예제 #1
0
void AddArgsToLTable(LSymbol **LSymbolHead, ArgStruct *a){
    int argLength = ArgLength(a);
    int ArgBind = ARG_START_BIND - argLength + 1;
    while(a != NULL){
        if(LlookupInTable(*LSymbolHead, a->name) != NULL){
          yyerror("LInstall : Local variable redefined ");
          printf(" %s",a->name);
          exit(1);
        }
        Ltemp = LInstall(a->name,a->type);
        Ltemp->next = *LSymbolHead;
        Ltemp->binding = ArgBind;
        ArgBind++;
        *LSymbolHead = Ltemp;
        a = a->next;
    }
}
예제 #2
0
ResultType Line::IniWrite(LPTSTR aValue, LPTSTR aFilespec, LPTSTR aSection, LPTSTR aKey)
{
	TCHAR	szFileTemp[_MAX_PATH+1];
	TCHAR	*szFilePart;
	BOOL	result;
	// Get the fullpathname (INI functions need a full path) 
	GetFullPathName(aFilespec, _MAX_PATH, szFileTemp, &szFilePart);
#ifdef UNICODE
	// WritePrivateProfileStringW() always creates INIs using the system codepage.
	// IniEncodingFix() checks if the file exists and if it doesn't then it creates
	// an empty file with a UTF-16LE BOM.
	result = IniEncodingFix(szFileTemp, aSection);
	if(result){
#endif
		if (*aKey)
		{
			result = WritePrivateProfileString(aSection, aKey, aValue, szFileTemp);  // Returns zero on failure.
		}
		else
		{
			size_t value_len = ArgLength(1);
			TCHAR c, *cp, *szBuffer = talloca(value_len + 2); // +2 for double null-terminator.
			// Convert newline-delimited list to null-terminated array of null-terminated strings.
			for (cp = szBuffer; *aValue; ++cp, ++aValue)
			{
				c = *aValue;
				*cp = (c == '\n') ? '\0' : c;
			}
			*cp = '\0', cp[1] = '\0'; // Double null-terminator.
			result = WritePrivateProfileSection(aSection, szBuffer, szFileTemp);
		}
		WritePrivateProfileString(NULL, NULL, NULL, szFileTemp);	// Flush
#ifdef UNICODE
	}
#endif
	return g_script.mIsAutoIt2 ? OK : SetErrorLevelOrThrowBool(!result);
}