예제 #1
0
bool CTemplateParserApp::EvaluateKeywords(SgmlElement *pKeywords)
{
   bool success = true;

   SgmlElement *pKeyword = pKeywords->Find("keyword");

   while (pKeyword && success)
   {
      const char *szName = pKeyword->GetValue("name");
      const char *szEval = pKeyword->GetValue("evaluate");
      const char *szContent = pKeyword->GetParameter();
      
      if (szName)
      {
         bool bEvaluate = false;
         if (szEval)
            bEvaluate = (stricmp("true", szEval) == 0);
         if (!bEvaluate)
         {
            ///AddKeyword(szName, szContent);
            /// replaced by

            CString csContent;
            csContent = szContent;
            // The content may contain keywords
            LTextBuffer ltbContent(csContent);
            ReplaceAllKeywords(ltbContent);
            csContent = ltbContent.GetString();
            AddKeyword(szName, csContent);
         }
         else
         {
            LTextBuffer lText(szContent);
            ReplaceAllKeywords(lText);
            LExpressionParser lExp(lText.GetString());
            int value = 0;
            success = lExp.EvaluateInt(&value);
            if (!success)
            {
               // TPERR_EVAL_ERROR
               // config.xml: Beim Evaluieren des Schlüsselwortes '%s' ist ein Fehler aufgetreten.
               // config.xml: An error occurred while evaluating the keyword '%s'.
               CString csKeyword(szName);
               MakeErrorMessage(TPERR_EVAL_ERROR, csKeyword);
            }
            if (success)
            {
               CString csReplace;
               csReplace.Format(_T("%d"), value);
               AddKeyword(szName, csReplace);
            }
         }
      }
      
      pKeyword = pKeyword->GetNext();
   }

   return success;
}
예제 #2
0
파일: ucl.c 프로젝트: M-ike/work
static int ParseCommandLine(int argc, char *argv[])
{
	int i;

	for (i = 0; i < argc; ++i)
	{
		if (strncmp(argv[i], "-ext:", 5) == 0)
		{
			ExtName = argv[i] + 5;
		}
		else if (strcmp(argv[i], "-ignore") == 0)
		{
			i++;
			AddWhiteSpace(argv[i]);
		}
		else if (strcmp(argv[i], "-keyword") == 0)
		{
			i++;
			AddKeyword(argv[i]);
		}
		else if (strcmp(argv[i], "--dump-ast") == 0)
		{
			DumpAST = 1;
		}
		else if (strcmp(argv[i], "--dump-IR") == 0)
		{
			DumpIR = 1;
		} 
		else
			return i;
	}
	return i;
}
예제 #3
0
DebugLink*
Debug::Find(DebugHead* list, const uni_char* s)
{
	for (StringLink* sl = (StringLink*)list->First(); sl; sl = (StringLink*)sl->Suc())
	{
		if (uni_str_eq(sl->data, s))
			return sl;
	}

	if (g_dbg_all_keywords)
		return AddKeyword(s);

	return NULL;
}
예제 #4
0
파일: pcl.c 프로젝트: vmezhang/sometest
/* 在参数输入时,以下命令必须在最前边,源文件名在后边 */
static int ParseCommandLine (int argc, char *argv[])
{
    int i;
    
    UserIncPath = CreateVector (1);
    for (i = 0; i < argc; i++) {

        if (!strncmp (argv[i], "-ext:", 5)) {
            /* 设置汇编文件的扩展名 */
            ExtName = argv[i] + 5;
        } else if (!strcmp (argv[i], "-ignore")) {
            /* 添加要当成空白符处理的字符串 */
            AddWhiteSpace (argv[++i]);
        } else if (!strcmp (argv[i], "-keyword")) {
            /* 添加用户自定义关键字 */
            AddKeyword (argv[++i]);
        } else if (!strcmp (argv[i], "--dump-ast")) {
            /* 标志生成语法树 */
            DumpAST = 1;
        } else if (!strcmp (argv[i], "--dump-IR")) {
            /* 标志是否要生成中间代码 */
            DumpIR = 1;
        } else if (!strcmp (argv[i], "--test-lex")) {
            
            test_lex = 1;
        } else if (!strncmp (argv[i], "-I", 2)) {
            
            char *path;
            
            path = calloc (strlen (argv[i]+2) + 1, sizeof (char));
            strcpy (path, argv[i] + 2);
            INSERT_ITEM (UserIncPath, path);
        } else if (!strncmp (argv[i], "-VARINFO=", 9)) {
            
            VarInfo = atoi (argv[i] + 9);
            if (VarInfo > 7 || VarInfo < 0) 
                VarInfo = 0;
        } else if (!strcmp (argv[i], "--help")) { 
        
            #define HELP(help) PRINT ("%s\n", help);
            #include "include/confg/help.h"
            #undef  HELP
        } else if (!strcmp (argv[i], "--version")) {
            
            PRINT ("%s \n", VERSION);
        } else return i;
    } return i;
}
예제 #5
0
//Go 버튼 클릭..(검색 )
void CDlg_Search::OnButtonSearch() 
{
	UpdateData(TRUE);

    m_sKeyword.TrimLeft(_T(" "));
    m_sKeyword.TrimRight(_T(" "));

    if ( isEnglishString(m_sKeyword) && m_sKeyword.GetLength() < MIN_SEARCHLENGTH_ENG)
    {
		CString sMsg;
		sMsg.Format(STR_SEARCH_LENGTHLIMIT, MIN_SEARCHLENGTH_ENG, MIN_SEARCHLENGTH_ETC);
		//AfxMessageBox( sMsg );
        FishMessageBox( (LPCTSTR)sMsg );
		return;
    }   
    else    
    if ( !isEnglishString(m_sKeyword) && m_sKeyword.GetLength() < MIN_SEARCHLENGTH_ETC )    
    {
		CString sMsg;
		sMsg.Format(STR_SEARCH_LENGTHLIMIT, MIN_SEARCHLENGTH_ENG, MIN_SEARCHLENGTH_ETC);
//		AfxMessageBox( sMsg );
        FishMessageBox( (LPCTSTR)sMsg );
		return;
	}

	TERM t;

	if(!m_bSearchTime) return;

	if(m_nSrchRange == TYPE_SRCH_RANGE_ALL)
	{
		theApp.m_spSM->Search(m_sKeyword, NET_SEARCH, t);
		//검색어 History 에 추가 
		AddKeyword(m_sKeyword);
	}
	else
	{
		theApp.m_spSM->Search(m_sKeyword, LOCAL_SEARCH, t);
	}

	m_bSearchTime = FALSE;
	m_nSearchTimer = SetTimer(TID_SEARCHINTERVAL, 500, NULL);

	ClearEdit();
}
예제 #6
0
DebugLink*
Debug::Find(DebugHead* list, const char* s)
{
	for (StringLink* sl = (StringLink*)list->First(); sl; sl = (StringLink*)sl->Suc())
	{
		if (uni_str_eq(sl->data, s))
			return sl;
	}

	if (g_dbg_all_keywords)
	{
		OpString str;
		if (OpStatus::IsError(str.Set(s)))
			return NULL;
		return AddKeyword(str.CStr());
	}

	return NULL;
}
예제 #7
0
static int ReadKeywords(CurPos &cp, ColorKeywords *keywords, int color) {
    unsigned char obj;
    unsigned short len;

    while ((obj = GetObj(cp, len)) != 0xFF) {
        switch (obj) {
        case CF_STRING:
            {
                const char *kname = GetCharStr(cp, len);
                if (kname == 0) return -1;
                if (AddKeyword(keywords, (char) color, kname) != 1) return -1;
            }
            break;
        case CF_END:
            return 0;
        default:
            return -1;
        }
    }
    return -1;
}
예제 #8
0
NS_IMETHODIMP nsMsgOfflineImapOperation::AddKeywordToRemove(const char * aKeyword)
{
  SetOperation(kRemoveKeywords);
  return AddKeyword(aKeyword, m_keywordsToRemove, PROP_KEYWORD_REMOVE, m_keywordsToAdd, PROP_KEYWORD_ADD);
}
void foo() {
  // CHECK: define void @_ZN6PR75233fooEv()
  // CHECK: call void @_ZN6PR752310AddKeywordENS_9StringRefEi(i8* {{.*}}, i32 4)
  AddKeyword(StringRef(), 4);
}