Пример #1
0
 public function load($moduleSequence)
 {
     $_g = 0;
     while ($_g < $moduleSequence->length) {
         $path = $moduleSequence[$_g];
         ++$_g;
         if (zcale_core_web_ModuleLoader_0($this, $_g, $moduleSequence, $path) === true && $path !== _hx_array_get(new _hx_array(array("zcale.Core", "zcale.core")), 0) && Lambda::has(zcale_core_web_ModuleLoader::$loadedModules, $path) === false) {
             $this->modules->push($path);
         }
         unset($path);
     }
     $this->loadNextModule();
 }
Пример #2
0
 public function load($filePath)
 {
     if (Lambda::has(zcale_core_web_scriptLoader_targets_SystemScriptLoader::$loadedScripts, $filePath) === false) {
         $classPath = null;
         $s = zcale_PathTools::removeLastElement($filePath, null);
         $classPath = str_replace("/", ".", $s);
         $cls = Type::resolveClass($classPath);
         if (is_object($_t = Type::typeof($cls)) && !$_t instanceof Enum ? $_t !== ValueType::$TNull : $_t != ValueType::$TNull) {
             try {
                 Reflect::callMethod($cls, Reflect::field($cls, "main"), new _hx_array(array()));
             } catch (Exception $__hx__e) {
                 $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
                 $error = $_ex_;
             }
             zcale_core_web_scriptLoader_targets_SystemScriptLoader::$loadedScripts->push($filePath);
             $this->event->dispatch($this->eventKeys->complete);
         } else {
             $this->event->dispatchError($this->eventData, $this, "load", "Class not found: " . _hx_string_or_null($classPath));
         }
     } else {
         $this->event->dispatch($this->eventKeys->complete);
     }
 }
Пример #3
0
 public function prepare($where)
 {
     $wParam = _hx_explode(",", $where);
     $where = "";
     if (Lambda::has($wParam, "filter=1")) {
         $wParam = $wParam->filter(array(new _hx_lambda(array(&$wParam, &$where), "model_Select_0"), 'execute'));
     }
     if ($wParam->length > 0 && $where === "") {
         $where = "";
     }
     $_g = 0;
     while ($_g < $wParam->length) {
         $w = $wParam[$_g];
         ++$_g;
         if ($where === "") {
             $where = "WHERE " . _hx_string_or_null($w);
         } else {
             $where = " AND " . _hx_string_or_null($w);
         }
         unset($w);
     }
     haxe_Log::trace($where, _hx_anonymous(array("fileName" => "Select.hx", "lineNumber" => 62, "className" => "model.Select", "methodName" => "prepare")));
     return $where;
 }
Пример #4
0
 static function dispatch($param)
 {
     $cl = Type::resolveClass("model." . Std::string($param->get("className")));
     if ($cl === null) {
         haxe_Log::trace("model." . Std::string($param->get("className")) . " ???", _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 66, "className" => "Model", "methodName" => "dispatch")));
         return false;
     }
     $fl = Reflect::field($cl, "create");
     if ($fl === null) {
         haxe_Log::trace(Std::string($cl) . "create is null", _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 73, "className" => "Model", "methodName" => "dispatch")));
         return false;
     }
     $iFields = Type::getInstanceFields($cl);
     if (Lambda::has($iFields, $param->get("action"))) {
         haxe_Log::trace("calling create " . Std::string($cl), _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 80, "className" => "Model", "methodName" => "dispatch")));
         return Reflect::callMethod($cl, $fl, new _hx_array(array($param)));
     } else {
         haxe_Log::trace("not calling create ", _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 85, "className" => "Model", "methodName" => "dispatch")));
         return false;
     }
 }
Пример #5
0
 public function run($args, $io = null)
 {
     if ($io === null) {
         $io = new coopy_TableIO();
     }
     if ($io === null) {
         haxe_Log::trace("No system interface available", _hx_anonymous(array("fileName" => "Coopy.hx", "lineNumber" => 693, "className" => "coopy.Coopy", "methodName" => "run")));
         return 1;
     }
     $this->init();
     $this->io = $io;
     $more = true;
     $output = null;
     $inplace = false;
     $git = false;
     $this->flags = new coopy_CompareFlags();
     $this->flags->always_show_header = true;
     while ($more) {
         $more = false;
         $_g1 = 0;
         $_g = $args->length;
         while ($_g1 < $_g) {
             $i = $_g1++;
             $tag = $args[$i];
             if ($tag === "--output") {
                 $more = true;
                 $output = $args[$i + 1];
                 $args->splice($i, 2);
                 break;
             } else {
                 if ($tag === "--css") {
                     $more = true;
                     $this->fragment = true;
                     $this->css_output = $args[$i + 1];
                     $args->splice($i, 2);
                     break;
                 } else {
                     if ($tag === "--fragment") {
                         $more = true;
                         $this->fragment = true;
                         $args->splice($i, 1);
                         break;
                     } else {
                         if ($tag === "--plain") {
                             $more = true;
                             $this->pretty = false;
                             $args->splice($i, 1);
                             break;
                         } else {
                             if ($tag === "--all") {
                                 $more = true;
                                 $this->flags->show_unchanged = true;
                                 $this->flags->show_unchanged_columns = true;
                                 $args->splice($i, 1);
                                 break;
                             } else {
                                 if ($tag === "--all-rows") {
                                     $more = true;
                                     $this->flags->show_unchanged = true;
                                     $args->splice($i, 1);
                                     break;
                                 } else {
                                     if ($tag === "--all-columns") {
                                         $more = true;
                                         $this->flags->show_unchanged_columns = true;
                                         $args->splice($i, 1);
                                         break;
                                     } else {
                                         if ($tag === "--act") {
                                             $more = true;
                                             if ($this->flags->acts === null) {
                                                 $this->flags->acts = new haxe_ds_StringMap();
                                             }
                                             $this->flags->acts->set($args[$i + 1], true);
                                             true;
                                             $args->splice($i, 2);
                                             break;
                                         } else {
                                             if ($tag === "--context") {
                                                 $more = true;
                                                 $context = Std::parseInt($args[$i + 1]);
                                                 if ($context >= 0) {
                                                     $this->flags->unchanged_context = $context;
                                                 }
                                                 $args->splice($i, 2);
                                                 break;
                                                 unset($context);
                                             } else {
                                                 if ($tag === "--inplace") {
                                                     $more = true;
                                                     $inplace = true;
                                                     $args->splice($i, 1);
                                                     break;
                                                 } else {
                                                     if ($tag === "--git") {
                                                         $more = true;
                                                         $git = true;
                                                         $args->splice($i, 1);
                                                         break;
                                                     } else {
                                                         if ($tag === "--unordered") {
                                                             $more = true;
                                                             $this->flags->ordered = false;
                                                             $this->flags->unchanged_context = 0;
                                                             $this->order_set = true;
                                                             $args->splice($i, 1);
                                                             break;
                                                         } else {
                                                             if ($tag === "--ordered") {
                                                                 $more = true;
                                                                 $this->flags->ordered = true;
                                                                 $this->order_set = true;
                                                                 $args->splice($i, 1);
                                                                 break;
                                                             } else {
                                                                 if ($tag === "--color") {
                                                                     $more = true;
                                                                     $this->flags->terminal_format = "ansi";
                                                                     $args->splice($i, 1);
                                                                     break;
                                                                 } else {
                                                                     if ($tag === "--no-color") {
                                                                         $more = true;
                                                                         $this->flags->terminal_format = "plain";
                                                                         $args->splice($i, 1);
                                                                         break;
                                                                     } else {
                                                                         if ($tag === "--input-format") {
                                                                             $more = true;
                                                                             $this->setFormat($args[$i + 1]);
                                                                             $args->splice($i, 2);
                                                                             break;
                                                                         } else {
                                                                             if ($tag === "--output-format") {
                                                                                 $more = true;
                                                                                 $this->output_format = $args[$i + 1];
                                                                                 $this->output_format_set = true;
                                                                                 $args->splice($i, 2);
                                                                                 break;
                                                                             } else {
                                                                                 if ($tag === "--id") {
                                                                                     $more = true;
                                                                                     if ($this->flags->ids === null) {
                                                                                         $this->flags->ids = new _hx_array(array());
                                                                                     }
                                                                                     $this->flags->ids->push($args[$i + 1]);
                                                                                     $args->splice($i, 2);
                                                                                     break;
                                                                                 } else {
                                                                                     if ($tag === "--ignore") {
                                                                                         $more = true;
                                                                                         $this->flags->ignoreColumn($args[$i + 1]);
                                                                                         $args->splice($i, 2);
                                                                                         break;
                                                                                     } else {
                                                                                         if ($tag === "--index") {
                                                                                             $more = true;
                                                                                             $this->flags->always_show_order = true;
                                                                                             $this->flags->never_show_order = false;
                                                                                             $args->splice($i, 1);
                                                                                             break;
                                                                                         } else {
                                                                                             if ($tag === "--www") {
                                                                                                 $more = true;
                                                                                                 $this->output_format = "www";
                                                                                                 $this->output_format_set = true;
                                                                                                 $args->splice($i, 1);
                                                                                             } else {
                                                                                                 if ($tag === "--table") {
                                                                                                     $more = true;
                                                                                                     $this->flags->addTable($args[$i + 1]);
                                                                                                     $args->splice($i, 2);
                                                                                                     break;
                                                                                                 } else {
                                                                                                     if ($tag === "-w" || $tag === "--ignore-whitespace") {
                                                                                                         $more = true;
                                                                                                         $this->flags->ignore_whitespace = true;
                                                                                                         $args->splice($i, 1);
                                                                                                         break;
                                                                                                     } else {
                                                                                                         if ($tag === "-i" || $tag === "--ignore-case") {
                                                                                                             $more = true;
                                                                                                             $this->flags->ignore_case = true;
                                                                                                             $args->splice($i, 1);
                                                                                                             break;
                                                                                                         } else {
                                                                                                             if ($tag === "--padding") {
                                                                                                                 $more = true;
                                                                                                                 $this->flags->padding_strategy = $args[$i + 1];
                                                                                                                 $args->splice($i, 2);
                                                                                                                 break;
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             unset($tag, $i);
         }
         unset($_g1, $_g);
     }
     $cmd = $args[0];
     if ($args->length < 2) {
         if ($cmd === "version") {
             $io->writeStdout(_hx_string_or_null(coopy_Coopy::$VERSION) . "\n");
             return 0;
         }
         if ($cmd === "git") {
             $io->writeStdout("You can use daff to improve git's handling of csv files, by using it as a\ndiff driver (for showing what has changed) and as a merge driver (for merging\nchanges between multiple versions).\n");
             $io->writeStdout("\n");
             $io->writeStdout("Automatic setup\n");
             $io->writeStdout("---------------\n\n");
             $io->writeStdout("Run:\n");
             $io->writeStdout("  daff git csv\n");
             $io->writeStdout("\n");
             $io->writeStdout("Manual setup\n");
             $io->writeStdout("------------\n\n");
             $io->writeStdout("Create and add a file called .gitattributes in the root directory of your\nrepository, containing:\n\n");
             $io->writeStdout("  *.csv diff=daff-csv\n");
             $io->writeStdout("  *.csv merge=daff-csv\n");
             $io->writeStdout("\nCreate a file called .gitconfig in your home directory (or alternatively\nopen .git/config for a particular repository) and add:\n\n");
             $io->writeStdout("  [diff \"daff-csv\"]\n");
             $io->writeStdout("  command = daff diff --git\n");
             $io->writeStderr("\n");
             $io->writeStdout("  [merge \"daff-csv\"]\n");
             $io->writeStdout("  name = daff tabular merge\n");
             $io->writeStdout("  driver = daff merge --output %A %O %A %B\n\n");
             $io->writeStderr("Make sure you can run daff from the command-line as just \"daff\" - if not,\nreplace \"daff\" in the driver and command lines above with the correct way\nto call it. Add --no-color if your terminal does not support ANSI colors.");
             $io->writeStderr("\n");
             return 0;
         }
         $io->writeStderr("daff can produce and apply tabular diffs.\n");
         $io->writeStderr("Call as:\n");
         $io->writeStderr("  daff [--color] [--no-color] [--output OUTPUT.csv] a.csv b.csv\n");
         $io->writeStderr("  daff [--output OUTPUT.html] a.csv b.csv\n");
         $io->writeStderr("  daff [--output OUTPUT.csv] parent.csv a.csv b.csv\n");
         $io->writeStderr("  daff [--output OUTPUT.ndjson] a.ndjson b.ndjson\n");
         $io->writeStderr("  daff [--www] a.csv b.csv\n");
         $io->writeStderr("  daff patch [--inplace] [--output OUTPUT.csv] a.csv patch.csv\n");
         $io->writeStderr("  daff merge [--inplace] [--output OUTPUT.csv] parent.csv a.csv b.csv\n");
         $io->writeStderr("  daff trim [--output OUTPUT.csv] source.csv\n");
         $io->writeStderr("  daff render [--output OUTPUT.html] diff.csv\n");
         $io->writeStderr("  daff copy in.csv out.tsv\n");
         $io->writeStderr("  daff git\n");
         $io->writeStderr("  daff version\n");
         $io->writeStderr("\n");
         $io->writeStderr("The --inplace option to patch and merge will result in modification of a.csv.\n");
         $io->writeStderr("\n");
         $io->writeStderr("If you need more control, here is the full list of flags:\n");
         $io->writeStderr("  daff diff [--output OUTPUT.csv] [--context NUM] [--all] [--act ACT] a.csv b.csv\n");
         $io->writeStderr("     --act ACT:     show only a certain kind of change (update, insert, delete)\n");
         $io->writeStderr("     --all:         do not prune unchanged rows or columns\n");
         $io->writeStderr("     --all-rows:    do not prune unchanged rows\n");
         $io->writeStderr("     --all-columns: do not prune unchanged columns\n");
         $io->writeStderr("     --color:       highlight changes with terminal colors (default in terminals)\n");
         $io->writeStderr("     --context NUM: show NUM rows of context\n");
         $io->writeStderr("     --id:          specify column to use as primary key (repeat for multi-column key)\n");
         $io->writeStderr("     --ignore:      specify column to ignore completely (can repeat)\n");
         $io->writeStderr("     --index:       include row/columns numbers from original tables\n");
         $io->writeStderr("     --input-format [csv|tsv|ssv|json]: set format to expect for input\n");
         $io->writeStderr("     --no-color:    make sure terminal colors are not used\n");
         $io->writeStderr("     --ordered:     assume row order is meaningful (default for CSV)\n");
         $io->writeStderr("     --output-format [csv|tsv|ssv|json|copy|html]: set format for output\n");
         $io->writeStderr("     --padding [dense|sparse|smart]: set padding method for aligning columns\n");
         $io->writeStderr("     --table NAME:  compare the named table, used with SQL sources\n");
         $io->writeStderr("     --unordered:   assume row order is meaningless (default for json formats)\n");
         $io->writeStderr("     -w / --ignore-whitespace: ignore changes in leading/trailing whitespace\n");
         $io->writeStderr("     -i / --ignore-case: ignore differences in case\n");
         $io->writeStderr("\n");
         $io->writeStderr("  daff render [--output OUTPUT.html] [--css CSS.css] [--fragment] [--plain] diff.csv\n");
         $io->writeStderr("     --css CSS.css: generate a suitable css file to go with the html\n");
         $io->writeStderr("     --fragment:    generate just a html fragment rather than a page\n");
         $io->writeStderr("     --plain:       do not use fancy utf8 characters to make arrows prettier\n");
         $io->writeStderr("     --www:         send output to a browser\n");
         return 1;
     }
     $cmd1 = $args[0];
     $offset = 1;
     if (!Lambda::has(new _hx_array(array("diff", "patch", "merge", "trim", "render", "git", "version", "copy")), $cmd1)) {
         if (_hx_index_of($cmd1, ".", null) !== -1 || _hx_index_of($cmd1, "--", null) === 0) {
             $cmd1 = "diff";
             $offset = 0;
         }
     }
     if ($cmd1 === "git") {
         $types = $args->splice($offset, $args->length - $offset);
         return $this->installGitDriver($io, $types);
     }
     if ($git) {
         $ct = $args->length - $offset;
         if ($ct !== 7 && $ct !== 9) {
             $io->writeStderr("Expected 7 or 9 parameters from git, but got " . _hx_string_rec($ct, "") . "\n");
             return 1;
         }
         $git_args = $args->splice($offset, $ct);
         $args->splice(0, $args->length);
         $offset = 0;
         $old_display_path = $git_args[0];
         $new_display_path = $git_args[0];
         $old_file = $git_args[1];
         $new_file = $git_args[4];
         if ($ct === 9) {
             $io->writeStdout($git_args[8]);
             $new_display_path = $git_args[7];
         }
         $io->writeStdout("--- a/" . _hx_string_or_null($old_display_path) . "\n");
         $io->writeStdout("+++ b/" . _hx_string_or_null($new_display_path) . "\n");
         $args->push($old_file);
         $args->push($new_file);
     }
     $parent = null;
     if ($args->length - $offset >= 3) {
         $parent = $this->loadTable($args[$offset]);
         $offset++;
     }
     $aname = $args[$offset];
     $a = $this->loadTable($aname);
     $b = null;
     if ($args->length - $offset >= 2) {
         if ($cmd1 !== "copy") {
             $b = $this->loadTable($args[1 + $offset]);
         } else {
             $output = $args[1 + $offset];
         }
     }
     $this->flags->diff_strategy = $this->strategy;
     if ($inplace) {
         if ($output !== null) {
             $io->writeStderr("Please do not use --inplace when specifying an output.\n");
         }
         $output = $aname;
         return 1;
     }
     if ($output === null) {
         $output = "-";
     }
     $ok = true;
     if ($cmd1 === "diff") {
         if (!$this->order_set) {
             $this->flags->ordered = $this->order_preference;
             if (!$this->flags->ordered) {
                 $this->flags->unchanged_context = 0;
             }
         }
         $this->flags->allow_nested_cells = $this->nested_output;
         $this->runDiff($parent, $a, $b, $this->flags, $output);
     } else {
         if ($cmd1 === "patch") {
             $patcher = new coopy_HighlightPatch($a, $b, null);
             $patcher->apply();
             $this->saveTable($output, $a, null);
         } else {
             if ($cmd1 === "merge") {
                 $merger = new coopy_Merger($parent, $a, $b, $this->flags);
                 $conflicts = $merger->apply();
                 $ok = $conflicts === 0;
                 if ($conflicts > 0) {
                     $io->writeStderr(_hx_string_rec($conflicts, "") . " conflict" . _hx_string_or_null($conflicts > 1 ? "s" : "") . "\n");
                 }
                 $this->saveTable($output, $a, null);
             } else {
                 if ($cmd1 === "trim") {
                     $this->saveTable($output, $a, null);
                 } else {
                     if ($cmd1 === "render") {
                         $this->renderTable($output, $a);
                     } else {
                         if ($cmd1 === "copy") {
                             $this->saveTable($output, $a, null);
                         }
                     }
                 }
             }
         }
     }
     if ($ok) {
         return 0;
     } else {
         return 1;
     }
 }
 static function hasRtti($c)
 {
     return Lambda::has(Type::getClassFields($c), "__rtti");
 }
function ufront_view_UFViewEngine_2(&$_g, &$ext, &$finalPath, &$path, &$templatingEngine, &$testNextEngine, &$testNextEngine1, &$tplEngines, &$tplStrReady)
{
    if ($tplEngines->length > 0) {
        $engine = $tplEngines->shift();
        if (Lambda::has($engine->extensions, $ext)) {
            $finalPath = $path;
            $this3 = $_g->getTemplateString($finalPath);
            $this3(array(new _hx_lambda(array(&$_g, &$engine, &$ext, &$finalPath, &$path, &$templatingEngine, &$testNextEngine, &$testNextEngine1, &$this3, &$tplEngines, &$tplStrReady), "ufront_view_UFViewEngine_6"), 'execute'));
        } else {
            call_user_func($testNextEngine1);
        }
    } else {
        $result12 = tink_core_Outcome::Failure(new tink_core_TypedError(null, "No templating engine found for " . _hx_string_or_null($path) . " (None support extension " . _hx_string_or_null($ext) . ")", _hx_anonymous(array("fileName" => "UFViewEngine.hx", "lineNumber" => 134, "className" => "ufront.view.UFViewEngine", "methodName" => "getTemplate"))));
        if ($tplStrReady->{"list"} === null) {
            false;
        } else {
            $list9 = $tplStrReady->{"list"};
            $tplStrReady->{"list"} = null;
            $tplStrReady->result = $result12;
            tink_core__Callback_CallbackList_Impl_::invoke($list9, $result12);
            tink_core__Callback_CallbackList_Impl_::clear($list9);
            true;
        }
    }
}