public function make_column($name, $errors) { foreach (self::$registered as $col) { if (strcasecmp($col->formula->name, $name) == 0) { return $col; } } if (substr($name, 0, 4) === "edit") { return null; } $formula = new Formula($name); if (!$formula->check()) { if ($errors && strpos($name, "(") !== false) { self::make_column_error($errors, $formula->error_html(), 1); } return null; } $fdef = new FormulaPaperColumn("formulax" . (count(self::$registered) + 1), $formula); self::register($fdef); return $fdef; }
private function _search_formula($word, &$qt, $quoted) { if (preg_match('/\\A[^(){}\\[\\]]+\\z/', $word) && !$quoted && ($result = Dbl::qe("select * from Formula where name=?", $word)) && ($row = $result->fetch_object())) { $formula = new Formula($row); Dbl::free($result); } else { $formula = new Formula($word); } if ($formula->check()) { $qt[] = new SearchTerm("formula", self::F_XVIEW, $formula); } else { $this->warn($formula->error_html()); $qt[] = new SearchTerm("f"); } }