Esempio n. 1
0
function parseIDLParams($idlFunc, $isMagicMethod = false)
{
    $params = array();
    foreach ($idlFunc['args'] as $arg) {
        $paramname = $arg['name'];
        $parambyRef = array_key_exists('ref', $arg) && $arg['ref'];
        $paramtype = mapType(typeidlname($arg['type'], 'void'), $parambyRef);
        if ($isMagicMethod) {
            $paramtype = 'HPHP::Variant';
        }
        $paramdefValue = array_key_exists('default', $arg) ? $arg['default'] : 'NULL';
        if ($paramdefValue == 'NULL') {
            $paramdefValue = '';
        } else {
            if ($paramdefValue == '""') {
                $paramdefValue = 'empty_string';
            }
        }
        $params[] = new PhpParam($paramname, $paramtype, $paramdefValue, $parambyRef);
    }
    return $params;
}
Esempio n. 2
0
function imageURL($phone)
{
    $query = array("maptype" => mapType(), "key" => APIKEY, "size" => pix("x", $phone) . 'x' . pix("y", $phone), "center" => lat() . "," . long(), "zoom" => zoom(), "sensor" => "false", "markers" => marker(), "mobile" => MOBILEMAP);
    return mapURL() . '?' . http_build_query($query);
}
Esempio n. 3
0
function processArgType($func, $indent)
{
    $name = $func->name;
    $args_set = parseArgs(@$func->args);
    $i = count($args_set);
    if ($i == 0) {
        return;
    } else {
        if ($i == 1) {
            foreach ($args_set as $var => $type) {
                $typename = mapType($type, "");
                $argsTyName = getArgsType($name);
                echo "\n{$indent}typedef {$typename} {$argsTyName};\n";
            }
        } else {
            echo "\n{$indent}typedef struct {\n";
            foreach ($args_set as $var => $type) {
                $typename = mapType($type, "");
                echo "{$indent}\t{$typename} {$var};\n";
            }
            $argsTyName = getArgsType($name);
            echo "{$indent}} {$argsTyName};\n";
        }
    }
}
Esempio n. 4
0
//Print the list of servers
echo '<table align="center" cellspacing=5 cellpadding=5>
    <tr>
      <td><b>Name</b></td>
      <td><b>Users</b></td>
      <td><b>Map</b></td>
      <td><b>Game</b></td>
      <td><b>Status</b></td>
      <td><b>Enter</b></td>';
$query = "SELECT id,servername,users,maxusers,status,map,gametype FROM serverlist";
$result = @mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo '<tr>
      <td>' . $row['servername'] . '</td>
      <td>' . $row['users'] . '/' . $row['maxusers'] . '</td>
      <td>' . mapType($row['map']) . '</td>
      <td>' . gameTypeToText($row[gametype]) . '</td>
      <td>';
    if ($row['status'] != 2) {
        if ($row['status'] == 0) {
            echo '<font color="lime">Online</font></td>';
        } else {
            echo '<font color="Orange">In Progress</font></td>';
        }
        if (isOnServer($row['id'], $id)) {
            echo '<td><a href="./server.php?s=' . $row['id'] . '">Enter</a></td>';
        } else {
            if (getServerStat(users, $row['id']) < getServerStat(maxusers, $row['id']) && $row['status'] == 0) {
                echo '<td><a href="./server.php?s=' . $row['id'] . '">Join</a></td>';
            } else {
                echo '<td>Full</td>';
Esempio n. 5
0
function genCtor($class_name, $ctor, $indent)
{
    echo "\n";
    echo "{$indent}";
    if (!count($ctor) || !@$ctor->args) {
        echo "explicit ";
    }
    //echo "${class_name}(cerl::Fiber self";
    echo "{$class_name}(";
    if (count($ctor)) {
        $args = parseArgs(@$ctor->args);
        $i = 0;
        foreach ($args as $var => $tp) {
            if ($i == 0) {
                $typename = mapType($tp, "&");
                echo "const {$typename} {$var}";
            } else {
                $typename = mapType($tp, "&");
                echo ", const {$typename} {$var}";
            }
            $i = $i + 1;
        }
    }
    //echo ")\n${indent}\t: self(_me)\n";
    echo ")\n";
    echo "{$indent}{\n{$indent}}\n";
}
Esempio n. 6
0
function genSyncFuncDef($func, $indent)
{
    $name = $func->name;
    $async = @$func->async;
    $args_set = parseArgs(@$func->args);
    $retType = getRetType($name);
    if ($async) {
        echo "\n{$indent}/*[async]*/";
    }
    echo "\n{$indent}bool cerl_call {$name}(";
    if (!$async) {
        echo "cerl::ScopedAlloc& alloc";
        echo ",\n{$indent}\t{$retType}& _result";
    }
    $flag = 0;
    foreach ($args_set as $var => $type) {
        $typename = mapType($type, "&");
        if ($flag == 0 && $async) {
            echo "const {$typename} {$var}";
            $flag = 1;
        } else {
            echo ",\n{$indent}\tconst {$typename} {$var}";
        }
    }
    if (count($args_set) || !$async) {
        echo "\n{$indent}\t";
    }
    echo ")\n";
    echo "{$indent}{\n";
    if (count($args_set) > 1) {
        $argsTyName = getArgsType($name);
        echo "{$indent}\t{$argsTyName} _args = {";
        $j = 1;
        foreach ($args_set as $var => $type) {
            if ($j == 1) {
                echo "{$var}";
            } else {
                echo ", {$var}";
            }
            $j++;
        }
        echo "};\n";
    }
    if ($async) {
        if (count($args_set) == 0) {
            echo "{$indent}\treturn m_conn.dbg_cast0(this, (cerl::FID)code_{$name});\n";
        } else {
            if (count($args_set) == 1) {
                foreach ($args_set as $var => $type) {
                    break;
                }
                echo "{$indent}\treturn m_conn.dbg_cast(this, (cerl::FID)code_{$name}, {$var});\n";
            } else {
                echo "{$indent}\treturn m_conn.dbg_cast(this, (cerl::FID)code_{$name}, _args);\n";
            }
        }
    } else {
        if (count($args_set) == 0) {
            echo "{$indent}\treturn m_conn.dbg_call0(this, alloc, _result, (cerl::FID)code_{$name});\n";
        } else {
            if (count($args_set) == 1) {
                foreach ($args_set as $var => $type) {
                    break;
                }
                echo "{$indent}\treturn m_conn.dbg_call(this, alloc, _result, (cerl::FID)code_{$name}, {$var});\n";
            } else {
                echo "{$indent}\treturn m_conn.dbg_call(this, alloc, _result, (cerl::FID)code_{$name}, _args);\n";
            }
        }
    }
    echo "{$indent}}\n";
}
Esempio n. 7
0
function imageURL($prefix)
{
    $query = array("maptype" => mapType(), "size" => pix("x", $prefix) . 'x' . pix("y", $prefix), "center" => lat() . "," . long(), "zoom" => zoom(), "sensor" => "false", "markers" => marker(), "mobile" => MOBILEMAP);
    return mapURL() . '?' . urldecode(http_build_query($query));
}