static function escapeArgument($arg) { $ok = true; $_g1 = 0; $_g = strlen($arg); while ($_g1 < $_g) { $i = $_g1++; switch (_hx_char_code_at($arg, $i)) { case 32: case 34: $ok = false; break; case 0: case 13: case 10: $arg = _hx_substr($arg, 0, $i); break; } unset($i); } if ($ok) { return $arg; } return "\"" . _hx_explode("\"", $arg)->join("\\\"") . "\""; }
public function nextSafeToken() { if ($this->i < $this->n) { $this->c = _hx_char_code_at($this->str, $this->i); $this->i++; } else { $this->c = -1; } }
public function log($context, $appMessages) { $logFile = _hx_string_or_null($context->get_contentDirectory()) . _hx_string_or_null($this->path); $req = $context->request; $res = $context->response; $userDetails = $req->get_clientIP(); if ((null !== $context->session ? $context->session->get_id() : null) !== null) { $userDetails .= " " . _hx_string_or_null(null !== $context->session ? $context->session->get_id() : null); } if (($context->auth !== null && $context->auth->get_currentUser() !== null ? $context->auth->get_currentUser()->get_userID() : null) !== null) { $userDetails .= " " . _hx_string_or_null($context->auth !== null && $context->auth->get_currentUser() !== null ? $context->auth->get_currentUser()->get_userID() : null); } $content = "" . Std::string(Date::now()) . " [" . _hx_string_or_null($req->get_httpMethod()) . "] [" . _hx_string_or_null($req->get_uri()) . "] from [" . _hx_string_or_null($userDetails) . "], response: [" . _hx_string_rec($res->status, "") . " " . _hx_string_or_null($res->get_contentType()) . "]\n"; $_g = 0; $_g1 = $context->messages; while ($_g < $_g1->length) { $msg = $_g1[$_g]; ++$_g; $content .= "\t" . _hx_string_or_null(ufront_log_FileLogger::format($msg)) . "\n"; unset($msg); } if ($appMessages !== null) { $_g2 = 0; while ($_g2 < $appMessages->length) { $msg1 = $appMessages[$_g2]; ++$_g2; $content .= "\t" . _hx_string_or_null(ufront_log_FileLogger::format($msg1)) . "\n"; unset($msg1); } } $path = haxe_io_Path::directory($logFile); $path1 = haxe_io_Path::addTrailingSlash($path); $_p = null; $parts = new _hx_array(array()); while ($path1 !== ($_p = haxe_io_Path::directory($path1))) { $parts->unshift($path1); $path1 = $_p; } $_g3 = 0; while ($_g3 < $parts->length) { $part = $parts[$_g3]; ++$_g3; if (_hx_char_code_at($part, strlen($part) - 1) !== 58 && !file_exists($part)) { @mkdir($part, 493); } unset($part); } $file = sys_io_File::append(_hx_string_or_null($context->get_contentDirectory()) . _hx_string_or_null($this->path), null); $file->writeString($content); $file->close(); return ufront_core_SurpriseTools::success(); }
static function do_hash($s) { $b = 378551; $a = 63689; $hash = 0; $i = 0; $_g1 = 0; $_g = strlen($s); while ($_g1 < $_g) { $i1 = $_g1++; $hash = $hash * $a + _hx_char_code_at($s, $i1); $a = $a * $b; unset($i1); } return Math::abs($hash); }
static function escapeArgument($arg) { $ok = true; $_g1 = 0; $_g = strlen($arg); while ($_g1 < $_g) { $i = $_g1++; $_g2 = _hx_char_code_at($arg, $i); if ($_g2 !== null) { switch ($_g2) { case 32: case 9: case 34: case 38: case 124: case 60: case 62: case 35: case 59: case 42: case 63: case 40: case 41: case 123: case 125: case 36: $ok = false; break; case 0: case 13: case 10: $arg = _hx_substr($arg, 0, $i); break; } } unset($i, $_g2); } if ($ok) { return $arg; } return "\"" . _hx_string_or_null(_hx_explode("\"", _hx_explode("\\", $arg)->join("\\\\"))->join("\\\"")) . "\""; }
static function quoteForDiff($v, $d) { $nil = "NULL"; $str = $v->toString($d); $score = 0; $_g1 = 0; $_g = strlen($str); while ($_g1 < $_g) { $i = $_g1++; if (_hx_char_code_at($str, $score) !== 95) { break; } $score++; unset($i); } if (_hx_substr($str, $score, null) === $nil) { $str = "_" . _hx_string_or_null($str); } return $str; }
static function isInteger($str) { $str = trim($str); $i = 0; $n = strlen($str); if (StringTools::startsWith($str, "-")) { $i++; } if (StringTools::startsWith($str, "+")) { $i++; } $c = null; while ($i < $n) { $c = _hx_char_code_at($str, $i); if ($c < 48 || $c > 57) { return false; } $i++; } return true; }
public function toHex() { $s = new StringBuf(); $chars = new _hx_array(array()); $str = "0123456789abcdef"; $_g1 = 0; $_g = strlen($str); while ($_g1 < $_g) { $i = $_g1++; $chars->push(_hx_char_code_at($str, $i)); unset($i); } $_g1 = 0; $_g = $this->length; while ($_g1 < $_g) { $i = $_g1++; $c = ord($this->b[$i]); $s->b .= chr($chars[$c >> 4]); $s->b .= chr($chars[$c & 15]); unset($i, $c); } return $s->b; }
public function requestIn($ctx) { $_g = $this; if (strtolower($ctx->request->get_httpMethod()) === "post" && $ctx->request->isMultipart()) { $file = null; $postName = null; $origFileName = null; $size = 0; $tmpFilePath = null; $dateStr = DateTools::format(Date::now(), "%Y%m%d-%H%M"); $dir = _hx_string_or_null($ctx->get_contentDirectory()) . _hx_string_or_null(haxe_io_Path::addTrailingSlash(ufront_web_upload_TmpFileUploadMiddleware::$subDir)); $path = haxe_io_Path::removeTrailingSlashes($dir); $path1 = haxe_io_Path::addTrailingSlash($path); $_p = null; $parts = new _hx_array(array()); while ($path1 !== ($_p = haxe_io_Path::directory($path1))) { $parts->unshift($path1); $path1 = $_p; } $_g1 = 0; while ($_g1 < $parts->length) { $part = $parts[$_g1]; ++$_g1; if (_hx_char_code_at($part, strlen($part) - 1) !== 58 && !file_exists($part)) { @mkdir($part, 493); } unset($part); } $onPart = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_0"), 'execute'); $onData = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_1"), 'execute'); $onEndPart = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onData, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_2"), 'execute'); return tink_core__Future_Future_Impl_::map($ctx->request->parseMultipart($onPart, $onData, $onEndPart), array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onData, &$onEndPart, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_3"), 'execute'), null); } else { return ufront_core_SurpriseTools::success(); } }
public function fromString($txt) { $txt .= "]"; $at = 0; $_g1 = 0; $_g = strlen($txt); while ($_g1 < $_g) { $i = $_g1++; $ch = _hx_char_code_at($txt, $i); if ($ch >= 48 && $ch <= 57) { $at *= 10; $at += $ch - 48; } else { if ($ch === 45) { $at = -1; } else { if ($ch === 124) { $this->p = $at; $at = 0; } else { if ($ch === 58) { $this->l = $at; $at = 0; } else { if ($ch === 93) { $this->r = $at; return true; } } } } } unset($i, $ch); } return false; }
static function isOp($c) { return com_wiris_util_xml_WCharacterBase::isLarge($c) || com_wiris_util_xml_WCharacterBase::isVeryLarge($c) || com_wiris_util_xml_WCharacterBase::isBinaryOp($c) || com_wiris_util_xml_WCharacterBase::isRelation($c) || $c === _hx_char_code_at(".", 0) || $c === _hx_char_code_at(",", 0) || $c === _hx_char_code_at(":", 0); }
public function readLine() { $buf = new StringBuf(); $last = null; $s = null; try { while (($last = $this->readByte()) !== 10) { $buf->b .= chr($last); } $s = $buf->b; if (_hx_char_code_at($s, strlen($s) - 1) === 13) { $s = _hx_substr($s, 0, -1); } } catch (Exception $»e) { $_ex_ = $»e instanceof HException ? $»e->e : $»e; if (($e = $_ex_) instanceof haxe_io_Eof) { $s = $buf->b; if (strlen($s) === 0) { throw new HException($e); } } else { throw $»e; } } return $s; }
public function encodeString($sb, $s) { $sb->add("\""); $i = null; $_g1 = 0; $_g = strlen($s); while ($_g1 < $_g) { $i1 = $_g1++; $c = _hx_char_code_at($s, $i1); if ($c === 34) { $sb->add("\\\""); } else { if ($c === 13) { $sb->add("\\r"); } else { if ($c === 10) { $sb->add("\\n"); } else { if ($c === 9) { $sb->add("\\t"); } else { if ($c === 92) { $sb->add("\\\\"); } else { $sb->add(_hx_char_at($s, $i1)); } } } } } unset($i1, $c); } $sb->add("\""); }
public function makeConst($v) { haxe_Template::$expr_trim->match($v); $v = haxe_Template::$expr_trim->matched(1); if (_hx_char_code_at($v, 0) === 34) { $str = _hx_substr($v, 1, strlen($v) - 2); return array(new _hx_lambda(array("str" => &$str, "v" => &$v), null, array(), "{\n\t\t\t\treturn \$str;\n\t\t\t}"), 'execute0'); } if (haxe_Template::$expr_int->match($v)) { $i = Std::parseInt($v); return array(new _hx_lambda(array("i" => &$i, "str" => &$str, "v" => &$v), null, array(), "{\n\t\t\t\treturn \$i;\n\t\t\t}"), 'execute0'); } if (haxe_Template::$expr_float->match($v)) { $f = Std::parseFloat($v); return array(new _hx_lambda(array("f" => &$f, "i" => &$i, "str" => &$str, "v" => &$v), null, array(), "{\n\t\t\t\treturn \$f;\n\t\t\t}"), 'execute0'); } $me = $this; return array(new _hx_lambda(array("f" => &$f, "i" => &$i, "me" => &$me, "str" => &$str, "v" => &$v), null, array(), "{\n\t\t\treturn \$me->resolve(\$v);\n\t\t}"), 'execute0'); }
public function applyHeader() { $_g1 = $this->payloadCol; $_g = $this->payloadTop; while ($_g1 < $_g) { $i = $_g1++; $name = $this->getString($i); if ($name === "...") { $this->modifier->set($i, "..."); $this->haveDroppedColumns = true; continue; } $mod = $this->modifier->get($i); $move = false; if ($mod !== null) { if (_hx_char_code_at($mod, 0) === 58) { $move = true; $mod = _hx_substr($mod, 1, strlen($mod)); } } $this->header->set($i, $name); if ($mod !== null) { if (_hx_char_code_at($mod, 0) === 40) { $prev_name = _hx_substr($mod, 1, strlen($mod) - 2); $this->headerPre->set($prev_name, $i); $this->headerPost->set($name, $i); $this->headerRename->set($prev_name, $name); continue; unset($prev_name); } } if ($mod !== "+++") { $this->headerPre->set($name, $i); } if ($mod !== "---") { $this->headerPost->set($name, $i); } if ($move) { if ($this->headerMove === null) { $this->headerMove = new haxe_ds_StringMap(); } $this->headerMove->set($name, 1); } unset($name, $move, $mod, $i); } if (!$this->useMetaForRowChanges()) { if ($this->source->get_height() === 0) { $this->applyAction("+++"); } } }
static function isSpace($s, $pos) { $c = _hx_char_code_at($s, $pos); return $c >= 9 && $c <= 13 || $c === 32; }
public function parseCellPart($txt) { if ($txt === null) { return null; } $this->row_ended = false; $first_non_underscore = strlen($txt); $last_processed = 0; $quoting = false; $quote = 0; $result = ""; $start = $this->cursor; $_g1 = $this->cursor; $_g = strlen($txt); while ($_g1 < $_g) { $i = $_g1++; $ch = _hx_char_code_at($txt, $i); $last_processed = $i; if ($ch !== 95 && $i < $first_non_underscore) { $first_non_underscore = $i; } if ($this->has_structure) { if (!$quoting) { if ($ch === _hx_char_code_at($this->delim, 0)) { break; } if ($ch === 13 || $ch === 10) { $ch2 = _hx_char_code_at($txt, $i + 1); if ($ch2 !== null) { if ($ch2 !== $ch) { if ($ch2 === 13 || $ch2 === 10) { $last_processed++; } } } $this->row_ended = true; break; unset($ch2); } if ($ch === 34 || $ch === 39) { if ($i === $this->cursor) { $quoting = true; $quote = $ch; if ($i !== $start) { $result .= _hx_string_or_null(chr($ch)); } continue; } else { if ($ch === $quote) { $quoting = true; } } } $result .= _hx_string_or_null(chr($ch)); continue; } if ($ch === $quote) { $quoting = false; continue; } } $result .= _hx_string_or_null(chr($ch)); unset($i, $ch); } $this->cursor = $last_processed; if ($quote === 0) { if ($result === "NULL") { return null; } if ($first_non_underscore > $start) { $del = $first_non_underscore - $start; if (_hx_substr($result, $del, null) === "NULL") { return _hx_substr($result, 1, null); } } } return $result; }
static function isXmlEntity($ent) { if (_hx_char_code_at($ent, 0) === 35) { $c = null; if (_hx_char_code_at($ent, 1) === 120) { $c = Std::parseInt("0x" . _hx_substr($ent, 2, null)); } else { $c = Std::parseInt(_hx_substr($ent, 1, null)); } return $c === 34 || $c === 38 || $c === 39 || $c === 60 || $c === 62; } else { return $ent === "amp" || $ent === "lt" || $ent === "gt" || $ent === "quot" || $ent === "apos"; } }
function ufront_web_session_FileSession_1(&$dir) { if (file_exists($dir) === false) { $path = haxe_io_Path::addTrailingSlash($dir); $_p = null; $parts = new _hx_array(array()); while ($path !== ($_p = haxe_io_Path::directory($path))) { $parts->unshift($path); $path = $_p; } $_g = 0; while ($_g < $parts->length) { $part = $parts[$_g]; ++$_g; if (_hx_char_code_at($part, strlen($part) - 1) !== 58 && !file_exists($part)) { @mkdir($part, 493); } unset($part); } } return tink_core_Noise::$Noise; }
static function removeTrailingSlashes($path) { while (true) { $_g = _hx_char_code_at($path, strlen($path) - 1); if ($_g !== null) { switch ($_g) { case 47: case 92: $path = _hx_substr($path, 0, -1); break; default: break 2; break; } } else { break; } unset($_g); } return $path; }
public function makeConst($v) { haxe_Template::$expr_trim->match($v); $v = haxe_Template::$expr_trim->matched(1); if (_hx_char_code_at($v, 0) === 34) { $str = _hx_substr($v, 1, strlen($v) - 2); return array(new _hx_lambda(array(&$str, &$v), "haxe_Template_1"), 'execute'); } if (haxe_Template::$expr_int->match($v)) { $i = Std::parseInt($v); return array(new _hx_lambda(array(&$i, &$v), "haxe_Template_2"), 'execute'); } if (haxe_Template::$expr_float->match($v)) { $f = Std::parseFloat($v); return array(new _hx_lambda(array(&$f, &$v), "haxe_Template_3"), 'execute'); } $me = $this; return array(new _hx_lambda(array(&$me, &$v), "haxe_Template_4"), 'execute'); }
function _hx_string_call($s, $method, $params) { if (!is_string($s)) { return call_user_func_array(array($s, $method), $params); } switch ($method) { case 'toUpperCase': return strtoupper($s); case 'toLowerCase': return strtolower($s); case 'charAt': return substr($s, $params[0], 1); case 'charCodeAt': return _hx_char_code_at($s, $params[0]); case 'indexOf': return _hx_index_of($s, $params[0], count($params) > 1 ? $params[1] : null); case 'lastIndexOf': return _hx_last_index_of($s, count($params) > 1 ? $params[1] : null, null); case 'split': return _hx_explode($params[0], $s); case 'substr': return _hx_substr($s, $params[0], count($params) > 1 ? $params[1] : null); case 'toString': return $s; default: throw new HException('Invalid Operation: ' . $method); } }
static function compareStrings($a, $b) { $i = null; $an = strlen($a); $bn = strlen($b); $n = $an > $bn ? $bn : $an; $_g = 0; while ($_g < $n) { $i1 = $_g++; $c = _hx_char_code_at($a, $i1) - _hx_char_code_at($b, $i1); if ($c !== 0) { return $c; } unset($i1, $c); } return strlen($a) - strlen($b); }