Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once( 'go.php' );
- $me = me_shorthand( $_SERVER['SCRIPT_NAME'] );
- // top of page (title)
- echo '<html><head><title>Roe XAMPP Builder (mk'.
- ( !is_null( $me ) ? ' '. $me['mk'] : '').
- ( !is_null( $me ) ? ' '. $me['me'] : '').
- ')</title><style>'. nen_css() . '</style></head><body>';
- // copyright header
- echo '<table style="width:100%;text-align:top;"><tr><th colspan="2">
- <span style="alignment:center center;font-size:170%;">Roe Collector Card Game</span><br><span style="alignment:center center;font-size:120%;">Copyright 1997, 2021 Tim Keal</span></th></tr>';
- echo '<tr><td>';
- // perform regex upon data from table of contents
- if( !is_null( $me ) ){
- //cycle_sourcefiles();
- //cycle_pagedata();
- cycle_pagedata( $me[ 'mk' ], $me[ 'me' ] );
- }
- echo '</td></tr>';
- echo '</table>';
- // bottom of page
- echo '</body></html>';
- function cycle_pagedata($mk = '', $me = '')
- {
- global $nen;
- $toc_magic = 'dun';
- $toc = fasttoc( 'misc'. $toc_magic. '/', array( '.bas', '.BAS' ) );
- $page = '';
- $toc_index = 0;
- $toc_pattern = '/(^<?magicnumber>{{$toc_magic}}(<?sourcehandle>[0-9]{3})(?<extension>\.bas|\.BAS)$/m';
- $toc_pattern = str_replace( '{{$toc_magic}}', $toc_magic, $toc_pattern );
- $toc_pattern2 = file_get_contents( $nen[ 'root' ] . 'pcre/toc-'. strtolower( $me ). '.pattern.pcre' );
- $toc_pattern2 = str_replace( '{{$toc_magic}}', $toc_magic, $toc_pattern2 );
- if( $toc_pattern !== $toc_pattern2)
- {
- $toc_pattern = $toc_pattern2;
- }
- unset( $toc_pattern2 );
- $pattern='/^(?<linenumber>\d{3,5}) IF (?<resource>MAP)\((?<T>[A-Z]+),(?<TT>[A-Z]+)\)=(?<assignment>\d+)(?: AND \(?([A-Z]+)(=|<>)(\d+)(?: (AND|OR) ([A-Z]+)(=|<>)(\d+)\))?)? THEN PUT\(\(\k<T>-1\)\*(\d+),\(\k<TT>-1\)\*(\d+)\),(?<sprite>[A-Z]{2})$/gm';
- $pattern2 = file_get_contents( $nen[ 'root' ] . 'pcre/'. $toc_magic. '-'. strtolower( $me ). '.pattern.pcre' );
- if( $pattern !== $pattern2)
- {
- $pattern = $pattern2;
- }
- unset( $pattern2 );
- trk_echo2( 'toc', $toc );
- trk_echo2( 'pattern', $pattern );
- trk_echo2( 'toc_index', ( $toc_index + 1 ). ' of '. count( $toc ). ':'. $toc[ $toc_index ] );
- while( ( $toc_index > count( $toc ) - 1 ) ? false : preg_match_all( $toc_pattern, $toc[ $toc_index ], $toc_matches, PREG_SET_ORDER, 0 ) )
- {
- trk_echo2( 'toc_index', ( $toc_index + 1 ). ' of '. count( $toc ). ':'. $toc[ $toc_index ] );
- $page2 = '';
- $toc_magic = strtolower( $toc_matches[ 'magicnumber' ] );
- echo '<h3>'. htmlentities( 'misc'. $toc_magic. '/'. $toc_matches[ 'sourcehandle' ]. $toc_matches[ 'extension' ] ). '</h3>';
- $page = file_get_contents( $nen[ 'root' ] . 'misc'. $toc_magic. '/'. $toc[ $toc_index ] );
- while( preg_match_all( $pattern, $page, $matches, PREG_SET_ORDER, 0 ) )
- {
- if( strlen( $page2 ) > 0 )
- {
- $page2 .= "\r\n";
- }
- $page2 .= $matches[ 0 ];
- }
- file_put_contents( $nen[ 'root' ].
- 'meta'. strtolower( $me ). '/R'. $mk. '-'. $me. $toc_matches[ 'sourcehandle' ]. $toc_matches[ 'extension' ]. '.dat', $page2 );
- echo $page2;
- $toc_index++;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement