height="14"
name="clippy"
quality="high"
allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
FlashVars="text=' . $text . '"
bgcolor="#FFFFFF"
/>
</object>';
}
function str_chop_lines($str, $lines = 4)
{
    return implode("\n", array_slice(explode("\n", $str), $lines));
}
$str = str_chop_lines($str);
function wp_syntax_head()
{
    $css_url = WP_PLUGIN_URL . "/wp-syntax/wp-syntax.css";
    if (file_exists(TEMPLATEPATH . "/wp-syntax.css")) {
        $css_url = get_bloginfo("template_url") . "/wp-syntax.css";
    }
    echo "\n" . '<link rel="stylesheet" href="' . $css_url . '" type="text/css" media="screen" />' . "\n";
}
function wp_syntax_code_trim($code)
{
    // special ltrim b/c leading whitespace matters on 1st line of content
    $code = preg_replace("/^\\s*\n/siU", "", $code);
    $code = rtrim($code);
    return $code;
}
Пример #2
0
}
$descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
$cwd = getcwd() . '/usr/bin';
// -I../../gel/include -I../../gel/include/asm-m68hc11/arch-32k
$command = sprintf('./m6811-elf-g++ -x%s -O%s -m68hc11 -mshort -fomit-frame-pointer -msoft-reg-count=0 -ffixed-z -S -o - -', $lang, $opt);
$process = proc_open($command, $descriptorspec, $pipes, $cwd, NULL);
if (is_resource($process)) {
    fwrite($pipes[0], $source);
    fclose($pipes[0]);
    $asm = stream_get_contents($pipes[1]);
    fclose($pipes[1]);
    $err = stream_get_contents($pipes[2]);
    fclose($pipes[2]);
    $ret = proc_close($process);
}
$asm = str_chop_lines($asm, 7);
//$asm = preg_replace('/^\s*[;.][^\n]+$(?:\r\n|\n)?/m', '', $asm);
?>

<style>
th {
    font-size: 14pt;
}
td {
    vertical-align: top;
}

pre {
    padding: 10px;
    background: #111;
    color: white;