Exemplo n.º 1
0
function define_class($class)
{
    global $output, $net;
    $name = $class['name'];
    $desc = idx_string($class, 'desc');
    if ((empty($desc) || $net == 1) && $net != -1) {
        $desc = phpnet_get_class_desc($name);
    }
    $output .= "////////////////////////////////////////" . "///////////////////////////////////////\n\n";
    begin_function('BeginClass');
    begin_array();
    out_str('name', $name, true);
    out_str('parent', $class['parent']);
    out_fmt('ifaces', idx_array($class, 'ifaces'));
    out_fmt('bases', idx_array($class, 'bases'));
    out_str('desc', $desc);
    out_fmt('flags', idx_flags($class, 'flags', false));
    out_str('note', idx_string($class, 'note'));
    out_doc('footer', idx_string($class, 'footer'));
    end_array(false);
    end_function();
    define_constants($class['consts']);
    foreach ($class['methods'] as $func) {
        define_function($func, $name);
    }
    define_properties($class['properties']);
    begin_function('EndClass');
    end_function();
}
Exemplo n.º 2
0
$filename = $argv[1];
$lines = explode("\n", file_get_contents($filename));
$sig = '// Do NOT modifiy this doc comment block generated by idl/sysdoc.php';
$file = '';
for ($i = 0; $i < count($lines) - 1; $i++) {
    $line = $lines[$i];
    if (preg_match("#{$sig}#", $line)) {
        while (!preg_match('#^ \\*/$#', $line)) {
            $line = $lines[++$i];
        }
        $line = $lines[++$i];
    }
    if (preg_match('/(?:class|interface) (\\w+)/', $line, $m)) {
        $class = $m[1];
        $info['name'] = $class;
        $doc = phpnet_get_class_desc($class);
        if (!empty($doc)) {
            $info['desc'] = $doc;
            $info['flags'] = 0;
            $file .= "{$sig}\n";
            $file .= get_class_doc_comments($info) . "\n";
        }
    } else {
        if (preg_match('/function /', $line)) {
            while (!preg_match('/function (\\w+) *\\(([^\\)]*)\\)/s', $line, $m)) {
                $line .= "\n" . $lines[++$i];
            }
            $func = $m[1];
            $args = $m[2];
            preg_match_all('/(\\&?\\$\\w+)/', $args, $m);
            $argdefs = $m[1];