#include "frontends/Alert.h"
#include "support/lyxalgo.h" // for lyx::count
-#include "support/tostr.h"
+#include "support/convert.h"
#include "support/translator.h"
#include <boost/array.hpp>
namespace {
// Paragraph separation
-typedef Translator<std::string, BufferParams::PARSEP> ParSepTranslator;
+typedef Translator<string, BufferParams::PARSEP> ParSepTranslator;
-ParSepTranslator const init_parseptranslator() {
+ParSepTranslator const init_parseptranslator()
+{
ParSepTranslator translator(string_paragraph_separation[0], BufferParams::PARSEP_INDENT);
translator.addPair(string_paragraph_separation[1], BufferParams::PARSEP_SKIP);
return translator;
}
-ParSepTranslator const & parseptranslator() {
+ParSepTranslator const & parseptranslator()
+{
static ParSepTranslator translator = init_parseptranslator();
return translator;
}
+
// Quotes language
-typedef Translator<std::string, InsetQuotes::quote_language> QuotesLangTranslator;
+typedef Translator<string, InsetQuotes::quote_language> QuotesLangTranslator;
-QuotesLangTranslator const init_quoteslangtranslator() {
+QuotesLangTranslator const init_quoteslangtranslator()
+{
QuotesLangTranslator translator(string_quotes_language[0], InsetQuotes::EnglishQ);
translator.addPair(string_quotes_language[1], InsetQuotes::SwedishQ);
translator.addPair(string_quotes_language[2], InsetQuotes::GermanQ);
}
-QuotesLangTranslator const & quoteslangtranslator() {
+QuotesLangTranslator const & quoteslangtranslator()
+{
static QuotesLangTranslator translator = init_quoteslangtranslator();
return translator;
}
-// Quote times
-typedef Translator<int, InsetQuotes::quote_times> QuotesTimesTranslator;
-
-
-QuotesTimesTranslator const init_quotestimestranslator() {
- QuotesTimesTranslator translator(1, InsetQuotes::SingleQ);
- translator.addPair(2, InsetQuotes::DoubleQ);
- return translator;
-}
-
-
-QuotesTimesTranslator const & quotestimestranslator() {
- static QuotesTimesTranslator translator = init_quotestimestranslator();
- return translator;
-}
// Paper size
-typedef Translator<std::string, VMARGIN_PAPER_TYPE> PaperSizeTranslator;
-
-
-PaperSizeTranslator const init_papersizetranslator() {
- PaperSizeTranslator translator(string_papersize[0], VM_PAPER_DEFAULT);
- translator.addPair(string_papersize[1], VM_PAPER_CUSTOM);
- translator.addPair(string_papersize[2], VM_PAPER_USLETTER);
- translator.addPair(string_papersize[3], VM_PAPER_USLEGAL);
- translator.addPair(string_papersize[4], VM_PAPER_USEXECUTIVE);
- translator.addPair(string_papersize[5], VM_PAPER_A3);
- translator.addPair(string_papersize[6], VM_PAPER_A4);
- translator.addPair(string_papersize[7], VM_PAPER_A5);
- translator.addPair(string_papersize[8], VM_PAPER_B3);
- translator.addPair(string_papersize[9], VM_PAPER_B4);
- translator.addPair(string_papersize[10], VM_PAPER_B5);
- return translator;
-}
-
-
-PaperSizeTranslator const & papersizetranslator() {
- static PaperSizeTranslator translator = init_papersizetranslator();
- return translator;
-}
+typedef Translator<std::string, PAPER_SIZE> PaperSizeTranslator;
-// Paper packages
-typedef Translator<std::string, PAPER_PACKAGES> PaperPackagesTranslator;
-
-PaperPackagesTranslator const init_paperpackagestranslator() {
- PaperPackagesTranslator translator(string_paperpackages[0], PACKAGE_NONE);
- translator.addPair(string_paperpackages[1], PACKAGE_A4);
- translator.addPair(string_paperpackages[2], PACKAGE_A4WIDE);
- translator.addPair(string_paperpackages[3], PACKAGE_WIDEMARGINSA4);
+PaperSizeTranslator const init_papersizetranslator()
+{
+ PaperSizeTranslator translator(string_papersize[0], PAPER_DEFAULT);
+ translator.addPair(string_papersize[1], PAPER_CUSTOM);
+ translator.addPair(string_papersize[2], PAPER_USLETTER);
+ translator.addPair(string_papersize[3], PAPER_USLEGAL);
+ translator.addPair(string_papersize[4], PAPER_USEXECUTIVE);
+ translator.addPair(string_papersize[5], PAPER_A3);
+ translator.addPair(string_papersize[6], PAPER_A4);
+ translator.addPair(string_papersize[7], PAPER_A5);
+ translator.addPair(string_papersize[8], PAPER_B3);
+ translator.addPair(string_papersize[9], PAPER_B4);
+ translator.addPair(string_papersize[10], PAPER_B5);
return translator;
}
-PaperPackagesTranslator const & paperpackagestranslator() {
- static PaperPackagesTranslator translator = init_paperpackagestranslator();
+PaperSizeTranslator const & papersizetranslator()
+{
+ static PaperSizeTranslator translator = init_papersizetranslator();
return translator;
}
// Paper orientation
-typedef Translator<std::string, PAPER_ORIENTATION> PaperOrientationTranslator;
+typedef Translator<string, PAPER_ORIENTATION> PaperOrientationTranslator;
-PaperOrientationTranslator const init_paperorientationtranslator() {
+PaperOrientationTranslator const init_paperorientationtranslator()
+{
PaperOrientationTranslator translator(string_orientation[0], ORIENTATION_PORTRAIT);
translator.addPair(string_orientation[1], ORIENTATION_LANDSCAPE);
return translator;
}
-PaperOrientationTranslator const & paperorientationtranslator() {
+PaperOrientationTranslator const & paperorientationtranslator()
+{
static PaperOrientationTranslator translator = init_paperorientationtranslator();
return translator;
}
typedef Translator<int, LyXTextClass::PageSides> SidesTranslator;
-SidesTranslator const init_sidestranslator() {
+SidesTranslator const init_sidestranslator()
+{
SidesTranslator translator(1, LyXTextClass::OneSide);
translator.addPair(2, LyXTextClass::TwoSides);
return translator;
}
-SidesTranslator const & sidestranslator() {
+SidesTranslator const & sidestranslator()
+{
static SidesTranslator translator = init_sidestranslator();
return translator;
}
typedef Translator<int, BufferParams::AMS> AMSTranslator;
-AMSTranslator const init_amstranslator() {
+AMSTranslator const init_amstranslator()
+{
AMSTranslator translator(0, BufferParams::AMS_OFF);
translator.addPair(1, BufferParams::AMS_AUTO);
translator.addPair(2, BufferParams::AMS_ON);
}
-AMSTranslator const & amstranslator() {
+AMSTranslator const & amstranslator()
+{
static AMSTranslator translator = init_amstranslator();
return translator;
}
-
// Cite engine
typedef Translator<string, biblio::CiteEngine> CiteEngineTranslator;
-CiteEngineTranslator const init_citeenginetranslator() {
+CiteEngineTranslator const init_citeenginetranslator()
+{
CiteEngineTranslator translator("basic", biblio::ENGINE_BASIC);
translator.addPair("natbib_numerical", biblio::ENGINE_NATBIB_NUMERICAL);
translator.addPair("natbib_authoryear", biblio::ENGINE_NATBIB_AUTHORYEAR);
}
-CiteEngineTranslator const & citeenginetranslator() {
+CiteEngineTranslator const & citeenginetranslator()
+{
static CiteEngineTranslator translator = init_citeenginetranslator();
return translator;
}
typedef Translator<string, Spacing::Space> SpaceTranslator;
-SpaceTranslator const init_spacetranslator() {
+SpaceTranslator const init_spacetranslator()
+{
SpaceTranslator translator("default", Spacing::Default);
translator.addPair("single", Spacing::Single);
translator.addPair("onehalf", Spacing::Onehalf);
translator.addPair("double", Spacing::Double);
+ translator.addPair("other", Spacing::Other);
return translator;
}
-SpaceTranslator const & spacetranslator() {
+SpaceTranslator const & spacetranslator()
+{
static SpaceTranslator translator = init_spacetranslator();
return translator;
}
}
-struct BufferParams::Impl
+class BufferParams::Impl
{
+public:
Impl();
AuthorList authorlist;
BufferParams::Impl *
BufferParams::MemoryTraits::clone(BufferParams::Impl const * ptr)
{
+ BOOST_ASSERT(ptr);
+
return new BufferParams::Impl(*ptr);
}
// true in the returned pair, then `second' is the textclass
// number; if it is false, second is 0. In both cases, second
// is what we want.
- textclass(textclasslist.NumberOfClass("article").second),
+ textclass(textclasslist.numberOfClass("article").second),
pimpl_(new Impl)
{
paragraph_separation = PARSEP_INDENT;
quotes_language = InsetQuotes::EnglishQ;
- quotes_times = InsetQuotes::DoubleQ;
fontsize = "default";
/* PaperLayout */
papersize = PAPER_DEFAULT;
- papersize2 = VM_PAPER_DEFAULT; /* DEFAULT */
- paperpackage = PACKAGE_NONE;
orientation = ORIENTATION_PORTRAIT;
use_geometry = false;
use_amsmath = AMS_AUTO;
cite_engine = biblio::ENGINE_BASIC;
use_bibtopic = false;
tracking_changes = false;
+ output_changes = false;
secnumdepth = 3;
tocdepth = 3;
language = default_language;
}
-Bullet & BufferParams::temp_bullet(lyx::size_type index)
+Bullet & BufferParams::temp_bullet(lyx::size_type const index)
{
BOOST_ASSERT(index < 4);
return pimpl_->temp_bullets[index];
}
-Bullet const & BufferParams::temp_bullet(lyx::size_type index) const
+Bullet const & BufferParams::temp_bullet(lyx::size_type const index) const
{
BOOST_ASSERT(index < 4);
return pimpl_->temp_bullets[index];
}
-Bullet & BufferParams::user_defined_bullet(lyx::size_type index)
+Bullet & BufferParams::user_defined_bullet(lyx::size_type const index)
{
BOOST_ASSERT(index < 4);
return pimpl_->user_defined_bullets[index];
}
-Bullet const & BufferParams::user_defined_bullet(lyx::size_type index) const
+Bullet const & BufferParams::user_defined_bullet(lyx::size_type const index) const
{
BOOST_ASSERT(index < 4);
return pimpl_->user_defined_bullets[index];
lex.next();
string const classname = lex.getString();
pair<bool, lyx::textclass_type> pp =
- textclasslist.NumberOfClass(classname);
+ textclasslist.numberOfClass(classname);
if (pp.first) {
textclass = pp.second;
} else {
- textclass = 0;
- return classname;
+ // if text class does not exist, try to load it from filepath
+ pp = textclasslist.addTextClass(classname, filepath);
+ if (pp.first) {
+ textclass = pp.second;
+ } else {
+ textclass = 0;
+ return classname;
+ }
}
+ // FIXME: isTeXClassAvailable will try to load the layout file, but will
+ // fail because of the lack of path info. Warnings will be given although
+ // the layout file will be correctly loaded later.
if (!getLyXTextClass().isTeXClassAvailable()) {
- string msg = bformat(_("The document uses a missing "
+ string const msg =
+ bformat(_("The document uses a missing "
"TeX class \"%1$s\".\n"), classname);
Alert::warning(_("Document class not available"),
- msg + _("LyX will not be able to produce output."));
+ msg + _("LyX will not be able to produce output."));
}
} else if (token == "\\begin_preamble") {
readPreamble(lex);
string quotes_lang;
lex >> quotes_lang;
quotes_language = quoteslangtranslator().find(quotes_lang);
- } else if (token == "\\quotes_times") {
- int qtimes;
- lex >> qtimes;
- quotes_times = quotestimestranslator().find(qtimes);
} else if (token == "\\papersize") {
string ppsize;
lex >> ppsize;
- papersize2 = papersizetranslator().find(ppsize);
- } else if (token == "\\paperpackage") {
- string ppackage;
- lex >> ppackage;
- paperpackage = paperpackagestranslator().find(ppackage);
+ papersize = papersizetranslator().find(ppsize);
} else if (token == "\\use_geometry") {
lex >> use_geometry;
} else if (token == "\\use_amsmath") {
lex >> use_bibtopic;
} else if (token == "\\tracking_changes") {
lex >> tracking_changes;
+ } else if (token == "\\output_changes") {
+ lex >> output_changes;
} else if (token == "\\branch") {
lex.next();
string branch = lex.getString();
} else if (token == "\\spacing") {
string nspacing;
lex >> nspacing;
- float tmp_val = 0.0;
+ string tmp_val;
if (nspacing == "other") {
lex >> tmp_val;
}
<< "\n\\end_preamble\n";
}
- /* the options */
+ // the options
if (!options.empty()) {
os << "\\options " << options << '\n';
}
- /* then the text parameters */
+ // then the text parameters
if (language != ignore_language)
os << "\\language " << language->lang() << '\n';
os << "\\inputencoding " << inputenc
spacing().writeFile(os);
- os << "\\papersize " << string_papersize[papersize2]
- << "\n\\paperpackage " << string_paperpackages[paperpackage]
- << "\n\\use_geometry " << tostr(use_geometry)
+ os << "\\papersize " << string_papersize[papersize]
+ << "\n\\use_geometry " << convert<string>(use_geometry)
<< "\n\\use_amsmath " << use_amsmath
<< "\n\\cite_engine " << citeenginetranslator().find(cite_engine)
- << "\n\\use_bibtopic " << tostr(use_bibtopic)
+ << "\n\\use_bibtopic " << convert<string>(use_bibtopic)
<< "\n\\paperorientation " << string_orientation[orientation]
<< '\n';
- std::list<Branch>::const_iterator it = branchlist().begin();
- std::list<Branch>::const_iterator end = branchlist().end();
+ BranchList::const_iterator it = branchlist().begin();
+ BranchList::const_iterator end = branchlist().end();
for (; it != end; ++it) {
os << "\\branch " << it->getBranch()
<< "\n\\selected " << it->getSelected()
- << "\n\\color " << it->getColor()
+ << "\n\\color " << lyx::X11hexname(it->getColor())
<< "\n\\end_branch"
<< "\n";
}
<< string_paragraph_separation[paragraph_separation]
<< "\n\\defskip " << getDefSkip().asLyXCommand()
<< "\n\\quotes_language "
- << string_quotes_language[quotes_language] << '\n'
- << "\\quotes_times "
- << quotestimestranslator().find(quotes_times)
+ << string_quotes_language[quotes_language]
<< "\n\\papercolumns " << columns
<< "\n\\papersides " << sides
<< "\n\\paperpagestyle " << pagestyle << '\n';
}
}
- os << "\\tracking_changes " << tostr(tracking_changes) << "\n";
+ os << "\\tracking_changes " << convert<string>(tracking_changes) << "\n";
+ os << "\\output_changes " << convert<string>(output_changes) << "\n";
if (tracking_changes) {
AuthorList::Authors::const_iterator it = pimpl_->authorlist.begin();
clsoptions << fontsize << "pt,";
}
+ // custom, A3, B3 and B4 paper sizes need geometry
+ bool nonstandard_papersize = (papersize == PAPER_B3) ||
+ (papersize == PAPER_B4) ||
+ (papersize == PAPER_A3) ||
+ (papersize == PAPER_CUSTOM);
- if (!use_geometry &&
- (paperpackage == PACKAGE_NONE)) {
+ if (!use_geometry) {
switch (papersize) {
- case PAPER_A3PAPER:
- clsoptions << "a3paper,";
- break;
- case PAPER_A4PAPER:
+ case PAPER_A4:
clsoptions << "a4paper,";
break;
case PAPER_USLETTER:
clsoptions << "letterpaper,";
break;
- case PAPER_A5PAPER:
+ case PAPER_A5:
clsoptions << "a5paper,";
break;
- case PAPER_B5PAPER:
+ case PAPER_B5:
clsoptions << "b5paper,";
break;
- case PAPER_EXECUTIVEPAPER:
+ case PAPER_USEXECUTIVE:
clsoptions << "executivepaper,";
break;
- case PAPER_LEGALPAPER:
+ case PAPER_USLEGAL:
clsoptions << "legalpaper,";
break;
case PAPER_DEFAULT:
+ case PAPER_A3:
+ case PAPER_B3:
+ case PAPER_B4:
+ case PAPER_CUSTOM:
break;
}
}
if (inputenc == "auto") {
string const doc_encoding =
- language->encoding()->LatexName();
+ language->encoding()->latexName();
// Create a list with all the input encodings used
// in the document
texrow.newline();
}
- // At the very beginning the text parameters.
- if (paperpackage != PACKAGE_NONE) {
- switch (paperpackage) {
- case PACKAGE_NONE:
- break;
- case PACKAGE_A4:
- os << "\\usepackage{a4}\n";
- texrow.newline();
- break;
- case PACKAGE_A4WIDE:
- os << "\\usepackage{a4wide}\n";
- texrow.newline();
- break;
- case PACKAGE_WIDEMARGINSA4:
- os << "\\usepackage[widemargins]{a4}\n";
- texrow.newline();
- break;
- }
- }
- if (use_geometry) {
+ if (use_geometry || nonstandard_papersize) {
os << "\\usepackage{geometry}\n";
texrow.newline();
os << "\\geometry{verbose";
if (orientation == ORIENTATION_LANDSCAPE)
os << ",landscape";
- switch (papersize2) {
- case VM_PAPER_CUSTOM:
+ switch (papersize) {
+ case PAPER_CUSTOM:
if (!paperwidth.empty())
os << ",paperwidth="
<< paperwidth;
os << ",paperheight="
<< paperheight;
break;
- case VM_PAPER_USLETTER:
+ case PAPER_USLETTER:
os << ",letterpaper";
break;
- case VM_PAPER_USLEGAL:
+ case PAPER_USLEGAL:
os << ",legalpaper";
break;
- case VM_PAPER_USEXECUTIVE:
+ case PAPER_USEXECUTIVE:
os << ",executivepaper";
break;
- case VM_PAPER_A3:
+ case PAPER_A3:
os << ",a3paper";
break;
- case VM_PAPER_A4:
+ case PAPER_A4:
os << ",a4paper";
break;
- case VM_PAPER_A5:
+ case PAPER_A5:
os << ",a5paper";
break;
- case VM_PAPER_B3:
+ case PAPER_B3:
os << ",b3paper";
break;
- case VM_PAPER_B4:
+ case PAPER_B4:
os << ",b4paper";
break;
- case VM_PAPER_B5:
+ case PAPER_B5:
os << ",b5paper";
break;
default:
- // default papersize ie VM_PAPER_DEFAULT
+ // default papersize ie PAPER_DEFAULT
switch (lyxrc.default_papersize) {
case PAPER_DEFAULT: // keep compiler happy
case PAPER_USLETTER:
os << ",letterpaper";
break;
- case PAPER_LEGALPAPER:
+ case PAPER_USLEGAL:
os << ",legalpaper";
break;
- case PAPER_EXECUTIVEPAPER:
+ case PAPER_USEXECUTIVE:
os << ",executivepaper";
break;
- case PAPER_A3PAPER:
+ case PAPER_A3:
os << ",a3paper";
break;
- case PAPER_A4PAPER:
+ case PAPER_A4:
os << ",a4paper";
break;
- case PAPER_A5PAPER:
+ case PAPER_A5:
os << ",a5paper";
break;
- case PAPER_B5PAPER:
+ case PAPER_B5:
os << ",b5paper";
break;
+ case PAPER_B3:
+ case PAPER_B4:
+ case PAPER_CUSTOM:
+ break;
}
}
if (!topmargin.empty())
texrow.newline();
}
- if (secnumdepth != tclass.secnumdepth()) {
- os << "\\setcounter{secnumdepth}{"
- << secnumdepth
- << "}\n";
- texrow.newline();
- }
- if (tocdepth != tclass.tocdepth()) {
- os << "\\setcounter{tocdepth}{"
- << tocdepth
- << "}\n";
- texrow.newline();
+ // Only if class has a ToC hierarchy
+ if (tclass.hasTocLevels()) {
+ if (secnumdepth != tclass.secnumdepth()) {
+ os << "\\setcounter{secnumdepth}{"
+ << secnumdepth
+ << "}\n";
+ texrow.newline();
+ }
+ if (tocdepth != tclass.tocdepth()) {
+ os << "\\setcounter{tocdepth}{"
+ << tocdepth
+ << "}\n";
+ texrow.newline();
+ }
}
if (paragraph_separation) {
if (user_defined_bullet(i) != ITEMIZE_DEFAULTS[i]) {
if (bullets_def.empty())
bullets_def="\\AtBeginDocument{\n";
- bullets_def += " \\renewcommand{\\labelitemi";
+ bullets_def += " \\def\\labelitemi";
switch (i) {
// `i' is one less than the item to modify
case 0:
bullets_def += 'v';
break;
}
- bullets_def += "}{" +
+ bullets_def += '{' +
user_defined_bullet(i).getText()
+ "}\n";
}
lyxpreamble += "\\makeatother\n";
// dvipost settings come after everything else
- if (tracking_changes) {
+ if (features.isAvailable("dvipost") && tracking_changes && output_changes) {
lyxpreamble +=
"\\dvipostlayout\n"
"\\dvipost{osstart color push Red}\n"
return use_babel;
}
-void BufferParams::setPaperStuff()
-{
- papersize = PAPER_DEFAULT;
- char const c1 = paperpackage;
- if (c1 == PACKAGE_NONE) {
- char const c2 = papersize2;
- if (c2 == VM_PAPER_USLETTER)
- papersize = PAPER_USLETTER;
- else if (c2 == VM_PAPER_USLEGAL)
- papersize = PAPER_LEGALPAPER;
- else if (c2 == VM_PAPER_USEXECUTIVE)
- papersize = PAPER_EXECUTIVEPAPER;
- else if (c2 == VM_PAPER_A3)
- papersize = PAPER_A3PAPER;
- else if (c2 == VM_PAPER_A4)
- papersize = PAPER_A4PAPER;
- else if (c2 == VM_PAPER_A5)
- papersize = PAPER_A5PAPER;
- else if ((c2 == VM_PAPER_B3) || (c2 == VM_PAPER_B4) ||
- (c2 == VM_PAPER_B5))
- papersize = PAPER_B5PAPER;
- } else if ((c1 == PACKAGE_A4) || (c1 == PACKAGE_A4WIDE) ||
- (c1 == PACKAGE_WIDEMARGINSA4))
- papersize = PAPER_A4PAPER;
-}
-
void BufferParams::useClassDefaults()
{
columns = tclass.columns();
pagestyle = tclass.pagestyle();
options = tclass.options();
- secnumdepth = tclass.secnumdepth();
- tocdepth = tclass.tocdepth();
+ // Only if class has a ToC hierarchy
+ if (tclass.hasTocLevels()) {
+ secnumdepth = tclass.secnumdepth();
+ tocdepth = tclass.tocdepth();
+ }
}
}
+LyXFont const BufferParams::getFont() const
+{
+ LyXFont f = getLyXTextClass().defaultfont();
+ f.setLanguage(language);
+ return f;
+}
+
+
void BufferParams::readPreamble(LyXLex & lex)
{
if (lex.getString() != "\\begin_preamble")
if (test == tmptok) {
graphicsDriver = tmptok;
break;
- } else if (test == "last_item") {
+ } else if (test == "") {
lex.printError(
"Warning: graphics driver `$$Token' not recognized!\n"
" Setting graphics driver to `default'.\n");
if (!lex.next()) return;
int const index = lex.getInteger();
lex.next(true);
- string temp_str = lex.getString();
+ string const temp_str = lex.getString();
user_defined_bullet(index).setText(temp_str);
temp_bullet(index).setText(temp_str);
real_papersize = lyxrc.default_papersize;
switch (real_papersize) {
- case PAPER_A3PAPER:
+ case PAPER_A3:
return "a3";
- case PAPER_A4PAPER:
+ case PAPER_A4:
return "a4";
- case PAPER_A5PAPER:
+ case PAPER_A5:
return "a5";
- case PAPER_B5PAPER:
+ case PAPER_B5:
return "b5";
- case PAPER_EXECUTIVEPAPER:
+ case PAPER_USEXECUTIVE:
return "foolscap";
- case PAPER_LEGALPAPER:
+ case PAPER_USLEGAL:
return "legal";
case PAPER_USLETTER:
default:
string result;
if (use_geometry
- && papersize2 == VM_PAPER_CUSTOM
+ && papersize == PAPER_CUSTOM
&& !lyxrc.print_paper_dimension_flag.empty()
&& !paperwidth.empty()
&& !paperheight.empty()) {
}
}
if (orientation == ORIENTATION_LANDSCAPE &&
- papersize2 != VM_PAPER_CUSTOM)
+ papersize != PAPER_CUSTOM)
result += ' ' + lyxrc.print_landscape_flag;
return result;
}