Compare commits

...

733 Commits
v1.3.0 ... mcw

Author SHA1 Message Date
multicoreware
313e5b9292 Add README_RS
Change-Id: I046b97ce4badb0730283fd44206c9e920cbea290
2014-04-02 15:10:35 -07:00
Dmitry Kovalev
9c8b74f121 Merge "Moving y4m encoding functions into separate files." 2014-01-17 23:59:21 -08:00
Dmitry Kovalev
5088631410 Merge "Cleaning up vp9_picklpf.c file." 2014-01-17 18:19:06 -08:00
Yaowu Xu
829c3530be Merge "Change the vp8 END_USAGE typedef" 2014-01-17 17:04:32 -08:00
Dmitry Kovalev
5ab63583db Moving y4m encoding functions into separate files.
Change-Id: I03f614872167841515a74740d654c008b60104a4
2014-01-17 17:02:37 -08:00
hkuang
671df8486d Merge "Use a temp buffer for reconstruction when reference buffer is out of boarder." 2014-01-17 16:17:36 -08:00
hkuang
7459fee8c6 Use a temp buffer for reconstruction when
reference buffer is out of boarder.

Change-Id: Ic7ad136e54a4d68abe0fd4345146a86b0ba824e1
2014-01-17 16:15:54 -08:00
Dmitry Kovalev
2f4e6ee55d Cleaning up vp9_picklpf.c file.
Change-Id: Id54f317846f61a320cc5aeef47248e074376ee5d
2014-01-17 16:09:21 -08:00
Alex Converse
7e157467dc Merge "Fix output cropping in vp9_get_preview_raw_frame." 2014-01-17 15:49:06 -08:00
Dmitry Kovalev
c5b633975c Merge "Removing unused vp9_yv12_copy_partial_frame() function." 2014-01-17 15:43:02 -08:00
Deb Mukherjee
67fb3bf639 Change the vp8 END_USAGE typedef
Makes the END_USAGE typedef compatible with the vpxenc input

Change-Id: If784586fdb90a1e6f7badcb522ea9e93d4ddc030
2014-01-17 15:39:49 -08:00
Alex Converse
9c19953763 Fix output cropping in vp9_get_preview_raw_frame.
Handle the non-420 case and set uv_width.

This is needed to get the correct colorspace information out of
vp9e_get_preview().

Change-Id: I62ce118cd7082708d812deb0843c1be87582e0fe
2014-01-17 14:03:42 -08:00
Dmitry Kovalev
36ddfa9d00 Merge "Adding vpx_image_scale() function in vpxdec." 2014-01-17 12:56:58 -08:00
Dmitry Kovalev
50ca3c8324 Merge "Cleaning up vp9_refining_search_8p_c() function." 2014-01-17 12:36:00 -08:00
Dmitry Kovalev
3c054811bd Adding vpx_image_scale() function in vpxdec.
Change-Id: I29eaffff5089b26e8778a977c3b3da11800f1c49
2014-01-17 12:19:19 -08:00
Dmitry Kovalev
6f8b3039af Merge "Removing out_put() function from vpxdec.c." 2014-01-17 11:45:41 -08:00
Jingning Han
d100fb6139 Merge "Rename pick_sb_modes to rd_pick_sb_modes" 2014-01-17 10:58:26 -08:00
Jingning Han
8684b25955 Merge "Deprecate the use of best_mv in decoding process" 2014-01-17 10:58:00 -08:00
Dmitry Kovalev
cf46bc7bfe Removing out_put() function from vpxdec.c.
Adding two new functions: update_image_md5() and write_image_file().

Change-Id: Ic3e7e6ef08e70fb15ab021c92127872f29bcad9b
2014-01-17 10:57:55 -08:00
Alex Converse
8590276e7f Merge "Add Y4mVideoSource to be used with 4:4:4 tests." 2014-01-17 10:23:15 -08:00
Alex Converse
2bfafefb34 Merge "Fix key frames for one pass." 2014-01-17 10:22:59 -08:00
Dmitry Kovalev
ac40c87f68 Removing unused vp9_yv12_copy_partial_frame() function.
Change-Id: I3149e562fe9500914f67b6f908283edcdc381ac6
2014-01-16 18:16:34 -08:00
Jingning Han
98b01c038f Rename pick_sb_modes to rd_pick_sb_modes
Keep naming consistency for RD and non-RD mode decision functions,
respectively.

Change-Id: I904282b675fc511a46c13cb1f8287aa5d1c8ac94
2014-01-16 18:05:42 -08:00
Jingning Han
318e177f4a Deprecate the use of best_mv in decoding process
This commit removes the use of best_mv in the decoding process. This
variable can be replaced with nearest_mv. It saves a few cycles on
assigning the values for best_mv.

Change-Id: Ic183f9c1fb615c54efd7e6ccfedcf09d493435e4
2014-01-16 18:04:58 -08:00
Yunqing Wang
d2bb0c51d3 Revert "Revert "Revert "SSSE3 convolution optimization"""
This reverts commit f9404f2406.

This patch caused some ASAN error.

Change-Id: If15b7e581310e19061d111c69f2931809662ed19
2014-01-16 16:11:46 -08:00
Dmitry Kovalev
55d0230221 Cleaning up vp9_refining_search_8p_c() function.
Change-Id: Icf3b3dd96d7e133a4ad7260cd95288f6217998a6
2014-01-16 16:05:36 -08:00
Alex Converse
8a0b0a035a Add Y4mVideoSource to be used with 4:4:4 tests.
Change-Id: Ida3128e7e8a2ed333ac0b4ee92c23cb7dc1b7843
2014-01-16 15:23:08 -08:00
Jingning Han
013eba8ee8 Merge "Inter-frame non-RD mode decision" 2014-01-16 14:04:51 -08:00
Dmitry Kovalev
b0526522c1 Merge "Adding VP9 support to decode_to_md5 example." 2014-01-16 13:39:20 -08:00
Alex Converse
2b3891d9da Fix key frames for one pass.
Set this_key_frame_forced flag and don't use kf_boost when not set.

Change-Id: Ibe66a82fa9219e60db358ddeb43d6471816c8b50
2014-01-16 13:04:51 -08:00
Jingning Han
2f52decd22 Inter-frame non-RD mode decision
This commit setups a test framework for real-time coding. It enables
a light motion search for non-RD mode decision purpose.

Change-Id: I8bec656331539e963c2b685a70e43e0ae32a6e9d
2014-01-16 12:35:04 -08:00
Adrian Grange
6cd6349896 Merge "Fix printf formatting" 2014-01-16 11:02:55 -08:00
hkuang
2a2d8c140f Merge "Add vp9_tm_predictor_4x4 neon implementation" 2014-01-16 10:18:12 -08:00
Jim Bankoski
a5cb1b1ad5 Merge "don't dummy pack if we won't recode" 2014-01-16 08:21:03 -08:00
Tom Finegan
94bb09cab8 Merge "vpxenc: Warn on lagged encoding with real time." 2014-01-15 17:42:39 -08:00
Dmitry Kovalev
8f0d213494 Merge "Cleaning up reatectrl.c file." 2014-01-15 16:26:09 -08:00
Dmitry Kovalev
67e4ca2a1a Merge "Cleaning up postproc code." 2014-01-15 16:23:54 -08:00
Dmitry Kovalev
c1bce6b0aa Merge "Cleaning up ivf-related code." 2014-01-15 16:04:11 -08:00
Dmitry Kovalev
c37d54a93e Merge "Replacing cpi->rc with rc." 2014-01-15 16:04:05 -08:00
Jim Bankoski
3977e64fc7 don't dummy pack if we won't recode
Avoid packing the bitstream 2 times unless we need to.  For me this
at speed -5 was a 2% speed up.

Change-Id: I32205c98f55eedd4ff031ed5fb498c84bdaa855d
2014-01-15 15:30:13 -08:00
Dmitry Kovalev
df46372eee Cleaning up ivf-related code.
Change-Id: I80f3e197562f3424acddbff786a5d0d209fbd666
2014-01-15 15:10:12 -08:00
Yaowu Xu
056db03d17 Merge "Revert "Revert "SSSE3 convolution optimization""" 2014-01-15 15:03:25 -08:00
Dmitry Kovalev
3c11345211 Merge "Removing VP8_FOURCC_MASK & VP9_FOURCC_MASK." 2014-01-15 14:46:42 -08:00
Yaowu Xu
293532f314 Merge "Add max burst bitrate control." 2014-01-15 14:40:59 -08:00
Dmitry Kovalev
0f8787d6be Adding VP9 support to decode_to_md5 example.
This is still work in progress, there are many another planned updates
for all example files.

Change-Id: I2ba5dc6cd19a4bea9fbc6f1ee84cc2bd85925966
2014-01-15 14:38:27 -08:00
James Zern
2d8a954823 Merge "vpxenc: remove some warnings w/--disable-(vp8|vp9)" 2014-01-15 14:21:22 -08:00
Dmitry Kovalev
cccadd245c Removing VP8_FOURCC_MASK & VP9_FOURCC_MASK.
There is no reason to have fourcc masks, everything just works without
them.

Change-Id: I1d48100e7b7d5ef55ec49a708ba6adcb9ab4ecd8
2014-01-15 14:01:38 -08:00
Deb Mukherjee
8ce5f68fe4 Merge "Rearranges the END_USAGE typedef" 2014-01-15 14:01:30 -08:00
Adrian Grange
a22b834eae Merge "Delete outdated comment & tidy-up others" 2014-01-15 13:55:14 -08:00
Dmitry Kovalev
d39485a776 Merge "calculate_modified_err() cleanup." 2014-01-15 12:56:32 -08:00
Dmitry Kovalev
2123c5d65c Merge "Removing VpxInputContext dependency from {ivf, raw}_read_frame()." 2014-01-15 12:56:05 -08:00
Dmitry Kovalev
b7465b3efb Replacing cpi->rc with rc.
Change-Id: I0fbb7615545861e26ebffe72bd44f3a0e8616df7
2014-01-15 12:46:18 -08:00
Dmitry Kovalev
8b5133fc4c Merge "Removing unused calc_partial_ssl_err() function." 2014-01-15 12:24:06 -08:00
Dmitry Kovalev
efdbd29928 calculate_modified_err() cleanup.
Change-Id: Ia24c9b1ff2d51dd9cb133722a041a615e1b8419f
2014-01-15 12:23:16 -08:00
Jim Bankoski
ae5b96d355 Merge "As you go mbmi->skip_coeff" 2014-01-15 12:20:14 -08:00
Dmitry Kovalev
a26899ada5 Merge "Removing intra_mode_stats." 2014-01-15 12:16:50 -08:00
Dmitry Kovalev
f1cf405815 Merge "Removing pass number check from ivf_write_file_header()." 2014-01-15 12:15:48 -08:00
hkuang
f2ef389256 Add vp9_tm_predictor_4x4 neon implementation
Change-Id: I10c423bde7ea5a3bac9f14f35c73b6bc31c8f3e3
2014-01-15 11:51:36 -08:00
Jim Bankoski
9adcc4d681 Merge "Save ~30% off tokenize_b" 2014-01-15 10:59:49 -08:00
Deb Mukherjee
f32106951a Rearranges the END_USAGE typedef
Rearranges the END_USAGE typedef to make it compatible with the
vpx user input.

Change-Id: Ic9fa9e9edbee7c0ad01e12e685b219582fcecd16
2014-01-15 10:10:23 -08:00
Adrian Grange
7a203301b7 Fix printf formatting
Change-Id: I37c5d6f4a0f09d48d3ee31eecdb68dfa11d30bd3
2014-01-15 09:58:01 -08:00
Adrian Grange
c3011e6f90 Delete outdated comment & tidy-up others
Change-Id: I83031180723ee59270ec8fb66b2f73c0796bee25
2014-01-15 09:53:03 -08:00
Dmitry Kovalev
69b684279c Merge "Cleaning up vp9_rdopt.c." 2014-01-15 00:00:33 -08:00
James Zern
5248d7111e vpxenc: remove some warnings w/--disable-(vp8|vp9)
group vp8/vp9 only options under CONFIG_*_ENCODER

Change-Id: I331bb154df019b398780be6451355de50657a33e
2014-01-14 18:22:01 -08:00
Tom Finegan
150fbfc7b6 vpxenc: Warn on lagged encoding with real time.
Restore warning when attempting to use lagged encoding with real time mode.

Change-Id: I109026db64566906f288f42d2686084ae5c13500
2014-01-14 18:15:21 -08:00
Jim Bankoski
73cd22f8d4 As you go mbmi->skip_coeff
Calculate the skip_coeff as part of the encode process, rather than
checking the eobs after the fact with another pass.

Change-Id: Ib41b139e96a97dee30e4b993b4cc53d86337128d
2014-01-14 17:58:25 -08:00
Dmitry Kovalev
433e5ea0e8 Fixing invalid block width/height calculation.
Change-Id: Ieaeb53902ce0ffd5b1b27a92583e98abfa791433
2014-01-14 17:53:32 -08:00
Dmitry Kovalev
70fe826d26 Cleaning up vp9_rdopt.c.
Change-Id: I5200bf68b43578eaadc4ea47b37f2633fa96d7bd
2014-01-14 17:46:14 -08:00
Dmitry Kovalev
a540f8a0b0 Cleaning up postproc code.
Change-Id: I7e53f6345a4cf89309262f50850c9ad08ed3c527
2014-01-14 15:49:19 -08:00
Jim Bankoski
da94b9be81 Save ~30% off tokenize_b
Refactoring for speed in the same vein as detokenize_b...

Change-Id: I90779aa46e3b13c22ddce9a42b60e1920ad97142
2014-01-14 15:19:43 -08:00
Dmitry Kovalev
f13b3d1e08 Merge "Making motion search code more compact." 2014-01-14 15:12:43 -08:00
Dmitry Kovalev
497b6a633d Merge "Cleaning up md5 example." 2014-01-14 15:10:27 -08:00
Dmitry Kovalev
382470db42 Merge "Removing unnecessary casts + cleanup." 2014-01-14 14:47:48 -08:00
Dmitry Kovalev
970e945795 Merge changes I8eda5762,Ia2ffca07
* changes:
  Removing unused switchable_interp_count[] field from VP9_COMP.
  Using clamp() function instead of the same raw code.
2014-01-14 14:46:07 -08:00
Dmitry Kovalev
b53113c3ca Merge "Removing unused error_bins[] field from VP9_COMP." 2014-01-14 14:45:17 -08:00
Dmitry Kovalev
a8bb1ffd89 Merge "Reusing get_frame_new_buffer() function." 2014-01-14 14:40:48 -08:00
Dmitry Kovalev
f3728f20ea Merge "Cleaning up vp9_encodeframe.c." 2014-01-14 14:14:49 -08:00
Dmitry Kovalev
7da6422d63 Merge "Adding get_vp9_ref_frame_buffer() function." 2014-01-14 14:12:45 -08:00
Dmitry Kovalev
518a934f43 Merge "Converting int_mv to MV." 2014-01-14 14:11:49 -08:00
Deb Mukherjee
fc43938d5e Merge "Minor fix on an assert" 2014-01-14 13:57:17 -08:00
Deb Mukherjee
1699d6bd53 Minor fix on an assert
Fixes assert that fails occasionally on small values of
max-key frame intervals. Also, adds a small change on
updating frames_to_key for frame drops.

Change-Id: Icc2b33b25e3e4ced7e49f8db73e0a887ef9c99e0
2014-01-14 12:51:13 -08:00
Adrian Grange
903ba1a1ab Merge "Change the strategy for deciding the display size" 2014-01-14 07:52:37 -08:00
Paul Wilkins
5c808ba13a Add max burst bitrate control.
Applies an upper limit on burst bitrate for any
frame. This is to insure that typical encodes for YT
do not produce frames that are so large that they
risk stalling HW implementations. Such frames
could also cause playback problems in SW.

For now the limit is set at 250 bits per MB for 1080P
and larger (with the 1080P limit used for smaller frames).

Setting maxQ, constant quality mode or targeting a
very high bandwidth will have precedence over this limit.

Change-Id: Ie6f776c38b06ac7cec043d034085f4b79ee46a38
2014-01-14 09:52:49 +00:00
Yaowu Xu
4f2a80f05f Merge "fix a div by zero issue" 2014-01-13 18:04:30 -08:00
Dmitry Kovalev
a8a5774ba9 Removing unused error_bins[] field from VP9_COMP.
Change-Id: I883eb9026b44cb354d5b01c0f1d34ecd71f942e4
2014-01-13 16:33:16 -08:00
Dmitry Kovalev
0a74236bd4 Removing unused switchable_interp_count[] field from VP9_COMP.
Change-Id: I8eda5762728d981ab7757388741b598c665c26ca
2014-01-13 16:30:40 -08:00
Dmitry Kovalev
46a951c846 Using clamp() function instead of the same raw code.
Change-Id: Ia2ffca072f5391b277ce1a0c4e5b4ece9ffc6831
2014-01-13 16:27:50 -08:00
Dmitry Kovalev
80aae67f44 Making motion search code more compact.
Change-Id: I04d6a006eaf2676f2d8d1d96b87f69e081969382
2014-01-13 15:24:06 -08:00
Dmitry Kovalev
096ab11012 Removing pass number check from ivf_write_file_header().
Putting appropriate check to open_output_file() and close_output_file().
Before that the output file has been opened twice during two-pass encoding.

Change-Id: I290cecf00513d6a31ca3f45bc20fef7efcb10190
2014-01-13 15:21:48 -08:00
Dmitry Kovalev
9855b6e510 Reusing get_frame_new_buffer() function.
Change-Id: Iac5c5aeaef62a4095a60d91285d2c7ad717db0fb
2014-01-13 14:04:56 -08:00
Dmitry Kovalev
887984479c Removing unnecessary casts + cleanup.
Change-Id: I7298087426977e36b61ecf493949e9412842254c
2014-01-13 13:04:05 -08:00
Yunqing Wang
f9404f2406 Revert "Revert "SSSE3 convolution optimization""
This reverts commit b645257121.

Change-Id: I60d1bf57ae8e9eb6127f42f2d5a780124ac51b45
2014-01-13 12:29:55 -08:00
Dmitry Kovalev
dd31f2e4ae Merge "Adding mv_has_subpel() function." 2014-01-13 12:00:51 -08:00
Dmitry Kovalev
0eac753dc0 Removing VpxInputContext dependency from {ivf, raw}_read_frame().
File type check inside ivf_read_frame() is not necessary (it is done
before this function get called).

Change-Id: Iede8feb358d25878b340473d85c3b01d701fc624
2014-01-13 11:57:55 -08:00
Adrian Grange
482c39c0e9 Change the strategy for deciding the display size
There are three contributors to the definition of how the
display size is set:

(1) display width/height set in the container.
(2) display size (optional in the frame header)
(3) decoded frame size (from the frame header)

This patch modifies the way that vpxdec defines the display
size to give preference to these three criteria in the order
given above. If the container sets a non-zero size, it is
used, otherwise the display size specified in the first
decoded frame is used (if specified), with the raw
decoded frame size of the first frame used as a last resort.

The display size set in frames other than the first is
always ignored in this implementation.

Change-Id: I7e98d817d3f5894d559dd2aeb0a6cb1959b9092b
2014-01-13 11:48:47 -08:00
Dmitry Kovalev
9c9fdf30e6 Merge "Adding raw_read_frame() function to vpxdec." 2014-01-13 11:46:01 -08:00
Dmitry Kovalev
b9592fa0b3 Removing intra_mode_stats.
Change-Id: I6e0895f7f826b484ac86945e6abe3a706a6b0399
2014-01-13 11:40:33 -08:00
Dmitry Kovalev
62a2c2b15b Removing unused calc_partial_ssl_err() function.
Change-Id: Iad8b0208d3a3b0fc3d7fda3933b0fc007d4d2e9e
2014-01-13 11:26:16 -08:00
James Zern
ff0d073d88 Merge "test_libvpx: fix negative CPU filter" 2014-01-13 11:25:59 -08:00
Dmitry Kovalev
2033ac49b4 Converting int_mv to MV.
Change-Id: Id31c0e100d275bd3650eaf5e4b8fe5ce648dbfaf
2014-01-13 11:21:07 -08:00
Dmitry Kovalev
4ae8ac7be8 Merge "Cleaning up and fixing psnr calculation code." 2014-01-13 10:59:26 -08:00
Dmitry Kovalev
b02c72b5d9 Adding mv_has_subpel() function.
Change-Id: I50922bb1a689f8515debaa018f850b231c21189f
2014-01-13 10:57:56 -08:00
Dmitry Kovalev
f0fde24379 Adding raw_read_frame() function to vpxdec.
Change-Id: Ie2a4606daf35b327d6f2ac8d7fd8f6cacf4c5b6a
2014-01-13 10:54:57 -08:00
Yaowu Xu
6fcabdd20c Merge "Enable reference frame masking for rt mode" 2014-01-13 10:52:00 -08:00
Yaowu Xu
31d3f43e18 fix a div by zero issue
Change-Id: I091dfaa0ed5b9672eedd46d6097469d0802e24ef
2014-01-13 10:44:32 -08:00
Yaowu Xu
5e5d4c0ea7 Enable reference frame masking for rt mode
Reference frame masking helped good quality mode to gain about 5% in
encoding speed, this commit enable it for rt mode to gain the speed
improvement.

In addition, this commit move the speed feature setup to a separate
function.

Change-Id: I015e8f78bbb21dd43ae183b9b9355bea2ccda9c5
2014-01-13 10:06:17 -08:00
Johann
7c52a3a25b Merge "mips dsp-ase r2 vp9 decoder fixed bug in extend frame module (seg fault)" 2014-01-13 09:22:15 -08:00
Paul Wilkins
a00dad39bd No arf right before real scene cut.
To reduce pulsing we now allow an arf just before forced key frames
and at the end of a clip or section (which may be stitched to
another clip or section). However, this does not make sense for
key frames arising from real scene cuts.

Change from original patch reflects other recent changes in regard
to alignment of gf/arf and kf groups.

Change-Id: I074a91d1207e9b3e28085af982f6718aa599775f
2014-01-13 11:35:02 +00:00
Paul Wilkins
603075fa04 Further rate control tweaks and fixes.
Further fixes regarding min and max rate.
Bug fixes re kf group bits and last kf group.

Change-Id: Iaafd719d30a489e135a3c55851ce8c632091a436
2014-01-13 11:34:34 +00:00
Parag Salasakar
59fa8cfd5f mips dsp-ase r2 vp9 decoder fixed bug in extend frame module (seg fault)
Change-Id: Ic46da8897d2fb5351e22d6d74805fd9d78c81b32
2014-01-13 14:44:18 +05:30
James Zern
f83c12b540 Merge "cosmetics: vp9_reconinter.h: make some variables const" 2014-01-11 12:39:32 -08:00
James Zern
01236769ab Merge "datarate_test: fix some type conversions" 2014-01-11 12:38:36 -08:00
James Zern
ada9dd7d84 test_libvpx: fix negative CPU filter
negative patterns begin with _one_ '-', not one before each pattern.

https://code.google.com/p/googletest/wiki/V1_7_AdvancedGuide#Running_a_Subset_of_the_Tests

Change-Id: I6fd527b31bc2571dfdaa453cbbb57c77b3409563
2014-01-10 19:08:44 -08:00
Dmitry Kovalev
d2c1e8a5a5 Cleaning up reatectrl.c file.
Adding temp variable for &cpi->rc.

Change-Id: Id9a658659354c12e1940532ff85311ce89071b2f
2014-01-10 17:44:33 -08:00
Johann
2c60f87506 Merge "Apply neon flags to intrinsic files" 2014-01-10 17:04:56 -08:00
Dmitry Kovalev
ca677a3859 Merge "Cleaning up vp9_rc_postencode_update() function." 2014-01-10 16:53:35 -08:00
Dmitry Kovalev
4def0a8125 Cleaning up and fixing psnr calculation code.
Introducing calc_psnr() which calculates psnr between two yv12 buffers.
Previously we incorrectly used width/height instead of
crop_width/crop_height to calculate number of samples -- fixed.

Change-Id: Iecda01980555de55ad347e0276e6641c793fa56c
2014-01-10 16:09:56 -08:00
Dmitry Kovalev
6ed59ecc8a Merge "Cleaning up vp9_dx_iface.c." 2014-01-10 16:01:54 -08:00
Jingning Han
29736b889b Merge "Declare setup_buffer_inter in vp9_rdopt.h" 2014-01-10 16:01:07 -08:00
Jingning Han
4f969ccc1b Merge "Enable skipping reference frame check in rd loop" 2014-01-10 16:00:56 -08:00
Dmitry Kovalev
aea2864471 Merge "Removing mi_height_log2_lookup table." 2014-01-10 16:00:56 -08:00
Dmitry Kovalev
a31dd326ea Cleaning up md5 example.
Change-Id: Ifee528b1663b10dbe45e0bfef79010370c914e3a
2014-01-10 14:50:58 -08:00
Jim Bankoski
6439aa5a0e explain speed features
Added comments to explain what the various speed features do, and removed
1 that was clearly unused.

Change-Id: Icd37a536072ddafedbfaefcecbe48979f6d10faf
2014-01-10 14:10:34 -08:00
Jingning Han
db2b350d33 Declare setup_buffer_inter in vp9_rdopt.h
This funtion initializes buffer pointers and first stage motion vector
prediction. It will be needed by both regular rate-distortion
optimization loop and the non-RD mode decision. Hence move its
declaration in vp9_rdopt.h

Change-Id: I64e8b6316c9d05f20756a62721533a2e4d158235
2014-01-10 13:52:40 -08:00
Dmitry Kovalev
3df5c54ad7 Cleaning up vp9_encodeframe.c.
Change-Id: I6d9f595249dc71752abe16c042d3b07aa2e4248d
2014-01-10 13:48:44 -08:00
Dmitry Kovalev
96be0a50ab Removing mi_height_log2_lookup table.
Change-Id: I1f0ae2edc3a96b33c0494d165ae756a8feba6184
2014-01-10 13:29:47 -08:00
Johann
dadf350551 Apply neon flags to intrinsic files
Filter out files ending in _neon.c and append .neon so the Android build
system knows to apply -mfpu=neon

Change-Id: Ib67277e5920bfcaeda7c4aa16cd1001b11d59305
2014-01-10 12:16:59 -08:00
Dmitry Kovalev
804a155d64 Adding get_vp9_ref_frame_buffer() function.
Change-Id: Iae195fcf952dd27ba424f8e95090b8ffc4d5a7c8
2014-01-10 11:59:38 -08:00
Marco Paniconi
21a0c1f38f Merge "Don't use gf_update by default for 1-pass CBR." 2014-01-10 11:43:20 -08:00
Dmitry Kovalev
21ededd4f4 Cleaning up vp9_dx_iface.c.
Change-Id: I6a0dfb95c55ee6cadc7b1675782c7830e5c7caaf
2014-01-10 11:01:52 -08:00
hkuang
b5af9d2905 Merge "Fix Issue #679: vp9 C loop filter produces valgrind warning." 2014-01-10 10:59:00 -08:00
Dmitry Kovalev
447eece329 Cleaning up vp9_rc_postencode_update() function.
Change-Id: I02e44c10660fdb9201a802ad19ceb64756feeebe
2014-01-10 10:44:20 -08:00
Marco Paniconi
c46538d45e Don't use gf_update by default for 1-pass CBR.
Change-Id: I5df6abceb0a2a69706feadeb820b593cae88f573
2014-01-10 10:40:12 -08:00
Dmitry Kovalev
ed364b2114 Merge "Adding {get, set}_rate_correction_factor() functions." 2014-01-10 10:30:04 -08:00
hkuang
66c6f7bf61 Fix Issue #679: vp9 C loop filter produces valgrind warning.
Fix the valgrind error due to access uninitialized
memory in loopfilter.

Change-Id: I52fccf5ede845ee1f4c13d3bd909b8f220c0bdff
2014-01-10 10:24:21 -08:00
Marco Paniconi
a260369aa8 Merge "Keep buffer clipped to maximum in change_config." 2014-01-10 09:33:33 -08:00
Paul Wilkins
b645257121 Revert "SSSE3 convolution optimization"
This reverts commit 511d218c60.

In current form intrinsics break borg build.

Change-Id: Ied37936af841250ecff449802e69a3d3761c91b9
2014-01-10 13:38:26 +00:00
Jingning Han
d66c748635 Enable skipping reference frame check in rd loop
This commit allows encoder to compare the SAD cost associated with
the best motion vector predictor, per frame. If one reference frame
has this cost more than 4 times of the best SAD cost given by other
reference frames, skip NEARESTMV, NEARMV, ZEROMV mode check of this
reference frame.

This setting is turned on in speed 2 and above. Compression quality
change in speed 2:
derf  -0.014%
yt    -0.097%
hd    -0.023%
stdhd  0.046%

It reduces the speed 2 runtime of test sequences:
pedestrian_area_1080p 4000 kbps 310763 ms -> 303595 ms
bluesky_1080p 6000 kbps         259852 ms -> 251920 ms

Change-Id: I7f59cf79503d51836d61d56d50dc5bdf0e502e22
2014-01-09 18:25:53 -08:00
Jingning Han
a4c94a94cc Merge "Optimze inv 16x16 DCT with 10 non-zero coeffs - P2" 2014-01-09 18:17:25 -08:00
Jingning Han
faa2ba86cc Merge "Optimze inv 16x16 DCT with 10 non-zero coeffs - P1" 2014-01-09 18:17:12 -08:00
Deb Mukherjee
36c8daed58 Merge "Cleanups on refresh flags" 2014-01-09 17:38:45 -08:00
Deb Mukherjee
412e4954c1 Cleanups on refresh flags
Cleanups on frame refresh flags and external overrides.

Change-Id: Ia6a56fe1bde906b1dc3fcbf4ef1c7b207cd2df2d
2014-01-09 17:00:23 -08:00
Johann
e8192cf633 Merge "Use the correct member for initialization" 2014-01-09 15:21:19 -08:00
Yaowu Xu
b1d81e19d8 Merge "Simplify set_rt_speed_feature()" 2014-01-09 15:02:24 -08:00
Marco Paniconi
193fa5c8ba Keep buffer clipped to maximum in change_config.
Under a configuration change, where the bitrate suddenly decreases,
the buffer level may be larger than maximum allowed (for that first frame to be encoded after change_config).
This change keeps it clipped to its maximum level.

Change-Id: I4d0b5b3d1fd8148600dd39e02bd630c9464baba5
2014-01-09 14:33:40 -08:00
Dmitry Kovalev
c8e8d3a461 Merge "Renaming 'Sharpness' to 'sharpness'." 2014-01-09 13:42:55 -08:00
Yaowu Xu
2d381d76d8 Simplify set_rt_speed_feature()
1. Made speed choices to be progressive
2. Adjusted rt speed settings to achieve better speed/quality

Overall, rt-5 gained 2.5% in compression/quality, encoding time of 720p
niklas clip goes from 137,052ms to 121,874ms

Change-Id: Ia6e7e1e15225395a868a2f1059c3db8e266e1600
2014-01-09 13:02:15 -08:00
Jingning Han
af31b27aae Optimze inv 16x16 DCT with 10 non-zero coeffs - P2
This commit further optimizes SSE2 operations in the second 1-D
inverse 16x16 DCT, with (<10) non-zero coefficients. The average
runtime of this module goes down from 779 cycles -> 725 cycles.

Change-Id: Iac31b123640d9b1e8f906e770702936b71f0ba7f
2014-01-09 12:46:09 -08:00
Yunqing Wang
f3b9b97c0e Merge "SSSE3 convolution optimization" 2014-01-09 12:39:47 -08:00
levytamar82
511d218c60 SSSE3 convolution optimization
Optimizing all SSSE3 assembly for convolution:
1. vp9_filter_block1d4_h8_sse2
2. vp9_filter_block1d8_h8_sse2
3. vp9_filter_block1d16_h8_sse2
4. vp9_filter_block1d4_v8_sse2
5. vp9_filter_block1d8_v8_sse2
6. vp9_filter_block1d16_v8_sse2
my optimization include:
-processing 2x8 elements in one 128 bit register instead of processing
8 elements in one 128 bit register.
-removing unecessary loads.
This optimization gives between 2.4% user level gain for 480p input
and 1.6% user level gain for 720p.
This Optimization done only for 64bit.

Change-Id: Icb586dc0c938b56699864fcee6c52fd43b36b969
2014-01-09 12:27:51 -07:00
Dmitry Kovalev
6d812d6f24 Merge "Removing examples code generation and making them static." 2014-01-09 11:15:46 -08:00
Dmitry Kovalev
42647fc9fe Merge "Using VP9_COMMON instead of VP9_COMP." 2014-01-09 11:15:29 -08:00
Johann
c8a2aaa7e7 Merge "VP8 for ARMv8 by using NEON intrinsics 01" 2014-01-09 10:39:05 -08:00
James Yu
79395e16cf VP8 for ARMv8 by using NEON intrinsics 01
Add bilinearpredict_neon_intrinsics.c
- vp8_bilinear_predict4x4_neon
- vp8_bilinear_predict8x4_neon
- vp8_bilinear_predict8x8_neon
- vp8_bilinear_predict16x16_neon

Change-Id: I33dfa502881219841b442dda32b73220e51b716b
Signed-off-by: James Yu <james.yu@linaro.org>
2014-01-09 09:56:22 -08:00
Paul Wilkins
11569060f4 Merge "Fix rate allocation bug." 2014-01-09 03:00:15 -08:00
Johann
719dadf3ef Use the correct member for initialization
On Windows this fails with:
error C2440: 'initializing': cannot convert from int_mv to uint32_t

Change-Id: I51630efd0e83a0ce620c91aa7859dd6fc1572e99
2014-01-08 19:31:24 -08:00
Dmitry Kovalev
b16fac42d4 Using VP9_COMMON instead of VP9_COMP.
Change-Id: If7d3958653104f3e170853e931f8489de3ecf3cc
2014-01-08 18:36:38 -08:00
Dmitry Kovalev
d606bf93ef Merge "Removing direct references to {lst_fb, gld_fb, alt_fb}_idx fields." 2014-01-08 18:12:09 -08:00
Johann
67ad03acc3 Merge "Install test sources for MSVS" 2014-01-08 17:59:30 -08:00
Dmitry Kovalev
feaad4f133 Merge "Cleanups around cpi->common." 2014-01-08 17:48:28 -08:00
Dmitry Kovalev
c01fe86ccc Adding {get, set}_rate_correction_factor() functions.
Change-Id: Ib3212832953a3445fc5f021af0e1de7886f09b4f
2014-01-08 17:40:35 -08:00
Dmitry Kovalev
4fbe54d201 Merge "Renaming 'Mode' to 'mode'." 2014-01-08 16:29:29 -08:00
Johann
0239f11482 Install test sources for MSVS
Move the code outside the conditions. The test sources themselves are
also required for Visual Studio.

Change-Id: Id5e93ebc7369e1807eba0b9dc4f7d0f18033d794
2014-01-08 15:45:14 -08:00
Jingning Han
ba6ab46cdc Optimze inv 16x16 DCT with 10 non-zero coeffs - P1
This commit is the first patch optimizing SSE2 implementation of inverse
16x16 DCT with <10 non-zero coefficients. It focused on the first 1-D (row)
transformation. It exploits the fact that only top-left 4x4 block contains
non-zero coefficients, in a 2-D inverse 16x16 DCT with <10 coeffients.

The average runtime of idct16x16_10 unit is reduced from
883 cycles -> 779 cycles (12% faster).

For pedestrian_area_1080p 300 frames at 4000 kbps, the speed 2 runtime goes
down from 310651 ms  -> 305910 ms. The decoding speed goes up from
80.37 fps -> 80.87 fps.

Change-Id: Ic6f3ac5a637a76c07ba73ddaafe318a699fea645
2014-01-08 15:36:45 -08:00
Dmitry Kovalev
510a828256 Removing direct references to {lst_fb, gld_fb, alt_fb}_idx fields.
Change-Id: Ib1d9628d2b538b6dc27b0db1fa7f40f70ff2072f
2014-01-08 15:21:41 -08:00
Dmitry Kovalev
0ecd583d8d Cleanups around cpi->common.
Change-Id: I0c42a729038d0f4cb7bc07f587d066fcb1dfe9d9
2014-01-08 14:51:00 -08:00
Alex Converse
8fcb74e6bb Merge "Add a C fallback for get_msb() and change inline to INLINE." 2014-01-08 14:43:46 -08:00
hkuang
5be0ed30dc Merge "Add initial intra frame neon optimization. 1~2% gain." 2014-01-08 14:41:43 -08:00
Dmitry Kovalev
962c8b241e Renaming 'Mode' to 'mode'.
Change-Id: I6cdd670d66288dbd66228f38bba6b30502d25362
2014-01-08 14:33:59 -08:00
Dmitry Kovalev
57be81369a Renaming 'Sharpness' to 'sharpness'.
Change-Id: I54513dc3b3321e0c0bb6b15ea5c34085ed80b4a4
2014-01-08 14:19:14 -08:00
Dmitry Kovalev
feab7e1146 Merge "Using struct twopass_rc* instead of VP9_COMP*." 2014-01-08 14:14:05 -08:00
Alex Converse
ce7ff3b63d Add a C fallback for get_msb() and change inline to INLINE.
For systems without __builtin_clz() or _BitScanReverse(), taken from libwep

Change-Id: Iead257efc1772c466c79e1dc0356ed571d38d43e
2014-01-08 12:25:47 -08:00
hkuang
691111aacf Add initial intra frame neon optimization. 1~2% gain.
More intra optimizations will be added.

Change-Id: I33ae8d93f6002bf7b64cc2669602d9e6bfa5a6e8
2014-01-08 11:58:42 -08:00
Yunqing Wang
a84029ad9c Merge "AVX2 Variance Optimization" 2014-01-08 11:33:42 -08:00
Johann
af72081818 Merge "Include gen_msvs_vcxproj.sh" 2014-01-08 11:10:03 -08:00
Alex Converse
22d83a0ab7 Merge "Replace RD modeling with a fixed point approximation." 2014-01-08 11:06:54 -08:00
levytamar82
357b65369f AVX2 Variance Optimization
Optimizing the variance functions: vp9_variance16x16, vp9_variance32x32,
vp9_variance64x64, vp9_variance32x16, vp9_variance64x32,
vp9_mse16x16 by migrating to AVX2
some of the functions were optimized by processing 32 elements instead of 16.
some of the functions were optimized by processing 2 loop strides of 16
elements in a single 256 bit register
This optimization gives between 2.4% - 2.7% user level performance gain
and 42% function level gain.

Change-Id: I265ae08a2b0196057a224a86450153ef3aebd85d
2014-01-08 12:05:53 -07:00
Alex Converse
f2ca665f1c Replace RD modeling with a fixed point approximation.
Change-Id: I44eb44eb3f36c05d916ef140ef42cc84f72f99ec
2014-01-08 10:37:24 -08:00
Jingning Han
aa9552b0b5 Merge "Fix an issue in motion vector prediction stage" 2014-01-08 10:06:03 -08:00
Johann
87784e3a99 Include gen_msvs_vcxproj.sh
Change-Id: I28e9cf9347acd7279df3b841863a248479633265
2014-01-08 09:51:15 -08:00
Deb Mukherjee
0d21d79bbc Merge "Further rate control cleanups" 2014-01-08 09:20:29 -08:00
Johann
7d4083a8da Merge "Remove yasm.rules dependency" 2014-01-08 08:42:25 -08:00
Paul Wilkins
d7b49b28e6 Fix rate allocation bug.
Fix miss alignment of the frames contributing to the
error score and bit allocation for gf/arf groups.

Initial results slightly +.

Change-Id: Ie508bdcfdac52e592d48e1f13e01b3551b523deb
2014-01-08 15:30:13 +00:00
Dmitry Kovalev
50fa58592b Removing examples code generation and making them static.
All documentation will be provided as comments in the source files.

Change-Id: Ie609852747733c181191f864204c787a6b23ef3a
2014-01-07 15:15:25 -08:00
Deb Mukherjee
730ade414d Further rate control cleanups
Some cleanups on frames_to_key, frames_since_key.
Also removes the unused fixed_q parameters in vp9.

Change-Id: If8743a32c71de30a8d17136477b53d607a7acda8
2014-01-07 13:51:50 -08:00
Jingning Han
06e4f825af Fix an issue in motion vector prediction stage
The previous implementation stops motion vector prediction test when
the zero motion vector appears for the second time. This commit fixes
it by simply skipping the second time check on zero mv and continuing
on to next mv candidate.

It slightly improves stdhd in speed 2 by 0.06% on average. Most static
sequences are not affected. A few hard ones, like jet, ped, and riverbed
were improved by 0.1 - 0.2%.

Change-Id: Ia8d4e2ffb7136669e8ad1fb24ea6e8fdd6b9a3c1
2014-01-07 10:18:04 -08:00
Jingning Han
fdad4fd226 Remove deprecated variable from rt_speed_feature
This resolves a merge error.

Change-Id: Ifb83acc0a08e80c82f7624f9c86f79d3a86cc871
2014-01-07 10:15:51 -08:00
Dmitry Kovalev
16f5607dfe Merge "Adding new_mv local variable." 2014-01-07 09:56:41 -08:00
Dmitry Kovalev
7b496783c2 Merge "Adding get_ref_frame_buffer() function." 2014-01-07 09:56:06 -08:00
Dmitry Kovalev
b3af2f87b0 Merge "Removing unused mvp_fill manipulation code." 2014-01-07 09:54:05 -08:00
Jingning Han
656166ea81 Merge "Remove avoid_frame_with_high_error from RD loop" 2014-01-07 09:31:17 -08:00
Dmitry Kovalev
9e18cf70db Merge "Reusing ROUND_POWER_OF_TWO macro." 2014-01-07 02:40:02 -08:00
Paul Wilkins
e4e58ac400 Merge "Clean up: unused function and variables" 2014-01-07 02:27:20 -08:00
Dmitry Kovalev
6a7a7341ee Removing unused mvp_fill manipulation code.
The code can be removed because mvp_full will be overridden after that.

Change-Id: I89559b1b6914c86bcd02b7359d37241948ac11d3
2014-01-06 18:07:12 -08:00
Dmitry Kovalev
8e6583b1a2 Merge "Replacing &cpi->common with cm." 2014-01-06 17:58:26 -08:00
Dmitry Kovalev
c015ba5f6e Adding new_mv local variable.
Change-Id: I9631b35810c232c134f39dc0edadb1b3860a45ae
2014-01-06 17:58:01 -08:00
Dmitry Kovalev
ff655420b5 Reusing ROUND_POWER_OF_TWO macro.
Change-Id: I064ba32d5358bfbf080a4300fc1793b345080006
2014-01-06 17:38:57 -08:00
Dmitry Kovalev
abe4940d64 Replacing &cpi->common with cm.
Change-Id: Ic5bf5682ccdb8d2fbad6bba0d7db19a4f47b62a1
2014-01-06 17:29:16 -08:00
Alex Converse
7900c80e5a Merge "Fix encoding Raw yv12 and i420 from a pipe." 2014-01-06 17:22:21 -08:00
Marco Paniconi
166d8142ac Merge "Code cleanup: remove unneeded lines." 2014-01-06 16:35:52 -08:00
Alex Converse
64b89f1b4b Fix encoding Raw yv12 and i420 from a pipe.
rewind() does not work on pipes.

https://code.google.com/p/webm/issues/detail?id=678

Change-Id: I057f1e25c3f5662012d6e33ff4c97c88f50df357
2014-01-06 16:31:09 -08:00
Yaowu Xu
9aa16eecd0 Merge "Added placeholder for real time mode" 2014-01-06 16:26:57 -08:00
Marco Paniconi
3817c7c732 Code cleanup: remove unneeded lines.
Change-Id: I44a89b822a436299b9dd4ff26ad2e35767c29c58
2014-01-06 16:04:48 -08:00
Charles 'Buck' Krasic
11660c6b38 Merge "Write correct resolution to the IVF file header (b/11270652)" 2014-01-06 15:18:04 -08:00
Johann
195a085253 Remove yasm.rules dependency
The file was removed by 9152f4851d after
the solution files were changed.

Change-Id: I868c56fd609f45fb3e21afd085b9e6c268aac038
2014-01-06 15:12:42 -08:00
Dmitry Kovalev
a224b0dded Merge "Combining ref_frame and second_ref_frame into ref_frames[2]." 2014-01-06 15:02:31 -08:00
Dmitry Kovalev
29199efd57 Merge "Moving reset_segment_features() to encoder/vp9_segmentation.h." 2014-01-06 15:01:54 -08:00
Dmitry Kovalev
7919bf6afd Adding get_ref_frame_buffer() function.
Encapsulating direct references to lst_fb_idx, gld_fb_idx, alt_fb_idx.

Change-Id: I7e65ba3f131286e433e6651970c5647311fa4687
2014-01-06 14:50:54 -08:00
Dmitry Kovalev
bbb25e6a39 Merge "Adding RefBuffer struct." 2014-01-06 14:19:44 -08:00
Charles 'Buck' Krasic
8aa33ed6b1 Write correct resolution to the IVF file header (b/11270652)
also:
 o remove dead code, create_dummy_frame
 o Fix a bug in command line handling that caused a segfault if wrong
   number of arguments were given.

Change-Id: I78f026aee4e363967b750e6cde0982659c558a1f
2014-01-06 14:18:38 -08:00
Jingning Han
393a8ccef9 Remove avoid_frame_with_high_error from RD loop
The feature undergoes prior assumption that the recursive partition
size search from 4x4 to 64x64, hence utilizing information from small
blocks to determine early termination in large block rate-distortion
optimization search. The current codebase is now going from top down.
The previous function might go with not properly initialized values,
hence removed.

Tested on pedestrian_area_1080p at 4000 kbps running under speed 2.
No visible difference in runtime observed.

Change-Id: I553df415c6191413762db7ae34e8790c71d8118e
2014-01-06 13:34:07 -08:00
Dmitry Kovalev
b57b82b5d6 Using struct twopass_rc* instead of VP9_COMP*.
Change-Id: Id9ff7772aa3a3fb5d6cf94aff7dc9489bd964340
2014-01-06 12:46:23 -08:00
Dmitry Kovalev
6b150c2884 Combining ref_frame and second_ref_frame into ref_frames[2].
Change-Id: I007d66a1cb1b44751dcceafbaa64649ed9a34562
2014-01-06 12:24:37 -08:00
Deb Mukherjee
f73b21439d Merge "Corerctly sets frame type in the 2 pass case" 2014-01-06 12:01:30 -08:00
Yaowu Xu
a2c01ed5b4 Added placeholder for real time mode
Change-Id: I203d10f76c7ca78d875eaae15557cd765c6240d1
2014-01-06 11:57:25 -08:00
Dmitry Kovalev
4603f31d02 Moving reset_segment_features() to encoder/vp9_segmentation.h.
Change-Id: I0db4b31cb2382d4f6249eae0a8f42d227ad0ac57
2014-01-06 11:31:57 -08:00
Dmitry Kovalev
a9deec4389 Merge "Moving get_scan() call out of decode_coeffs() function." 2014-01-06 10:50:16 -08:00
Deb Mukherjee
cf3d2c8d5a Corerctly sets frame type in the 2 pass case
This patch sets frame types correctly in the new
vp9_get_second_pass_params() function called prior
to encode_frame_to_data_rate() function, so that the
latter function can just work with what is passed to
it. This will allow multiple vp9_get_second_pass_params()
to be created for various encode strategies without
messing with the core encode function.

There is no difference in derf and yt. stdhd/hd are pending.

Change-Id: I70dfb97e9f497e9cee04052e0e8e0c2892eab0c3
2014-01-06 10:49:25 -08:00
Jingning Han
b49e9fb433 Merge "Tune IDCT8_1D macro function interface" 2014-01-06 09:38:19 -08:00
Paul Wilkins
d7663edeba Clean up: unused function and variables
Remove adjust_maxq_qrange() and related variables.

Change-Id: I50d065f4619c499283e2680e31d0d99c22439dec
2014-01-06 11:26:02 +00:00
Paul Wilkins
bc27812c8b Merge "Modified Handling of min and max vbr rates." 2014-01-06 02:04:55 -08:00
Dmitry Kovalev
5771276fda Moving get_scan() call out of decode_coeffs() function.
Change-Id: I5db2e5a6c36e6c503dea2e07d9d2e0daf4ac9d89
2014-01-03 18:18:39 -08:00
Dmitry Kovalev
2344e3a2e1 Merge "Converting CHECK_POINT macro to inline function." 2014-01-03 18:02:10 -08:00
Dmitry Kovalev
6e8c103620 Merge "Replacing int_mv with MV." 2014-01-03 17:38:28 -08:00
Dmitry Kovalev
513666e78c Converting CHECK_POINT macro to inline function.
Change-Id: I08533d59a78346dac30a7dcbc12146f23ef88bbc
2014-01-03 16:16:28 -08:00
Dmitry Kovalev
ed2fba2a79 Merge "Replacing CHECK_BOUNDS macro with inline check_bounds function." 2014-01-03 15:57:36 -08:00
Dmitry Kovalev
0c5575fe57 Merge "Moving hev mask calculation into filter4() function." 2014-01-03 15:56:16 -08:00
Jingning Han
3e0c62b53f Tune IDCT8_1D macro function interface
This commit adds input/output ports for IDCT8_1D macro function to
provide more flexibility in variable use. It allows to skip several
buffer swap operations.

Change-Id: I21f3450509537322293043b3281bfd3949868677
2014-01-03 15:23:47 -08:00
Dmitry Kovalev
ba41e9d459 Adding RefBuffer struct.
Adding RefBuffer to simplify reference buffer management. The struct has a
pointer to image data and scale factors relative to the current frame.

Change-Id: If38eb1491ff687cc11428aee339f3e052e2c5d9e
2014-01-03 15:21:55 -08:00
Dmitry Kovalev
efb150bb30 Merge "Cleaning up get_prediction_decay_rate() function." 2014-01-03 15:13:22 -08:00
Dmitry Kovalev
2336853be1 Merge "Pre planes configuration cleanup." 2014-01-03 15:04:53 -08:00
Jingning Han
326b73e41e Merge "Reduce num of buffer swap calls in idct8_1d_sse2" 2014-01-03 12:54:57 -08:00
Jingning Han
12f742bc3f Merge "Rework idct8x8_10 SSE2 implementation" 2014-01-03 12:54:43 -08:00
Dmitry Kovalev
a8ba34d299 Pre planes configuration cleanup.
Change-Id: I1d50f8701d9c9dedb84387a773a3e9b4daaad720
2014-01-03 12:50:57 -08:00
Dmitry Kovalev
38a478fc2c Merge "Merging best_ref_mv and second_best_ref_mv into best_ref_mv[2]." 2014-01-03 12:12:53 -08:00
Jingning Han
0b1a27135a Reduce num of buffer swap calls in idct8_1d_sse2
This commit merges the initial buffer swap operations in idct8_1d_sse2
into the array transpose step, hence reducing number of instructions
therein.

Change-Id: I219f6f50813390d2ec3ee37eecf2a4a2b44ae479
2014-01-03 12:12:03 -08:00
Dmitry Kovalev
84520829ed Cleaning up get_prediction_decay_rate() function.
Change-Id: Ie8fcee21f41f91f94b4fa02f2a55691dea1734e3
2014-01-03 12:11:36 -08:00
Jingning Han
1bb11781e2 Rework idct8x8_10 SSE2 implementation
This commit optimizes the SSE2 implmentation of idct8x8_10. It exploits
the fact that only top-left 4x4 block contains non-zero coefficients,
and hence reduces the instructions needed.

The runtime of idct8x8_10_sse2 goes down from 216 to 198 CPU cycles,
estimated by averaging over 100000 runs. For pedestrian_area_1080p 300
frames coded at 4000kbps, the average decoding speed goes up from
79.3 fps to 79.7 fps.

Change-Id: I6d277bbaa3ec9e1562667906975bae06904cb180
2014-01-03 12:04:09 -08:00
Dmitry Kovalev
672c355a26 Replacing int_mv with MV.
Change-Id: Ifd432fa3741ba47102d298e0b348eb00f5a9ce53
2014-01-03 11:48:07 -08:00
Dmitry Kovalev
f215c641bb Merge changes Ic0a2427a,I3addbf6d
* changes:
  Removing CONFIG_MD5.
  Using VP9_FRAME_MARKER instead of raw number.
2014-01-03 11:47:57 -08:00
Dmitry Kovalev
5b04962cf4 Merging best_ref_mv and second_best_ref_mv into best_ref_mv[2].
Change-Id: If04b57828847cee09a79c94e1098d1aa4990ea0d
2014-01-03 11:31:00 -08:00
Paul Wilkins
65ede3da45 Modified Handling of min and max vbr rates.
In two pass encodes bits are allocated to each frame
according to a modified error score for the frame as a
fraction of the modified error score for the clip or section.

Previously a minimum rate per frame was reserved and
subtracted from the bits allocatable by the two pass code.
The vbr max section rate was enforced by clipping the
actual number of bits allocated.

In this patch the min and max vbr rates are enforced
instead by clipping the modified error scores for each frame
rather than the number of bits allocated.

Small gains for all test sets (psnr and SSIM) ranging from
~ +0.05 for YT psnr up to ~ +0.25 for Std-hd SSIM.

Change-Id: Iae27d70bdd3944e3f0cceaf225bad2e8802833de
2014-01-03 14:56:08 +00:00
Dmitry Kovalev
f16b186b8e Reusing vp9_get_skip_context() function in encoder.
Change-Id: Ic0345622115941f49b6a568c7b8154ba892cbf0d
2014-01-02 18:29:56 -08:00
Christian Duvivier
3bcece9578 Merge "ARM NEON version of denoiser." 2014-01-02 15:03:58 -08:00
Christian Duvivier
b52db6b7e8 ARM NEON version of denoiser.
Change-Id: I951abd4ad0078f78949f3cb79453ac334fb82a7e
2014-01-02 10:51:05 -08:00
Yaowu Xu
8458c8c450 Merge "Fix show existing frame" 2014-01-02 09:27:28 -08:00
Dmitry Kovalev
d24f4e49c1 Removing CONFIG_MD5.
We don't need compile time md5 configuration because --md5 is a runtime
option.

Change-Id: Ic0a2427ae5de5a18f31e5ee60c3732481b377ca1
2013-12-27 16:10:18 -08:00
Jingning Han
cdc933ca00 Merge "Adaptive motion control on ref and search range" 2013-12-27 15:04:16 -08:00
Dmitry Kovalev
46d5cc4307 Using VP9_FRAME_MARKER instead of raw number.
Change-Id: I3addbf6d89a86a707c8df1a463da3e9e367910df
2013-12-27 14:50:27 -08:00
Dmitry Kovalev
7eb09151bc Merge "Removing vpx_codec_vp9x_cx and internal experimental flag." 2013-12-27 14:47:57 -08:00
Yunqing Wang
a7248a04b7 Merge "Remove a unused sub-pixel search" 2013-12-27 14:05:38 -08:00
Dmitry Kovalev
116e0a1ab7 Removing vpx_codec_vp9x_cx and internal experimental flag.
vpx_codec_vp9x_cx is not used internally. Experimental flag from
vp9_extracfg is also not really used. YUV 4:4:4 just works after these
changes (you have to specify --profile=1 for the encoder).

Change-Id: Ib1c8461d0d19d159827e005efe868f891eea0140
2013-12-27 14:01:12 -08:00
Jingning Han
a4ce53f14d Adaptive motion control on ref and search range
This commit takes a preliminary attempt to refine the motion search
control. It detects the SAD associated with mv predictor per reference
frame, and based on which to determine whether the encoder wants to
reduce the motion search range (if the predicted mv provides fairly
small SAD), or to skip the current reference frame (if there exists
another ref frame that gives much smaller SAD cost).

This feature is turned on in the settings of speed 1 and above.

In speed 1, compression performance changed
derf  -0.018%
yt    -0.043%
hd    -0.045%
stdhd -0.281%

speed-up
pedestrian_area_1080p at 4000 kbps 100 frames
199651ms -> 188846ms (5.5% speed-up)
blue_sky_1080p at 6000 kbps
443531ms -> 415239ms (6.3% speed-up)

In speed 2, compression performance changed
derf  -0.026%
yt    -0.090%
hd    -0.055%
stdhd -0.210%

speed-up
pedstrian 113949ms -> 108855ms (4.5% speed-up)
blue_sky  271057ms -> 257322ms (5% speed-up)

Change-Id: I1b74ea28278c94fea329d971d706d573983d810d
2013-12-27 12:43:06 -08:00
Dmitry Kovalev
f3beca079c Merge "Calculating has_second_ref only once for single_ref context." 2013-12-26 13:41:02 -08:00
Dmitry Kovalev
1e8b5bf4ac Merge "Removing vp9_findnearmv.{h, c} files." 2013-12-26 13:38:38 -08:00
James Zern
44963dfd37 cosmetics: vp9_reconinter.h: make some variables const
Change-Id: If5cd0a1487e97c8e9d13dc2e078c6dceaf79de4f
2013-12-26 14:02:46 -05:00
Dmitry Kovalev
87440aeb82 Moving MAX_PROB constant to vp9_prob.h.
Change-Id: I07470ad1b7a0344d088911428ffab8ba9a0d8708
2013-12-20 15:56:59 -08:00
Dmitry Kovalev
f69b5609ff Renaming vp9_dboolhuff.{h, c} to vp9_reader.{h, c}.
Change-Id: I50c009ff8108bda1c57427f23d63a79c04f7e776
2013-12-20 12:53:03 -08:00
Dmitry Kovalev
36ee0a2d0b Merge "Renaming vp9_boolcoder.{h, c} to vp9_writer.{h, c}." 2013-12-20 12:51:37 -08:00
Dmitry Kovalev
b3b9f4a4d0 Merge "Using single struct to represent scale factors." 2013-12-20 11:22:02 -08:00
Dmitry Kovalev
4084566554 Renaming vp9_boolcoder.{h, c} to vp9_writer.{h, c}.
Change-Id: I9b9a5fcce8530284df0f270706ee060a0edc1517
2013-12-20 11:10:24 -08:00
Dmitry Kovalev
47d482cb0a Merge "Reusing FRAME_COUNTS in the encoder." 2013-12-20 10:56:31 -08:00
Jingning Han
9938777058 Merge "Store the SSE of prediction residuals" 2013-12-20 10:37:20 -08:00
Marco Paniconi
68cdbfe50e Merge "Initialize avg_frame_qindex to worst_allowed for 1 pass." 2013-12-20 10:28:09 -08:00
Yaowu Xu
6afd37aa15 Merge "Fix a bug" 2013-12-20 09:20:50 -08:00
Yaowu Xu
2472f125c1 Fix a bug
The line was accidently removed in 4dbad63a7.

Change-Id: Ic1e18f209cead95cecc684f952ae667271b58a97
2013-12-20 08:52:35 -08:00
Yunqing Wang
b6a0ac11f0 Merge "Code clean up" 2013-12-20 08:46:11 -08:00
Paul Wilkins
17b2d63196 Merge "Adjust gf_group_error_left for arf groups." 2013-12-20 04:21:56 -08:00
James Zern
cc8ea84d3d Merge "test/partial_idct_test: fix msvc build" 2013-12-19 19:31:02 -08:00
Jingning Han
243327f43c Store the SSE of prediction residuals
Buffer the SSE of prediction residuals in the rate-distortion
optimization loop of a given block. This information would be used
for later encoding control.

Change-Id: If4e63f3462490513c48be9407d3327c8dd438367
2013-12-19 18:45:28 -08:00
Dmitry Kovalev
987810ad95 Removing vp9_findnearmv.{h, c} files.
Moving all code from that files to vp9_mvref_common.{h, c}.

Change-Id: Ibc4afcb8cea6847166ff411130e93611ebe63b20
2013-12-19 17:39:57 -08:00
Dmitry Kovalev
a3fbcc88bb Using single struct to represent scale factors.
Moving back to scale_factors struct. We don't need anymore x_offset_q4 and
y_offset_q4 because both values are calculated locally inside vp9_scale_mv
function.

Change-Id: I78a2122ba253c428a14558bda0e78ece738d2b5b
2013-12-19 16:06:33 -08:00
Dmitry Kovalev
40e173ac42 Merge "vp9_encode_frame() cleanup." 2013-12-19 15:37:13 -08:00
Marco Paniconi
5ba4b16c2d Initialize avg_frame_qindex to worst_allowed for 1 pass.
Change-Id: I535bde16c8fc4c2cd263bbbbaed46ead4c776090
2013-12-19 14:55:49 -08:00
Dmitry Kovalev
c872d2be65 Call set_scaled_offsets() just before scale_mv() call.
Before mv scaling it is required to calculate x_offset_q4/y_offset_q4
by calling set_scaled_offsets(). Now offset configuration can not be
missed because it happens just before scale_mv().

Change-Id: I7dd1a85b85811a6cc67c46c9b01e6ccbbb06ce3a
2013-12-19 14:55:13 -08:00
Dmitry Kovalev
5bfd475104 Merge "Adding get_block_variance_fn() function." 2013-12-19 14:47:59 -08:00
Dmitry Kovalev
a619f5a776 Merge "Replacing 1 << mi_{width, height}_log2() with lookup tables." 2013-12-19 14:28:58 -08:00
Dmitry Kovalev
f06187f125 vp9_encode_frame() cleanup.
Change-Id: I82ecbe7fe0baa890ce251043f3c7159188c00665
2013-12-19 14:28:42 -08:00
Dmitry Kovalev
66ef9d1c20 Adding get_block_variance_fn() function.
Change-Id: I67d934b6af899ffd4bcad2d913a650685fa64abd
2013-12-19 14:07:03 -08:00
Dmitry Kovalev
431aaefbec Replacing 1 << mi_{width, height}_log2() with lookup tables.
Change-Id: Iba91ff1e797a83517e2cd7c3ab86cba39f39415b
2013-12-19 13:43:45 -08:00
Deb Mukherjee
84b4d8c692 Merge "Begin refactor of frame schedule in rate control" 2013-12-19 11:37:06 -08:00
Yunqing Wang
6ff4f19269 Remove a unused sub-pixel search
The original iterative search was replaced by subpel_tree search,
and was not used anymore.

Change-Id: I998b38e1cb0ee359a08b2410d0766dbf183ab071
2013-12-19 11:20:56 -08:00
Yunqing Wang
09faf55916 Code clean up
Removed unused filter coefficients.

Change-Id: Ib395a51305e23ff41ab69c1808d56946d25961cd
2013-12-19 11:09:23 -08:00
Dmitry Kovalev
c67ee5ea24 Merge "Converting vp9_treecoder.h to vp9_prob.{h, c}" 2013-12-19 11:03:30 -08:00
Dmitry Kovalev
e4b85c9ed8 Merge "Adding get_zbin_mode_boost() function." 2013-12-19 11:03:23 -08:00
Deb Mukherjee
4dbad63a71 Begin refactor of frame schedule in rate control
Various cleanups and streamlining of interfaces as precursor
to further advancements in rate control.
Pre-encode parameter setting for different use cases:
One-pass, first of 2-pass, second of 2-pass, and Svc
are separated out.

There is no change in output with this change.

Change-Id: Ied8ca7d84d610993776aa30ef263fe20452e0e3e
2013-12-19 10:55:38 -08:00
Tom Finegan
46444c268a Merge "test/decode_perf_test: fix msvc build" 2013-12-19 10:35:41 -08:00
Paul Wilkins
ee29b7e85c Adjust gf_group_error_left for arf groups.
Take account of the fact that the overlay frame is usually
very cheap so distribute target bits among the other frames.

Change-Id: I120685122e8cbbe75da8d07d02932f7877059867
2013-12-19 17:26:04 +00:00
Paul Wilkins
cb8659981d Allow arf just before kfs or end of sequence.
This will hurt metrics in some cases (particularly for static
clips at low data rates where there is extra overhead, but it
helps smooth transitions around forced key frames between
stitched kf sections.

Change-Id: I7e1026ae0de6c77bba863061e115136d7f283cc0
2013-12-19 16:52:38 +00:00
Paul Wilkins
e1312c3696 Further q estimate adjustment.
Slightly reduces the mean tendency to undershoot target
rate in vbr, especially when using the memory less mode
and when recodes are disabled.

The effect is primarily at low q.

Change-Id: I59a593b99522cc7da31b4134d1c8a65f5b7b7c53
2013-12-19 15:32:50 +00:00
Paul Wilkins
d99e890840 Remove unused code and data structure.
Remove modified_error_used and adjust_active_maxq().

Change-Id: I8915007128dc1a17e11693104cfb008a6d64e6a2
2013-12-19 15:27:44 +00:00
Dmitry Kovalev
4e84ad1fc6 Reusing FRAME_COUNTS in the encoder.
Replacing: intra_inter_count, y_mode_count, y_uv_mode_count.

Change-Id: I5d70f73288af6effe6176e26400138067a2ae2a3
2013-12-18 18:52:58 -08:00
Tom Finegan
d2fdea1079 test/decode_perf_test: fix msvc build
Change-Id: I46590947dfde0bce727b20c12e3a0a8c27be8433
2013-12-18 18:34:32 -08:00
James Zern
949194db3b Merge "test/partial_idct_test: fix formatting and a warning" 2013-12-18 18:33:49 -08:00
Dmitry Kovalev
829ec56b47 Merge "Reusing FRAME_COUNTS in the encoder." 2013-12-18 18:27:08 -08:00
James Zern
cac85f82c5 datarate_test: fix some type conversions
Change-Id: I9840dfab644b0c75ff667174f8005dece005e700
2013-12-18 16:58:43 -08:00
James Zern
a5768f61e5 test/partial_idct_test: fix msvc build
Change-Id: I7fa72980d17f1ca997959e9c4f0f82501810d7c4
2013-12-18 16:38:41 -08:00
James Zern
19c53534bd test/partial_idct_test: fix formatting and a warning
test/partial_idct_test.cc:74:5: warning: variable 'size' is
used uninitialized whenever 'if' condition is true
[-Wsometimes-uninitialized]
    ASSERT_TRUE(0) << "Wrong Size!";

Change-Id: Ic2f880ae09268561c9f036b4d6de220fde6dc5c4
2013-12-18 15:59:09 -08:00
Johann
dc2c62eba8 Cast away Windows warning
Subtracting the pointers promoted to a signed type.

Change-Id: Ied0e822a1756ed7b2f514efafcb6dce4efb9b9d6
2013-12-18 15:52:51 -08:00
Alex Converse
69384a2510 Merge "Fix arnr for 4:4:4." 2013-12-18 14:58:03 -08:00
Alex Converse
7e731b6cea Fix arnr for 4:4:4.
Change-Id: I80a0cea96c65c0cfb530a71053616dba6edeb896
2013-12-18 14:33:29 -08:00
Marco Paniconi
5bafc2315d Merge "Fix to overflow in asan test (for vp8 encoder)." 2013-12-18 14:18:58 -08:00
Marco Paniconi
6efb0ab9b2 Fix to overflow in asan test (for vp8 encoder).
Change-Id: Ie67339ab3a16ce7669b5366a743812df93c52711
2013-12-18 14:12:29 -08:00
Jingning Han
89b6d40690 Replace cpi->common with cm in vp9_onyx_if
Replace repeated cpi->common fetching with cm variable in a few
places in vp9_onyx_if.c

Change-Id: Ifa16d617f37919b2e0baf8efb256130a647b5eb3
2013-12-18 12:31:41 -08:00
Jingning Han
ae0e383d35 Merge "Make rd_pred_filter update consistent in all bsizes" 2013-12-18 12:31:35 -08:00
Jingning Han
d8557a052c Make rd_pred_filter update consistent in all bsizes
This commit reworks the prediction filter rate-distortion cost update
process consistent for all block sizes.

Change-Id: I5874349ab38df380240f96c2d4ef924072bab68d
2013-12-18 11:54:31 -08:00
Yaowu Xu
f71f581ba2 Merge "Added a test vector that exercises lpf deltas" 2013-12-18 11:41:56 -08:00
Dmitry Kovalev
de49895804 Adding get_zbin_mode_boost() function.
Change-Id: Ia356178d6a3c40b512d3123390781ef94dec72d6
2013-12-18 10:39:08 -08:00
Marco Paniconi
02d5ebcfdc Merge "Updates for 1-pass CBR rate control." 2013-12-18 10:28:33 -08:00
Yaowu Xu
2424ba3d8b Added a test vector that exercises lpf deltas
From frame 2, the lpf deltas are all cleared for for even frames, and
a set of values are set and used for odd frames. The intention is to
exercise decoding code around lpf delta/update decoding.

Change-Id: Ic9ff1bc2c2a023f4805852f8573398f2ec2249d7
2013-12-18 10:08:39 -08:00
Marco Paniconi
1b8b8b0d0d Updates for 1-pass CBR rate control.
Adjustments based on buffer level, frame dropper.

Change-Id: Iaa85b570493526a60c4b9fb7ded4c0226b1b3a33
2013-12-18 09:24:24 -08:00
Johann
bb12bbaefb Merge "Fix incorrect size reading" 2013-12-17 21:26:50 -08:00
Johann
b46da98f3a Merge "Only exclude VP8 when it is included" 2013-12-17 21:26:44 -08:00
Frank Galligan
05d5332407 Merge "Increase required number of external frame buffers" 2013-12-17 21:20:34 -08:00
Jim Bankoski
9d754dcca8 Merge "rename loop filter functions" 2013-12-17 18:56:09 -08:00
Johann
85770264ac Fix incorrect size reading
Guard against incorrect size values moving *data past data_end.

Check read length against the difference of the buffers.

Change-Id: Ie0b54e2db517fd41a0f3ceb23402ee44839a4739
2013-12-17 18:48:55 -08:00
Johann
af416c4daf Only exclude VP8 when it is included
If configured with --disable-vp8 kVP8TestVectors is undefined.

Change-Id: I9d83e805923977ab057ab48042580ce0d817ba68
2013-12-17 18:27:04 -08:00
James Zern
ea8482fe74 Merge "Add external constants." 2013-12-17 18:20:31 -08:00
Frank Galligan
9e41d569d7 Increase required number of external frame buffers
Make applications pass in VPX_MAXIMUM_WORK_BUFFERS as well as
VP9_MAXIMUM_REF_BUFFERS.

Change-Id: I9c07ce83fa19c90ed43227b801b2013690e81edd
2013-12-17 17:34:36 -08:00
Jim Bankoski
b720ba165f rename loop filter functions
This renames all the loop filter functions so that they no
longer refer to mb

Change-Id: I8a58a8c7fd253d835cb619bde13913e896ece90b
2013-12-17 17:34:34 -08:00
Frank Galligan
bbf53047b0 Add external constants.
Change-Id: I8d329513c87bd8622306aba27c83bf04ef170fa4
2013-12-17 17:28:23 -08:00
Dmitry Kovalev
118c8fb3fb Calculating has_second_ref only once for single_ref context.
Change-Id: Ib1253e0606426850f53060a4c5303af86bf1c093
2013-12-17 17:02:24 -08:00
Yaowu Xu
ede392d765 Merge changes I5d28c2f5,Ib00b036f
* changes:
  Remove redundant function and calls
  Add test for partial inverse transforms
2013-12-17 16:57:01 -08:00
Dmitry Kovalev
c6a1ff223b Merge "Calling is_inter_block() only if mbmi is available." 2013-12-17 16:10:56 -08:00
Yaowu Xu
ed90a176af Remove redundant function and calls
lf deltas are later setup in function vp9_setup_past_independence(),
so this commit removed the redundant copy. Also renamed a function
to better align the behavior of the funciton.

Change-Id: I5d28c2f5b12b3d31817e14296ed4605c1fd5c98c
2013-12-17 15:44:25 -08:00
Dmitry Kovalev
4821084b3f Moving hev mask calculation into filter4() function.
Change-Id: Ieccf2070b2b01b4135f4c5f9857667eb7825c761
2013-12-17 15:23:23 -08:00
Dmitry Kovalev
eb0c73b6e0 Merge "Converting mode_lf_lut struct member into static lookup table." 2013-12-17 15:20:05 -08:00
Yaowu Xu
ed7e3d2447 Add test for partial inverse transforms
To make sure the results they produce to match their full versions

Change-Id: Ib00b036fecf43fe20af716acfc580af18ef87757
2013-12-16 22:01:02 -08:00
Dmitry Kovalev
1d23a6594b Reusing FRAME_COUNTS in the encoder.
Change-Id: I6ab9fe2326ebbadf0dd10cca9f66cf8277e3f43b
Replacing: comp_inter_count, single_ref_count, comp_ref_count.
2013-12-16 20:12:47 -08:00
James Zern
0f512788c8 {,vpx_scale}: normalize include guards
Change-Id: Ib8aafeee30d59521ee256dc1801e0db6b4b8a371
2013-12-16 19:41:13 -08:00
James Zern
d2f4940783 vpx_ports: normalize include guards
Change-Id: I4e931aadecfe1761c720b080bdd67a1875794979
2013-12-16 19:41:10 -08:00
James Zern
941e0b6150 vpx_mem: normalize include guards
Change-Id: Iac433b5823c572cfa79e5b6b839cd40b49c0389c
2013-12-16 19:41:07 -08:00
James Zern
7386bde9d2 vpx: normalize include guards
Change-Id: Iee670353cffa1f9e97976ac507ad9519e5dda7f7
2013-12-16 19:41:05 -08:00
James Zern
bb28520891 vp8/encoder: normalize include guards
Change-Id: I82834550503a43ff7ec8422342dc65136453b287
2013-12-16 19:41:01 -08:00
James Zern
074dc67277 vp8/decoder: normalize include guards
Change-Id: Ifa7934927cc8461cd58ca0b05bf76533abd78cb6
2013-12-16 19:40:58 -08:00
James Zern
e903cacf5b vp8/common: normalize include guards
Change-Id: Ia8789a8f864e0edc0bf94f00f6430846f86911c3
2013-12-16 19:40:54 -08:00
James Zern
bd9a388a06 vp9: normalize include guards
Change-Id: If4ddbdcfb3ab387cbca6910b42cf4df8111e6879
2013-12-16 19:40:49 -08:00
Johann
ccffac2b06 Merge "Avoid mixed comparison" 2013-12-16 19:17:57 -08:00
Johann
83baed0b6b Merge "Add const to match declaration" 2013-12-16 19:17:43 -08:00
Johann
3df4d9f62d Merge "Include files in the same directory directly" 2013-12-16 19:17:33 -08:00
Yaowu Xu
1f919cf27d Merge "Define POSITION to differentiate from MV" 2013-12-16 18:21:55 -08:00
Yaowu Xu
36c4e27454 Merge "Move two functions to encoder" 2013-12-16 18:09:51 -08:00
Jingning Han
07a28c77e3 Merge "Fix rd_filter_cache update in sub8x8 RD loop" 2013-12-16 17:57:02 -08:00
Jingning Han
ef838c349c Merge "Remove redefinition in handle_inter_mode" 2013-12-16 17:56:41 -08:00
Deb Mukherjee
9a005c994c Merge "Rate control changes on active_worst_quality" 2013-12-16 17:40:30 -08:00
Yaowu Xu
3cce464342 Define POSITION to differentiate from MV
MV struct was ussed to indicate the postition of a MI_BLOCK with row
and col components. The expression was confusing, this commit added a
new stucture "POSITION" with row and col component to better describe
the position of a mi_block.

Change-Id: I59fdd4b45010fe7d85a8db22a55503265c4f5b2b
2013-12-16 17:28:00 -08:00
Yaowu Xu
50ec6311e6 Move two functions to encoder
As they are used by encoder only.

Change-Id: I7b1e6955b218aba66fe156523521a8121c9a84a4
2013-12-16 17:27:48 -08:00
Yaowu Xu
e71985632e Merge "Added a test vector" 2013-12-16 17:27:37 -08:00
Deb Mukherjee
1e59cbf23b Rate control changes on active_worst_quality
Various cleanups and refactoring.
Removes feedback of active worst qaulity and uses last_q
instead to make the interface cleaner. Active worst quality
is now decided only once for a frame being coded in the
beginning based on last_q and other stats. Also, adds other
cleaups on last_q to store also the last_q for altref frames,
and reduces the altref interval a little.

The output does change a little.
derfraw300: +0.224% (global psnr)
stdhdraw250: +0.442% (global psnr)

Change-Id: Ie634cdc032697044c472dd0fe79c109b3e7f9767
2013-12-16 17:08:16 -08:00
Dmitry Kovalev
3755be94ed Merge "Using MV struct instead of int_mv union in encoder (2)." 2013-12-16 16:56:07 -08:00
Yaowu Xu
a3e919a4ba Added a test vector
The added vector was encoded with aq mode on, with the intent to
exercise the decode code around segment feature.

Change-Id: Iedcb7261e87d3e11b25ecf031d3a69385271148e
2013-12-16 15:48:04 -08:00
Johann
332169d39c Avoid mixed comparison
Silences warning C4018: '>' : signed/unsigned mismatch

Change-Id: I07d34060043e8ada7d995ea6dc8276cb881c7d95
2013-12-16 15:46:11 -08:00
Johann
5894e7ef50 Add const to match declaration
The definition fell out of sync in
I7d2fda72de5fc27e86c6589543b41fa044681dbf

Change-Id: I3ce3f6ba96bb121f51efaa08f64a69ad9f731a9e
2013-12-16 15:46:11 -08:00
Johann
e883c7478d Include files in the same directory directly
Change-Id: I56706a8326d9356a6735d13eb5e0832d04221c91
2013-12-16 15:46:05 -08:00
Dmitry Kovalev
bb7b4bad6d Merge "Getting rid of b_{width, height}_log2 calls in non-420 loop filter." 2013-12-16 15:10:25 -08:00
Dmitry Kovalev
865d5b83f2 Calling is_inter_block() only if mbmi is available.
Modifying vp9_get_intra_inter_context(), vp9_get_reference_mode_context(),
vp9_get_pred_context_single_ref_p1(), vp9_get_pred_context_single_ref_p2()
functions.

Change-Id: Ifaa2c3eb0c76a544ae8bd1fe3155aada266eae78
2013-12-16 15:09:33 -08:00
Jingning Han
75cfadbd1f Fix rd_filter_cache update in sub8x8 RD loop
Properly handle the rd_filter_cache update, when early termination
or skip prediction filter type check is triggered.

Change-Id: Ie7b9a75fed3358f45ffd15817f2b36670c14eb2d
2013-12-16 14:52:20 -08:00
hkuang
fb53409d2a Merge "Remove border extension in intra frame prediction." 2013-12-16 14:48:54 -08:00
Dmitry Kovalev
b1d821704b Merge "Yet another vp9_pred_common.c cleanup." 2013-12-16 14:10:52 -08:00
Dmitry Kovalev
4f0a381b49 Merge "Reusing nmv_frame_counts from FRAME_COUNTS in encoder." 2013-12-16 14:10:13 -08:00
hkuang
25e5552630 Remove border extension in intra frame prediction.
Change-Id: Id677df4d3dbbed6fdf7319ca6464f19cf32c8176
2013-12-16 14:05:58 -08:00
Dmitry Kovalev
b5c9261832 Converting vp9_treecoder.h to vp9_prob.{h, c}
Moving vp9_norm probability table from vp9_entropy.c to vp9_prob.c

Change-Id: Ie757b73860c6f43130790c332b292e2a1a81b788
2013-12-16 12:53:09 -08:00
Dmitry Kovalev
1a23a34419 Merge "Cleaning up encode_sb() and encode_b() functions." 2013-12-16 12:21:38 -08:00
Dmitry Kovalev
f00d4e0198 Merge "Removing unnecessary assert(delta != 0) from encode_loopfilter()." 2013-12-16 11:41:36 -08:00
Deb Mukherjee
4a535efcfd Change in data rate test to be less stringent
Makes the thresholds for bitrate control more leniant to
prevent test failures.

Change-Id: I535c1565174a8a46493b033531eb40360def883b
2013-12-16 09:29:37 -08:00
Frank Galligan
fbada948fa Add frame buffer lru cache.
Add an option for libvpx to return the least recently used
frame buffer.

Change-Id: I886a96ffb94984f1c42de53086e0131922df3260
2013-12-15 19:57:42 -08:00
Frank Galligan
d0ee1fd797 Merge "Add support to pass in external frame buffers." 2013-12-15 19:18:25 -08:00
Frank Galligan
10f891696b Add support to pass in external frame buffers.
VP9 decoder can now use frame buffers passed in by the application.

Change-Id: I599527ec85c577f3f5552831d79a693884fafb73
2013-12-15 18:45:46 -08:00
Dmitry Kovalev
4d2d1591a3 Converting mode_lf_lut struct member into static lookup table.
Change-Id: I6e6c7cb5ff5b60fbe6a7c314daec5ccdc2cafcc3
2013-12-14 17:42:12 -08:00
Dmitry Kovalev
2aadc06e0d Yet another vp9_pred_common.c cleanup.
Change-Id: I617d6c610d181076773c5c3d6f3dbc6717b02580
2013-12-14 17:39:24 -08:00
James Zern
c5aaf923d8 webmdec/tests: fix leak when file isn't read to eof
the nestegg packet was only freed by subsequent reads

Change-Id: Ib687a13907861c7575830783e47a596d85169cf1
2013-12-13 19:06:21 -08:00
Dmitry Kovalev
b41574e379 Removing unnecessary assert(delta != 0) from encode_loopfilter().
Change-Id: I8ae093d0b61d71d3c294b95d98d0178f7f67c8f6
2013-12-13 18:05:15 -08:00
Dmitry Kovalev
095b03231c Using MV struct instead of int_mv union in encoder (2).
Change-Id: I068345f722a7116e3119927295ad23a28d3066a0
2013-12-13 17:20:40 -08:00
Dmitry Kovalev
64cf398713 Merge "Using MV struct instead of int_mv union in encoder." 2013-12-13 16:42:54 -08:00
Dmitry Kovalev
33df4f0483 Merge "vp9_convole.c cleanup." 2013-12-13 15:40:00 -08:00
Dmitry Kovalev
f54b515797 Merge "Cleaning up vp9_append_sub8x8_mvs_for_idx()." 2013-12-13 15:38:53 -08:00
Dmitry Kovalev
25da21b14e Using MV struct instead of int_mv union in encoder.
Change-Id: I8b81a3e4b4fa530a654c28d9c136afa0c1d379fd
2013-12-13 15:24:48 -08:00
Yunqing Wang
d4b500d9d7 Merge "Increase disable_filter_search_var_thresh threshold" 2013-12-13 15:11:17 -08:00
Jingning Han
84acc988eb Remove redefinition in handle_inter_mode
Change-Id: I44513b9db6d42e2c52723e1a429f06a93d300c8b
2013-12-13 13:38:05 -08:00
Dmitry Kovalev
466cc94e7a Getting rid of b_{width, height}_log2 calls in non-420 loop filter.
Using num_{4x4, 8x8}_blocks_{wide, high}_lookup instead.

Change-Id: I66a7ab807fa57395253b2d0e636c2479fa8c4adf
2013-12-13 12:53:41 -08:00
James Zern
ec79db6086 Merge "obj_int_extract: fix compile warning" 2013-12-13 12:47:19 -08:00
James Zern
3aa75bcef6 Merge "vp9 asserts: fix compile warning" 2013-12-13 12:41:31 -08:00
Jingning Han
a793cf953f Merge "Rename so -> scan_order in vp9_encodemb.c" 2013-12-13 12:14:48 -08:00
Dmitry Kovalev
df13e01665 Merge "Renaming treed_write() to vp9_write_tree()." 2013-12-13 11:19:04 -08:00
Dmitry Kovalev
15a23c8131 Merge "zz_motion_search() cleanup." 2013-12-13 11:18:13 -08:00
Dmitry Kovalev
33859ad8e3 Merge "Moving mi configuration loop from vp9_read_mode_info to set_offsets." 2013-12-13 11:16:59 -08:00
Jingning Han
2f9d118f21 Merge "Remove some dead code" 2013-12-13 11:10:39 -08:00
Jingning Han
930ae71ef0 Rename so -> scan_order in vp9_encodemb.c
Change-Id: I7ff2899ea18a55b37f5c581431ef59806f01e009
2013-12-13 11:06:23 -08:00
Yunqing Wang
da9f55c3fb Increase disable_filter_search_var_thresh threshold
Increased threshold(t) for interp filter search. This sped up the
encoder with some PSNR loss.

Borg tests were ran at speed 2.
t = 100, PSNR loss:
-0.710%(derf); -0.561%(stdhd); -0.647%(youtube)
speedup:
9%(derf); 3%(stdhd); 5.7%(youtube)

t = 500, PSNR loss:
-1.687%(derf); -1.665%(stdhd); -1.664%(youtube)
speedup:
18%(derf); 10%(stdhd); 8%(youtube)

Change-Id: I180e3657c1e156aaa88dc7c437f8bcbd19f5caba
2013-12-13 10:47:14 -08:00
Adrian Grange
2ec473bb0a Merge "Set rc_2pass_vbr_maxsection_pct to correct value" 2013-12-13 10:30:46 -08:00
Jingning Han
8b73296d7b Merge "Enable adaptive pred filter type for sub8x8" 2013-12-13 09:34:24 -08:00
Adrian Grange
15cf59605f Set rc_2pass_vbr_maxsection_pct to correct value
Corrected a typo that set rc_2pass_vbr_minsection_pct to
two different values on consecutive lines. Second line
should have set rc_2pass_vbr_maxsection_pct.

Change-Id: Ie07ac67cd5455afe556bef34da8127304db9c97c
2013-12-13 08:50:13 -08:00
Dmitry Kovalev
e121bf4c1d Moving mi configuration loop from vp9_read_mode_info to set_offsets.
set_offsets() is a right place to configure all mi-related pointers.

Change-Id: I7d2fda72de5fc27e86c6589543b41fa044681dbf
2013-12-12 19:56:30 -08:00
James Zern
178db94cd6 vp9 asserts: fix compile warning
string literal to int within an assert

Change-Id: I0c889256b67a078e6e2a79577f0b7ae084243258
2013-12-12 19:49:19 -08:00
James Zern
934f0fbbcb obj_int_extract: fix compile warning
string literals should be returned as const char*

Change-Id: Iaab98711ed22f9c6eff1ca922c0576a1ff93a58f
2013-12-12 19:43:01 -08:00
Jingning Han
3b5a90bd86 Enable adaptive pred filter type for sub8x8
This commit enables an adaptive prediction filter type selection
for sub8x8 block sizes. In speed 1, it re-uses the filter type of
collocated 8x8 block if it is tested in the rate-distortion optimization
loop, for the sub8x8 blocks. Otherwise, it runs the normal test
over all the three filter types. In speed 2, it re-uses the 8x8
block's prediction filter type, if available. Otherwise, force it
to be EIGHTTAP.

Compression and speed performance wise:
speed 1
derf -0.266%
yt   -0.138%

bus at 2000 kbps: 33766ms -> 30451ms (10% speed-up)
football at 600 kbps: 48173ms -> 43786ms (9% speed-up)

speed 2
derf -0.026%
yt   +0.134%

bus at 2000 kbps: 18973ms -> 17698ms (6% speed-up)
football at 600 kbps: 26748ms -> 25096ms (6% speed-up)

Change-Id: I77e097533b969fd3472147225fa79fc98095d342
2013-12-12 17:54:34 -08:00
James Zern
c2634188ce Merge "test-data.sha1: add missing sha1sums" 2013-12-12 11:57:10 -08:00
Dmitry Kovalev
52bf93479c zz_motion_search() cleanup.
Change-Id: I4991bc36e1627bd3a9495ca72c0738f1a937da2e
2013-12-12 11:18:17 -08:00
Dmitry Kovalev
629fb85f17 vp9_convole.c cleanup.
Making overall logic more clear, moving "hacked" calculation of base filter
array pointer to get_filter_base() function.

Change-Id: Ibbd38a9f937e48d35bbbfef3ad933ab36664cccb
2013-12-12 11:14:06 -08:00
Frank Galligan
38536f6b1c Cleanup copyright headers.
Change-Id: I7ff2b18e085f3fffaa7f25d40e4e50427b808f43
2013-12-12 08:36:34 -08:00
Frank Galligan
802fc78bd7 Merge "Move test vector list into a separate header." 2013-12-12 08:28:48 -08:00
Frank Galligan
994a552c09 Merge "Add pre decode frame hook to decoder test class." 2013-12-12 08:26:43 -08:00
Frank Galligan
52b2d50db4 Move test vector list into a separate header.
Change-Id: I36f9033492f12fda7f9ce0e7a97a009aab9aab57
2013-12-11 23:15:39 -08:00
James Zern
1586bbf7f1 test-data.sha1: add missing sha1sums
vp90-2-02-size-lf-1920x1080.webm{,.md5} were added in:
ebb583d Add a test vector for loopfilter

Change-Id: I021808338935932cb742ea2621b94f44f22e3037
2013-12-11 19:19:39 -08:00
Dmitry Kovalev
2a6c7a1a9b Merge "Little cleanup in vp9_encode_block_intra()." 2013-12-11 17:58:02 -08:00
Deb Mukherjee
7edd5170b5 Merge "Changes interfaces to vp9_get_compressed_data fn" 2013-12-11 15:50:40 -08:00
Dmitry Kovalev
1b92ab0ecb Little cleanup in vp9_encode_block_intra().
Change-Id: Ibfe04b920648e15bf7116f4fdc98960572a7007e
2013-12-11 15:26:45 -08:00
Dmitry Kovalev
efe5b28c09 Reusing nmv_frame_counts from FRAME_COUNTS in encoder.
Change-Id: Iadf2fcc9a5bfa5d02fc166f31963be1cc814831c
2013-12-11 15:16:10 -08:00
Dmitry Kovalev
5556090dd0 Replacing CHECK_BOUNDS macro with inline check_bounds function.
Change-Id: I8437113da256088576bf66401186e35125089c03
2013-12-11 15:00:36 -08:00
Jingning Han
a4ccfadcc2 Merge "Rename clamp_mv_min_max to set_mv_search_range" 2013-12-11 14:45:06 -08:00
Dmitry Kovalev
b8dc52f4a3 Cleaning up encode_sb() and encode_b() functions.
Trying to make encode_sb() more similar to write_modes_sb() and
decode_mode_sb() because essentially all branching logic should be the
same.

Change-Id: Ib7dec7b48fce29418142abad4d1dcfdb1c770735
2013-12-11 14:38:22 -08:00
Dmitry Kovalev
e79103166f Merge "Renames for consistency in vp9_pred_common.{c, h} files." 2013-12-11 14:30:44 -08:00
Yaowu Xu
3897de6098 Merge "Reduce the number of frames used in lossless test" 2013-12-11 14:26:11 -08:00
Deb Mukherjee
e33855cc47 Changes interfaces to vp9_get_compressed_data fn
Silences some lint warnings in previous patches

Change-Id: I04bf47ebe7e63a95fd322719a3154e589c115d78
2013-12-11 14:22:51 -08:00
Jingning Han
9d6e7ce12d Rename clamp_mv_min_max to set_mv_search_range
This function sets the motion search range limit. Rename it to be
more informative.

Change-Id: I2e8e01073dcb99c9bea9c9acd0a61d672d615444
2013-12-11 14:00:08 -08:00
Jingning Han
cf83dfb283 Merge "Enforce motion search range clamp for sub8x8" 2013-12-11 13:51:32 -08:00
Yaowu Xu
d62af81f6a Reduce the number of frames used in lossless test
Change-Id: I976f70b640b06f20533ad29578a5b2acca134fd4
2013-12-11 13:45:07 -08:00
hkuang
9460226acd Merge "Fix valgrind error." 2013-12-11 13:22:32 -08:00
hkuang
1339f3842c Fix valgrind error.
Temporarily change memcpy to memmove.

Change-Id: I700a197bc1ce496be1ddad7118429c5da465b0ca
2013-12-11 13:21:28 -08:00
James Zern
dce5b82f12 Merge "vp8: remove 2 unused tables" 2013-12-11 13:16:41 -08:00
Adrian Grange
1f07e804f0 Merge "Fix the printf format string" 2013-12-11 12:50:04 -08:00
Jingning Han
a67e654b6c Enforce motion search range clamp for sub8x8
This commit constrains the maximal motion search range for sub8x8
blocks to be [-1023, 1023], in the unit of full pixel.

Change-Id: I955b60649364ab410f2453cafd46a496f2fcb43e
2013-12-11 10:59:27 -08:00
Adrian Grange
8af3e6507e Fix the printf format string
There were two problems with the format string in
the conditionally compiled print statement. It referred
to a variable that is no longer available and it used
incorrect format specifiers.

Change-Id: I315e22bea2691bb535a2e33f5ca206fc55287a37
2013-12-11 10:47:59 -08:00
Frank Galligan
f9d69bd0fd Add pre decode frame hook to decoder test class.
Adds a hook that derived test classes can implement to be notified
before every call to decode a frame.

Change-Id: Iefa836459cf3e5d7df9ee27f8198daf82b1be088
2013-12-11 08:58:21 -08:00
James Zern
3d7cc9d2d1 vp8: remove 2 unused tables
Change-Id: Ib5ba4e0b438107741efa28251848306322fd7f89
2013-12-10 21:13:21 -08:00
James Zern
345fbfef06 vp9 mt decode: reorder tile decode
reorder the tiles based on size and their presumed complexity. this
minimizes the cases where the main thread is waiting on a worker to
complete.

Change-Id: Ie80642c6a1d64ece884f41683d23a3708ab38e0c
2013-12-10 18:33:27 -08:00
Dmitry Kovalev
3274fc30ee Renames for consistency in vp9_pred_common.{c, h} files.
Change-Id: Icba06e84ca55c419abbacedf5825eeb394a1b140
2013-12-10 18:31:46 -08:00
Dmitry Kovalev
021a15fe9f Renaming treed_write() to vp9_write_tree().
Making name consistent with vp9_read_tree().

Change-Id: Ie213ffe0d5345bf3035f28e17f610894fec79205
2013-12-10 18:13:29 -08:00
Dmitry Kovalev
098d13ba10 Cleaning up vp9_append_sub8x8_mvs_for_idx().
Replacing if-else with switch statement, reordering function arguments.

Change-Id: I4825d2ef311ba8999b6d4ceb0eef003587a13434
2013-12-10 17:56:53 -08:00
Yaowu Xu
014b9c70f7 Merge "Fix a bug" 2013-12-10 16:06:42 -08:00
Dmitry Kovalev
1048a7e314 Merge "Cleaning up skip context calculation." 2013-12-10 15:00:22 -08:00
Dmitry Kovalev
bcee73f7ae Merge "Cleaning up read_inter_block_mode_info() function." 2013-12-10 14:59:36 -08:00
Guillaume Martres
020a1e7006 Merge "avoid crash when using --best on cpus with SSE3 (but not SSE4) support" 2013-12-10 14:49:10 -08:00
Yaowu Xu
e0f82c6ed6 Fix a bug
In evaluating partition split case, Wrong partition size is used in
calling partition_plane_context(). This commit change to use the
correct sub partition size. The incorrect partition size used were
causing an ASAN error in unit test.

Change-Id: Iab695b764bc51cc61580075f2ae4001421132362
2013-12-10 14:34:32 -08:00
Dmitry Kovalev
2dd20e468a Cleaning up skip context calculation.
Renames:
  vp9_get_pred_context_mbskip => vp9_get_skip_context
  vp9_get_pred_prob_mbskip    => vp9_get_skip_prob

Change-Id: I2af499848ef73f3f5cd8cdb27852d0bcdfe31d09
2013-12-10 14:11:26 -08:00
Dmitry Kovalev
35b7b0b549 Merge "Removing unused vp9_get_pred_flag_mbskip() function." 2013-12-10 13:58:35 -08:00
hkuang
19bbe41c71 Merge "Refactor inter_predictor function." 2013-12-10 13:34:24 -08:00
Dmitry Kovalev
48088f210d Removing unused vp9_get_pred_flag_mbskip() function.
Change-Id: Ib46a97d8ff9f2915b9fa2abba3cd18b6711fcb0c
2013-12-10 12:53:17 -08:00
Dmitry Kovalev
e18eb7721e Merge "Renaming comp_pred_mode to reference_mode." 2013-12-10 10:52:34 -08:00
hkuang
6c9dcae532 Refactor inter_predictor function.
Change-Id: Ic429b2f16462e926f30efb3af4da3080026359d8
2013-12-10 10:36:44 -08:00
Guillaume Martres
0102f1d5ec avoid crash when using --best on cpus with SSE3 (but not SSE4) support
Change-Id: Ie100114a01b8b4da7248603c40676792cd06b32a
2013-12-10 18:17:10 +01:00
Dmitry Kovalev
d2dad31e79 Merge "Cleaning up vp9_get_pred_context_switchable_interp() functuion." 2013-12-09 17:34:30 -08:00
Johann
af7b7ffb4e Merge "Add include guards to setupintrarecon.h and vpx_once.h" 2013-12-09 17:16:33 -08:00
hkuang
d70a8c09c6 Merge "Implenment on demand border extension. In place extend the border now. Next commit will totally remove the border." 2013-12-09 17:16:31 -08:00
Dmitry Kovalev
9edd4d4db7 Cleaning up vp9_get_pred_context_switchable_interp() functuion.
Change-Id: I67a45a41312ca0efd8fe00ccd8bdc0f97675d09f
2013-12-09 17:02:38 -08:00
hkuang
ff2c96be1f Implenment on demand border extension. In place extend
the border now. Next commit will totally remove the border.

Change-Id: Ic1e1ca9cc34f81c688715b3948689b47df63a151
2013-12-09 16:44:08 -08:00
Jingning Han
54040f94b9 Merge "Clean-ups in diamond_search_sad" 2013-12-09 16:12:39 -08:00
Jingning Han
f92b5842bf Merge "Full range motion search for regular block sizes" 2013-12-09 16:12:35 -08:00
Yaowu Xu
dad8dfe254 Merge "Further clean up of estimate_max_q." 2013-12-09 15:35:00 -08:00
Dmitry Kovalev
08c48ddc01 Renaming comp_pred_mode to reference_mode.
Change-Id: I83ffed2b1878a35ac35f07f9ee74309adc9c7b11
2013-12-09 15:13:34 -08:00
Dmitry Kovalev
347df4ce55 Merge "Renaming vp9_get_pred_context_tx_size() function." 2013-12-09 15:10:49 -08:00
Dmitry Kovalev
7293ef7ac0 Cleaning up read_inter_block_mode_info() function.
Change-Id: Ib4e215a80f00e342d857a54a4ca1b2dc82b6db1d
2013-12-09 14:45:17 -08:00
Dmitry Kovalev
2c3120274a Removing max_uv_txsize_lookup lookup table.
Adding get_uv_tx_size_impl() with tx size selection logic, rewriting
get_uv_tx_size().

Change-Id: I3ecb108059a41be227a8c89a0710bd174f508951
2013-12-09 14:03:23 -08:00
Ehsan Akhgari
45bac0c496 Add include guards to setupintrarecon.h and vpx_once.h
Change-Id: Ife17fc6369ce32f36d5c7f8a2ef5a3b7724d81b9
2013-12-09 10:59:28 -08:00
Paul Wilkins
267daddecc Further clean up of estimate_max_q.
Clean up and simplification of both estimate_max_q
variants and only call once per clip/section.

This leads to a more constrained range of Q values
across a clip / section.

Average gains across all 4 test sets:-

PSNR ~0.5%  SSIM ~0.3%

Change-Id: If77d5f7bb50939a464e117724f4da5b001c62d70
2013-12-09 17:49:46 +00:00
Dmitry Kovalev
a19d694f09 Merge "Removing BLOCK_TYPES and adding PLANE_TYPES constant instead." 2013-12-07 02:20:41 -08:00
Alex Converse
1c3e04bb94 Remove some dead code
Change-Id: I0953a3b28758811f9d6a85787850e77592bd7670
2013-12-06 21:21:04 -08:00
Dmitry Kovalev
cb92f4f042 Renaming vp9_get_pred_context_tx_size() function.
Change-Id: Ia6d6f4dfb1fd1ec0f8ba53796b59a802e9d7881d
2013-12-06 15:31:06 -08:00
Yaowu Xu
2341747805 Disable warning for intentional lossless coding
For VP9, lossless coding is enabled by passing 0 for both min_q and
max_q. This is a valid configuration, and should not be warned.

Change-Id: Idd117579cd89cd14c0723b1d7e482067ac12b401
2013-12-06 14:47:25 -08:00
Jim Bankoski
dcb17eaefc Merge "Disable early exit based on distortion in lossless" 2013-12-06 14:46:28 -08:00
Jingning Han
44627a9677 Clean-ups in diamond_search_sad
Use the pre-fetched stride value.

Change-Id: I8d4aaedab7a83a4870be51c110da27e55ca3bc85
2013-12-06 14:25:20 -08:00
Dmitry Kovalev
b6e5bb27c9 Merge "Renaming reference mode context calculation function." 2013-12-06 14:22:47 -08:00
Dmitry Kovalev
af04bfa300 Merge "Replacing b_width_log2 with num_4x4_blocks_wide_lookup." 2013-12-06 14:19:59 -08:00
Yaowu Xu
f8c06fb2ac Disable early exit based on distortion in lossless
In lossless coding, distortion is always 0. Early exit based on this
metric was incorrect.

This CL also changed to use best_rd instead of distortion as the metric
for easly exit as requested by Jim.

Change-Id: I8ef3e407ac03b4abc3283b273f936a68fad5c2ab
2013-12-06 13:37:55 -08:00
James Zern
18744fe3ab Merge "add tile test vectors" 2013-12-06 12:47:57 -08:00
Jingning Han
b295092b8f Full range motion search for regular block sizes
Add a full range motion search for regular block sizes. This runs
exhaustive search within the given reference area. This commit further
optimizes the search process by combining 4 points test into one
pipeline, which gives 30% speed-up as compared to run each individual
point at a time.

This full range search serves as a best possible motion search reference.
When replacing the diamond search with full range search, the speed 0
runtime of bus CIF at 2000 kbps goes from 153872ms to 623051ms. The
compression performance compared to speed 0 setting gains 0.585% for
derf set.

Change-Id: Ieef1225216b0b86b4ac4872fa7fb9e18bf2eabb3
2013-12-06 12:24:53 -08:00
Dmitry Kovalev
2da30a96d4 Merge "Removing duplicated C code from vp9_loopfilter_filters.c file." 2013-12-06 12:13:24 -08:00
Dmitry Kovalev
52618d28e1 Replacing b_width_log2 with num_4x4_blocks_wide_lookup.
Change-Id: I8ab9bbe2595ed1743f35223b6a6ce6d023b9a20e
2013-12-06 12:04:06 -08:00
Dmitry Kovalev
63963f51ef Renaming reference mode context calculation function.
Renames:
  vp9_get_pred_context_comp_inter_inter => vp9_get_reference_mode_context
  vp9_get_pred_prob_comp_inter_inter    => vp9_get_reference_mode_prob

Change-Id: I3bbb69481e6b0c848028667c9269f567f293d3bd
2013-12-06 11:23:01 -08:00
Dmitry Kovalev
d6b159d4a6 Removing BLOCK_TYPES and adding PLANE_TYPES constant instead.
Change-Id: Ic3bb862e93aedf6a489a33ea6f7e5097d96855ee
2013-12-06 10:54:00 -08:00
Yaowu Xu
2dd730ccb3 Merge "Remove rate correction factor." 2013-12-06 10:39:51 -08:00
Dmitry Kovalev
cf4dfdc8e7 Merge "Moving vp9_tree_probs_from_distribution() to encoder." 2013-12-06 10:18:30 -08:00
Dmitry Kovalev
8eac2ca840 Merge "Renaming constants." 2013-12-06 09:55:02 -08:00
Dmitry Kovalev
5be34ba80f Merge "vp9_get_pred_context_intra_inter() clean up." 2013-12-06 09:14:36 -08:00
Adrian Grange
de2046275d Merge "Remove redundant calls to vp9_update_mode_info_border" 2013-12-06 08:59:47 -08:00
Jingning Han
ee02f3fbed Merge "Remove redundant bsize mapping in motion search" 2013-12-06 08:57:58 -08:00
Paul Wilkins
570b6d25c0 Remove rate correction factor.
Removed an adaptive rate correction factor that was having
a negative impact on quality in many clips. This factor
was influencing the Q range available to each frame
independently of the bits allocated to each.

Average results with DISABLE_RC_LONG_TERM_MEM.

derf +0.199, -0.059.
yt +3.957, +3.798
std hd +1.577, +2.140
yt hd +4.127, +4.513

Average results without  DISABLE_RC_LONG_TERM_MEM

derf -0.628, -0.665
yt +3.432, +3.015
std hd -0.105, +0.153
yt hd +3.432, +3.015

Change-Id: I45bab6b606f49a442e7b27a6d631f3ffd843bbce
2013-12-06 16:57:16 +00:00
James Zern
937c3b990b add tile test vectors
3840x2160

vp90-2-08-tile_1x8_frame_parallel.webm
vp90-2-08-tile_1x8.webm

vpxenc crowd_run_2160p50.y4m \
  --codec=vp9 -p 2 \
  --frame-parallel=${fpm} \
  --tile-columns=${tc} \
  --limit=10 \
  --auto-alt-ref=1 \
  --lag-in-frames=5 \
  --target-bitrate=2500

Change-Id: I6dc19b4fca483d03ef9a897a843bf9037d095c8e
2013-12-05 21:04:46 -08:00
James Zern
d77b9d1ce9 Merge "Fix bug with put slice cb function." 2013-12-05 20:21:16 -08:00
Dmitry Kovalev
4ac6a2552b Moving vp9_tree_probs_from_distribution() to encoder.
Writing custom coeff branch count calculation (which is much clearer) in
adapt_coef_probs() function. Removing vp9_treecoder.c file.

Change-Id: I8880fb7a39996c8bcf6cd0acf9898a8c712ba91f
2013-12-05 18:13:26 -08:00
Dmitry Kovalev
d72c847fe8 Merge "Renaming PREV_COEF_CONTEXTS to COEFF_CONTEXTS." 2013-12-05 17:54:44 -08:00
Dmitry Kovalev
377fa8aff8 Renaming PREV_COEF_CONTEXTS to COEFF_CONTEXTS.
Also adding BAND_COEFF_CONTEXTS macro to simplify for loop logic.

Change-Id: I12a78a49cf1addf81e6b3fe2a3736ec2b79bd79e
2013-12-05 17:08:06 -08:00
Dmitry Kovalev
6fd71e1b09 vp9_get_pred_context_intra_inter() clean up.
Renaming:
 vp9_get_pred_context_intra_inter => vp9_get_intra_inter_context
 vp9_get_pred_prob_intra_inter    => vp9_get_intra_inter_prob

Change-Id: I2c1affea2e84f4e616137c6df82adb11c7845781
2013-12-05 17:01:03 -08:00
Deb Mukherjee
8de1d8bfe3 Merge "Further rate control cleanups" 2013-12-05 16:55:35 -08:00
Dmitry Kovalev
da519166e9 Merge "Cleaning up vp9_detokenize.c file." 2013-12-05 16:45:10 -08:00
Dmitry Kovalev
f7396f3394 Merge "Removing vp9_default_coef_probs.h file." 2013-12-05 16:44:26 -08:00
Deb Mukherjee
52d273674b Further rate control cleanups
Includes various cleanups.
Streamlines the interfaces so that all rate control state
updates happen in the vp9_rc_postencode_update() function.
This will hopefully make it easier to support multiple
rate control schemes.
Removes some unnecessary code, which in rare cases can casue
a difference in the constrained quality mode output, but
other than that there is no bitstream change yet.

Change-Id: I3198cc37249932feea1e3691c0b2650e7b0c22fc
2013-12-05 16:31:04 -08:00
Dmitry Kovalev
0d4b8d7e43 Renaming constants.
NUM_YV12_BUFFERS        => FRAME_BUFFERS
ALLOWED_REFS_PER_FRAME  => REFS_PER_FRAME
NUM_REF_FRAMES_LOG2     => REF_FRAMES_LOG2
NUM_REF_FRAMES          => REF_FRAMES
NUM_FRAME_CONTEXTS_LOG2 => FRAME_CONTEXTS_LOG2
NUM_FRAME_CONTEXTS      => FRAME_CONTEXTS

Change-Id: I4e1ada08f25d8fa30fdf03aebe1b1c9df0f87e63
2013-12-05 16:23:09 -08:00
Dmitry Kovalev
2b95a05bf6 Removing duplicated C code from vp9_loopfilter_filters.c file.
Change-Id: I299b621fca1c8ff5d296afde9698cdcccfecaf3f
2013-12-05 15:49:57 -08:00
Frank Galligan
bbf61e35e7 Fix bug with put slice cb function.
Change-Id: Idfbd87d0a4bebdce7dd587c8446e7fa75b030d91
2013-12-05 15:45:15 -08:00
Adrian Grange
93d8a3fd29 Remove redundant calls to vp9_update_mode_info_border
Removed calls to vp9_update_mode_info_border since
they immediately followed code that initialized the
entire buffer to 0.

Change-Id: Ife06794daa20439a0b607a83a87f88df59afac40
2013-12-05 15:02:32 -08:00
Dmitry Kovalev
3eb0170ea6 Using lookup to determine tx_size in encode_superblock().
Change-Id: I68d6217db6f67da15380cd59ec5eda0c44da7d34
2013-12-05 12:25:03 -08:00
Dmitry Kovalev
6df9ec52a0 Merge "Cleaning up vp9_get_pred_context_tx_size() function." 2013-12-05 09:59:00 -08:00
Yaowu Xu
bdf3f07677 Merge "Disable --tune=ssim for vp9" 2013-12-05 09:15:13 -08:00
Tero Rintaluoma
047b0b01bb Fix show existing frame
- Disable mode info update in case where current frame is coded
  as "show existing frame".
- Should fix issue 676.

Change-Id: Ibee681850eb307f982da6528d3e31cb94f881c08
2013-12-05 12:10:10 +02:00
Frank Galligan
7ecf3bc91c Fix ref count decrement code.
Buffer 0 would never be decremented, so it could only be used
once.

Change-Id: I605d99fa2a513eadae6a0e230161729880653282
2013-12-04 22:21:00 -08:00
Dmitry Kovalev
5eeffc9fc5 Cleaning up vp9_get_pred_context_tx_size() function.
Change-Id: Ia6ef876e3d1e66b2182a9c0bce3fd758691cd381
2013-12-04 21:35:30 -08:00
Dmitry Kovalev
a1123538a5 Moving vp9_token from common to encoder.
Change-Id: I40a070c353663e82c59e174d7c92eb84f72ed808
2013-12-04 19:36:58 -08:00
Frank Galligan
8363349b84 Merge "Fix the initial references to frame buffers." 2013-12-04 19:26:40 -08:00
Jingning Han
45aa6f15b0 Remove redundant bsize mapping in motion search
Both single frame and compound inter motion search run with luma
component only. Hence removing the block size mapping therein.

Change-Id: I217488e702432ae9fa0e95bf6f516ebb36b5c79b
2013-12-04 17:25:06 -08:00
Dmitry Kovalev
934e10d0f1 Cleaning up vp9_detokenize.c file.
Using consistent names (block_idx => block, dqcoeff_ptr => dqcoeff,
pt => ctx), inlining get_tx_eob() call.

Change-Id: I05208e57df81bbb8f25b8274684a48192e9de464
2013-12-04 17:24:18 -08:00
Jingning Han
61da0870b9 Merge "Add a test vector for loopfilter" 2013-12-04 17:13:57 -08:00
Dmitry Kovalev
4afd141a05 Removing vp9_default_coef_probs.h file.
Moving all probability tables from removed file to vp9_entropy.c.

Change-Id: I12846f1da778c3016d96b82e53384d4634883430
2013-12-04 17:04:35 -08:00
Dmitry Kovalev
cf8e3d2c5c Merge "Cleaning up vp9_dec_build_inter_predictors_sb function." 2013-12-04 16:57:54 -08:00
Frank Galligan
9ed616a56c Fix the initial references to frame buffers.
The old code would start in a mixed state, where all the reference
frames were pointing to frame buffer 0, but the reference counts
were 0. This is why we needed special code for the first frame.

Change-Id: I734961012917654ff8c0c8b317aac00ab75ded1a
2013-12-04 16:53:18 -08:00
Dmitry Kovalev
3712b58c2f Merge "Cleaning up vp9_entropy.h file." 2013-12-04 16:46:41 -08:00
Dmitry Kovalev
97b36b26e0 Merge "Removing old code." 2013-12-04 16:45:11 -08:00
Dmitry Kovalev
16c3a25f71 Merge "Compact formatting default_coef_probs_{4x4, 8x8, 16x16, 32x32}." 2013-12-04 16:37:10 -08:00
Adrian Grange
bc02079cb2 Merge "Modified spatial scalable encoder & unit tests" 2013-12-04 15:49:12 -08:00
Dmitry Kovalev
c6ca5c5ad9 Compact formatting default_coef_probs_{4x4, 8x8, 16x16, 32x32}.
Change-Id: If40b930431766d5179b9769509b5e4ca1628e9cc
2013-12-04 15:45:28 -08:00
Jingning Han
ebb583d291 Add a test vector for loopfilter
The test vector exercises the loopfilter behavior at frame boundary.

blue_sky_1080p25.y4m --good --cpu-used=2 --threads=0 --profile=0
--lag-in-frames=25 --limit=300 --min-q=0 --max-q=63 --cq-level=20
--end-usage=0 --auto-alt-ref=1 -p 2 --kf-max-dist=9999 --kf-min-dist=0
--drop-frame=0 --static-thresh=0 --bias-pct=50 --minsection-pct=0
--maxsection-pct=2000 --arnr-maxframes=7 --arnr-strength=5
--arnr-type=3 --sharpness=0 --undershoot-pct=100 --target-bitrate=6000

Change-Id: Ibd0807395d2fe87f24f81f990369678df3de7c23
2013-12-04 13:05:21 -08:00
Yaowu Xu
d84c098417 Disable --tune=ssim for vp9
The feature is not yet supported.

Change-Id: If46382302d2077b20670391b4a03017045a104f5
2013-12-04 12:39:15 -08:00
Dmitry Kovalev
da2da79012 Merge "Formatting vp9_pareto8_full array." 2013-12-04 12:22:50 -08:00
Dmitry Kovalev
beb35aba19 Cleaning up vp9_dec_build_inter_predictors_sb function.
Using get_plane_block_size() instead of manipulation with subsampling
values, calculating all required values only once without redundant calls
to b_width_log2().

Change-Id: I00303f2a0926f9c4cb17f34591adda60615f8919
2013-12-04 12:11:01 -08:00
Adrian Grange
475d1d60b8 Modified spatial scalable encoder & unit tests
Modifications to the spatial scalable encoder to match
changes made to the scaling code in the decoder.

In particular, the use of a dummy first frame was removed
now that the decoder is able to handle a smaller first
frame.

SvcTest.FirstFrameHasLayers unit test re-enabled.

Change-Id: Ic2e91fbe4eadf95895569947670d36d68abaf458
2013-12-04 11:45:40 -08:00
Yunqing Wang
f6582d6928 Revert "Simplify mask checking in loop filters"
Jingning saw bitstream change with this patch. It could be true
that (mask_16x16_0 & 1) is 1, but (mask_16x16_1 & 1) is 0 in some
edge cases.

This reverts commit 8f05e70340.

Change-Id: I0a529435ce816a1e14653eb510d5090de276070a
2013-12-04 11:31:19 -08:00
Dmitry Kovalev
1470789927 Merge "Moving eob array to the encoder." 2013-12-04 10:58:02 -08:00
Adrian Grange
584c72992a Merge "Change default behavior to assume sampled chroma" 2013-12-04 09:35:14 -08:00
Yunqing Wang
920a074e89 Merge "Improve idct16x16: _256_add_sse2(x1.107)&_10_add_sse2(x1.012)" 2013-12-04 08:50:51 -08:00
Dmitry Kovalev
30a5a07a71 Removing old code.
Change-Id: I7ccbe13e1accd292a3e0e98522416f9c4b4bc82b
2013-12-03 19:44:48 -08:00
Dmitry Kovalev
ff6d6a9f07 Formatting vp9_pareto8_full array.
Change-Id: Ic7f47a8d233daf5e61e82092865837ea4eda4095
2013-12-03 18:49:19 -08:00
Yaowu Xu
ecc0a1ece8 Merge "Fix a spelling mistake in filename" 2013-12-03 18:11:36 -08:00
Yaowu Xu
43110b2c29 Merge "Fix VP8 border replication for very small image" 2013-12-03 18:03:08 -08:00
Dmitry Kovalev
f00d157c12 Moving eob array to the encoder.
In the decoder we don't need to save eobs, we can pass eob as an argument.
That's why removing eob arrays from VP9Decompressor and TileWorkerData,
and moving eob pointer from macroblockd_plane to macroblock_plane.

Change-Id: I8eb919acc837acfb3abdd8319af63d1bbca8217a
2013-12-03 17:59:32 -08:00
Dmitry Kovalev
8e89e2f2e0 Cleaning up vp9_entropy.h file.
Renaming constants for consistency:
  DCT_VAL_CATEGORY1 => CATEGORY1_TOKEN
  DCT_VAL_CATEGORY2 => CATEGORY2_TOKEN
  DCT_VAL_CATEGORY3 => CATEGORY3_TOKEN
  DCT_VAL_CATEGORY4 => CATEGORY4_TOKEN
  DCT_VAL_CATEGORY5 => CATEGORY5_TOKEN
  DCT_VAL_CATEGORY6 => CATEGORY6_TOKEN
  DCT_EOB_TOKEN     => EOB_TOKEN
  DCT_EOB_MODEL_TOKEN => EOB_MODEL_TOKEN
  MAX_ENTROPY_TOKENS => ENTROPY_TOKENS

Moving constants:
  INTER_MODE_CONTEXTS from vp9_entropy.h to vp9_blockd.h.
  EOSB_TOKEN from vp9_entropy.h to vp9_tokenize.h

Change-Id: I5fcbf081318e1d365792b6d290a930c6cb0f3fc2
2013-12-03 17:23:03 -08:00
Yaowu Xu
33e5e35fdb Fix a spelling mistake in filename
Change-Id: Ic06124ed95a50935b1c6509907dcac87c7707bcc
2013-12-03 17:19:41 -08:00
Yaowu Xu
a0f77f6acb Fix VP8 border replication for very small image
Also added a test vector for this issue.

Change-Id: I8a8654f9d33b27afd53c295f1ea44d198550d067
2013-12-03 17:06:17 -08:00
Jingning Han
3c34619125 Fix initialization order for the encoder
This commit makes the coefficient tree initialized prior to token
initialization, where the coefficient costs are filled out according
to the probabilities associated with coefficient value categories.

Change-Id: If4e89c3923058376f8382c683fe4a225a4a38af3
2013-12-03 15:29:24 -08:00
Dmitry Kovalev
fd16baae25 Merge "Making names consistent with REFERENCE_MODE enum name." 2013-12-03 12:48:34 -08:00
Dmitry Kovalev
4585b9dbac Merge "Removing token_to_counttoken array." 2013-12-03 12:29:56 -08:00
Dmitry Kovalev
ac830b3970 Merge "Using local variable for token_cache." 2013-12-03 12:29:50 -08:00
Dmitry Kovalev
09577b8c8d Merge "Removing dummy assignments." 2013-12-03 10:59:34 -08:00
Alex Converse
f63c75de84 Merge "Remove plane_block_idx." 2013-12-03 10:51:13 -08:00
Jingning Han
b88b49a7bc Merge "Fix intra prediction ref selection in skip_encode" 2013-12-03 09:47:41 -08:00
Paul Wilkins
8a4310b160 Merge "Fix use_uv_intra_estimate in rd loop" 2013-12-03 04:30:50 -08:00
Jingning Han
f01ad926d0 Fix intra prediction ref selection in skip_encode
This commit fixes the intra prediction reference source selection
in the settings of skip_encode. Use original boundary pixels as
prediction reference, when the inverse transform and reconstruction
are skipped in the per block size rate-distortion optimization loop.

Change-Id: I36081aa30aa46e203e0e6f4e8a420fd08269469a
2013-12-02 18:48:51 -08:00
Dmitry Kovalev
54b5deff77 Removing token_to_counttoken array.
Change-Id: I02050bcca4c9fd68a00abdea5aba0c3f8993d9a9
2013-12-02 18:41:53 -08:00
Alex Converse
2360a5f093 Remove plane_block_idx.
Its last remaining caller can be passed its results directly without any
additional work. Also, it's not non-4:2:0 safe.

Change-Id: Ia5089ba5f7f66c7617270483c619c9271aefd868
2013-12-02 18:33:50 -08:00
Abo Talib Mahfoodh
e4419ab691 Improve idct16x16: _256_add_sse2(x1.107)&_10_add_sse2(x1.012)
The performance gain of idct16x16_10_add_sse2 function is not
noticeable. However since both functions use the IDCT16_1D,
idct16x16_10_add_sse2 should be modified as well.
Tested with: park_joy_420_720p50.y4m

Change-Id: I02b957e36fcf997c677d15baf496533895271bff
2013-12-02 21:08:56 -05:00
Jingning Han
9f81a50c85 Fix use_uv_intra_estimate in rd loop
This commit fixes the use of uv_intra_estimate by properly restoring
the mode_info struct required by rd_pick_intra_sbuv_mode.

Change-Id: I6a156d79533c4e2e60dfd3b8c5bb0a42a8eca280
2013-12-02 17:30:41 -08:00
Dmitry Kovalev
5ab920d2ae Using local variable for token_cache.
The difference with the old code is that originally the whole token_cache
was initialized with zeros at the beginning of decode_coefs() function.
Now we set several zero values explicitly with "token_cache[scan[c]] = 0".

Change-Id: I88cc5031f01d13012d1a4491739c36cb44f9401e
2013-12-02 15:44:26 -08:00
Dmitry Kovalev
e7922a5b70 Merge "Cleaning up decode_coefs() function." 2013-12-02 15:31:10 -08:00
Yunqing Wang
8f182a1cac Merge "improve vp9_idct32x32_34(x1.472)&1024(x1.032)_add_sse2" 2013-12-02 15:10:05 -08:00
Alex Converse
5cf74bf10c Merge "Disable partitioning in the dominant subsampling direction." 2013-12-02 15:08:22 -08:00
Dmitry Kovalev
9144111296 Cleaning up decode_coefs() function.
Removing goto and using while loop instead, renaming seg_eob to max_eob,
moving eob token counter increment.

Change-Id: Idcc4b3a45e4f313596a71776aef56691a6647e5f
2013-12-02 14:36:06 -08:00
Alex Converse
962fc2e1e7 Disable partitioning in the dominant subsampling direction.
E.g. disable vertical partioning for 4:2:2. Until we come up with something
better to do with the chroma block size, this prevents an assert error.

Change-Id: I9394fb3f14ec1343abc3ad4769de208e6278f285
2013-12-02 13:38:11 -08:00
Yunqing Wang
37e68aba55 Merge "Simplify mask checking in loop filters" 2013-12-02 12:06:26 -08:00
Johann
b9db869a3d Merge branch 'forest'
Bookkeeping. master already contains everything
in forest.

Change-Id: I1471064eef341411c6ed0c9e855fce18cff12ebc
2013-12-02 11:13:36 -08:00
Dmitry Kovalev
862c22cf7d Merge "Moving token-encoding related stuff from common to encoder." 2013-12-02 10:32:04 -08:00
Dmitry Kovalev
526a774adb Merge "Moving reaster_block_offset{,_int16} from vp9_blockd.h to vp9_rdopt.h." 2013-12-02 10:31:31 -08:00
Yaowu Xu
e237b7dea3 Merge "Simplify super_block_yrd()" 2013-12-02 09:39:42 -08:00
Yaowu Xu
56d9a4fcd5 Merge "Merge tx selection into RD calculation" 2013-12-02 09:39:10 -08:00
Deb Mukherjee
e924057d80 Fixing inadvertent change
Fixes an inadvertant change made in a previous patch while doing
some experiments.

Change-Id: I9961f2157c803676491a3d6daf056ff8a37367b3
2013-11-27 14:50:34 -08:00
Yunqing Wang
8f05e70340 Simplify mask checking in loop filters
Considering a horizontal edge, if mask_16x16 is 1 for an even-
indexed 8x8 block, then mask_16x16 is 1 for next 8x8 block in
same row. Similiar to a verticle edge, if mask_16x16 is 1 for
an even-rowed 8x8 block, then mask_16x16 is 1 for the 8x8 block
right below it in next raw. Based on that, the mask_16x16 checking
can be simplified to save cycles. The corresponding 8-pixel
vp9_mb_lpf_horizontal_edge code can also be removed.

Change-Id: Ic3fe7a5674322239208cbe2731dc3216ce2084f3
2013-11-27 14:10:57 -08:00
Dmitry Kovalev
d83d61d942 Moving reaster_block_offset{,_int16} from vp9_blockd.h to vp9_rdopt.h.
Change-Id: I5a5888d4639cc6b7eb266be47581dd15ba08c91e
2013-11-27 12:57:21 -08:00
Deb Mukherjee
a622ed554f Merge "Continued rate control clean-ups" 2013-11-27 12:04:38 -08:00
Deb Mukherjee
d17ac4feb2 Continued rate control clean-ups
Moves all post encode rate control updates to a separate function
plus other cleanups.

Change-Id: I70e8eccf666c88d8b649b969997fd84d27e4baaa
2013-11-27 11:34:48 -08:00
Dmitry Kovalev
f9da823216 Moving token-encoding related stuff from common to encoder.
Change-Id: I0e59d320407b3bed0ba3622a7b29975f6fad7ebf
2013-11-27 11:27:57 -08:00
Dmitry Kovalev
e2f1d02eb3 Merge "Moving mode encodings from common to encoder + cleanup." 2013-11-27 11:00:54 -08:00
Yaowu Xu
e9c19617bf Merge "vp9_short_fdct32x32_rd vp9_short_fdct32x32 optimized for AVX2" 2013-11-27 10:27:32 -08:00
Dmitry Kovalev
d3a2e55af4 Removing qcoeff buffers from the decoder.
We only need qcoeff buffers in the encoder. Reducing TileWorkerData struct
and VP9Decompressor struct sizes by 24K.

Change-Id: Id148868461f7ffa3d3dd634b371503ae9c57e207
2013-11-26 18:52:10 -08:00
Yaowu Xu
971112f965 Simplify super_block_yrd()
Change-Id: Iae16644faeed920e69cd5d1db71e2e1e4bda241c
2013-11-26 17:05:56 -08:00
Dmitry Kovalev
c5bdc9dfd2 Making names consistent with REFERENCE_MODE enum name.
Change-Id: I17268af3e0cbf7e5788c3154466e404947c944b3
2013-11-26 16:46:13 -08:00
Dmitry Kovalev
fc3c3303f1 Removing dummy assignments.
Change-Id: I10d1a4bcac751a982d9dd135f019e3a4d92f8522
2013-11-26 15:35:11 -08:00
Dmitry Kovalev
f4bf712fbb Moving mode encodings from common to encoder + cleanup.
Change-Id: I248ccb1532e2cd95314d0b95108f2c2e71cf084f
2013-11-26 14:53:17 -08:00
Yaowu Xu
b60293e1ce Merge "Amended some comments for clarity" 2013-11-26 14:32:02 -08:00
Dmitry Kovalev
4622cd14c2 Merge "Deleting vp9_treereader.h file." 2013-11-26 14:13:30 -08:00
Dmitry Kovalev
d7efe068d2 Deleting vp9_treereader.h file.
Renaming treed_read() to consistent vp9_read_tree() and moving it from
deleted vp9_treereader.h to vp9_dboolhuff.h file.

Change-Id: Iedd8655acbe25e4fcf62b79e5a13bdea69b6b004
2013-11-26 12:38:58 -08:00
Yaowu Xu
08d6fa6de4 Merge tx selection into RD calculation
Change-Id: I406021e34b31b899202a99b39d3da4fa06ebee69
2013-11-26 12:37:25 -08:00
Yunqing Wang
099d27432b Merge "Add a noise test vector" 2013-11-26 11:56:13 -08:00
James Zern
20a7691c92 Merge "thumb: Fix a typo in a comment" 2013-11-26 11:49:01 -08:00
Yunqing Wang
f234136414 Add a noise test vector
Added the test vector provided by Attila, which caught the bug in
Issue 661 "Decoder produces mismatched outputs with ssse3 enabled
and disabled"

vp90-hantro-stream-001.ivf
size: 320x180; 20 frames

Change-Id: Ic0d2b57ac7596ecb938dd55abc8c706fc2dd6d8f
2013-11-26 11:30:13 -08:00
Yaowu Xu
5e4f4196a9 Merge "Fix unit test failures" 2013-11-26 11:22:30 -08:00
Frank Galligan
b4874e2c82 Fix 16 wide neon horz loopfilter.
Multiply by 3 was on 8bit vectors when it should have been on
16bit vectors.

Change-Id: I248c1429b3134dfd171dfab0ebb109fd2437e1fc
2013-11-26 10:02:40 -08:00
Yaowu Xu
03094a5533 Fix unit test failures
Change-Id: Ibc61ef81fafeb20df6df6e5496b6c01760f3dc84
2013-11-26 09:57:55 -08:00
Yunqing Wang
7a5fd6a1bf Merge "Do vertical loopfiltering in parallel" 2013-11-26 09:35:14 -08:00
Deb Mukherjee
65f14b0067 Merge "Some cleanups on rate control" 2013-11-26 09:34:20 -08:00
Abo Talib Mahfoodh
f97d91ab67 improve vp9_idct32x32_34(x1.472)&1024(x1.032)_add_sse2
vp9_idct32x32_34_add_sse2:
speedup: 1.472
IDCT32_1D_34 and MULTIPLICATION_AND_ADD_2 are optimized
based on the fact that Only upper-left 8x8 has
non-zero values.

vp9_idct32x32_1024_add_sse2:
speedup: 1.032

Tested with: park_joy_420_720p50.y4m

Change-Id: I8670ce547552b48695049de298e2fc46ce28dfbc
2013-11-26 12:28:26 -05:00
Martin Storsjo
f0339cc9cf thumb: Fix a typo in a comment
Change-Id: Ic318be9d74a95793abc41501fe563164de53a6d7
2013-11-26 10:57:01 +02:00
Dmitry Kovalev
5488da280d Merge "Moving mv entropy encodings calculation to the encoder side." 2013-11-25 19:15:21 -08:00
Dmitry Kovalev
d5f6ca8255 Merge "Removing vp9_modecosts.{c, h} files." 2013-11-25 19:14:47 -08:00
Deb Mukherjee
25f1195a25 Some cleanups on rate control
Removes the active_worst_qchanged variable since it is never
set to 1.

Change-Id: I29a291fd1068fd9b504a2db7768d45644c1eae3e
2013-11-25 18:58:45 -08:00
Dmitry Kovalev
56d048c412 Moving mv entropy encodings calculation to the encoder side.
Moved arrays:
  vp9_mv_joint_encodings
  vp9_mv_class_encodings
  vp9_mv_class0_encodings
  vp9_mv_fp_encodings

Change-Id: Iaf5008c579fcbd6d77fdd81d1aef8c71b5f308b7
2013-11-25 16:36:28 -08:00
Dmitry Kovalev
7ba7a5f817 Merge "Removing redundant call of vp9_init_mbmode_probs()." 2013-11-25 16:08:42 -08:00
Dmitry Kovalev
204ff1c868 Removing vp9_modecosts.{c, h} files.
Renaming vp9_init_mode_costs() to fill_mode_costs() and moving it to
vp9_rdopt.c.

Change-Id: Ib2542d216458f6dced9f4b7ccbdd2cd98176aa5a
2013-11-25 12:44:05 -08:00
Tom Finegan
249366b1ac vpxenc: Move config check code into its own source files.
- Add command line args that allow display of warnings without prompting
  for user input.
- Extend warning code to make it somewhat scalable.

Change-Id: I2bad8f9315f6eed120c2e1bbe0a2a5ede15fbf35
2013-11-25 12:05:45 -08:00
Dmitry Kovalev
939b297ac7 Reusing txfrm_block_to_raster_xy in vp9_xform_quant().
Change-Id: Ib273dfff3be284f3c9ae288e5315fb6c6126f9c2
2013-11-25 11:13:55 -08:00
Dmitry Kovalev
22216a8691 Merge "Cleaning up vp9_write_nmv_probs() function." 2013-11-25 11:03:00 -08:00
Dmitry Kovalev
3e72277272 Merge "Adding select_tx_size() function." 2013-11-25 10:59:56 -08:00
Dmitry Kovalev
cfc1f91c9f Merge "Moving {left, right}_block_mode to vp9_blockd.h." 2013-11-25 10:59:24 -08:00
Dmitry Kovalev
e8af3db88a Merge "Renaming COMPPREDMODE_TYPE enum and its members." 2013-11-25 10:59:08 -08:00
Yaowu Xu
dd69337e6e Amended some comments for clarity
Change-Id: I31c3908ba394095deb5d3a5d7b7c9b2b5328c3e8
2013-11-25 10:55:01 -08:00
Yaowu Xu
cc1e05ca5f Merge "In frame Q adjustment experiment." 2013-11-25 10:52:22 -08:00
Jingning Han
f547fb8e07 Merge "Use separate inter predictors for enc/dec" 2013-11-25 10:29:07 -08:00
Paul Wilkins
644bd87e8e In frame Q adjustment experiment.
The idea here is to allow "in frame" adjustment of the final Q
value used to encode each SB64, using segmentation.

There is also adjustment of the rd mult in regions of overspend.

Activated using aq_mode=2

Change-Id: I2f140cd898c9f877c32cd6d2e667f5e11ada4b1c
2013-11-25 10:22:55 -08:00
Yaowu Xu
3183135dd3 Merge "Fix a build issue with visual c." 2013-11-25 10:20:53 -08:00
Guillaume Martres
0c54beb1ee Merge "Rename block_yrd_txfm to block_rd_txfm" 2013-11-25 09:45:55 -08:00
Jingning Han
ba8b5e8d6d Use separate inter predictors for enc/dec
The decoder will construct inter predictor using lazy border extension,
while the encoder, going with multiple runs of motion search in the rate-
distortion optimization loop for each block, does border extension at
frame level. This commit makes separate the inter predictors for encoder
and decoder, respectively.

Change-Id: Ieca2fecba3a7201a6d64ef9f219e5d91e50559c3
2013-11-25 09:43:34 -08:00
Jingning Han
12e5ec6aa8 Merge "Separate setup_scale_factor/extend_frame_borders" 2013-11-25 09:14:46 -08:00
Adrian Grange
3173c21909 Change default behavior to assume sampled chroma
When calling check_initial_width through vp9_set_size_literal
the function was defaulting to using non-subsampled chroma.

This patch changes the default to assume sampled chroma as
an interim solution until complete support for other
color formats is added.

Change-Id: Id8e7e919b350e3473dfdf7551af6fd0716478b04
2013-11-25 08:59:29 -08:00
Yaowu Xu
86368faca9 Fix a build issue with visual c.
Change-Id: Ic8fc16ee1734cfde0d12a2e3abb3e9299382f3b1
2013-11-25 08:11:35 -08:00
Dmitry Kovalev
c6c7557f8e Cleaning up vp9_write_nmv_probs() function.
Change-Id: I9af38f1a0e226ee094c17081f044a722ac1caded
2013-11-24 16:20:59 -08:00
Guillaume Martres
87375e257b Rename block_yrd_txfm to block_rd_txfm
This function is also used with the U and V planes.

Change-Id: Ib6beae0438790bfb690b3a2bda9c5c8b0e89a9b8
2013-11-25 01:18:51 +01:00
Dmitry Kovalev
2d50c8498d Merge "Using partition counts from FRAME_COUNTS struct in the encoder." 2013-11-24 16:08:29 -08:00
Dmitry Kovalev
9fe88870c5 Merge "Cleaning up vp9_append_sub8x8_mvs_for_idx." 2013-11-24 16:08:20 -08:00
Dmitry Kovalev
78d3adbb21 Merge "Inlining and removing vp9_set_pred_flag_seg_id() function." 2013-11-24 16:07:57 -08:00
Paul Wilkins
f345da5238 Merge "Added cpuid compatibility for older MSVC versions" 2013-11-23 03:05:55 -08:00
Dmitry Kovalev
52b43a2876 Inlining and removing vp9_set_pred_flag_seg_id() function.
Change-Id: I0fd76937e847f78378a7ab3fa0af00a7c2c52b42
2013-11-22 17:32:11 -08:00
Dmitry Kovalev
520aa705cb Merge "Organizing all scan tables into lookup table." 2013-11-22 17:16:19 -08:00
Yaowu Xu
8caeeb886a Added cpuid compatibility for older MSVC versions
Change-Id: I891bf936e03411ca611620e7cb2eb5081993a346
2013-11-22 17:06:02 -08:00
Yaowu Xu
28e44bbb0b Merge "Fix bug in extend_frame chroma extended too far" 2013-11-22 17:01:07 -08:00
Dmitry Kovalev
fb9c19c62d Renaming COMPPREDMODE_TYPE enum and its members.
List of renames:
  COMPPREDMODE_TYPE      => REFERENCE_MODE
  SINGLE_PREDICTION_ONLY => SINGLE_REFERENCE
  COMP_PREDICTION_ONLY   => COMPOUND_REFERENCE
  HYBRID_PREDICTION      => REFERENCE_MODE_SELECT (like TX_MODE_SELECT)
  NB_PREDICTION_TYPES    => REFERENCE_MODES

Change-Id: If723dabe9435325d0165dcd028142a2c78b417b4
2013-11-22 16:35:37 -08:00
Dmitry Kovalev
350731e8f9 Organizing all scan tables into lookup table.
Change-Id: Ie829ee58a55157e6972c63cebe69a5d0a3221349
2013-11-22 16:20:45 -08:00
Dmitry Kovalev
52fa10a9a3 Cleaning up vp9_append_sub8x8_mvs_for_idx.
Change-Id: Ic92f15d82ff5cfa3df655d08e460335c2ef8a325
2013-11-22 15:28:32 -08:00
Dmitry Kovalev
75e4377d81 Using partition counts from FRAME_COUNTS struct in the encoder.
Change-Id: I6c3d47b00acabe7ffba22ffc73741173aa9a0bff
2013-11-22 14:26:39 -08:00
Jingning Han
86d2a9b978 Separate setup_scale_factor/extend_frame_borders
This commit takes out vp9_extend_frame_borders from
vp9_setup_scale_factors.

The refactoring is for the preparation of the use of lazy border
extension at decoder. This makes it necessary to handle border
extension separately at encoder/decoder. The use of
vp9_extend_frame_borders will be removed, when lazy border extension
is ready.

Change-Id: Ia3baba3d179d5f11eee1634f19b3b319d2a59186
2013-11-22 12:02:08 -08:00
Adrian Grange
2117fe0593 Fix decoder to handle display size correctly
The decoder ignored the display width & height
specified in the frame header.

This patch adds a control, VP9D_GET_DISPLAY_SIZE, to
allow the application to obtain the display width and
height from the frame header.

vpxdec has been modified to scale the output frame to
this size.

Should the request for the display size fail vpxdec will
use the native width and height of the raw decoded
frame instead.

Change-Id: I25db04407426dac730263720c75a7dd6400af68a
2013-11-22 11:58:07 -08:00
Dmitry Kovalev
0a64f943fc Merge "Cleaning up entropy probability update in encoder." 2013-11-22 10:52:40 -08:00
Dmitry Kovalev
e0ec61187e Merge "Removing txfrm_block_to_raster_xy() call from extend_for_intra()." 2013-11-22 10:51:38 -08:00
Yunqing Wang
384089004d Merge "Improve vp9_fdct4x4_sse2 (x1.2)" 2013-11-22 10:39:55 -08:00
Yunqing Wang
ed36720b66 Do vertical loopfiltering in parallel
This patch followed "Add filter_selectively_vert_row2 to enable
parallel loopfiltering" commit, and added x86 SSE2 optimization
to do 16-pixel filtering in parallel. For other optimizations
(neon and dspr2), current 16-pixel functions were done by calling
8-pixel functions twice, and real 16-pixel functions could be added
later.

Decoder speedup:
tulip clip:     2% speed gain;
old_town_cross: 1.2% speed gain;
bus:            2% speed gain.

Change-Id: I4818a0c72f84b34f5fe678e496cf4a10238574b7
2013-11-22 10:04:51 -08:00
Yaowu Xu
16ad35f64e Merge "Fix the cpuid macro for x86_64 non-gcc build" 2013-11-22 10:03:51 -08:00
Adrian Grange
d427fab587 Fix bug in extend_frame chroma extended too far
This fixes issue 667.

In the case where the frame was an odd number of pixels
wide or high, the border was being extended by one col
or row too far.

The calculation of color plane dimensions was modified
to use those already computed at the time the frame
buffer was allocated.

Also freed the temporary scaling buffer in vpxdec to
prevent a memory leak.

Change-Id: Ied04bdcdfd77469731408c05da205db1a6f89bf5
2013-11-22 09:55:10 -08:00
Jim Bankoski
a64a192c90 Merge changes Id1698a35,Idcabd0b9
* changes:
  detokenization speedups
  Don't write 0's to token_cache
2013-11-22 08:16:17 -08:00
Deb Mukherjee
5576a4e1cb Merge "Refactoring of rate control - part 1" 2013-11-22 08:06:48 -08:00
Deb Mukherjee
f1781e86b7 Refactoring of rate control - part 1
Moves all rate control variables to a separate structure,
removes some currently unused variables,
moves some rate control functions to vp9_ratectrl.c,
and splits the encode_frame_to_data_rate function.

Change-Id: I4ed54c24764b3b6de2dd676484f01473724ab52b
2013-11-22 07:07:24 -08:00
Dmitry Kovalev
7c8cac3c21 Removing txfrm_block_to_raster_xy() call from extend_for_intra().
Change-Id: I6a48d1f35ed5fe7a2c7499675b339994c9c3bdf2
2013-11-21 19:30:58 -08:00
Yaowu Xu
36dfb90c53 Fix the cpuid macro for x86_64 non-gcc build
Change-Id: I0c44800db10db8d74c1ddfe89abecfd1c53d0f8d
2013-11-21 18:02:20 -08:00
Tom Finegan
65ac291f20 Merge "vpxenc: Add vpxenc.h and move/rename the global_config struct" 2013-11-21 17:56:26 -08:00
Jim Bankoski
70ffd5d055 detokenization speedups
removed unnecessary ifs and branches ..

Change-Id: Id1698a35292659388f48926791024d1400f2cea9
2013-11-21 16:55:22 -08:00
Dmitry Kovalev
5925ba08a3 Merge "Using num_4x4_blocks_* instead of b_{width, height}_log2." 2013-11-21 16:48:34 -08:00
Tom Finegan
49dc9cafa6 vpxenc: Add vpxenc.h and move/rename the global_config struct
- Rename the struct to VpxEncoderConfig.
- The idea behind this is to enable checking the global settings against
  stream specific settings in source files other than vpxenc.c.

Change-Id: Ic736cbb714845b9466acb34671780d65b83ad1a8
2013-11-21 16:46:40 -08:00
Dmitry Kovalev
ad3333e2cd Merge "Removing plane_block_{width, height} functions." 2013-11-21 16:37:27 -08:00
Dmitry Kovalev
6042f781f7 Merge "Using txfrm_block_to_raster_xy() in encoder." 2013-11-21 16:24:22 -08:00
Dmitry Kovalev
485682c30a Adding select_tx_size() function.
Change-Id: I9d18b31661a2ccdcd4e25956882c7fc2d4b7002e
2013-11-21 15:55:40 -08:00
Dmitry Kovalev
27e6b5b6bd Using num_4x4_blocks_* instead of b_{width, height}_log2.
Change-Id: I9ea3946c17b19f511565cd771037abe7db8b3ddb
2013-11-21 15:53:06 -08:00
Joshua Litt
3aeebfb231 Merge "Removing PARAMS macro for consistency" 2013-11-21 15:06:51 -08:00
Frank Galligan
fe847e7660 Merge "Revert "Add 16 wide neon horz loopfilter."" 2013-11-21 15:06:17 -08:00
levytamar82
8def766de2 vp9_short_fdct32x32_rd vp9_short_fdct32x32 optimized for AVX2
Change-Id: I6366e84490883b72362f762369d7e5bccb64f02f
2013-11-21 14:19:49 -08:00
Frank Galligan
97d1258375 Revert "Add 16 wide neon horz loopfilter."
The change caused mismatches with some test vectors on neon.

Original CL: https://gerrit.chromium.org/gerrit/#/c/67863/

Change-Id: I913891636d53783e93cb1865ca78ded1821dc4b0
2013-11-21 14:01:33 -08:00
Jim Bankoski
b38e42fe9d Don't write 0's to token_cache
This code only updates the token_cache if the result is non0.

Change-Id: Idcabd0b993a926fea9c29dbec134b9c5c4859b40
2013-11-21 12:52:15 -08:00
Dmitry Kovalev
864e7c51b6 Syncing update_coef_probs() implementation with decoder.
Using for loop based on max_tx_size instead of separate checks. Combining
build_coeff_contexts() with update_coef_probs().

Change-Id: Ie335a7db29830677fbc14478a9c190d3c1068665
2013-11-21 12:36:02 -08:00
Abo Talib Mahfoodh
ec2dbdd107 Improve vp9_fdct4x4_sse2 (x1.2)
Modifications are done to reduce the total clock cycle.
Speedup: 1.2

Tested with: park_joy_420_720p50.y4m

Change-Id: Ia36b87e62e2f80a5fadaf5628729aedc80f38f3f
2013-11-21 15:04:35 -05:00
Dmitry Kovalev
4896d5c7ef Moving {left, right}_block_mode to vp9_blockd.h.
Both functions have no relation to motion vectors, so moving them from
vp9_findnearmv.h to vp9_blockd.h.

Change-Id: I74f524267886ab0fff4a2da793a10c906ed0f43a
2013-11-21 11:43:53 -08:00
Yunqing Wang
e002bb99a8 Merge "Add filter_selectively_vert_row2 to enable parallel loopfiltering" 2013-11-21 11:25:55 -08:00
hkuang
370bf116a2 Merge "Remove unnecessary eob checking." 2013-11-21 11:24:02 -08:00
Frank Galligan
2dd77580c0 Merge "Add 16 wide neon horz loopfilter." 2013-11-21 10:29:30 -08:00
Yunqing Wang
b5e6d6cccf Add filter_selectively_vert_row2 to enable parallel loopfiltering
Added filter_selectively_vert_row2 to be ready for parallel
loopfiltering in vertical direction. This change did 2-row
filtering at a time. If 2 vertically adjacent 8x8 blocks do same
type of filtering, we can do 16-pixel filtering in parallel.

Next, we need to provide 16-pixel loopfiltering functions in c
and optimized versions for codec speedup.

Change-Id: Idf97bbdd70566e55bd30e1fd25cb8544e33291be
2013-11-21 09:53:15 -08:00
Yunqing Wang
6c4964602a Merge "Correct ssse3 8/16-pixel wide sub-pixel filter calculation" 2013-11-21 09:40:02 -08:00
Frank Galligan
98de15137e Add 16 wide neon horz loopfilter.
Add support to do 16 pixel horizontal filtering in Neon.
Nexus devices saw about 0.5% decode speed increase.

Change-Id: I2993f6c2d49f31fa74976879eeaa289fd3f4e15d
2013-11-21 09:39:36 -08:00
Dmitry Kovalev
c90b6bb101 Removing redundant call of vp9_init_mbmode_probs().
This function is called from vp9_setup_past_independence() which is called
before the modified piece of code. Moving reset of inter_mode_probs  into
vp9_init_mbmode_probs() for consistency.

Change-Id: Ib188e8798e1fbe15407fd501406761b746fdda95
2013-11-20 21:56:38 -08:00
Tom Finegan
44dd3274da vpxenc: Warn users about incorrect quantizer settings.
Also, clean up stylistically questionable code near my changes.

Change-Id: I92c96a274cb339b7b74174a608f94ae86aba8354
2013-11-20 17:18:28 -08:00
Dmitry Kovalev
77a865d970 Merge "Removing old code." 2013-11-20 14:43:03 -08:00
Dmitry Kovalev
a218a96784 Merge "Adding MV_FP_SIZE constant." 2013-11-20 14:39:58 -08:00
Dmitry Kovalev
d54893da1d Merge "Using is_inter_block() and has_second_ref() functions." 2013-11-20 14:39:50 -08:00
Dmitry Kovalev
87ff7f2af3 Removing old code.
Change-Id: I67d1681c7b17661deb792c5e6a9e2014a73ff9b7
2013-11-20 14:05:21 -08:00
Dmitry Kovalev
a84c5f0f64 Using txfrm_block_to_raster_xy() in encoder.
Change-Id: Ibe847000467fe46bf8ce87d8f1ef8f2d5ad1eaf4
2013-11-20 13:58:21 -08:00
Yunqing Wang
256cf7ee7d Correct ssse3 8/16-pixel wide sub-pixel filter calculation
Although no mismatch was indicated for 8/16 wide sub-pixel filters
in issue 661, they had similar problems that could cause mismatch
potentially. This patch fixed calculations in HORIZx8/16
and VERTx8/16.

Change-Id: I169961c9d40a20340995b7d22aafc89ccf30bfca
2013-11-20 12:52:56 -08:00
Dmitry Kovalev
79b5a2b142 Removing plane_block_{width, height} functions.
Change-Id: I29c0dfcf41a1253d5e2a0d2ff740c0c38ebaa5a2
2013-11-20 12:39:29 -08:00
Jim Bankoski
302c33e49f Merge "Clean up removal of vp9_pareto8 table." 2013-11-20 12:30:03 -08:00
Dmitry Kovalev
1a69eed2c4 Using is_inter_block() and has_second_ref() functions.
Change-Id: Iadd771a33c8874f3b774923bca4da3c8fe5429ee
2013-11-20 12:08:10 -08:00
Dmitry Kovalev
4956fcd31b Adding MV_FP_SIZE constant.
Change-Id: I98d750ee92ff51fb714980418ea28be3b1d0f3c6
2013-11-20 12:07:57 -08:00
Yunqing Wang
82f8ae4c5b Merge "Support for extended feature flags enumeration leaf in CPUID instruction" 2013-11-20 12:01:39 -08:00
hkuang
6debc446e0 Remove unnecessary eob checking.
Change-Id: Ia568f70bddc1a2b62141a0197459119ca74c22b5
2013-11-20 11:58:11 -08:00
Jim Bankoski
25aae73a30 Merge "remove the model and copy in pack_mb_tokens" 2013-11-20 11:34:30 -08:00
Jim Bankoski
5bbb0c6295 Clean up removal of vp9_pareto8 table.
Change-Id: I5556e8d1fc150be8a3e93af21900829b59a500dc
2013-11-20 11:17:26 -08:00
Erik Niemeyer
9f26861147 Support for extended feature flags enumeration leaf in CPUID instruction
This CL fixes an overcite with the AVX2 support CL previously
merged (Change-Id: Idc03f3fca4bf2d0afd33631ea1d3caf8fc34ec29) that
prevented runtime execution of AVX2 code in WebM. 

Background:
Starting with the Sandybridge processor, the CPUID instruction was
enhanced to add various extended feature flag enumeration leaves.
Reading these leaves requires an additional input value for the CPUID
instruction which is stored in ECX. This change adds this second input
value for all ARCH_X86 and ARCH_x86_64 targets to the CPUID macros,
allowing checks of EBX bit 5 for AVX2 support. This capability will be
required moving forward to check for future processor features.

Change-Id: Ie9d872bc9ff68dad4b6578e4544e4dfd0ae26c36
2013-11-20 11:10:54 -08:00
Jingning Han
81b9fd4310 Merge "Take out assertion from inverse transforms" 2013-11-20 10:55:27 -08:00
Jim Bankoski
03276bf6e6 remove the model and copy in pack_mb_tokens
Change-Id: I00a5203c8ed76c184d936fccf93d76e7c06773d3
2013-11-20 10:06:04 -08:00
Yunqing Wang
0ef63f596d Fix stack pointer in sub-pixel filters
In commit "3d50da5397d20abc932d81453b26cde758293a40", the stack
pointer was modified while aligning the stack, and it needed to
be pop out at the end.

Change-Id: I062971e195f1f2ab9d0ab5fb84dcf215a0fcaa67
2013-11-20 09:42:44 -08:00
Guillaume Martres
b00057c88a Merge "vpxenc: add --aq-mode flag to control adaptive quantization" 2013-11-20 08:13:28 -08:00
Dmitry Kovalev
c511f560bf Cleaning up entropy probability update in encoder.
Change-Id: I94cb9e3d910dff74bf90906dd96e3a4e06ebdbe6
2013-11-19 19:49:56 -08:00
Marco Paniconi
d486427cf1 Undo the vp8 change in "Reduce loop filter in..."
Patch in https://gerrit.chromium.org/gerrit/#/c/41176/
was merged into repository by mistake.

Change-Id: I235c71af26bb2d72698c8aac2301e5a7e9c5f960
2013-11-19 17:16:00 -08:00
Jim Bankoski
7a8a68e2bd Merge "scan order table lookup same for encoder and decoder" 2013-11-19 16:22:48 -08:00
Yunqing Wang
e8f8e77642 Merge "Fix decoder mismatch with ssse3 enabled" 2013-11-19 16:19:32 -08:00
Jingning Han
75673cfc3d Merge "Use restore_dst_buf in handle_inter_mode" 2013-11-19 16:19:04 -08:00
Dmitry Kovalev
e8346f8cf7 Merge "Cleaning up probability/cost functions." 2013-11-19 16:08:16 -08:00
Yaowu Xu
dd04ff506b Merge "Move vp9_setup_interp_filter() to encoder" 2013-11-19 16:01:19 -08:00
Jingning Han
82c32fe1b5 Use restore_dst_buf in handle_inter_mode
There are many places in handle_inter_mode that need to restore the
dst buffer pointers, due to buffer pointer swap and early rd search
breakout. This commit wraps these operations into an inline function
for clean-up.

Change-Id: I0462e8c41c8bc3cd8db07395489cac03d8e5be54
2013-11-19 15:33:16 -08:00
Jim Bankoski
d6667dd54f scan order table lookup same for encoder and decoder
Change-Id: I473947b5ca70b7a81151926284bff86f8555492a
2013-11-19 15:31:43 -08:00
Tom Finegan
a944deae97 Merge "vpxdec: Relocate WebM input support." 2013-11-19 15:30:41 -08:00
Yunqing Wang
3d50da5397 Fix decoder mismatch with ssse3 enabled
This patch fixed issue 661: "Decoder produces mismatched outputs
with ssse3 enabled and disabled." In sub-pixel filters, a pixel
value was multiplied by a filter coefficient, and the results
were added up. The order of adding up these multiplications had to
be arranged carefully to prevent incorrect overflowing.

Change-Id: Id08af4200fea9e1b896fc40157b8651c2c7e80f2
2013-11-19 15:10:04 -08:00
Dmitry Kovalev
65cee2f01a Merge "Simplifying partition context calculation." 2013-11-19 15:09:01 -08:00
Dmitry Kovalev
86b629efb6 Merge "Calculating dst pointer only once per transform block." 2013-11-19 15:05:46 -08:00
Dmitry Kovalev
e55d3e6d1b Cleaning up probability/cost functions.
Change-Id: Ifad4b0e6355ce49fcc6f470becc080e8069452ee
2013-11-19 14:59:12 -08:00
Jim Bankoski
60aba6558f Merge "entropy code speedup" 2013-11-19 14:58:44 -08:00
Yaowu Xu
df78fea166 Move vp9_setup_interp_filter() to encoder
As it is used in encoder only.

Change-Id: I5f2a8abbe72bb18cbf6ce36a3dc7e132aeae8ec2
2013-11-19 14:57:58 -08:00
Jim Bankoski
69541e1dec Merge "Reduce loop filter in cyclic refresh." 2013-11-19 14:42:32 -08:00
Yaowu Xu
f92cfa1ca6 Merge "Move vp9_sadmxn.h from common to encoder" 2013-11-19 14:41:33 -08:00
Jim Bankoski
8cf352abac entropy code speedup
Change-Id: Ic316d3374ff9a2b43897272260947d56765a0fdd
2013-11-19 14:31:38 -08:00
Jim Bankoski
ff4f1c4b76 scan order / neighbors converted to lookup
Change-Id: I64b189dfeee1cf3e90134a1a93497072f3361e5e
2013-11-19 12:55:44 -08:00
Yaowu Xu
30b03050a2 Move vp9_sadmxn.h from common to encoder
Change-Id: I6f6ba91b1b8b280902b171472314d665aa0baf0b
2013-11-19 12:46:08 -08:00
Yaowu Xu
5b3a8563de Merge "Fix a bug in vpxenc reading raw input frame" 2013-11-19 11:26:02 -08:00
Dmitry Kovalev
f6ec323906 Simplifying partition context calculation.
Reversing bit order of partition_context_lookup, and modifying accordingly
update_partition_context() and partition_plane_context().

Change-Id: I64a11f1a94962a3bf217de2f50698cb781db71a5
2013-11-19 11:17:30 -08:00
Johann
296b4be859 Merge "Disable avx/avx2 for Visual Studio 2010" 2013-11-19 11:17:20 -08:00
Yunqing Wang
f16fb829e6 Merge "Improve vp9_iht4x4_16_add_sse2 (x1.341)" 2013-11-19 11:11:47 -08:00
Yaowu Xu
a7c7e78aa5 Fix a bug in vpxenc reading raw input frame
The bug was introduced in 00a35aab. The reading of raw yuv input frame
was off by 4 bytes.

Change-Id: I6923ea5528aa529a47a06b64adca8f94847f19a6
2013-11-19 10:28:30 -08:00
Tom Finegan
2abe2d4664 vpxdec: Relocate WebM input support.
- Move it to webmdec.c and webmdec.h.
- Also, tidy up obvious style nits in the vicinity of code I was
  already touching.

Change-Id: Ie2898d06e73c1e9030d9c8d465b73ee7edc3c02a
2013-11-19 10:26:51 -08:00
Joshua Litt
51490e5654 Removing PARAMS macro for consistency
Change-Id: I23ed873a6c47b15491a2ffbcdd4f0fdeef1207a0
2013-11-19 09:28:18 -08:00
Dmitry Kovalev
953b1e9683 Removing raster_block_offset_uint8() function.
There is no need to use that function, it is much clear to pass offset
directly to the buffer.

Change-Id: I9026cb0c5094c46f97df5d7f7daeb952f2843b24
2013-11-18 19:00:49 -08:00
Dmitry Kovalev
9e1e7bee48 Merge "Finally removing txfrm_block_to_raster_block() function." 2013-11-18 18:43:16 -08:00
Dmitry Kovalev
b5c4520101 Calculating dst pointer only once per transform block.
Change-Id: I23fea0a2e85be8373600e3e2dae98d36acde389c
2013-11-18 18:37:53 -08:00
Dmitry Kovalev
220af9ac2c Merge "Cleaning up vp9_entropy.c file." 2013-11-18 18:04:56 -08:00
Abo Talib Mahfoodh
613e2d2e90 Improve vp9_iht4x4_16_add_sse2 (x1.341)
This rebase is a better implementation of the previous ones.

Modifications are done to reduce the total clock cycle.
Speedup: 1.341
Compiled with -O3
Tested with: park_joy_420_720p50.y4m

Change-Id: I940eaf283f60597ca0d9d2e13d518878d55ff02d
2013-11-18 20:53:13 -05:00
Dmitry Kovalev
d8c06d23da Cleaning up vp9_entropy.c file.
Change-Id: I568f5e2d4ef2f2affe013ba1691ffb546f1fe8c6
2013-11-18 17:18:14 -08:00
Joshua Litt
a782d63954 Decoder performance test added to unit tests
Change-Id: Id578a5fe2039631cefd82dc2ef98cc62683194c3
2013-11-18 17:12:05 -08:00
Tom Finegan
a7c4209724 Merge "vpxdec: Include frame number when decode fails." 2013-11-18 16:23:20 -08:00
Tom Finegan
f225b1e69b vpxdec: Include frame number when decode fails.
Change-Id: I6ea460af884d522319735e4416a2dd66c2f35d27
2013-11-18 16:13:04 -08:00
Yaowu Xu
040dc8c945 Merge "Fixed a bug in commit a4a5a210" 2013-11-18 15:43:41 -08:00
Yaowu Xu
a42ab027fd Merge "Move vp9_extend.{h,c} from common to encoder" 2013-11-18 15:43:32 -08:00
Yaowu Xu
e63aaf9ad1 Fixed a bug in commit a4a5a210
Commit a4a5a210 enabled lossless coding, but the commit incorrectly
disabled the usage of skip in encoder even when skip should be used.
This commit make sure that skip is enabled even in lossless mode.

Change-Id: I276954f952c6ac68f17a316ebc72f09001228a08
2013-11-18 14:51:04 -08:00
Johann
e813843b46 Disable avx/avx2 for Visual Studio 2010
VS2010 only supports avx. There is currently no avx code
in libvpx so don't create a special case for it.

Change-Id: Iacb10ea4762155412e04f23904b4324d01451fbd
2013-11-18 13:30:19 -08:00
Yaowu Xu
1c61e1960d Move vp9_extend.{h,c} from common to encoder
Since they used in encoder only. This commit also re-order includes
for the files that include vp9_extend.h

Change-Id: I929fc113f2135d3198cd1fc6a17434e5a2f8a459
2013-11-18 12:43:36 -08:00
Jingning Han
46ce6ddec4 Merge "Constrain encoder motion search range" 2013-11-18 12:35:34 -08:00
Jingning Han
bbe68fbd2a Constrain encoder motion search range
Explicitly constrain the upper limit of motion search range (in the
unit of full pixel) to be [-1023, +1023]. It is intended to control
the effective motion search range for 4K sequences.

Change-Id: I645539c70885eec0f155781f439d97d333336e88
2013-11-18 11:19:45 -08:00
Yunqing Wang
e3168b0c54 Merge "Do horizontal loopfiltering in parallel" 2013-11-18 10:03:41 -08:00
Yaowu Xu
c8e38a6c69 Merge "Add support for VC++2013" 2013-11-18 09:32:19 -08:00
Jim Bankoski
83eb1975df partition context update speedup
This removes a lot of operations in setting partition context...

Change-Id: I365e6f5607ece85190cb21443988816dfa510ce3
2013-11-17 06:58:08 -08:00
Tom Finegan
5ae4ba5774 vpxdec: Restore IVF support.
Refactored IVF frame reading code out into ivf_read_frame(). Forgot
to actually make the function call in read_frame().

Change-Id: Ie9f6917e70bd26d0352a761932465c60a29a1f81
2013-11-16 08:31:20 -08:00
Yunqing Wang
64f728caef Do horizontal loopfiltering in parallel
This patch followed "Rewrite filter_selectively_horiz for parallel
loopfiltering" commit, and added x86 SSE2 optimization to do
16-pixel filtering in parallel. Also, corrected the declaration
of aligned arrays. For 8-pixel-in-parallel case, improved the
calculation of the masks and filters. Updated the threshold loading
since the thresholds were already duplicated. Updated neon C functions
to call neon loopfilters twice.

Using tulip clip, tests showed it gave a ~1.5% decoder speed gain.

Change-Id: Id02638626ac27a4b0e0b09d71792a24c0499bd35
2013-11-15 16:18:43 -08:00
hkuang
7fb5e73897 Merge "Let the idct vp9_idct32x32_34_add = vp9_idct32x32_1024_add on arm until we implenment real vp9_idct32x32_34_add_neon." 2013-11-15 15:45:49 -08:00
Jingning Han
bdc4371174 Take out assertion from inverse transforms
Separate the rounding and right shift operations of forward transform
from those of inverse transform. Take out the assertion check from
inverse transforms. If the transform coefficients were constructed to
cause intermediate steps of inverse transform overflow, the codec will
just let it overflow without breaking the decoding flow.

Change-Id: I73cfc3706c4e840fc543a77cbc4cdb0b05d07730
2013-11-15 15:30:47 -08:00
Yaowu Xu
dc90541563 Merge "Renamed two files" 2013-11-15 15:20:23 -08:00
hkuang
7424492a0b Let the idct vp9_idct32x32_34_add = vp9_idct32x32_1024_add
on arm until we implenment real vp9_idct32x32_34_add_neon.

This issue is due to commit 47665452f0
Merge "Add 32x32 idct function for eob<=34 case".

Change-Id: I56b5f0abc20e7dd1bba521f78a995e85d65ea296
2013-11-15 14:59:16 -08:00
Dmitry Kovalev
3b9befe52e Merge "Removing vp9_encodeintra.{h, c} files." 2013-11-15 13:38:20 -08:00
Yaowu Xu
49cbe4580d Renamed two files
from vp9_decodframe.{c,h} to vp9_decodeframe.{c,h}

Change-Id: I21ac4b14fc90246e3f16bd90c52c12d126d791f8
2013-11-15 12:48:43 -08:00
Dmitry Kovalev
5380739a87 Removing vp9_encodeintra.{h, c} files.
There was only one function in *.c file, so moving it to vp9_encodemb.c.

Change-Id: I728859d08b3d6c05c33c1c5b21f0ea1d0e0f83af
2013-11-15 12:17:16 -08:00
Tom Finegan
6f25c15d23 Merge "vpx[dec|enc]: Extract IVF support from the apps." 2013-11-15 11:21:57 -08:00
Guillaume Martres
17084657e6 vpxenc: add --aq-mode flag to control adaptive quantization
Change-Id: I57e1ad4bed3487df12893ced77c49093f8755706
2013-11-15 19:42:20 +01:00
Tom Finegan
00a35aab7c vpx[dec|enc]: Extract IVF support from the apps.
- Move IVF reading support into ivfdec.c and ivfdec.h
- Move IVF writing support into ivfenc.c and ivfenc.h
- Removed IVF writing code from the SVC example in favor of ivfenc.

Change-Id: I70adf6240d0320fdd232d8546ed573f0f68dd793
2013-11-15 08:33:24 -08:00
Dmitry Kovalev
49fbbf72fa Finally removing txfrm_block_to_raster_block() function.
We only use txfrm_block_to_raster_xy() now.

Change-Id: I4242cd592da99e761041acf9fef1bac3d55a48e1
2013-11-14 13:45:51 -08:00
Yaowu Xu
a638bdf4c4 Add support for VC++2013
Change-Id: Iccc15aacee1fee9995dfd974bc89913891ad67a9
2013-11-14 12:05:59 -08:00
Marco Paniconi
07ce775189 Reduce loop filter in cyclic refresh.
Reduce the delta loop filter for blocks that are cyclicly refreshed.
This helps to reduce the dot artifacts that may happen
when zero_mv blocks are repeatedly loop-filtered.

This change, along with the fix in:
https://gerrit.chromium.org/gerrit/#/c/40409/
helps to reduce this artifact, but cannot remove the dot artifacts completely.

Change-Id: I44675e7a0f59295b648a3b7d4956fb301231a97f
2013-01-11 16:46:09 -08:00
585 changed files with 23389 additions and 88495 deletions

37
README_RS Normal file
View File

@@ -0,0 +1,37 @@
Welcome to read this page!
How to run renderscript in VP9 decode
1. Compile RenderScript Kernel(We use zero copy this version,
if ndk rs module don't support this,
it can't pass compile)
Because RenderScript need g++, but VP9 use gcc.
So we need to compile rs alone as a so library. Then VP9 project load/use it.
RS code is in vp9/common/kernel/rs/, there is a compile.sh in that folder,
We can use sh to compile rs kernel.(need NDK-r9b or higher, we need to config ndk in path).
If compile success, it will gen:
vp9_rs_packing.so(vp9/common/kernel/rs/)
librs.inter_rs.so(vp9/common/kernel/rs/obj/)
libstlport_shared.so(vp9/common/kernel/rs/obj/)
2. Compile VP9 project
Just Compile it normally.
3. Run vpxdec with RenderScript(We use zero copy this version,
if system RS module don't support this,
it won't work)
[1]: push vp9_rs_packing.so to /data/local/tmp/(or /vendor/lib, /system/lib,
need adb remount)
[2]: push librs.inter_rs.so to /data/local/tmp/(or /vendor/lib, /system/lib,
need adb remount)
[3]: push libstlport_shared.so to /data/local/tmp/(or /vendor/lib, /system/lib,
need adb remount)
[4]: push vpxdec to /data/local/tmp
[5]: adb shell (as root)
[6]: cd /data/local/tmp (on device)
[7]: export RSENABLE=1 (on device, if not, it won't use RS)
[8]: export QCTENABLE=1 (on device, enable qct kernel)
[9]: export OPENABLE=1 (on device, enable optimized kernel, dependence on system and driver)
[10]:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp (on device,
if we push .so file to /data/local/tmp, we need set this)
[11]:run vpxdec normally(on device)

6
args.h
View File

@@ -9,8 +9,8 @@
*/
#ifndef ARGS_H
#define ARGS_H
#ifndef ARGS_H_
#define ARGS_H_
#include <stdio.h>
struct arg {
@@ -48,4 +48,4 @@ unsigned int arg_parse_uint(const struct arg *arg);
int arg_parse_int(const struct arg *arg);
struct vpx_rational arg_parse_rational(const struct arg *arg);
int arg_parse_enum_or_int(const struct arg *arg);
#endif
#endif // ARGS_H_

View File

@@ -135,10 +135,14 @@ CODEC_SRCS_UNIQUE = $(sort $(CODEC_SRCS))
# Pull out C files. vpx_config.c is in the immediate directory and
# so it does not need libvpx/ prefixed like the rest of the source files.
# The neon files with intrinsics need to have .neon appended so the proper
# flags are applied.
CODEC_SRCS_C = $(filter %.c, $(CODEC_SRCS_UNIQUE))
LOCAL_CODEC_SRCS_C = $(filter-out vpx_config.c, $(CODEC_SRCS_C))
LOCAL_NEON_SRCS_C = $(filter %_neon.c, $(CODEC_SRCS_C))
LOCAL_CODEC_SRCS_C = $(filter-out vpx_config.c %_neon.c, $(CODEC_SRCS_C))
LOCAL_SRC_FILES += $(foreach file, $(LOCAL_CODEC_SRCS_C), libvpx/$(file))
LOCAL_SRC_FILES += $(foreach file, $(LOCAL_NEON_SRCS_C), libvpx/$(file).neon)
# Pull out assembly files, splitting NEON from the rest. This is
# done to specify that the NEON assembly files use NEON assembler flags.

View File

@@ -390,7 +390,7 @@ ifneq ($(call enabled,DIST-SRCS),)
DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh
DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh
DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh
DIST-SRCS-$(CONFIG_MSVS) += build/x86-msvs/yasm.rules
DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_vcxproj.sh
DIST-SRCS-$(CONFIG_MSVS) += build/x86-msvs/obj_int_extract.bat
DIST-SRCS-$(CONFIG_MSVS) += build/arm-msvs/obj_int_extract.bat
DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh

View File

@@ -321,7 +321,7 @@ bail:
return 1;
}
char *parse_elf_string_table(elf_obj_t *elf, int s_idx, int idx) {
const char *parse_elf_string_table(elf_obj_t *elf, int s_idx, int idx) {
if (elf->bits == 32) {
Elf32_Shdr shdr;

View File

@@ -24,7 +24,7 @@ sub FixThumbInstructions($$)
# with left shift, addition and a right shift (to restore the
# register to the original value). Currently the right shift
# isn't necessary in the code base since the values in these
# registers aren't used, but doing the shift for consitency.
# registers aren't used, but doing the shift for consistency.
# This converts instructions such as "add r12, r12, r5, lsl r4"
# into the sequence "lsl r5, r4", "add r12, r12, r5", "lsr r5, r4".
s/^(\s*)(add)(\s+)(r\d+),\s*(r\d+),\s*(r\d+),\s*lsl (r\d+)/$1lsl$3$6, $7\n$1$2$3$4, $5, $6\n$1lsr$3$6, $7/g;

7
configure vendored
View File

@@ -24,6 +24,7 @@ Advanced options:
${toggle_examples} examples
${toggle_docs} documentation
${toggle_unit_tests} unit tests
${toggle_decode_perf_tests} build decoder perf tests with unit tests
--libc=PATH path to alternate libc
--as={yasm|nasm|auto} use specified assembler [auto, yasm preferred]
--sdk-path=PATH path to root of sdk (android builds only)
@@ -31,7 +32,6 @@ Advanced options:
supported by hardware [auto]
${toggle_codec_srcs} in/exclude codec library source code
${toggle_debug_libs} in/exclude debug version of libraries
${toggle_md5} support for output of checksum data
${toggle_static_msvcrt} use static MSVCRT (VS builds only)
${toggle_vp8} VP8 codec support
${toggle_vp9} VP9 codec support
@@ -183,7 +183,6 @@ enable_feature install_libs
enable_feature static
enable_feature optimizations
enable_feature fast_unaligned #allow unaligned accesses, if supported by hw
enable_feature md5
enable_feature spatial_resampling
enable_feature multithread
enable_feature os_support
@@ -278,7 +277,6 @@ CONFIG_LIST="
mem_manager
mem_tracker
mem_checks
md5
dequant_tokens
dc_recon
@@ -302,6 +300,7 @@ CONFIG_LIST="
postproc_visualizer
os_support
unit_tests
decode_perf_tests
multi_res_encoding
temporal_denoising
experimental
@@ -334,7 +333,6 @@ CMDLINE_SELECT="
fast_unaligned
codec_srcs
debug_libs
md5
dequant_tokens
dc_recon
@@ -355,6 +353,7 @@ CMDLINE_SELECT="
small
postproc_visualizer
unit_tests
decode_perf_tests
multi_res_encoding
temporal_denoising
experimental

View File

@@ -31,7 +31,6 @@ TXT_DOX = $(call enabled,TXT_DOX)
EXAMPLE_PATH += $(SRC_PATH_BARE) #for CHANGELOG, README, etc
doxyfile: $(if $(findstring examples, $(ALL_TARGETS)),examples.doxy)
doxyfile: libs.doxy_template libs.doxy
@echo " [CREATE] $@"
@cat $^ > $@

View File

@@ -23,7 +23,10 @@ vpxdec.SRCS += md5_utils.c md5_utils.h
vpxdec.SRCS += vpx_ports/vpx_timer.h
vpxdec.SRCS += vpx/vpx_integer.h
vpxdec.SRCS += args.c args.h
vpxdec.SRCS += ivfdec.c ivfdec.h
vpxdec.SRCS += tools_common.c tools_common.h
vpxdec.SRCS += webmdec.c webmdec.h
vpxdec.SRCS += y4menc.c y4menc.h
vpxdec.SRCS += nestegg/halloc/halloc.h
vpxdec.SRCS += nestegg/halloc/src/align.h
vpxdec.SRCS += nestegg/halloc/src/halloc.c
@@ -35,8 +38,11 @@ vpxdec.SRCS += $(LIBYUV_SRCS)
vpxdec.GUID = BA5FE66F-38DD-E034-F542-B1578C5FB950
vpxdec.DESCRIPTION = Full featured decoder
UTILS-$(CONFIG_ENCODERS) += vpxenc.c
vpxenc.SRCS += args.c args.h y4minput.c y4minput.h
vpxenc.SRCS += args.c args.h y4minput.c y4minput.h vpxenc.h
vpxenc.SRCS += ivfdec.c ivfdec.h
vpxenc.SRCS += ivfenc.c ivfenc.h
vpxenc.SRCS += tools_common.c tools_common.h
vpxenc.SRCS += warnings.c warnings.h
vpxenc.SRCS += webmenc.c webmenc.h
vpxenc.SRCS += vpx_ports/mem_ops.h
vpxenc.SRCS += vpx_ports/mem_ops_aligned.h
@@ -53,18 +59,11 @@ vp8_scalable_patterns.GUID = 0D6A210B-F482-4D6F-8570-4A9C01ACC88C
vp8_scalable_patterns.DESCRIPTION = Temporal Scalability Encoder
UTILS-$(CONFIG_VP9_ENCODER) += vp9_spatial_scalable_encoder.c
vp9_spatial_scalable_encoder.SRCS += args.c args.h
vp9_spatial_scalable_encoder.SRCS += ivfenc.c ivfenc.h
vp9_spatial_scalable_encoder.SRCS += tools_common.c tools_common.h
vp9_spatial_scalable_encoder.GUID = 4A38598D-627D-4505-9C7B-D4020C84100D
vp9_spatial_scalable_encoder.DESCRIPTION = Spatial Scalable Encoder
# Clean up old ivfenc, ivfdec binaries.
ifeq ($(CONFIG_MSVS),yes)
CLEAN-OBJS += $(foreach p,$(VS_PLATFORMS),$(p)/Release/ivfenc.exe)
CLEAN-OBJS += $(foreach p,$(VS_PLATFORMS),$(p)/Release/ivfdec.exe)
else
CLEAN-OBJS += ivfenc{.c.o,.c.d,.dox,.exe,}
CLEAN-OBJS += ivfdec{.c.o,.c.d,.dox,.exe,}
endif
# XMA example disabled for now, not used in VP8
#UTILS-$(CONFIG_DECODERS) += example_xma.c
#example_xma.GUID = A955FC4A-73F1-44F7-135E-30D84D32F022
@@ -207,9 +206,9 @@ $(foreach bin,$(BINS-yes),\
# Rules to generate the GEN_EXAMPLES sources
.PRECIOUS: %.c
CLEAN-OBJS += $(GEN_EXAMPLES)
%.c: examples/%.txt
%.c: examples/%.c
@echo " [EXAMPLE] $@"
@$(SRC_PATH_BARE)/examples/gen_example_code.sh $< > $@
@cp $< $@
# The following pairs define a mapping of locations in the distribution
@@ -254,45 +253,3 @@ INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
$(addprefix bin/$(p)/,$(ALL_EXAMPLES:.c=.exe)))
$(foreach proj,$(call enabled,PROJECTS),\
$(eval $(call vcproj_template,$(proj))))
#
# Documentation Rules
#
%.dox: examples/%.txt
@echo " [DOXY] $@"
@$(SRC_PATH_BARE)/examples/gen_example_text.sh $< | \
$(SRC_PATH_BARE)/examples/gen_example_doxy.php \
example_$(@:.dox=) $(@:.dox=.c) > $@
%.dox: %.c
@echo " [DOXY] $@"
@echo "/*!\page example_$(@:.dox=) $(@:.dox=)" > $@
@echo " \includelineno $(notdir $<)" >> $@
@echo "*/" >> $@
samples.dox: examples.mk
@echo " [DOXY] $@"
@echo "/*!\page samples Sample Code" > $@
@echo " This SDK includes a number of sample applications."\
"each sample documents a feature of the SDK in both prose"\
"and the associated C code. In general, later samples"\
"build upon prior samples, so it is best to work through the"\
"list in order. The following samples are included: ">>$@
@$(foreach ex,$(GEN_EXAMPLES:.c=),\
echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
@echo >> $@
@echo " In addition, the SDK contains a number of utilities."\
"Since these utilities are built upon the concepts described"\
"in the sample code listed above, they are not documented in"\
"pieces like the samples are. Thir sourcre is included here"\
"for reference. The following utilities are included:" >> $@
@$(foreach ex,$(UTILS:.c=),\
echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
@echo "*/" >> $@
CLEAN-OBJS += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
DOCS-yes += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
examples.doxy: samples.dox $(ALL_EXAMPLES:.c=.dox)
@echo "INPUT += $^" > $@

173
examples/decode_to_md5.c Normal file
View File

@@ -0,0 +1,173 @@
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
// Frame-by-frame MD5 Checksum
// ===========================
//
// This example builds upon the simple decoder loop to show how checksums
// of the decoded output can be generated. These are used for validating
// decoder implementations against the reference implementation, for example.
//
// MD5 algorithm
// -------------
// The Message-Digest 5 (MD5) is a well known hash function. We have provided
// an implementation derived from the RSA Data Security, Inc. MD5 Message-Digest
// Algorithm for your use. Our implmentation only changes the interface of this
// reference code. You must include the `md5_utils.h` header for access to these
// functions.
//
// Processing The Decoded Data
// ---------------------------
// Each row of the image is passed to the MD5 accumulator. First the Y plane
// is processed, then U, then V. It is important to honor the image's `stride`
// values.
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define VPX_CODEC_DISABLE_COMPAT 1
#include "./vpx_config.h"
#include "vpx/vp8dx.h"
#include "vpx/vpx_decoder.h"
#include "md5_utils.h"
#define VP8_FOURCC 0x30385056
#define VP9_FOURCC 0x30395056
#define IVF_FILE_HDR_SZ (32)
#define IVF_FRAME_HDR_SZ (12)
static vpx_codec_iface_t *get_codec_interface(unsigned int fourcc) {
switch (fourcc) {
case VP8_FOURCC:
return vpx_codec_vp8_dx();
case VP9_FOURCC:
return vpx_codec_vp9_dx();
}
return NULL;
}
static unsigned int mem_get_le32(const unsigned char *mem) {
return (mem[3] << 24) | (mem[2] << 16) | (mem[1] << 8) | (mem[0]);
}
static void die(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
if (fmt[strlen(fmt) - 1] != '\n')
printf("\n");
exit(EXIT_FAILURE);
}
static void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
const char *detail = vpx_codec_error_detail(ctx);
printf("%s: %s\n", s, vpx_codec_error(ctx));
if(detail)
printf(" %s\n",detail);
exit(EXIT_FAILURE);
}
static void get_image_md5(const vpx_image_t *img, unsigned char digest[16]) {
int plane, y;
MD5Context md5;
MD5Init(&md5);
for (plane = 0; plane < 3; ++plane) {
const unsigned char *buf = img->planes[plane];
const int stride = img->stride[plane];
const int w = plane ? (img->d_w + 1) >> 1 : img->d_w;
const int h = plane ? (img->d_h + 1) >> 1 : img->d_h;
for (y = 0; y < h; ++y) {
MD5Update(&md5, buf, w);
buf += stride;
}
}
MD5Final(digest, &md5);
}
static void print_md5(FILE *stream, unsigned char digest[16]) {
int i;
for (i = 0; i < 16; ++i)
fprintf(stream, "%02x", digest[i]);
}
int main(int argc, char **argv) {
FILE *infile, *outfile;
vpx_codec_ctx_t codec;
vpx_codec_iface_t *iface;
int flags = 0, frame_cnt = 0;
unsigned char file_hdr[IVF_FILE_HDR_SZ];
unsigned char frame_hdr[IVF_FRAME_HDR_SZ];
unsigned char frame[256 * 1024];
if (argc != 3)
die("Usage: %s <infile> <outfile>\n", argv[0]);
if (!(infile = fopen(argv[1], "rb")))
die("Failed to open %s for reading", argv[1]);
if (!(outfile = fopen(argv[2], "wb")))
die("Failed to open %s for writing", argv[2]);
if (!(fread(file_hdr, 1, IVF_FILE_HDR_SZ, infile) == IVF_FILE_HDR_SZ &&
file_hdr[0] == 'D' && file_hdr[1] == 'K' &&
file_hdr[2] == 'I' && file_hdr[3] == 'F'))
die("%s is not an IVF file.", argv[1]);
iface = get_codec_interface(mem_get_le32(file_hdr + 8));
if (!iface)
die("Unknown FOURCC code.");
printf("Using %s\n", vpx_codec_iface_name(iface));
if (vpx_codec_dec_init(&codec, iface, NULL, flags))
die_codec(&codec, "Failed to initialize decoder");
while (fread(frame_hdr, 1, IVF_FRAME_HDR_SZ, infile) == IVF_FRAME_HDR_SZ) {
const int frame_size = mem_get_le32(frame_hdr);
vpx_codec_iter_t iter = NULL;
vpx_image_t *img;
if (frame_size > sizeof(frame))
die("Frame %d data too big for example code buffer", frame_size);
if (fread(frame, 1, frame_size, infile) != frame_size)
die("Failed to read complete frame");
if (vpx_codec_decode(&codec, frame, frame_size, NULL, 0))
die_codec(&codec, "Failed to decode frame");
while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL) {
unsigned char digest[16];
get_image_md5(img, digest);
print_md5(outfile, digest);
fprintf(outfile, " img-%dx%d-%04d.i420\n",
img->d_w, img->d_h, ++frame_cnt);
}
}
printf("Processed %d frames.\n", frame_cnt);
if (vpx_codec_destroy(&codec))
die_codec(&codec, "Failed to destroy codec");
fclose(outfile);
fclose(infile);
return EXIT_SUCCESS;
}

View File

@@ -1,48 +0,0 @@
@TEMPLATE decoder_tmpl.c
Frame-by-frame MD5 Checksum
===========================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
This example builds upon the simple decoder loop to show how checksums
of the decoded output can be generated. These are used for validating
decoder implementations against the reference implementation, for example.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
MD5 algorithm
-------------
The Message-Digest 5 (MD5) is a well known hash function. We have provided
an implementation derived from the RSA Data Security, Inc. MD5 Message-Digest
Algorithm for your use. Our implmentation only changes the interface of this
reference code. You must include the `md5_utils.h` header for access to these
functions.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_INCLUDES
#include "md5_utils.h"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_INCLUDES
Processing The Decoded Data
---------------------------
Each row of the image is passed to the MD5 accumulator. First the Y plane
is processed, then U, then V. It is important to honor the image's `stride`
values.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_DX
unsigned char md5_sum[16];
MD5Context md5;
int i;
MD5Init(&md5);
for(plane=0; plane < 3; plane++) {
unsigned char *buf =img->planes[plane];
for(y=0; y < (plane ? (img->d_h + 1) >> 1 : img->d_h); y++) {
MD5Update(&md5, buf, (plane ? (img->d_w + 1) >> 1 : img->d_w));
buf += img->stride[plane];
}
}
MD5Final(md5_sum, &md5);
for(i=0; i<16; i++)
fprintf(outfile, "%02x",md5_sum[i]);
fprintf(outfile, " img-%dx%d-%04d.i420\n", img->d_w, img->d_h,
frame_cnt);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_DX

View File

@@ -0,0 +1,177 @@
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
// Decode With Drops Example
// =========================
//
// This is an example utility which drops a series of frames, as specified
// on the command line. This is useful for observing the error recovery
// features of the codec.
//
// Usage
// -----
// This example adds a single argument to the `simple_decoder` example,
// which specifies the range or pattern of frames to drop. The parameter is
// parsed as follows:
//
// Dropping A Range Of Frames
// --------------------------
// To drop a range of frames, specify the starting frame and the ending
// frame to drop, separated by a dash. The following command will drop
// frames 5 through 10 (base 1).
//
// $ ./decode_with_drops in.ivf out.i420 5-10
//
//
// Dropping A Pattern Of Frames
// ----------------------------
// To drop a pattern of frames, specify the number of frames to drop and
// the number of frames after which to repeat the pattern, separated by
// a forward-slash. The following command will drop 3 of 7 frames.
// Specifically, it will decode 4 frames, then drop 3 frames, and then
// repeat.
//
// $ ./decode_with_drops in.ivf out.i420 3/7
//
//
// Extra Variables
// ---------------
// This example maintains the pattern passed on the command line in the
// `n`, `m`, and `is_range` variables:
//
//
// Making The Drop Decision
// ------------------------
// The example decides whether to drop the frame based on the current
// frame number, immediately before decoding the frame.
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define VPX_CODEC_DISABLE_COMPAT 1
#include "./vpx_config.h"
#include "vpx/vp8dx.h"
#include "vpx/vpx_decoder.h"
#define interface (vpx_codec_vp8_dx())
#define IVF_FILE_HDR_SZ (32)
#define IVF_FRAME_HDR_SZ (12)
static unsigned int mem_get_le32(const unsigned char *mem) {
return (mem[3] << 24)|(mem[2] << 16)|(mem[1] << 8)|(mem[0]);
}
static void die(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
if(fmt[strlen(fmt)-1] != '\n')
printf("\n");
exit(EXIT_FAILURE);
}
static void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
const char *detail = vpx_codec_error_detail(ctx);
printf("%s: %s\n", s, vpx_codec_error(ctx));
if(detail)
printf(" %s\n",detail);
exit(EXIT_FAILURE);
}
int main(int argc, char **argv) {
FILE *infile, *outfile;
vpx_codec_ctx_t codec;
int flags = 0, frame_cnt = 0;
unsigned char file_hdr[IVF_FILE_HDR_SZ];
unsigned char frame_hdr[IVF_FRAME_HDR_SZ];
unsigned char frame[256*1024];
vpx_codec_err_t res;
int n, m, is_range;
(void)res;
/* Open files */
if(argc!=4)
die("Usage: %s <infile> <outfile> <N-M|N/M>\n", argv[0]);
{
char *nptr;
n = strtol(argv[3], &nptr, 0);
m = strtol(nptr+1, NULL, 0);
is_range = *nptr == '-';
if(!n || !m || (*nptr != '-' && *nptr != '/'))
die("Couldn't parse pattern %s\n", argv[3]);
}
if(!(infile = fopen(argv[1], "rb")))
die("Failed to open %s for reading", argv[1]);
if(!(outfile = fopen(argv[2], "wb")))
die("Failed to open %s for writing", argv[2]);
/* Read file header */
if(!(fread(file_hdr, 1, IVF_FILE_HDR_SZ, infile) == IVF_FILE_HDR_SZ
&& file_hdr[0]=='D' && file_hdr[1]=='K' && file_hdr[2]=='I'
&& file_hdr[3]=='F'))
die("%s is not an IVF file.", argv[1]);
printf("Using %s\n",vpx_codec_iface_name(interface));
/* Initialize codec */
if(vpx_codec_dec_init(&codec, interface, NULL, flags))
die_codec(&codec, "Failed to initialize decoder");
/* Read each frame */
while(fread(frame_hdr, 1, IVF_FRAME_HDR_SZ, infile) == IVF_FRAME_HDR_SZ) {
int frame_sz = mem_get_le32(frame_hdr);
vpx_codec_iter_t iter = NULL;
vpx_image_t *img;
frame_cnt++;
if(frame_sz > sizeof(frame))
die("Frame %d data too big for example code buffer", frame_sz);
if(fread(frame, 1, frame_sz, infile) != frame_sz)
die("Frame %d failed to read complete frame", frame_cnt);
if((is_range && frame_cnt >= n && frame_cnt <= m)
||(!is_range && m - (frame_cnt-1)%m <= n)) {
putc('X', stdout);
continue;
}
putc('.', stdout);
fflush(stdout);
/* Decode the frame */
if(vpx_codec_decode(&codec, frame, frame_sz, NULL, 0))
die_codec(&codec, "Failed to decode frame");
/* Write decoded data to disk */
while((img = vpx_codec_get_frame(&codec, &iter))) {
unsigned int plane, y;
for(plane=0; plane < 3; plane++) {
unsigned char *buf =img->planes[plane];
for(y=0; y < (plane ? (img->d_h + 1) >> 1 : img->d_h); y++) {
(void) fwrite(buf, 1, (plane ? (img->d_w + 1) >> 1 : img->d_w),
outfile);
buf += img->stride[plane];
}
}
}
}
printf("Processed %d frames.\n",frame_cnt);
if(vpx_codec_destroy(&codec))
die_codec(&codec, "Failed to destroy codec");
fclose(outfile);
fclose(infile);
return EXIT_SUCCESS;
}

View File

@@ -1,73 +0,0 @@
@TEMPLATE decoder_tmpl.c
Decode With Drops Example
=========================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
This is an example utility which drops a series of frames, as specified
on the command line. This is useful for observing the error recovery
features of the codec.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
Usage
-----
This example adds a single argument to the `simple_decoder` example,
which specifies the range or pattern of frames to drop. The parameter is
parsed as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE
if(argc!=4)
die("Usage: %s <infile> <outfile> <N-M|N/M>\n", argv[0]);
{
char *nptr;
n = strtol(argv[3], &nptr, 0);
m = strtol(nptr+1, NULL, 0);
is_range = *nptr == '-';
if(!n || !m || (*nptr != '-' && *nptr != '/'))
die("Couldn't parse pattern %s\n", argv[3]);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE
Dropping A Range Of Frames
--------------------------
To drop a range of frames, specify the starting frame and the ending
frame to drop, separated by a dash. The following command will drop
frames 5 through 10 (base 1).
$ ./decode_with_drops in.ivf out.i420 5-10
Dropping A Pattern Of Frames
----------------------------
To drop a pattern of frames, specify the number of frames to drop and
the number of frames after which to repeat the pattern, separated by
a forward-slash. The following command will drop 3 of 7 frames.
Specifically, it will decode 4 frames, then drop 3 frames, and then
repeat.
$ ./decode_with_drops in.ivf out.i420 3/7
Extra Variables
---------------
This example maintains the pattern passed on the command line in the
`n`, `m`, and `is_range` variables:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_VARS
int n, m, is_range;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_VARS
Making The Drop Decision
------------------------
The example decides whether to drop the frame based on the current
frame number, immediately before decoding the frame.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRE_DECODE
if((is_range && frame_cnt >= n && frame_cnt <= m)
||(!is_range && m - (frame_cnt-1)%m <= n)) {
putc('X', stdout);
continue;
}
putc('.', stdout);
fflush(stdout);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRE_DECODE

View File

@@ -0,0 +1,328 @@
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
// Decode With Partial Drops Example
// =========================
//
// This is an example utility which drops a series of frames (or parts of
// frames), as specified on the command line. This is useful for observing the
// error recovery features of the codec.
//
// Usage
// -----
// This example adds a single argument to the `simple_decoder` example,
// which specifies the range or pattern of frames to drop. The parameter is
// parsed as follows.
//
// Dropping A Range Of Frames
// --------------------------
// To drop a range of frames, specify the starting frame and the ending
// frame to drop, separated by a dash. The following command will drop
// frames 5 through 10 (base 1).
//
// $ ./decode_with_partial_drops in.ivf out.i420 5-10
//
//
// Dropping A Pattern Of Frames
// ----------------------------
// To drop a pattern of frames, specify the number of frames to drop and
// the number of frames after which to repeat the pattern, separated by
// a forward-slash. The following command will drop 3 of 7 frames.
// Specifically, it will decode 4 frames, then drop 3 frames, and then
// repeat.
//
// $ ./decode_with_partial_drops in.ivf out.i420 3/7
//
// Dropping Random Parts Of Frames
// -------------------------------
// A third argument tuple is available to split the frame into 1500 bytes pieces
// and randomly drop pieces rather than frames. The frame will be split at
// partition boundaries where possible. The following example will seed the RNG
// with the seed 123 and drop approximately 5% of the pieces. Pieces which
// are depending on an already dropped piece will also be dropped.
//
// $ ./decode_with_partial_drops in.ivf out.i420 5,123
//
// Extra Variables
// ---------------
// This example maintains the pattern passed on the command line in the
// `n`, `m`, and `is_range` variables:
//
// Making The Drop Decision
// ------------------------
// The example decides whether to drop the frame based on the current
// frame number, immediately before decoding the frame.
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define VPX_CODEC_DISABLE_COMPAT 1
#include "./vpx_config.h"
#include "vpx/vp8dx.h"
#include "vpx/vpx_decoder.h"
#define interface (vpx_codec_vp8_dx())
#include <time.h>
#define IVF_FILE_HDR_SZ (32)
#define IVF_FRAME_HDR_SZ (12)
static unsigned int mem_get_le32(const unsigned char *mem) {
return (mem[3] << 24)|(mem[2] << 16)|(mem[1] << 8)|(mem[0]);
}
static void die(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
if(fmt[strlen(fmt)-1] != '\n')
printf("\n");
exit(EXIT_FAILURE);
}
static void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
const char *detail = vpx_codec_error_detail(ctx);
printf("%s: %s\n", s, vpx_codec_error(ctx));
if(detail)
printf(" %s\n",detail);
exit(EXIT_FAILURE);
}
struct parsed_header
{
char key_frame;
int version;
char show_frame;
int first_part_size;
};
int next_packet(struct parsed_header* hdr, int pos, int length, int mtu)
{
int size = 0;
int remaining = length - pos;
/* Uncompressed part is 3 bytes for P frames and 10 bytes for I frames */
int uncomp_part_size = (hdr->key_frame ? 10 : 3);
/* number of bytes yet to send from header and the first partition */
int remainFirst = uncomp_part_size + hdr->first_part_size - pos;
if (remainFirst > 0)
{
if (remainFirst <= mtu)
{
size = remainFirst;
}
else
{
size = mtu;
}
return size;
}
/* second partition; just slot it up according to MTU */
if (remaining <= mtu)
{
size = remaining;
return size;
}
return mtu;
}
void throw_packets(unsigned char* frame, int* size, int loss_rate,
int* thrown, int* kept)
{
unsigned char loss_frame[256*1024];
int pkg_size = 1;
int pos = 0;
int loss_pos = 0;
struct parsed_header hdr;
unsigned int tmp;
int mtu = 1500;
if (*size < 3)
{
return;
}
putc('|', stdout);
/* parse uncompressed 3 bytes */
tmp = (frame[2] << 16) | (frame[1] << 8) | frame[0];
hdr.key_frame = !(tmp & 0x1); /* inverse logic */
hdr.version = (tmp >> 1) & 0x7;
hdr.show_frame = (tmp >> 4) & 0x1;
hdr.first_part_size = (tmp >> 5) & 0x7FFFF;
/* don't drop key frames */
if (hdr.key_frame)
{
int i;
*kept = *size/mtu + ((*size % mtu > 0) ? 1 : 0); /* approximate */
for (i=0; i < *kept; i++)
putc('.', stdout);
return;
}
while ((pkg_size = next_packet(&hdr, pos, *size, mtu)) > 0)
{
int loss_event = ((rand() + 1.0)/(RAND_MAX + 1.0) < loss_rate/100.0);
if (*thrown == 0 && !loss_event)
{
memcpy(loss_frame + loss_pos, frame + pos, pkg_size);
loss_pos += pkg_size;
(*kept)++;
putc('.', stdout);
}
else
{
(*thrown)++;
putc('X', stdout);
}
pos += pkg_size;
}
memcpy(frame, loss_frame, loss_pos);
memset(frame + loss_pos, 0, *size - loss_pos);
*size = loss_pos;
}
int main(int argc, char **argv) {
FILE *infile, *outfile;
vpx_codec_ctx_t codec;
int flags = 0, frame_cnt = 0;
unsigned char file_hdr[IVF_FILE_HDR_SZ];
unsigned char frame_hdr[IVF_FRAME_HDR_SZ];
unsigned char frame[256*1024];
vpx_codec_err_t res;
int n, m, mode;
unsigned int seed;
int thrown=0, kept=0;
int thrown_frame=0, kept_frame=0;
vpx_codec_dec_cfg_t dec_cfg = {0};
(void)res;
/* Open files */
if(argc < 4 || argc > 6)
die("Usage: %s <infile> <outfile> [-t <num threads>] <N-M|N/M|L,S>\n",
argv[0]);
{
char *nptr;
int arg_num = 3;
if (argc == 6 && strncmp(argv[arg_num++], "-t", 2) == 0)
dec_cfg.threads = strtol(argv[arg_num++], NULL, 0);
n = strtol(argv[arg_num], &nptr, 0);
mode = (*nptr == '\0' || *nptr == ',') ? 2 : (*nptr == '-') ? 1 : 0;
m = strtol(nptr+1, NULL, 0);
if((!n && !m) || (*nptr != '-' && *nptr != '/' &&
*nptr != '\0' && *nptr != ','))
die("Couldn't parse pattern %s\n", argv[3]);
}
seed = (m > 0) ? m : (unsigned int)time(NULL);
srand(seed);thrown_frame = 0;
printf("Seed: %u\n", seed);
printf("Threads: %d\n", dec_cfg.threads);
if(!(infile = fopen(argv[1], "rb")))
die("Failed to open %s for reading", argv[1]);
if(!(outfile = fopen(argv[2], "wb")))
die("Failed to open %s for writing", argv[2]);
/* Read file header */
if(!(fread(file_hdr, 1, IVF_FILE_HDR_SZ, infile) == IVF_FILE_HDR_SZ
&& file_hdr[0]=='D' && file_hdr[1]=='K' && file_hdr[2]=='I'
&& file_hdr[3]=='F'))
die("%s is not an IVF file.", argv[1]);
printf("Using %s\n",vpx_codec_iface_name(interface));
/* Initialize codec */
flags = VPX_CODEC_USE_ERROR_CONCEALMENT;
res = vpx_codec_dec_init(&codec, interface, &dec_cfg, flags);
if(res)
die_codec(&codec, "Failed to initialize decoder");
/* Read each frame */
while(fread(frame_hdr, 1, IVF_FRAME_HDR_SZ, infile) == IVF_FRAME_HDR_SZ) {
int frame_sz = mem_get_le32(frame_hdr);
vpx_codec_iter_t iter = NULL;
vpx_image_t *img;
frame_cnt++;
if(frame_sz > sizeof(frame))
die("Frame %d data too big for example code buffer", frame_sz);
if(fread(frame, 1, frame_sz, infile) != frame_sz)
die("Frame %d failed to read complete frame", frame_cnt);
/* Decide whether to throw parts of the frame or the whole frame
depending on the drop mode */
thrown_frame = 0;
kept_frame = 0;
switch (mode)
{
case 0:
if (m - (frame_cnt-1)%m <= n)
{
frame_sz = 0;
}
break;
case 1:
if (frame_cnt >= n && frame_cnt <= m)
{
frame_sz = 0;
}
break;
case 2:
throw_packets(frame, &frame_sz, n, &thrown_frame, &kept_frame);
break;
default: break;
}
if (mode < 2)
{
if (frame_sz == 0)
{
putc('X', stdout);
thrown_frame++;
}
else
{
putc('.', stdout);
kept_frame++;
}
}
thrown += thrown_frame;
kept += kept_frame;
fflush(stdout);
/* Decode the frame */
if(vpx_codec_decode(&codec, frame, frame_sz, NULL, 0))
die_codec(&codec, "Failed to decode frame");
/* Write decoded data to disk */
while((img = vpx_codec_get_frame(&codec, &iter))) {
unsigned int plane, y;
for(plane=0; plane < 3; plane++) {
unsigned char *buf =img->planes[plane];
for(y=0; y < (plane ? (img->d_h + 1) >> 1 : img->d_h); y++) {
(void) fwrite(buf, 1, (plane ? (img->d_w + 1) >> 1 : img->d_w),
outfile);
buf += img->stride[plane];
}
}
}
}
printf("Processed %d frames.\n",frame_cnt);
if(vpx_codec_destroy(&codec))
die_codec(&codec, "Failed to destroy codec");
fclose(outfile);
fclose(infile);
return EXIT_SUCCESS;
}

View File

@@ -1,238 +0,0 @@
@TEMPLATE decoder_tmpl.c
Decode With Partial Drops Example
=========================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
This is an example utility which drops a series of frames (or parts of frames),
as specified on the command line. This is useful for observing the error
recovery features of the codec.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_INCLUDES
#include <time.h>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_INCLUDES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HELPERS
struct parsed_header
{
char key_frame;
int version;
char show_frame;
int first_part_size;
};
int next_packet(struct parsed_header* hdr, int pos, int length, int mtu)
{
int size = 0;
int remaining = length - pos;
/* Uncompressed part is 3 bytes for P frames and 10 bytes for I frames */
int uncomp_part_size = (hdr->key_frame ? 10 : 3);
/* number of bytes yet to send from header and the first partition */
int remainFirst = uncomp_part_size + hdr->first_part_size - pos;
if (remainFirst > 0)
{
if (remainFirst <= mtu)
{
size = remainFirst;
}
else
{
size = mtu;
}
return size;
}
/* second partition; just slot it up according to MTU */
if (remaining <= mtu)
{
size = remaining;
return size;
}
return mtu;
}
void throw_packets(unsigned char* frame, int* size, int loss_rate,
int* thrown, int* kept)
{
unsigned char loss_frame[256*1024];
int pkg_size = 1;
int pos = 0;
int loss_pos = 0;
struct parsed_header hdr;
unsigned int tmp;
int mtu = 1500;
if (*size < 3)
{
return;
}
putc('|', stdout);
/* parse uncompressed 3 bytes */
tmp = (frame[2] << 16) | (frame[1] << 8) | frame[0];
hdr.key_frame = !(tmp & 0x1); /* inverse logic */
hdr.version = (tmp >> 1) & 0x7;
hdr.show_frame = (tmp >> 4) & 0x1;
hdr.first_part_size = (tmp >> 5) & 0x7FFFF;
/* don't drop key frames */
if (hdr.key_frame)
{
int i;
*kept = *size/mtu + ((*size % mtu > 0) ? 1 : 0); /* approximate */
for (i=0; i < *kept; i++)
putc('.', stdout);
return;
}
while ((pkg_size = next_packet(&hdr, pos, *size, mtu)) > 0)
{
int loss_event = ((rand() + 1.0)/(RAND_MAX + 1.0) < loss_rate/100.0);
if (*thrown == 0 && !loss_event)
{
memcpy(loss_frame + loss_pos, frame + pos, pkg_size);
loss_pos += pkg_size;
(*kept)++;
putc('.', stdout);
}
else
{
(*thrown)++;
putc('X', stdout);
}
pos += pkg_size;
}
memcpy(frame, loss_frame, loss_pos);
memset(frame + loss_pos, 0, *size - loss_pos);
*size = loss_pos;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HELPERS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INIT
/* Initialize codec */
flags = VPX_CODEC_USE_ERROR_CONCEALMENT;
res = vpx_codec_dec_init(&codec, interface, &dec_cfg, flags);
if(res)
die_codec(&codec, "Failed to initialize decoder");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INIT
Usage
-----
This example adds a single argument to the `simple_decoder` example,
which specifies the range or pattern of frames to drop. The parameter is
parsed as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE
if(argc < 4 || argc > 6)
die("Usage: %s <infile> <outfile> [-t <num threads>] <N-M|N/M|L,S>\n",
argv[0]);
{
char *nptr;
int arg_num = 3;
if (argc == 6 && strncmp(argv[arg_num++], "-t", 2) == 0)
dec_cfg.threads = strtol(argv[arg_num++], NULL, 0);
n = strtol(argv[arg_num], &nptr, 0);
mode = (*nptr == '\0' || *nptr == ',') ? 2 : (*nptr == '-') ? 1 : 0;
m = strtol(nptr+1, NULL, 0);
if((!n && !m) || (*nptr != '-' && *nptr != '/' &&
*nptr != '\0' && *nptr != ','))
die("Couldn't parse pattern %s\n", argv[3]);
}
seed = (m > 0) ? m : (unsigned int)time(NULL);
srand(seed);thrown_frame = 0;
printf("Seed: %u\n", seed);
printf("Threads: %d\n", dec_cfg.threads);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE
Dropping A Range Of Frames
--------------------------
To drop a range of frames, specify the starting frame and the ending
frame to drop, separated by a dash. The following command will drop
frames 5 through 10 (base 1).
$ ./decode_with_partial_drops in.ivf out.i420 5-10
Dropping A Pattern Of Frames
----------------------------
To drop a pattern of frames, specify the number of frames to drop and
the number of frames after which to repeat the pattern, separated by
a forward-slash. The following command will drop 3 of 7 frames.
Specifically, it will decode 4 frames, then drop 3 frames, and then
repeat.
$ ./decode_with_partial_drops in.ivf out.i420 3/7
Dropping Random Parts Of Frames
-------------------------------
A third argument tuple is available to split the frame into 1500 bytes pieces
and randomly drop pieces rather than frames. The frame will be split at
partition boundaries where possible. The following example will seed the RNG
with the seed 123 and drop approximately 5% of the pieces. Pieces which
are depending on an already dropped piece will also be dropped.
$ ./decode_with_partial_drops in.ivf out.i420 5,123
Extra Variables
---------------
This example maintains the pattern passed on the command line in the
`n`, `m`, and `is_range` variables:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_VARS
int n, m, mode;
unsigned int seed;
int thrown=0, kept=0;
int thrown_frame=0, kept_frame=0;
vpx_codec_dec_cfg_t dec_cfg = {0};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_VARS
Making The Drop Decision
------------------------
The example decides whether to drop the frame based on the current
frame number, immediately before decoding the frame.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRE_DECODE
/* Decide whether to throw parts of the frame or the whole frame
depending on the drop mode */
thrown_frame = 0;
kept_frame = 0;
switch (mode)
{
case 0:
if (m - (frame_cnt-1)%m <= n)
{
frame_sz = 0;
}
break;
case 1:
if (frame_cnt >= n && frame_cnt <= m)
{
frame_sz = 0;
}
break;
case 2:
throw_packets(frame, &frame_sz, n, &thrown_frame, &kept_frame);
break;
default: break;
}
if (mode < 2)
{
if (frame_sz == 0)
{
putc('X', stdout);
thrown_frame++;
}
else
{
putc('.', stdout);
kept_frame++;
}
}
thrown += thrown_frame;
kept += kept_frame;
fflush(stdout);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRE_DECODE

View File

@@ -1,104 +0,0 @@
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
@*INTRODUCTION
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define VPX_CODEC_DISABLE_COMPAT 1
#include "./vpx_config.h"
#include "vpx/vp8dx.h"
#include "vpx/vpx_decoder.h"
#define interface (vpx_codec_vp8_dx())
@EXTRA_INCLUDES
#define IVF_FILE_HDR_SZ (32)
#define IVF_FRAME_HDR_SZ (12)
static unsigned int mem_get_le32(const unsigned char *mem) {
return (mem[3] << 24)|(mem[2] << 16)|(mem[1] << 8)|(mem[0]);
}
static void die(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
if(fmt[strlen(fmt)-1] != '\n')
printf("\n");
exit(EXIT_FAILURE);
}
@DIE_CODEC
@HELPERS
int main(int argc, char **argv) {
FILE *infile, *outfile;
vpx_codec_ctx_t codec;
int flags = 0, frame_cnt = 0;
unsigned char file_hdr[IVF_FILE_HDR_SZ];
unsigned char frame_hdr[IVF_FRAME_HDR_SZ];
unsigned char frame[256*1024];
vpx_codec_err_t res;
@@@@EXTRA_VARS
(void)res;
/* Open files */
@@@@USAGE
if(!(infile = fopen(argv[1], "rb")))
die("Failed to open %s for reading", argv[1]);
if(!(outfile = fopen(argv[2], "wb")))
die("Failed to open %s for writing", argv[2]);
/* Read file header */
if(!(fread(file_hdr, 1, IVF_FILE_HDR_SZ, infile) == IVF_FILE_HDR_SZ
&& file_hdr[0]=='D' && file_hdr[1]=='K' && file_hdr[2]=='I'
&& file_hdr[3]=='F'))
die("%s is not an IVF file.", argv[1]);
printf("Using %s\n",vpx_codec_iface_name(interface));
@@@@DEC_INIT
/* Read each frame */
while(fread(frame_hdr, 1, IVF_FRAME_HDR_SZ, infile) == IVF_FRAME_HDR_SZ) {
int frame_sz = mem_get_le32(frame_hdr);
vpx_codec_iter_t iter = NULL;
vpx_image_t *img;
frame_cnt++;
if(frame_sz > sizeof(frame))
die("Frame %d data too big for example code buffer", frame_sz);
if(fread(frame, 1, frame_sz, infile) != frame_sz)
die("Frame %d failed to read complete frame", frame_cnt);
@@@@@@@@PRE_DECODE
@@@@@@@@DECODE
/* Write decoded data to disk */
@@@@@@@@GET_FRAME
unsigned int plane, y;
@@@@@@@@@@@@PROCESS_DX
}
}
printf("Processed %d frames.\n",frame_cnt);
@@@@DESTROY
fclose(outfile);
fclose(infile);
return EXIT_SUCCESS;
}

View File

@@ -1,62 +0,0 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INCLUDES
#define VPX_CODEC_DISABLE_COMPAT 1
#include "vpx/vpx_decoder.h"
#include "vpx/vp9dx.h"
#define interface (vpx_codec_vp8_dx())
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INCLUDES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DIE_CODEC
static void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
const char *detail = vpx_codec_error_detail(ctx);
printf("%s: %s\n", s, vpx_codec_error(ctx));
if(detail)
printf(" %s\n",detail);
exit(EXIT_FAILURE);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DIE_CODEC
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE
if(argc!=3)
die("Usage: %s <infile> <outfile>\n", argv[0]);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INIT
/* Initialize codec */
if(vpx_codec_dec_init(&codec, interface, NULL, flags))
die_codec(&codec, "Failed to initialize decoder");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INIT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DECODE
/* Decode the frame */
if(vpx_codec_decode(&codec, frame, frame_sz, NULL, 0))
die_codec(&codec, "Failed to decode frame");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DECODE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GET_FRAME
while((img = vpx_codec_get_frame(&codec, &iter))) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GET_FRAME
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_DX
for(plane=0; plane < 3; plane++) {
unsigned char *buf =img->planes[plane];
for(y=0; y < (plane ? (img->d_h + 1) >> 1 : img->d_h); y++) {
(void) fwrite(buf, 1, (plane ? (img->d_w + 1) >> 1 : img->d_w),
outfile);
buf += img->stride[plane];
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_DX
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY
if(vpx_codec_destroy(&codec))
die_codec(&codec, "Failed to destroy codec");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY

View File

@@ -1,74 +0,0 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_INCLUDES
#define VPX_CODEC_DISABLE_COMPAT 1
#include "vpx/vpx_encoder.h"
#include "vpx/vp9cx.h"
#define interface (vpx_codec_vp8_cx())
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_INCLUDES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DIE_CODEC
static void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
const char *detail = vpx_codec_error_detail(ctx);
printf("%s: %s\n", s, vpx_codec_error(ctx));
if(detail)
printf(" %s\n",detail);
exit(EXIT_FAILURE);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DIE_CODEC
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE
if(argc!=5)
die("Usage: %s <width> <height> <infile> <outfile>\n", argv[0]);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_DEF_CFG
/* Populate encoder configuration */
res = vpx_codec_enc_config_default(interface, &cfg, 0);
if(res) {
printf("Failed to get config: %s\n", vpx_codec_err_to_string(res));
return EXIT_FAILURE;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_DEF_CFG
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_SET_CFG
/* Update the default configuration with our settings */
cfg.rc_target_bitrate = width * height * cfg.rc_target_bitrate
/ cfg.g_w / cfg.g_h;
cfg.g_w = width;
cfg.g_h = height;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_SET_CFG
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_INIT
/* Initialize codec */
if(vpx_codec_enc_init(&codec, interface, &cfg, 0))
die_codec(&codec, "Failed to initialize encoder");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_INIT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENCODE_FRAME
frame_avail = read_frame(infile, &raw);
if(vpx_codec_encode(&codec, frame_avail? &raw : NULL, frame_cnt,
1, flags, VPX_DL_REALTIME))
die_codec(&codec, "Failed to encode frame");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENCODE_FRAME
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_FRAME
case VPX_CODEC_CX_FRAME_PKT:
write_ivf_frame_header(outfile, pkt);
(void) fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz,
outfile);
break;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_FRAME
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY
vpx_img_free(&raw);
if(vpx_codec_destroy(&codec))
die_codec(&codec, "Failed to destroy codec");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY

View File

@@ -8,10 +8,23 @@
* be found in the AUTHORS file in the root of the source tree.
*/
// Error Resiliency Features
// =========================
//
// This is an example demonstrating how to enable the error resiliency
// features of the codec.
//
// Configuration
// -------------
// Error resiliency is controlled by the g_error_resilient member of the
// configuration structure.
//
// Observing The Effects
// ---------------------
// Use the `decode_with_drops` example to decode with frames 5-10 dropped.
// Compare the output for a file encoded with this example versus one
// encoded with the `simple_encoder` example.
/*
@*INTRODUCTION
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -21,7 +34,6 @@
#include "vpx/vp8cx.h"
#define interface (vpx_codec_vp8_cx())
#define fourcc 0x30385056
@EXTRA_INCLUDES
#define IVF_FILE_HDR_SZ (32)
#define IVF_FRAME_HDR_SZ (12)
@@ -48,7 +60,14 @@ static void die(const char *fmt, ...) {
exit(EXIT_FAILURE);
}
@DIE_CODEC
static void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
const char *detail = vpx_codec_error_detail(ctx);
printf("%s: %s\n", s, vpx_codec_error(ctx));
if(detail)
printf(" %s\n",detail);
exit(EXIT_FAILURE);
}
static int read_frame(FILE *f, vpx_image_t *img) {
size_t nbytes, to_read;
@@ -118,10 +137,10 @@ int main(int argc, char **argv) {
int frame_avail;
int got_data;
int flags = 0;
@@@@TWOPASS_VARS
/* Open files */
@@@@USAGE
if(argc!=5)
die("Usage: %s <width> <height> <infile> <outfile>\n", argv[0]);
width = strtol(argv[1], NULL, 0);
height = strtol(argv[2], NULL, 0);
if(width < 16 || width%2 || height <16 || height%2)
@@ -133,20 +152,32 @@ int main(int argc, char **argv) {
printf("Using %s\n",vpx_codec_iface_name(interface));
@@@@ENC_DEF_CFG
/* Populate encoder configuration */
res = vpx_codec_enc_config_default(interface, &cfg, 0);
if(res) {
printf("Failed to get config: %s\n", vpx_codec_err_to_string(res));
return EXIT_FAILURE;
}
@@@@ENC_SET_CFG
@@@@ENC_SET_CFG2
/* Update the default configuration with our settings */
cfg.rc_target_bitrate = width * height * cfg.rc_target_bitrate
/ cfg.g_w / cfg.g_h;
cfg.g_w = width;
cfg.g_h = height;
/* Enable error resilient mode */
cfg.g_error_resilient = 1;
write_ivf_file_header(outfile, &cfg, 0);
@@@@TWOPASS_LOOP_BEGIN
/* Open input file for this encoding pass */
if(!(infile = fopen(argv[3], "rb")))
die("Failed to open %s for reading", argv[3]);
@@@@@@@@ENC_INIT
/* Initialize codec */
if(vpx_codec_enc_init(&codec, interface, &cfg, 0))
die_codec(&codec, "Failed to initialize encoder");
frame_avail = 1;
got_data = 0;
@@ -154,14 +185,19 @@ int main(int argc, char **argv) {
vpx_codec_iter_t iter = NULL;
const vpx_codec_cx_pkt_t *pkt;
@@@@@@@@@@@@PER_FRAME_CFG
@@@@@@@@@@@@ENCODE_FRAME
frame_avail = read_frame(infile, &raw);
if(vpx_codec_encode(&codec, frame_avail? &raw : NULL, frame_cnt,
1, flags, VPX_DL_REALTIME))
die_codec(&codec, "Failed to encode frame");
got_data = 0;
while( (pkt = vpx_codec_get_cx_data(&codec, &iter)) ) {
got_data = 1;
switch(pkt->kind) {
@@@@@@@@@@@@@@@@PROCESS_FRAME
@@@@@@@@@@@@@@@@PROCESS_STATS
case VPX_CODEC_CX_FRAME_PKT:
write_ivf_frame_header(outfile, pkt);
(void) fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz,
outfile);
break;
default:
break;
}
@@ -173,10 +209,11 @@ int main(int argc, char **argv) {
}
printf("\n");
fclose(infile);
@@@@TWOPASS_LOOP_END
printf("Processed %d frames.\n",frame_cnt-1);
@@@@DESTROY
vpx_img_free(&raw);
if(vpx_codec_destroy(&codec))
die_codec(&codec, "Failed to destroy codec");
/* Try to rewrite the file header with the actual frame count */
if(!fseek(outfile, 0, SEEK_SET))

View File

@@ -1,25 +0,0 @@
@TEMPLATE encoder_tmpl.c
Error Resiliency Features
=========================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
This is an example demonstrating how to enable the error resiliency
features of the codec.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
Configuration
-------------
Error resiliency is controlled by the g_error_resilient member of the
configuration structure.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_SET_CFG2
/* Enable error resilient mode */
cfg.g_error_resilient = 1;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_SET_CFG2
Observing The Effects
---------------------
Use the `decode_with_drops` example to decode with frames 5-10 dropped.
Compare the output for a file encoded with this example versus one
encoded with the `simple_encoder` example.

193
examples/example_xma.c Normal file
View File

@@ -0,0 +1,193 @@
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/* This is a simple program showing how to initialize the decoder in XMA mode */
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#define VPX_CODEC_DISABLE_COMPAT 1
#include "vpx_config.h"
#include "vpx/vpx_decoder.h"
#include "vpx/vpx_integer.h"
#if CONFIG_VP9_DECODER
#include "vpx/vp8dx.h"
#endif
static char *exec_name;
static int verbose = 0;
static const struct {
const char *name;
const vpx_codec_iface_t *iface;
} ifaces[] = {
#if CONFIG_VP9_DECODER
{"vp9", &vpx_codec_vp8_dx_algo},
#endif
};
static void usage_exit(void) {
int i;
printf("Usage: %s <options>\n\n"
"Options:\n"
"\t--codec <name>\tCodec to use (default=%s)\n"
"\t-h <height>\tHeight of the simulated video frame, in pixels\n"
"\t-w <width> \tWidth of the simulated video frame, in pixels\n"
"\t-v \tVerbose mode (show individual segment sizes)\n"
"\t--help \tShow this message\n"
"\n"
"Included decoders:\n"
"\n",
exec_name,
ifaces[0].name);
for (i = 0; i < sizeof(ifaces) / sizeof(ifaces[0]); i++)
printf(" %-6s - %s\n",
ifaces[i].name,
vpx_codec_iface_name(ifaces[i].iface));
exit(EXIT_FAILURE);
}
static void usage_error(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
printf("\n");
usage_exit();
}
void my_mem_dtor(vpx_codec_mmap_t *mmap) {
if (verbose)
printf("freeing segment %d\n", mmap->id);
free(mmap->priv);
}
int main(int argc, char **argv) {
vpx_codec_ctx_t decoder;
vpx_codec_iface_t *iface = ifaces[0].iface;
vpx_codec_iter_t iter;
vpx_codec_dec_cfg_t cfg;
vpx_codec_err_t res = VPX_CODEC_OK;
unsigned int alloc_sz = 0;
unsigned int w = 352;
unsigned int h = 288;
int i;
exec_name = argv[0];
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "--codec")) {
if (i + 1 < argc) {
int j, k = -1;
i++;
for (j = 0; j < sizeof(ifaces) / sizeof(ifaces[0]); j++)
if (!strcmp(ifaces[j].name, argv[i]))
k = j;
if (k >= 0)
iface = ifaces[k].iface;
else
usage_error("Error: Unrecognized argument (%s) to --codec\n",
argv[i]);
} else
usage_error("Error: Option --codec requires argument.\n");
} else if (!strcmp(argv[i], "-v"))
verbose = 1;
else if (!strcmp(argv[i], "-h"))
if (i + 1 < argc) {
h = atoi(argv[++i]);
} else
usage_error("Error: Option -h requires argument.\n");
else if (!strcmp(argv[i], "-w"))
if (i + 1 < argc) {
w = atoi(argv[++i]);
} else
usage_error("Error: Option -w requires argument.\n");
else if (!strcmp(argv[i], "--help"))
usage_exit();
else
usage_error("Error: Unrecognized option %s\n\n", argv[i]);
}
if (argc == 1)
printf("Using built-in defaults. For options, rerun with --help\n\n");
/* XMA mode is not supported on all decoders! */
if (!(vpx_codec_get_caps(iface) & VPX_CODEC_CAP_XMA)) {
printf("%s does not support XMA mode!\n", vpx_codec_iface_name(iface));
return EXIT_FAILURE;
}
/* The codec knows how much memory to allocate based on the size of the
* encoded frames. This data can be parsed from the bitstream with
* vpx_codec_peek_stream_info() if a bitstream is available. Otherwise,
* a fixed size can be used that will be the upper limit on the frame
* size the decoder can decode.
*/
cfg.w = w;
cfg.h = h;
/* Initialize the decoder in XMA mode. */
if (vpx_codec_dec_init(&decoder, iface, &cfg, VPX_CODEC_USE_XMA)) {
printf("Failed to initialize decoder in XMA mode: %s\n",
vpx_codec_error(&decoder));
return EXIT_FAILURE;
}
/* Iterate through the list of memory maps, allocating them with the
* requested alignment.
*/
iter = NULL;
do {
vpx_codec_mmap_t mmap;
unsigned int align;
res = vpx_codec_get_mem_map(&decoder, &mmap, &iter);
align = mmap.align ? mmap.align - 1 : 0;
if (!res) {
if (verbose)
printf("Allocating segment %u, size %lu, align %u %s\n",
mmap.id, mmap.sz, mmap.align,
mmap.flags & VPX_CODEC_MEM_ZERO ? "(ZEROED)" : "");
if (mmap.flags & VPX_CODEC_MEM_ZERO)
mmap.priv = calloc(1, mmap.sz + align);
else
mmap.priv = malloc(mmap.sz + align);
mmap.base = (void *)((((uintptr_t)mmap.priv) + align) &
~(uintptr_t)align);
mmap.dtor = my_mem_dtor;
alloc_sz += mmap.sz + align;
if (vpx_codec_set_mem_map(&decoder, &mmap, 1)) {
printf("Failed to set mmap: %s\n", vpx_codec_error(&decoder));
return EXIT_FAILURE;
}
} else if (res != VPX_CODEC_LIST_END) {
printf("Failed to get mmap: %s\n", vpx_codec_error(&decoder));
return EXIT_FAILURE;
}
} while (res != VPX_CODEC_LIST_END);
printf("%s\n %d bytes external memory required for %dx%d.\n",
decoder.name, alloc_sz, cfg.w, cfg.h);
vpx_codec_destroy(&decoder);
return EXIT_SUCCESS;
}

225
examples/force_keyframe.c Normal file
View File

@@ -0,0 +1,225 @@
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
// Forcing A Keyframe
// ==================
//
// This is an example demonstrating how to control placement of keyframes
// on a frame-by-frame basis.
//
// Configuration
// -------------
// Keyframes can be forced by setting the VPX_EFLAG_FORCE_KF bit of the
// flags passed to `vpx_codec_control()`. In this example, we force a
// keyframe every 8 frames.
//
// Observing The Effects
// ---------------------
// The output of the encoder examples shows a 'K' rather than a dot '.'
// when the encoder generates a keyframe. Note that every 8 frames a 'K'
// is output.
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#define VPX_CODEC_DISABLE_COMPAT 1
#include "vpx/vpx_encoder.h"
#include "vpx/vp8cx.h"
#define interface (vpx_codec_vp8_cx())
#define fourcc 0x30385056
#define IVF_FILE_HDR_SZ (32)
#define IVF_FRAME_HDR_SZ (12)
static void mem_put_le16(char *mem, unsigned int val) {
mem[0] = val;
mem[1] = val>>8;
}
static void mem_put_le32(char *mem, unsigned int val) {
mem[0] = val;
mem[1] = val>>8;
mem[2] = val>>16;
mem[3] = val>>24;
}
static void die(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
if(fmt[strlen(fmt)-1] != '\n')
printf("\n");
exit(EXIT_FAILURE);
}
static void die_codec(vpx_codec_ctx_t *ctx, const char *s) {
const char *detail = vpx_codec_error_detail(ctx);
printf("%s: %s\n", s, vpx_codec_error(ctx));
if(detail)
printf(" %s\n",detail);
exit(EXIT_FAILURE);
}
static int read_frame(FILE *f, vpx_image_t *img) {
size_t nbytes, to_read;
int res = 1;
to_read = img->w*img->h*3/2;
nbytes = fread(img->planes[0], 1, to_read, f);
if(nbytes != to_read) {
res = 0;
if(nbytes > 0)
printf("Warning: Read partial frame. Check your width & height!\n");
}
return res;
}
static void write_ivf_file_header(FILE *outfile,
const vpx_codec_enc_cfg_t *cfg,
int frame_cnt) {
char header[32];
if(cfg->g_pass != VPX_RC_ONE_PASS && cfg->g_pass != VPX_RC_LAST_PASS)
return;
header[0] = 'D';
header[1] = 'K';
header[2] = 'I';
header[3] = 'F';
mem_put_le16(header+4, 0); /* version */
mem_put_le16(header+6, 32); /* headersize */
mem_put_le32(header+8, fourcc); /* headersize */
mem_put_le16(header+12, cfg->g_w); /* width */
mem_put_le16(header+14, cfg->g_h); /* height */
mem_put_le32(header+16, cfg->g_timebase.den); /* rate */
mem_put_le32(header+20, cfg->g_timebase.num); /* scale */
mem_put_le32(header+24, frame_cnt); /* length */
mem_put_le32(header+28, 0); /* unused */
(void) fwrite(header, 1, 32, outfile);
}
static void write_ivf_frame_header(FILE *outfile,
const vpx_codec_cx_pkt_t *pkt)
{
char header[12];
vpx_codec_pts_t pts;
if(pkt->kind != VPX_CODEC_CX_FRAME_PKT)
return;
pts = pkt->data.frame.pts;
mem_put_le32(header, pkt->data.frame.sz);
mem_put_le32(header+4, pts&0xFFFFFFFF);
mem_put_le32(header+8, pts >> 32);
(void) fwrite(header, 1, 12, outfile);
}
int main(int argc, char **argv) {
FILE *infile, *outfile;
vpx_codec_ctx_t codec;
vpx_codec_enc_cfg_t cfg;
int frame_cnt = 0;
vpx_image_t raw;
vpx_codec_err_t res;
long width;
long height;
int frame_avail;
int got_data;
int flags = 0;
/* Open files */
if(argc!=5)
die("Usage: %s <width> <height> <infile> <outfile>\n", argv[0]);
width = strtol(argv[1], NULL, 0);
height = strtol(argv[2], NULL, 0);
if(width < 16 || width%2 || height <16 || height%2)
die("Invalid resolution: %ldx%ld", width, height);
if(!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, width, height, 1))
die("Faile to allocate image", width, height);
if(!(outfile = fopen(argv[4], "wb")))
die("Failed to open %s for writing", argv[4]);
printf("Using %s\n",vpx_codec_iface_name(interface));
/* Populate encoder configuration */
res = vpx_codec_enc_config_default(interface, &cfg, 0);
if(res) {
printf("Failed to get config: %s\n", vpx_codec_err_to_string(res));
return EXIT_FAILURE;
}
/* Update the default configuration with our settings */
cfg.rc_target_bitrate = width * height * cfg.rc_target_bitrate
/ cfg.g_w / cfg.g_h;
cfg.g_w = width;
cfg.g_h = height;
write_ivf_file_header(outfile, &cfg, 0);
/* Open input file for this encoding pass */
if(!(infile = fopen(argv[3], "rb")))
die("Failed to open %s for reading", argv[3]);
/* Initialize codec */
if(vpx_codec_enc_init(&codec, interface, &cfg, 0))
die_codec(&codec, "Failed to initialize encoder");
frame_avail = 1;
got_data = 0;
while(frame_avail || got_data) {
vpx_codec_iter_t iter = NULL;
const vpx_codec_cx_pkt_t *pkt;
if(!(frame_cnt & 7))
flags |= VPX_EFLAG_FORCE_KF;
else
flags &= ~VPX_EFLAG_FORCE_KF;
frame_avail = read_frame(infile, &raw);
if(vpx_codec_encode(&codec, frame_avail? &raw : NULL, frame_cnt,
1, flags, VPX_DL_REALTIME))
die_codec(&codec, "Failed to encode frame");
got_data = 0;
while( (pkt = vpx_codec_get_cx_data(&codec, &iter)) ) {
got_data = 1;
switch(pkt->kind) {
case VPX_CODEC_CX_FRAME_PKT:
write_ivf_frame_header(outfile, pkt);
(void) fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz,
outfile);
break;
default:
break;
}
printf(pkt->kind == VPX_CODEC_CX_FRAME_PKT
&& (pkt->data.frame.flags & VPX_FRAME_IS_KEY)? "K":".");
fflush(stdout);
}
frame_cnt++;
}
printf("\n");
fclose(infile);
printf("Processed %d frames.\n",frame_cnt-1);
vpx_img_free(&raw);
if(vpx_codec_destroy(&codec))
die_codec(&codec, "Failed to destroy codec");
/* Try to rewrite the file header with the actual frame count */
if(!fseek(outfile, 0, SEEK_SET))
write_ivf_file_header(outfile, &cfg, frame_cnt-1);
fclose(outfile);
return EXIT_SUCCESS;
}

View File

@@ -1,28 +0,0 @@
@TEMPLATE encoder_tmpl.c
Forcing A Keyframe
==================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
This is an example demonstrating how to control placement of keyframes
on a frame-by-frame basis.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION
Configuration
-------------
Keyframes can be forced by setting the VPX_EFLAG_FORCE_KF bit of the
flags passed to `vpx_codec_control()`. In this example, we force a
keyframe every 8 frames.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PER_FRAME_CFG
if(!(frame_cnt & 7))
flags |= VPX_EFLAG_FORCE_KF;
else
flags &= ~VPX_EFLAG_FORCE_KF;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PER_FRAME_CFG
Observing The Effects
---------------------
The output of the encoder examples shows a 'K' rather than a dot '.'
when the encoder generates a keyframe. Note that every 8 frames a 'K'
is output.

View File

@@ -1,85 +0,0 @@
#!/bin/bash
##
## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
##
## Use of this source code is governed by a BSD-style license
## that can be found in the LICENSE file in the root of the source
## tree. An additional intellectual property rights grant can be found
## in the file PATENTS. All contributing project authors may
## be found in the AUTHORS file in the root of the source tree.
##
# gen_example_code.sh
self=$0
die_usage() {
echo "Usage: $self <example.txt>"
exit 1
}
die() {
echo "$@"
exit 1
}
include_block() {
show_bar=$1
block_name=${line##*@}
indent=${line%%${block_name}}
indent=${#indent}
[ $indent -eq 1 ] && indent=0
local on_block
while IFS=$'\n' read -r t_line; do
case "$t_line" in
\~*\ ${block_name})
if [ "x$on_block" == "xyes" ]; then
return 0;
else
on_block=yes
fi
;;
@DEFAULT)
if [ "x$on_block" == "xyes" ]; then
include_block $show_bar < "${template%.c}.txt"
return 0
fi
;;
*)
if [ "x$on_block" == "xyes" ]; then
local rem
(( rem = 78 - indent ))
case "$block_name" in
\**) printf "%${indent}s * %s\n" "" "$t_line" ;;
*)
if [ "$show_bar" == "yes" ]; then
printf "%${indent}s%-${rem}s//\n" "" "$t_line"
else
printf "%${indent}s%s\n" "" "$t_line"
fi
;;
esac
fi
esac
done
return 1
}
txt=$1
[ -f "$txt" ] || die_usage
read -r template < "$txt"
case "$template" in
@TEMPLATE*) template=${txt%/*}/${template##@TEMPLATE } ;;
*) die "Failed to parse template name from '$template'" ;;
esac
while IFS=$'\n' read -r line; do
case "$line" in
@*) include_block yes < "$txt" \
|| include_block < "${template%.c}.txt" \
#|| echo "WARNING: failed to find text for block $block_name" >&2
;;
*) echo "$line" ;;
esac
done < "$template"

View File

@@ -1,224 +0,0 @@
#!/usr/bin/env php
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
<?php
/* This script converts markdown to doxygen htmlonly syntax, nesting the
* content inside a \page. It expects input on stdin and outputs on stdout.
*
* Usage: gen_example_doxy.php <page_identifier> "<page description>"
*/
$geshi_path = dirname($argv[0])."/includes/geshi/geshi/"; // Language files
$tmp_token = '<!-- I wanna rock you, Chaka Khan -->';
// Include prerequisites or exit
if(!include_once('includes/PHP-Markdown-Extra-1.2.3/markdown.php'))
die("Cannot load Markdown transformer.\n");
if(!include_once('includes/PHP-SmartyPants-1.5.1e/smartypants.php'))
die("Cannot load SmartyPants transformer.\n");
if(!include_once('includes/geshi/geshi.php'))
die("Cannot load GeSHi transformer.\n");
// ASCIIMathPHP?
// HTML::Toc?
// Tidy?
// Prince?
/**
* Generate XHTML body
*
*/
$page_body = file_get_contents('php://stdin');
// Transform any MathML expressions in the body text
$regexp = '/\[\[(.*?)\]\]/'; // Double square bracket delimiters
$page_body = preg_replace_callback($regexp, 'ASCIIMathPHPCallback', $page_body);
// Fix ASCIIMathPHP's output
$page_body = fix_asciiMath($page_body);
// Wrap block-style <math> elements in <p>, since Markdown doesn't.
$page_body = preg_replace('/\n(<math.*<\/math>)\n/', '<p class="eq_para">$1</p>', $page_body);
// Transform the body text to HTML
$page_body = Markdown($page_body);
// Preprocess code blocks
// Decode XML entities. GeSHi doesn't anticipate that
// Markdown has already done this.
$regexp = '|<pre><code>(.*?)<\/code><\/pre>|si';
while (preg_match($regexp, $page_body, $matches) > 0)
{
// Replace 1st match with token
$page_body = preg_replace($regexp, $tmp_token, $page_body, 1);
$block_new = $matches[1];
// Un-encode ampersand entities
$block_new = decode_markdown($block_new);
// Replace token with revised string
$page_body = preg_replace("|$tmp_token|", '<div class="codeblock">'.$block_new.'</div>', $page_body);
}
// Run GeSHi over code blocks
$regexp = '|<div class="codeblock">(.*?)<\/div>|si';
$language = 'c';
while (preg_match($regexp, $page_body, $matches))
{
$geshi = new GeSHi($matches[1], $language);
$geshi->set_language_path($geshi_path);
$block_new = $geshi->parse_code();
// Strip annoying final newline
$block_new = preg_replace('|\n&nbsp;<\/pre>|', '</pre>' , $block_new);
// Remove style attribute (TODO: Research this in GeSHi)
$block_new = preg_replace('| style="font-family:monospace;"|', '' , $block_new);
$page_body = preg_replace($regexp, $block_new, $page_body, 1);
unset($geshi); // Clean up
}
unset($block_new); // Clean up
// Apply typographic flourishes
$page_body = SmartyPants($page_body);
/**
* Generate Doxygen Body
*
*/
$page_id=(isset($argv[1]))?$argv[1]:"";
$page_desc=(isset($argv[2]))?$argv[2]:"";
print "/*!\\page ".$page_id." ".$page_desc."\n\\htmlonly\n";
print $page_body;
print "\\endhtmlonly\n*/\n";
// ---------------------------------------------------------
/**
* decode_markdown()
*
* Markdown encodes '&', '<' and '>' in detected code
* blocks, as a convenience. This will restore the
* encoded entities to ordinary characters, since a
* downstream transformer (like GeSHi) may not
* anticipate this.
*
**********************************************************/
function decode_markdown($input)
{
$out = FALSE;
$entities = array ('|&amp;|'
,'|&lt;|'
,'|&gt;|'
);
$characters = array ('&'
,'<'
,'>'
);
$input = preg_replace($entities, $characters, $input);
$out = $input;
return $out;
}
/**
* ASCIIMathML parser
* http://tinyurl.com/ASCIIMathPHP
*
* @PARAM mtch_arr array - Array of ASCIIMath expressions
* as returned by preg_replace_callback([pattern]). First
* dimension is the full matched string (with delimiter);
* 2nd dimension is the undelimited contents (typically
* a capture group).
*
**********************************************************/
function ASCIIMathPHPCallback($mtch_arr)
{
$txt = trim($mtch_arr[1]);
include('includes/ASCIIMathPHP-2.0/ASCIIMathPHP-2.0.cfg.php');
require_once('includes/ASCIIMathPHP-2.0/ASCIIMathPHP-2.0.class.php');
static $asciimath;
if (!isset($asciimath)) $asciimath = new ASCIIMathPHP($symbol_arr);
$math_attr_arr = array('displaystyle' => 'true');
$asciimath->setExpr($txt);
$asciimath->genMathML($math_attr_arr);
return($asciimath->getMathML());
}
/**
* fix_asciiMath()
*
* ASCIIMath pretty-prints its output, with linefeeds
* and tabs. Causes unexpected behavior in some renderers.
* This flattens <math> blocks.
*
* @PARAM page_body str - The <body> element of an
* XHTML page to transform.
*
**********************************************************/
function fix_asciiMath($page_body)
{
$out = FALSE;
// Remove linefeeds and whitespace in <math> elements
$tags_bad = array('/(<math.*?>)\n*\s*/'
, '/(<mstyle.*?>)\n*\s*/'
, '/(<\/mstyle>)\n*\s*/'
, '/(<mrow.*?>)\n*\s*/'
, '/(<\/mrow>)\n*\s*/'
, '/(<mo.*?>)\n*\s*/'
, '/(<\/mo>)\n*\s*/'
, '/(<mi.*?>)\n*\s*/'
, '/(<\/mi>)\n*\s*/'
, '/(<mn.*?>)\n*\s*/'
, '/(<\/mn>)\n*\s*/'
, '/(<mtext.*?>)\n*\s*/'
, '/(<\/mtext>)\n*\s*/'
, '/(<msqrt.*?>)\n*\s*/'
, '/(<\/msqrt>)\n*\s*/'
, '/(<mfrac.*?>)\n*\s*/'
, '/(<\/mfrac>)\n*\s*/'
);
$tags_good = array( '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
, '$1'
);
$out = preg_replace($tags_bad, $tags_good, $page_body);
return $out;
}

View File

@@ -1,84 +0,0 @@
#!/bin/bash
##
## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
##
## Use of this source code is governed by a BSD-style license
## that can be found in the LICENSE file in the root of the source
## tree. An additional intellectual property rights grant can be found
## in the file PATENTS. All contributing project authors may
## be found in the AUTHORS file in the root of the source tree.
##
# gen_example_text.sh
self=$0
die_usage() {
echo "Usage: $self <example.txt>"
exit 1
}
die() {
echo "$@"
exit 1
}
include_block() {
local on_block
while IFS=$'\n' read -r t_line; do
case "$t_line" in
\~*\ ${block_name})
if [ "x$on_block" == "xyes" ]; then
return 0;
else
on_block=yes
fi
;;
*)
if [ "x$on_block" == "xyes" ]; then
echo "$t_line"
fi
;;
esac
done
echo "WARNING: failed to find text for block $block_name" >&2
return 1
}
txt=$1
[ -f "$txt" ] || die_usage
read -r template < "$txt"
case "$template" in
@TEMPLATE*) template=${txt%/*}/${template##@TEMPLATE } ;;
*) die "Failed to parse template name from '$template'" ;;
esac
fence="~~~~~~~~~"
fence="${fence}${fence}"
fence="${fence}${fence}"
fence="${fence}${fence}"
while IFS=$'\n' read -r line; do
case "$line" in
@TEMPLATE*)
template=${template##@TEMPLATE }
template=${template%.c}.txt
;;
@DEFAULT)
include_block < "$template"
;;
~~~*)
block_name=${line##~* }
[ "$block_name" == "INTRODUCTION" ] || echo "$fence"
;;
*) echo "$line"
;;
esac
done < "$txt"
echo
echo "Putting It All Together"
echo "======================="
echo "${fence}"
${self%/*}/gen_example_code.sh "${txt}"
echo "${fence}"

View File

@@ -1,218 +0,0 @@
<?php
$symbol_arr = array(
// Greek symbols
'alpha' => array( 'input'=>'alpha','tag'=>'mi', 'output'=>'&#' . hexdec('03B1') . ';'),
'beta' => array( 'input'=>'beta','tag'=>'mi', 'output'=>'&#' . hexdec('03B2') . ';'),
'chi' => array( 'input'=>'chi','tag'=>'mi', 'output'=>'&#' . hexdec('03C7') . ';'),
'delta' => array( 'input'=>'delta','tag'=>'mi', 'output'=>'&#' . hexdec('03B4') . ';'),
'Delta' => array( 'input'=>'Delta','tag'=>'mo', 'output'=>'&#' . hexdec('0394') . ';'),
'epsi' => array( 'input'=>'epsi','tag'=>'mi', 'output'=>'&#' . hexdec('03B5') . ';'),
'varepsilon' => array( 'input'=>'varepsilon','tag'=>'mi', 'output'=>'&#' . hexdec('025B') . ';'),
'eta' => array( 'input'=>'eta','tag'=>'mi', 'output'=>'&#' . hexdec('03B7') . ';'),
'gamma' => array( 'input'=>'gamma','tag'=>'mi', 'output'=>'&#' . hexdec('03B3') . ';'),
'Gamma' => array( 'input'=>'Gamma','tag'=>'mi', 'output'=>'&#' . hexdec('0393') . ';'),
'iota' => array( 'input'=>'iota','tag'=>'mi', 'output'=>'&#' . hexdec('03B9') . ';'),
'kappa' => array( 'input'=>'kappa','tag'=>'mi', 'output'=>'&#' . hexdec('03BA') . ';'),
'lambda' => array( 'input'=>'lambda','tag'=>'mi', 'output'=>'&#' . hexdec('03BB') . ';'),
'Lambda' => array( 'input'=>'Lambda','tag'=>'mo', 'output'=>'&#' . hexdec('039B') . ';'),
'mu' => array( 'input'=>'mu','tag'=>'mi', 'output'=>'&#' . hexdec('03BC') . ';'),
'nu' => array( 'input'=>'nu','tag'=>'mi', 'output'=>'&#' . hexdec('03BD') . ';'),
'omega' => array( 'input'=>'omega','tag'=>'mi', 'output'=>'&#' . hexdec('03C9') . ';'),
'Omega' => array( 'input'=>'Omega','tag'=>'mo', 'output'=>'&#' . hexdec('03A9') . ';'),
'phi' => array( 'input'=>'phi','tag'=>'mi', 'output'=>'&#' . hexdec('03C6') . ';'),
'varphi' => array( 'input'=>'varphi','tag'=>'mi', 'output'=>'&#' . hexdec('03D5') . ';'),
'Phi' => array( 'input'=>'Phi','tag'=>'mo', 'output'=>'&#' . hexdec('03A6') . ';'),
'pi' => array( 'input'=>'pi','tag'=>'mi', 'output'=>'&#' . hexdec('03C0') . ';'),
'Pi' => array( 'input'=>'Pi','tag'=>'mo', 'output'=>'&#' . hexdec('03A0') . ';'),
'psi' => array( 'input'=>'psi','tag'=>'mi', 'output'=>'&#' . hexdec('03C8') . ';'),
'rho' => array( 'input'=>'rho','tag'=>'mi', 'output'=>'&#' . hexdec('03C1') . ';'),
'sigma' => array( 'input'=>'sigma','tag'=>'mi', 'output'=>'&#' . hexdec('03C3') . ';'),
'Sigma' => array( 'input'=>'Sigma','tag'=>'mo', 'output'=>'&#' . hexdec('03A3') . ';'),
'tau' => array( 'input'=>'tau','tag'=>'mi', 'output'=>'&#' . hexdec('03C4') . ';'),
'theta' => array( 'input'=>'theta','tag'=>'mi', 'output'=>'&#' . hexdec('03B8') . ';'),
'vartheta' => array( 'input'=>'vartheta','tag'=>'mi', 'output'=>'&#' . hexdec('03D1') . ';'),
'Theta' => array( 'input'=>'Theta','tag'=>'mo', 'output'=>'&#' . hexdec('0398') . ';'),
'upsilon' => array( 'input'=>'upsilon','tag'=>'mi', 'output'=>'&#' . hexdec('03C5') . ';'),
'xi' => array( 'input'=>'xi','tag'=>'mi', 'output'=>'&#' . hexdec('03BE') . ';'),
'Xi' => array( 'input'=>'alpha','tag'=>'mo', 'output'=>'&#' . hexdec('039E') . ';'),
'zeta' => array( 'input'=>'zeta','tag'=>'mi', 'output'=>'&#' . hexdec('03B6') . ';'),
// Binary operation symbols
'*' => array( 'input'=>'*','tag'=>'mo', 'output'=>'&#' . hexdec('22C5') . ';'),
'**' => array( 'input'=>'**','tag'=>'mo', 'output'=>'&#' . hexdec('22C6') . ';'),
'//' => array( 'input'=>'//','tag'=>'mo', 'output'=>'/'),
'\\\\' => array( 'input'=>'\\\\','tag'=>'mo', 'output'=>'\\'),
'xx' => array( 'input'=>'xx','tag'=>'mo', 'output'=>'&#' . hexdec('00D7') . ';'),
'-:' => array( 'input'=>'-:','tag'=>'mo', 'output'=>'&#' . hexdec('00F7') . ';'),
'@' => array( 'input'=>'@','tag'=>'mo', 'output'=>'&#' . hexdec('2218') . ';'),
'o+' => array( 'input'=>'o+','tag'=>'mo', 'output'=>'&#' . hexdec('2295') . ';'),
'ox' => array( 'input'=>'ox','tag'=>'mo', 'output'=>'&#' . hexdec('2297') . ';'),
'sum' => array( 'input'=>'sum','tag'=>'mo', 'output'=>'&#' . hexdec('2211') . ';', 'underover'=>TRUE),
'prod' => array( 'input'=>'prod','tag'=>'mo', 'output'=>'&#' . hexdec('220F') . ';', 'underover'=>TRUE),
'^^' => array( 'input'=>'^^','tag'=>'mo', 'output'=>'&#' . hexdec('2227') . ';'),
'^^^' => array( 'input'=>'^^^','tag'=>'mo', 'output'=>'&#' . hexdec('22C0') . ';', 'underover'=>TRUE),
'vv' => array( 'input'=>'vv','tag'=>'mo', 'output'=>'&#' . hexdec('2228') . ';'),
'vvv' => array( 'input'=>'vvv','tag'=>'mo', 'output'=>'&#' . hexdec('22C1') . ';', 'underover'=>TRUE),
'nn' => array( 'input'=>'nn','tag'=>'mo', 'output'=>'&#' . hexdec('2229') . ';'),
'nnn' => array( 'input'=>'nnn','tag'=>'mo', 'output'=>'&#' . hexdec('22C5') . ';', 'underover'=>TRUE),
'uu' => array( 'input'=>'uu','tag'=>'mo', 'output'=>'&#' . hexdec('222A') . ';'),
'uuu' => array( 'input'=>'uuu','tag'=>'mo', 'output'=>'&#' . hexdec('22C3') . ';', 'underover'=>TRUE),
// Binary relation symbols
'!=' => array( 'input'=>'!=','tag'=>'mo', 'output'=>'&#' . hexdec('2260') . ';'),
':=' => array( 'input'=>':=','tag'=>'mo', 'output'=>':=' ), /* 2005-06-05 wes */
'<' => array( 'input'=>'<','tag'=>'mo', 'output'=>'&lt;'),
'lt' => array( 'input'=>'lt','tag'=>'mo', 'output'=>'&lt;'), /* 2005-06-05 wes */
'<=' => array( 'input'=>'<=','tag'=>'mo', 'output'=>'&#' . hexdec('2264') . ';'),
'lt=' => array( 'input'=>'lt=','tag'=>'mo', 'output'=>'&#' . hexdec('2264') . ';'),
'le' => array( 'input'=>'le','tag'=>'mo', 'output'=>'&#' . hexdec('2264') . ';'), /* 2005-06-05 wes */
'>' => array( 'input'=>'>','tag'=>'mo', 'output'=>'&gt;'),
'>=' => array( 'input'=>'>=','tag'=>'mo', 'output'=>'&#' . hexdec('2265') . ';'),
'qeq' => array( 'input'=>'geq','tag'=>'mo', 'output'=>'&#' . hexdec('2265') . ';'),
'-<' => array( 'input'=>'-<','tag'=>'mo', 'output'=>'&#' . hexdec('227A') . ';'),
'-lt' => array( 'input'=>'-lt','tag'=>'mo', 'output'=>'&#' . hexdec('227A') . ';'),
'>-' => array( 'input'=>'>-','tag'=>'mo', 'output'=>'&#' . hexdec('227B') . ';'),
'in' => array( 'input'=>'in','tag'=>'mo', 'output'=>'&#' . hexdec('2208') . ';'),
'!in' => array( 'input'=>'!in','tag'=>'mo', 'output'=>'&#' . hexdec('2209') . ';'),
'sub' => array( 'input'=>'sub','tag'=>'mo', 'output'=>'&#' . hexdec('2282') . ';'),
'sup' => array( 'input'=>'sup','tag'=>'mo', 'output'=>'&#' . hexdec('2283') . ';'),
'sube' => array( 'input'=>'sube','tag'=>'mo', 'output'=>'&#' . hexdec('2286') . ';'),
'supe' => array( 'input'=>'supe','tag'=>'mo', 'output'=>'&#' . hexdec('2287') . ';'),
'-=' => array( 'input'=>'-=','tag'=>'mo', 'output'=>'&#' . hexdec('2261') . ';'),
'~=' => array( 'input'=>'~=','tag'=>'mo', 'output'=>'&#' . hexdec('2245') . ';'),
'~~' => array( 'input'=>'~~','tag'=>'mo', 'output'=>'&#' . hexdec('2248') . ';'),
'prop' => array( 'input'=>'prop','tag'=>'mo', 'output'=>'&#' . hexdec('221D') . ';'),
// Logical symbols
'and' => array( 'input'=>'and','tag'=>'mtext', 'output'=>'and', 'space'=>'1ex'),
'or' => array( 'input'=>'or','tag'=>'mtext', 'output'=>'or', 'space'=>'1ex'),
'not' => array( 'input'=>'not','tag'=>'mo', 'output'=>'&#' . hexdec('00AC') . ';'),
'=>' => array( 'input'=>'=>','tag'=>'mo', 'output'=>'&#' . hexdec('21D2') . ';'),
'if' => array( 'input'=>'if','tag'=>'mo', 'output'=>'if', 'space'=>'1ex'),
'iff' => array( 'input'=>'iff','tag'=>'mo', 'output'=>'&#' . hexdec('21D4') . ';'),
'<=>' => array( 'input'=>'iff','tag'=>'mo', 'output'=>'&#' . hexdec('21D4') . ';'), /* 2005-06-07 wes */
'AA' => array( 'input'=>'AA','tag'=>'mo', 'output'=>'&#' . hexdec('2200') . ';'),
'EE' => array( 'input'=>'EE','tag'=>'mo', 'output'=>'&#' . hexdec('2203') . ';'),
'_|_' => array( 'input'=>'_|_','tag'=>'mo', 'output'=>'&#' . hexdec('22A5') . ';'),
'TT' => array( 'input'=>'TT','tag'=>'mo', 'output'=>'&#' . hexdec('22A4') . ';'),
'|-' => array( 'input'=>'|-','tag'=>'mo', 'output'=>'&#' . hexdec('22A2') . ';'),
'|=' => array( 'input'=>'|=','tag'=>'mo', 'output'=>'&#' . hexdec('22A8') . ';'),
// Miscellaneous symbols
'ang' => array('input'=>'ang','tag'=>'mo','output'=>'&#' . hexdec('2220') . ';'),
'deg' => array('input'=>'deg','tag'=>'mo','output'=>'&#' . hexdec('00B0') . ';'),
'int' => array( 'input'=>'int','tag'=>'mo', 'output'=>'&#' . hexdec('222B') . ';'),
'dx' => array( 'input'=>'dx','tag'=>'mi', 'output'=>'{:d x:}', 'definition'=>TRUE), /* 2005-06-11 wes */
'dy' => array( 'input'=>'dy','tag'=>'mi', 'output'=>'{:d y:}', 'definition'=>TRUE), /* 2005-06-11 wes */
'dz' => array( 'input'=>'dz','tag'=>'mi', 'output'=>'{:d z:}', 'definition'=>TRUE), /* 2005-06-11 wes */
'dt' => array( 'input'=>'dt','tag'=>'mi', 'output'=>'{:d t:}', 'definition'=>TRUE), /* 2005-06-11 wes */
'oint' => array( 'input'=>'oint','tag'=>'mo', 'output'=>'&#' . hexdec('222E') . ';'),
'del' => array( 'input'=>'del','tag'=>'mo', 'output'=>'&#' . hexdec('2202') . ';'),
'grad' => array( 'input'=>'grad','tag'=>'mo', 'output'=>'&#' . hexdec('2207') . ';'),
'+-' => array( 'input'=>'+-','tag'=>'mo', 'output'=>'&#' . hexdec('00B1') . ';'),
'O/' => array( 'input'=>'0/','tag'=>'mo', 'output'=>'&#' . hexdec('2205') . ';'),
'oo' => array( 'input'=>'oo','tag'=>'mo', 'output'=>'&#' . hexdec('221E') . ';'),
'aleph' => array( 'input'=>'aleph','tag'=>'mo', 'output'=>'&#' . hexdec('2135') . ';'),
'...' => array( 'input'=>'int','tag'=>'mo', 'output'=>'...'),
'~' => array( 'input'=>'!~','tag'=>'mo', 'output'=>'&#' . hexdec('0020') . ';'),
'\\ ' => array( 'input'=>'~','tag'=>'mo', 'output'=>'&#' . hexdec('00A0') . ';'),
'quad' => array( 'input'=>'quad','tag'=>'mo', 'output'=>'&#' . hexdec('00A0') . ';&#' . hexdec('00A0') . ';'),
'qquad' => array( 'input'=>'qquad','tag'=>'mo', 'output'=> '&#' . hexdec('00A0') . ';&#' . hexdec('00A0') . ';&#' . hexdec('00A0') . ';'),
'cdots' => array( 'input'=>'cdots','tag'=>'mo', 'output'=>'&#' . hexdec('22EF') . ';'),
'vdots' => array( 'input'=>'vdots','tag'=>'mo', 'output'=>'&#' . hexdec('22EE') . ';'), /* 2005-06-11 wes */
'ddots' => array( 'input'=>'ddots','tag'=>'mo', 'output'=>'&#' . hexdec('22F1') . ';'), /* 2005-06-11 wes */
'diamond' => array( 'input'=>'diamond','tag'=>'mo', 'output'=>'&#' . hexdec('22C4') . ';'),
'square' => array( 'input'=>'square','tag'=>'mo', 'output'=>'&#' . hexdec('25A1') . ';'),
'|_' => array( 'input'=>'|_','tag'=>'mo', 'output'=>'&#' . hexdec('230A') . ';'),
'_|' => array( 'input'=>'_|','tag'=>'mo', 'output'=>'&#' . hexdec('230B') . ';'),
'|~' => array( 'input'=>'|~','tag'=>'mo', 'output'=>'&#' . hexdec('2308') . ';'),
'~|' => array( 'input'=>'~|','tag'=>'mo', 'output'=>'&#' . hexdec('2309') . ';'),
'CC' => array( 'input'=>'CC','tag'=>'mo', 'output'=>'&#' . hexdec('2102') . ';'),
'NN' => array( 'input'=>'NN','tag'=>'mo', 'output'=>'&#' . hexdec('2115') . ';'),
'QQ' => array( 'input'=>'QQ','tag'=>'mo', 'output'=>'&#' . hexdec('211A') . ';'),
'RR' => array( 'input'=>'RR','tag'=>'mo', 'output'=>'&#' . hexdec('211D') . ';'),
'ZZ' => array( 'input'=>'ZZ','tag'=>'mo', 'output'=>'&#' . hexdec('2124') . ';'),
// Standard functions
'lim' => array( 'input'=>'lim','tag'=>'mo', 'output'=>'lim', 'underover'=>TRUE),
'Lim' => array( 'input'=>'Lim','tag'=>'mo', 'output'=>'Lim', 'underover'=>TRUE), /* 2005-06-11 wes */
'sin' => array( 'input'=>'sin','tag'=>'mo', 'output'=>'sin', 'unary'=>TRUE, 'func'=>TRUE),
'cos' => array( 'input'=>'cos', 'tag'=>'mo', 'output'=>'cos', 'unary'=>TRUE, 'func'=>TRUE),
'tan' => array( 'input'=>'tan', 'tag'=>'mo', 'output'=>'tan', 'unary'=>TRUE, 'func'=>TRUE),
'arcsin' => array( 'input'=>'arcsin','tag'=>'mo', 'output'=>'arcsin', 'unary'=>TRUE, 'func'=>TRUE), //2006-9-7 DL
'arccos' => array( 'input'=>'arccos', 'tag'=>'mo', 'output'=>'arccos', 'unary'=>TRUE, 'func'=>TRUE), //2006-9-7 DL
'arctan' => array( 'input'=>'arctan', 'tag'=>'mo', 'output'=>'arctan', 'unary'=>TRUE, 'func'=>TRUE), //2006-9-7 DL
'sinh' => array( 'input'=>'sinh','tag'=>'mo', 'output'=>'sinh', 'unary'=>TRUE, 'func'=>TRUE),
'cosh' => array( 'input'=>'cosh', 'tag'=>'mo', 'output'=>'cosh', 'unary'=>TRUE, 'func'=>TRUE),
'tanh' => array( 'input'=>'tanh', 'tag'=>'mo', 'output'=>'tanh', 'unary'=>TRUE, 'func'=>TRUE),
'cot' => array( 'input'=>'cot','tag'=>'mo', 'output'=>'cot', 'unary'=>TRUE, 'func'=>TRUE),
'sec' => array( 'input'=>'sec', 'tag'=>'mo', 'output'=>'sec', 'unary'=>TRUE, 'func'=>TRUE),
'csc' => array( 'input'=>'csc', 'tag'=>'mo', 'output'=>'csc', 'unary'=>TRUE, 'func'=>TRUE),
'coth' => array( 'input'=>'coth','tag'=>'mo', 'output'=>'coth', 'unary'=>TRUE, 'func'=>TRUE),
'sech' => array( 'input'=>'sech', 'tag'=>'mo', 'output'=>'sech', 'unary'=>TRUE, 'func'=>TRUE),
'csch' => array( 'input'=>'csch', 'tag'=>'mo', 'output'=>'csch', 'unary'=>TRUE, 'func'=>TRUE),
'log' => array( 'input'=>'log', 'tag'=>'mo', 'output'=>'log', 'unary'=>TRUE, 'func'=>TRUE),
'ln' => array( 'input'=>'ln', 'tag'=>'mo', 'output'=>'ln', 'unary'=>TRUE, 'func'=>TRUE),
'det' => array( 'input'=>'det', 'tag'=>'mo', 'output'=>'det', 'unary'=>TRUE, 'func'=>TRUE),
'dim' => array( 'input'=>'dim', 'tag'=>'mo', 'output'=>'dim'),
'mod' => array( 'input'=>'mod', 'tag'=>'mo', 'output'=>'mod'),
'gcd' => array( 'input'=>'gcd', 'tag'=>'mo', 'output'=>'gcd', 'unary'=>TRUE, 'func'=>TRUE),
'lcm' => array( 'input'=>'lcm', 'tag'=>'mo', 'output'=>'lcm', 'unary'=>TRUE, 'func'=>TRUE),
'lub' => array( 'input'=>'lub', 'tag'=>'mo', 'output'=>'lub'), /* 2005-06-11 wes */
'glb' => array( 'input'=>'glb', 'tag'=>'mo', 'output'=>'glb'), /* 2005-06-11 wes */
'min' => array( 'input'=>'min', 'tag'=>'mo', 'output'=>'min', 'underover'=>TRUE), /* 2005-06-11 wes */
'max' => array( 'input'=>'max', 'tag'=>'mo', 'output'=>'max', 'underover'=>TRUE), /* 2005-06-11 wes */
'f' => array( 'input'=>'f','tag'=>'mi', 'output'=>'f', 'unary'=>TRUE, 'func'=>TRUE), //2006-9-7 DL
'g' => array( 'input'=>'g', 'tag'=>'mi', 'output'=>'g', 'unary'=>TRUE, 'func'=>TRUE), //2006-9-7 DL
// Arrows
'uarr' => array( 'input'=>'uarr', 'tag'=>'mo', 'output'=>'&#' . hexdec('2191') . ';'),
'darr' => array( 'input'=>'darr', 'tag'=>'mo', 'output'=>'&#' . hexdec('2193') . ';'),
'rarr' => array( 'input'=>'rarr', 'tag'=>'mo', 'output'=>'&#' . hexdec('2192') . ';'),
'->' => array( 'input'=>'->', 'tag'=>'mo', 'output'=>'&#' . hexdec('2192') . ';'),
'|->' => array( 'input'=>'|->', 'tag'=>'mo', 'output'=>'&#' . hexdec('21A6') . ';'), /* 2005-06-11 wes */
'larr' => array( 'input'=>'larr', 'tag'=>'mo', 'output'=>'&#' . hexdec('2190') . ';'),
'harr' => array( 'input'=>'harr', 'tag'=>'mo', 'output'=>'&#' . hexdec('2194') . ';'),
'rArr' => array( 'input'=>'rArr', 'tag'=>'mo', 'output'=>'&#' . hexdec('21D2') . ';'),
'lArr' => array( 'input'=>'lArr', 'tag'=>'mo', 'output'=>'&#' . hexdec('21D0') . ';'),
'hArr' => array( 'input'=>'hArr', 'tag'=>'mo', 'output'=>'&#' . hexdec('21D4') . ';'),
// Commands with argument
'sqrt' => array( 'input'=>'sqrt', 'tag'=>'msqrt', 'output'=>'sqrt', 'unary'=>TRUE ),
'root' => array( 'input'=>'root', 'tag'=>'mroot', 'output'=>'root', 'binary'=>TRUE ),
'frac' => array( 'input'=>'frac', 'tag'=>'mfrac', 'output'=>'/', 'binary'=>TRUE),
'/' => array( 'input'=>'/', 'tag'=>'mfrac', 'output'=>'/', 'infix'=>TRUE),
'_' => array( 'input'=>'_', 'tag'=>'msub', 'output'=>'_', 'infix'=>TRUE),
'^' => array( 'input'=>'^', 'tag'=>'msup', 'output'=>'^', 'infix'=>TRUE),
'hat' => array( 'input'=>'hat', 'tag'=>'mover', 'output'=>'&#' . hexdec('005E') . ';', 'unary'=>TRUE, 'acc'=>TRUE),
'bar' => array( 'input'=>'bar', 'tag'=>'mover', 'output'=>'&#' . hexdec('00AF') . ';', 'unary'=>TRUE, 'acc'=>TRUE),
'vec' => array( 'input'=>'vec', 'tag'=>'mover', 'output'=>'&#' . hexdec('2192') . ';', 'unary'=>TRUE, 'acc'=>TRUE),
'dot' => array( 'input'=>'dot', 'tag'=>'mover', 'output'=>'.', 'unary'=>TRUE, 'acc'=>TRUE),
'ddot' => array( 'input'=>'ddot', 'tag'=>'mover', 'output'=>'..', 'unary'=>TRUE, 'acc'=>TRUE),
'ul' => array( 'input'=>'ul', 'tag'=>'munder', 'output'=>'&#' . hexdec('0332') . ';', 'unary'=>TRUE, 'acc'=>TRUE),
'avec' => array( 'input'=>'avec', 'tag'=>'munder', 'output'=>'~', 'unary'=>TRUE, 'acc'=>TRUE),
'text' => array( 'input'=>'text', 'tag'=>'mtext', 'output'=>'text', 'unary'=>TRUE),
'mbox' => array( 'input'=>'mbox', 'tag'=>'mtext', 'output'=>'mbox', 'unary'=>TRUE),
'"' => array( 'input'=>'"', 'tag'=>'mtext','output'=>'mbox', 'unary'=>TRUE),
/* 2005-06-05 wes: added stackrel */
'stackrel' => array( 'input'=>'stackrel', 'tag'=>'mover', 'output'=>'stackrel', 'binary'=>TRUE),
// Grouping brackets
'(' => array( 'input'=>'(', 'tag'=>'mo', 'output'=>'(', 'left_bracket'=>TRUE),
')' => array( 'input'=>')', 'tag'=>'mo', 'output'=>')', 'right_bracket'=>TRUE),
'[' => array( 'input'=>'[', 'tag'=>'mo', 'output'=>'[', 'left_bracket'=>TRUE),
']' => array( 'input'=>']', 'tag'=>'mo', 'output'=>']', 'right_bracket'=>TRUE),
'{' => array( 'input'=>'{', 'tag'=>'mo', 'output'=>'{', 'left_bracket'=>TRUE),
'}' => array( 'input'=>'}', 'tag'=>'mo', 'output'=>'}', 'right_bracket'=>TRUE),
'(:' => array( 'input'=>'(:', 'tag'=>'mo', 'output'=>'&#' . hexdec('2329') . ';', 'left_bracket'=>TRUE),
':)' => array( 'input'=>':)', 'tag'=>'mo', 'output'=>'&#' . hexdec('232A') . ';', 'right_bracket'=>TRUE),
'{:' => array( 'input'=>'{:', 'tag'=>'mo', 'output'=>'{:', 'left_bracket'=>TRUE, 'invisible'=>TRUE),
':}' => array( 'input'=>':}', 'tag'=>'mo', 'output'=>':}', 'right_bracket'=>TRUE ,'invisible'=>TRUE),
'<<' => array( 'input'=>'<<', 'tag'=>'mo', 'output'=>'&#' . hexdec('2329') . ';', 'left_bracket'=>TRUE), // 2005-06-07 wes
'>>' => array( 'input'=>'>>', 'tag'=>'mo', 'output'=>'&#' . hexdec('232A') . ';', 'right_bracket'=>TRUE) // 2005-06-07 wes
);
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,86 +0,0 @@
/* March 19, 2004 MathHTML (c) Peter Jipsen http://www.chapman.edu/~jipsen
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
(at http://www.gnu.org/copyleft/gpl.html) for more details.*/
function convertMath(node) {// for Gecko
if (node.nodeType==1) {
var newnode =
document.createElementNS("http://www.w3.org/1998/Math/MathML",
node.nodeName.toLowerCase());
for(var i=0; i < node.attributes.length; i++) {
if (node.attributes[i].nodeName == 'displaystyle') {
newnode.setAttribute(node.attributes[i].nodeName,node.attributes[i].nodeValue);
}
}
for (var i=0; i<node.childNodes.length; i++) {
var st = node.childNodes[i].nodeValue;
if (st==null || st.slice(0,1)!=" " && st.slice(0,1)!="\n")
newnode.appendChild(convertMath(node.childNodes[i]));
}
return newnode;
}
else return node;
}
function convert() {
if (document.createElementNS) {
var mmlnode = document.getElementsByTagName("span");
for (var i=0; i<mmlnode.length; i++) {
var tmp_node = mmlnode[i];
if (tmp_node.className == 'asciimath') {
tmp_node.replaceChild(convertMath(tmp_node.firstChild),tmp_node.firstChild);
/*
for (var j=0;j<tmp_node.childNodes.length;j++) {
if (tmp_node.childNodes[j].nodeType != 3) {
}
}
*/
}
}
} else {
var st,node,newnode;
var mmlnode = document.getElementsByTagName("math");
for (var i=0; i<mmlnode.length; i++) {
var str = "";
node = mmlnode[i];
while (node.nodeName!="/MATH" && node.nextSibling) {
st = node.nodeName.toLowerCase();
if (st=="#text") {
str += node.nodeValue;
} else {
str += (st.slice(0,1)=="/" ? "</m:"+st.slice(1) : "<m:"+st);
if (st.slice(0,1)!="/") {
for(var j=0; j < node.attributes.length; j++) {
if (node.attributes[j].nodeValue!="italic" &&
node.attributes[j].nodeValue!="" &&
node.attributes[j].nodeValue!="inherit" &&
node.attributes[j].nodeValue!=undefined) {
str += " "+node.attributes[j].nodeName+"="+
"\""+node.attributes[j].nodeValue+"\"";
}
}
}
str += ">";
}
node = node.nextSibling;
node.parentNode.removeChild(node.previousSibling);
}
if (str != '') {
str += "</m:math>";
newnode = document.createElement("span");
node.parentNode.replaceChild(newnode,node);
newnode.innerHTML = str;
}
}
}
}

View File

@@ -1 +0,0 @@
* -crlf

View File

@@ -1,26 +0,0 @@
Revision history for Perl extension HTML::Toc.
2001-09-03 Freddy Vulto <fvu@fvu.myweb.nl>
Release 0.91
- Tested on Cygwin.
- Used Unix file type for source files.
- Updated documentation.
- Prohibited call with undefined parameter to HTML::Parser->parse() from
HTML::_tokenTocEndParser->parse() which caused havoc with version 3.25
of HTML::Parser.
- Specified 'HTML::Parser' as module that needs to be available in order
to use HTML::Toc.
- Added protected method HTML::TocGenerator::_setActiveAnchorName().
This method replaces the incongruous access of
'HTML::TocUpdator::_doDeleteTokens' by HTML::TocGenerator.
HTML::TocUpdator now overrides '_setActiveAnchorName()' to allow
the ancestor call to HTML::TocGenerator only when '_doDeleteTokens'
equals false.
2001-08-09 Freddy Vulto <fvu@fvu.myweb.nl>
Release 0.90
- First release.

View File

@@ -1,26 +0,0 @@
Changes
Toc.pod
Toc.pm
TocGenerator.pm
TocInsertor.pm
TocUpdator.pm
Makefile.PL
MANIFEST
t/extend.t
t/format.t
t/generate.t
t/insert.t
t/manualTest.t
t/options.t
t/podExamples.t
t/propagate.t
t/siteMap.t
t/update.t
t/ManualTest/manualTest1.htm
t/SiteMap/index.htm
t/SiteMap/SubDir1/index.htm
t/SiteMap/SubDir1/SubSubDir1/index.htm
t/SiteMap/SubDir2/index.htm
t/SiteMap/SubDir2/SubSubDir1/index.htm
t/SiteMap/SubDir2/SubSubDir2/index.htm
t/SiteMap/SubDir3/index.htm

View File

@@ -1,8 +0,0 @@
use ExtUtils::MakeMaker;
WriteMakefile(
'NAME' => 'HTML::Toc',
'VERSION_FROM' => 'Toc.pm',
'PREREQ_PM' => {'HTML::Parser' => 0},
'MAN3PODS' => {},
);

View File

@@ -1,549 +0,0 @@
#=== HTML::Toc ================================================================
# function: HTML Table of Contents
package HTML::Toc;
use strict;
BEGIN {
use vars qw($VERSION);
$VERSION = '0.91';
}
use constant FILE_FILTER => '.*';
use constant GROUP_ID_H => 'h';
use constant LEVEL_1 => 1;
use constant NUMBERING_STYLE_DECIMAL => 'decimal';
# Templates
# Anchor templates
use constant TEMPLATE_ANCHOR_NAME => '$groupId."-".$node';
use constant TEMPLATE_ANCHOR_HREF_BEGIN =>
'"<a href=#$anchorName>"';
use constant TEMPLATE_ANCHOR_HREF_BEGIN_FILE =>
'"<a href=$file#$anchorName>"';
use constant TEMPLATE_ANCHOR_HREF_END => '"</a>"';
use constant TEMPLATE_ANCHOR_NAME_BEGIN =>
'"<a name=$anchorName>"';
use constant TEMPLATE_ANCHOR_NAME_END => '"</a>"';
use constant TOKEN_UPDATE_BEGIN_OF_ANCHOR_NAME_BEGIN =>
'<!-- #BeginTocAnchorNameBegin -->';
use constant TOKEN_UPDATE_END_OF_ANCHOR_NAME_BEGIN =>
'<!-- #EndTocAnchorNameBegin -->';
use constant TOKEN_UPDATE_BEGIN_OF_ANCHOR_NAME_END =>
'<!-- #BeginTocAnchorNameEnd -->';
use constant TOKEN_UPDATE_END_OF_ANCHOR_NAME_END =>
'<!-- #EndTocAnchorNameEnd -->';
use constant TOKEN_UPDATE_BEGIN_NUMBER =>
'<!-- #BeginTocNumber -->';
use constant TOKEN_UPDATE_END_NUMBER =>
'<!-- #EndTocNumber -->';
use constant TOKEN_UPDATE_BEGIN_TOC =>
'<!-- #BeginToc -->';
use constant TOKEN_UPDATE_END_TOC =>
'<!-- #EndToc -->';
use constant TEMPLATE_TOKEN_NUMBER => '"$node &nbsp;"';
# Level templates
use constant TEMPLATE_LEVEL => '"<li>$text\n"';
use constant TEMPLATE_LEVEL_BEGIN => '"<ul>\n"';
use constant TEMPLATE_LEVEL_END => '"</ul>\n"';
END {}
#--- HTML::Toc::new() ---------------------------------------------------------
# function: Constructor
sub new {
# Get arguments
my ($aType) = @_;
# Local variables
my $self;
$self = bless({}, $aType);
# Default to empty 'options' array
$self->{options} = {};
# Empty toc
$self->{_toc} = "";
# Hash reference to array for each groupId, each array element
# referring to the group of the level indicated by the array index.
# For example, with the default 'tokenGroups', '_levelGroups' would
# look like:
#
# {'h'} => [\$group1, \$group2, \$group3, \$group4, \$group5, \$group6];
#
$self->{_levelGroups} = undef;
# Set default options
$self->_setDefaults();
return $self;
} # new()
#--- HTML::Toc::_compareLevels() ----------------------------------------------
# function: Compare levels.
# args: - $aLevel: pointer to level
# - $aGroupLevel
# - $aPreviousLevel
# - $aPreviousGroupLevel
# returns: 0 if new level equals previous level, 1 if new level exceeds
# previous level, -1 if new level is smaller then previous level.
sub _compareLevels {
# Get arguments
my (
$self, $aLevel, $aPreviousLevel, $aGroupLevel, $aPreviousGroupLevel
) = @_;
# Local variables
my ($result);
# Levels equals?
if (
($aLevel == $aPreviousLevel) &&
($aGroupLevel == $aPreviousGroupLevel)
) {
# Yes, levels are equals;
# Indicate so
$result = 0;
}
else {
# No, levels differ;
# Bias to new level being smaller than previous level;
$result = -1;
# Must groups not be nested and do group levels differ?
if (
($self->{options}{'doNestGroup'} == 0) &&
($aGroupLevel != $aPreviousGroupLevel)
) {
# Yes, groups must be kept apart and the group levels differ;
# Level is greater than previous level?
if (
($aLevel > $aPreviousLevel)
) {
# Yes, level is greater than previous level;
# Indicate so
$result = 1;
}
}
else {
# No, group must be nested;
# Level is greater than previous level?
if (
($aLevel > $aPreviousLevel) ||
($aGroupLevel > $aPreviousGroupLevel)
) {
# Yes, level is greater than previous level;
# Indicate so
$result = 1;
}
}
}
# Return value
return $result;
} # _compareLevels()
#--- HTML::TocGenerator::_formatLevelIndent() ---------------------------------
# function: Format indent.
# args: - $aText: text to indent
# - $aLevel: Level.
# - $aGroupLevel: Group level.
# - $aAdd
# - $aGlobalLevel
sub _formatLevelIndent {
# Get arguments
my ($self, $aText, $aAdd, $aGlobalLevel) = @_;
# Local variables
my ($levelIndent, $indent, $nrOfIndents);
# Alias indentation option
$levelIndent = $self->{options}{'levelIndent'}; #=~ s/[0-9]+/&/;
# Calculate number of indents
$nrOfIndents = ($aGlobalLevel + $aAdd) * $levelIndent;
# Assemble indents
$indent = pack("A$nrOfIndents");
# Return value
return $indent . $aText;
} # _formatLevelIndent()
#--- HTML::Toc::_formatToc() --------------------------------------------------
# function: Format ToC.
# args: - aPreviousLevel
# - aPreviousGroupLevel
# - aToc: ToC to format.
# - aHeaderLines
# note: Recursive function this is.
sub _formatToc {
# Get arguments
my (
$self, $aPreviousLevel, $aPreviousGroupLevel, $aToc, $aHeaderLines,
$aGlobalLevel
) = @_;
# Local variables
my ($level, $groupLevel, $line, $groupId, $text, $compareStatus);
my ($anchorName, $globalLevel, $node, $sequenceNr);
LOOP: {
# Lines need processing?
while (scalar(@$aHeaderLines) > 0) {
# Yes, lines need processing;
# Get line
$line = shift @$aHeaderLines;
# Determine levels
($level, $groupLevel, $groupId, $node, $sequenceNr,
$anchorName, $text) = split(
/ /, $line, 7
);
# Must level and group be processed?
if (
($level =~ m/$self->{options}{'levelToToc'}/) &&
($groupId =~ m/$self->{options}{'groupToToc'}/)
) {
# Yes, level must be processed;
# Compare levels
$compareStatus = $self->_compareLevels(
$level, $aPreviousLevel, $groupLevel, $aPreviousGroupLevel
);
COMPARE_LEVELS: {
# Equals?
if ($compareStatus == 0) {
# Yes, levels are equal;
# Format level
$$aToc .= $self->_formatLevelIndent(
ref($self->{_templateLevel}) eq "CODE" ?
&{$self->{_templateLevel}}(
$level, $groupId, $node, $sequenceNr, $text
) :
eval($self->{_templateLevel}),
0, $aGlobalLevel
);
}
# Greater?
if ($compareStatus > 0) {
# Yes, new level is greater than previous level;
# Must level be single-stepped?
if (
$self->{options}{'doSingleStepLevel'} &&
($aPreviousLevel) &&
($level > $aPreviousLevel)
) {
# Yes, level must be single-stepped;
# Make sure, new level is increased one step only
$level = $aPreviousLevel + 1;
}
# Increase global level
$aGlobalLevel++;
# Format begin of level
$$aToc .= $self->_formatLevelIndent(
eval($self->{_templateLevelBegin}), -1, $aGlobalLevel
);
# Process line again
unshift @$aHeaderLines, $line;
# Assemble TOC (recursive) for next level
$self->_formatToc(
$level, $groupLevel, $aToc, $aHeaderLines, $aGlobalLevel
);
# Format end of level
$$aToc .= $self->_formatLevelIndent(
eval($self->{_templateLevelEnd}), -1, $aGlobalLevel
);
# Decrease global level
$aGlobalLevel--;
# Exit loop
last COMPARE_LEVELS;
}
# Smaller?
if ($compareStatus < 0) {
# Yes, new level is smaller than previous level;
# Process line again
unshift @$aHeaderLines, $line;
# End loop
last LOOP;
}
}
}
}
}
} # _formatToc()
#--- HTML::Toc::_parseTokenGroups() -------------------------------------------
# function: Parse token groups
sub _parseTokenGroups {
# Get arguments
my ($self) = @_;
# Local variables
my ($group, $levelGroups, $numberingStyle);
# Clear any previous 'levelGroups'
$self->{_levelGroups} = undef;
# Determine default 'numberingStyle'
$numberingStyle = defined($self->{options}{'numberingStyle'}) ?
$self->{options}{'numberingStyle'} : NUMBERING_STYLE_DECIMAL;
# Loop through groups
foreach $group (@{$self->{options}{'tokenToToc'}}) {
# 'groupId' is specified?
if (! defined($group->{'groupId'})) {
# No, 'groupId' isn't specified;
# Set default groupId
$group->{'groupId'} = GROUP_ID_H;
}
# 'level' is specified?
if (! defined($group->{'level'})) {
# No, 'level' isn't specified;
# Set default level
$group->{'level'} = LEVEL_1;
}
# 'numberingStyle' is specified?
if (! defined($group->{'numberingStyle'})) {
# No, 'numberingStyle' isn't specified;
# Set default numberingStyle
$group->{'numberingStyle'} = $numberingStyle;
}
# Add group to '_levelGroups' variabele
$self->{_levelGroups}{$group->{'groupId'}}[$group->{'level'} - 1] =
$group;
}
} # _parseTokenGroups()
#--- HTML::Toc::_setDefaults() ------------------------------------------------
# function: Set default options.
sub _setDefaults {
# Get arguments
my ($self) = @_;
# Set default options
$self->setOptions(
{
'attributeToExcludeToken' => '-',
'attributeToTocToken' => '@',
'insertionPoint' => 'after <body>',
'levelToToc' => '.*',
'groupToToc' => '.*',
'doNumberToken' => 0,
'doLinkToFile' => 0,
'doLinkToToken' => 1,
'doLinkToId' => 0,
'doSingleStepLevel' => 1,
'linkUri' => '',
'levelIndent' => 3,
'doNestGroup' => 0,
'doUseExistingAnchors' => 1,
'doUseExistingIds' => 1,
'tokenToToc' => [
{
'level' => 1,
'tokenBegin' => '<h1>'
}, {
'level' => 2,
'tokenBegin' => '<h2>'
}, {
'level' => 3,
'tokenBegin' => '<h3>'
}, {
'level' => 4,
'tokenBegin' => '<h4>'
}, {
'level' => 5,
'tokenBegin' => '<h5>'
}, {
'level' => 6,
'tokenBegin' => '<h6>'
}
],
'header' =>
"\n<!-- Table of Contents generated by Perl - HTML::Toc -->\n",
'footer' =>
"\n<!-- End of generated Table of Contents -->\n",
}
);
} # _setDefaults()
#--- HTML::Toc::clear() -------------------------------------------------------
# function: Clear ToC.
sub clear {
# Get arguments
my ($self) = @_;
# Clear ToC
$self->{_toc} = "";
$self->{toc} = "";
$self->{groupIdLevels} = undef;
$self->{levels} = undef;
} # clear()
#--- HTML::Toc::format() ------------------------------------------------------
# function: Format ToC.
# returns: Formatted ToC.
sub format {
# Get arguments
my ($self) = @_;
# Local variables;
my $toc = "";
my @tocLines = split(/\r\n|\n/, $self->{_toc});
# Format table of contents
$self->_formatToc("0", "0", \$toc, \@tocLines, 0);
# Remove last newline
$toc =~ s/\n$//m;
# Add header & footer
$toc = $self->{options}{'header'} . $toc . $self->{options}{'footer'};
# Return value
return $toc;
} # format()
#--- HTML::Toc::parseOptions() ------------------------------------------------
# function: Parse options.
sub parseOptions {
# Get arguments
my ($self) = @_;
# Alias options
my $options = $self->{options};
# Parse token groups
$self->_parseTokenGroups();
# Link ToC to tokens?
if ($self->{options}{'doLinkToToken'}) {
# Yes, link ToC to tokens;
# Determine anchor href template begin
$self->{_templateAnchorHrefBegin} =
defined($options->{'templateAnchorHrefBegin'}) ?
$options->{'templateAnchorHrefBegin'} :
$options->{'doLinkToFile'} ?
TEMPLATE_ANCHOR_HREF_BEGIN_FILE : TEMPLATE_ANCHOR_HREF_BEGIN;
# Determine anchor href template end
$self->{_templateAnchorHrefEnd} =
defined($options->{'templateAnchorHrefEnd'}) ?
$options->{'templateAnchorHrefEnd'} :
TEMPLATE_ANCHOR_HREF_END;
# Determine anchor name template
$self->{_templateAnchorName} =
defined($options->{'templateAnchorName'}) ?
$options->{'templateAnchorName'} :
TEMPLATE_ANCHOR_NAME;
# Determine anchor name template begin
$self->{_templateAnchorNameBegin} =
defined($options->{'templateAnchorNameBegin'}) ?
$options->{'templateAnchorNameBegin'} :
TEMPLATE_ANCHOR_NAME_BEGIN;
# Determine anchor name template end
$self->{_templateAnchorNameEnd} =
defined($options->{'templateAnchorNameEnd'}) ?
$options->{'templateAnchorNameEnd'} :
TEMPLATE_ANCHOR_NAME_END;
}
# Determine token number template
$self->{_templateTokenNumber} =
defined($options->{'templateTokenNumber'}) ?
$options->{'templateTokenNumber'} :
TEMPLATE_TOKEN_NUMBER;
# Determine level template
$self->{_templateLevel} =
defined($options->{'templateLevel'}) ?
$options->{'templateLevel'} :
TEMPLATE_LEVEL;
# Determine level begin template
$self->{_templateLevelBegin} =
defined($options->{'templateLevelBegin'}) ?
$options->{'templateLevelBegin'} :
TEMPLATE_LEVEL_BEGIN;
# Determine level end template
$self->{_templateLevelEnd} =
defined($options->{'templateLevelEnd'}) ?
$options->{'templateLevelEnd'} :
TEMPLATE_LEVEL_END;
# Determine 'anchor name begin' begin update token
$self->{_tokenUpdateBeginOfAnchorNameBegin} =
defined($options->{'tokenUpdateBeginOfAnchorNameBegin'}) ?
$options->{'tokenUpdateBeginOfAnchorNameBegin'} :
TOKEN_UPDATE_BEGIN_OF_ANCHOR_NAME_BEGIN;
# Determine 'anchor name begin' end update token
$self->{_tokenUpdateEndOfAnchorNameBegin} =
defined($options->{'tokenUpdateEndOfAnchorNameBegin'}) ?
$options->{'tokenUpdateEndOfAnchorNameBegin'} :
TOKEN_UPDATE_END_OF_ANCHOR_NAME_BEGIN;
# Determine 'anchor name end' begin update token
$self->{_tokenUpdateBeginOfAnchorNameEnd} =
defined($options->{'tokenUpdateBeginOfAnchorNameEnd'}) ?
$options->{'tokenUpdateBeginOfAnchorNameEnd'} :
TOKEN_UPDATE_BEGIN_OF_ANCHOR_NAME_END;
# Determine 'anchor name end' end update token
$self->{_tokenUpdateEndOfAnchorNameEnd} =
defined($options->{'tokenUpdateEndOfAnchorNameEnd'}) ?
$options->{'tokenUpdateEndOfAnchorNameEnd'} :
TOKEN_UPDATE_END_OF_ANCHOR_NAME_END;
# Determine number begin update token
$self->{_tokenUpdateBeginNumber} =
defined($options->{'tokenUpdateBeginNumber'}) ?
$options->{'tokenUpdateBeginNumber'} :
TOKEN_UPDATE_BEGIN_NUMBER;
# Determine number end update token
$self->{_tokenUpdateEndNumber} =
defined($options->{'tokenUpdateEndNumber'}) ?
$options->{'tokenUpdateEndNumber'} :
TOKEN_UPDATE_END_NUMBER;
# Determine toc begin update token
$self->{_tokenUpdateBeginToc} =
defined($options->{'tokenUpdateBeginToc'}) ?
$options->{'tokenUpdateBeginToc'} :
TOKEN_UPDATE_BEGIN_TOC;
# Determine toc end update token
$self->{_tokenUpdateEndToc} =
defined($options->{'tokenUpdateEndToc'}) ?
$options->{'tokenUpdateEndToc'} :
TOKEN_UPDATE_END_TOC;
} # parseOptions()
#--- HTML::Toc::setOptions() --------------------------------------------------
# function: Set options.
# args: - aOptions: Reference to hash containing options.
sub setOptions {
# Get arguments
my ($self, $aOptions) = @_;
# Add options
%{$self->{options}} = (%{$self->{options}}, %$aOptions);
} # setOptions()
1;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,693 +0,0 @@
#==== HTML::TocUpdator ========================================================
# function: Update 'HTML::Toc' table of contents.
# note: - 'TUT' is an abbreviation of 'Toc Update Token'.
package HTML::TocUpdator;
use strict;
use HTML::TocInsertor;
BEGIN {
use vars qw(@ISA $VERSION);
$VERSION = '0.91';
@ISA = qw(HTML::TocInsertor);
}
use constant TUT_TOKENTYPE_START => 0;
use constant TUT_TOKENTYPE_END => 1;
use constant TUT_TOKENTYPE_TEXT => 2;
use constant TUT_TOKENTYPE_COMMENT => 3;
use constant MODE_DO_NOTHING => 0; # 0b00
use constant MODE_DO_INSERT => 1; # 0b01
use constant MODE_DO_UPDATE => 3; # 0b11
END {}
#--- HTML::TocUpdator::new() --------------------------------------------------
# function: Constructor.
sub new {
# Get arguments
my ($aType) = @_;
my $self = $aType->SUPER::new;
# Bias to not update ToC
$self->{htu__Mode} = MODE_DO_NOTHING;
# Bias to not delete tokens
$self->{_doDeleteTokens} = 0;
# Reset batch variables
#$self->_resetBatchVariables;
$self->{options} = {};
# TODO: Initialize output
return $self;
} # new()
#--- HTML::TocUpdator::_deinitializeUpdatorBatch() --------------------------
# function: Deinitialize updator batch.
# args: - $aTocs: Reference to array of tocs.
sub _deinitializeUpdatorBatch {
# Get arguments
my ($self, $aTocs) = @_;
# Indicate end of ToC updating
$self->{htu__Mode} = MODE_DO_NOTHING;
# Deinitialize insertor batch
$self->_deinitializeInsertorBatch();
} # _deinitializeUpdatorBatch()
#--- HTML::TokenUpdator::_doesHashEqualHash() ---------------------------------
# function: Determines whether hash1 equals hash2.
# args: - $aHash1
# - $aHash2
# returns: True (1) if hash1 equals hash2, 0 if not. For example, with the
# following hashes:
#
# %hash1 = { %hash2 = {
# 'class' => 'header', 'class' => 'header',
# 'id' => 'intro1' 'id' => 'intro2'
# } }
#
# the routine will return 0, cause the hash fields 'id' differ.
# note: Class function.
sub _doesHashEqualHash {
# Get arguments
my ($aHash1, $aHash2) = @_;
# Local variables
my ($key1, $value1, $key2, $value2, $result);
# Bias to success
$result = 1;
# Loop through hash1 while values available
HASH1: while (($key1, $value1) = each %$aHash1) {
# Yes, values are available;
# Value1 differs from value2?
if ($value1 ne $aHash2->{$key1}) {
# Yes, hashes differ;
# Indicate condition fails
$result = 0;
# Reset 'each' iterator which we're going to break
keys %$aHash2;
# Break loop
last HASH1;
}
}
# Return value
return $result;
} # _doesHashEqualHash()
#--- HTML::TokenUpdator::_doesTagExistInArray() -------------------------------
# function: Check whether tag & attributes matches any of the tags & attributes
# in the specified array. The array must consist of elements with
# format:
#
# [$tag, \%attributes]
#
# args: - $aTag: tag to search for
# - $aAttributes: tag attributes to search for
# - $aArray: Array to search in.
# returns: 1 if tag does exist in array, 0 if not.
# note: Class function.
sub _doesTagExistInArray {
# Get arguments
my ($aTag, $aAttributes, $aArray) = @_;
# Local variables
my ($tag, $result);
# Bias to non-existing tag
$result = 0;
# Loop through existing tags
TAG: foreach $tag (@{$aArray}) {
if (defined(@{$tag}[0])) {
# Does tag equals any existing tag?
if ($aTag eq @{$tag}[0]) {
# Yes, tag equals existing tag;
# Do hashes equal?
if (HTML::TocUpdator::_doesHashEqualHash(
$aAttributes, @{$tag}[1]
)) {
# Yes, hashes are the same;
# Indicate tag exists in array
$result = 1;
# Break loop
last TAG;
}
}
}
}
# Return value
return $result;
} # _doesTagExistInArray()
#--- HTML::TocUpdator::_initializeUpdatorBatch() ----------------------------
# function: Initialize insertor batch.
# args: - $aMode: Mode. Can be either MODE_DO_INSERT or MODE_DO_UPDATE
# - $aTocs: Reference to array of tocs.
# - $aOptions: optional options
# note: Updating actually means: deleting the old ToC and inserting a new
# ToC. That's why we're calling 'insertor' methods here.
sub _initializeUpdatorBatch {
# Get arguments
my ($self, $aMode, $aTocs, $aOptions) = @_;
# Initialize insertor batch
$self->_initializeInsertorBatch($aTocs, $aOptions);
# Parse ToC update templates
$self->_parseTocUpdateTokens();
# Indicate start of ToC updating
$self->{htu__Mode} = $aMode;
} # _initializeUpdatorBatch()
#--- HTML::TocUpdator::_parseTocUpdateTokens() --------------------------------
# function: Parse ToC insertion point specifier.
sub _parseTocUpdateTokens {
# Get arguments
my ($self) = @_;
# Local variables
my ($toc, $tokenType, $tokenPreposition, $token);
my ($tocInsertionPoint, $tocInsertionPointTokenAttributes);
# Create parser for update begin tokens
my $tokenUpdateBeginParser = HTML::_TokenUpdateParser->new(
$self->{_tokensUpdateBegin}
);
# Create parser for update end tokens
my $tokenUpdateEndParser = HTML::_TokenUpdateParser->new(
$self->{_tokensUpdateEnd}
);
# Loop through ToCs
foreach $toc (@{$self->{_tocs}}) {
# Parse update tokens
$tokenUpdateBeginParser->parse(
$toc->{_tokenUpdateBeginOfAnchorNameBegin}
);
$tokenUpdateBeginParser->parse($toc->{_tokenUpdateBeginOfAnchorNameEnd});
$tokenUpdateBeginParser->parse($toc->{_tokenUpdateBeginNumber});
$tokenUpdateBeginParser->parse($toc->{_tokenUpdateBeginToc});
$tokenUpdateEndParser->parse($toc->{_tokenUpdateEndOfAnchorNameBegin});
$tokenUpdateEndParser->parse($toc->{_tokenUpdateEndOfAnchorNameEnd});
$tokenUpdateEndParser->parse($toc->{_tokenUpdateEndNumber});
$tokenUpdateEndParser->parse($toc->{_tokenUpdateEndToc});
}
} # _parseTocUpdateTokens()
#--- HTML::TocUpdator::_resetBatchVariables() ---------------------------------
# function: Reset batch variables
sub _resetBatchVariables {
# Get arguments
my ($self) = @_;
# Call ancestor
$self->SUPER::_resetBatchVariables();
# Arrays containing start, end, comment & text tokens which indicate
# the begin of ToC tokens. The tokens are stored in keys of hashes to
# avoid storing duplicates as an array would.
$self->{_tokensUpdateBegin} = [
[], # ['<start tag>', <attributes>]
{}, # {'<end tag>' => ''}
{}, # {'<text>' => ''}
{} # {'<comment>' => ''}
];
# Arrays containing start, end, comment & text tokens which indicate
# the end of ToC tokens. The tokens are stored in keys of hashes to
# avoid storing duplicates as an array would.
$self->{_tokensUpdateEnd} = [
[], # ['<start tag>', <attributes>]
{}, # {'<end tag>' => ''}
{}, # {'<text>' => ''}
{} # {'<comment>' => ''}
];
} # _resetBatchVariables()
#--- HTML::TocUpdator::_setActiveAnchorName() ---------------------------------
# function: Set active anchor name.
# args: - aAnchorName: Name of anchor name to set active.
sub _setActiveAnchorName {
# Get arguments
my ($self, $aAnchorName) = @_;
# Are tokens being deleted?
if (! $self->{_doDeleteTokens}) {
# No, tokens aren't being deleted;
# Call ancestor to set anchor name
$self->SUPER::_setActiveAnchorName($aAnchorName);
}
} # _setActiveAnchorName()
#--- HTML::TocUpdator::_update() ----------------------------------------------
# function: Update ToC in string.
# args: - $aMode: Mode. Can be either MODE_DO_UPDATE or MODE_DO_INSERT.
# - $aToc: (reference to array of) ToC object to update
# - $aString: string to update ToC of
# - $aOptions: optional updator options
# note: Used internally.
sub _update {
# Get arguments
my ($self, $aMode, $aToc, $aString, $aOptions) = @_;
# Initialize TocUpdator batch
$self->_initializeUpdatorBatch($aMode, $aToc, $aOptions);
# Start updating ToC by starting ToC insertion
$self->_insert($aString);
# Deinitialize TocUpdator batch
$self->_deinitializeUpdatorBatch();
} # update()
#--- HTML::TocUpdator::_updateFile() ------------------------------------------
# function: Update ToCs in file.
# args: - $aMode: Mode. Can be either MODE_DO_UPDATE or MODE_DO_INSERT.
# - $aToc: (reference to array of) ToC object to update
# - $aFile: (reference to array of) file to parse for updating.
# - $aOptions: optional updator options
# note: Used internally.
sub _updateFile {
# Get arguments
my ($self, $aMode, $aToc, $aFile, $aOptions) = @_;
# Initialize TocUpdator batch
$self->_initializeUpdatorBatch($aMode, $aToc, $aOptions);
# Start updating ToC by starting ToC insertion
$self->_insertIntoFile($aFile);
# Deinitialize TocUpdator batch
$self->_deinitializeUpdatorBatch();
} # _updateFile()
#--- HTML::TocUpdator::_writeOrBufferOutput() ---------------------------------
# function: Write processed HTML to output device(s).
# args: - aOutput: scalar to write
sub _writeOrBufferOutput {
# Get arguments
my ($self, $aOutput) = @_;
# Delete output?
if (! $self->{_doDeleteTokens}) {
# No, don't delete output;
# Call ancestor
$self->SUPER::_writeOrBufferOutput($aOutput);
}
} # _writeOrBufferOutput()
#--- HTML::TocUpdator::anchorNameBegin() --------------------------------------
# function: Process 'anchor name begin' generated by HTML::Toc.
# args: - $aAnchorName: Anchor name begin tag to output.
# - $aToc: Reference to ToC to which anchorname belongs.
sub anchorNameBegin {
# Get arguments
my ($self, $aAnchorNameBegin, $aToc) = @_;
# Call ancestor
$self->SUPER::anchorNameBegin($aAnchorNameBegin);
# Must ToC be inserted or updated?
if ($self->{htu__Mode} != MODE_DO_NOTHING) {
# Yes, ToC must be inserted or updated;
# Surround anchor name with update tags
$self->{_outputPrefix} =
$aToc->{_tokenUpdateBeginOfAnchorNameBegin} .
$self->{_outputPrefix} .
$aToc->{_tokenUpdateEndOfAnchorNameBegin};
}
} # anchorNameBegin()
#--- HTML::TocUpdator::anchorNameEnd() ----------------------------------------
# function: Process 'anchor name end' generated by HTML::Toc.
# args: - $aAnchorNameEnd: Anchor name end tag to output.
# - $aToc: Reference to ToC to which anchorname belongs.
sub anchorNameEnd {
# Get arguments
my ($self, $aAnchorNameEnd, $aToc) = @_;
# Call ancestor
$self->SUPER::anchorNameEnd($aAnchorNameEnd);
# Must ToC be inserted or updated?
if ($self->{htu__Mode} != MODE_DO_NOTHING) {
# Yes, ToC must be inserted or updated;
# Surround anchor name with update tags
$self->{_outputSuffix} =
$aToc->{_tokenUpdateBeginOfAnchorNameEnd} .
$self->{_outputSuffix} .
$aToc->{_tokenUpdateEndOfAnchorNameEnd};
}
} # anchorNameEnd()
#--- HTML::TocUpdator::comment() ----------------------------------------------
# function: Process comment.
# args: - $aComment: comment text with '<!--' and '-->' tags stripped off.
sub comment {
# Get arguments
my ($self, $aComment) = @_;
# Must ToC be updated?
if ($self->{htu__Mode} == MODE_DO_UPDATE) {
# Yes, ToC must be updated;
# Updator is currently deleting tokens?
if ($self->{_doDeleteTokens}) {
# Yes, tokens must be deleted;
# Call ancestor
$self->SUPER::comment($aComment);
# Look for update end token
# Does comment matches update end token?
if (defined(
$self->{_tokensUpdateEnd}[TUT_TOKENTYPE_COMMENT]{$aComment}
)) {
# Yes, comment matches update end token;
# Indicate to stop deleting tokens
$self->{_doDeleteTokens} = 0;
}
}
else {
# No, tokens mustn't be deleted;
# Look for update begin token
# Does comment matches update begin token?
if (defined(
$self->{_tokensUpdateBegin}[TUT_TOKENTYPE_COMMENT]{$aComment}
)) {
# Yes, comment matches update begin token;
# Indicate to start deleting tokens
$self->{_doDeleteTokens} = 1;
}
# Call ancestor
$self->SUPER::comment($aComment);
}
}
else {
# No, ToC mustn't be updated;
# Call ancestor
$self->SUPER::comment($aComment);
}
} # comment()
#--- HTML::TocUpdator::end() --------------------------------------------------
# function: This function is called every time a closing tag is encountered.
# args: - $aTag: tag name (in lower case).
# - $aOrigText: tag name including brackets.
sub end {
# Get arguments
my ($self, $aTag, $aOrigText) = @_;
# Call ancestor
$self->SUPER::end($aTag, $aOrigText);
# Must ToC be updated?
if ($self->{htu__Mode} == MODE_DO_UPDATE) {
# Yes, ToC must be updated;
# Updator is currently deleting tokens?
if ($self->{_doDeleteTokens}) {
# Yes, tokens must be deleted;
# Does end tag matches update end token?
if (defined(
$self->{_tokensUpdateEnd}[TUT_TOKENTYPE_END]{$aTag}
)) {
# Yes, end tag matches update end token;
# Indicate to stop deleting tokens
$self->{_doDeleteTokens} = 0;
}
}
}
} # end()
#--- HTML::TocUpdator::insert() -----------------------------------------------
# function: Insert ToC in string.
# args: - $aToc: (reference to array of) ToC object to update
# - $aString: string to insert ToC in.
# - $aOptions: optional updator options
sub insert {
# Get arguments
my ($self, $aToc, $aString, $aOptions) = @_;
# Do start insert
$self->_update(MODE_DO_INSERT, $aToc, $aString, $aOptions);
} # insert()
#--- HTML::TocUpdator::insertIntoFile() --------------------------------------
# function: Insert ToC in file.
# args: - $aToc: (reference to array of) ToC object to update
# - $aFile: File to insert ToC in.
# - $aOptions: optional updator options
sub insertIntoFile {
# Get arguments
my ($self, $aToc, $aFile, $aOptions) = @_;
# Do start insert
$self->_updateFile(MODE_DO_INSERT, $aToc, $aFile, $aOptions);
} # insertIntoFile()
#--- HTML::TocUpdator::number() -----------------------------------------------
# function: Process heading number generated by HTML::Toc.
# args: - $aNumber
# - $aToc: Reference to ToC to which anchorname belongs.
sub number {
# Get arguments
my ($self, $aNumber, $aToc) = @_;
# Call ancestor
$self->SUPER::number($aNumber);
# Must ToC be inserted or updated?
if ($self->{htu__Mode} != MODE_DO_NOTHING) {
# Yes, ToC must be inserted or updated;
# Surround number with update tags
$self->{_outputSuffix} =
$aToc->{_tokenUpdateBeginNumber} .
$self->{_outputSuffix} .
$aToc->{_tokenUpdateEndNumber};
}
} # number()
#--- HTML::TocUpdator::start() ------------------------------------------------
# function: This function is called every time an opening tag is encountered.
# args: - $aTag: tag name (in lower case).
# - $aAttr: reference to hash containing all tag attributes (in lower
# case).
# - $aAttrSeq: reference to array containing all tag attributes (in
# lower case) in the original order
# - $aOrigText: the original HTML text
sub start {
# Get arguments
my ($self, $aTag, $aAttr, $aAttrSeq, $aOrigText) = @_;
# Must ToC be updated?
if ($self->{htu__Mode} == MODE_DO_UPDATE) {
# Yes, ToC must be updated;
# Does start tag matches token update begin tag?
if (HTML::TocUpdator::_doesTagExistInArray(
$aTag, $aAttr, $self->{_tokensUpdateBegin}[TUT_TOKENTYPE_START]
)) {
# Yes, start tag matches token update tag;
# Indicate to delete tokens
$self->{_doDeleteTokens} = 1;
}
}
# Let ancestor process the start tag
$self->SUPER::start($aTag, $aAttr, $aAttrSeq, $aOrigText);
} # start()
#--- HTML::TocUpdator::toc() --------------------------------------------------
# function: Toc processing method. Add toc reference to scenario.
# args: - $aScenario: Scenario to add ToC reference to.
# - $aToc: Reference to ToC to insert.
# note: The ToC hasn't been build yet; only a reference to the ToC to be
# build is inserted.
sub toc {
# Get arguments
my ($self, $aScenario, $aToc) = @_;
# Surround toc with update tokens
# Add update begin token
push(@$aScenario, \$aToc->{_tokenUpdateBeginToc});
# Call ancestor
$self->SUPER::toc($aScenario, $aToc);
# Add update end token
push(@$aScenario, \$aToc->{_tokenUpdateEndToc});
} # toc()
#--- HTML::TocUpdator::_processTocText() --------------------------------------
# function: Toc text processing function.
# args: - $aText: Text to add to ToC.
# - $aToc: ToC to add text to.
sub _processTocText {
# Get arguments
my ($self, $aText, $aToc) = @_;
# Delete output?
if (! $self->{_doDeleteTokens}) {
# No, don't delete output;
# Call ancestor
$self->SUPER::_processTocText($aText, $aToc);
}
} # _processTocText()
#--- HTML::TocUpdator::update() -----------------------------------------------
# function: Update ToC in string.
# args: - $aToc: (reference to array of) ToC object to update
# - $aString: string to update ToC of
# - $aOptions: optional updator options
sub update {
# Get arguments
my ($self, $aToc, $aString, $aOptions) = @_;
# Do start update
$self->_update(MODE_DO_UPDATE, $aToc, $aString, $aOptions);
} # update()
#--- HTML::TocUpdator::updateFile() -------------------------------------------
# function: Update ToC of file.
# args: - $aToc: (reference to array of) ToC object to update
# - $aFile: (reference to array of) file to parse for updating.
# - $aOptions: optional updator options
sub updateFile {
# Get arguments
my ($self, $aToc, $aFile, $aOptions) = @_;
# Do start update
$self->_updateFile(MODE_DO_UPDATE, $aToc, $aFile, $aOptions);
} # update()
#=== HTML::_TokenUpdateParser =================================================
# function: Parse 'update tokens'. 'Update tokens' mark HTML code which is
# inserted by 'HTML::TocInsertor'.
# note: Used internally.
package HTML::_TokenUpdateParser;
BEGIN {
use vars qw(@ISA);
@ISA = qw(HTML::Parser);
}
END {}
#--- HTML::_TokenUpdateParser::new() ------------------------------------------
# function: Constructor
sub new {
# Get arguments
my ($aType, $aTokenArray) = @_;
# Create instance
my $self = $aType->SUPER::new;
# Reference token array
$self->{tokens} = $aTokenArray;
# Return instance
return $self;
} # new()
#--- HTML::_TokenUpdateParser::comment() --------------------------------------
# function: Process comment.
# args: - $aComment: comment text with '<!--' and '-->' tags stripped off.
sub comment {
# Get arguments
my ($self, $aComment) = @_;
# Add token to array of update tokens
$self->{tokens}[HTML::TocUpdator::TUT_TOKENTYPE_COMMENT]{$aComment} = '';
} # comment()
#--- HTML::_TokenUpdateParser::end() ------------------------------------------
# function: This function is called every time a closing tag is encountered
# by HTML::Parser.
# args: - $aTag: tag name (in lower case).
sub end {
# Get arguments
my ($self, $aTag, $aOrigText) = @_;
# Add token to array of update tokens
$self->{tokens}[HTML::TocUpdator::TUT_TOKENTYPE_END]{$aTag} = '';
} # end()
#--- HTML::_TokenUpdateParser::parse() ----------------------------------------
# function: Parse token.
# args: - $aToken: 'update token' to parse
sub parse {
# Get arguments
my ($self, $aString) = @_;
# Call ancestor
$self->SUPER::parse($aString);
} # parse()
#--- HTML::_TokenUpdateParser::start() ----------------------------------------
# function: This function is called every time an opening tag is encountered.
# args: - $aTag: tag name (in lower case).
# - $aAttr: reference to hash containing all tag attributes (in lower
# case).
# - $aAttrSeq: reference to array containing all tag attributes (in
# lower case) in the original order
# - $aOrigText: the original HTML text
sub start {
# Get arguments
my ($self, $aTag, $aAttr, $aAttrSeq, $aOrigText) = @_;
# Does token exist in array?
if (! HTML::TocUpdator::_doesTagExistInArray(
$aTag, $aAttr, $self->{tokens}[HTML::TocUpdator::TUT_TOKENTYPE_START]
)) {
# No, token doesn't exist in array;
# Add token to array of update tokens
push(
@{$self->{tokens}[HTML::TocUpdator::TUT_TOKENTYPE_START]},
[$aTag, $aAttr]
);
}
} # start()
#--- HTML::_TokenUpdateParser::text() -----------------------------------------
# function: This function is called every time plain text is encountered.
# args: - @_: array containing data.
sub text {
# Get arguments
my ($self, $aText) = @_;
# Add token to array of update tokens
$self->{tokens}[HTML::TocUpdator::TUT_TOKENTYPE_TEXT]{$aText} = '';
} # text()
1;

View File

@@ -1,92 +0,0 @@
<html>
<head>
<title>Manual</title>
<style type="text/css">
ul.toc_appendix1 {
list-style-type: none;
margin-left: 0;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h2 {
list-style-type: none;
}
ul.toc_h3 {
list-style-type: none;
}
ul.toc_part1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_prelude1 {
list-style: none;
}
p.captionFigure {
font-style: italic;
font-weight: bold;
}
p.captionTable {
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<h1 class=prelude>Preface</h1>
Better C than never.
<h1 class=hidden>Table of Contents</h1>
<!-- Table of Contents -->
<h1 class=prelude>Table of Figures</h1>
<!-- Table of Figures -->
<h1 class=prelude>Table of Tables</h1>
<!-- Table of Tables -->
<h1 class=prelude>Introduction</h1>
Thanks to standardisation and the excellent work of the QWERTY corporation it is possible to learn C with almost any C manual.
<p class=captionTable>Compile Steps</p>
<ul><pre>
Parser
Compiler
Linker
</pre></ul>
<h1 class=part>Disks</h1>
<h1>Compiler Disk v1</h1>
<img src=img.gif alt="Contents Compiler Disk v1">
<p class=captionFigure>Contents Compiler Disk v1</p>
<h2>System</h2>
<h2>Standard Library</h2>
<h1>Compiler Disk v2</h1>
<img src=img.gif alt="Contents Compiler Disk v2">
<p class=captionFigure>Contents Compiler Disk v2</p>
<h2>System</h2>
<h3>parser.com</h3>
<h3>compiler.com</h3>
<h3>linker.com</h3>
<h2>Standard Library</h2>
<h1>Library System Disk</h1>
<h1 class=part>Personal</h1>
<h1>Tips & Tricks</h1>
<h1 class=part>Appendixes</h1>
<h1 class=appendix>Functions Standard Library v1</h1>
<h1 class=appendix>Functions Standard Library v2</h1>
<h1 class=appendix>Functions Graphic Library</h1>
<h1 class=prelude>Bibliography</h1>
</body>
</html>

View File

@@ -1,5 +0,0 @@
<html>
<head>
<title>SubSub1</title>
</head>
</html>

View File

@@ -1,5 +0,0 @@
<html>
<head>
<title>Sub1</title>
</head>
</html>

View File

@@ -1,5 +0,0 @@
<html>
<head>
<title>SubSub1</title>
</head>
</html>

View File

@@ -1,5 +0,0 @@
<html>
<head>
<title>SubSub2</title>
</head>
</html>

View File

@@ -1,5 +0,0 @@
<html>
<head>
<title>Sub2</title>
</head>
</html>

View File

@@ -1,5 +0,0 @@
<html>
<head>
<title>Sub3</title>
</head>
</html>

View File

@@ -1,5 +0,0 @@
<html>
<head>
<title>Main</title>
</head>
</html>

View File

@@ -1,87 +0,0 @@
#--- generate.t ---------------------------------------------------------------
# function: Test ToC generation.
use strict;
use Test;
BEGIN { plan tests => 4; }
use HTML::Toc;
use HTML::TocGenerator;
my ($filename);
my $toc = HTML::Toc->new;
my $tocGenerator = HTML::TocGenerator->new;
$toc->setOptions({
'doLinkToToken' => 0,
'levelIndent' => 0,
'header' => '',
'footer' => '',
});
BEGIN {
# Create test file
$filename = "file$$.htm";
die "$filename is already there" if -e $filename;
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT';
<h1>Header</h1>
EOT
close(FILE);
}
END {
# Remove test file
unlink($filename) or warn "Can't unlink $filename: $!";
}
#--- 1. extend ----------------------------------------------------------------
# Generate ToC
$tocGenerator->generate($toc, "<h1>Header</h1>");
# Extend ToC
$tocGenerator->extend($toc, "<h1>Header</h1>");
# Test ToC
ok($toc->format(), "<ul>\n<li>Header\n<li>Header\n</ul>");
#--- 2. extendFromFile --------------------------------------------------------
# Generate ToC
$tocGenerator->generateFromFile($toc, $filename);
# Extend ToC
$tocGenerator->extendFromFile($toc, $filename);
# Test ToC
ok($toc->format(), "<ul>\n<li>Header\n<li>Header\n</ul>");
#--- 3. extendFromFiles -------------------------------------------------------
# Generate ToC
$tocGenerator->generateFromFile($toc, $filename);
# Extend ToC
$tocGenerator->extendFromFile($toc, [$filename, $filename]);
# Test ToC
ok($toc->format(), "<ul>\n<li>Header\n<li>Header\n<li>Header\n</ul>");
#--- 4. linkTocToToken --------------------------------------------------------
$toc->setOptions({
'doLinkToToken' => 1,
});
# Generate ToC
$tocGenerator->generate($toc, "<h1>Header</h1>");
# Extend ToC
$tocGenerator->extend($toc, "<h1>Header</h1>");
# Test ToC
ok($toc->format() . "\n", <<'EOT');
<ul>
<li><a href=#h-1>Header</a>
<li><a href=#h-2>Header</a>
</ul>
EOT

View File

@@ -1,157 +0,0 @@
#--- format.t -----------------------------------------------------------------
# function: Test ToC formatting.
use strict;
use Test;
BEGIN { plan tests => 6; }
use HTML::Toc;
use HTML::TocGenerator;
use HTML::TocInsertor;
my ($output, $content, $filename);
my $toc = HTML::Toc->new;
my $tocGenerator = HTML::TocGenerator->new;
my $tocInsertor = HTML::TocInsertor->new;
$toc->setOptions({
'doLinkToToken' => 0,
'levelIndent' => 0,
'insertionPoint' => 'before <h1>',
'header' => '',
'footer' => '',
});
BEGIN {
# Create test file
$filename = "file$$.htm";
die "$filename is already there" if -e $filename;
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<h1>Header</h1>
EOT
}
END {
# Remove test file
unlink($filename) or warn "Can't unlink $filename: $!";
}
#--- 1. templateLevelBegin ----------------------------------------------------
$toc->setOptions({
'templateLevelBegin' => '"<ul class=toc_$groupId$level>\n"'
});
$tocInsertor->insert($toc, "<h1>Header</h1>", {'output' => \$output});
ok($output, "<ul class=toc_h1>\n<li>Header\n</ul><h1>Header</h1>");
$toc->setOptions({'templateLevelBegin' => undef});
#--- 2. levelToToc -----------------------------------------------------------
$tocGenerator->generate($toc, "<h1>Header1</h1>\n<h2>Header2</h2>");
$toc->setOptions({'levelToToc' => '1'});
ok($toc->format(), "<ul>\n<li>Header1\n</ul>");
$toc->setOptions({'levelToToc' => '.*'});
#--- 3. groupToToc -----------------------------------------------------------
$toc->setOptions({
'tokenToToc' => [{
'level' => 1,
'tokenBegin' => '<h1 class=-foo>'
}, {
'groupId' => 'foo',
'level' => 1,
'tokenBegin' => '<h1 class=foo>'
}]
});
$tocGenerator->generate($toc, "<h1>Header1</h1>\n<h1 class=foo>Foo</h1>");
$toc->setOptions({'groupToToc' => 'foo'});
ok($toc->format(), "<ul>\n<li>Foo\n</ul>");
$toc->setOptions({'groupToToc' => '.*'});
#--- 4. header & footer -------------------------------------------------------
$toc->setOptions({
'tokenToToc' => [{
'level' => 1,
'tokenBegin' => '<h1>'
}],
'header' => '<!-- TocHeader -->',
'footer' => '<!-- TocFooter -->',
});
$tocInsertor->insert($toc, "<h1>Header1</h1>", {'output' => \$output});
ok("$output\n", <<EOT);
<!-- TocHeader --><ul>
<li>Header1
</ul><!-- TocFooter --><h1>Header1</h1>
EOT
# Test 'doSingleStepLevel' => 1
TestSingleStepLevel1();
# Test 'doSingleStepLevel' => 0
TestSingleStepLevel0();
#--- 5. TestSingleStepLevel1 --------------------------------------------------
sub TestSingleStepLevel1 {
my $toc = new HTML::Toc;
my $tocGenerator = new HTML::TocGenerator;
# Generate ToC
$tocGenerator->generate($toc, <<EOT);
<h1>Header 1</h1>
<h3>Header 3</h3>
EOT
# Compare output
ok($toc->format(), <<EOT);
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1>Header 1</a>
<ul>
<ul>
<li><a href=#h-1.0.1>Header 3</a>
</ul>
</ul>
</ul>
<!-- End of generated Table of Contents -->
EOT
} # TestSingleStepLevel1()
#--- 6. TestSingleStepLevel0 --------------------------------------------------
sub TestSingleStepLevel0 {
my $toc = new HTML::Toc;
my $tocGenerator = new HTML::TocGenerator;
# Set ToC options
$toc->setOptions({'doSingleStepLevel' => 0});
# Generate ToC
$tocGenerator->generate($toc, <<EOT);
<h1>Header 1</h1>
<h3>Header 3</h3>
EOT
# Compare output
ok($toc->format(), <<EOT);
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1>Header 1</a>
<ul>
<li><a href=#h-1.0.1>Header 3</a>
</ul>
</ul>
<!-- End of generated Table of Contents -->
EOT
} # TestSingleStepLevel0()

View File

@@ -1,200 +0,0 @@
#--- generate.t ---------------------------------------------------------------
# function: Test ToC generation.
use strict;
use Test;
BEGIN { plan tests => 13; }
use HTML::Toc;
use HTML::TocGenerator;
my ($filename);
my $toc = HTML::Toc->new;
my $tocGenerator = HTML::TocGenerator->new;
$toc->setOptions({
'doLinkToToken' => 0,
'levelIndent' => 0,
'header' => '',
'footer' => '',
});
BEGIN {
# Create test file
$filename = "file$$.htm";
die "$filename is already there" if -e $filename;
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT';
<h1>Header</h1>
EOT
close(FILE);
}
END {
# Remove test file
unlink($filename) or warn "Can't unlink $filename: $!";
}
#--- 1. generate --------------------------------------------------------------
$tocGenerator->generate($toc, "<h1>Header</h1>");
ok($toc->format(), "<ul>\n<li>Header\n</ul>");
#--- 2. generateFromFile ------------------------------------------------------
$tocGenerator->generateFromFile($toc, $filename);
ok($toc->format(), "<ul>\n<li>Header\n</ul>");
#--- 3. generateFromFiles -----------------------------------------------------
$tocGenerator->generateFromFile($toc, [$filename, $filename]);
ok($toc->format(), "<ul>\n<li>Header\n<li>Header\n</ul>");
#--- 4. doLinkToToken -----------------------------------------------------
$toc->setOptions({'doLinkToToken' => 1});
$tocGenerator->generateFromFile($toc, $filename, {'globalGroups' => 1});
ok($toc->format(), "<ul>\n<li><a href=#h-1>Header</a>\n</ul>");
#--- 5. doLinkToFile -------------------------------------------------------
$toc->setOptions({'doLinkToFile' => 1});
$tocGenerator->generateFromFile($toc, $filename);
ok($toc->format(), "<ul>\n<li><a href=$filename#h-1>Header</a>\n</ul>");
#--- 6. templateAnchorHrefBegin -----------------------------------------------
# Set options
$toc->setOptions({'templateAnchorHrefBegin' => '"test-$file"'});
# Generate ToC
$tocGenerator->generateFromFile($toc, $filename);
# Test ToC
ok($toc->format(), "<ul>\n<li>test-".$filename."Header</a>\n</ul>");
# Reset options
$toc->setOptions({'templateAnchorHrefBegin' => undef});
#--- 7. templateAnchorHrefBegin function --------------------------------------
sub AssembleAnchorHrefBegin {
# Get arguments
my ($aFile, $aGroupId, $aLevel, $aNode) = @_;
# Return value
return $aFile . $aGroupId . $aLevel . $aNode;
} # AssembleAnchorHrefBegin()
# Set options
$toc->setOptions({'templateAnchorHrefBegin' => \&AssembleAnchorHrefBegin});
# Generate ToC
$tocGenerator->generateFromFile($toc, $filename);
# Test ToC
ok($toc->format(), "<ul>\n<li>".$filename."h11Header</a>\n</ul>");
# Reset options
$toc->setOptions({'templateAnchorHrefBegin' => undef});
#--- 8. levelToToc no levels available ---------------------------------------
$toc->setOptions({'levelToToc' => '2'});
$tocGenerator->generate($toc, "<h1>Header</h1>");
ok($toc->format(), "");
#--- 9. levelToToc level 1 ---------------------------------------------------
# Set options
$toc->setOptions({
'levelToToc' => '1',
'doLinkToToken' => 0,
});
$tocGenerator->generate($toc, "<h1>Header1</h1>\n<h2>Header2</h2>");
ok($toc->format(), "<ul>\n<li>Header1\n</ul>");
#--- 10. levelToToc level 2 --------------------------------------------------
# Set options
$toc->setOptions({
'levelToToc' => '2',
'doLinkToToken' => 0,
});
$tocGenerator->generate($toc, "<h1>Header1</h1>\n<h2>Header2</h2>");
ok($toc->format(), "<ul>\n<li>Header2\n</ul>");
# Restore options
$toc->setOptions({
'levelToToc' => '.*',
});
#--- 11. tokenToToc empty array ----------------------------------------------
# Set options
$toc->setOptions({'tokenToToc' => []});
$tocGenerator->generate($toc, "<h1>Header</h1>");
ok($toc->format(), "");
#--- 12. groups nested --------------------------------------------------------
$toc->setOptions({
'doNestGroup' => 1,
'tokenToToc' => [
{
'level' => 1,
'tokenBegin' => '<h1 class=-appendix>'
}, {
'groupId' => 'appendix',
'level' => 1,
'tokenBegin' => '<h1 class=appendix>'
}
]
});
$tocGenerator->generate(
$toc, "<h1>Header1</h1>\n<h1 class=appendix>Appendix</h1>"
);
ok($toc->format() . "\n", <<'EOT');
<ul>
<li>Header1
<ul>
<li>Appendix
</ul>
</ul>
EOT
#--- 13. groups not nested ----------------------------------------------------
$toc->setOptions({
'doNestGroup' => 0,
'tokenToToc' => [
{
'level' => 1,
'tokenBegin' => '<h1 class=-appendix>'
}, {
'groupId' => 'appendix',
'level' => 1,
'tokenBegin' => '<h1 class=appendix>'
}
]
});
$tocGenerator->generate(
$toc, "<h1>Header1</h1>\n<h1 class=appendix>Appendix</h1>"
);
ok($toc->format() . "\n", <<'EOT');
<ul>
<li>Header1
</ul>
<ul>
<li>Appendix
</ul>
EOT

View File

@@ -1,336 +0,0 @@
#--- insert.t -----------------------------------------------------------------
# function: Test ToC insertion.
use strict;
use Test;
BEGIN { plan tests => 10; }
use HTML::Toc;
use HTML::TocGenerator;
use HTML::TocInsertor;
my ($output, $content, $filename);
my $toc = HTML::Toc->new;
my $tocGenerator = HTML::TocGenerator->new;
my $tocInsertor = HTML::TocInsertor->new;
$toc->setOptions({
'doLinkToToken' => 0,
'levelIndent' => 0,
'header' => "",
'footer' => "",
});
BEGIN {
# Create test file
$filename = "file$$.htm";
die "$filename is already there" if -e $filename;
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<h1>Header</h1>
EOT
}
END {
# Remove test file
unlink($filename) or warn "Can't unlink $filename: $!";
}
#--- 1. insert before start ---------------------------------------------------
$toc->setOptions({'insertionPoint' => 'before <h1>'});
# Generate ToC
$tocGenerator->generate($toc, "<h1>Header</h1>");
$tocInsertor->insert($toc, "<h1>Header</h1>", {
'output' => \$output,
'doGenerateToc' => 0
});
# Test ToC
ok($output, "<ul>\n<li>Header\n</ul><h1>Header</h1>");
#--- 2. insert after start ----------------------------------------------------
$toc->setOptions({'insertionPoint' => 'after <h1>'});
# Generate ToC
$tocGenerator->generate($toc, "<h1>Header</h1>");
$tocInsertor->insert($toc, "<h1>Header</h1>", {
'output' => \$output,
'doGenerateToc' => 0
});
# Test ToC
ok($output, "<h1><ul>\n<li>Header\n</ul>Header</h1>");
#--- 3. insert before end -----------------------------------------------------
$toc->setOptions({'insertionPoint' => 'before </h1>'});
# Generate ToC
$tocGenerator->generate($toc, "<h1>Header</h1>");
$tocInsertor->insert($toc, "<h1>Header</h1>", {
'output' => \$output,
'doGenerateToc' => 0
});
# Test ToC
ok($output, "<h1>Header<ul>\n<li>Header\n</ul></h1>");
#--- 4. insert after end ------------------------------------------------------
$toc->setOptions({'insertionPoint' => 'after </h1>'});
# Generate ToC
$tocGenerator->generate($toc, "<h1>Header</h1>");
$tocInsertor->insert($toc, "<h1>Header</h1>", {
'output' => \$output,
'doGenerateToc' => 0
});
# Test ToC
ok($output, "<h1>Header</h1><ul>\n<li>Header\n</ul>");
#--- 5. outputFile ------------------------------------------------------------
$toc->setOptions({'insertionPoint' => 'before <h1>'});
# Generate ToC
$tocGenerator->generate($toc, "<h1>Header</h1>");
# Insert ToC, output to file
$tocInsertor->insert($toc, "<h1>Header</h1>", {
'outputFile' => $filename,
'doGenerateToc' => 0
});
# Read outputfile
open(FILE, "<$filename") || die "Can't open $filename: $!";
$content = join('', <FILE>);
close(FILE);
# Test ToC
ok($output, "<ul>\n<li>Header\n</ul><h1>Header</h1>");
#--- 6. empty toc -------------------------------------------------------------
$tocGenerator->generate($toc, "");
$tocInsertor->insert($toc, "", {
'output' => \$output,
'doGenerateToc' => 0
});
ok($output, "");
#--- TestAfterDeclaration() ---------------------------------------------------
# function: Test putting HTML comment after declaration.
sub TestAfterDeclaration {
# Create objects
my $toc = HTML::Toc->new();
my $tocInsertor = HTML::TocInsertor->new();
my $output;
# Set ToC options
$toc->setOptions({
'insertionPoint' => "after <!ToC>",
});
# Generate ToC
$tocInsertor->insert($toc, <<EOT, {'output' => \$output});
<!ToC><body>
<h1>Appendix</h1>
<h2>Appendix Paragraph</h2>
<h1>Appendix</h1>
<h2>Appendix Paragraph</h2>
</body>
EOT
# Test ToC
ok($output, <<EOT);
<!ToC>
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1>Appendix</a>
<ul>
<li><a href=#h-1.1>Appendix Paragraph</a>
</ul>
<li><a href=#h-2>Appendix</a>
<ul>
<li><a href=#h-2.1>Appendix Paragraph</a>
</ul>
</ul>
<!-- End of generated Table of Contents -->
<body>
<a name=h-1><h1>Appendix</h1></a>
<a name=h-1.1><h2>Appendix Paragraph</h2></a>
<a name=h-2><h1>Appendix</h1></a>
<a name=h-2.1><h2>Appendix Paragraph</h2></a>
</body>
EOT
} # TestAfterDeclaration()
#--- TestNumberingStyle() -----------------------------------------------------
# function: Test numberingstyle.
sub TestNumberingStyle {
# Create objects
my $toc = HTML::Toc->new();
my $tocInsertor = HTML::TocInsertor->new();
my $output;
# Set ToC options
$toc->setOptions({
'numberingStyle' => 'lower-alpha',
'doNumberToken' => 1,
'tokenToToc' => [{
'tokenBegin' => '<h1>',
}, {
'tokenBegin' => '<h2>',
'level' => 2,
'numberingStyle' => 'upper-alpha'
}, {
'tokenBegin' => '<h3>',
'level' => 3,
'numberingStyle' => 'decimal'
}]
});
# Generate ToC
$tocInsertor->insert($toc, <<EOT, {'output' => \$output});
<body>
<h1>Chapter</h1>
<h2>Paragraph</h2>
<h3>Paragraph</h3>
<h3>Paragraph</h3>
<h3>Paragraph</h3>
</body>
EOT
# Test ToC
ok($output, <<EOT);
<body>
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-a>Chapter</a>
<ul>
<li><a href=#h-a.A>Paragraph</a>
<ul>
<li><a href=#h-a.A.1>Paragraph</a>
<li><a href=#h-a.A.2>Paragraph</a>
<li><a href=#h-a.A.3>Paragraph</a>
</ul>
</ul>
</ul>
<!-- End of generated Table of Contents -->
<a name=h-a><h1>a &nbsp;Chapter</h1></a>
<a name=h-a.A><h2>a.A &nbsp;Paragraph</h2></a>
<a name=h-a.A.1><h3>a.A.1 &nbsp;Paragraph</h3></a>
<a name=h-a.A.2><h3>a.A.2 &nbsp;Paragraph</h3></a>
<a name=h-a.A.3><h3>a.A.3 &nbsp;Paragraph</h3></a>
</body>
EOT
} # TestNumberingStyle()
#--- TestReplaceComment() -----------------------------------------------------
# function: Test replacing HTML comment with ToC.
sub TestReplaceComment {
# Create objects
my $toc = HTML::Toc->new();
my $tocInsertor = HTML::TocInsertor->new();
my $output;
# Set ToC options
$toc->setOptions({
'insertionPoint' => "replace <!-- ToC -->"
});
# Generate ToC
$tocInsertor->insert($toc, <<EOT, {'output' => \$output});
<!-- ToC -->
<body>
<h1>Appendix</h1>
<h2>Appendix Paragraph</h2>
<h1>Appendix</h1>
<h2>Appendix Paragraph</h2>
</body>
EOT
# Test ToC
ok($output, <<EOT);
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1>Appendix</a>
<ul>
<li><a href=#h-1.1>Appendix Paragraph</a>
</ul>
<li><a href=#h-2>Appendix</a>
<ul>
<li><a href=#h-2.1>Appendix Paragraph</a>
</ul>
</ul>
<!-- End of generated Table of Contents -->
<body>
<a name=h-1><h1>Appendix</h1></a>
<a name=h-1.1><h2>Appendix Paragraph</h2></a>
<a name=h-2><h1>Appendix</h1></a>
<a name=h-2.1><h2>Appendix Paragraph</h2></a>
</body>
EOT
} # TestReplaceComment()
#--- TestReplaceText() -----------------------------------------------------
# function: Test replacing HTML comment with ToC.
sub TestReplaceText {
# Create objects
my $toc = HTML::Toc->new();
my $tocInsertor = HTML::TocInsertor->new();
my $output;
# Set ToC options
$toc->setOptions({
'insertionPoint' => "replace ToC will be placed here[,]"
});
# Generate ToC
$tocInsertor->insert($toc, <<EOT, {'output' => \$output});
The ToC will be placed here, overnight.
<body>
<h1>Appendix</h1>
<h2>Appendix Paragraph</h2>
<h1>Appendix</h1>
<h2>Appendix Paragraph</h2>
</body>
EOT
# Test ToC
ok($output, <<EOT);
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1>Appendix</a>
<ul>
<li><a href=#h-1.1>Appendix Paragraph</a>
</ul>
<li><a href=#h-2>Appendix</a>
<ul>
<li><a href=#h-2.1>Appendix Paragraph</a>
</ul>
</ul>
<!-- End of generated Table of Contents -->
<body>
<a name=h-1><h1>Appendix</h1></a>
<a name=h-1.1><h2>Appendix Paragraph</h2></a>
<a name=h-2><h1>Appendix</h1></a>
<a name=h-2.1><h2>Appendix Paragraph</h2></a>
</body>
EOT
} # TestReplaceText()
# 7. Test 'numberingStyle'
TestNumberingStyle();
# 8. Test replace comment
TestReplaceComment();
# 9. Test after declaration
TestAfterDeclaration();
# 10. Test replace text
TestReplaceText();

View File

@@ -1,768 +0,0 @@
#--- manual.t -----------------------------------------------------------------
# function: Test HTML::ToC generating a manual.
use strict;
use Test;
BEGIN { plan tests => 3; }
use HTML::Toc;
use HTML::TocGenerator;
use HTML::TocInsertor;
use HTML::TocUpdator;
#--- AssembleTocLine() --------------------------------------------------------
# function: Assemble ToC line.
sub AssembleTocLine {
# Get arguments
my ($aLevel, $aGroupId, $aNode, $aSequenceNr, $aText) = @_;
# Local variables
my ($result);
# Assemble ToC line
SWITCH: {
if ($aGroupId eq "prelude") {
$result = "<li>$aText\n";
last SWITCH;
}
if ($aGroupId eq "part") {
$result = "<li>Part $aNode &nbsp;$aText\n";
last SWITCH;
}
if ($aGroupId eq "h") {
$result = "<li>$aSequenceNr. &nbsp;$aText\n";
last SWITCH;
}
else {
$result = "<li>$aNode &nbsp;$aText\n";
last SWITCH;
}
}
# Return value
return $result;
} # AssembleTocLine()
#--- AssembleTokenNumber() ----------------------------------------------------
# function: Assemble token number.
sub AssembleTokenNumber {
# Get arguments
my ($aNode, $aGroupId, $aFile, $aGroupLevel, $aLevel, $aToc) = @_;
# Local variables
my ($result);
# Assemble token number
SWITCH: {
if ($aGroupId eq "part") {
$result = "Part $aNode &nbsp;";
last SWITCH;
}
else {
$result = "$aNode &nbsp;";
last SWITCH;
}
}
# Return value
return $result;
} # AssembleTokenNumber()
#--- TestInsertManualToc ------------------------------------------------------
# function: Test inserting ToC into manual.
sub TestInsertManualToc {
my $output;
# Create objects
my $toc = new HTML::Toc;
my $tocOfFigures = new HTML::Toc;
my $tocOfTables = new HTML::Toc;
my $tocInsertor = new HTML::TocInsertor;
# Set ToC options
$toc->setOptions({
'doNestGroup' => 1,
'doNumberToken' => 1,
'insertionPoint' => "replace <!-- Table of Contents -->",
'templateLevel' => \&AssembleTocLine,
'templateLevelBegin' => '"<ul class=toc_$groupId$level>\n"',
'templateLevelEnd' => '"</ul>\n"',
'templateTokenNumber' => \&AssembleTokenNumber,
'tokenToToc' => [{
'groupId' => 'part',
'doNumberToken' => 1,
'level' => 1,
'tokenBegin' => '<h1 class=part>',
}, {
'tokenBegin' => '<h1 class=-[appendix|prelude|hidden|part]>'
}, {
'tokenBegin' => '<h2>',
'level' => 2
}, {
'tokenBegin' => '<h3>',
'level' => 3
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h1 class=appendix>',
'numberingStyle' => 'upper-alpha',
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h2 class=appendix>',
'level' => 2
}, {
'groupId' => 'prelude',
'tokenBegin' => '<h1 class=prelude>',
'level' => 1,
'doNumberToken' => 0,
}],
});
$tocOfFigures->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "replace <!-- Table of Figures -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Figure $node: &nbsp;"',
'tokenToToc' => [{
'groupId' => 'Figure',
'tokenBegin' => '<p class=captionFigure>'
}]
});
$tocOfTables->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "replace <!-- Table of Tables -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Table $node: &nbsp;"',
'tokenToToc' => [{
'groupId' => 'Table',
'tokenBegin' => '<p class=captionTable>'
}]
});
# Insert ToC
$tocInsertor->insertIntoFile(
[$toc, $tocOfFigures, $tocOfTables],
't/ManualTest/manualTest1.htm', {
'doUseGroupsGlobal' => 1,
'output' => \$output,
'outputFile' => 't/ManualTest/manualTest2.htm'
}
);
ok($output, <<EOT);
<html>
<head>
<title>Manual</title>
<style type="text/css">
ul.toc_appendix1 {
list-style-type: none;
margin-left: 0;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h2 {
list-style-type: none;
}
ul.toc_h3 {
list-style-type: none;
}
ul.toc_part1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_prelude1 {
list-style: none;
}
p.captionFigure {
font-style: italic;
font-weight: bold;
}
p.captionTable {
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<a name=prelude-1><h1 class=prelude>Preface</h1></a>
Better C than never.
<h1 class=hidden>Table of Contents</h1>
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul class=toc_prelude1>
<li><a href=#prelude-1>Preface</a>
<li><a href=#prelude-2>Table of Figures</a>
<li><a href=#prelude-3>Table of Tables</a>
<li><a href=#prelude-4>Introduction</a>
<ul class=toc_part1>
<li>Part 1 &nbsp;<a href=#part-1>Disks</a>
<ul class=toc_h1>
<li>1. &nbsp;<a href=#h-1>Compiler Disk v1</a>
<ul class=toc_h2>
<li>1. &nbsp;<a href=#h-1.1>System</a>
<li>2. &nbsp;<a href=#h-1.2>Standard Library</a>
</ul>
<li>2. &nbsp;<a href=#h-2>Compiler Disk v2</a>
<ul class=toc_h2>
<li>1. &nbsp;<a href=#h-2.1>System</a>
<ul class=toc_h3>
<li>1. &nbsp;<a href=#h-2.1.1>parser.com</a>
<li>2. &nbsp;<a href=#h-2.1.2>compiler.com</a>
<li>3. &nbsp;<a href=#h-2.1.3>linker.com</a>
</ul>
<li>2. &nbsp;<a href=#h-2.2>Standard Library</a>
</ul>
<li>3. &nbsp;<a href=#h-3>Library System Disk</a>
</ul>
<li>Part 2 &nbsp;<a href=#part-2>Personal</a>
<ul class=toc_h1>
<li>4. &nbsp;<a href=#h-4>Tips & Tricks</a>
</ul>
<li>Part 3 &nbsp;<a href=#part-3>Appendixes</a>
<ul class=toc_appendix1>
<li>A &nbsp;<a href=#appendix-A>Functions Standard Library v1</a>
<li>B &nbsp;<a href=#appendix-B>Functions Standard Library v2</a>
<li>C &nbsp;<a href=#appendix-C>Functions Graphic Library</a>
</ul>
</ul>
<li><a href=#prelude-5>Bibliography</a>
</ul>
<!-- End of generated Table of Contents -->
<a name=prelude-2><h1 class=prelude>Table of Figures</h1></a>
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ol>
<li><a href=#Figure-1>Contents Compiler Disk v1</a>
<li><a href=#Figure-2>Contents Compiler Disk v2</a>
</ol>
<!-- End of generated Table of Contents -->
<a name=prelude-3><h1 class=prelude>Table of Tables</h1></a>
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ol>
<li><a href=#Table-1>Compile Steps</a>
</ol>
<!-- End of generated Table of Contents -->
<a name=prelude-4><h1 class=prelude>Introduction</h1></a>
Thanks to standardisation and the excellent work of the QWERTY corporation it is possible to learn C with almost any C manual.
<a name=Table-1><p class=captionTable>Table 1: &nbsp;Compile Steps</p></a>
<ul><pre>
Parser
Compiler
Linker
</pre></ul>
<a name=part-1><h1 class=part>Part 1 &nbsp;Disks</h1></a>
<a name=h-1><h1>1 &nbsp;Compiler Disk v1</h1></a>
<img src=img.gif alt="Contents Compiler Disk v1">
<a name=Figure-1><p class=captionFigure>Figure 1: &nbsp;Contents Compiler Disk v1</p></a>
<a name=h-1.1><h2>1.1 &nbsp;System</h2></a>
<a name=h-1.2><h2>1.2 &nbsp;Standard Library</h2></a>
<a name=h-2><h1>2 &nbsp;Compiler Disk v2</h1></a>
<img src=img.gif alt="Contents Compiler Disk v2">
<a name=Figure-2><p class=captionFigure>Figure 2: &nbsp;Contents Compiler Disk v2</p></a>
<a name=h-2.1><h2>2.1 &nbsp;System</h2></a>
<a name=h-2.1.1><h3>2.1.1 &nbsp;parser.com</h3></a>
<a name=h-2.1.2><h3>2.1.2 &nbsp;compiler.com</h3></a>
<a name=h-2.1.3><h3>2.1.3 &nbsp;linker.com</h3></a>
<a name=h-2.2><h2>2.2 &nbsp;Standard Library</h2></a>
<a name=h-3><h1>3 &nbsp;Library System Disk</h1></a>
<a name=part-2><h1 class=part>Part 2 &nbsp;Personal</h1></a>
<a name=h-4><h1>4 &nbsp;Tips & Tricks</h1></a>
<a name=part-3><h1 class=part>Part 3 &nbsp;Appendixes</h1></a>
<a name=appendix-A><h1 class=appendix>A &nbsp;Functions Standard Library v1</h1></a>
<a name=appendix-B><h1 class=appendix>B &nbsp;Functions Standard Library v2</h1></a>
<a name=appendix-C><h1 class=appendix>C &nbsp;Functions Graphic Library</h1></a>
<a name=prelude-5><h1 class=prelude>Bibliography</h1></a>
</body>
</html>
EOT
} # TestInsertManualToc()
#--- TestInsertManualForUpdating() --------------------------------------------
# function: Test inserting ToC into manual.
sub TestInsertManualForUpdating {
my $output;
# Create objects
my $toc = new HTML::Toc;
my $tocOfFigures = new HTML::Toc;
my $tocOfTables = new HTML::Toc;
my $tocUpdator = new HTML::TocUpdator;
# Set ToC options
$toc->setOptions({
'doNestGroup' => 1,
'doNumberToken' => 1,
'insertionPoint' => "after <!-- Table of Contents -->",
'templateLevel' => \&AssembleTocLine,
'templateLevelBegin' => '"<ul class=toc_$groupId$level>\n"',
'templateLevelEnd' => '"</ul>\n"',
'templateTokenNumber' => \&AssembleTokenNumber,
'tokenToToc' => [{
'groupId' => 'part',
'doNumberToken' => 1,
'level' => 1,
'tokenBegin' => '<h1 class=part>',
}, {
'tokenBegin' => '<h1 class=-[appendix|prelude|hidden|part]>'
}, {
'tokenBegin' => '<h2>',
'level' => 2
}, {
'tokenBegin' => '<h3>',
'level' => 3
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h1 class=appendix>',
'numberingStyle' => 'upper-alpha',
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h2 class=appendix>',
'level' => 2
}, {
'groupId' => 'prelude',
'tokenBegin' => '<h1 class=prelude>',
'level' => 1,
'doNumberToken' => 0,
}],
});
$tocOfFigures->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "after <!-- Table of Figures -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Figure $node: &nbsp;"',
'tokenToToc' => [{
'groupId' => 'Figure',
'tokenBegin' => '<p class=captionFigure>'
}]
});
$tocOfTables->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "after <!-- Table of Tables -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Table $node: &nbsp;"',
'tokenToToc' => [{
'groupId' => 'Table',
'tokenBegin' => '<p class=captionTable>'
}]
});
# Insert ToC
$tocUpdator->updateFile(
[$toc, $tocOfFigures, $tocOfTables],
't/ManualTest/manualTest1.htm', {
'doUseGroupsGlobal' => 1,
'output' => \$output,
'outputFile' => 't/ManualTest/manualTest3.htm'
}
);
ok($output, <<EOT);
<html>
<head>
<title>Manual</title>
<style type="text/css">
ul.toc_appendix1 {
list-style-type: none;
margin-left: 0;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h2 {
list-style-type: none;
}
ul.toc_h3 {
list-style-type: none;
}
ul.toc_part1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_prelude1 {
list-style: none;
}
p.captionFigure {
font-style: italic;
font-weight: bold;
}
p.captionTable {
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<!-- #BeginTocAnchorNameBegin --><a name=prelude-1><!-- #EndTocAnchorNameBegin --><h1 class=prelude>Preface</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
Better C than never.
<h1 class=hidden>Table of Contents</h1>
<!-- Table of Contents --><!-- #BeginToc -->
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul class=toc_prelude1>
<li><a href=#prelude-1>Preface</a>
<li><a href=#prelude-2>Table of Figures</a>
<li><a href=#prelude-3>Table of Tables</a>
<li><a href=#prelude-4>Introduction</a>
<ul class=toc_part1>
<li>Part 1 &nbsp;<a href=#part-1>Disks</a>
<ul class=toc_h1>
<li>1. &nbsp;<a href=#h-1>Compiler Disk v1</a>
<ul class=toc_h2>
<li>1. &nbsp;<a href=#h-1.1>System</a>
<li>2. &nbsp;<a href=#h-1.2>Standard Library</a>
</ul>
<li>2. &nbsp;<a href=#h-2>Compiler Disk v2</a>
<ul class=toc_h2>
<li>1. &nbsp;<a href=#h-2.1>System</a>
<ul class=toc_h3>
<li>1. &nbsp;<a href=#h-2.1.1>parser.com</a>
<li>2. &nbsp;<a href=#h-2.1.2>compiler.com</a>
<li>3. &nbsp;<a href=#h-2.1.3>linker.com</a>
</ul>
<li>2. &nbsp;<a href=#h-2.2>Standard Library</a>
</ul>
<li>3. &nbsp;<a href=#h-3>Library System Disk</a>
</ul>
<li>Part 2 &nbsp;<a href=#part-2>Personal</a>
<ul class=toc_h1>
<li>4. &nbsp;<a href=#h-4>Tips & Tricks</a>
</ul>
<li>Part 3 &nbsp;<a href=#part-3>Appendixes</a>
<ul class=toc_appendix1>
<li>A &nbsp;<a href=#appendix-A>Functions Standard Library v1</a>
<li>B &nbsp;<a href=#appendix-B>Functions Standard Library v2</a>
<li>C &nbsp;<a href=#appendix-C>Functions Graphic Library</a>
</ul>
</ul>
<li><a href=#prelude-5>Bibliography</a>
</ul>
<!-- End of generated Table of Contents -->
<!-- #EndToc -->
<!-- #BeginTocAnchorNameBegin --><a name=prelude-2><!-- #EndTocAnchorNameBegin --><h1 class=prelude>Table of Figures</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- Table of Figures --><!-- #BeginToc -->
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ol>
<li><a href=#Figure-1>Contents Compiler Disk v1</a>
<li><a href=#Figure-2>Contents Compiler Disk v2</a>
</ol>
<!-- End of generated Table of Contents -->
<!-- #EndToc -->
<!-- #BeginTocAnchorNameBegin --><a name=prelude-3><!-- #EndTocAnchorNameBegin --><h1 class=prelude>Table of Tables</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- Table of Tables --><!-- #BeginToc -->
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ol>
<li><a href=#Table-1>Compile Steps</a>
</ol>
<!-- End of generated Table of Contents -->
<!-- #EndToc -->
<!-- #BeginTocAnchorNameBegin --><a name=prelude-4><!-- #EndTocAnchorNameBegin --><h1 class=prelude>Introduction</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
Thanks to standardisation and the excellent work of the QWERTY corporation it is possible to learn C with almost any C manual.
<!-- #BeginTocAnchorNameBegin --><a name=Table-1><!-- #EndTocAnchorNameBegin --><p class=captionTable><!-- #BeginTocNumber -->Table 1: &nbsp;<!-- #EndTocNumber -->Compile Steps</p><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<ul><pre>
Parser
Compiler
Linker
</pre></ul>
<!-- #BeginTocAnchorNameBegin --><a name=part-1><!-- #EndTocAnchorNameBegin --><h1 class=part><!-- #BeginTocNumber -->Part 1 &nbsp;<!-- #EndTocNumber -->Disks</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-1><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->1 &nbsp;<!-- #EndTocNumber -->Compiler Disk v1</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<img src=img.gif alt="Contents Compiler Disk v1">
<!-- #BeginTocAnchorNameBegin --><a name=Figure-1><!-- #EndTocAnchorNameBegin --><p class=captionFigure><!-- #BeginTocNumber -->Figure 1: &nbsp;<!-- #EndTocNumber -->Contents Compiler Disk v1</p><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-1.1><!-- #EndTocAnchorNameBegin --><h2><!-- #BeginTocNumber -->1.1 &nbsp;<!-- #EndTocNumber -->System</h2><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-1.2><!-- #EndTocAnchorNameBegin --><h2><!-- #BeginTocNumber -->1.2 &nbsp;<!-- #EndTocNumber -->Standard Library</h2><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->2 &nbsp;<!-- #EndTocNumber -->Compiler Disk v2</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<img src=img.gif alt="Contents Compiler Disk v2">
<!-- #BeginTocAnchorNameBegin --><a name=Figure-2><!-- #EndTocAnchorNameBegin --><p class=captionFigure><!-- #BeginTocNumber -->Figure 2: &nbsp;<!-- #EndTocNumber -->Contents Compiler Disk v2</p><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2.1><!-- #EndTocAnchorNameBegin --><h2><!-- #BeginTocNumber -->2.1 &nbsp;<!-- #EndTocNumber -->System</h2><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2.1.1><!-- #EndTocAnchorNameBegin --><h3><!-- #BeginTocNumber -->2.1.1 &nbsp;<!-- #EndTocNumber -->parser.com</h3><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2.1.2><!-- #EndTocAnchorNameBegin --><h3><!-- #BeginTocNumber -->2.1.2 &nbsp;<!-- #EndTocNumber -->compiler.com</h3><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2.1.3><!-- #EndTocAnchorNameBegin --><h3><!-- #BeginTocNumber -->2.1.3 &nbsp;<!-- #EndTocNumber -->linker.com</h3><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2.2><!-- #EndTocAnchorNameBegin --><h2><!-- #BeginTocNumber -->2.2 &nbsp;<!-- #EndTocNumber -->Standard Library</h2><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-3><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->3 &nbsp;<!-- #EndTocNumber -->Library System Disk</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=part-2><!-- #EndTocAnchorNameBegin --><h1 class=part><!-- #BeginTocNumber -->Part 2 &nbsp;<!-- #EndTocNumber -->Personal</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-4><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->4 &nbsp;<!-- #EndTocNumber -->Tips & Tricks</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=part-3><!-- #EndTocAnchorNameBegin --><h1 class=part><!-- #BeginTocNumber -->Part 3 &nbsp;<!-- #EndTocNumber -->Appendixes</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=appendix-A><!-- #EndTocAnchorNameBegin --><h1 class=appendix><!-- #BeginTocNumber -->A &nbsp;<!-- #EndTocNumber -->Functions Standard Library v1</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=appendix-B><!-- #EndTocAnchorNameBegin --><h1 class=appendix><!-- #BeginTocNumber -->B &nbsp;<!-- #EndTocNumber -->Functions Standard Library v2</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=appendix-C><!-- #EndTocAnchorNameBegin --><h1 class=appendix><!-- #BeginTocNumber -->C &nbsp;<!-- #EndTocNumber -->Functions Graphic Library</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=prelude-5><!-- #EndTocAnchorNameBegin --><h1 class=prelude>Bibliography</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
</body>
</html>
EOT
} # TestInsertManualForUpdating()
#--- TestUpdateManual() -------------------------------------------------------
# function: Test inserting ToC into manual.
sub TestUpdateManual {
my $output;
# Create objects
my $toc = new HTML::Toc;
my $tocOfFigures = new HTML::Toc;
my $tocOfTables = new HTML::Toc;
my $tocUpdator = new HTML::TocUpdator;
# Set ToC options
$toc->setOptions({
'doNestGroup' => 1,
'doNumberToken' => 1,
'insertionPoint' => "after <!-- Table of Contents -->",
'templateLevel' => \&AssembleTocLine,
'templateLevelBegin' => '"<ul class=toc_$groupId$level>\n"',
'templateLevelEnd' => '"</ul>\n"',
'templateTokenNumber' => \&AssembleTokenNumber,
'tokenToToc' => [{
'groupId' => 'part',
'doNumberToken' => 1,
'level' => 1,
'tokenBegin' => '<h1 class=part>',
}, {
'tokenBegin' => '<h1 class=-[appendix|prelude|hidden|part]>'
}, {
'tokenBegin' => '<h2>',
'level' => 2
}, {
'tokenBegin' => '<h3>',
'level' => 3
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h1 class=appendix>',
'numberingStyle' => 'upper-alpha',
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h2 class=appendix>',
'level' => 2
}, {
'groupId' => 'prelude',
'tokenBegin' => '<h1 class=prelude>',
'level' => 1,
'doNumberToken' => 0,
}],
});
$tocOfFigures->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "after <!-- Table of Figures -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Figure $node: &nbsp;"',
'tokenToToc' => [{
'groupId' => 'Figure',
'tokenBegin' => '<p class=captionFigure>'
}]
});
$tocOfTables->setOptions({
'doNumberToken' => 1,
'insertionPoint' => "after <!-- Table of Tables -->",
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
'templateTokenNumber' => '"Table $node: &nbsp;"',
'tokenToToc' => [{
'groupId' => 'Table',
'tokenBegin' => '<p class=captionTable>'
}]
});
# Insert ToC
$tocUpdator->updateFile(
[$toc, $tocOfFigures, $tocOfTables],
't/ManualTest/manualTest3.htm', {
'doUseGroupsGlobal' => 1,
'output' => \$output,
'outputFile' => 't/ManualTest/manualTest4.htm'
}
);
ok($output, <<EOT);
<html>
<head>
<title>Manual</title>
<style type="text/css">
ul.toc_appendix1 {
list-style-type: none;
margin-left: 0;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_h2 {
list-style-type: none;
}
ul.toc_h3 {
list-style-type: none;
}
ul.toc_part1 {
list-style-type: none;
margin-left: 1;
margin-top: 1em;
margin-bottom: 1em;
}
ul.toc_prelude1 {
list-style: none;
}
p.captionFigure {
font-style: italic;
font-weight: bold;
}
p.captionTable {
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<!-- #BeginTocAnchorNameBegin --><a name=prelude-1><!-- #EndTocAnchorNameBegin --><h1 class=prelude>Preface</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
Better C than never.
<h1 class=hidden>Table of Contents</h1>
<!-- Table of Contents --><!-- #BeginToc -->
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul class=toc_prelude1>
<li><a href=#prelude-1>Preface</a>
<li><a href=#prelude-2>Table of Figures</a>
<li><a href=#prelude-3>Table of Tables</a>
<li><a href=#prelude-4>Introduction</a>
<ul class=toc_part1>
<li>Part 1 &nbsp;<a href=#part-1>Disks</a>
<ul class=toc_h1>
<li>1. &nbsp;<a href=#h-1>Compiler Disk v1</a>
<ul class=toc_h2>
<li>1. &nbsp;<a href=#h-1.1>System</a>
<li>2. &nbsp;<a href=#h-1.2>Standard Library</a>
</ul>
<li>2. &nbsp;<a href=#h-2>Compiler Disk v2</a>
<ul class=toc_h2>
<li>1. &nbsp;<a href=#h-2.1>System</a>
<ul class=toc_h3>
<li>1. &nbsp;<a href=#h-2.1.1>parser.com</a>
<li>2. &nbsp;<a href=#h-2.1.2>compiler.com</a>
<li>3. &nbsp;<a href=#h-2.1.3>linker.com</a>
</ul>
<li>2. &nbsp;<a href=#h-2.2>Standard Library</a>
</ul>
<li>3. &nbsp;<a href=#h-3>Library System Disk</a>
</ul>
<li>Part 2 &nbsp;<a href=#part-2>Personal</a>
<ul class=toc_h1>
<li>4. &nbsp;<a href=#h-4>Tips & Tricks</a>
</ul>
<li>Part 3 &nbsp;<a href=#part-3>Appendixes</a>
<ul class=toc_appendix1>
<li>A &nbsp;<a href=#appendix-A>Functions Standard Library v1</a>
<li>B &nbsp;<a href=#appendix-B>Functions Standard Library v2</a>
<li>C &nbsp;<a href=#appendix-C>Functions Graphic Library</a>
</ul>
</ul>
<li><a href=#prelude-5>Bibliography</a>
</ul>
<!-- End of generated Table of Contents -->
<!-- #EndToc -->
<!-- #BeginTocAnchorNameBegin --><a name=prelude-2><!-- #EndTocAnchorNameBegin --><h1 class=prelude>Table of Figures</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- Table of Figures --><!-- #BeginToc -->
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ol>
<li><a href=#Figure-1>Contents Compiler Disk v1</a>
<li><a href=#Figure-2>Contents Compiler Disk v2</a>
</ol>
<!-- End of generated Table of Contents -->
<!-- #EndToc -->
<!-- #BeginTocAnchorNameBegin --><a name=prelude-3><!-- #EndTocAnchorNameBegin --><h1 class=prelude>Table of Tables</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- Table of Tables --><!-- #BeginToc -->
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ol>
<li><a href=#Table-1>Compile Steps</a>
</ol>
<!-- End of generated Table of Contents -->
<!-- #EndToc -->
<!-- #BeginTocAnchorNameBegin --><a name=prelude-4><!-- #EndTocAnchorNameBegin --><h1 class=prelude>Introduction</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
Thanks to standardisation and the excellent work of the QWERTY corporation it is possible to learn C with almost any C manual.
<!-- #BeginTocAnchorNameBegin --><a name=Table-1><!-- #EndTocAnchorNameBegin --><p class=captionTable><!-- #BeginTocNumber -->Table 1: &nbsp;<!-- #EndTocNumber -->Compile Steps</p><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<ul><pre>
Parser
Compiler
Linker
</pre></ul>
<!-- #BeginTocAnchorNameBegin --><a name=part-1><!-- #EndTocAnchorNameBegin --><h1 class=part><!-- #BeginTocNumber -->Part 1 &nbsp;<!-- #EndTocNumber -->Disks</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-1><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->1 &nbsp;<!-- #EndTocNumber -->Compiler Disk v1</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<img src=img.gif alt="Contents Compiler Disk v1">
<!-- #BeginTocAnchorNameBegin --><a name=Figure-1><!-- #EndTocAnchorNameBegin --><p class=captionFigure><!-- #BeginTocNumber -->Figure 1: &nbsp;<!-- #EndTocNumber -->Contents Compiler Disk v1</p><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-1.1><!-- #EndTocAnchorNameBegin --><h2><!-- #BeginTocNumber -->1.1 &nbsp;<!-- #EndTocNumber -->System</h2><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-1.2><!-- #EndTocAnchorNameBegin --><h2><!-- #BeginTocNumber -->1.2 &nbsp;<!-- #EndTocNumber -->Standard Library</h2><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->2 &nbsp;<!-- #EndTocNumber -->Compiler Disk v2</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<img src=img.gif alt="Contents Compiler Disk v2">
<!-- #BeginTocAnchorNameBegin --><a name=Figure-2><!-- #EndTocAnchorNameBegin --><p class=captionFigure><!-- #BeginTocNumber -->Figure 2: &nbsp;<!-- #EndTocNumber -->Contents Compiler Disk v2</p><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2.1><!-- #EndTocAnchorNameBegin --><h2><!-- #BeginTocNumber -->2.1 &nbsp;<!-- #EndTocNumber -->System</h2><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2.1.1><!-- #EndTocAnchorNameBegin --><h3><!-- #BeginTocNumber -->2.1.1 &nbsp;<!-- #EndTocNumber -->parser.com</h3><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2.1.2><!-- #EndTocAnchorNameBegin --><h3><!-- #BeginTocNumber -->2.1.2 &nbsp;<!-- #EndTocNumber -->compiler.com</h3><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2.1.3><!-- #EndTocAnchorNameBegin --><h3><!-- #BeginTocNumber -->2.1.3 &nbsp;<!-- #EndTocNumber -->linker.com</h3><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-2.2><!-- #EndTocAnchorNameBegin --><h2><!-- #BeginTocNumber -->2.2 &nbsp;<!-- #EndTocNumber -->Standard Library</h2><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-3><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->3 &nbsp;<!-- #EndTocNumber -->Library System Disk</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=part-2><!-- #EndTocAnchorNameBegin --><h1 class=part><!-- #BeginTocNumber -->Part 2 &nbsp;<!-- #EndTocNumber -->Personal</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=h-4><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->4 &nbsp;<!-- #EndTocNumber -->Tips & Tricks</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=part-3><!-- #EndTocAnchorNameBegin --><h1 class=part><!-- #BeginTocNumber -->Part 3 &nbsp;<!-- #EndTocNumber -->Appendixes</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=appendix-A><!-- #EndTocAnchorNameBegin --><h1 class=appendix><!-- #BeginTocNumber -->A &nbsp;<!-- #EndTocNumber -->Functions Standard Library v1</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=appendix-B><!-- #EndTocAnchorNameBegin --><h1 class=appendix><!-- #BeginTocNumber -->B &nbsp;<!-- #EndTocNumber -->Functions Standard Library v2</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=appendix-C><!-- #EndTocAnchorNameBegin --><h1 class=appendix><!-- #BeginTocNumber -->C &nbsp;<!-- #EndTocNumber -->Functions Graphic Library</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
<!-- #BeginTocAnchorNameBegin --><a name=prelude-5><!-- #EndTocAnchorNameBegin --><h1 class=prelude>Bibliography</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
</body>
</html>
EOT
} # TestUpdateManual()
# Test inserting ToC into manual
TestInsertManualToc();
# Test inserting ToC with update tokens into manual
TestInsertManualForUpdating();
# Test updating ToC
TestUpdateManual();

View File

@@ -1,194 +0,0 @@
#--- options.t ----------------------------------------------------------------
# function: Test HTML::ToC. In particular test the available options.
use strict;
use Test;
BEGIN { plan tests => 5; }
use HTML::Toc;
use HTML::TocGenerator;
use HTML::TocInsertor;
use HTML::TocUpdator;
my ($filename);
BEGIN {
# Create test file
$filename = "file$$.htm";
die "$filename is already there" if -e $filename;
}
END {
# Remove test file
unlink($filename) or warn "Can't unlink $filename: $!";
}
#--- TestAttributeToExcludeToken() --------------------------------------------
# function: Test 'HTML::Toc' option 'attributeToExcludeToken'
sub TestAttributeToExcludeToken {
# Assemble test file
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<body>
<h1>Chapter 1</h1>
<h1 class=appendix>Appendix</h1>
</body>
EOT
# Create objects
my $toc = HTML::Toc->new();
my $tocGenerator = HTML::TocGenerator->new();
$toc->setOptions({
'attributeToExcludeToken' => 'foo',
'tokenToToc' => [{
'tokenBegin' => '<h1 class=foodix>'
}]
});
# Generate ToC
$tocGenerator->generateFromFile($toc, $filename);
# Test ToC
ok($toc->format(), <<EOT);
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1>Chapter 1</a>
</ul>
<!-- End of generated Table of Contents -->
EOT
} # TestAttributeToExcludeToken()
#--- TestAttributeToTocToken() ------------------------------------------------
# function: Test 'HTML::Toc' option 'attributeToTocToken'
sub TestAttributeToTocToken {
# Assemble test file
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<body>
<img src=test.gif alt=Picture>
</body>
</html>
EOT
# Create objects
my $toc = HTML::Toc->new();
my $tocGenerator = HTML::TocGenerator->new();
$toc->setOptions({
'attributeToTocToken' => 'foo',
'tokenToToc' => [{
'groupId' => 'image',
'tokenBegin' => '<img alt=foo>'
}],
});
# Generate ToC
$tocGenerator->generateFromFile($toc, $filename);
# Test ToC
ok($toc->format(), <<EOT);
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#image-1>Picture</a>
</ul>
<!-- End of generated Table of Contents -->
EOT
} # TestAttributeToTocToken()
#--- TestNumberingStyleDecimal ------------------------------------------------
# function: Test 'decimal' numbering style.
sub TestNumberingStyleDecimal {
# Local variables
my $output;
# Create objects
my $toc = HTML::Toc->new();
my $tocInsertor = HTML::TocInsertor->new();
$toc->setOptions({
'doNumberToken' => 1,
'tokenToToc' => [{
'level' => 1,
'tokenBegin' => '<h1>',
'numberingStyle' => 'decimal'
}],
});
# Generate ToC
$tocInsertor->insert($toc, "<h1>Header</h1>", {'output' => \$output});
# Test ToC
ok("$output\n", <<EOT);
<a name=h-1><h1>1 &nbsp;Header</h1></a>
EOT
} # TestNumberingStyleDecimal()
#--- TestNumberingStyleLowerAlpha ---------------------------------------------
# function: Test 'lower-alpha' numbering style.
sub TestNumberingStyleLowerAlpha {
# Local variables
my $output;
# Create objects
my $toc = HTML::Toc->new();
my $tocInsertor = HTML::TocInsertor->new();
$toc->setOptions({
'doNumberToken' => 1,
'tokenToToc' => [{
'level' => 1,
'tokenBegin' => '<h1>',
'numberingStyle' => 'lower-alpha'
}],
});
# Generate ToC
$tocInsertor->insert($toc, "<h1>Header</h1>", {'output' => \$output});
# Test ToC
ok("$output\n", <<EOT);
<a name=h-a><h1>a &nbsp;Header</h1></a>
EOT
} # TestNumberingStyleLowerAlpha()
#--- TestNumberingStyleUpperAlpha ---------------------------------------------
# function: Test 'upper-alpha' numbering style.
sub TestNumberingStyleUpperAlpha {
# Local variables
my $output;
# Create objects
my $toc = HTML::Toc->new();
my $tocInsertor = HTML::TocInsertor->new();
$toc->setOptions({
'doNumberToken' => 1,
'tokenToToc' => [{
'level' => 1,
'tokenBegin' => '<h1>',
'numberingStyle' => 'upper-alpha'
}],
});
# Generate ToC
$tocInsertor->insert($toc, "<h1>Header</h1>", {'output' => \$output});
# Test ToC
ok("$output\n", <<EOT);
<a name=h-A><h1>A &nbsp;Header</h1></a>
EOT
} # TestNumberingStyleUpperAlpha()
# Test 'attributeToTocToken'
TestAttributeToTocToken();
# Test 'attributeToExcludeToken'
TestAttributeToExcludeToken();
# Test 'numberingStyleDecimal'
TestNumberingStyleDecimal();
# Test 'numberingStyleLowerAlpha'
TestNumberingStyleLowerAlpha();
# Test 'numberingStyleUpperAlpha'
TestNumberingStyleUpperAlpha();

View File

@@ -1,709 +0,0 @@
#--- podExamples.t ------------------------------------------------------------
# function: Test HTML::ToC. In particular test the examples as described in
# the POD documentation.
use strict;
use Test;
BEGIN { plan tests => 13; }
use HTML::Toc;
use HTML::TocGenerator;
use HTML::TocInsertor;
use HTML::TocUpdator;
my ($filename, $filename2);
BEGIN {
# Create test file
$filename = "tmp.htm";
die "$filename is already there" if -e $filename;
# Create test file 2
$filename2 = "tmp2.htm";
die "$filename2 is already there" if -e $filename2;
}
END {
# Remove test file
unlink($filename) or warn "Can't unlink $filename: $!";
# Remove test file 2
unlink($filename2) or warn "Can't unlink $filename2: $!";
}
#--- TestExtendFromFile() --------------------------------------------------
# function: Test 'HTML::TocGenerator->extendFromFile()
sub TestExtendFromFile {
# Assemble test file
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<body>
<h1>Chapter of document 1</h1>
</body>
EOT
# Assemble test file 2
open(FILE, ">$filename2") || die "Can't create $filename2: $!";
print FILE <<'EOT'; close(FILE);
<html>
<body>
<h1>Chapter of document 2</h1>
</body>
</html>
EOT
# Create objects
my $toc = HTML::Toc->new();
my $tocGenerator = HTML::TocGenerator->new();
# Set ToC options
$toc->setOptions({'doLinkToFile' => 1});
# Generate ToC
$tocGenerator->generateFromFile($toc, $filename);
$tocGenerator->extendFromFile($toc, $filename2);
# Test ToC
ok($toc->format(), <<EOT);
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=tmp.htm#h-1>Chapter of document 1</a>
<li><a href=tmp2.htm#h-2>Chapter of document 2</a>
</ul>
<!-- End of generated Table of Contents -->
EOT
} # TestExtendFromFile()
#--- TestGenerateFromFiles() --------------------------------------------------
# function: Test 'HTML::TocGenerator->generateFromFile()
sub TestGenerateFromFiles {
# Assemble test file
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<body>
<h1>Chapter of document 1</h1>
</body>
EOT
# Assemble test file 2
open(FILE, ">$filename2") || die "Can't create $filename2: $!";
print FILE <<'EOT'; close(FILE);
<html>
<body>
<h1>Chapter of document 2</h1>
</body>
</html>
EOT
# Create objects
my $toc = HTML::Toc->new();
my $tocGenerator = HTML::TocGenerator->new();
# Set ToC options
$toc->setOptions({'doLinkToFile' => 1});
# Generate ToC
$tocGenerator->generateFromFile($toc, [$filename, $filename2]);
# Test ToC
ok($toc->format(), <<EOT);
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=tmp.htm#h-1>Chapter of document 1</a>
<li><a href=tmp2.htm#h-2>Chapter of document 2</a>
</ul>
<!-- End of generated Table of Contents -->
EOT
} # TestGenerateFromFiles()
#--- TestGenerateFromFiles() --------------------------------------------------
# function: Test 'HTML::TocGenerator->generateFromFile() using multiple files.
sub TestGenerateFromFile {
# Assemble test file 1
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<html>
<body>
<h1>Chapter</h1>
</body>
</html>
EOT
# Create objects
my $toc = HTML::Toc->new();
my $tocGenerator = HTML::TocGenerator->new();
# Generate ToC
$tocGenerator->generateFromFile($toc, $filename);
# Test ToC
ok($toc->format(), <<EOT);
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1>Chapter</a>
</ul>
<!-- End of generated Table of Contents -->
EOT
} # TestGenerateFromFile()
#--- TestInsertIntoFile() -----------------------------------------------------
# function: Test 'HTML::TocInsertor->insertIntoFile()
sub TestInsertIntoFile {
# Assemble test file
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<html>
<body>
<h1>Chapter</h1>
</body>
</html>
EOT
# Create objects
my $toc = HTML::Toc->new();
my $tocInsertor = HTML::TocInsertor->new();
my $output;
# Generate ToC
$tocInsertor->insertIntoFile($toc, $filename, {'output' => \$output});
# Test ToC
ok($output, <<EOT);
<html>
<body>
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1>Chapter</a>
</ul>
<!-- End of generated Table of Contents -->
<a name=h-1><h1>Chapter</h1></a>
</body>
</html>
EOT
} # TestInsertIntoFile()
#--- TestInsertIntoFileUsingTocUpdator() --------------------------------------
# function: Test 'HTML::TocUpdator->insertIntoFile()
sub TestInsertIntoFileUsingTocUpdator {
# Assemble test file
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<html>
<body>
<h1>
Chapter
</h1>
</body>
</html>
EOT
# Create objects
my $toc = HTML::Toc->new();
my $tocUpdator = HTML::TocUpdator->new();
my $output;
# Generate ToC
$tocUpdator->insertIntoFile($toc, $filename, {'output' => \$output});
# Test ToC
ok($output, <<EOT);
<html>
<body><!-- #BeginToc -->
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1> Chapter </a>
</ul>
<!-- End of generated Table of Contents -->
<!-- #EndToc -->
<!-- #BeginTocAnchorNameBegin --><a name=h-1><!-- #EndTocAnchorNameBegin --><h1>
Chapter
</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
</body>
</html>
EOT
} # TestInsertIntoFileUsingTocUpdator()
#--- TestGlobalGroups0() ------------------------------------------------------
# function: Test 'HTML::TocGenerator' option 'doUseGroupsGlobal = 0'.
sub TestGlobalGroups0 {
# Assemble test file
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<h1>Chapter</h1>
<h2>Paragraph</h2>
EOT
# Create objects
my $toc1 = HTML::Toc->new();
my $toc2 = HTML::Toc->new();
my $tocGenerator = HTML::TocGenerator->new();
# Set options
$toc1->setOptions({
'header' => '',
'footer' => '',
'tokenToToc' => [{'tokenBegin' => '<h1>'}]
});
$toc2->setOptions({
'header' => '',
'footer' => '',
'tokenToToc' => [{'tokenBegin' => '<h2>'}]
});
# Generate ToC
$tocGenerator->generateFromFile([$toc1, $toc2], $filename);
# Test ToC
ok($toc1->format() . $toc2->format() . "\n", <<'EOT');
<ul>
<li><a href=#h-1>Chapter</a>
</ul><ul>
<li><a href=#h-1>Paragraph</a>
</ul>
EOT
} # TestGlobalGroups0()
#--- TestGlobalGroups1() ------------------------------------------------------
# function: Test 'HTML::TocGenerator' option 'doUseGroupsGlobal = 0'.
sub TestGlobalGroups1 {
# Assemble test file
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT';
<h1>Chapter</h1>
<h2>Paragraph</h2>
EOT
close(FILE);
# Create objects
my $toc1 = HTML::Toc->new();
my $toc2 = HTML::Toc->new();
my $tocGenerator = HTML::TocGenerator->new();
# Set options
$toc1->setOptions({
'header' => '',
'footer' => '',
'tokenToToc' => [{'tokenBegin' => '<h1>'}]
});
$toc2->setOptions({
'header' => '',
'footer' => '',
'tokenToToc' => [{'tokenBegin' => '<h2>'}]
});
# Generate ToC
$tocGenerator->generateFromFile(
[$toc1, $toc2], $filename, {'doUseGroupsGlobal' => 1}
);
# Test ToC
ok($toc1->format() . $toc2->format() . "\n", <<'EOT');
<ul>
<li><a href=#h-1>Chapter</a>
</ul><ul>
<li><a href=#h-2>Paragraph</a>
</ul>
EOT
} # TestGlobalGroups1()
#--- TestMultipleGroupsAppendix() ---------------------------------------------
# function: Test multiple ToCs
sub TestMultipleGroupsAppendix() {
# Create objects
my $toc = HTML::Toc->new();
my $tocInsertor = HTML::TocInsertor->new();
my $output;
# Set ToC options
$toc->setOptions({
'tokenToToc' => [{
'tokenBegin' => '<h1 class=-appendix>'
}, {
'tokenBegin' => '<h2 class=-appendix>',
'level' => 2
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h1 class=appendix>',
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h2 class=appendix>',
'level' => 2
}],
});
# Generate ToC
$tocInsertor->insert($toc, <<EOT, {'output' => \$output});
<body>
<h1>Chapter</h1>
<h2>Paragraph</h2>
<h3>Subparagraph</h3>
<h1>Chapter</h1>
<h1 class=appendix>Appendix Chapter</h1>
<h2 class=appendix>Appendix Paragraph</h2>
</body>
EOT
# Test ToC
ok($output, <<EOT);
<body>
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1>Chapter</a>
<ul>
<li><a href=#h-1.1>Paragraph</a>
</ul>
<li><a href=#h-2>Chapter</a>
</ul>
<ul>
<li><a href=#appendix-1>Appendix Chapter</a>
<ul>
<li><a href=#appendix-1.1>Appendix Paragraph</a>
</ul>
</ul>
<!-- End of generated Table of Contents -->
<a name=h-1><h1>Chapter</h1></a>
<a name=h-1.1><h2>Paragraph</h2></a>
<h3>Subparagraph</h3>
<a name=h-2><h1>Chapter</h1></a>
<a name=appendix-1><h1 class=appendix>Appendix Chapter</h1></a>
<a name=appendix-1.1><h2 class=appendix>Appendix Paragraph</h2></a>
</body>
EOT
} # TestMultipleGroupsAppendix()
#--- TestMultipleGroupsPart() -------------------------------------------------
# function: Test multiple ToCs
sub TestMultipleGroupsPart() {
# Create objects
my $toc = HTML::Toc->new();
my $tocInsertor = HTML::TocInsertor->new();
my $output;
# Set ToC options
$toc->setOptions({
'tokenToToc' => [{
'tokenBegin' => '<h1 class=-part>'
}, {
'tokenBegin' => '<h2 class=-part>',
'level' => 2,
}, {
'groupId' => 'part',
'tokenBegin' => '<h1 class=part>',
'level' => 1,
'doNumberToken' => 1,
'numberingStyle' => 'upper-alpha'
}]
});
# Generate ToC
$tocInsertor->insert($toc, <<EOT, {'output' => \$output});
<body>
<h1 class=part>First Part</h1>
<h1>Chapter</h1>
<h2>Paragraph</h2>
<h1 class=part>Second Part</h1>
<h1>Chapter</h1>
<h2>Paragraph</h2>
</body>
EOT
# Test ToC
ok($output, <<EOT);
<body>
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#part-A>First Part</a>
</ul>
<ul>
<li><a href=#h-1>Chapter</a>
<ul>
<li><a href=#h-1.1>Paragraph</a>
</ul>
</ul>
<ul>
<li><a href=#part-B>Second Part</a>
</ul>
<ul>
<li><a href=#h-2>Chapter</a>
<ul>
<li><a href=#h-2.1>Paragraph</a>
</ul>
</ul>
<!-- End of generated Table of Contents -->
<a name=part-A><h1 class=part>A &nbsp;First Part</h1></a>
<a name=h-1><h1>Chapter</h1></a>
<a name=h-1.1><h2>Paragraph</h2></a>
<a name=part-B><h1 class=part>B &nbsp;Second Part</h1></a>
<a name=h-2><h1>Chapter</h1></a>
<a name=h-2.1><h2>Paragraph</h2></a>
</body>
EOT
} # TestMultipleGroupsPart()
#--- TestMultipleTocs() -------------------------------------------------------
# function: Test multiple ToCs
sub TestMultipleTocs() {
# Assemble test file
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<body>
<h1>Header One</h1>
<img src=test1.gif alt="First picture">
<h2>Paragraph One</h2>
<img src=test2.gif alt="Second picture">
</body>
EOT
# Create objects
my $toc1 = HTML::Toc->new();
my $toc2 = HTML::Toc->new();
my $tocInsertor = HTML::TocInsertor->new();
my $output;
# Set ToC options
$toc2->setOptions({
'tokenToToc' => [{
'groupId' => 'image',
'tokenBegin' => '<img alt=@>'
}],
});
# Generate ToC
$tocInsertor->insertIntoFile(
[$toc1, $toc2], $filename, {'output' => \$output}
);
# Test ToC
ok($output, <<EOT);
<body>
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1>Header One</a>
<ul>
<li><a href=#h-1.1>Paragraph One</a>
</ul>
</ul>
<!-- End of generated Table of Contents -->
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#image-1>First picture</a>
<li><a href=#image-2>Second picture</a>
</ul>
<!-- End of generated Table of Contents -->
<a name=h-1><h1>Header One</h1></a>
<a name=image-1><img src=test1.gif alt="First picture"></a>
<a name=h-1.1><h2>Paragraph One</h2></a>
<a name=image-2><img src=test2.gif alt="Second picture"></a>
</body>
EOT
} # TestMultipleTocs()
#--- TestSpecifyNumberedList() ------------------------------------------------
# function: Test specifying numbered list.
sub TestSpecifyNumberedList {
# Assemble test file
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<body>
<h1>Chapter</h1>
<h2>Paragraph</h2>
</body>
EOT
# Create objects
my $toc = HTML::Toc->new();
my $tocGenerator = HTML::TocGenerator->new();
# Set ToC options
$toc->setOptions({
'templateLevelBegin' => '"<ol>\n"',
'templateLevelEnd' => '"</ol>\n"',
});
# Generate ToC
$tocGenerator->generateFromFile($toc, $filename);
# Test ToC
ok($toc->format(), <<EOT);
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ol>
<li><a href=#h-1>Chapter</a>
<ol>
<li><a href=#h-1.1>Paragraph</a>
</ol>
</ol>
<!-- End of generated Table of Contents -->
EOT
} # TestSpecifyNumberedList()
#--- TestUpdateFile() ---------------------------------------------------------
# function: Test 'HTML::TocUpdator->updateFile()'
sub TestUpdateFile {
# Assemble test file
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<html>
<body><!-- #BeginToc -->
foo
<!-- #EndToc -->
<!-- #BeginTocAnchorNameBegin -->bar<!-- #EndTocAnchorNameBegin --><h1>
Chapter
</h1><!-- #BeginTocAnchorNameEnd -->foo<!-- #EndTocAnchorNameEnd -->
</body>
</html>
EOT
# Create objects
my $toc = HTML::Toc->new();
my $tocUpdator = HTML::TocUpdator->new();
my $output;
# Generate ToC
$tocUpdator->updateFile($toc, $filename, {'output' => \$output});
# Test ToC
ok($output, <<EOT);
<html>
<body><!-- #BeginToc -->
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=#h-1> Chapter </a>
</ul>
<!-- End of generated Table of Contents -->
<!-- #EndToc -->
<!-- #BeginTocAnchorNameBegin --><a name=h-1><!-- #EndTocAnchorNameBegin --><h1>
Chapter
</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
</body>
</html>
EOT
} # TestUpdateFile()
#--- TestUsingCSS() -----------------------------------------------------------
# function: Test multiple ToCs
sub TestUsingCSS() {
# Create objects
my $toc = new HTML::Toc;
my $tocInsertor = new HTML::TocInsertor;
my $output;
$toc->setOptions({
'templateLevelBegin' => '"<ol class=toc_$groupId$level>\n"',
'templateLevelEnd' => '"</ol>\n"',
'doNumberToken' => 1,
'tokenToToc' => [{
'groupId' => 'appendix',
'tokenBegin' => '<h1>',
'numberingStyle' => 'upper-alpha'
}, {
'groupId' => 'appendix',
'tokenBegin' => '<h2>',
'level' => 2,
}]
});
$tocInsertor->insert($toc, <<EOT);
<html>
<head>
<style type="text/css">
ol.toc_appendix1 { list-style-type: upper-alpha }
</style>
</head>
<body>
<h1>Appendix</h1>
<h2>Appendix Paragraph</h2>
<h1>Appendix</h1>
<h2>Appendix Paragraph</h2>
</body>
</html>
EOT
# Insert ToC
$tocInsertor->insert($toc, <<EOT, {'output' => \$output});
<html>
<head>
<style type="text/css">
ol.toc_appendix1 { list-style-type: upper-alpha }
</style>
</head>
<body>
<h1>Appendix</h1>
<h2>Appendix Paragraph</h2>
<h1>Appendix</h1>
<h2>Appendix Paragraph</h2>
</body>
</html>
EOT
# Test ToC
ok($output, <<EOT);
<html>
<head>
<style type="text/css">
ol.toc_appendix1 { list-style-type: upper-alpha }
</style>
</head>
<body>
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ol class=toc_appendix1>
<li><a href=#appendix-A>Appendix</a>
<ol class=toc_appendix2>
<li><a href=#appendix-A.1>Appendix Paragraph</a>
</ol>
<li><a href=#appendix-B>Appendix</a>
<ol class=toc_appendix2>
<li><a href=#appendix-B.1>Appendix Paragraph</a>
</ol>
</ol>
<!-- End of generated Table of Contents -->
<a name=appendix-A><h1>A &nbsp;Appendix</h1></a>
<a name=appendix-A.1><h2>A.1 &nbsp;Appendix Paragraph</h2></a>
<a name=appendix-B><h1>B &nbsp;Appendix</h1></a>
<a name=appendix-B.1><h2>B.1 &nbsp;Appendix Paragraph</h2></a>
</body>
</html>
EOT
} # TestUsingCSS()
# Test 'extendFromFile()'
TestExtendFromFile();
# Test 'generateFromFile()'
TestGenerateFromFile();
# Test 'generateFromFiles()'
TestGenerateFromFiles();
# Test 'doUseGroupsGlobal = 0'
TestGlobalGroups0();
# Test 'doUseGroupsGlobal = 1'
TestGlobalGroups1();
# Test 'tocInsertor->insertIntoFile'
TestInsertIntoFile();
# Test 'tocUpdator->insertIntoFile'
TestInsertIntoFileUsingTocUpdator();
# Test additional 'appendix' group
TestMultipleGroupsAppendix();
# Test additional 'part' group
TestMultipleGroupsPart();
# Test multiple ToCs
TestMultipleTocs();
# Test specifying numbered list
TestSpecifyNumberedList();
# Test 'updateFile()'
TestUpdateFile();
# Test using CSS
TestUsingCSS();

View File

@@ -1,176 +0,0 @@
#--- propagate.t --------------------------------------------------------------
# function: Test ToC propagation.
use strict;
use Test;
BEGIN { plan tests => 10; }
use HTML::Toc;
use HTML::TocGenerator;
use HTML::TocInsertor;
my ($output, $content, $filename);
my $toc = HTML::Toc->new;
my $tocGenerator = HTML::TocGenerator->new;
my $tocInsertor = HTML::TocInsertor->new;
$toc->setOptions({
'doLinkToToken' => 0,
'levelIndent' => 0,
'insertionPoint' => 'before <h1>',
'header' => '',
'footer' => '',
});
BEGIN {
# Create test file
$filename = "file$$.htm";
die "$filename is already there" if -e $filename;
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<h1>Header</h1>
EOT
}
END {
# Remove test file
unlink($filename) or warn "Can't unlink $filename: $!";
}
#--- 1. propagate -------------------------------------------------------------
$tocInsertor->insert($toc, "<h1>Header</h1>", {'output' => \$output});
ok($output, "<ul>\n<li>Header\n</ul><h1>Header</h1>");
#--- 2. propagateFile ---------------------------------------------------------
$tocInsertor->insertIntoFile($toc, $filename, {'output' => \$output});
ok($output, "<ul>\n<li>Header\n</ul><h1>Header</h1>\n");
#--- 3. doLinkToToken -----------------------------------------------------
$toc->setOptions({'doLinkToToken' => 1});
$tocInsertor->insert($toc, "<h1>Header</h1>", {'output' => \$output});
ok("$output\n", <<'EOT');
<ul>
<li><a href=#h-1>Header</a>
</ul><a name=h-1><h1>Header</h1></a>
EOT
#--- 4. templateAnchorHrefBegin -----------------------------------------------
$toc->setOptions(
{'templateAnchorHrefBegin' => '"<$node${file}test${groupId}>"'}
);
$tocInsertor->insertIntoFile($toc, $filename, {'output' => \$output});
ok($output, "<ul>\n<li><1${filename}testh>Header</a>\n</ul><a name=h-1><h1>Header</h1></a>\n");
$toc->setOptions({'templateAnchorHrefBegin' => undef});
#--- 5. templateAnchorNameBegin -----------------------------------------------
$toc->setOptions({
'templateAnchorName' => '"$node$groupId"',
'templateAnchorNameBegin' => '"<$anchorName>"'
});
$tocInsertor->insert($toc, "<h1>Header</h1>", {'output' => \$output});
ok($output, "<ul>\n<li><a href=#1h>Header</a>\n</ul><1h><h1>Header</h1></a>");
$toc->setOptions({'templateAnchorName' => undef});
#--- 6. templateAnchorName function -------------------------------------------
sub AssembleAnchorName {
# Get arguments
my ($aFile, $aGroupId, $aLevel, $aNode) = @_;
# Return value
return $aFile . $aGroupId . $aLevel . $aNode;
} # AssembleAnchorName()
# Set options
$toc->setOptions({'templateAnchorNameBegin' => \&AssembleAnchorName});
# Propagate ToC
$tocInsertor->insert($toc, "<h1>Header</h1>", {'output' => \$output});
# Test ToC
ok($output, "<ul>\n<li><a href=#h-1>Header</a>\n</ul>h11<h1>Header</h1></a>");
# Restore options
$toc->setOptions({'templateAnchorNameBegin' => undef});
#--- 7. doNumberToken --------------------------------------------------------
# Set options
$toc->setOptions({'doNumberToken' => 1});
$tocInsertor->insert($toc, "<h1>Header</h1>", {'output' => \$output});
ok("$output\n", <<'EOT');
<ul>
<li><a href=#h-1>Header</a>
</ul><a name=h-1><h1>1 &nbsp;Header</h1></a>
EOT
# Reset options
$toc->setOptions({
'templateTokenNumber' => undef,
'doNumberToken' => 0
});
#--- 8. templateTokenNumber ---------------------------------------------------
# Set options
$toc->setOptions({
'templateTokenNumber' => '"-$node-"',
'doNumberToken' => 1
});
# Propagate ToC
$tocInsertor->insert($toc, "<h1>Header</h1>", {'output' => \$output});
# Test ToC
ok("$output\n", <<'EOT');
<ul>
<li><a href=#h-1>Header</a>
</ul><a name=h-1><h1>-1-Header</h1></a>
EOT
# Reset options
$toc->setOptions({
'doNumberToken' => 0,
'templateTokenNumber' => undef
});
#--- 9. numberingStyle --------------------------------------------------------
# Set options
$toc->setOptions({
'doNumberToken' => 1,
'tokenToToc' => [{
'level' => 1,
'tokenBegin' => '<h1>',
'numberingStyle' => 'lower-alpha'
}]
});
# Propagate ToC
$tocInsertor->insert($toc, "<h1>Header</h1>", {'output' => \$output});
# Test ToC
ok("$output\n", <<'EOT');
<ul>
<li><a href=#h-a>Header</a>
</ul><a name=h-a><h1>a &nbsp;Header</h1></a>
EOT
# Reset options
$toc->setOptions({
'doNumberToken' => 0,
'tokenToToc' => undef,
});
#--- 10. declaration pass through ---------------------------------------------
$tocInsertor->insert($toc, '<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><h1>Header</h1>', {'output' => \$output});
# Test ToC
ok($output, '<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><h1>Header</h1>');

View File

@@ -1,97 +0,0 @@
#--- manual.t -----------------------------------------------------------------
# function: Test HTML::ToC generating a manual.
use strict;
use Test;
BEGIN { plan tests => 1; }
use Data::Dumper;
use File::Find;
use HTML::Toc;
use HTML::TocGenerator;
use HTML::TocInsertor;
use HTML::TocUpdator;
# Create objects
my $toc = HTML::Toc->new();
my $tocGenerator = HTML::TocGenerator->new();
my @fileList;
#--- TestSiteMap() ------------------------------------------------------------
# function: Test specifying numbered list.
sub TestSiteMap {
# Set ToC options
$toc->setOptions({
'doLinkToFile' => 1,
'templateAnchorName' => '""',
'templateAnchorHref' => '"<a href=$file"."#".$groupId.$level.">"',
'doLinkTocToToken' => 1,
'tokenToToc' => [{
'groupId' => 'dir',
'level' => 1,
'tokenBegin' => '<title>',
'tokenEnd' => '</title>',
'fileSpec' => '\./[^/]+$'
}, {
'groupId' => 'dir',
'level' => 2,
'tokenBegin' => '<title>',
'tokenEnd' => '</title>',
'fileSpec' => '\./[^/]+?/[^/]+$'
}, {
'groupId' => 'dir',
'level' => 3,
'tokenBegin' => '<title>',
'tokenEnd' => '</title>',
'fileSpec' => '\./[^/]+?/[^/]+?/[^/]+$'
}]
});
# Change current directory
chdir("t/SiteMap");
# Find files, filling 'fileList'
find({wanted => \&WantedSiteMap, no_chdir => 1}, '.');
# Generate ToC of case-insensitively sorted file list
$tocGenerator->extendFromFile(
$toc, [sort {uc($a) cmp uc($b)} @fileList]
);
# Restore current directory
chdir("../..");
# Test ToC
ok($toc->format(), <<EOT);
<!-- Table of Contents generated by Perl - HTML::Toc -->
<ul>
<li><a href=./index.htm#>Main</a>
<ul>
<li><a href=./SubDir1/index.htm#>Sub1</a>
<ul>
<li><a href=./SubDir1/SubSubDir1/index.htm#>SubSub1</a>
</ul>
<li><a href=./SubDir2/index.htm#>Sub2</a>
<ul>
<li><a href=./SubDir2/SubSubDir1/index.htm#>SubSub1</a>
<li><a href=./SubDir2/SubSubDir2/index.htm#>SubSub2</a>
</ul>
<li><a href=./SubDir3/index.htm#>Sub3</a>
</ul>
</ul>
<!-- End of generated Table of Contents -->
EOT
} # TestSiteMap()
#--- WantedSiteMap() ----------------------------------------------------------
# function: 'Wanted' function, used by File::Find of 'TestSiteMap()'.
sub WantedSiteMap {
# Add file to 'fileList' if extension matches '.htm'
push (@fileList, $File::Find::name) if (m/\.htm$/);
} # WantedSiteMap()
# Test site map
TestSiteMap();

View File

@@ -1,114 +0,0 @@
#--- update.t -----------------------------------------------------------------
# function: Test ToC updating.
use strict;
use Test;
BEGIN { plan tests => 6; }
use HTML::Toc;
use HTML::TocUpdator;
my ($output, $output2, $content, $filename);
my $toc = HTML::Toc->new;
my $tocUpdator = HTML::TocUpdator->new;
$toc->setOptions({
'doLinkToToken' => 1,
'doNumberToken' => 1,
'levelIndent' => 0,
'insertionPoint' => 'before <h1>',
'header' => '',
'footer' => '',
});
BEGIN {
# Create test file
$filename = "file$$.htm";
die "$filename is already there" if -e $filename;
open(FILE, ">$filename") || die "Can't create $filename: $!";
print FILE <<'EOT'; close(FILE);
<h1>Header</h1>
EOT
}
END {
# Remove test file
unlink($filename) or warn "Can't unlink $filename: $!";
}
#--- 1. update ----------------------------------------------------------------
$tocUpdator->update($toc, "<h1>Header</h1>", {'output' => \$output});
ok("$output\n", <<'EOT');
<!-- #BeginToc --><ul>
<li><a href=#h-1>Header</a>
</ul><!-- #EndToc --><!-- #BeginTocAnchorNameBegin --><a name=h-1><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->1 &nbsp;<!-- #EndTocNumber -->Header</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
EOT
#--- 2. updateFile ------------------------------------------------------------
$tocUpdator->updateFile($toc, $filename, {'output' => \$output});
open(FILE, ">a.out1") || die "Can't create a.out1: $!";
print FILE $output; close(FILE);
$output2 = <<'EOT';
<!-- #BeginToc --><ul>
<li><a href=#h-1>Header</a>
</ul><!-- #EndToc --><!-- #BeginTocAnchorNameBegin --><a name=h-1><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->1 &nbsp;<!-- #EndTocNumber -->Header</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
EOT
open(FILE, ">a.out2") || die "Can't create a.out2: $!";
print FILE $output2; close(FILE);
ok($output, $output2);
#--- 3. insert ----------------------------------------------------------------
$tocUpdator->insert($toc, "<h1>Header</h1>", {'output' => \$output});
ok("$output\n", <<'EOT');
<!-- #BeginToc --><ul>
<li><a href=#h-1>Header</a>
</ul><!-- #EndToc --><!-- #BeginTocAnchorNameBegin --><a name=h-1><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->1 &nbsp;<!-- #EndTocNumber -->Header</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
EOT
#--- 4. insertIntoFile --------------------------------------------------------
$tocUpdator->insertIntoFile($toc, $filename, {'output' => \$output});
ok($output, <<'EOT');
<!-- #BeginToc --><ul>
<li><a href=#h-1>Header</a>
</ul><!-- #EndToc --><!-- #BeginTocAnchorNameBegin --><a name=h-1><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->1 &nbsp;<!-- #EndTocNumber -->Header</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
EOT
#--- 5. update twice ----------------------------------------------------------
$tocUpdator->update($toc, "<h1>Header</h1>", {'output' => \$output});
$tocUpdator->update($toc, $output, {'output' => \$output2});
ok("$output\n", <<'EOT');
<!-- #BeginToc --><ul>
<li><a href=#h-1>Header</a>
</ul><!-- #EndToc --><!-- #BeginTocAnchorNameBegin --><a name=h-1><!-- #EndTocAnchorNameBegin --><h1><!-- #BeginTocNumber -->1 &nbsp;<!-- #EndTocNumber -->Header</h1><!-- #BeginTocAnchorNameEnd --></a><!-- #EndTocAnchorNameEnd -->
EOT
#--- 6. tokens update begin & end ---------------------------------------------
$toc->setOptions({
'tokenUpdateBeginOfAnchorNameBegin' => '<tocAnchorNameBegin>',
'tokenUpdateEndOfAnchorNameBegin' => '</tocAnchorNameBegin>',
'tokenUpdateBeginOfAnchorNameEnd' => '<tocAnchorNameEnd>',
'tokenUpdateEndOfAnchorNameEnd' => '</tocAnchorNameEnd>',
'tokenUpdateBeginNumber' => '<tocNumber>',
'tokenUpdateEndNumber' => '</tocNumber>',
'tokenUpdateBeginToc' => '<toc>',
'tokenUpdateEndToc', => '</toc>'
});
$tocUpdator->update($toc, "<h1>Header</h1>", {'output' => \$output});
ok("$output\n", <<'EOT');
<toc><ul>
<li><a href=#h-1>Header</a>
</ul></toc><tocAnchorNameBegin><a name=h-1></tocAnchorNameBegin><h1><tocNumber>1 &nbsp;</tocNumber>Header</h1><tocAnchorNameEnd></a></tocAnchorNameEnd>
EOT

View File

@@ -1,36 +0,0 @@
PHP Markdown & Extra
Copyright (c) 2004-2008 Michel Fortin
<http://www.michelf.com/>
All rights reserved.
Based on Markdown
Copyright (c) 2003-2006 John Gruber
<http://daringfireball.net/>
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.
* 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.
* Neither the name "Markdown" 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 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.

View File

@@ -1,731 +0,0 @@
PHP Markdown Extra
==================
Version 1.2.3 - Wed 31 Dec 2008
by Michel Fortin
<http://www.michelf.com/>
based on Markdown by John Gruber
<http://daringfireball.net/>
Introduction
------------
This is a special version of PHP Markdown with extra features. See
<http://www.michelf.com/projects/php-markdown/extra/> for details.
Markdown is a text-to-HTML conversion tool for web writers. Markdown
allows you to write using an easy-to-read, easy-to-write plain text
format, then convert it to structurally valid XHTML (or HTML).
"Markdown" is two things: a plain text markup syntax, and a software
tool, written in Perl, that converts the plain text markup to HTML.
PHP Markdown is a port to PHP of the original Markdown program by
John Gruber.
PHP Markdown can work as a plug-in for WordPress and bBlog, as a
modifier for the Smarty templating engine, or as a remplacement for
textile formatting in any software that support textile.
Full documentation of Markdown's syntax is available on John's
Markdown page: <http://daringfireball.net/projects/markdown/>
Installation and Requirement
----------------------------
PHP Markdown requires PHP version 4.0.5 or later.
### WordPress ###
PHP Markdown works with [WordPress][wp], version 1.2 or later.
[wp]: http://wordpress.org/
1. To use PHP Markdown with WordPress, place the "makrdown.php" file
in the "plugins" folder. This folder is located inside
"wp-content" at the root of your site:
(site home)/wp-content/plugins/
2. Activate the plugin with the administrative interface of
WordPress. In the "Plugins" section you will now find Markdown.
To activate the plugin, click on the "Activate" button on the
same line than Markdown. Your entries will now be formatted by
PHP Markdown.
3. To post Markdown content, you'll first have to disable the
"visual" editor in the User section of WordPress.
You can configure PHP Markdown to not apply to the comments on your
WordPress weblog. See the "Configuration" section below.
It is not possible at this time to apply a different set of
filters to different entries. All your entries will be formated by
PHP Markdown. This is a limitation of WordPress. If your old entries
are written in HTML (as opposed to another formatting syntax, like
Textile), they'll probably stay fine after installing Markdown.
### bBlog ###
PHP Markdown also works with [bBlog][bb].
[bb]: http://www.bblog.com/
To use PHP Markdown with bBlog, rename "markdown.php" to
"modifier.markdown.php" and place the file in the "bBlog_plugins"
folder. This folder is located inside the "bblog" directory of
your site, like this:
(site home)/bblog/bBlog_plugins/modifier.markdown.php
Select "Markdown" as the "Entry Modifier" when you post a new
entry. This setting will only apply to the entry you are editing.
### Replacing Textile in TextPattern ###
[TextPattern][tp] use [Textile][tx] to format your text. You can
replace Textile by Markdown in TextPattern without having to change
any code by using the *Texitle Compatibility Mode*. This may work
with other software that expect Textile too.
[tx]: http://www.textism.com/tools/textile/
[tp]: http://www.textpattern.com/
1. Rename the "markdown.php" file to "classTextile.php". This will
make PHP Markdown behave as if it was the actual Textile parser.
2. Replace the "classTextile.php" file TextPattern installed in your
web directory. It can be found in the "lib" directory:
(site home)/textpattern/lib/
Contrary to Textile, Markdown does not convert quotes to curly ones
and does not convert multiple hyphens (`--` and `---`) into en- and
em-dashes. If you use PHP Markdown in Textile Compatibility Mode, you
can solve this problem by installing the "smartypants.php" file from
[PHP SmartyPants][psp] beside the "classTextile.php" file. The Textile
Compatibility Mode function will use SmartyPants automatically without
further modification.
[psp]: http://www.michelf.com/projects/php-smartypants/
### In Your Own Programs ###
You can use PHP Markdown easily in your current PHP program. Simply
include the file and then call the Markdown function on the text you
want to convert:
include_once "markdown.php";
$my_html = Markdown($my_text);
If you wish to use PHP Markdown with another text filter function
built to parse HTML, you should filter the text *after* the Markdown
function call. This is an example with [PHP SmartyPants][psp]:
$my_html = SmartyPants(Markdown($my_text));
### With Smarty ###
If your program use the [Smarty][sm] template engine, PHP Markdown
can now be used as a modifier for your templates. Rename "markdown.php"
to "modifier.markdown.php" and put it in your smarty plugins folder.
[sm]: http://smarty.php.net/
If you are using MovableType 3.1 or later, the Smarty plugin folder is
located at `(MT CGI root)/php/extlib/smarty/plugins`. This will allow
Markdown to work on dynamic pages.
### Updating Markdown in Other Programs ###
Many web applications now ship with PHP Markdown, or have plugins to
perform the conversion to HTML. You can update PHP Markdown -- or
replace it with PHP Markdown Extra -- in many of these programs by
swapping the old "markdown.php" file for the new one.
Here is a short non-exhaustive list of some programs and where they
hide the "markdown.php" file.
| Program | Path to Markdown
| ------- | ----------------
| [Pivot][] | `(site home)/pivot/includes/markdown/`
If you're unsure if you can do this with your application, ask the
developer, or wait for the developer to update his application or
plugin with the new version of PHP Markdown.
[Pivot]: http://pivotlog.net/
Configuration
-------------
By default, PHP Markdown produces XHTML output for tags with empty
elements. E.g.:
<br />
Markdown can be configured to produce HTML-style tags; e.g.:
<br>
To do this, you must edit the "MARKDOWN_EMPTY_ELEMENT_SUFFIX"
definition below the "Global default settings" header at the start of
the "markdown.php" file.
### WordPress-Specific Settings ###
By default, the Markdown plugin applies to both posts and comments on
your WordPress weblog. To deactivate one or the other, edit the
`MARKDOWN_WP_POSTS` or `MARKDOWN_WP_COMMENTS` definitions under the
"WordPress settings" header at the start of the "markdown.php" file.
Bugs
----
To file bug reports please send email to:
<michel.fortin@michelf.com>
Please include with your report: (1) the example input; (2) the output you
expected; (3) the output PHP Markdown actually produced.
Version History
---------------
Extra 1.2.3 (31 Dec 2008):
* In WordPress pages featuring more than one post, footnote id prefixes are
now automatically applied with the current post ID to avoid clashes
between footnotes belonging to different posts.
* Fix for a bug introduced in Extra 1.2 where block-level HTML tags where
not detected correctly, thus the addition of erroneous `<p>` tags and
interpretation of their content as Markdown-formatted instead of
HTML-formatted.
Extra 1.2.2 (21 Jun 2008):
* Fixed a problem where abbreviation definitions, footnote
definitions and link references were stripped inside
fenced code blocks.
* Fixed a bug where characters such as `"` in abbreviation
definitions weren't properly encoded to HTML entities.
* Fixed a bug where double quotes `"` were not correctly encoded
as HTML entities when used inside a footnote reference id.
1.0.1m (21 Jun 2008):
* Lists can now have empty items.
* Rewrote the emphasis and strong emphasis parser to fix some issues
with odly placed and overlong markers.
Extra 1.2.1 (27 May 2008):
* Fixed a problem where Markdown headers and horizontal rules were
transformed into their HTML equivalent inside fenced code blocks.
Extra 1.2 (11 May 2008):
* Added fenced code block syntax which don't require indentation
and can start and end with blank lines. A fenced code block
starts with a line of consecutive tilde (~) and ends on the
next line with the same number of consecutive tilde. Here's an
example:
~~~~~~~~~~~~
Hello World!
~~~~~~~~~~~~
* Rewrote parts of the HTML block parser to better accomodate
fenced code blocks.
* Footnotes may now be referenced from within another footnote.
* Added programatically-settable parser property `predef_attr` for
predefined attribute definitions.
* Fixed an issue where an indented code block preceded by a blank
line containing some other whitespace would confuse the HTML
block parser into creating an HTML block when it should have
been code.
1.0.1l (11 May 2008):
* Now removing the UTF-8 BOM at the start of a document, if present.
* Now accepting capitalized URI schemes (such as HTTP:) in automatic
links, such as `<HTTP://EXAMPLE.COM/>`.
* Fixed a problem where `<hr@example.com>` was seen as a horizontal
rule instead of an automatic link.
* Fixed an issue where some characters in Markdown-generated HTML
attributes weren't properly escaped with entities.
* Fix for code blocks as first element of a list item. Previously,
this didn't create any code block for item 2:
* Item 1 (regular paragraph)
* Item 2 (code block)
* A code block starting on the second line of a document wasn't seen
as a code block. This has been fixed.
* Added programatically-settable parser properties `predef_urls` and
`predef_titles` for predefined URLs and titles for reference-style
links. To use this, your PHP code must call the parser this way:
$parser = new Markdwon_Parser;
$parser->predef_urls = array('linkref' => 'http://example.com');
$html = $parser->transform($text);
You can then use the URL as a normal link reference:
[my link][linkref]
[my link][linkRef]
Reference names in the parser properties *must* be lowercase.
Reference names in the Markdown source may have any case.
* Added `setup` and `teardown` methods which can be used by subclassers
as hook points to arrange the state of some parser variables before and
after parsing.
Extra 1.1.7 (26 Sep 2007):
1.0.1k (26 Sep 2007):
* Fixed a problem introduced in 1.0.1i where three or more identical
uppercase letters, as well as a few other symbols, would trigger
a horizontal line.
Extra 1.1.6 (4 Sep 2007):
1.0.1j (4 Sep 2007):
* Fixed a problem introduced in 1.0.1i where the closing `code` and
`pre` tags at the end of a code block were appearing in the wrong
order.
* Overriding configuration settings by defining constants from an
external before markdown.php is included is now possible without
producing a PHP warning.
Extra 1.1.5 (31 Aug 2007):
1.0.1i (31 Aug 2007):
* Fixed a problem where an escaped backslash before a code span
would prevent the code span from being created. This should now
work as expected:
Litteral backslash: \\`code span`
* Overall speed improvements, especially with long documents.
Extra 1.1.4 (3 Aug 2007):
1.0.1h (3 Aug 2007):
* Added two properties (`no_markup` and `no_entities`) to the parser
allowing HTML tags and entities to be disabled.
* Fix for a problem introduced in 1.0.1g where posting comments in
WordPress would trigger PHP warnings and cause some markup to be
incorrectly filtered by the kses filter in WordPress.
Extra 1.1.3 (3 Jul 2007):
* Fixed a performance problem when parsing some invalid HTML as an HTML
block which was resulting in too much recusion and a segmentation fault
for long documents.
* The markdown="" attribute now accepts unquoted values.
* Fixed an issue where underscore-emphasis didn't work when applied on the
first or the last word of an element having the markdown="1" or
markdown="span" attribute set unless there was some surrounding whitespace.
This didn't work:
<p markdown="1">_Hello_ _world_</p>
Now it does produce emphasis as expected.
* Fixed an issue preventing footnotes from working when the parser's
footnote id prefix variable (fn_id_prefix) is not empty.
* Fixed a performance problem where the regular expression for strong
emphasis introduced in version 1.1 could sometime be long to process,
give slightly wrong results, and in some circumstances could remove
entirely the content for a whole paragraph.
* Fixed an issue were abbreviations tags could be incorrectly added
inside URLs and title of links.
* Placing footnote markers inside a link, resulting in two nested links, is
no longer allowed.
1.0.1g (3 Jul 2007):
* Fix for PHP 5 compiled without the mbstring module. Previous fix to
calculate the length of UTF-8 strings in `detab` when `mb_strlen` is
not available was only working with PHP 4.
* Fixed a problem with WordPress 2.x where full-content posts in RSS feeds
were not processed correctly by Markdown.
* Now supports URLs containing literal parentheses for inline links
and images, such as:
[WIMP](http://en.wikipedia.org/wiki/WIMP_(computing))
Such parentheses may be arbitrarily nested, but must be
balanced. Unbalenced parentheses are allowed however when the URL
when escaped or when the URL is enclosed in angle brakets `<>`.
* Fixed a performance problem where the regular expression for strong
emphasis introduced in version 1.0.1d could sometime be long to process,
give slightly wrong results, and in some circumstances could remove
entirely the content for a whole paragraph.
* Some change in version 1.0.1d made possible the incorrect nesting of
anchors within each other. This is now fixed.
* Fixed a rare issue where certain MD5 hashes in the content could
be changed to their corresponding text. For instance, this:
The MD5 value for "+" is "26b17225b626fb9238849fd60eabdf60".
was incorrectly changed to this in previous versions of PHP Markdown:
<p>The MD5 value for "+" is "+".</p>
* Now convert escaped characters to their numeric character
references equivalent.
This fix an integration issue with SmartyPants and backslash escapes.
Since Markdown and SmartyPants have some escapable characters in common,
it was sometime necessary to escape them twice. Previously, two
backslashes were sometime required to prevent Markdown from "eating" the
backslash before SmartyPants sees it:
Here are two hyphens: \\--
Now, only one backslash will do:
Here are two hyphens: \--
Extra 1.1.2 (7 Feb 2007)
* Fixed an issue where headers preceded too closely by a paragraph
(with no blank line separating them) where put inside the paragraph.
* Added the missing TextileRestricted method that was added to regular
PHP Markdown since 1.0.1d but which I forgot to add to Extra.
1.0.1f (7 Feb 2007):
* Fixed an issue with WordPress where manually-entered excerpts, but
not the auto-generated ones, would contain nested paragraphs.
* Fixed an issue introduced in 1.0.1d where headers and blockquotes
preceded too closely by a paragraph (not separated by a blank line)
where incorrectly put inside the paragraph.
* Fixed an issue introduced in 1.0.1d in the tokenizeHTML method where
two consecutive code spans would be merged into one when together they
form a valid tag in a multiline paragraph.
* Fixed an long-prevailing issue where blank lines in code blocks would
be doubled when the code block is in a list item.
This was due to the list processing functions relying on artificially
doubled blank lines to correctly determine when list items should
contain block-level content. The list item processing model was thus
changed to avoid the need for double blank lines.
* Fixed an issue with `<% asp-style %>` instructions used as inline
content where the opening `<` was encoded as `&lt;`.
* Fixed a parse error occuring when PHP is configured to accept
ASP-style delimiters as boundaries for PHP scripts.
* Fixed a bug introduced in 1.0.1d where underscores in automatic links
got swapped with emphasis tags.
Extra 1.1.1 (28 Dec 2006)
* Fixed a problem where whitespace at the end of the line of an atx-style
header would cause tailing `#` to appear as part of the header's content.
This was caused by a small error in the regex that handles the definition
for the id attribute in PHP Markdown Extra.
* Fixed a problem where empty abbreviations definitions would eat the
following line as its definition.
* Fixed an issue with calling the Markdown parser repetitivly with text
containing footnotes. The footnote hashes were not reinitialized properly.
1.0.1e (28 Dec 2006)
* Added support for internationalized domain names for email addresses in
automatic link. Improved the speed at which email addresses are converted
to entities. Thanks to Milian Wolff for his optimisations.
* Made deterministic the conversion to entities of email addresses in
automatic links. This means that a given email address will always be
encoded the same way.
* PHP Markdown will now use its own function to calculate the length of an
UTF-8 string in `detab` when `mb_strlen` is not available instead of
giving a fatal error.
Extra 1.1 (1 Dec 2006)
* Added a syntax for footnotes.
* Added an experimental syntax to define abbreviations.
1.0.1d (1 Dec 2006)
* Fixed a bug where inline images always had an empty title attribute. The
title attribute is now present only when explicitly defined.
* Link references definitions can now have an empty title, previously if the
title was defined but left empty the link definition was ignored. This can
be useful if you want an empty title attribute in images to hide the
tooltip in Internet Explorer.
* Made `detab` aware of UTF-8 characters. UTF-8 multi-byte sequences are now
correctly mapped to one character instead of the number of bytes.
* Fixed a small bug with WordPress where WordPress' default filter `wpautop`
was not properly deactivated on comment text, resulting in hard line breaks
where Markdown do not prescribes them.
* Added a `TextileRestrited` method to the textile compatibility mode. There
is no restriction however, as Markdown does not have a restricted mode at
this point. This should make PHP Markdown work again in the latest
versions of TextPattern.
* Converted PHP Markdown to a object-oriented design.
* Changed span and block gamut methods so that they loop over a
customizable list of methods. This makes subclassing the parser a more
interesting option for creating syntax extensions.
* Also added a "document" gamut loop which can be used to hook document-level
methods (like for striping link definitions).
* Changed all methods which were inserting HTML code so that they now return
a hashed representation of the code. New methods `hashSpan` and `hashBlock`
are used to hash respectivly span- and block-level generated content. This
has a couple of significant effects:
1. It prevents invalid nesting of Markdown-generated elements which
could occur occuring with constructs like `*something [link*][1]`.
2. It prevents problems occuring with deeply nested lists on which
paragraphs were ill-formed.
3. It removes the need to call `hashHTMLBlocks` twice during the the
block gamut.
Hashes are turned back to HTML prior output.
* Made the block-level HTML parser smarter using a specially-crafted regular
expression capable of handling nested tags.
* Solved backtick issues in tag attributes by rewriting the HTML tokenizer to
be aware of code spans. All these lines should work correctly now:
<span attr='`ticks`'>bar</span>
<span attr='``double ticks``'>bar</span>
`<test a="` content of attribute `">`
* Changed the parsing of HTML comments to match simply from `<!--` to `-->`
instead using of the more complicated SGML-style rule with paired `--`.
This is how most browsers parse comments and how XML defines them too.
* `<address>` has been added to the list of block-level elements and is now
treated as an HTML block instead of being wrapped within paragraph tags.
* Now only trim trailing newlines from code blocks, instead of trimming
all trailing whitespace characters.
* Fixed bug where this:
[text](http://m.com "title" )
wasn't working as expected, because the parser wasn't allowing for spaces
before the closing paren.
* Filthy hack to support markdown='1' in div tags.
* _DoAutoLinks() now supports the 'dict://' URL scheme.
* PHP- and ASP-style processor instructions are now protected as
raw HTML blocks.
<? ... ?>
<% ... %>
* Fix for escaped backticks still triggering code spans:
There are two raw backticks here: \` and here: \`, not a code span
Extra 1.0 - 5 September 2005
* Added support for setting the id attributes for headers like this:
Header 1 {#header1}
========
## Header 2 ## {#header2}
This only work only for headers for now.
* Tables will now work correctly as the first element of a definition
list. For example, this input:
Term
: Header | Header
------- | -------
Cell | Cell
used to produce no definition list and a table where the first
header was named ": Header". This is now fixed.
* Fix for a problem where a paragraph following a table was not
placed between `<p>` tags.
Extra 1.0b4 - 1 August 2005
* Fixed some issues where whitespace around HTML blocks were trigging
empty paragraph tags.
* Fixed an HTML block parsing issue that would cause a block element
following a code span or block with unmatched opening bracket to be
placed inside a paragraph.
* Removed some PHP notices that could appear when parsing definition
lists and tables with PHP notice reporting flag set.
Extra 1.0b3 - 29 July 2005
* Definition lists now require a blank line before each term. Solves
an ambiguity where the last line of lazy-indented definitions could
be mistaken by PHP Markdown as a new term in the list.
* Definition lists now support multiple terms per definition.
* Some special tags were replaced in the output by their md5 hash
key. Things such as this now work as expected:
## Header <?php echo $number ?> ##
Extra 1.0b2 - 26 July 2005
* Definition lists can now take two or more definitions for one term.
This should have been the case before, but a bug prevented this
from working right.
* Fixed a problem where single column table with a pipe only at the
end where not parsed as table. Here is such a table:
| header
| ------
| cell
* Fixed problems with empty cells in the first column of a table with
no leading pipe, like this one:
header | header
------ | ------
| cell
* Code spans containing pipes did not within a table. This is now
fixed by parsing code spans before splitting rows into cells.
* Added the pipe character to the backlash escape character lists.
Extra 1.0b1 (25 Jun 2005)
* First public release of PHP Markdown Extra.
Copyright and License
---------------------
Copyright (c) 2004-2005 Michel Fortin
<http://www.michelf.com/>
All rights reserved.
Based on Markdown
Copyright (c) 2003-2005 John Gruber
<http://daringfireball.net/>
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.
* 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.
* Neither the name "Markdown" 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 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.

File diff suppressed because it is too large Load Diff

View File

@@ -1,394 +0,0 @@
PHP SmartyPants
===============
Version 1.5.1e - Fri 9 Dec 2005
by Michel Fortin
<http://www.michelf.com/>
based on work by John Gruber
<http://daringfireball.net/>
Introduction
------------
PHP SmartyPants is a port to PHP of the original SmartyPants written
in Perl by John Gruber.
PHP SmartyPants is a free web publishing plug-in for WordPress and
Smarty template engine that easily translates plain ASCII punctuation
characters into "smart" typographic punctuation HTML entities.
SmartyPants can also be invoked as a standalone PHP function.
SmartyPants can perform the following transformations:
* Straight quotes (`"` and `'`) into "curly" quote HTML entities
* Backtick-style quotes (` ``like this'' `) into "curly" quote HTML
entities
* Dashes (`--` and `---`) into en- and em-dash entities
* Three consecutive dots (`...`) into an ellipsis entity
This means you can write, edit, and save using plain old ASCII straight
quotes, plain dashes, and plain dots, but your published posts (and
final HTML output) will appear with smart quotes, em-dashes, and proper
ellipses.
SmartyPants does not modify characters within `<pre>`, `<code>`,
`<kbd>`, or `<script>` tag blocks. Typically, these tags are used to
display text where smart quotes and other "smart punctuation" would not
be appropriate, such as source code or example markup.
### Backslash Escapes ###
If you need to use literal straight quotes (or plain hyphens and
periods), SmartyPants accepts the following backslash escape sequences
to force non-smart punctuation. It does so by transforming the escape
sequence into a decimal-encoded HTML entity:
Escape Value Character
------ ----- ---------
\\ &#92; \
\" &#34; "
\' &#39; '
\. &#46; .
\- &#45; -
\` &#96; `
This is useful, for example, when you want to use straight quotes as
foot and inch marks:
6\'2\" tall
translates into:
6&#39;2&#34; tall
in SmartyPants's HTML output. Which, when rendered by a web browser,
looks like:
6'2" tall
Installation and Requirement
----------------------------
PHP SmartyPants require PHP version 4.0.5 or later.
### WordPress ###
WordPress already include a filter called "Texturize" with the same
goal as SmartyPants. You could still find some usefulness to
PHP SmartyPants if you are not happy enough with the standard algorithm.
PHP SmartyPants works with [WordPress][wp], version 1.2 or later.
[wp]: http://wordpress.org/
1. To use PHP SmartyPants with WordPress, place the "smartypants.php"
file in the "plugins" folder. This folder is hidden inside
"wp-content" at the root of your site:
(site home)/wp-content/plugins/smartypants.php
2. Activate the plugin with the administrative interface of WordPress.
In the "Plugins" section you will now find SmartyPants. To activate
the plugin, click on the "Activate" button on the same line than
SmartyPants. Your entries will now be filtered by PHP SmartyPants.
Note: It is not possible at this time to apply a different set of
filters to different entries. All your entries will be filtered by
PHP SmartyPants if the plugin is active. This is currently a limitation
of WordPress.
### Blosxom ###
SmartyPants works with Blosxom version 2.0 or later.
1. Rename the "SmartyPants.pl" plug-in to "SmartyPants" (case is
important). Movable Type requires plug-ins to have a ".pl"
extension; Blosxom forbids it (at least as of this writing).
2. Copy the "SmartyPants" plug-in file to your Blosxom plug-ins folder.
If you're not sure where your Blosxom plug-ins folder is, see the
Blosxom documentation for information.
3. That's it. The entries in your weblog should now automatically have
SmartyPants's default transformations applied.
4. If you wish to configure SmartyPants's behavior, open the
"SmartyPants" plug-in, and edit the value of the `$smartypants_attr`
configuration variable, located near the top of the script. The
default value is 1; see "Options", below, for the full list of
supported values.
### In your programs ###
You can use PHP SmartyPants easily in your current PHP program. Simply
include the file and then call the `SmartyPants` function on the text
you want to convert:
include_once "smartypants.php";
$my_text = SmartyPants($my_text);
### With Smarty ###
If your program use the [Smarty][sm] template engine, PHP SmartyPants
can now be used as a modifier for your templates. Rename
"smartypants.php" to "modifier.smartypants.php" and put it in your
smarty plugins folder.
[sm]: http://smarty.php.net/
Options and Configuration
-------------------------
Settings are specified by editing the value of the `$smartypants_attr`
variable in the "smartypants.php" file. For users of the Smarty template
engine, the "smartypants" modifier also takes an optional attribute where
you can specify configuration options, like this:
`{$var|smartypants:1}` (where "1" is the configuration option).
Numeric values are the easiest way to configure SmartyPants's behavior:
"0"
Suppress all transformations. (Do nothing.)
"1"
Performs default SmartyPants transformations: quotes (including
backticks-style), em-dashes, and ellipses. `--` (dash dash) is
used to signify an em-dash; there is no support for en-dashes.
"2"
Same as smarty_pants="1", except that it uses the old-school
typewriter shorthand for dashes: `--` (dash dash) for en-dashes,
`---` (dash dash dash) for em-dashes.
"3"
Same as smarty_pants="2", but inverts the shorthand for dashes: `--`
(dash dash) for em-dashes, and `---` (dash dash dash) for en-dashes.
"-1"
Stupefy mode. Reverses the SmartyPants transformation process,
turning the HTML entities produced by SmartyPants into their ASCII
equivalents. E.g. `&#8220;` is turned into a simple double-quote
(`"`), `&#8212;` is turned into two dashes, etc. This is useful if you
wish to suppress smart punctuation in specific pages, such as
RSS feeds.
The following single-character attribute values can be combined to
toggle individual transformations from within the smarty_pants
attribute. For example, to educate normal quotes and em-dashes, but not
ellipses or backticks-style quotes:
$smartypants_attr = "qd";
Or inside a Smarty template:
{$var|smartypants:"qd"}
"q"
Educates normal quote characters: (`"`) and (`'`).
"b"
Educates ` ``backticks'' ` double quotes.
"B"
Educates backticks-style double quotes and ` `single' ` quotes.
"d"
Educates em-dashes.
"D"
Educates em-dashes and en-dashes, using old-school typewriter
shorthand: (dash dash) for en-dashes, (dash dash dash) for
em-dashes.
"i"
Educates em-dashes and en-dashes, using inverted old-school
typewriter shorthand: (dash dash) for em-dashes, (dash dash dash)
for en-dashes.
"e"
Educates ellipses.
"w"
Translates any instance of `&quot;` into a normal double-quote
character. This should be of no interest to most people, but of
particular interest to anyone who writes their posts using
Dreamweaver, as Dreamweaver inexplicably uses this entity to
represent a literal double-quote character. SmartyPants only
educates normal quotes, not entities (because ordinarily, entities
are used for the explicit purpose of representing the specific
character they represent). The "w" option must be used in
conjunction with one (or both) of the other quote options ("q" or
"b"). Thus, if you wish to apply all SmartyPants transformations
(quotes, en- and em-dashes, and ellipses) and also translate
`&quot;` entities into regular quotes so SmartyPants can educate
them, you should pass the following to the smarty_pants attribute:
$smartypants_attr = "qDew";
Inside a Smarty template, this will be:
{$var|smartypants:"qDew"}
Caveats
-------
### Why You Might Not Want to Use Smart Quotes in Your Weblog ###
For one thing, you might not care.
Most normal, mentally stable individuals do not take notice of proper
typographic punctuation. Many design and typography nerds, however,
break out in a nasty rash when they encounter, say, a restaurant sign
that uses a straight apostrophe to spell "Joe's".
If you're the sort of person who just doesn't care, you might well want
to continue not caring. Using straight quotes -- and sticking to the
7-bit ASCII character set in general -- is certainly a simpler way to
live.
Even if you *do* care about accurate typography, you still might want to
think twice before educating the quote characters in your weblog. One
side effect of publishing curly quote HTML entities is that it makes
your weblog a bit harder for others to quote from using copy-and-paste.
What happens is that when someone copies text from your blog, the copied
text contains the 8-bit curly quote characters (as well as the 8-bit
characters for em-dashes and ellipses, if you use these options). These
characters are not standard across different text encoding methods,
which is why they need to be encoded as HTML entities.
People copying text from your weblog, however, may not notice that
you're using curly quotes, and they'll go ahead and paste the unencoded
8-bit characters copied from their browser into an email message or
their own weblog. When pasted as raw "smart quotes", these characters
are likely to get mangled beyond recognition.
That said, my own opinion is that any decent text editor or email client
makes it easy to stupefy smart quote characters into their 7-bit
equivalents, and I don't consider it my problem if you're using an
indecent text editor or email client.
### Algorithmic Shortcomings ###
One situation in which quotes will get curled the wrong way is when
apostrophes are used at the start of leading contractions. For example:
'Twas the night before Christmas.
In the case above, SmartyPants will turn the apostrophe into an opening
single-quote, when in fact it should be a closing one. I don't think
this problem can be solved in the general case -- every word processor
I've tried gets this wrong as well. In such cases, it's best to use the
proper HTML entity for closing single-quotes (`&#8217;` or `&rsquo;`) by
hand.
Bugs
----
To file bug reports or feature requests (other than topics listed in the
Caveats section above) please send email to:
<michel.fortin@michelf.com>
If the bug involves quotes being curled the wrong way, please send
example text to illustrate.
Version History
---------------
1.5.1e (9 Dec 2005)
* Corrected a bug that prevented special characters from being
escaped.
1.5.1d (6 Jun 2005)
* Correct a small bug in `_TokenizeHTML` where a Doctype declaration
was not seen as HTML, making curly quotes inside it.
1.5.1c (13 Dec 2004)
* Changed a regular expression in `_TokenizeHTML` that could lead
to a segmentation fault with PHP 4.3.8 on Linux.
1.5.1b (6 Sep 2004)
* Corrected a problem with quotes immediately following a dash
with no space between: `Text--"quoted text"--text.`
* PHP SmartyPants can now be used as a modifier by the Smarty
template engine. Rename the file to "modifier.smartypants.php"
and put it in your smarty plugins folder.
* Replaced a lot of spaces characters by tabs, saving about 4 KB.
1.5.1a (30 Jun 2004)
* PHP Markdown and PHP Smartypants now share the same `_TokenizeHTML`
function when loaded simultanously.
* Changed the internals of `_TokenizeHTML` to lower the PHP version
requirement to PHP 4.0.5.
1.5.1 (6 Jun 2004)
* Initial release of PHP SmartyPants, based on version 1.5.1 of the
original SmartyPants written in Perl.
Copyright and License
---------------------
Copyright (c) 2005 Michel Fortin
<http://www.michelf.com/>
All rights reserved.
Copyright (c) 2003-2004 John Gruber
<http://daringfireball.net/>
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.
* 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.
* Neither the name "SmartyPants" 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 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.

View File

@@ -1,860 +0,0 @@
<?php
#
# SmartyPants - Smart punctuation for web sites
#
# by John Gruber
# <http://daringfireball.net>
#
# PHP port by Michel Fortin
# <http://www.michelf.com/>
#
# Copyright (c) 2003-2004 John Gruber
# Copyright (c) 2004-2005 Michel Fortin
#
global $SmartyPantsPHPVersion, $SmartyPantsSyntaxVersion,
$smartypants_attr, $sp_tags_to_skip;
$SmartyPantsPHPVersion = '1.5.1e'; # Fru 9 Dec 2005
$SmartyPantsSyntaxVersion = '1.5.1'; # Fri 12 Mar 2004
# Configurable variables:
$smartypants_attr = "1"; # Change this to configure.
# 1 => "--" for em-dashes; no en-dash support
# 2 => "---" for em-dashes; "--" for en-dashes
# 3 => "--" for em-dashes; "---" for en-dashes
# See docs for more configuration options.
# Globals:
$sp_tags_to_skip = '<(/?)(?:pre|code|kbd|script|math)[\s>]';
# -- WordPress plugin interface -----------------------------------------------
/*
Plugin Name: SmartyPants
Plugin URI: http://www.michelf.com/projects/php-smartypants/
Description: SmartyPants is a web publishing utility that translates plain ASCII punctuation characters into &#8220;smart&#8221; typographic punctuation HTML entities. This plugin <strong>replace the default WordPress Texturize algorithm</strong> for the content and the title of your posts, the comments body and author name, and everywhere else Texturize normally apply. Based on the original Perl version by <a href="http://daringfireball.net/">John Gruber</a>.
Version: 1.5.1e
Author: Michel Fortin
Author URI: http://www.michelf.com/
*/
if (isset($wp_version)) {
# Remove default Texturize filter that would conflict with SmartyPants.
remove_filter('category_description', 'wptexturize');
remove_filter('list_cats', 'wptexturize');
remove_filter('comment_author', 'wptexturize');
remove_filter('comment_text', 'wptexturize');
remove_filter('single_post_title', 'wptexturize');
remove_filter('the_title', 'wptexturize');
remove_filter('the_content', 'wptexturize');
remove_filter('the_excerpt', 'wptexturize');
# Add SmartyPants filter with priority 10 (same as Texturize).
add_filter('category_description', 'SmartyPants', 10);
add_filter('list_cats', 'SmartyPants', 10);
add_filter('comment_author', 'SmartyPants', 10);
add_filter('comment_text', 'SmartyPants', 10);
add_filter('single_post_title', 'SmartyPants', 10);
add_filter('the_title', 'SmartyPants', 10);
add_filter('the_content', 'SmartyPants', 10);
add_filter('the_excerpt', 'SmartyPants', 10);
}
# -- Smarty Modifier Interface ------------------------------------------------
function smarty_modifier_smartypants($text, $attr = NULL) {
return SmartyPants($text, $attr);
}
function SmartyPants($text, $attr = NULL, $ctx = NULL) {
global $smartypants_attr, $sp_tags_to_skip;
# Paramaters:
$text; # text to be parsed
$attr; # value of the smart_quotes="" attribute
$ctx; # MT context object (unused)
if ($attr == NULL) $attr = $smartypants_attr;
# Options to specify which transformations to make:
$do_stupefy = FALSE;
$convert_quot = 0; # should we translate &quot; entities into normal quotes?
# Parse attributes:
# 0 : do nothing
# 1 : set all
# 2 : set all, using old school en- and em- dash shortcuts
# 3 : set all, using inverted old school en and em- dash shortcuts
#
# q : quotes
# b : backtick quotes (``double'' only)
# B : backtick quotes (``double'' and `single')
# d : dashes
# D : old school dashes
# i : inverted old school dashes
# e : ellipses
# w : convert &quot; entities to " for Dreamweaver users
if ($attr == "0") {
# Do nothing.
return $text;
}
else if ($attr == "1") {
# Do everything, turn all options on.
$do_quotes = 1;
$do_backticks = 1;
$do_dashes = 1;
$do_ellipses = 1;
}
else if ($attr == "2") {
# Do everything, turn all options on, use old school dash shorthand.
$do_quotes = 1;
$do_backticks = 1;
$do_dashes = 2;
$do_ellipses = 1;
}
else if ($attr == "3") {
# Do everything, turn all options on, use inverted old school dash shorthand.
$do_quotes = 1;
$do_backticks = 1;
$do_dashes = 3;
$do_ellipses = 1;
}
else if ($attr == "-1") {
# Special "stupefy" mode.
$do_stupefy = 1;
}
else {
$chars = preg_split('//', $attr);
foreach ($chars as $c){
if ($c == "q") { $do_quotes = 1; }
else if ($c == "b") { $do_backticks = 1; }
else if ($c == "B") { $do_backticks = 2; }
else if ($c == "d") { $do_dashes = 1; }
else if ($c == "D") { $do_dashes = 2; }
else if ($c == "i") { $do_dashes = 3; }
else if ($c == "e") { $do_ellipses = 1; }
else if ($c == "w") { $convert_quot = 1; }
else {
# Unknown attribute option, ignore.
}
}
}
$tokens = _TokenizeHTML($text);
$result = '';
$in_pre = 0; # Keep track of when we're inside <pre> or <code> tags.
$prev_token_last_char = ""; # This is a cheat, used to get some context
# for one-character tokens that consist of
# just a quote char. What we do is remember
# the last character of the previous text
# token, to use as context to curl single-
# character quote tokens correctly.
foreach ($tokens as $cur_token) {
if ($cur_token[0] == "tag") {
# Don't mess with quotes inside tags.
$result .= $cur_token[1];
if (preg_match("@$sp_tags_to_skip@", $cur_token[1], $matches)) {
$in_pre = isset($matches[1]) && $matches[1] == '/' ? 0 : 1;
}
} else {
$t = $cur_token[1];
$last_char = substr($t, -1); # Remember last char of this token before processing.
if (! $in_pre) {
$t = ProcessEscapes($t);
if ($convert_quot) {
$t = preg_replace('/&quot;/', '"', $t);
}
if ($do_dashes) {
if ($do_dashes == 1) $t = EducateDashes($t);
if ($do_dashes == 2) $t = EducateDashesOldSchool($t);
if ($do_dashes == 3) $t = EducateDashesOldSchoolInverted($t);
}
if ($do_ellipses) $t = EducateEllipses($t);
# Note: backticks need to be processed before quotes.
if ($do_backticks) {
$t = EducateBackticks($t);
if ($do_backticks == 2) $t = EducateSingleBackticks($t);
}
if ($do_quotes) {
if ($t == "'") {
# Special case: single-character ' token
if (preg_match('/\S/', $prev_token_last_char)) {
$t = "&#8217;";
}
else {
$t = "&#8216;";
}
}
else if ($t == '"') {
# Special case: single-character " token
if (preg_match('/\S/', $prev_token_last_char)) {
$t = "&#8221;";
}
else {
$t = "&#8220;";
}
}
else {
# Normal case:
$t = EducateQuotes($t);
}
}
if ($do_stupefy) $t = StupefyEntities($t);
}
$prev_token_last_char = $last_char;
$result .= $t;
}
}
return $result;
}
function SmartQuotes($text, $attr = NULL, $ctx = NULL) {
global $smartypants_attr, $sp_tags_to_skip;
# Paramaters:
$text; # text to be parsed
$attr; # value of the smart_quotes="" attribute
$ctx; # MT context object (unused)
if ($attr == NULL) $attr = $smartypants_attr;
$do_backticks; # should we educate ``backticks'' -style quotes?
if ($attr == 0) {
# do nothing;
return $text;
}
else if ($attr == 2) {
# smarten ``backticks'' -style quotes
$do_backticks = 1;
}
else {
$do_backticks = 0;
}
# Special case to handle quotes at the very end of $text when preceded by
# an HTML tag. Add a space to give the quote education algorithm a bit of
# context, so that it can guess correctly that it's a closing quote:
$add_extra_space = 0;
if (preg_match("/>['\"]\\z/", $text)) {
$add_extra_space = 1; # Remember, so we can trim the extra space later.
$text .= " ";
}
$tokens = _TokenizeHTML($text);
$result = '';
$in_pre = 0; # Keep track of when we're inside <pre> or <code> tags
$prev_token_last_char = ""; # This is a cheat, used to get some context
# for one-character tokens that consist of
# just a quote char. What we do is remember
# the last character of the previous text
# token, to use as context to curl single-
# character quote tokens correctly.
foreach ($tokens as $cur_token) {
if ($cur_token[0] == "tag") {
# Don't mess with quotes inside tags
$result .= $cur_token[1];
if (preg_match("@$sp_tags_to_skip@", $cur_token[1], $matches)) {
$in_pre = isset($matches[1]) && $matches[1] == '/' ? 0 : 1;
}
} else {
$t = $cur_token[1];
$last_char = substr($t, -1); # Remember last char of this token before processing.
if (! $in_pre) {
$t = ProcessEscapes($t);
if ($do_backticks) {
$t = EducateBackticks($t);
}
if ($t == "'") {
# Special case: single-character ' token
if (preg_match('/\S/', $prev_token_last_char)) {
$t = "&#8217;";
}
else {
$t = "&#8216;";
}
}
else if ($t == '"') {
# Special case: single-character " token
if (preg_match('/\S/', $prev_token_last_char)) {
$t = "&#8221;";
}
else {
$t = "&#8220;";
}
}
else {
# Normal case:
$t = EducateQuotes($t);
}
}
$prev_token_last_char = $last_char;
$result .= $t;
}
}
if ($add_extra_space) {
preg_replace('/ \z/', '', $result); # Trim trailing space if we added one earlier.
}
return $result;
}
function SmartDashes($text, $attr = NULL, $ctx = NULL) {
global $smartypants_attr, $sp_tags_to_skip;
# Paramaters:
$text; # text to be parsed
$attr; # value of the smart_dashes="" attribute
$ctx; # MT context object (unused)
if ($attr == NULL) $attr = $smartypants_attr;
# reference to the subroutine to use for dash education, default to EducateDashes:
$dash_sub_ref = 'EducateDashes';
if ($attr == 0) {
# do nothing;
return $text;
}
else if ($attr == 2) {
# use old smart dash shortcuts, "--" for en, "---" for em
$dash_sub_ref = 'EducateDashesOldSchool';
}
else if ($attr == 3) {
# inverse of 2, "--" for em, "---" for en
$dash_sub_ref = 'EducateDashesOldSchoolInverted';
}
$tokens;
$tokens = _TokenizeHTML($text);
$result = '';
$in_pre = 0; # Keep track of when we're inside <pre> or <code> tags
foreach ($tokens as $cur_token) {
if ($cur_token[0] == "tag") {
# Don't mess with quotes inside tags
$result .= $cur_token[1];
if (preg_match("@$sp_tags_to_skip@", $cur_token[1], $matches)) {
$in_pre = isset($matches[1]) && $matches[1] == '/' ? 0 : 1;
}
} else {
$t = $cur_token[1];
if (! $in_pre) {
$t = ProcessEscapes($t);
$t = $dash_sub_ref($t);
}
$result .= $t;
}
}
return $result;
}
function SmartEllipses($text, $attr = NULL, $ctx = NULL) {
# Paramaters:
$text; # text to be parsed
$attr; # value of the smart_ellipses="" attribute
$ctx; # MT context object (unused)
if ($attr == NULL) $attr = $smartypants_attr;
if ($attr == 0) {
# do nothing;
return $text;
}
$tokens;
$tokens = _TokenizeHTML($text);
$result = '';
$in_pre = 0; # Keep track of when we're inside <pre> or <code> tags
foreach ($tokens as $cur_token) {
if ($cur_token[0] == "tag") {
# Don't mess with quotes inside tags
$result .= $cur_token[1];
if (preg_match("@$sp_tags_to_skip@", $cur_token[1], $matches)) {
$in_pre = isset($matches[1]) && $matches[1] == '/' ? 0 : 1;
}
} else {
$t = $cur_token[1];
if (! $in_pre) {
$t = ProcessEscapes($t);
$t = EducateEllipses($t);
}
$result .= $t;
}
}
return $result;
}
function EducateQuotes($_) {
#
# Parameter: String.
#
# Returns: The string, with "educated" curly quote HTML entities.
#
# Example input: "Isn't this fun?"
# Example output: &#8220;Isn&#8217;t this fun?&#8221;
#
# Make our own "punctuation" character class, because the POSIX-style
# [:PUNCT:] is only available in Perl 5.6 or later:
$punct_class = "[!\"#\\$\\%'()*+,-.\\/:;<=>?\\@\\[\\\\\]\\^_`{|}~]";
# Special case if the very first character is a quote
# followed by punctuation at a non-word-break. Close the quotes by brute force:
$_ = preg_replace(
array("/^'(?=$punct_class\\B)/", "/^\"(?=$punct_class\\B)/"),
array('&#8217;', '&#8221;'), $_);
# Special case for double sets of quotes, e.g.:
# <p>He said, "'Quoted' words in a larger quote."</p>
$_ = preg_replace(
array("/\"'(?=\w)/", "/'\"(?=\w)/"),
array('&#8220;&#8216;', '&#8216;&#8220;'), $_);
# Special case for decade abbreviations (the '80s):
$_ = preg_replace("/'(?=\\d{2}s)/", '&#8217;', $_);
$close_class = '[^\ \t\r\n\[\{\(\-]';
$dec_dashes = '&\#8211;|&\#8212;';
# Get most opening single quotes:
$_ = preg_replace("{
(
\\s | # a whitespace char, or
&nbsp; | # a non-breaking space entity, or
-- | # dashes, or
&[mn]dash; | # named dash entities
$dec_dashes | # or decimal entities
&\\#x201[34]; # or hex
)
' # the quote
(?=\\w) # followed by a word character
}x", '\1&#8216;', $_);
# Single closing quotes:
$_ = preg_replace("{
($close_class)?
'
(?(1)| # If $1 captured, then do nothing;
(?=\\s | s\\b) # otherwise, positive lookahead for a whitespace
) # char or an 's' at a word ending position. This
# is a special case to handle something like:
# \"<i>Custer</i>'s Last Stand.\"
}xi", '\1&#8217;', $_);
# Any remaining single quotes should be opening ones:
$_ = str_replace("'", '&#8216;', $_);
# Get most opening double quotes:
$_ = preg_replace("{
(
\\s | # a whitespace char, or
&nbsp; | # a non-breaking space entity, or
-- | # dashes, or
&[mn]dash; | # named dash entities
$dec_dashes | # or decimal entities
&\\#x201[34]; # or hex
)
\" # the quote
(?=\\w) # followed by a word character
}x", '\1&#8220;', $_);
# Double closing quotes:
$_ = preg_replace("{
($close_class)?
\"
(?(1)|(?=\\s)) # If $1 captured, then do nothing;
# if not, then make sure the next char is whitespace.
}x", '\1&#8221;', $_);
# Any remaining quotes should be opening ones.
$_ = str_replace('"', '&#8220;', $_);
return $_;
}
function EducateBackticks($_) {
#
# Parameter: String.
# Returns: The string, with ``backticks'' -style double quotes
# translated into HTML curly quote entities.
#
# Example input: ``Isn't this fun?''
# Example output: &#8220;Isn't this fun?&#8221;
#
$_ = str_replace(array("``", "''",),
array('&#8220;', '&#8221;'), $_);
return $_;
}
function EducateSingleBackticks($_) {
#
# Parameter: String.
# Returns: The string, with `backticks' -style single quotes
# translated into HTML curly quote entities.
#
# Example input: `Isn't this fun?'
# Example output: &#8216;Isn&#8217;t this fun?&#8217;
#
$_ = str_replace(array("`", "'",),
array('&#8216;', '&#8217;'), $_);
return $_;
}
function EducateDashes($_) {
#
# Parameter: String.
#
# Returns: The string, with each instance of "--" translated to
# an em-dash HTML entity.
#
$_ = str_replace('--', '&#8212;', $_);
return $_;
}
function EducateDashesOldSchool($_) {
#
# Parameter: String.
#
# Returns: The string, with each instance of "--" translated to
# an en-dash HTML entity, and each "---" translated to
# an em-dash HTML entity.
#
# em en
$_ = str_replace(array("---", "--",),
array('&#8212;', '&#8211;'), $_);
return $_;
}
function EducateDashesOldSchoolInverted($_) {
#
# Parameter: String.
#
# Returns: The string, with each instance of "--" translated to
# an em-dash HTML entity, and each "---" translated to
# an en-dash HTML entity. Two reasons why: First, unlike the
# en- and em-dash syntax supported by
# EducateDashesOldSchool(), it's compatible with existing
# entries written before SmartyPants 1.1, back when "--" was
# only used for em-dashes. Second, em-dashes are more
# common than en-dashes, and so it sort of makes sense that
# the shortcut should be shorter to type. (Thanks to Aaron
# Swartz for the idea.)
#
# en em
$_ = str_replace(array("---", "--",),
array('&#8211;', '&#8212;'), $_);
return $_;
}
function EducateEllipses($_) {
#
# Parameter: String.
# Returns: The string, with each instance of "..." translated to
# an ellipsis HTML entity. Also converts the case where
# there are spaces between the dots.
#
# Example input: Huh...?
# Example output: Huh&#8230;?
#
$_ = str_replace(array("...", ". . .",), '&#8230;', $_);
return $_;
}
function StupefyEntities($_) {
#
# Parameter: String.
# Returns: The string, with each SmartyPants HTML entity translated to
# its ASCII counterpart.
#
# Example input: &#8220;Hello &#8212; world.&#8221;
# Example output: "Hello -- world."
#
# en-dash em-dash
$_ = str_replace(array('&#8211;', '&#8212;'),
array('-', '--'), $_);
# single quote open close
$_ = str_replace(array('&#8216;', '&#8217;'), "'", $_);
# double quote open close
$_ = str_replace(array('&#8220;', '&#8221;'), '"', $_);
$_ = str_replace('&#8230;', '...', $_); # ellipsis
return $_;
}
function ProcessEscapes($_) {
#
# Parameter: String.
# Returns: The string, with after processing the following backslash
# escape sequences. This is useful if you want to force a "dumb"
# quote or other character to appear.
#
# Escape Value
# ------ -----
# \\ &#92;
# \" &#34;
# \' &#39;
# \. &#46;
# \- &#45;
# \` &#96;
#
$_ = str_replace(
array('\\\\', '\"', "\'", '\.', '\-', '\`'),
array('&#92;', '&#34;', '&#39;', '&#46;', '&#45;', '&#96;'), $_);
return $_;
}
# _TokenizeHTML is shared between PHP SmartyPants and PHP Markdown.
# We only define it if it is not already defined.
if (!function_exists('_TokenizeHTML')) :
function _TokenizeHTML($str) {
#
# Parameter: String containing HTML markup.
# Returns: An array of the tokens comprising the input
# string. Each token is either a tag (possibly with nested,
# tags contained therein, such as <a href="<MTFoo>">, or a
# run of text between tags. Each element of the array is a
# two-element array; the first is either 'tag' or 'text';
# the second is the actual value.
#
#
# Regular expression derived from the _tokenize() subroutine in
# Brad Choate's MTRegex plugin.
# <http://www.bradchoate.com/past/mtregex.php>
#
$index = 0;
$tokens = array();
$match = '(?s:<!(?:--.*?--\s*)+>)|'. # comment
'(?s:<\?.*?\?>)|'. # processing instruction
# regular tags
'(?:<[/!$]?[-a-zA-Z0-9:]+\b(?>[^"\'>]+|"[^"]*"|\'[^\']*\')*>)';
$parts = preg_split("{($match)}", $str, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($parts as $part) {
if (++$index % 2 && $part != '')
$tokens[] = array('text', $part);
else
$tokens[] = array('tag', $part);
}
return $tokens;
}
endif;
/*
PHP SmartyPants
===============
Description
-----------
This is a PHP translation of the original SmartyPants quote educator written in
Perl by John Gruber.
SmartyPants is a web publishing utility that translates plain ASCII
punctuation characters into "smart" typographic punctuation HTML
entities. SmartyPants can perform the following transformations:
* Straight quotes (`"` and `'`) into "curly" quote HTML entities
* Backticks-style quotes (` ``like this'' `) into "curly" quote HTML
entities
* Dashes (`--` and `---`) into en- and em-dash entities
* Three consecutive dots (`...`) into an ellipsis entity
SmartyPants does not modify characters within `<pre>`, `<code>`, `<kbd>`,
`<script>`, or `<math>` tag blocks. Typically, these tags are used to
display text where smart quotes and other "smart punctuation" would not
be appropriate, such as source code or example markup.
### Backslash Escapes ###
If you need to use literal straight quotes (or plain hyphens and
periods), SmartyPants accepts the following backslash escape sequences
to force non-smart punctuation. It does so by transforming the escape
sequence into a decimal-encoded HTML entity:
Escape Value Character
------ ----- ---------
\\ &#92; \
\" &#34; "
\' &#39; '
\. &#46; .
\- &#45; -
\` &#96; `
This is useful, for example, when you want to use straight quotes as
foot and inch marks: 6'2" tall; a 17" iMac.
Bugs
----
To file bug reports or feature requests (other than topics listed in the
Caveats section above) please send email to:
<michel.fortin@michelf.com>
If the bug involves quotes being curled the wrong way, please send example
text to illustrate.
### Algorithmic Shortcomings ###
One situation in which quotes will get curled the wrong way is when
apostrophes are used at the start of leading contractions. For example:
'Twas the night before Christmas.
In the case above, SmartyPants will turn the apostrophe into an opening
single-quote, when in fact it should be a closing one. I don't think
this problem can be solved in the general case -- every word processor
I've tried gets this wrong as well. In such cases, it's best to use the
proper HTML entity for closing single-quotes (`&#8217;`) by hand.
Version History
---------------
1.5.1e (9 Dec 2005)
* Corrected a bug that prevented special characters from being
escaped.
1.5.1d (25 May 2005)
* Corrected a small bug in `_TokenizeHTML` where a Doctype declaration
was not seen as HTML (smart quotes where applied inside).
1.5.1c (13 Dec 2004)
* Changed a regular expression in `_TokenizeHTML` that could lead to
a segmentation fault with PHP 4.3.8 on Linux.
1.5.1b (6 Sep 2004)
* Corrected a problem with quotes immediately following a dash
with no space between: `Text--"quoted text"--text.`
* PHP SmartyPants can now be used as a modifier by the Smarty
template engine. Rename the file to "modifier.smartypants.php"
and put it in your smarty plugins folder.
* Replaced a lot of space characters by tabs, saving about 4 KB.
1.5.1a (30 Jun 2004)
* PHP Markdown and PHP Smartypants now share the same `_TokenizeHTML`
function when loaded simultanously.
* Changed the internals of `_TokenizeHTML` to lower the PHP version
requirement to PHP 4.0.5.
1.5.1 (6 Jun 2004)
* Initial release of PHP SmartyPants, based on version 1.5.1 of the
original SmartyPants written in Perl.
Author
------
John Gruber
<http://daringfireball.net/>
Ported to PHP by Michel Fortin
<http://www.michelf.com/>
Additional Credits
------------------
Portions of this plug-in are based on Brad Choate's nifty MTRegex plug-in.
Brad Choate also contributed a few bits of source code to this plug-in.
Brad Choate is a fine hacker indeed. (<http://bradchoate.com/>)
Jeremy Hedley (<http://antipixel.com/>) and Charles Wiltgen
(<http://playbacktime.com/>) deserve mention for exemplary beta testing.
Copyright and License
---------------------
Copyright (c) 2003 John Gruber
<http://daringfireball.net/>
All rights reserved.
Copyright (c) 2004-2005 Michel Fortin
<http://www.michelf.com>
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.
* 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.
* Neither the name "SmartyPants" 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 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.
*/
?>

View File

@@ -1,124 +0,0 @@
<?php
/**
* Another GeSHi example script
*
* Configure your Apache server with 'AcceptPathInfo true' and something like
* 'Alias /viewmysource /var/www/geshi/contrib/aliased.php'. Don't forget
* to protect this alias as necessary.
*
* Usage - visit /viewmysource/file.name.ext to see that file with syntax
* highlighting, where "viewmysource" is the name of the alias you set up.
* You can use this without an alias too, just by visiting
* aliased.php/file.name.ext.
*
* @author Ross Golder <ross@golder.org>
* @version $Id: aliased.php 785 2006-07-19 10:09:45Z oracleshinoda $
*/
// Your config here
define("SOURCE_ROOT", "/var/www/your/source/root/");
// Assume you've put geshi in the include_path already
require_once("geshi.php");
// Get path info
$path = SOURCE_ROOT.$_SERVER['PATH_INFO'];
// Check for dickheads trying to use '../' to get to sensitive areas
$base_path_len = strlen(SOURCE_ROOT);
$real_path = realpath($path);
if(strncmp($real_path, SOURCE_ROOT, $base_path_len)) {
exit("Stop that.");
}
// Check file exists
if(!file_exists($path)) {
exit("File not found ($path).");
}
// Gather contents
$contents = file_get_contents($path);
// Prepare GeSHi instance
$geshi =& new GeSHi($contents, "PHP");
$geshi->set_header_type(GESHI_HEADER_PRE);
$geshi->enable_classes();
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 10);
$geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', true);
$geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true);
$geshi->set_code_style('color: #000020;', 'color: #000020;');
$geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
$geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
$geshi->set_header_content('Source code viewer');
$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
$geshi->set_footer_content('Parsed in <TIME> seconds, using GeSHi <VERSION>');
$geshi->set_footer_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Source code viewer - <?php echo $path; ?></title>
<style type="text/css">
<!--
<?php
// Output the stylesheet. Note it doesn't output the <style> tag
echo $geshi->get_stylesheet();
?>
html {
background-color: #f0f0f0;
}
body {
font-family: Verdana, Arial, sans-serif;
margin: 10px;
border: 2px solid #e0e0e0;
background-color: #fcfcfc;
padding: 5px;
}
h2 {
margin: .1em 0 .2em .5em;
border-bottom: 1px solid #b0b0b0;
color: #b0b0b0;
font-weight: normal;
font-size: 150%;
}
h3 {
margin: .1em 0 .2em .5em;
color: #b0b0b0;
font-weight: normal;
font-size: 120%;
}
#footer {
text-align: center;
font-size: 80%;
color: #a9a9a9;
}
#footer a {
color: #9999ff;
}
textarea {
border: 1px solid #b0b0b0;
font-size: 90%;
color: #333;
margin-left: 20px;
}
select, input {
margin-left: 20px;
}
p {
font-size: 90%;
margin-left: .5em;
}
-->
</style>
</head>
<body>
<?php
// The fun part :)
echo $geshi->parse_code();
?>
<hr/>
</body>
</html>

View File

@@ -1,456 +0,0 @@
<?php
/*************************************************************************************
* cssgen.php
* ----------
* Author: Nigel McNie (nigel@geshi.org)
* Copyright: (c) 2004 Nigel McNie
* Release Version: 1.0.8.1
* Date Started: 2004/05/20
*
* Application to generate custom CSS files for GeSHi (based on an idea by Andreas
* Gohr)
*
*************************************************************************************
*
* This file is part of GeSHi.
*
* GeSHi 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.
*
* GeSHi 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 GeSHi; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
************************************************************************************/
set_magic_quotes_runtime(0);
//
// Functions
//
function make_header ( $title )
{
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>GeSHi CSS Generator :: ' . $title . ' </title>
<style type="text/css" media="screen">
<!--
html {
font-family: Verdana, Arial, sans-serif;
font-size: 80%;
background-color: #d0d0d0;
}
body {
margin: 10px;
padding: 5px;
border: 1px solid #f0f0f0;
background-color: #f6f6f6;
}
h1 {
border-bottom: 2px solid #e0e0e0;
font-weight: normal;
font-size: 150%;
color: #c0c0c0;
}
input, textarea {
border: 1px solid #d0d0d0;
}
th {
text-align: right;
font-weight: normal;
}
pre {
font-size: 110%;
color: #202020;
}
#footer {
color: #b0b0b0;
text-align: center;
font-size: 90%;
margin: 0 auto;
border-top: 1px solid #e0e0e0;
}
#footer a {
color: #c0c0c0;
}
-->
</style>
<script type="text/javascript">
function select (state)
{
var cboxes = document.getElementsByTagName(\'input\');
for (var i = 0; i < cboxes.length; i++) {
if (cboxes[i].type == "checkbox") {
if (state == "true") {
cboxes[i].checked = true;
} else if (state == "false") {
cboxes[i].checked = false;
} else if (state == "invert") {
cboxes[i].checked = !cboxes[i].checked;
}
}
}
}
</script>
</head>
<body>
<h1>' . $title . '</h1>
';
}
function make_footer ()
{
echo '<div id="footer"><a href="http://qbnz.com/highlighter/">GeSHi</a> &copy; Nigel McNie, 2004, released under the GPL</div></body>
</html>';
}
function get_var ( $var_name )
{
if ( isset($_GET[$var_name]) )
{
return str_replace("\'", "'", $_GET[$var_name]);
}
elseif ( isset($_POST[$var_name]) )
{
return str_replace("\'", "'", $_POST[$var_name]);
}
return null;
}
//
// Unset everything
//
foreach ( $_REQUEST as $var )
{
unset($$var);
}
foreach ( array(
'_POST' => 'HTTP_POST_VARS',
'_GET' => 'HTTP_GET_VARS',
'_COOKIE' => 'HTTP_COOKIE_VARS',
'_SERVER' => 'HTTP_SERVER_VARS',
'_ENV' => 'HTTP_ENV_VARS',
'_FILES' => 'HTTP_POST_FILES') as $array => $other )
{
if ( !isset($$array) )
{
$$array = $$other;
}
unset($$other);
}
// Get what step we're up to
$step = get_var('step');
if ( !$step || $step == 1 )
{
$errors = 0;
make_header('Step 1');
echo "Welcome to the GeSHi CSS generator.<br /><pre>Searching for GeSHi... ";
// Find GeSHi
$geshi_path = get_var('geshi-path');
$geshi_lang_path = get_var('geshi-lang-path');
if ( !$geshi_path )
{
$geshi_path = '../geshi.php';
}
if ( !$geshi_lang_path )
{
$geshi_lang_path = '../geshi/';
}
if ( is_file($geshi_path) && is_readable($geshi_path) )
{
// Get file contents and see if GeSHi is in here
$file = @file($geshi_path);
$contents = '';
foreach ( $file as $line )
{
$contents .= $line;
}
if ( strpos($contents, '<?php
/**
* GeSHi - Generic Syntax Highlighter') !== false )
{
echo '<span style="color: green;">Found at ' . realpath($geshi_path) . '</span>';
}
else
{
++$errors;
$no_geshi_dot_php_error = true;
echo '<span style="color: red;">Not found</span>';
}
}
else
{
++$errors;
$no_geshi_dot_php_error = true;
echo '<span style="color: red;">Not found</span>';
}
// Find language files
echo "\nSearching for language files... ";
if ( is_readable($geshi_lang_path . 'css-gen.cfg') )
{
echo '<span style="color: green;">Found at ' . realpath($geshi_lang_path) . '</span>';
}
else
{
++$errors;
$no_lang_dir_error = true;
echo '<span style="color: red;">Not found</span>';
}
echo "</pre>\n";
if ( $errors > 0 )
{
// We're gonna have to ask for the paths...
echo 'Unfortunately CSSGen could not detect the following paths. Please input them and press &quot;submit&quot; to try again.';
echo "
<form action=\"cssgen.php\" method=\"post\">";
if ( $no_geshi_dot_php_error )
{
echo "
<br />geshi.php: <input type=\"text\" name=\"geshi-path\" value=\"" . realpath('../geshi.php') . "\" size=\"50\" />";
}
else
{
echo '<input type="hidden" name="geshi-path" value="' . htmlspecialchars($geshi_path) . '" />';
}
if ( $no_lang_dir_error )
{
echo "
<br />language files directory: <input type=\"text\" name=\"geshi-lang-path\" value=\"" . realpath('../geshi/') . "/\" size=\"50\" /> (should have a trailing slash)";
}
else
{
echo '<input type="hidden" name="geshi-lang-path" value="' . $geshi_lang_path . '" />';
}
echo "
<br /><input type=\"submit\" value=\"Search\" /></form>";
}
else
{
// no errors - echo continue form
echo 'Everything seems to be detected successfully. Use the button to continue.
<br /><br /><form action="cssgen.php?step=2" method="post">
<input type="hidden" name="geshi-path" value="' . realpath($geshi_path) . '" /><input type="hidden" name="geshi-lang-path" value="' . realpath($geshi_lang_path) . '" />
<input type="submit" value="Step 2" />';
}
make_footer();
}
// Step 2
elseif ( $step == 2 )
{
make_header('Step 2');
$geshi_path = get_var('geshi-path');
$geshi_lang_path = get_var('geshi-lang-path');
$dh = opendir($geshi_lang_path);
$lang_files = array();
$file = readdir($dh);
while ( $file !== false )
{
if ( $file == '.' || $file == '..' || $file == 'CVS' || $file == 'css-gen.cfg' )
{
$file = readdir($dh);
continue;
}
$lang_files[] = $file;
$file = readdir($dh);
}
closedir($dh);
sort($lang_files);
// Now installed languages are in $lang_files
echo '<form action="cssgen.php?step=3" method="post" id="step2">
What languages are you wanting to make this stylesheet for?<br /><br />
Detected languages:<br />';
foreach ( $lang_files as $lang )
{
$lang = substr($lang, 0, strpos($lang, '.'));
if ($lang) {
echo "<input type=\"checkbox\" name=\"langs[$lang]\" checked=\"checked\" />&nbsp;$lang<br />\n";
}
}
echo "Select: <a href=\"javascript:select('true')\">All</a>, <a href=\"javascript:select('false')\">None</a>, <a href=\"javascript:select('invert')\">Invert</a><br />\n";
echo 'If you\'d like any other languages not detected here to be supported, please enter
them here, one per line:<br /><textarea rows="4" cols="20" name="extra-langs"></textarea><br />
';
echo '<br />Styles:
<table>
<tr><th>Style for the overall code block:</th><td><input type="text" name="overall" value="border: 1px dotted #a0a0a0; font-family: \'Courier New\', Courier, monospace; background-color: #f0f0f0; color: #0000bb;" /></td></tr>
<tr><th>Default Styles</th><td><input type="text" name="default-styles" value="font-weight:normal;background:transparent;color:#000; padding-left: 5px;" /></td></tr>
<tr><th>Keywords I (if, do, while etc)</th><td><input type="text" name="keywords-1" value="color: #a1a100;" /></td></tr>
<tr><th>Keywords II (null, true, false etc)</th><td><input type="text" name="keywords-2" value="color: #000; font-weight: bold;" /></td></tr>
<tr><th>Inbuilt Functions (echo, print etc)</th><td><input type="text" name="keywords-3" value="color: #000066;" /></td></tr>
<tr><th>Data Types (int, boolean etc)</th><td><input type="text" name="keywords-4" value="color: #f63333;" /></td></tr>
<tr><th>Comments (//, <!-- --> etc)</th><td><input type="text" name="comments" value="color: #808080;" /></td></tr>
<tr><th>Escaped Characters (\n, \t etc)</th><td><input type="text" name="escaped-chars" value="color: #000033; font-weight: bold;" /></td></tr>
<tr><th>Brackets ( ([{}]) etc)</th><td><input type="text" name="brackets" value="color: #66cc66;" /></td></tr>
<tr><th>Strings ("foo" etc)</th><td><input type="text" name="strings" value="color: #ff0000;" /></td></tr>
<tr><th>Numbers (1, -54, 2.5 etc)</th><td><input type="text" name="numbers" value="color: #ff33ff;" /></td></tr>
<tr><th>Methods (Foo.bar() etc)</th><td><input type="text" name="methods" value="color: #006600;" /></td></tr>
</table>';
echo '<input type="hidden" name="geshi-path" value="' . realpath($geshi_path) . '" /><input type="hidden" name="geshi-lang-path" value="' . realpath($geshi_lang_path) . '" />
<input type="submit" value="Step 3" /></form>';
make_footer();
}
// Step 3
elseif ( $step == 3 )
{
make_header('Step 3');
echo '<p>Here is your completed stylesheet. Note that it may not be perfect - no regular expression styles are included for one thing,
you\'ll have to add those yourself (php and xml are just two languages that use them), and line numbers are not included, however
it includes most of the basic information.</p>';
// Make the stylesheet
$part_selector_1 = '';
$part_selector_2 = '';
$part_selector_3 = '';
$langs = get_var('langs');
$extra_langs = trim(get_var('extra-langs'));
if ( $extra_langs != '' )
{
$l = explode("\r\n", $extra_langs);
foreach ( $l as $lng )
{
$langs[$lng] = true;
}
}
foreach ( $langs as $lang => $dummy )
{
$part_selector_1 .= ".$lang {PART}, ";
$part_selector_2 .= ".$lang {PART1}, .$lang {PART2}, ";
$part_selector_3 .= ".$lang {PART1}, .$lang {PART2}, .$lang {PART3}, ";
}
$part_selector_1 = substr($part_selector_1, 0, -2);
$part_selector_2 = substr($part_selector_2, 0, -2);
$part_selector_3 = substr($part_selector_3, 0, -2);
$default_styles = get_var('default-styles');
$ol_selector = str_replace('{PART}', 'ol', $part_selector_1);
$overall_styles = get_var('overall');
$overall_selector = str_replace('{PART}', '', $part_selector_1);
$stylesheet = "/* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */";
if ( $overall != '' )
{
$stylesheet .= "\n$overall_selector {{$overall_styles}}";
}
if ( $default_styles != '' )
{
$default_selector = str_replace(array('{PART1}', '{PART2}'), array('.de1', '.de2'), $part_selector_2);
$stylesheet .= "\n$default_selector {{$default_styles}}";
}
// Do keywords
$keywords_1 = get_var('keywords-1');
$keyword_selector_1 = str_replace('{PART}', '.kw1', $part_selector_1);
if ( $keywords_1 != '' )
{
$stylesheet .= "\n$keyword_selector_1 {{$keywords_1}}";
}
$keywords_2 = get_var('keywords-2');
$keyword_selector_2 = str_replace('{PART}', '.kw2', $part_selector_1);
if ( $keywords_2 != '' )
{
$stylesheet .= "\n$keyword_selector_2 {{$keywords_2}}";
}
$keywords_3 = get_var('keywords-3');
$keyword_selector_3 = str_replace('{PART}', '.kw3', $part_selector_1);
if ( $keywords_3 != '' )
{
$stylesheet .= "\n$keyword_selector_3 {{$keywords_3}}";
}
$keywords_4 = get_var('keywords-4');
$keyword_selector_4 = str_replace('{PART}', '.kw4', $part_selector_1);
if ( $keywords_4 != '' )
{
$stylesheet .= "\n$keyword_selector_4 {{$keywords_4}}";
}
// Do other lexics
$comments = get_var('comments');
$comment_selector = str_replace(array('{PART1}', '{PART2}', '{PART3}'), array('.co1', '.co2', '.coMULTI'), $part_selector_3);
if ( $comments != '' )
{
$stylesheet .= "\n$comment_selector {{$comments}}";
}
$esc = get_var('escaped-chars');
$esc_selector = str_replace('{PART}', '.es0', $part_selector_1);
if ( $esc != '' )
{
$stylesheet .= "\n$esc_selector {{$esc}}";
}
$brackets = get_var('brackets');
$brk_selector = str_replace('{PART}', '.br0', $part_selector_1);
if ( $brackets != '' )
{
$stylesheet .= "\n$brk_selector {{$brackets}}";
}
$strings = get_var('strings');
$string_selector = str_replace('{PART}', '.st0', $part_selector_1);
if ( $strings != '' )
{
$stylesheet .= "\n$string_selector {{$strings}}";
}
$numbers = get_var('numbers');
$num_selector = str_replace('{PART}', '.nu0', $part_selector_1);
if ( $numbers != '' )
{
$stylesheet .= "\n$num_selector {{$numbers}}";
}
$methods = get_var('methods');
$method_selector = str_replace('{PART}', '.me0', $part_selector_1);
if ( $methods != '' )
{
$stylesheet .= "\n$method_selector {{$methods}}";
}
echo "<pre>$stylesheet</pre>";
make_footer();
}
?>

View File

@@ -1,59 +0,0 @@
<?php
/**
* A simple script which outputs the CSS classes for all languages
* supported by GeSHi. You can access it directly to download
* the CSS file. On *NIX you can also do a simple `php cssgen.php > geshi.css`.
*
* This file is part of GeSHi.
*
* GeSHi 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.
*
* GeSHi 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 GeSHi; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @package geshi
* @subpackage contrib
* @author revulo <revulon@gmail.com>
* @copyright 2008 revulo
* @license http://gnu.org/copyleft/gpl.html GNU GPL
*
*/
require dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'geshi.php';
$geshi = new GeSHi;
$languages = array();
if ($handle = opendir($geshi->language_path)) {
while (($file = readdir($handle)) !== false) {
$pos = strpos($file, '.');
if ($pos > 0 && substr($file, $pos) == '.php') {
$languages[] = substr($file, 0, $pos);
}
}
closedir($handle);
}
sort($languages);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="geshi.css"');
echo "/**\n".
" * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann\n" .
" * (http://qbnz.com/highlighter/ and http://geshi.org/)\n".
" */\n";
foreach ($languages as $language) {
$geshi->set_language($language);
// note: the false argument is required for stylesheet generators, see API documentation
$css = $geshi->get_stylesheet(false);
echo preg_replace('/^\/\*\*.*?\*\//s', '', $css);
}

View File

@@ -1,217 +0,0 @@
<?php
/**
* GeSHi example script
*
* Just point your browser at this script (with geshi.php in the parent directory,
* and the language files in subdirectory "../geshi/")
*
* @author Nigel McNie
* @version $Id: example.php 1512 2008-07-21 21:05:40Z benbe $
*/
header('Content-Type: text/html; charset=utf-8');
error_reporting(E_ALL);
// Rudimentary checking of where GeSHi is. In a default install it will be in ../, but
// it could be in the current directory if the include_path is set. There's nowhere else
// we can reasonably guess.
if (is_readable('../geshi.php')) {
$path = '../';
} elseif (is_readable('geshi.php')) {
$path = './';
} else {
die('Could not find geshi.php - make sure it is in your include path!');
}
require $path . 'geshi.php';
$fill_source = false;
if (isset($_POST['submit'])) {
if (get_magic_quotes_gpc()) {
$_POST['source'] = stripslashes($_POST['source']);
}
if (!strlen(trim($_POST['source']))) {
$_POST['language'] = preg_replace('#[^a-zA-Z0-9\-_]#', '', $_POST['language']);
$_POST['source'] = implode('', @file($path . 'geshi/' . $_POST['language'] . '.php'));
$_POST['language'] = 'php';
} else {
$fill_source = true;
}
// Here's a free demo of how GeSHi works.
// First the initialisation: source code to highlight and the language to use. Make sure
// you sanitise correctly if you use $_POST of course - this very script has had a security
// advisory against it in the past because of this. Please try not to use this script on a
// live site.
$geshi = new GeSHi($_POST['source'], $_POST['language']);
// Use the PRE_VALID header. This means less output source since we don't have to output &nbsp;
// everywhere. Of course it also means you can't set the tab width.
// HEADER_PRE_VALID puts the <pre> tag inside the list items (<li>) thus producing valid HTML markup.
// HEADER_PRE puts the <pre> tag around the list (<ol>) which is invalid in HTML 4 and XHTML 1
// HEADER_DIV puts a <div> tag arount the list (valid!) but needs to replace whitespaces with &nbsp
// thus producing much larger overhead. You can set the tab width though.
$geshi->set_header_type(GESHI_HEADER_PRE_VALID);
// Enable CSS classes. You can use get_stylesheet() to output a stylesheet for your code. Using
// CSS classes results in much less output source.
$geshi->enable_classes();
// Enable line numbers. We want fancy line numbers, and we want every 5th line number to be fancy
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 5);
// Set the style for the PRE around the code. The line numbers are contained within this box (not
// XHTML compliant btw, but if you are liberally minded about these things then you'll appreciate
// the reduced source output).
$geshi->set_overall_style('font: normal normal 90% monospace; color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', false);
// Set the style for line numbers. In order to get style for line numbers working, the <li> element
// is being styled. This means that the code on the line will also be styled, and most of the time
// you don't want this. So the set_code_style reverts styles for the line (by using a <div> on the line).
// So the source output looks like this:
//
// <pre style="[set_overall_style styles]"><ol>
// <li style="[set_line_style styles]"><div style="[set_code_style styles]>...</div></li>
// ...
// </ol></pre>
$geshi->set_line_style('color: #003030;', 'font-weight: bold; color: #006060;', true);
$geshi->set_code_style('color: #000020;', true);
// Styles for hyperlinks in the code. GESHI_LINK for default styles, GESHI_HOVER for hover style etc...
// note that classes must be enabled for this to work.
$geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
$geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
// Use the header/footer functionality. This puts a div with content within the PRE element, so it is
// affected by the styles set by set_overall_style. So if the PRE has a border then the header/footer will
// appear inside it.
$geshi->set_header_content('<SPEED> <TIME> GeSHi &copy; 2004-2007, Nigel McNie, 2007-2008 Benny Baumann. View source of example.php for example of using GeSHi');
$geshi->set_header_content_style('font-family: sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
// You can use <TIME> and <VERSION> as placeholders
$geshi->set_footer_content('Parsed in <TIME> seconds at <SPEED>, using GeSHi <VERSION>');
$geshi->set_footer_content_style('font-family: sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
} else {
// make sure we don't preselect any language
$_POST['language'] = null;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>GeSHi examples</title>
<style type="text/css">
<!--
<?php
if (isset($_POST['submit'])) {
// Output the stylesheet. Note it doesn't output the <style> tag
echo $geshi->get_stylesheet(true);
}
?>
html {
background-color: #f0f0f0;
}
body {
font-family: Verdana, Arial, sans-serif;
margin: 10px;
border: 2px solid #e0e0e0;
background-color: #fcfcfc;
padding: 5px;
}
h2 {
margin: .1em 0 .2em .5em;
border-bottom: 1px solid #b0b0b0;
color: #b0b0b0;
font-weight: normal;
font-size: 150%;
}
h3 {
margin: .1em 0 .2em .5em;
color: #b0b0b0;
font-weight: normal;
font-size: 120%;
}
#footer {
text-align: center;
font-size: 80%;
color: #a9a9a9;
}
#footer a {
color: #9999ff;
}
textarea {
border: 1px solid #b0b0b0;
font-size: 90%;
color: #333;
margin-left: 20px;
}
select, input {
margin-left: 20px;
}
p {
font-size: 90%;
margin-left: .5em;
}
-->
</style>
</head>
<body>
<h2>GeSHi Example Script</h2>
<p>To use this script, make sure that <strong>geshi.php</strong> is in the parent directory or in your
include_path, and that the language files are in a subdirectory of GeSHi's directory called <strong>geshi/</strong>.</p>
<p>Enter your source and a language to highlight the source in and submit, or just choose a language to
have that language file highlighted in PHP.</p>
<?php
if (isset($_POST['submit'])) {
// The fun part :)
echo $geshi->parse_code();
echo '<hr />';
}
?>
<form action="<?php echo basename($_SERVER['PHP_SELF']); ?>" method="post">
<h3>Source to highlight</h3>
<p>
<textarea rows="10" cols="60" name="source" id="source"><?php echo $fill_source ? htmlspecialchars($_POST['source']) : '' ?></textarea>
</p>
<h3>Choose a language</h3>
<p>
<select name="language" id="language">
<?php
if (!($dir = @opendir(dirname(__FILE__) . '/geshi'))) {
if (!($dir = @opendir(dirname(__FILE__) . '/../geshi'))) {
echo '<option>No languages available!</option>';
}
}
$languages = array();
while ($file = readdir($dir)) {
if ( $file[0] == '.' || strpos($file, '.', 1) === false) {
continue;
}
$lang = substr($file, 0, strpos($file, '.'));
$languages[] = $lang;
}
closedir($dir);
sort($languages);
foreach ($languages as $lang) {
if (isset($_POST['language']) && $_POST['language'] == $lang) {
$selected = 'selected="selected"';
} else {
$selected = '';
}
echo '<option value="' . $lang . '" '. $selected .'>' . $lang . "</option>\n";
}
?>
</select>
</p>
<p>
<input type="submit" name="submit" value="Highlight Source" />
<input type="submit" name="clear" onclick="document.getElementById('source').value='';document.getElementById('language').value='';return false" value="clear" />
</p>
</form>
<div id="footer">GeSHi &copy; Nigel McNie, 2004, released under the GNU GPL<br />
For a better demonstration, check out the <a href="http://qbnz.com/highlighter/demo.php">online demo</a>
</div>
</body>
</html>

View File

@@ -1,666 +0,0 @@
<?php
/**
* GeSHi example script
*
* Just point your browser at this script (with geshi.php in the parent directory,
* and the language files in subdirectory "../geshi/")
*
* @author Nigel McNie
* @version $Id: langcheck.php 1971 2008-12-25 15:14:14Z benbe $
*/
header('Content-Type: text/html; charset=utf-8');
set_time_limit(0);
error_reporting(E_ALL);
$time_start = explode(' ', microtime());
define ('TYPE_NOTICE', 0);
define ('TYPE_WARNING', 1);
define ('TYPE_ERROR', 2);
$error_abort = false;
$error_cache = array();
function output_error_cache(){
global $error_cache, $error_abort;
if(count($error_cache)) {
echo "<span style=\"color: #F00; font-weight: bold;\">Failed</span><br />";
echo "<ol>\n";
foreach($error_cache as $error_msg) {
echo "<li>";
switch($error_msg['t']) {
case TYPE_NOTICE:
echo "<span style=\"color: #080; font-weight: bold;\">NOTICE:</span>";
break;
case TYPE_WARNING:
echo "<span style=\"color: #CC0; font-weight: bold;\">WARNING:</span>";
break;
case TYPE_ERROR:
echo "<span style=\"color: #F00; font-weight: bold;\">ERROR:</span>";
break;
}
echo " " . $error_msg['m'] . "</li>";
}
echo "</ol>\n";
} else {
echo "<span style=\"color: #080; font-weight: bold;\">OK</span><br />";
}
echo "\n";
$error_cache = array();
}
function report_error($type, $message) {
global $error_cache, $error_abort;
$error_cache[] = array('t' => $type, 'm' => $message);
if(TYPE_ERROR == $type) {
$error_abort = true;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>GeSHi Language File Validation Script</title>
<style type="text/css">
<!--
html {
background-color: #f0f0f0;
}
body {
font-family: Verdana, Arial, sans-serif;
margin: 10px;
border: 2px solid #e0e0e0;
background-color: #fcfcfc;
padding: 5px;
font-size: 10pt;
}
h2 {
margin: .1em 0 .2em .5em;
border-bottom: 1px solid #b0b0b0;
color: #b0b0b0;
font-weight: normal;
font-size: 150%;
}
h3 {
margin: .1em 0 .2em .5em;
color: #b0b0b0;
font-weight: normal;
font-size: 120%;
}
#footer {
text-align: center;
font-size: 80%;
color: #a9a9a9;
}
#footer a {
color: #9999ff;
}
textarea {
border: 1px solid #b0b0b0;
font-size: 90%;
color: #333;
margin-left: 20px;
}
select, input {
margin-left: 20px;
}
p {
font-size: 90%;
margin-left: .5em;
}
-->
</style>
</head>
<body>
<h2>GeSHi Language File Validation Script</h2>
<p>To use this script, make sure that <strong>geshi.php</strong> is in the
parent directory or in your include_path, and that the language files are in a
subdirectory of GeSHi's directory called <strong>geshi/</strong>.</p>
<p>Everything else will be done by this script automatically. After the script
finished you should see messages of what could cause trouble with GeSHi or where
your language files can be improved. Please be patient, as this might take some time.</p>
<ol>
<li>Checking where to find GeSHi installation ... <?php
// Rudimentary checking of where GeSHi is. In a default install it will be in ../, but
// it could be in the current directory if the include_path is set. There's nowhere else
// we can reasonably guess.
if (is_readable('../geshi.php')) {
$path = '../';
} elseif (is_readable('geshi.php')) {
$path = './';
} else {
report_error(TYPE_ERROR, 'Could not find geshi.php - make sure it is in your include path!');
}
if(!$error_abort) {
require $path . 'geshi.php';
if(!class_exists('GeSHi')) {
report_error(TYPE_ERROR, 'The GeSHi class was not found, although it seemed we loaded the correct file!');
}
}
if(!$error_abort) {
if(!defined('GESHI_LANG_ROOT')) {
report_error(TYPE_ERROR, 'There\'s no information present on where to find the language files!');
} else if(!is_dir(GESHI_LANG_ROOT)) {
report_error(TYPE_ERROR, 'The path "'.GESHI_LANG_ROOT.'" given, does not ressemble a directory!');
} else if(!is_readable(GESHI_LANG_ROOT)) {
report_error(TYPE_ERROR, 'The path "'.GESHI_LANG_ROOT.'" is not readable to this script!');
}
}
output_error_cache();
if(!$error_abort) {
echo "</li>\n<li>Listing available language files ... ";
if (!($dir = @opendir(GESHI_LANG_ROOT))) {
report_error(TYPE_ERROR, 'Error requesting listing for available language files!');
}
$languages = array();
if(!$error_abort) {
while ($file = readdir($dir)) {
if (!$file || $file[0] == '.' || strpos($file, '.') === false) {
continue;
}
$lang = substr($file, 0, strpos($file, '.'));
$languages[] = $lang;
}
closedir($dir);
}
$languages = array_unique($languages);
sort($languages);
if(!count($languages)) {
report_error(TYPE_WARNING, 'Unable to locate any usable language files in "'.GESHI_LANG_ROOT.'"!');
}
output_error_cache();
}
if (isset($_REQUEST['show']) && in_array($_REQUEST['show'], $languages)) {
$languages = array($_REQUEST['show']);
}
if(!$error_abort) {
foreach ($languages as $lang) {
echo "</li>\n<li>Validating language file for '$lang' ... ";
$langfile = GESHI_LANG_ROOT . $lang . '.php';
unset($language_data);
if(!is_file($langfile)) {
report_error(TYPE_ERROR, 'The path "' .$langfile. '" does not ressemble a regular file!');
} else if(!is_readable($langfile)) {
report_error(TYPE_ERROR, 'Cannot read file "' .$langfile. '"!');
} else {
$langfile_content = file_get_contents($langfile);
if(preg_match("/\?>(?:\r?\n|\r(?!\n)){2,}\Z/", $langfile_content)) {
report_error(TYPE_ERROR, 'Language file contains trailing empty lines at EOF!');
}
if(!preg_match("/\?>(?:\r?\n|\r(?!\n))?\Z/", $langfile_content)) {
report_error(TYPE_ERROR, 'Language file contains no PHP end marker at EOF!');
}
if(preg_match("/\t/", $langfile_content)) {
report_error(TYPE_NOTICE, 'Language file contains unescaped tabulator chars (probably for indentation)!');
}
if(preg_match('/^(?: )*(?! )(?! \*) /m', $langfile_content)) {
report_error(TYPE_NOTICE, 'Language file contains irregular indentation (other than 4 spaces per indentation level)!');
}
if(!preg_match("/\/\*\*((?!\*\/).)*?Author:((?!\*\/).)*?\*\//s", $langfile_content)) {
report_error(TYPE_WARNING, 'Language file does not contain a specification of an author!');
}
if(!preg_match("/\/\*\*((?!\*\/).)*?Copyright:((?!\*\/).)*?\*\//s", $langfile_content)) {
report_error(TYPE_WARNING, 'Language file does not contain a specification of the copyright!');
}
if(!preg_match("/\/\*\*((?!\*\/).)*?Release Version:((?!\*\/).)*?\*\//s", $langfile_content)) {
report_error(TYPE_WARNING, 'Language file does not contain a specification of the release version!');
}
if(!preg_match("/\/\*\*((?!\*\/).)*?Date Started:((?!\*\/).)*?\*\//s", $langfile_content)) {
report_error(TYPE_WARNING, 'Language file does not contain a specification of the date it was started!');
}
if(!preg_match("/\/\*\*((?!\*\/).)*?This file is part of GeSHi\.((?!\*\/).)*?\*\//s", $langfile_content)) {
report_error(TYPE_WARNING, 'Language file does not state that it belongs to GeSHi!');
}
if(!preg_match("/\/\*\*((?!\*\/).)*?language file for GeSHi\.((?!\*\/).)*?\*\//s", $langfile_content)) {
report_error(TYPE_WARNING, 'Language file does not state that it is a language file for GeSHi!');
}
if(!preg_match("/\/\*\*((?!\*\/).)*?GNU General Public License((?!\*\/).)*?\*\//s", $langfile_content)) {
report_error(TYPE_WARNING, 'Language file does not state that it is provided under the terms of the GNU GPL!');
}
unset($langfile_content);
include $langfile;
if(!isset($language_data)) {
report_error(TYPE_ERROR, 'Language file does not contain a $language_data structure to check!');
} else if (!is_array($language_data)) {
report_error(TYPE_ERROR, 'Language file contains a $language_data structure which is not an array!');
}
}
if(!$error_abort) {
if(!isset($language_data['LANG_NAME'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'LANG_NAME\'] specification!');
} else if (!is_string($language_data['LANG_NAME'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'LANG_NAME\'] specification which is not a string!');
}
if(!isset($language_data['COMMENT_SINGLE'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'COMMENT_SIGNLE\'] structure to check!');
} else if (!is_array($language_data['COMMENT_SINGLE'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'COMMENT_SINGLE\'] structure which is not an array!');
}
if(!isset($language_data['COMMENT_MULTI'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'COMMENT_MULTI\'] structure to check!');
} else if (!is_array($language_data['COMMENT_MULTI'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'COMMENT_MULTI\'] structure which is not an array!');
}
if(isset($language_data['COMMENT_REGEXP'])) {
if (!is_array($language_data['COMMENT_REGEXP'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'COMMENT_REGEXP\'] structure which is not an array!');
}
}
if(!isset($language_data['QUOTEMARKS'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'QUOTEMARKS\'] structure to check!');
} else if (!is_array($language_data['QUOTEMARKS'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'QUOTEMARKS\'] structure which is not an array!');
}
if(isset($language_data['HARDQUOTE'])) {
if (!is_array($language_data['HARDQUOTE'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'HARDQUOTE\'] structure which is not an array!');
}
}
if(!isset($language_data['ESCAPE_CHAR'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'ESCAPE_CHAR\'] specification to check!');
} else if (!is_string($language_data['ESCAPE_CHAR'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'ESCAPE_CHAR\'] specification which is not a string!');
} else if (1 < strlen($language_data['ESCAPE_CHAR'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'ESCAPE_CHAR\'] specification is not empty or exactly one char!');
}
if(!isset($language_data['CASE_KEYWORDS'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'CASE_KEYWORDS\'] specification!');
} else if (!is_int($language_data['CASE_KEYWORDS'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'CASE_KEYWORDS\'] specification which is not an integer!');
} else if (GESHI_CAPS_NO_CHANGE != $language_data['CASE_KEYWORDS'] &&
GESHI_CAPS_LOWER != $language_data['CASE_KEYWORDS'] &&
GESHI_CAPS_UPPER != $language_data['CASE_KEYWORDS']) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'CASE_KEYWORDS\'] specification which is neither of GESHI_CAPS_NO_CHANGE, GESHI_CAPS_LOWER nor GESHI_CAPS_UPPER!');
}
if(!isset($language_data['KEYWORDS'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'KEYWORDS\'] structure to check!');
} else if (!is_array($language_data['KEYWORDS'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'KEYWORDS\'] structure which is not an array!');
} else {
foreach($language_data['KEYWORDS'] as $kw_key => $kw_value) {
if(!is_integer($kw_key)) {
report_error(TYPE_WARNING, "Language file contains an key '$kw_key' in \$language_data['KEYWORDS'] that is not integer!");
} else if (!is_array($kw_value)) {
report_error(TYPE_ERROR, "Language file contains a \$language_data['CASE_SENSITIVE']['$kw_value'] structure which is not an array!");
}
}
}
if(!isset($language_data['SYMBOLS'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'SYMBOLS\'] structure to check!');
} else if (!is_array($language_data['SYMBOLS'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'SYMBOLS\'] structure which is not an array!');
}
if(!isset($language_data['CASE_SENSITIVE'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'CASE_SENSITIVE\'] structure to check!');
} else if (!is_array($language_data['CASE_SENSITIVE'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'CASE_SENSITIVE\'] structure which is not an array!');
} else {
foreach($language_data['CASE_SENSITIVE'] as $cs_key => $cs_value) {
if(!is_integer($cs_key)) {
report_error(TYPE_WARNING, "Language file contains an key '$cs_key' in \$language_data['CASE_SENSITIVE'] that is not integer!");
} else if (!is_bool($cs_value)) {
report_error(TYPE_ERROR, "Language file contains a Case Sensitivity specification for \$language_data['CASE_SENSITIVE']['$cs_value'] which is not a boolean!");
}
}
}
if(!isset($language_data['URLS'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'URLS\'] structure to check!');
} else if (!is_array($language_data['URLS'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'URLS\'] structure which is not an array!');
} else {
foreach($language_data['URLS'] as $url_key => $url_value) {
if(!is_integer($url_key)) {
report_error(TYPE_WARNING, "Language file contains an key '$url_key' in \$language_data['URLS'] that is not integer!");
} else if (!is_string($url_value)) {
report_error(TYPE_ERROR, "Language file contains a Documentation URL specification for \$language_data['URLS']['$url_value'] which is not a string!");
} else if (preg_match('#&([^;]*(=|$))#U', $url_value)) {
report_error(TYPE_ERROR, "Language file contains unescaped ampersands (&amp;) in \$language_data['URLS']!");
}
}
}
if(!isset($language_data['OOLANG'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'OOLANG\'] specification!');
} else if (!is_int($language_data['OOLANG']) && !is_bool($language_data['OOLANG'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'OOLANG\'] specification which is neither boolean nor integer!');
} else if (false !== $language_data['OOLANG'] &&
true !== $language_data['OOLANG'] &&
2 !== $language_data['OOLANG']) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'OOLANG\'] specification which is neither of false, true or 2!');
}
if(!isset($language_data['OBJECT_SPLITTERS'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'OBJECT_SPLITTERS\'] structure to check!');
} else if (!is_array($language_data['OBJECT_SPLITTERS'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'OBJECT_SPLITTERS\'] structure which is not an array!');
}
if(!isset($language_data['REGEXPS'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'REGEXPS\'] structure to check!');
} else if (!is_array($language_data['REGEXPS'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'REGEXPS\'] structure which is not an array!');
}
if(!isset($language_data['STRICT_MODE_APPLIES'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'STRICT_MODE_APPLIES\'] specification!');
} else if (!is_int($language_data['STRICT_MODE_APPLIES'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'STRICT_MODE_APPLIES\'] specification which is not an integer!');
} else if (GESHI_MAYBE != $language_data['STRICT_MODE_APPLIES'] &&
GESHI_ALWAYS != $language_data['STRICT_MODE_APPLIES'] &&
GESHI_NEVER != $language_data['STRICT_MODE_APPLIES']) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'STRICT_MODE_APPLIES\'] specification which is neither of GESHI_MAYBE, GESHI_ALWAYS nor GESHI_NEVER!');
}
if(!isset($language_data['SCRIPT_DELIMITERS'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'SCRIPT_DELIMITERS\'] structure to check!');
} else if (!is_array($language_data['SCRIPT_DELIMITERS'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'SCRIPT_DELIMITERS\'] structure which is not an array!');
}
if(!isset($language_data['HIGHLIGHT_STRICT_BLOCK'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'HIGHLIGHT_STRICT_BLOCK\'] structure to check!');
} else if (!is_array($language_data['HIGHLIGHT_STRICT_BLOCK'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'HIGHLIGHT_STRICT_BLOCK\'] structure which is not an array!');
}
if(isset($language_data['TAB_WIDTH'])) {
if (!is_int($language_data['TAB_WIDTH'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'TAB_WIDTH\'] specification which is not an integer!');
} else if (1 > $language_data['TAB_WIDTH']) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'TAB_WIDTH\'] specification which is less than 1!');
}
}
if(isset($language_data['PARSER_CONTROL'])) {
if (!is_array($language_data['PARSER_CONTROL'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'PARSER_CONTROL\'] structure which is not an array!');
}
}
if(!isset($language_data['STYLES'])) {
report_error(TYPE_ERROR, 'Language file contains no $language_data[\'STYLES\'] structure to check!');
} else if (!is_array($language_data['STYLES'])) {
report_error(TYPE_ERROR, 'Language file contains a $language_data[\'STYLES\'] structure which is not an array!');
} else {
$style_arrays = array('KEYWORDS', 'COMMENTS', 'ESCAPE_CHAR',
'BRACKETS', 'STRINGS', 'NUMBERS', 'METHODS', 'SYMBOLS',
'REGEXPS', 'SCRIPT');
foreach($style_arrays as $style_kind) {
if(!isset($language_data['STYLES'][$style_kind])) {
report_error(TYPE_ERROR, "Language file contains no \$language_data['STYLES']['$style_kind'] structure to check!");
} else if (!is_array($language_data['STYLES'][$style_kind])) {
report_error(TYPE_ERROR, "Language file contains a \$language_data['STYLES\']['$style_kind'] structure which is not an array!");
} else {
foreach($language_data['STYLES'][$style_kind] as $sk_key => $sk_value) {
if(!is_int($sk_key) && ('COMMENTS' != $style_kind && 'MULTI' != $sk_key)
&& !(('STRINGS' == $style_kind || 'ESCAPE_CHAR' == $style_kind) && 'HARD' == $sk_key)) {
report_error(TYPE_WARNING, "Language file contains an key '$sk_key' in \$language_data['STYLES']['$style_kind'] that is not integer!");
} else if (!is_string($sk_value)) {
report_error(TYPE_WARNING, "Language file contains a CSS specification for \$language_data['STYLES']['$style_kind'][$key] which is not a string!");
}
}
}
}
unset($style_arrays);
}
}
if(!$error_abort) {
//Initial sanity checks survived? --> Let's dig deeper!
foreach($language_data['KEYWORDS'] as $key => $keywords) {
if(!isset($language_data['CASE_SENSITIVE'][$key])) {
report_error(TYPE_ERROR, "Language file contains no \$language_data['CASE_SENSITIVE'] specification for keyword group $key!");
}
if(!isset($language_data['URLS'][$key])) {
report_error(TYPE_ERROR, "Language file contains no \$language_data['URLS'] specification for keyword group $key!");
}
if(empty($keywords)) {
report_error(TYPE_WARNING, "Language file contains an empty keyword list in \$language_data['KEYWORDS'] for group $key!");
}
foreach($keywords as $id => $kw) {
if(!is_string($kw)) {
report_error(TYPE_WARNING, "Language file contains an non-string entry at \$language_data['KEYWORDS'][$key][$id]!");
} else if (!strlen($kw)) {
report_error(TYPE_ERROR, "Language file contains an empty string entry at \$language_data['KEYWORDS'][$key][$id]!");
} else if (preg_match('/^([\(\)\{\}\[\]\^=.,:;\-+\*\/%\$\"\'\?]|&[\w#]\w*;)+$/i', $kw)) {
report_error(TYPE_NOTICE, "Language file contains an keyword ('$kw') at \$language_data['KEYWORDS'][$key][$id] which seems to be better suited for the symbols section!");
}
}
if(count($keywords) != count(array_unique($keywords))) {
$kw_diffs = array_count_values($keywords);
foreach($kw_diffs as $kw => $kw_count) {
if($kw_count > 1) {
report_error(TYPE_WARNING, "Language file contains per-group duplicate keyword '$kw' in \$language_data['KEYWORDS'][$key]!");
}
}
}
}
$disallowed_before = "(?<![a-zA-Z0-9\$_\|\#;>|^&";
$disallowed_after = "(?![a-zA-Z0-9_\|%\\-&;";
foreach($language_data['KEYWORDS'] as $key => $keywords) {
foreach($language_data['KEYWORDS'] as $key2 => $keywords2) {
if($key2 <= $key) {
continue;
}
$kw_diffs = array_intersect($keywords, $keywords2);
foreach($kw_diffs as $kw) {
if(isset($language_data['PARSER_CONTROL']['KEYWORDS'])) {
//Check the precondition\post-cindition for the involved keyword groups
$g1_pre = $disallowed_before;
$g2_pre = $disallowed_before;
$g1_post = $disallowed_after;
$g2_post = $disallowed_after;
if(isset($language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'])) {
$g1_pre = $language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'];
$g2_pre = $language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_BEFORE'];
}
if(isset($language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'])) {
$g1_post = $language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'];
$g2_post = $language_data['PARSER_CONTROL']['KEYWORDS']['DISALLOWED_AFTER'];
}
if(isset($language_data['PARSER_CONTROL']['KEYWORDS'][$key]['DISALLOWED_BEFORE'])) {
$g1_pre = $language_data['PARSER_CONTROL']['KEYWORDS'][$key]['DISALLOWED_BEFORE'];
}
if(isset($language_data['PARSER_CONTROL']['KEYWORDS'][$key]['DISALLOWED_AFTER'])) {
$g1_post = $language_data['PARSER_CONTROL']['KEYWORDS'][$key]['DISALLOWED_AFTER'];
}
if(isset($language_data['PARSER_CONTROL']['KEYWORDS'][$key2]['DISALLOWED_BEFORE'])) {
$g2_pre = $language_data['PARSER_CONTROL']['KEYWORDS'][$key2]['DISALLOWED_BEFORE'];
}
if(isset($language_data['PARSER_CONTROL']['KEYWORDS'][$key2]['DISALLOWED_AFTER'])) {
$g2_post = $language_data['PARSER_CONTROL']['KEYWORDS'][$key2]['DISALLOWED_AFTER'];
}
if($g1_pre != $g2_pre || $g1_post != $g2_post) {
continue;
}
}
report_error(TYPE_WARNING, "Language file contains cross-group duplicate keyword '$kw' in \$language_data['KEYWORDS'][$key] and \$language_data['KEYWORDS'][$key2]!");
}
}
}
foreach($language_data['CASE_SENSITIVE'] as $key => $keywords) {
if(!isset($language_data['KEYWORDS'][$key]) && $key != GESHI_COMMENTS) {
report_error(TYPE_WARNING, "Language file contains an superfluous \$language_data['CASE_SENSITIVE'] specification for non-existing keyword group $key!");
}
}
foreach($language_data['URLS'] as $key => $keywords) {
if(!isset($language_data['KEYWORDS'][$key])) {
report_error(TYPE_WARNING, "Language file contains an superfluous \$language_data['URLS'] specification for non-existing keyword group $key!");
}
}
foreach($language_data['STYLES']['KEYWORDS'] as $key => $keywords) {
if(!isset($language_data['KEYWORDS'][$key])) {
report_error(TYPE_WARNING, "Language file contains an superfluous \$language_data['STYLES']['KEYWORDS'] specification for non-existing keyword group $key!");
}
}
foreach($language_data['COMMENT_SINGLE'] as $ck => $cv) {
if(!is_int($ck)) {
report_error(TYPE_WARNING, "Language file contains an key '$ck' in \$language_data['COMMENT_SINGLE'] that is not integer!");
}
if(!is_string($cv)) {
report_error(TYPE_WARNING, "Language file contains an non-string entry at \$language_data['COMMENT_SINGLE'][$ck]!");
}
if(!isset($language_data['STYLES']['COMMENTS'][$ck])) {
report_error(TYPE_WARNING, "Language file contains no \$language_data['STYLES']['COMMENTS'] specification for comment group $ck!");
}
}
if(isset($language_data['COMMENT_REGEXP'])) {
foreach($language_data['COMMENT_REGEXP'] as $ck => $cv) {
if(!is_int($ck)) {
report_error(TYPE_WARNING, "Language file contains an key '$ck' in \$language_data['COMMENT_REGEXP'] that is not integer!");
}
if(!is_string($cv)) {
report_error(TYPE_WARNING, "Language file contains an non-string entry at \$language_data['COMMENT_REGEXP'][$ck]!");
}
if(!isset($language_data['STYLES']['COMMENTS'][$ck])) {
report_error(TYPE_WARNING, "Language file contains no \$language_data['STYLES']['COMMENTS'] specification for comment group $ck!");
}
}
}
foreach($language_data['STYLES']['COMMENTS'] as $ck => $cv) {
if($ck != 'MULTI' && !isset($language_data['COMMENT_SINGLE'][$ck]) &&
!isset($language_data['COMMENT_REGEXP'][$ck])) {
report_error(TYPE_NOTICE, "Language file contains an superfluous \$language_data['STYLES']['COMMENTS'] specification for Single Line or Regular-Expression Comment key $ck!");
}
}
if (isset($language_data['STYLES']['STRINGS']['HARD'])) {
if (empty($language_data['HARDQUOTE'])) {
report_error(TYPE_NOTICE, "Language file contains superfluous \$language_data['STYLES']['STRINGS'] specification for key 'HARD', but no 'HARDQUOTE's are defined!");
}
unset($language_data['STYLES']['STRINGS']['HARD']);
}
foreach($language_data['STYLES']['STRINGS'] as $sk => $sv) {
if($sk && !isset($language_data['QUOTEMARKS'][$sk])) {
report_error(TYPE_NOTICE, "Language file contains an superfluous \$language_data['STYLES']['STRINGS'] specification for non-existing quotemark key $sk!");
}
}
foreach($language_data['REGEXPS'] as $rk => $rv) {
if(!is_int($rk)) {
report_error(TYPE_WARNING, "Language file contains an key '$rk' in \$language_data['REGEXPS'] that is not integer!");
}
if(is_string($rv)) {
//Check for unmasked / in regular expressions ...
if(empty($rv)) {
report_error(TYPE_WARNING, "Language file contains an empty regular expression at \$language_data['REGEXPS'][$rk]!");
} else {
if(preg_match("/(?<!\\\\)\//s", $rv)) {
report_error(TYPE_WARNING, "Language file contains a regular expression with an unmasked / character at \$language_data['REGEXPS'][$rk]!");
} elseif (preg_match("/(?<!<)(\\\\\\\\)*\\\\\|(?!>)/s", $rv)) {
report_error(TYPE_WARNING, "Language file contains a regular expression with an unescaped match for a pipe character '|' which needs escaping as '&lt;PIPE&gt;' instead at \$language_data['REGEXPS'][$rk]!");
}
}
} elseif(is_array($rv)) {
if(!isset($rv[GESHI_SEARCH])) {
report_error(TYPE_ERROR, "Language file contains no GESHI_SEARCH entry in extended regular expression at \$language_data['REGEXPS'][$rk]!");
} elseif(!is_string($rv[GESHI_SEARCH])) {
report_error(TYPE_ERROR, "Language file contains a GESHI_SEARCH entry in extended regular expression at \$language_data['REGEXPS'][$rk] which is not a string!");
} else {
if(preg_match("/(?<!\\\\)\//s", $rv[GESHI_SEARCH])) {
report_error(TYPE_WARNING, "Language file contains a regular expression with an unmasked / character at \$language_data['REGEXPS'][$rk]!");
} elseif (preg_match("/(?<!<)(\\\\\\\\)*\\\\\|(?!>)/s", $rv[GESHI_SEARCH])) {
report_error(TYPE_WARNING, "Language file contains a regular expression with an unescaped match for a pipe character '|' which needs escaping as '&lt;PIPE&gt;' instead at \$language_data['REGEXPS'][$rk]!");
}
}
if(!isset($rv[GESHI_REPLACE])) {
report_error(TYPE_WARNING, "Language file contains no GESHI_REPLACE entry in extended regular expression at \$language_data['REGEXPS'][$rk]!");
} elseif(!is_string($rv[GESHI_REPLACE])) {
report_error(TYPE_ERROR, "Language file contains a GESHI_REPLACE entry in extended regular expression at \$language_data['REGEXPS'][$rk] which is not a string!");
}
if(!isset($rv[GESHI_MODIFIERS])) {
report_error(TYPE_WARNING, "Language file contains no GESHI_MODIFIERS entry in extended regular expression at \$language_data['REGEXPS'][$rk]!");
} elseif(!is_string($rv[GESHI_MODIFIERS])) {
report_error(TYPE_ERROR, "Language file contains a GESHI_MODIFIERS entry in extended regular expression at \$language_data['REGEXPS'][$rk] which is not a string!");
}
if(!isset($rv[GESHI_BEFORE])) {
report_error(TYPE_WARNING, "Language file contains no GESHI_BEFORE entry in extended regular expression at \$language_data['REGEXPS'][$rk]!");
} elseif(!is_string($rv[GESHI_BEFORE])) {
report_error(TYPE_ERROR, "Language file contains a GESHI_BEFORE entry in extended regular expression at \$language_data['REGEXPS'][$rk] which is not a string!");
}
if(!isset($rv[GESHI_AFTER])) {
report_error(TYPE_WARNING, "Language file contains no GESHI_AFTER entry in extended regular expression at \$language_data['REGEXPS'][$rk]!");
} elseif(!is_string($rv[GESHI_AFTER])) {
report_error(TYPE_ERROR, "Language file contains a GESHI_AFTER entry in extended regular expression at \$language_data['REGEXPS'][$rk] which is not a string!");
}
} else {
report_error(TYPE_WARNING, "Language file contains an non-string and non-array entry at \$language_data['REGEXPS'][$rk]!");
}
if(!isset($language_data['STYLES']['REGEXPS'][$rk])) {
report_error(TYPE_WARNING, "Language file contains no \$language_data['STYLES']['REGEXPS'] specification for regexp group $rk!");
}
}
foreach($language_data['STYLES']['REGEXPS'] as $rk => $rv) {
if(!isset($language_data['REGEXPS'][$rk])) {
report_error(TYPE_NOTICE, "Language file contains an superfluous \$language_data['STYLES']['REGEXPS'] specification for regexp key $rk!");
}
}
}
output_error_cache();
flush();
if($error_abort) {
break;
}
}
}
?></li>
</ol>
<p>Validation process completed in <?
$time_end = explode(' ', microtime());
$time_diff = $time_end[0] + $time_end[1] - $time_start[0] - $time_start[1];
echo sprintf("%.2f", $time_diff);
?> seconds.</p>
<div id="footer">GeSHi &copy; 2004-2007 Nigel McNie, 2007-2008 Benny Baumann, released under the GNU GPL</div>
</body>
</html>

View File

@@ -1,29 +0,0 @@
BUGS - list of known bugs in GeSHi
Version 1.0.8
- Number highlighting is quite poor [possibly better now]
- I'm not happy with URLS - there still could be extra bugs, and it's rather unflexible
(see TODO for a possible fix)
- "Important" sections for some reason seem to have their spans added after every
newline up until the next lexic, instead of stopping at the <END GeSHi> part. In fact,
context sensitiveness is quite poor...
- Using the extra line number highlighting feature without actually using line numbers
will result in malformed XHTML (not sure about this one though...)
- Slow!!! Especially for source with lots of strings in it. GeSHi will work acceptably
for sourcecode under 5K (for simple language files like SQL, a 100K file can be
highlighted in just 6 seconds), but above about 25K things get a little slow... If
you're using this as part of some larger software, you may want to think about
making some sort of "cache" effect to speed things up and reduce server load.
- The result is built by string replacement instead of by building another string based
on the source, that would be much safer. The focus of releases beyond 1.0.7 will be on
changing this behaviour, which may well fix some of the other bugs mentioned above.
- As of 1.0.7.1, dots (.) are allowed before keywords. This may change highlighting of some
things slightly, if you notice anything odd about the highlighting then please report
it to me.
- Perl/Javascript /.../ regex syntax is only supported basically and there's no
guarantee it is working all the time.
- The <pre> header output is not XHTML compliant. Please use the <div> header instead.
Send any bug reports to BenBE@omorphia.de, or submit them via the bug tracker at
sourceforge (http://sourceforge.net/tracker/?group_id=114997&atid=670231)

View File

@@ -1,682 +0,0 @@
CHANGES - Changelog for GeSHi (geshi.php only)
Changes to the code are listed under the version they occured in, with who suggested
it by each one (if there's nobody listed as suggesting it I dreamed it up :)). Users
who suggested an idea often also provided the code that was used as a basis for the
changes - thanks to all who suggested these ideas and gave me the code to show me how!
Language files listed under each version were made by the author beside them, and then
modified by me for consistency/bug fixing.
Please send any bug reports to BenBE@omorphia.de, or use the bug report tracker
at sourceforge (http://sourceforge.net/tracker/?group_id=114997&atid=670231)
Version 1.0.8.3
- Added language files
* DCS (Stelio Passaris)
* Locomotive Basic (Nacho Cabanes)
* LSL2 (Linden Scripting Language) (William Fry)
* Modula-3 (Martin Bishop)
* Oberon-2 (Mike Mol)
* Rebol (Lecanu Guillaume)
- Fixed a problem where HardEscapes weren't working when no escape char was given (BenBE)
- Added a PARSER_CONTROL setting to treat whitespace inside of keywords in
the language file as "any whitespace" in the source (i.e. "CREATE TABLE"
in SQL will match "CREATE\s+TABLE" instead of literally matching) (BenBE)
- Added a possibility to allow setting the style for escape characters (BenBE)
- Improvements to language files (BenBE)
* Added some missing Perl keywords and obscure default variables (BenBE)
* Allow for escaped colons to appear in CSS names (BenBE, simon)
* Added multiline continuation suppoert of preprocessor defines for
C, C for Mac, C++ and CC++ with Qt support (BenBE)
* keywords for C-based languages are case-sensitive (BenBE)
* Broken AutoIt highlighting (BenBE)
* Problem with escaped backslash in PHP and D (BenBE)
* Added some more functions for PHP (BenBE)
* Some changes for AppleScript (Stefan Klieme)
* Forbid highlighting keywords followed by / in bash (BenBE)
* Updated the LaTeX file to link some keywords (BenBE)
* Additional text rendered when matching special variables for PowerShell (BenBE)
* Added some more keywords for ABAP (BenBE, Sandra Rossi, Jacob Laursen)
Version 1.0.8.2
- Added language files
* Brainfuck \ Brainfork (Benny Baumann)
* HQ9+ (Benny Baumann)
* INTERCAL (Benny Baumann)
* LOLcode (Benny Baumann)
* LScript (Beau McGuigan)
* Pixel Bender (Richard Olsson)
* ProvideX (Jeff Wilder)
* VIM Script (Swaroop C H)
* Visual Prolog (Thomas Linder Puls)
* Whitespace (Benny Baumann)
- Changed priority for COMMENT_REGEXP compared to String highlighting (BenBE)
- Fixed correct escaping of spaces inside of URLs (BenBE)
- Updated the list of common file extensions (BenBE)
- Updated the language file check script in contrib/ (BenBE)
- Fixed a problem with link targets resulting in unclickable links (SF#2379120, BenBE)
- Fixed an undefined variable issue in langcheck.php (BenBE)
- Improvements to language files (BenBE)
* eMail Header highlighting now uses the correct delimiters for keywords (BenBE)
* eMail (RFC822\mbox) highlighting now highlights IPs, MIME types and
subfield assignments correctly (BenBE)
* Minor style changes in COBOL to improve loading performance (BenBE)
* Added some missing keywords for D (BenBE)
* Removed duplicate keywords from Progres, SAS and TSQL (BenBE)
* Fixed Heredoc Syntax for Bash (SF#2185319, BenBE)
* Moved symbol-lookalike sequences from keyword groups to separate symbol group
for languages asp, klonec, klonecpp, php, php-brief (BenBE)
* Fixed a lot of duplicate keyword warnings (BenBE)
* Added missing keywords to the Python language file,
introducing support for Python 3.0. (SF#2441839, milian)
* Updated documentation links for TypoScript (SF#2014276, BenBE)
* Fixed a problem with tag and attribute names in XML highlighting (SF#2276119, BenBE)
* Improved MySQL language file (BenBE, JavaWoman)
* Some commentss accidentially mistaken for DocComments (SF#2454897, BenBE)
* Added improved Escape Char handling for c, c_mac, cpp and cpp_qt (SF#2458743, BenBE)
Version 1.0.8.1
- Added language files
* AviSynth (Ryan Jones)
* eMail \ mbox (Benny Baumann)
* GNU Make (Neil Bird)
* Oracle 11i support (Simon Redhead)
* Prolog (Benny Baumann)
* SciLab (Christophe David)
* TeraTerm macro language (Boris Maisuradze)
- Added support for Escape Regular Expressions (BenBE)
* Implemented C-style Escapes in PHP (BenBE)
* Introduced support for \xAB and \007 style Char Escapes in PHP (BenBE)
* Implemented Variable Highlighting in PHP (BenBE)
* Implemented Variable Highlighting in Bash (milian)
- Fixed a problem with PCRE patterns for Keyword matching sometimes producing
very large strings, that could not be handled by some versions of PCRE lib,
causing broken highlighting an Regexp Compile errors (BenBE, milian)
- Fixed broken highlighting of bash commands like `dbus-send --dest=org.....`,
i.e. the dest was highlighted as variable declaration (milian)
- Fixed broken highlighting of some symbols in their escaped form (BenBE)
(<SEMI> and <PIPE> were accidentially filtered even though they are valid)
- Fixed a "memory leak" in the *_regexp_caches (milian)
- Fixed broken Escape chars if classes were disabled
- start_line_numbers_at() was ignored when GESHI_HEADER_PRE_TABLE was set (revulo)
- Fixed a problem allowing Remote Code Inclusion under certain circumstances (BenBE)
- Changes to default CSS in order to make the GESHI_HEADER_PRE_TABLE align properly,
even on Windows / Mac systems with strange fonts (milian, revulo, ^RT)
- Minor style changes to the following languages:
* cpp-qt (milian)
* MySQL (BenBE)
* PHP (BenBE)
- Improvements to language files (BenBE, milian)
* Added MinSpareThread\MaxSpareThreads to Apache highlighter (BenBE)
* Added new Keyword group for APT sources.list highlighter (BenBE)
* Fixed highlighting in LaTeX for \begin{} and \end{}, i.e. the stuff inside
the curly braces. (milian, thanks for the report go to Matthias Pospiech)
* Improved String support for D (BenBE)
* MySQL was seriously broken (BenBE)
* Reworked Keyword groups for MySQL to allow for more configuration (BenBE)
* Improved Mirc script language file (milian)
* Improved C++ Qt language file (milian)
* Minor bug with Transpose Operator in Matlab (BenBE, Daniele de Rigo)
* Highlighting of Batch Files for Windows (BenBE)
* Updated AutoIt to include latest changes for AutoIt v3.2.12.1 (BenBE, Thierry)
* Fixed duplicate keyword warnings for Perl, Tcl and Typoscript (BenBE)
* Fixed Doc-URL getting reparsed by highlighted keywords of other groups (BenBE, Jordi Boggiano)
Version 1.0.8
- Added language files
* APT sources.list (milian)
* Boo (Marcus Griep)
* CIL (Common Intermediate Language, .NET Assembly) (Marcus Griep)
* COBOL (Benny Baumann)
* Gnuplot (milian)
* KLoneC (Mickael Auger)
* KLoneC++ (Mickael Auger)
* PIC16xxx assembler (Phil Mattison)
* POV-Ray (Carl Fürstenberg)
* PowerShell (Frode Aarebrot)
* Progress (Marco Aurelio de Pasqual)
* TypoScript (Jan-Philipp Halle)
* Xorg configuration (milian)
- Make GeSHi's constructor arguments optional, so something like `$foo = new GeSHi;` is possible. (milian)
- Added an optimizer for lists to regular expressions. Using these cached lists results in a speedup of approx. 50%.
The slightly increased memory consumption (~150KB for PHP language file) is more than worth it! (milian)
- Some more memory & speed optimizations all over GeSHi (milian)
* Reduced memory overhead when highlighting keywords (BenBE)
* Keyword Linking now uses considerably less strtolower calls (milian)
* Cache Symbol Search Regexp and make Symbol Highlighting faster (milian)
* Use more native functions like substr_replace and strcasecmp to speed things up (milian)
* Use considerably less strlen() calls on various points by caching the results (milian)
* Properly set comments to be case insensitive where appropriate to increase performance (milian)
* Improve the performance of the strict mode tokenizer, making highlighting of languages like
HTML, ColdFusion or XML faster (milian)
* Setup caches for parsing on demand to make stylesheet generators fast (milian)
- Various improvements to Strict Block Handling (BenBE, milian)
* Added support for RegExp-based Strict Blocks (BenBE)
* Fixed highlighting incorrectly stopping at ?> in PHP (SF#1330968, BenBE)
* Languages with STRICT_MODE_APPLIES = GESHI_MAYBE default to strict mode now. When no highlightable
code is found in this mode, we fallback to the same setting as if GESHI_NEVER was set. That way it
should not be needed to call enable_strictmode() manually. (milian)
- Added new GESHI_HEADER_PRE_VALID type which uses the following markup: (milian)
* With line numbers: <div>header<ol><li><pre>...</pre></li>...</ol></div>
* Without line numbers: <pre>header...CODE...</pre>
=> valid HTML and no need for &nbsp; indentation
- Added new GESHI_HEADER_PRE_TABLE type which can be used to prevent linenumber-selection in Firefox
on copy'n'paste. (milian)
- set_language will not reset any language settings by default anymore.
* Added $force_reset param for to force full reload of a language. (milian)
* Make sure strict_mode is set properly when doing repeated set_language calls (milian)
- Fixed some problems with old PHP versions (SF#1975625, milian, BenBE)
- Fixed broken use with Suhosin Patch when /e modifier was disabled (SF#2021800, BenBE)
- Added support for external style information files to override language defaults without modifying language files (BenBE)
- The overall_class is now up to the user, and the language-code is _always_ added as a class (milian)
- Fixed Economy Mode for GeSHi::get_stylesheet() - now it just makes so much more sense! (milian)
- Fixed Economy Mode when COMMENT_REGEXP are used (BenBE)
- Changed the default encoding to use UTF-8, due to SF#2037598, BenBE)
- Improved overall string support:
* Added support for multichar string delimiters (SF#1932083, BenBE)
* Fixed problems of unfinished strings and comments producing invalid XHTML (SF#1996353, BenBE)
* Multichar Quotemarks sometimes had inconsistent behaviour (BenBE)
* Support for multiple styles of strings depending on the starter (BenBE)
* Properly handle escapes in strings, i.e. '\\' was not working properly before (milian)
* Fixed escape char support when an escape char is followed by multi-byte chars (SF#2037598, BenBE)
- Improved flexibility in language files (BenBE, milian)
* Added PARSER_CONTROL for OOLANG method highlighting (SF#1923060, BenBE)
* Added possibility to define strict blocks using an Regexp (BenBE)
* Removed explicit escaping of / in Regular Expressions (BenBE)
* Ignoring empty keyword groups when highlighting (milian)
* Make language_permissions configurable in language files via ['PARSER_CONTROL']['ENABLE_FLAGS']
this makes is_a calls unneeded and thus prevents PHP notices in PHP 5.x (milian)
* Extended support for number formats now covering the most common formats (SF#1923058, BenBE)
* Lifted a limitation that keywords had to have at least 2 subsequent letters (BenBE)
* Changed behaviour of PARSER_CONTROL now allowing to provide the full Lookahead and Lookbehind
expressions used as delimiters inside keywords instead of a simple char group (BenBE)
* Fixed improper handling of newlines in REGEXPS so this does not produce invalid html anylonger (milian)
- Some typos and mistakes in the documentation (BenBE)
- Added a script to contrib/ to verify language files are correct (BenBE)
- Fixed loads of compliancy warnings detected with that automated compliance testing script (BenBE)
- Many other improvements to various language files (BenBE, milian)
* Reduce strict errors & notices for language files (milian)
* Fixed symbol highlighting with C++ sometimes missing keywords after ; and comments (BenBE)
* Improved comment handling with TCL (Lars Hellström, BenBE)
* Fixed broken handling with XML comments (BenBE, SF#1849233)
* Fixed HTML comments spawning multiple lines producing invalid XHTML output (SF#1738173, BenBE)
* Added support for parameters beginning with dash in BASH language (BenBE)
* Support Apache's configuration sections, see http://httpd.apache.org/docs/2.2/sections.html (milian)
* Minor issue with PHP Heredoc and Nowdoc syntax sometimes not getting highlighted (BenBE)
* Updated Objective-C language file (SF#2013961, Quinn Taylor, BenBE)
* Added some keywords for VHDL (beshig, BenBE)
* Fixed severly broken ColdFusion language file (milian)
* Fixed some incorrectly highlighted things with the CSS language file (milian, BenBE)
* Improved Smarty language file (milian)
* Improved CSS language file (milian)
* Improved Pascal language file (milian)
* Improved LaTeX language file (Андрей Парамонов, BenBE)
* Fixed a regular expression in mIRC language file that caused a warning message to be issued (BenBE)
* Removed <, > and / from HTML names, now only containing the real tag names (BenBE)
* Use spaces instead of tabs for indendation in language files to have a consistent
coding standard accross geshi files (milian)
* Added some comment styles, keywords and added index highlighting (Chusslove Illich, Часлав Илић)
- Removed some private methods which were only called at exactly one place (milian)
* format_header_content
* format_footer_content
* get_attributes
- Second part of default style changes. Affected in this release:
* C++
* C++ (QT)
* CSS
* VHDL
Version 1.0.7.22
- Added language files
* glSlang (BenBE)
* KiXtart (Riley McArdle)
* Lotus Notes @Formulas (Richard Civil)
* LotusScript (Richard Civil)
* MXML (David Spurr)
* Scala (Franco Lombardo)
* ActionScript 3 (Jordi Boggiano)
* GNU Gettext .po/.pot (Milian Wolff)
* Verilog (Günter Dannoritzer)
- Fixed a problem not yet addressed in 1.0.7.21 regarding highlighting of
symbols that caused some extra characters to be added in the output or
broke highlighting and standard compliance due to missing escaping of
internally used characters (SF#192320 and SF#1926259, BenBE)
- Fixed missing style information for ocaml language file (The_PHP_Jedi)
- Fixed a bug causing masses of warnings in rendered output if language file
miss style information (The_PHP_Jedi, BenBE)
- Missing tab width information could lead to warnings (BenBE)
- Missing symbol information for ASP (SF#1952038, nfsupport, BenBE)
- Empty delimiter message with OOoBasic (BenBE, Ccornell)
- Escaping of comments in LaTeX ignored (SF#1749806, BenBE)
- Modified Math environment $$ in LaTeX to be non-greedy (BenBE)
- Added possibility to match a regexp as comment (SF#1914640, SF#1945301, SF#1934832, BenBE)
- Introduced C-Style multiline continuation comments (SF#1914640, SF#1945301, BenBE)
- Introduced Fortran Comments (SF#1914640, SF#1934832, BenBE)
- Implemented Heredoc and Nowdoc Syntax for PHP and Perl (SF#1914640, BenBE)
- Implemented Compiler Directives for Delphi (SF#1914640, BenBE)
- Implemented minimalistic support for JavaScript \ Perl Regular Expressions (SF#1786665, SF#1754333, SF#1956631, BenBE)
- Fixed Strings in Matlab to be handled as comments instead of regexps, to prevent keywords being linked (BenBE)
- Applied PARSER_CONTROL fix of CPP for CPP-QT-Derivative (BenBE)
- Fixed incorrect treatment of unequally long multiline comment separators (related to SF #1891630, BenBE)
- Added PARSER_CONTROL settings for keywords in ASM language file (SF#1835148, BenBE)
- Fixed missing CASSE_SENSITIVE entry for DOS language file (SF#1956314, BenBE)
- Fixed accidential highlighting of keywords in argument names (SF#1956456, Milian Wolff, BenBE)
- Fixed yet again some #-related bash problem (SF#1956459, Milian Wolff, BenBE)
- Added backticks as symbols (Milian Wolff)
- Example script remembers selections and source submitted (Milian Wolff)
- Example script allows remembered source and preselected language to be cleared (Milian Wolff)
- Example script now properly includes geshi and doesn't suppress error messages anylonger. (Milian Wolff)
- Code cleanup by using direct string indexing instead of substr with length 1 (Milian Wolff)
- Optimized generation of code parts in strict mode (Milian Wolff)
- Optimized COMMENT_REGEXP by using an incremental regexp cache (Milian Wolff, BenBE)
- Fixed a problem that rarely skipped highlighting of escaped chars which usually should have gotten highlighted (BenBE)
- Optimized generation of highlighted strings to use fast skip forward while highlighting them (Milian Wolff, BenBE)
- Optimization using basic rework of indent function improving tab expansion performance (BenBE)
- Lots of other minor optimizations based on coding style improvements (Milian Wolff)
- Implemented setting to force spans to be closed before newlines, see SF#1727398 (Milian Wolff)
- Added missing credits for D language file to THANKS file (SF#1720899, BenBE)
- Optimization to prevent loading the current language file twice (Milian Wolff)
- Optimization: Use file_get_contents() to load sourcecode from files.
Even if GeSHi worked with PHP 4.1 before, it doesn't now. (Milian Wolff)
- Added description of extra language features (SF#1970248, BenBE)
- Added support for highlighting the C# using and namespace directives (SF #1395677, BenBE)
- Added support for highlighting the Java import and package directives (SF #1395677, BenBE)
- Fixed minor problem in Haskell cuasing accidential start of comment (SF#1987221, BenBE)
- Fixed minor issue causing loads of warnings if a language files defines no symbols (BenBE)
- Updated some aspects of the documentation and included further hints (BenBE)
- First of series of color scheme changes. Affected languages (sofar):
* Assembler (x86)
* Bash
* C
* C#
* Delphi
* Fortran77
* glSlang
* Java & Java 5
* JavaScript
* OCaml
* OpenOffice.org Basic
* Pascal
* Perl
* PHP and PHP-Brief
Version 1.0.7.21
- Added language files
* Basic4GL (Matthew Webb)
- Fixed problem with mIRC language highlighting spaces only (BenBE)
- Language files can now specify a function to be called to decide the
colour of a regular expression match
- Added single quote to Lua (Darrin Roenfanz)
- Compare comments case insensitively (fixes AutoIT comments somewhat)
(Daniel Gordon)
- Fixed symbols not being highlighted at all (SF #1767953, BenBE)
- Fixed brackets not correctly managed (SF #1767954, BenBE)
- Changed default languages for some extensions
- Included color and character information for symbol highlighting in some languages (BenBE)
- Fixed a problem with extension detection if default was used (BenBE)
- Fixed a highlighting problem with the LaTeX language (SF #1776182, BenBE)
- Added a new parameter for enable_highlighting to reduce source duplication (SF #1786104, BenBE)
- Updated doxygen documentation to include since tags and some missing parameters
- Disabled symbol highlighting by default (doesn't affect brackets, cf. documentation) (BenBE)
- Added a check for set_case_keywords for the given param to be supported (BenBE)
- Minor rework of the HTML documentation layout \ W3C compliance (BenBE)
- Fixed highlighting error in bash language avoiding keywords in comments (SF #1786314, SF #1564839, BenBE)
- Fixed template params for C++ and C# not being highlighted (SF #1772919, BenBE)
- Fixed more reported problems about mirc highlighting
- Added some missing keywords for VB.NET
- Fixed some warnings in DOS language file (Florian Angehrn)
- Add possibility to handle more than one extra line style (SF #1698255, German Rumm, BenBE)
- Fixed handling of URLs when output case differs from URL case (SF #1815504, Tom Samstag, BenBE)
- Fixed POD (Plain Old Documentation) format problems breaking highlighting of Perl (SF #1891630, Shannon Wynter, BenBE)
- Fixed a problem with mIRC when & was used for identifiers (SF #1875552, BenBE)
Version 1.0.7.20
- Added language files
* Genero (logic) and Per (forms) (FOURJ's Genero 4GL) (Lars Gersmann)
* Haskell (Dagit)
* ABAP (Andres Picazo)
* Motorola 68k Assembler (for MC68HC908GP32 Microcontroller) (BenBE)
* Dot (Adrien Friggeri)
- Fixed java documentation search for keywords to actually go to the
documentation (spaze)
- Applied fix for bug 1688864 (bad regexes) (Tim Starling)
- Fixed comment CSS rule in visualfoxpro
- ThinBASIC language update (Eros Olmi)
- mIRC language update (BenBE)
- Fixed outdated documentation URL of Perl language file (RuralMoon by BenBE)
- Fixed tab replacement code not generating the correct number of spaces in
some cases (Guillermo Calvo)
- Fixed two typos in Z80 language file
- Applied fix for bug 1730168 (Daniel Naber)
- Applied fix for bug 1705482 (Jason Frame)
* Configurable line endings (Replace \n by custom string)
* per-language tab-widths (Adjustable for width>=1)
* Included defaults for ASM (x86, m68k, z80), C, C (Mac), C++, C++ (QT), C#,
Delphi, CSS,, HTML, PHP, PHP (Brief), QBasic, Ruby, XML
- Added a possibility to force generation of a surrounding tag around
the highlighted source
- Applied fix for additional keywords for the bash language
(cf. http://bash.thefreebizhost.com/bash_geshi.php, BenBE / Jan G)
- Fix bad colour definition in GML language (Andreas Gohr)
- Fixed phpdoc comments not being indented one space if they should be (Andy
Hassall)
Version 1.0.7.19
- Added language files
* X++ (Simon Butcher)
* Rails (Moises Deniz)
- Fixed invalid HTML being generated and doctypes not being highlighted over
multiple lines properly when line numbers are on (Validome)
- Improved the ruby syntax highlighting by basing it off the Rails file
- Changed some regular expressions to possibly help with badly performing
regex support in PHP (Tim Starling)
- Allow {TIME}, {LANGUAGE} and {VERSION} to be used in the header as well as
the normal <TIME>/<LANGUAGE>/<VERSION> (AthanD)
- Changed comment regex in bash to prevent malformed XHTML (rv1971)
Version 1.0.7.18
- Added language files
* ZiLOG Z80 Assembly (BenBE)
- Fixed incorrect highlighting when the starter of a multiline comment is
longer than the ender (Robert Anthony).
- Fixed "</span" generated if a multiline comment is the last thing in the
source (related to the above).
- Added #cs => #ce comment markers to AutoIT (Robert Anthony)
- Fixed spelling mistake for keyword in Python (wd3)
- Added a method to enable/disable keyword linking (Ian McKellar)
- Improved empty line detection for HTML output (BenBE)
- Changed code style of geshi.php, and removed tabs
Version 1.0.7.17
- Fixed up ends of files having too many newlines (binarygroop)
- Removed background colour on keyword group in eiffel (Julian Tschannen)
- Removed GESHI_DIR_SEPARATOR constant usage, it's unnecessary (Aleksey Zapparov)
- Added /* ... */ comments to coldfusion (Jeff Howden)
Version 1.0.7.16
- Added language files
* ActionScript (Steffen Krause)
* C++/QT (Iulian M)
* PL/SQL (Victor Engmark)
- Fixed up my e-mail address everywhere
- Fixed notice with "error" property (IZIU Zielona Góra)
- Added some entries to the get_language_name_from_extension table
(Stebastian Schuberth)
Version 1.0.7.15
- Added language files
* BNF (Rowan Rodrik van der Molen)
* IO (me, thanks to Johnathan Wright)
* mIRC (Alberto de Areba Sánchez)
- Fixed use of colon in XML (Grigory Rubtsov)
- Fixed notices in text.php, reg.php and latex.php when $this is not
available (Clemens Weiß)
- Made third parameter of geshi_highlight optional (Gaetano Giunta)
- Fix incorrect highlighting of the $# variable in bash (Michael Knight)
- Fixed single line comment mistake in thinbasic.php (Eros Olmi)
Version 1.0.7.14
- Added language files
* thinBasic (Eros Olmi)
* LaTeX (Matthais Pospiech)
- Removed extra newlines at the end of some files
- Fixed SF bug 1556404 - check before using $this in language files
(Clemens Weiß)
Version 1.0.7.13
- Added language files
* Uno IDL (Cedric Bosdonnat)
- Fixed add_ids causing odd XHTML (RyanJ)
- Fixed extra newline being added to end of result (Andreas Gohr)
Version 1.0.7.12
- Fixed lines being collapsed when they contain just a space (artlover)
- Allowed matching for regexes using start/end matchers at the start/end
of the code (Sheri)
- Added (dubious) fix for google "I'm feeling lucky" search for java keywords
(dubious in that it doesn't work for me)
- mysql - Made the symbols into their own keyword group as the symbol group
isn't used. Added a style for multiline comments.
- Added a couple of php5 keywords to the php language files.
- Allow XML tags to have dashes.
- Changed LANG_NAME for many languages to be more sensible/correct case
(Matthias Mohr)
- Added case-sensitivity indices to python
Version 1.0.7.11
- Added language files
* Smalltalk (Bananeweizen)
- Minor style improvements to matlab
- Moved a couple of functions to the correct group in smarty (arwan)
Version 1.0.7.10
- Added language files
* TCL (Reid van Melle)
* Winbatch (Craig Storey)
* Groovy (Ivan F. Villanueva B.)
* Text (SmokingRope)
* Reg (SmokingRope)
- Removed \ as an escape character in T-SQL (Dave Jackson)
- Reset extra lines to highlight if source is changed (Diogo Resende)
- Allow setting of lexic permissions in language files (SmokingRope)
- Allow regexes to set a CSS class name (SmokingRope)
- Added URL support to DOS language (mastrboy)
Version 1.0.7.9
- Added language files
* Fortran (Cedric Arrabie)
* SAS (Galen Johnson)
* CFDG (John Horigan)
- Fixed & in URL in java5 (Clemens Weiß)
- Added MD5 and SHA1 to mysql keywords (polarina)
- Fixes for highlight_lines_extra with line numbers (ithcy)
- Fixed backslash characters being removed (ArTourter)
Version 1.0.7.8
- Fixed blank at start of MySQL file (W. Tasin)
- Fixed smarty functions being broken (ultrabob)
- Changed keyword and regexp detection and parsing
slightly to allow more "meta characters" (like #) in
keywords
- Minor fixes for XML and GML
Version 1.0.7.7
- Added language files
* T-SQL (Duncan Lock)
* Robots.txt (Christian Lescuyer)
* AutoIT (mastrboy)
* Java 5 (Clemens Bruckmann)
* ColdFusion (Diego)
- A few keyword changes in java, removed :: object splitter (amphi)
- Now using a simpler regular expression for numbers (Brice Bernard)
- Fixed ah, bh etc. regs being highlighted as numbers (Unknown)
Version 1.0.7.6
- Fix backtick-string highlighting in ruby (Juan J. Martínez)
- Add =begin multiline comments in ruby (Juan J. Martínez)
- Added support for :keywords and ::access in lisp (Denis Mashkevich)
- Prevented number highlighting if they are just after underscores (Joce)
- Removed escape characters for strings in XML and HTML (floele)
- Added instanceof keyword to java (jgottschling)
- Fixed comments in ASP (SBD)
- Removed unnecessary keyword style index from ini
- Added support for " strings in ini
- Removed unnecessary regex style index from blitzbasic
- Keyword case of URL-ed keywords should be defined by language file (Benny Baumann)
- Added "Hardquote" feature, provides more accurate string highlighting (Cliff Stanford)
- Used hardquote support for @"..." strings in C# (Cliff Stanford)
- Used hardquote support for ' strings in perl (Cliff Stanford)
- Fixed setting of language path (Cliff Stanford)
- Display source correctly formatted with line numbers (if requested) if an error
has occured (several people)
- Having no source to highlight is not an error condition anymore
- Delphi language updated to include more keywords and types (BenBE)
- Updated NSIS to version 2.11 (deguix)
Version 1.0.7.5
- Fix for using escape characters to escape newlines breaking XHTML compliance (Yves Goergen)
- Fixed method highlighting in VB (Matt Beale)
- Fixed multiline comment highlighting in SQL (MrBaseball34)
- Fixed two ">" symbols being outputted when using a footer but not CSS classes (MrBaseball34)
- Marked important block stuff as deprecated
- Some documentation tidyup
- Updated GML language file (Jos? Jorge Enr?quez Rodr?guez)
- THANKS file tidied up
- Fixed double </a> for elements in HTML (Yves Goergen)
- Added some keywords for ASM (Dreuzzo)
Version 1.0.7.4
- Added language files
* MySQL (Carl Fürstenberg)
* BlitzBasic (Pàdraig O`Connel)
- Fixed up geshi_highlight function: it now correctly uses <code> instead of <div> (Remi Faure)
- When using GESHI_HEADER_NONE, remove the <ol> if line numbering is not enabled
- Commented example.php so people can use it as a guide better
- Fixed extra newline being generated if a comment is at the end
of the source (many people, including Yves Goergen)
- Fixed up some documentation issues
- Some minor language file fixes (C++, Lua) (Lua fixes by chromix)
- Fixed up no </span> in XML and other strict languages (regression from 1.0.7.3 fix: removed
unnecessary </span> when using strict mode) (Daniel Ecer, drskrud),
Version 1.0.7.3
- Added language files
* Scheme (Jon Raphaelson)
* Ocaml and Ocaml-brief (Flaie)
* Ruby (Amit Gupta)
- Make urls generated for java highlighting XHTML compliant (Tim Van Wassenhove)
- Removed unnecessary </span> when using strict mode (Tim Van Wassenhove)
- Fixed warning in dos.php about undefined constant (Tim Van Wassenhove)
- Fixed security hole in contrib/example.php - able to view any file if source
not set and language is set to wierd value (Maksymilian Arciemowicz)
Version 1.0.7.2
- Added language files
* Inno (Thomas Klinger)
* Ini (Deguix)
* DOS (Batchfile) (Alessandro Staltali)
* Applescript (Stephan Klimek)
* Freebasic (Roberto Rossi)
* SDLBasic (Roberto Rossi)
* ActionScript (links to French documentation) (NikO)
- NSIS language file updated (deguix)
- Lua language file updated (Roberto Rossi)
- Bugfix: Styles incorrectly overriding default styles instead of being merged
in set_*_styles methods (Stebastian Werner)
- Added GESHI_HEADER_NONE as valid header type. This still allows header content.
Version 1.0.7.1
- Added language files:
* Div (Gabriel Lorenzo)
* GML (José Jorge Enríquez Rodríguez)
* Eiffel (Zoran Simic)
- Minor change to rules regarding when keywords can appear - now dots (.) are
allowed before keywords. (NikO)
- Bugfix: the line style for non-fancy lines when fancy highlighting is enabled
is now applied (Amit Gupta)
Version 1.0.7
- Added language files:
* Diff (Conny Brunnkvist)
* VHDL (Alexander Krause)
* D (Thomas Kuehne)
* Matlab (Florian Knorn)
- Python highlighting improved (thither, Federico Quagliata)
- Changed file comments to use phpdoc syntax, and changed code style to be more
like PEAR
- Fixed bug in set_code_style: Second parameter is now optional
- The $_GESHI_ERRORS array is gone, error messages are internal to the GeSHi class
- Changed name of XML language to XML from HTML
- Removed min and max tab width checks
- Backported GeSHi 1.1.X's automatic language file path detection so you no longer
need to use the third parameter of the constructor or set_language_path except for
special circumstances.
- Source is checked to make sure it is not empty else an error occurs
- Removed excess characters after ?> in ada.php, apache.php and cpp.php that caused
http headers to be sent (psichron)
- Removed second "foreach" keyword for smarty language file that was causing
duplication (Iss)
- Added underscore to allowed characters in match for XML tags (anonymous)
- Added some missing java keywords like "abstract" and "transient"
- Added "list" and "continue" PHP keywords
- set_language resets error status and strict mode (Andrew Black)
- Removed margin:0 declaration from cssgen.php (Andrzej Kubaszek)
- Fixed multiline comment selector in cssgen.php (Andrzej Kubaszek)
Version 1.0.6
- Added support for smart tabs - tabs that behave just like normal tabs when in
GESHI_HEADER_DIV mode.
- Partial patch for UTF-8 encoding applied (doesn't quite work however...)
Version 1.0.5
- Added language files:
* MPASM (Bakalex)
* Oracle 8 (Guy Wicks)
- Fixed bug where not using an encoding type would sometime result in warnings (although
there still seems to be issues with encoding in general that I'm trying to gather more
data on) (Alexander Spennemann)
- Removed "margin: 0" from <ol> in an attempt to make line numbers visible in IE again
by default (untested, but I don't really care if it works... get firefox! ;))
- Added note on php5 support (Karim Scheik)
- Added two new methods: load_from_file and get_language_name_from_extension, that can
help automate file highlighting (though the extension array at this time is quite bare)
(David Gartner, Brian Cheesman)
Version 1.0.4
- Fixed many version-reporting bugs (Jack Lloyd)
- Fixed bug where methods were not having the correct CSS generated for them
by get_stylesheet() (Jack Lloyd)
- Added new keywords to C and C++ files (Jack Lloyd)
- Added section on case sensitivity to documentation that wasn't in the other versions
Version 1.0.3
- Added language files:
* Smarty (Alan Juden)
* C# (Alan Juden)
* VB.NET (Alan Juden)
* C for Macs (M. Uli Kusterer)
* Objective C (M. Uli Kusterer)
- Links can have a target attribute (Andreas Gohr)
- Fixed multiline string bug if not using classes
- Added method set_encoding that allows you to set the character
set used by calls to htmlentities() in GeSHi
- You can now specify an array of object splitters, and each
type of method separated by each object splitter can be highlighted
differently
- If a language uses a case sensitive keyword group and that group
has a URL associated with it, the keyword will not be lowercased
in the URL (M. Uli Kusterer)
Version 1.0.2
- Added language files:
* Actionscript (Steffen Krause)
* ASP (Amit Gupta)
* Bash (Andreas Gohr)
* CADDCL (Roberto Rossi)
* CadLisp (Roberto Rossi)
* C++ (Dennis Bayer)
* Delphi (Járja Norbert)
* Javascript (Ben Keen)
* Lisp (Roberto Rossi)
* OpenOffice.org BASIC (Roberto Rossi)
* Perl (Andreas Gohr and Ben Keen)
* Python (Roberto Rossi)
* VisualFoxPro (Roberto Armellin)
* XML (Nigel McNie, from an idea/file by Christian Weiske)
- Added contrib/ directory with script to create one external stylesheet
from many languages(base script by Andreas Gohr, modified by Nigel McNie),
and an example script (needs lotsa work...)
- Code lines can have their own unique ID (for use with javascript)
(suggested by Andreas von Oettingen)
- Certain rows can be specified to be highlighted differently (suggested by
Andreas von Oettingen)
- Getter available for human-readable language name (suggested by Simon Patterson)
- Line numbers aren't highlighted when a user selects the code
- Contextual highlighting with <BEGIN GeSHi> ... <END GeSHi> in the code (which
can be disabled)
- Functions can be made into URLs to appropriate documentation (suggested
by cybot_tm). Also thanks to Marcin Gryszkalis for the links for C, Java
and Perl.
- Code can have a header and footer
- Time taken to parse the code is recorded and made available with the get_time()
method
- error() now returns a human-readable error message
- Function geshi_highlight added to make it even easier to highlight on the fly
- Advanced regular expression handling
- Bug fixes to lexic_permission handling
Version 1.0.1
- Added methods set_symbols_style() and set_symbols_highlighting(). These should be used
instead of set_brackets_style and set_brackets_highlighting respectively.
- Added a new field - language_path - that can be set either when the constructor is
called, or by the new method set_language_path(), that specifies a path to the directory
containing the language files (bug reported by bbspliff)
- Added a new method set_case_keywords(), that allows the auto-casing feature to be
changed on the fly instead of simply being specified in the language file
- If there is an error the source that is outputted is now handled much better
- Lines are broken in the source only by \n now, not by \r\n (to save on output source)
- Indentation moved into its own method
- Method header() modified to allow the user to choose whether the code is surrounded in
a <div> or a <pre> (see documentation for benefits of both). Method footer() likewise
modified.
- Method get_stylesheet() modified so that a smaller comment is outputted in economy mode,
and bugs with when line number classes are outputted in economy mode have been fixed
- Bug where spans had two quotes at the end of the attributes fixed (ie. <span style=".."">)
- Added language files:
* Ada (Tux)
* Apache log file (Tux)
* ASM (Tux)
* NSIS (Tux)
* Pascal (Tux)
Version 1.0.0
- Initial Release

View File

@@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 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.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, 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 or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
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 give any other recipients of the Program a copy of this License
along with the Program.
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 Program or any portion
of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
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 Program, 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 Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) 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; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, 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 executable. However, as a
special exception, the source code 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.
If distribution of executable or 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 counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program 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.
5. 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 Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program 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 to
this License.
7. 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 Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program 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 Program.
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.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program 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.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 Program
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 Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, 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
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), 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 Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. 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 program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -1,33 +0,0 @@
GeSHi - GEneric Syntax HIghlighter
----------------------------------
Version 1.0.8
Author: Nigel McNie, Benny Baumann
Email: nigel@geshi.org, BenBE@omorphia.de
GeSHi Website: http://qbnz.com/highlighter
GeSHi is a generic syntax highlighter, written in PHP. You simply
input the source code you wish to highlight with the language you
wish to use, and the output will be a file syntax highlighted to
XHTML standards.
For more information on how to use GeSHi, please consult the
documentation. If you got this readme from a GeSHi package, then
the documentation is available in the docs/ directory. Documentation
is also available at http://qbnz.com/highlighter/documentation.php
If you think you've found a bug in GeSHi, contact me with a bug
report at BenBE@omorphia.de, or submit it to the bug tracker at
http://sourceforge.net/tracker/?group_id=114997&atid=670231. Be
aware that minor highlighting errors may well just be incorrect
language files, but if you do find something major please contact me.
And if you're using GeSHi as a plugin/mod for some other software,
please tell me about it! It's worth a link to you, and I can give
you specialist help if you need it.
GeSHi is free software, released under the GNU GPL. Please see the
COPYING file for more information. If you do modify this program,
please tell me about it! Perhaps you've made a good improvement that
I can learn from :)

View File

@@ -1,163 +0,0 @@
THANKS - List of credits for GeSHi
I owe these people/groups my thanks for help with GeSHi. Thanks, guys!
- Amit Gupta - Thanks for all that constructive criticism - it's
a great help for making GeSHi even better. And
thanks for the Wordpress plugin! (Anyone who is
interested in the plugin can visit:
http://blog.igeek.info/still-fresh/category/wp-plugins/igsyntax-hiliter/)
- Andreas Gohr - Thanks for language files and for using GeSHi for DokuWiki
(http://www.splitbrain.org/dokuwiki/wiki:dokuwiki). And thanks
for all your criticisms and for that stylesheet-maker code :).
Also, thanks for the UTF-8 patch.
- Andreas von Oettingen - Thanks for those great ideas! :)
- bbspliff - Thanks for pointing out that bug (pity I already
found it though ;))
- Benny Baumann - Thanks for your innumerable suggestions for improvements, and your
work on Delphi support :)
- Ben Keen - Thanks for the language files and pointing out some
ideas for future releases. Lookin' forward to seeing that
software soon! ;)
- Brian Cheesman - Thanks for using GeSHi in phpCvsView, and for the suggestion about
extension => language lookup
- Christian Weiske - Thanks for the inspiration for creating advanced regexp
highlighting :D
- Cliff Stanford - Thanks for the hardquote support for C# and Perl (can be used elsewhere
I'm sure)
- David Gartner - Thanks for using GeSHi in net2ftp, and for the idea about a load_from_file
method
- forum.qbasicnews.com - Thanks for putting up with the crappy versions
that I "forced" on you guys before ;)
- Jack Lloyd - Thanks for pointing out the versioning and method CSS bugs, and giving
me the extra C/C++ keywords
- Karim Scheik - Thanks for the php5 support report
- Marcin Gryszkalis - Thanks for those links for C, Java, Perl
- M. Uli Kusterer - Thanks for the idea about URL case conversion
- Milian Wolff - Thanks for the loads of optimizations
- Thanks for helping with implementation of various features
- Roberto Armellin - Thanks for pointing out some flaws in GeSHi (that will be solved
in 1.2 guaranteed)
- Sterling Christensen - Thanks for those links to language specs
- Tux - Thanks for making all those language files :D
- zbw - Thanks for proving a phpBB port was possible
PEOPE WHO MADE LANGUAGE FILES
- ABAP Andres Picazo
- Actionscript Steffen Krause (french translation by NikO)
- ActionScript 3 Jordi Boggiano (version for ActionScript3 and MXML)
- Ada Tux
- Apache Tux
- Applescript Stephan Klimek
- Apt sources.list Milian Wolff
- ASM Tux
- ASP Amit Gupta
- AutoIT mastrboy
- AviSynth Ryan Jones
- Bash Andreas Gohr
- Basic4GL Matthew Webb
- BlitzBasic P<>draig O`Connel
- BNF Rowan Rodrik van der Molen
- Boo Marcus Griep
- Brainfuck \ Brainfork Benny Baumann
- C++ Dennis Bayer, M. Uli Kusterer
- C++/QT Iulian M
- C# Alan Juden
- C for Macs M. Uli Kusterer
- CADDCL Roberto Rossi
- CadLisp Roberto Rossi
- CDFG John Horigan
- CIL Marcus Griep
- COBOL Benny Baumann
- ColdFusion Diego
- D Thomas Kuehne
- DCS Stelio Passaris
- Delphi Járja Norbert, Benny Baumann
- Div Gabriel Lorenzo
- DOS Alessandro Staltari
- Eiffel Zoran Simic
- eMail \ mbox Benny Baumann
- FreeBasic Roberto Rossi
- Fortran Cedric Arrabie
- glSlang Benny Baumann
- Gettext Milian Wolff
- GNU make Neil Bird
- Gnuplot Milian Wolff
- GML José Jorge Enríquez Rodríguez
- Groovy Ivan F. Villanueva B.
- Haskell Dagit
- HQ9+ Benny Baumann
- Ini Deguix
- Inno Thomas Klinger
- INTERCAL Benny Baumann
- Java 5 Clemens Bruckmann
- Javascript Ben Keen
- KiXtart Riley McArdle
- KLone C Mickael Auger
- KLone C++ Mickael Auger
- LaTeX Matthais Pospiech
- Lisp Roberto Rossi
- Locomotive Basic Nacho Cabanes
- LOLcode Benny Baumann
- LScript Beau McGuigan
- LSL2 William Fry
- Lua Roberto Rossi
- m86k Benny Baumann
- mIRC Alberto de Areba Sánchez
- Modula-3 Martin Bishop
- MPASM Bakalex
- MXML David Spurr
- MySQL Carl Fürstenberg, Marjolein Katsma
- NSIS Tux, Deguix
- Oberon-2 Mike Mol
- Objective C M. Uli Kusterer
- Ocaml Flaie
- Ocaml-brief Flaie
- OpenOffice.org BASIC Roberto Rossi
- Oracle 8 Guy Wicks
- Oracle 11i Simon Redhead
- Pascal Tux
- Perl Andreas Gohr, Ben Keen
- PIC16xxx assembler Phil Mattison
- Pixel Bender Richard Olsson
- PL/SQL Victor Engmark
- POV-Ray Carl Fürstenberg
- PowerShell Frode Aarebrot
- Progress Marco Aurelio de Pasqual
- Prolog Benny Baumann
- ProvideX Jeff Wilder
- Python Roberto Rossi
- Rails Moises Deniz
- Rebol Lecanu Guillaume
- Reg SmokingRope
- Robots Christian Lescuyer
- Ruby Amit Gupta, Moises Deniz
- SAS Galen Johnson
- SDLBasic Roberto Rossi
- Scheme Jon Raphaelson
- SciLab Christophe David
- Smalltalk Bananeweizen
- Smarty Alan Juden
- T-SQL Duncan Lock
- TeraTerm Boris Maisuradze
- Text SmokingRope
- TCL Reid van Melle
- thinBasic Eros Olmi
- TypoScript Jan-Philipp Halle
- Uno IDL Cedric Bosdonnat
- VB Roberto Rossi
- VB.NET Alan Juden
- Verilog Günter Dannoritzer
- VIM Script Swaroop C H
- Visual FoxPro Roberto Armellin
- Visual Prolog Thomas Linder Puls
- Whitespace Benny Baumann
- Winbatch Craig Storey
- X++ Simon Butcher
- Xorg config Milian Wolff
- Z80 Assembler Benny Baumann
Do you want your name in here? Help me out! Make a language file, or suggest a new
feature, or make a plugin for GeSHi for some other software, then tell me about it!

View File

@@ -1,71 +0,0 @@
TODO - List of things to do as of 2005/01/29
Suggestions for things to add are welcome, if you have a feature request you
can either post it to the forums:
http://qbnz.com/highlighter/forum.php
Or to the feature request tracker:
http://sourceforge.net/tracker/?group_id=114997&atid=670234
TODO for version 1.0.8.x
- Rework the load_from_file method and the one for getting a file extension,
as documented in the source.
- use analogous vars to $next_comment_regexp_pos for more GeSHi structures,
should reduce number of functions called and hence improve performance
- make a set of default colours which can be used in the language files.
this way we can give languages a uniform look and maybe even add "themes"
- Get better coverage in our coderepo
- README / INSTALL / ... file for phpdoc integration => take geshi-doc.*?
- rework HARDQUOTE + styles, currently this is a bit of a mess imo (milian)
- Allow per-keywordgroup AutoCaps/NoCaps
- Complete API to support latest features
set_number_style ($key missing)
set_string_style ($key missing)
set_case_keywords (support for per_keywordgroup AutoCaps)
TODO for version 1.2.0
- Rewrite engine to use remove/replace method (will hopefully almost
eliminate the need for regular expressions except for numbers/methods
etc). This will also assist for making different output formats [DONE]
- "Intelligent" output format - eg if the user doesn't want lines to
wrap and wants line numbers don't use <ol>, use the <table> method
instead. (This saves on output)
- Clear split between "public" and "private" methods [DONE]
- PHP5 version
- "Themes" for styles - basically pre-made stylesheets that can be used
to highlight code of any language in a similar manner [DONE]
- "Dialects" for languages - eg php4, php5. One master language definition
file, and a bunch of "specialised" dialect files for each language
Ability to specify a "specialised" dialect as default? [DONE]
- Look at load/memory usage and try to reduce
- Make tabs into tab-stops like a normal editor [DONE]
- Ability to add more than one multiline comment or string [DONE]
- Ability to specify that strings cannot be multiline [DONE]
- Create a "wrapper" class for ultra-easy use
- Code written in a style that conforms to a phpdoc utility [DONE, PEAR]
- Dig functions/methods out of code and where they are called make an internal
link back to their definition
TODO for version 2.0.0
- Support for multiple output formats (XHTML, XML, PDF, RTF etc) [DONE IN 1.2]
- Support for auto-indent/code "beautifing"
- Option for "Lite" highlighting - aims for speed and low server load
- "Intelligent" highlighting inside comments, and ability to highlight
source in multiple languages at once (eg PHP+HTML) [DONE IN 1.2]
- Perhaps a script on the GeSHi site that would map urls to appropriate
definitions and relocate the user? (eg, java documentation is
structured in such a way that urls are not able to be used with GeSHi.
Instead the URL could become:
http://qbnz.com/highlighter/redirect.php?lang=java&kw=KeyWord
and that script would redirect to the correct location.
[BETTER FIX IN 1.2]
$Id: TODO 1727 2008-08-08 13:36:52Z benbe $

View File

@@ -1,13 +0,0 @@
<html>
<head>
<title>GeSHi 1.0.8</title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div align="center"><h1>GeSHi 1.0.8</h1></div>
<b>Welcome to geshi!</b><br />
<br />
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.2</a><br />
</body>
</html>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<!-- Start of Class Data -->
<H2>
</H2>
<h2>Root class GeSHi</h2>
<ul>
<li><a href="geshi/core/GeSHi.html">GeSHi</a></li></ul>
<p class="notes" id="credit">
Documentation generated on Thu, 25 Dec 2008 14:34:34 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.2</a>
</p>
</body>
</html>

View File

@@ -1,867 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<a name="top"></a>
<h2>Full index</h2>
<h3>Package indexes</h3>
<ul>
<li><a href="elementindex_geshi.html">geshi</a></li>
</ul>
<br />
<div class="index-letter-menu">
<a class="index-letter" href="elementindex.html#a">a</a>
<a class="index-letter" href="elementindex.html#d">d</a>
<a class="index-letter" href="elementindex.html#e">e</a>
<a class="index-letter" href="elementindex.html#g">g</a>
<a class="index-letter" href="elementindex.html#h">h</a>
<a class="index-letter" href="elementindex.html#l">l</a>
<a class="index-letter" href="elementindex.html#o">o</a>
<a class="index-letter" href="elementindex.html#p">p</a>
<a class="index-letter" href="elementindex.html#r">r</a>
<a class="index-letter" href="elementindex.html#s">s</a>
</div>
<a name="a"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">a</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">add_keyword</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodadd_keyword">GeSHi::add_keyword()</a> in geshi.php</div>
<div class="index-item-description">Adds a keyword to a keyword group for highlighting</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">add_keyword_group</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodadd_keyword_group">GeSHi::add_keyword_group()</a> in geshi.php</div>
<div class="index-item-description">Creates a new keyword group</div>
</dd>
</dl>
<a name="d"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">d</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">disable_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methoddisable_highlighting">GeSHi::disable_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Disables all highlighting</div>
</dd>
</dl>
<a name="e"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">e</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_classes</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_classes">GeSHi::enable_classes()</a> in geshi.php</div>
<div class="index-item-description">Sets whether CSS classes should be used to highlight the source. Default is off, calling this method with no arguments will turn it on</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_highlighting">GeSHi::enable_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Enables all highlighting</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_ids</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_ids">GeSHi::enable_ids()</a> in geshi.php</div>
<div class="index-item-description">Whether CSS IDs should be added to each line</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_important_blocks</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_important_blocks">GeSHi::enable_important_blocks()</a> in geshi.php</div>
<div class="index-item-description">Sets whether context-important blocks are highlighted</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_inner_code_block</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_inner_code_block">GeSHi::enable_inner_code_block()</a> in geshi.php</div>
<div class="index-item-description">Sets whether to force a surrounding block around the highlighted code or not</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_keyword_links</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_keyword_links">GeSHi::enable_keyword_links()</a> in geshi.php</div>
<div class="index-item-description">Turns linking of keywords on or off.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_line_numbers</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_line_numbers">GeSHi::enable_line_numbers()</a> in geshi.php</div>
<div class="index-item-description">Sets whether line numbers should be displayed.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_multiline_span</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_multiline_span">GeSHi::enable_multiline_span()</a> in geshi.php</div>
<div class="index-item-description">Sets wether spans and other HTML markup generated by GeSHi can span over multiple lines or not. Defaults to true to reduce overhead.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_strict_mode</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_strict_mode">GeSHi::enable_strict_mode()</a> in geshi.php</div>
<div class="index-item-description">Enables/disables strict highlighting. Default is off, calling this method without parameters will turn it on. See documentation for more details on strict mode and where to use it.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">error</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methoderror">GeSHi::error()</a> in geshi.php</div>
<div class="index-item-description">Returns an error message associated with the last GeSHi operation, or false if no error has occured</div>
</dd>
</dl>
<a name="g"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">g</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Constructor.png" alt="Method" title="Method" /></title>
<span class="method-title">GeSHi</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodGeSHi">GeSHi::GeSHi()</a> in geshi.php</div>
<div class="index-item-description">Creates a new GeSHi object, with source and language</div>
</dd>
<dt class="field">
<img src="media/images/Class.png" alt="Class" title="Class" /></title>
GeSHi
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html">GeSHi</a> in geshi.php</div>
<div class="index-item-description">The GeSHi Class.</div>
</dd>
<dt class="field">
<img src="media/images/Page.png" alt="Page" title="Page" /></title>
<span class="include-title">geshi.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html">geshi.php</a> in geshi.php</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_ACTIVE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_ACTIVE">GESHI_ACTIVE</a> in geshi.php</div>
<div class="index-item-description">Links in the source in the :active state</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_CAPS_LOWER</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_CAPS_LOWER">GESHI_CAPS_LOWER</a> in geshi.php</div>
<div class="index-item-description">Leave keywords found as the case that they are</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_CAPS_NO_CHANGE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_CAPS_NO_CHANGE">GESHI_CAPS_NO_CHANGE</a> in geshi.php</div>
<div class="index-item-description">Lowercase keywords found</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_CAPS_UPPER</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_CAPS_UPPER">GESHI_CAPS_UPPER</a> in geshi.php</div>
<div class="index-item-description">Uppercase keywords found</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_END_IMPORTANT</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_END_IMPORTANT">GESHI_END_IMPORTANT</a> in geshi.php</div>
<div class="index-item-description">The ender for important parts of the source</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_FANCY_LINE_NUMBERS</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_FANCY_LINE_NUMBERS">GESHI_FANCY_LINE_NUMBERS</a> in geshi.php</div>
<div class="index-item-description">Use fancy line numbers when building the result</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HEADER_DIV</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HEADER_DIV">GESHI_HEADER_DIV</a> in geshi.php</div>
<div class="index-item-description">Use a &quot;div&quot; to surround the source</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HEADER_NONE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HEADER_NONE">GESHI_HEADER_NONE</a> in geshi.php</div>
<div class="index-item-description">Use nothing to surround the source</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HEADER_PRE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HEADER_PRE">GESHI_HEADER_PRE</a> in geshi.php</div>
<div class="index-item-description">Use a &quot;pre&quot; to surround the source</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HEADER_PRE_TABLE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HEADER_PRE_TABLE">GESHI_HEADER_PRE_TABLE</a> in geshi.php</div>
<div class="index-item-description">Use a &quot;table&quot; to surround the source:</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HEADER_PRE_VALID</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HEADER_PRE_VALID">GESHI_HEADER_PRE_VALID</a> in geshi.php</div>
<div class="index-item-description">Use a pre to wrap lines when line numbers are enabled or to wrap the whole code.</div>
</dd>
<dt class="field">
<img src="media/images/Function.png" alt="Function" title="Function" /></title>
<span class="method-title">geshi_highlight</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#functiongeshi_highlight">geshi_highlight()</a> in geshi.php</div>
<div class="index-item-description">Easy way to highlight stuff. Behaves just like highlight_string</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HOVER</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HOVER">GESHI_HOVER</a> in geshi.php</div>
<div class="index-item-description">Links in the source in the :hover state</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_LANG_ROOT</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_LANG_ROOT">GESHI_LANG_ROOT</a> in geshi.php</div>
<div class="index-item-description">The language file directory for GeSHi</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_LINK</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_LINK">GESHI_LINK</a> in geshi.php</div>
<div class="index-item-description">Links in the source in the :link state</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_NORMAL_LINE_NUMBERS</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_NORMAL_LINE_NUMBERS">GESHI_NORMAL_LINE_NUMBERS</a> in geshi.php</div>
<div class="index-item-description">Use normal line numbers when building the result</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_NO_LINE_NUMBERS</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_NO_LINE_NUMBERS">GESHI_NO_LINE_NUMBERS</a> in geshi.php</div>
<div class="index-item-description">Use no line numbers when building the result</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_ROOT</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_ROOT">GESHI_ROOT</a> in geshi.php</div>
<div class="index-item-description">The root directory for GeSHi</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_SECURITY_PARANOID</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_SECURITY_PARANOID">GESHI_SECURITY_PARANOID</a> in geshi.php</div>
<div class="index-item-description">Tells GeSHi to be paranoid about security settings</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_START_IMPORTANT</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_START_IMPORTANT">GESHI_START_IMPORTANT</a> in geshi.php</div>
<div class="index-item-description">The starter for important parts of the source</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_VERSION</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_VERSION">GESHI_VERSION</a> in geshi.php</div>
<div class="index-item-description">The version of this GeSHi file</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_VISITED</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_VISITED">GESHI_VISITED</a> in geshi.php</div>
<div class="index-item-description">Links in the source in the :visited state</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_language_name</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_language_name">GeSHi::get_language_name()</a> in geshi.php</div>
<div class="index-item-description">Gets a human-readable language name (thanks to Simon Patterson for the idea :))</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_language_name_from_extension</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_language_name_from_extension">GeSHi::get_language_name_from_extension()</a> in geshi.php</div>
<div class="index-item-description">Given a file extension, this method returns either a valid geshi language name, or the empty string if it couldn't be found</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_multiline_span</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_multiline_span">GeSHi::get_multiline_span()</a> in geshi.php</div>
<div class="index-item-description">Get current setting for multiline spans, see GeSHi-&gt;enable_multiline_span().</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_real_tab_width</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_real_tab_width">GeSHi::get_real_tab_width()</a> in geshi.php</div>
<div class="index-item-description">Returns the tab width to use, based on the current language and user preference</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_stylesheet</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_stylesheet">GeSHi::get_stylesheet()</a> in geshi.php</div>
<div class="index-item-description">Returns a stylesheet for the highlighted code. If $economy mode is true, we only return the stylesheet declarations that matter for this code block instead of the whole thing</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_time</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_time">GeSHi::get_time()</a> in geshi.php</div>
<div class="index-item-description">Gets the time taken to parse the code</div>
</dd>
</dl>
<a name="h"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">h</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">highlight_lines_extra</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodhighlight_lines_extra">GeSHi::highlight_lines_extra()</a> in geshi.php</div>
<div class="index-item-description">Specifies which lines to highlight extra</div>
</dd>
</dl>
<a name="l"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">l</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">load_from_file</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodload_from_file">GeSHi::load_from_file()</a> in geshi.php</div>
<div class="index-item-description">Given a file name, this method loads its contents in, and attempts</div>
</dd>
</dl>
<a name="o"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">o</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">optimize_keyword_group</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodoptimize_keyword_group">GeSHi::optimize_keyword_group()</a> in geshi.php</div>
<div class="index-item-description">compile optimized regexp list for keyword group</div>
</dd>
</dl>
<a name="p"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">p</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">parse_code</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodparse_code">GeSHi::parse_code()</a> in geshi.php</div>
<div class="index-item-description">Returns the code in $this-&gt;source, highlighted and surrounded by the nessecary HTML.</div>
</dd>
</dl>
<a name="r"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">r</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">remove_keyword</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodremove_keyword">GeSHi::remove_keyword()</a> in geshi.php</div>
<div class="index-item-description">Removes a keyword from a keyword group</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">remove_keyword_group</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodremove_keyword_group">GeSHi::remove_keyword_group()</a> in geshi.php</div>
<div class="index-item-description">Removes a keyword group</div>
</dd>
</dl>
<a name="s"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">s</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_brackets_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_brackets_highlighting">GeSHi::set_brackets_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for brackets</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_brackets_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_brackets_style">GeSHi::set_brackets_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for brackets. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_case_keywords</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_case_keywords">GeSHi::set_case_keywords()</a> in geshi.php</div>
<div class="index-item-description">Sets the case that keywords should use when found. Use the constants:</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_case_sensitivity</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_case_sensitivity">GeSHi::set_case_sensitivity()</a> in geshi.php</div>
<div class="index-item-description">Sets whether a set of keywords are checked for in a case sensitive manner</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_code_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_code_style">GeSHi::set_code_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the style for the actual code. This should be a string</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_comments_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_comments_highlighting">GeSHi::set_comments_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for comment groups</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_comments_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_comments_style">GeSHi::set_comments_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for comment groups. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_encoding</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_encoding">GeSHi::set_encoding()</a> in geshi.php</div>
<div class="index-item-description">Sets the encoding used for htmlspecialchars(), for international support.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_escape_characters_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_escape_characters_highlighting">GeSHi::set_escape_characters_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for escaped characters</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_escape_characters_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_escape_characters_style">GeSHi::set_escape_characters_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for escaped characters. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_footer_content</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_footer_content">GeSHi::set_footer_content()</a> in geshi.php</div>
<div class="index-item-description">Sets the content of the footer block</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_footer_content_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_footer_content_style">GeSHi::set_footer_content_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the style for the footer content</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_header_content</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_header_content">GeSHi::set_header_content()</a> in geshi.php</div>
<div class="index-item-description">Sets the content of the header block</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_header_content_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_header_content_style">GeSHi::set_header_content_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the style for the header content</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_header_type</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_header_type">GeSHi::set_header_type()</a> in geshi.php</div>
<div class="index-item-description">Sets the type of header to be used.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_highlight_lines_extra_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_highlight_lines_extra_style">GeSHi::set_highlight_lines_extra_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the style for extra-highlighted lines</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_important_styles</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_important_styles">GeSHi::set_important_styles()</a> in geshi.php</div>
<div class="index-item-description">Sets styles for important parts of the code</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_keyword_group_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_keyword_group_highlighting">GeSHi::set_keyword_group_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for a keyword group</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_keyword_group_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_keyword_group_style">GeSHi::set_keyword_group_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the style for a keyword group. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_language</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_language">GeSHi::set_language()</a> in geshi.php</div>
<div class="index-item-description">Sets the language for this object</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_language_path</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_language_path">GeSHi::set_language_path()</a> in geshi.php</div>
<div class="index-item-description">Sets the path to the directory containing the language files. Note that this path is relative to the directory of the script that included geshi.php, NOT geshi.php itself.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_line_ending</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_line_ending">GeSHi::set_line_ending()</a> in geshi.php</div>
<div class="index-item-description">Sets the line-ending</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_line_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_line_style">GeSHi::set_line_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for the line numbers.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_link_styles</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_link_styles">GeSHi::set_link_styles()</a> in geshi.php</div>
<div class="index-item-description">Sets styles for links in code</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_link_target</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_link_target">GeSHi::set_link_target()</a> in geshi.php</div>
<div class="index-item-description">Sets the target for links in code</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_methods_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_methods_highlighting">GeSHi::set_methods_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for methods</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_methods_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_methods_style">GeSHi::set_methods_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for methods. $key is a number that references the</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_numbers_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_numbers_highlighting">GeSHi::set_numbers_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for numbers</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_numbers_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_numbers_style">GeSHi::set_numbers_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for numbers. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_overall_class</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_overall_class">GeSHi::set_overall_class()</a> in geshi.php</div>
<div class="index-item-description">Sets the overall classname for this block of code. This class can then be used in a stylesheet to style this object's output</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_overall_id</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_overall_id">GeSHi::set_overall_id()</a> in geshi.php</div>
<div class="index-item-description">Sets the overall id for this block of code. This id can then be used in a stylesheet to style this object's output</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_overall_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_overall_style">GeSHi::set_overall_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for the code that will be outputted when this object is parsed. The style should be a string of valid stylesheet declarations</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_regexps_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_regexps_highlighting">GeSHi::set_regexps_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for regexps</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_regexps_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_regexps_style">GeSHi::set_regexps_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for regexps. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_source</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_source">GeSHi::set_source()</a> in geshi.php</div>
<div class="index-item-description">Sets the source code for this object</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_strings_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_strings_highlighting">GeSHi::set_strings_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for strings</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_strings_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_strings_style">GeSHi::set_strings_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for strings. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_symbols_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_symbols_highlighting">GeSHi::set_symbols_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for symbols</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_symbols_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_symbols_style">GeSHi::set_symbols_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for symbols. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_tab_width</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_tab_width">GeSHi::set_tab_width()</a> in geshi.php</div>
<div class="index-item-description">Sets how many spaces a tab is substituted for</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_url_for_keyword_group</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_url_for_keyword_group">GeSHi::set_url_for_keyword_group()</a> in geshi.php</div>
<div class="index-item-description">Sets the base URL to be used for keywords</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_use_language_tab_width</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_use_language_tab_width">GeSHi::set_use_language_tab_width()</a> in geshi.php</div>
<div class="index-item-description">Sets whether or not to use tab-stop width specifed by language</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">start_line_numbers_at</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodstart_line_numbers_at">GeSHi::start_line_numbers_at()</a> in geshi.php</div>
<div class="index-item-description">Sets what number line numbers should start at. Should be a positive integer, and will be converted to one.</div>
</dd>
</dl>
<div class="index-letter-menu">
<a class="index-letter" href="elementindex.html#a">a</a>
<a class="index-letter" href="elementindex.html#d">d</a>
<a class="index-letter" href="elementindex.html#e">e</a>
<a class="index-letter" href="elementindex.html#g">g</a>
<a class="index-letter" href="elementindex.html#h">h</a>
<a class="index-letter" href="elementindex.html#l">l</a>
<a class="index-letter" href="elementindex.html#o">o</a>
<a class="index-letter" href="elementindex.html#p">p</a>
<a class="index-letter" href="elementindex.html#r">r</a>
<a class="index-letter" href="elementindex.html#s">s</a>
</div> </body>
</html>

View File

@@ -1,864 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<a name="top"></a>
<h2>[geshi] element index</h2>
<a href="elementindex.html">All elements</a>
<br />
<div class="index-letter-menu">
<a class="index-letter" href="elementindex_geshi.html#a">a</a>
<a class="index-letter" href="elementindex_geshi.html#d">d</a>
<a class="index-letter" href="elementindex_geshi.html#e">e</a>
<a class="index-letter" href="elementindex_geshi.html#g">g</a>
<a class="index-letter" href="elementindex_geshi.html#h">h</a>
<a class="index-letter" href="elementindex_geshi.html#l">l</a>
<a class="index-letter" href="elementindex_geshi.html#o">o</a>
<a class="index-letter" href="elementindex_geshi.html#p">p</a>
<a class="index-letter" href="elementindex_geshi.html#r">r</a>
<a class="index-letter" href="elementindex_geshi.html#s">s</a>
</div>
<a name="a"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">a</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">add_keyword</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodadd_keyword">GeSHi::add_keyword()</a> in geshi.php</div>
<div class="index-item-description">Adds a keyword to a keyword group for highlighting</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">add_keyword_group</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodadd_keyword_group">GeSHi::add_keyword_group()</a> in geshi.php</div>
<div class="index-item-description">Creates a new keyword group</div>
</dd>
</dl>
<a name="d"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">d</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">disable_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methoddisable_highlighting">GeSHi::disable_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Disables all highlighting</div>
</dd>
</dl>
<a name="e"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">e</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_classes</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_classes">GeSHi::enable_classes()</a> in geshi.php</div>
<div class="index-item-description">Sets whether CSS classes should be used to highlight the source. Default is off, calling this method with no arguments will turn it on</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_highlighting">GeSHi::enable_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Enables all highlighting</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_ids</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_ids">GeSHi::enable_ids()</a> in geshi.php</div>
<div class="index-item-description">Whether CSS IDs should be added to each line</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_important_blocks</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_important_blocks">GeSHi::enable_important_blocks()</a> in geshi.php</div>
<div class="index-item-description">Sets whether context-important blocks are highlighted</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_inner_code_block</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_inner_code_block">GeSHi::enable_inner_code_block()</a> in geshi.php</div>
<div class="index-item-description">Sets whether to force a surrounding block around the highlighted code or not</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_keyword_links</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_keyword_links">GeSHi::enable_keyword_links()</a> in geshi.php</div>
<div class="index-item-description">Turns linking of keywords on or off.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_line_numbers</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_line_numbers">GeSHi::enable_line_numbers()</a> in geshi.php</div>
<div class="index-item-description">Sets whether line numbers should be displayed.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_multiline_span</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_multiline_span">GeSHi::enable_multiline_span()</a> in geshi.php</div>
<div class="index-item-description">Sets wether spans and other HTML markup generated by GeSHi can span over multiple lines or not. Defaults to true to reduce overhead.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">enable_strict_mode</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodenable_strict_mode">GeSHi::enable_strict_mode()</a> in geshi.php</div>
<div class="index-item-description">Enables/disables strict highlighting. Default is off, calling this method without parameters will turn it on. See documentation for more details on strict mode and where to use it.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">error</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methoderror">GeSHi::error()</a> in geshi.php</div>
<div class="index-item-description">Returns an error message associated with the last GeSHi operation, or false if no error has occured</div>
</dd>
</dl>
<a name="g"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">g</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Constructor.png" alt="Method" title="Method" /></title>
<span class="method-title">GeSHi</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodGeSHi">GeSHi::GeSHi()</a> in geshi.php</div>
<div class="index-item-description">Creates a new GeSHi object, with source and language</div>
</dd>
<dt class="field">
<img src="media/images/Class.png" alt="Class" title="Class" /></title>
GeSHi
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html">GeSHi</a> in geshi.php</div>
<div class="index-item-description">The GeSHi Class.</div>
</dd>
<dt class="field">
<img src="media/images/Page.png" alt="Page" title="Page" /></title>
<span class="include-title">geshi.php</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html">geshi.php</a> in geshi.php</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_ACTIVE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_ACTIVE">GESHI_ACTIVE</a> in geshi.php</div>
<div class="index-item-description">Links in the source in the :active state</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_CAPS_LOWER</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_CAPS_LOWER">GESHI_CAPS_LOWER</a> in geshi.php</div>
<div class="index-item-description">Leave keywords found as the case that they are</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_CAPS_NO_CHANGE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_CAPS_NO_CHANGE">GESHI_CAPS_NO_CHANGE</a> in geshi.php</div>
<div class="index-item-description">Lowercase keywords found</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_CAPS_UPPER</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_CAPS_UPPER">GESHI_CAPS_UPPER</a> in geshi.php</div>
<div class="index-item-description">Uppercase keywords found</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_END_IMPORTANT</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_END_IMPORTANT">GESHI_END_IMPORTANT</a> in geshi.php</div>
<div class="index-item-description">The ender for important parts of the source</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_FANCY_LINE_NUMBERS</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_FANCY_LINE_NUMBERS">GESHI_FANCY_LINE_NUMBERS</a> in geshi.php</div>
<div class="index-item-description">Use fancy line numbers when building the result</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HEADER_DIV</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HEADER_DIV">GESHI_HEADER_DIV</a> in geshi.php</div>
<div class="index-item-description">Use a &quot;div&quot; to surround the source</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HEADER_NONE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HEADER_NONE">GESHI_HEADER_NONE</a> in geshi.php</div>
<div class="index-item-description">Use nothing to surround the source</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HEADER_PRE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HEADER_PRE">GESHI_HEADER_PRE</a> in geshi.php</div>
<div class="index-item-description">Use a &quot;pre&quot; to surround the source</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HEADER_PRE_TABLE</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HEADER_PRE_TABLE">GESHI_HEADER_PRE_TABLE</a> in geshi.php</div>
<div class="index-item-description">Use a &quot;table&quot; to surround the source:</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HEADER_PRE_VALID</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HEADER_PRE_VALID">GESHI_HEADER_PRE_VALID</a> in geshi.php</div>
<div class="index-item-description">Use a pre to wrap lines when line numbers are enabled or to wrap the whole code.</div>
</dd>
<dt class="field">
<img src="media/images/Function.png" alt="Function" title="Function" /></title>
<span class="method-title">geshi_highlight</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#functiongeshi_highlight">geshi_highlight()</a> in geshi.php</div>
<div class="index-item-description">Easy way to highlight stuff. Behaves just like highlight_string</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_HOVER</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_HOVER">GESHI_HOVER</a> in geshi.php</div>
<div class="index-item-description">Links in the source in the :hover state</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_LANG_ROOT</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_LANG_ROOT">GESHI_LANG_ROOT</a> in geshi.php</div>
<div class="index-item-description">The language file directory for GeSHi</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_LINK</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_LINK">GESHI_LINK</a> in geshi.php</div>
<div class="index-item-description">Links in the source in the :link state</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_NORMAL_LINE_NUMBERS</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_NORMAL_LINE_NUMBERS">GESHI_NORMAL_LINE_NUMBERS</a> in geshi.php</div>
<div class="index-item-description">Use normal line numbers when building the result</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_NO_LINE_NUMBERS</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_NO_LINE_NUMBERS">GESHI_NO_LINE_NUMBERS</a> in geshi.php</div>
<div class="index-item-description">Use no line numbers when building the result</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_ROOT</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_ROOT">GESHI_ROOT</a> in geshi.php</div>
<div class="index-item-description">The root directory for GeSHi</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_SECURITY_PARANOID</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_SECURITY_PARANOID">GESHI_SECURITY_PARANOID</a> in geshi.php</div>
<div class="index-item-description">Tells GeSHi to be paranoid about security settings</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_START_IMPORTANT</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_START_IMPORTANT">GESHI_START_IMPORTANT</a> in geshi.php</div>
<div class="index-item-description">The starter for important parts of the source</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_VERSION</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_VERSION">GESHI_VERSION</a> in geshi.php</div>
<div class="index-item-description">The version of this GeSHi file</div>
</dd>
<dt class="field">
<img src="media/images/Constant.png" alt="Constant" title="Constant" /></title>
<span class="const-title">GESHI_VISITED</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/_geshi.php.html#defineGESHI_VISITED">GESHI_VISITED</a> in geshi.php</div>
<div class="index-item-description">Links in the source in the :visited state</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_language_name</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_language_name">GeSHi::get_language_name()</a> in geshi.php</div>
<div class="index-item-description">Gets a human-readable language name (thanks to Simon Patterson for the idea :))</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_language_name_from_extension</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_language_name_from_extension">GeSHi::get_language_name_from_extension()</a> in geshi.php</div>
<div class="index-item-description">Given a file extension, this method returns either a valid geshi language name, or the empty string if it couldn't be found</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_multiline_span</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_multiline_span">GeSHi::get_multiline_span()</a> in geshi.php</div>
<div class="index-item-description">Get current setting for multiline spans, see GeSHi-&gt;enable_multiline_span().</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_real_tab_width</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_real_tab_width">GeSHi::get_real_tab_width()</a> in geshi.php</div>
<div class="index-item-description">Returns the tab width to use, based on the current language and user preference</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_stylesheet</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_stylesheet">GeSHi::get_stylesheet()</a> in geshi.php</div>
<div class="index-item-description">Returns a stylesheet for the highlighted code. If $economy mode is true, we only return the stylesheet declarations that matter for this code block instead of the whole thing</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">get_time</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodget_time">GeSHi::get_time()</a> in geshi.php</div>
<div class="index-item-description">Gets the time taken to parse the code</div>
</dd>
</dl>
<a name="h"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">h</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">highlight_lines_extra</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodhighlight_lines_extra">GeSHi::highlight_lines_extra()</a> in geshi.php</div>
<div class="index-item-description">Specifies which lines to highlight extra</div>
</dd>
</dl>
<a name="l"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">l</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">load_from_file</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodload_from_file">GeSHi::load_from_file()</a> in geshi.php</div>
<div class="index-item-description">Given a file name, this method loads its contents in, and attempts</div>
</dd>
</dl>
<a name="o"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">o</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">optimize_keyword_group</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodoptimize_keyword_group">GeSHi::optimize_keyword_group()</a> in geshi.php</div>
<div class="index-item-description">compile optimized regexp list for keyword group</div>
</dd>
</dl>
<a name="p"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">p</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">parse_code</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodparse_code">GeSHi::parse_code()</a> in geshi.php</div>
<div class="index-item-description">Returns the code in $this-&gt;source, highlighted and surrounded by the nessecary HTML.</div>
</dd>
</dl>
<a name="r"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">r</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">remove_keyword</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodremove_keyword">GeSHi::remove_keyword()</a> in geshi.php</div>
<div class="index-item-description">Removes a keyword from a keyword group</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">remove_keyword_group</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodremove_keyword_group">GeSHi::remove_keyword_group()</a> in geshi.php</div>
<div class="index-item-description">Removes a keyword group</div>
</dd>
</dl>
<a name="s"></a>
<div class="index-letter-section">
<div style="float: left" class="index-letter-title">s</div>
<div style="float: right"><a href="#top">top</a></div>
<div style="clear: both"></div>
</div>
<dl>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_brackets_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_brackets_highlighting">GeSHi::set_brackets_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for brackets</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_brackets_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_brackets_style">GeSHi::set_brackets_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for brackets. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_case_keywords</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_case_keywords">GeSHi::set_case_keywords()</a> in geshi.php</div>
<div class="index-item-description">Sets the case that keywords should use when found. Use the constants:</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_case_sensitivity</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_case_sensitivity">GeSHi::set_case_sensitivity()</a> in geshi.php</div>
<div class="index-item-description">Sets whether a set of keywords are checked for in a case sensitive manner</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_code_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_code_style">GeSHi::set_code_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the style for the actual code. This should be a string</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_comments_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_comments_highlighting">GeSHi::set_comments_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for comment groups</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_comments_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_comments_style">GeSHi::set_comments_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for comment groups. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_encoding</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_encoding">GeSHi::set_encoding()</a> in geshi.php</div>
<div class="index-item-description">Sets the encoding used for htmlspecialchars(), for international support.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_escape_characters_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_escape_characters_highlighting">GeSHi::set_escape_characters_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for escaped characters</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_escape_characters_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_escape_characters_style">GeSHi::set_escape_characters_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for escaped characters. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_footer_content</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_footer_content">GeSHi::set_footer_content()</a> in geshi.php</div>
<div class="index-item-description">Sets the content of the footer block</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_footer_content_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_footer_content_style">GeSHi::set_footer_content_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the style for the footer content</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_header_content</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_header_content">GeSHi::set_header_content()</a> in geshi.php</div>
<div class="index-item-description">Sets the content of the header block</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_header_content_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_header_content_style">GeSHi::set_header_content_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the style for the header content</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_header_type</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_header_type">GeSHi::set_header_type()</a> in geshi.php</div>
<div class="index-item-description">Sets the type of header to be used.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_highlight_lines_extra_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_highlight_lines_extra_style">GeSHi::set_highlight_lines_extra_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the style for extra-highlighted lines</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_important_styles</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_important_styles">GeSHi::set_important_styles()</a> in geshi.php</div>
<div class="index-item-description">Sets styles for important parts of the code</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_keyword_group_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_keyword_group_highlighting">GeSHi::set_keyword_group_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for a keyword group</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_keyword_group_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_keyword_group_style">GeSHi::set_keyword_group_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the style for a keyword group. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_language</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_language">GeSHi::set_language()</a> in geshi.php</div>
<div class="index-item-description">Sets the language for this object</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_language_path</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_language_path">GeSHi::set_language_path()</a> in geshi.php</div>
<div class="index-item-description">Sets the path to the directory containing the language files. Note that this path is relative to the directory of the script that included geshi.php, NOT geshi.php itself.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_line_ending</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_line_ending">GeSHi::set_line_ending()</a> in geshi.php</div>
<div class="index-item-description">Sets the line-ending</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_line_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_line_style">GeSHi::set_line_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for the line numbers.</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_link_styles</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_link_styles">GeSHi::set_link_styles()</a> in geshi.php</div>
<div class="index-item-description">Sets styles for links in code</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_link_target</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_link_target">GeSHi::set_link_target()</a> in geshi.php</div>
<div class="index-item-description">Sets the target for links in code</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_methods_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_methods_highlighting">GeSHi::set_methods_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for methods</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_methods_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_methods_style">GeSHi::set_methods_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for methods. $key is a number that references the</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_numbers_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_numbers_highlighting">GeSHi::set_numbers_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for numbers</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_numbers_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_numbers_style">GeSHi::set_numbers_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for numbers. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_overall_class</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_overall_class">GeSHi::set_overall_class()</a> in geshi.php</div>
<div class="index-item-description">Sets the overall classname for this block of code. This class can then be used in a stylesheet to style this object's output</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_overall_id</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_overall_id">GeSHi::set_overall_id()</a> in geshi.php</div>
<div class="index-item-description">Sets the overall id for this block of code. This id can then be used in a stylesheet to style this object's output</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_overall_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_overall_style">GeSHi::set_overall_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for the code that will be outputted when this object is parsed. The style should be a string of valid stylesheet declarations</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_regexps_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_regexps_highlighting">GeSHi::set_regexps_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for regexps</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_regexps_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_regexps_style">GeSHi::set_regexps_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for regexps. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_source</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_source">GeSHi::set_source()</a> in geshi.php</div>
<div class="index-item-description">Sets the source code for this object</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_strings_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_strings_highlighting">GeSHi::set_strings_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for strings</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_strings_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_strings_style">GeSHi::set_strings_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for strings. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_symbols_highlighting</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_symbols_highlighting">GeSHi::set_symbols_highlighting()</a> in geshi.php</div>
<div class="index-item-description">Turns highlighting on/off for symbols</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_symbols_style</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_symbols_style">GeSHi::set_symbols_style()</a> in geshi.php</div>
<div class="index-item-description">Sets the styles for symbols. If $preserve_defaults is true, then styles are merged with the default styles, with the user defined styles having priority</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_tab_width</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_tab_width">GeSHi::set_tab_width()</a> in geshi.php</div>
<div class="index-item-description">Sets how many spaces a tab is substituted for</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_url_for_keyword_group</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_url_for_keyword_group">GeSHi::set_url_for_keyword_group()</a> in geshi.php</div>
<div class="index-item-description">Sets the base URL to be used for keywords</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">set_use_language_tab_width</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodset_use_language_tab_width">GeSHi::set_use_language_tab_width()</a> in geshi.php</div>
<div class="index-item-description">Sets whether or not to use tab-stop width specifed by language</div>
</dd>
<dt class="field">
<img src="media/images/Method.png" alt="Method" title="Method" /></title>
<span class="method-title">start_line_numbers_at</span>
</dt>
<dd class="index-item-body">
<div class="index-item-details"><a href="geshi/core/GeSHi.html#methodstart_line_numbers_at">GeSHi::start_line_numbers_at()</a> in geshi.php</div>
<div class="index-item-description">Sets what number line numbers should start at. Should be a positive integer, and will be converted to one.</div>
</dd>
</dl>
<div class="index-letter-menu">
<a class="index-letter" href="elementindex_geshi.html#a">a</a>
<a class="index-letter" href="elementindex_geshi.html#d">d</a>
<a class="index-letter" href="elementindex_geshi.html#e">e</a>
<a class="index-letter" href="elementindex_geshi.html#g">g</a>
<a class="index-letter" href="elementindex_geshi.html#h">h</a>
<a class="index-letter" href="elementindex_geshi.html#l">l</a>
<a class="index-letter" href="elementindex_geshi.html#o">o</a>
<a class="index-letter" href="elementindex_geshi.html#p">p</a>
<a class="index-letter" href="elementindex_geshi.html#r">r</a>
<a class="index-letter" href="elementindex_geshi.html#s">s</a>
</div> </body>
</html>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>phpDocumentor Parser Errors and Warnings</title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<a href="#Post-parsing">Post-parsing</a><br>
<a name="geshi.php"></a>
<h1>geshi.php</h1>
<h2>Errors:</h2><br>
<b>Error on line 569</b> - DocBlock has multiple @access tags, illegal. ignoring additional tag "@access private"<br>
<p class="notes" id="credit">
Documentation generated on Thu, 25 Dec 2008 14:34:53 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.2</a>
</p>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,478 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Docs for page geshi.php</title>
<link rel="stylesheet" href="../../media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="page-body">
<h2 class="file-name"><img src="../../media/images/Page_logo.png" alt="File" style="vertical-align: middle">/geshi.php</h2>
<a name="sec-description"></a>
<div class="info-box">
<div class="info-box-title">Description</div>
<div class="nav-bar">
<span class="disabled">Description</span> |
<a href="#sec-classes">Classes</a>
| <a href="#sec-constants">Constants</a>
| <a href="#sec-functions">Functions</a>
</div>
<div class="info-box-body">
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">GeSHi - Generic Syntax Highlighter</p>
<p class="description"><p>The GeSHi class for Generic Syntax Highlighting. Please refer to the documentation at http://qbnz.com/highlighter/documentation.php for more information about how to use this class.</p><p>For changes, release notes, TODOs etc, see the relevant files in the docs/ directory.</p><p>This file is part of GeSHi.</p><p>GeSHi 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.</p><p>GeSHi 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.</p><p>You should have received a copy of the GNU General Public License along with GeSHi; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p></p>
<ul class="tags">
<li><span class="field">author:</span> Nigel McNie &lt;<a href="mailto:nigel@geshi.org">nigel@geshi.org</a>&gt;, Benny Baumann &lt;BenBE@omorphia.de&gt;</li>
<li><span class="field">copyright:</span> (C) 2004 - 2007 Nigel McNie, (C) 2007 - 2008 Benny Baumann</li>
<li><span class="field">filesource:</span> <a href="../../__filesource/fsource_geshi_core_geshi.php.html">Source Code for this file</a></li>
<li><span class="field">license:</span> <a href="http://gnu.org/copyleft/gpl.html">GNU GPL</a></li>
</ul>
</div>
</div>
<a name="sec-classes"></a>
<div class="info-box">
<div class="info-box-title">Classes</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<span class="disabled">Classes</span>
| <a href="#sec-constants">Constants</a>
| <a href="#sec-functions">Functions</a>
</div>
<div class="info-box-body">
<table cellpadding="2" cellspacing="0" class="class-table">
<tr>
<th class="class-table-header">Class</th>
<th class="class-table-header">Description</th>
</tr>
<tr>
<td style="padding-right: 2em; vertical-align: top; white-space: nowrap">
<img src="../../media/images/Class.png"
alt=" class"
title=" class"/>
<a href="../../geshi/core/GeSHi.html">GeSHi</a>
</td>
<td>
The GeSHi Class.
</td>
</tr>
</table>
</div>
</div>
<a name="sec-constants"></a>
<div class="info-box">
<div class="info-box-title">Constants</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-classes">Classes</a>
| <span class="disabled">Constants</span>
| <a href="#sec-functions">Functions</a>
</div>
<div class="info-box-body">
<a name="defineGESHI_ACTIVE"><!-- --></a>
<div class="oddrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_ACTIVE</span> = 2
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a107">107</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Links in the source in the :active state</p>
</div>
<a name="defineGESHI_CAPS_LOWER"><!-- --></a>
<div class="evenrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_CAPS_LOWER</span> = 2
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a99">99</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Leave keywords found as the case that they are</p>
</div>
<a name="defineGESHI_CAPS_NO_CHANGE"><!-- --></a>
<div class="oddrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_CAPS_NO_CHANGE</span> = 0
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a95">95</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Lowercase keywords found</p>
</div>
<a name="defineGESHI_CAPS_UPPER"><!-- --></a>
<div class="evenrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_CAPS_UPPER</span> = 1
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a97">97</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Uppercase keywords found</p>
</div>
<a name="defineGESHI_END_IMPORTANT"><!-- --></a>
<div class="oddrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_END_IMPORTANT</span> = '&lt;END GeSHi&gt;'
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a117">117</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">The ender for important parts of the source</p>
</div>
<a name="defineGESHI_FANCY_LINE_NUMBERS"><!-- --></a>
<div class="evenrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_FANCY_LINE_NUMBERS</span> = 2
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a67">67</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Use fancy line numbers when building the result</p>
</div>
<a name="defineGESHI_HEADER_DIV"><!-- --></a>
<div class="oddrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_HEADER_DIV</span> = 1
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a73">73</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Use a &quot;div&quot; to surround the source</p>
</div>
<a name="defineGESHI_HEADER_NONE"><!-- --></a>
<div class="evenrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_HEADER_NONE</span> = 0
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a71">71</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Use nothing to surround the source</p>
</div>
<a name="defineGESHI_HEADER_PRE"><!-- --></a>
<div class="oddrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_HEADER_PRE</span> = 2
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a75">75</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Use a &quot;pre&quot; to surround the source</p>
</div>
<a name="defineGESHI_HEADER_PRE_TABLE"><!-- --></a>
<div class="evenrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_HEADER_PRE_TABLE</span> = 4
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a91">91</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Use a &quot;table&quot; to surround the source:</p>
<p class="description"><p>&lt;table&gt; &lt;thead&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;$header&lt;/td&gt;&lt;/tr&gt;&lt;/thead&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td&gt;<pre>$linenumbers</pre>&lt;/td&gt;&lt;td&gt;<pre>$code></pre>&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt; &lt;tfooter&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;$footer&lt;/td&gt;&lt;/tr&gt;&lt;/tfoot&gt; &lt;/table&gt;</p><p>this is essentially only a workaround for Firefox, see sf#1651996 or take a look at https://bugzilla.mozilla.org/show_bug.cgi?id=365805</p></p>
<ul class="tags">
<li><span class="field">note:</span> when linenumbers are disabled this is essentially the same as GESHI_HEADER_PRE</li>
</ul>
</div>
<a name="defineGESHI_HEADER_PRE_VALID"><!-- --></a>
<div class="oddrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_HEADER_PRE_VALID</span> = 3
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a77">77</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Use a pre to wrap lines when line numbers are enabled or to wrap the whole code.</p>
</div>
<a name="defineGESHI_HOVER"><!-- --></a>
<div class="evenrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_HOVER</span> = 1
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a105">105</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Links in the source in the :hover state</p>
</div>
<a name="defineGESHI_LANG_ROOT"><!-- --></a>
<div class="oddrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_LANG_ROOT</span> = GESHI_ROOT.'geshi'.DIRECTORY_SEPARATOR
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a53">53</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">The language file directory for GeSHi</p>
</div>
<a name="defineGESHI_LINK"><!-- --></a>
<div class="evenrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_LINK</span> = 0
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a103">103</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Links in the source in the :link state</p>
</div>
<a name="defineGESHI_NORMAL_LINE_NUMBERS"><!-- --></a>
<div class="oddrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_NORMAL_LINE_NUMBERS</span> = 1
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a65">65</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Use normal line numbers when building the result</p>
</div>
<a name="defineGESHI_NO_LINE_NUMBERS"><!-- --></a>
<div class="evenrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_NO_LINE_NUMBERS</span> = 0
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a63">63</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Use no line numbers when building the result</p>
</div>
<a name="defineGESHI_ROOT"><!-- --></a>
<div class="oddrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_ROOT</span> = dirname(__FILE__).DIRECTORY_SEPARATOR
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a49">49</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">The root directory for GeSHi</p>
</div>
<a name="defineGESHI_SECURITY_PARANOID"><!-- --></a>
<div class="evenrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_SECURITY_PARANOID</span> = false
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a58">58</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Tells GeSHi to be paranoid about security settings</p>
</div>
<a name="defineGESHI_START_IMPORTANT"><!-- --></a>
<div class="oddrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_START_IMPORTANT</span> = '&lt;BEGIN GeSHi&gt;'
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a115">115</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">The starter for important parts of the source</p>
</div>
<a name="defineGESHI_VERSION"><!-- --></a>
<div class="evenrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_VERSION</span> = '1.0.8.2',
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a44">44</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">The version of this GeSHi file</p>
</div>
<a name="defineGESHI_VISITED"><!-- --></a>
<div class="oddrow">
<div>
<img src="../../media/images/Constant.png" />
<span class="const-title">
<span class="const-name">GESHI_VISITED</span> = 3
(line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a109">109</a></span>)
</span>
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Links in the source in the :visited state</p>
</div>
</div>
</div>
<a name="sec-functions"></a>
<div class="info-box">
<div class="info-box-title">Functions</div>
<div class="nav-bar">
<a href="#sec-description">Description</a> |
<a href="#sec-classes">Classes</a>
| <a href="#sec-constants">Constants</a>
| <span class="disabled">Functions</span>
</div>
<div class="info-box-body">
<a name="functiongeshi_highlight" id="functiongeshi_highlight"><!-- --></a>
<div class="evenrow">
<div>
<img src="../../media/images/Function.png" />
<span class="method-title">geshi_highlight</span> (line <span class="line-number"><a href="../../__filesource/fsource_geshi_core_geshi.php.html#a4577">4577</a></span>)
</div>
<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Easy way to highlight stuff. Behaves just like highlight_string</p>
<ul class="tags">
<li><span class="field">return:</span> The code highlighted (if $return is true)</li>
<li><span class="field">since:</span> 1.0.2</li>
</ul>
<div class="method-signature">
<span class="method-result">string</span>
<span class="method-name">
geshi_highlight
</span>
(<span class="var-type">string</span>&nbsp;<span class="var-name">$string</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$language</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$path</span> = <span class="var-default">null</span>], [<span class="var-type">boolean</span>&nbsp;<span class="var-name">$return</span> = <span class="var-default">false</span>])
</div>
<ul class="parameters">
<li>
<span class="var-type">string</span>
<span class="var-name">$string</span><span class="var-description">: The code to highlight</span> </li>
<li>
<span class="var-type">string</span>
<span class="var-name">$language</span><span class="var-description">: The language to highlight the code in</span> </li>
<li>
<span class="var-type">string</span>
<span class="var-name">$path</span><span class="var-description">: The path to the language files. You can leave this blank if you need as from version 1.0.7 the path should be automatically detected</span> </li>
<li>
<span class="var-type">boolean</span>
<span class="var-name">$return</span><span class="var-description">: Whether to return the result or to echo</span> </li>
</ul>
</div>
</div>
</div>
<p class="notes" id="credit">
Documentation generated on Thu, 25 Dec 2008 14:34:34 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.2</a>
</p>
</div></body>
</html>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Generated by phpDocumentor on Thu, 25 Dec 2008 14:34:34 +0100 -->
<title>GeSHi 1.0.8</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<FRAMESET rows='120,*'>
<FRAME src='packages.html' name='left_top' frameborder="1" bordercolor="#999999">
<FRAMESET cols='25%,*'>
<FRAME src='li_geshi.html' name='left_bottom' frameborder="1" bordercolor="#999999">
<FRAME src='blank.html' name='right' frameborder="1" bordercolor="#999999">
</FRAMESET>
<NOFRAMES>
<H2>Frame Alert</H2>
<P>This document is designed to be viewed using the frames feature.
If you see this message, you are using a non-frame-capable web client.</P>
</NOFRAMES>
</FRAMESET>
</HTML>

View File

@@ -1,46 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="package-title">geshi</div>
<div class="package-details">
<dl class="tree">
<dt class="folder-title">Description</dt>
<dd>
<a href='classtrees_geshi.html' target='right'>Class trees</a><br />
<a href='elementindex_geshi.html' target='right'>Index of elements</a><br />
<a href="todolist.html" target="right">Todo List</a><br />
</dd>
<dt class="sub-package"><img class="tree-icon" src="media/images/package.png" alt="Sub-package">core</dt>
<dd>
<dl class="tree">
<dt class="folder-title"><img class="tree-icon" src="media/images/class_folder.png" alt=" ">Classes</dt>
<dd><img class="tree-icon" src="media/images/Class.png" alt="Class"><a href='geshi/core/GeSHi.html' target='right'>GeSHi</a></dd>
<dt class="folder-title"><img class="tree-icon" src="media/images/function_folder.png" alt=" ">Functions</dt>
<dd><img class="tree-icon" src="media/images/Function.png" alt="Function"><a href='geshi/core/_geshi.php.html#functiongeshi_highlight' target='right'>geshi_highlight</a></dd>
<dt class="folder-title"><img class="tree-icon" src="media/images/folder.png" alt=" ">Files</dt>
<dd><img class="tree-icon" src="media/images/Page.png" alt="File"><a href='geshi/core/_geshi.php.html' target='right'>geshi.php</a></dd>
</dl>
</dd>
</dl>
</div>
<p class="notes"><a href="http://www.phpdoc.org" target="_blank">phpDocumentor v <span class="field">1.4.2</span></a></p>
</BODY>
</HTML>

View File

@@ -1,33 +0,0 @@
body
{
background-color: #EEEEEE;
margin: 0px;
padding: 0px;
}
/* Banner (top bar) classes */
.banner { }
.banner-menu
{
text-align: right;
clear: both;
padding: .5em;
border-top: 2px solid #AAAAAA;
}
.banner-title
{
text-align: right;
font-size: 20pt;
font-weight: bold;
margin: .2em;
}
.package-selector
{
background-color: #DDDDDD;
border: 1px solid #AAAAAA;
color: #000090;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Some files were not shown because too many files have changed in this diff Show More