示例#1
0
文件: example2.c 项目: 10341074/pacs
/** \brief Check for external keywords.
*/
int CheckKeywords(const char *a_szLine, muParserHandle_t a_hParser)
{
  if (!strcmp(a_szLine, "quit"))
  {
    return -1;
  }
  else if (!strcmp(a_szLine,"list var"))
  {
    ListVar(a_hParser);
    return 1;
  }
  else if (!strcmp(a_szLine, "list exprvar"))
  {
    ListExprVar(a_hParser);
    return 1;
  }
  else if (!strcmp(a_szLine, "list const"))
  {
    ListConst(a_hParser);
    return 1;
  }
  else if (!strcmp(a_szLine, "locale de"))
  {
    printf("Setting german locale: ArgSep=';' DecSep=',' ThousandsSep='.'\n");
    mupSetArgSep(a_hParser, ';');
    mupSetDecSep(a_hParser, ',');
    mupSetThousandsSep(a_hParser, '.');
    return 1;
  }
  else if (!strcmp(a_szLine, "locale en"))
  {
    printf("Setting english locale: ArgSep=',' DecSep='.' ThousandsSep=''\n");
    mupSetArgSep(a_hParser, ',');
    mupSetDecSep(a_hParser, '.');
    mupSetThousandsSep(a_hParser, 0);
    return 1;
  }
  else if (!strcmp(a_szLine, "locale reset"))
  {
    printf("Resetting locale\n");
    mupResetLocale(a_hParser);
    return 1;
  }
  else if (!strcmp(a_szLine, "test bulk"))
  {
    printf("Testing bulk mode\n");
    CalcBulk();
    return 1;
  }

  return 0;
}
示例#2
0
/** \brief Check for external keywords.
*/
int CheckKeywords(const mecChar_t *a_szLine, mecParserHandle_t a_hParser)
{
    if (!mystrcmp(a_szLine, _T("quit")))
    {
        return -1;
    }
    else if (!mystrcmp(a_szLine, _T("list var")))
    {
        ListVar(a_hParser);
        return 1;
    }
    else if (!mystrcmp(a_szLine, _T("list exprvar")))
    {
        ListExprVar(a_hParser);
        return 1;
    }
    else if (!mystrcmp(a_szLine, _T("list const")))
    {
        ListConst(a_hParser);
        return 1;
    }
    else if (!mystrcmp(a_szLine, _T("locale de")))
    {
        myprintf(_T("Setting german locale: ArgSep=';' DecSep=',' ThousandsSep='.'\n"));
        mecSetArgSep(a_hParser, ';');
        mecSetDecSep(a_hParser, ',');
        mecSetThousandsSep(a_hParser, '.');
        return 1;
    }
    else if (!mystrcmp(a_szLine, _T("locale en")))
    {
        myprintf(_T("Setting english locale: ArgSep=',' DecSep='.' ThousandsSep=''\n"));
        mecSetArgSep(a_hParser, ',');
        mecSetDecSep(a_hParser, '.');
        mecSetThousandsSep(a_hParser, 0);
        return 1;
    }
    else if (!mystrcmp(a_szLine, _T("locale reset")))
    {
        myprintf(_T("Resetting locale\n"));
        mecResetLocale(a_hParser);
        return 1;
    }

    return 0;
}
示例#3
0
/** \brief Check for external keywords.
*/
muBool_t CheckKeywords(const char *a_szLine, muParserHandle_t a_hParser)
{
  if (!strcmp(a_szLine, "quit"))
  {
    exit(0);
  }
  else if (!strcmp(a_szLine,"list var"))
  {
    ListVar(a_hParser);
    return 1;
  }
  else if (!strcmp(a_szLine, "list exprvar"))
  {
    ListExprVar(a_hParser);
    return 1;
  }
  else if (!strcmp(a_szLine, "list const"))
  {
    ListConst(a_hParser);
    return 1;
  }

  return 0;
}