All files in the common/ subdirectory now compiles in Unicode mode.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2144
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
switch (the_type)
{
case wxExprWord:
switch (the_type)
{
case wxExprWord:
- value.word = copystring((const char *)word_or_string);
+ value.word = copystring((const wxChar *)word_or_string);
break;
case wxExprString:
break;
case wxExprString:
- value.string = copystring((const char *)word_or_string);
+ value.string = copystring((const wxChar *)word_or_string);
break;
case wxExprList:
last = NULL;
break;
case wxExprList:
last = NULL;
-wxExpr::wxExpr(wxExprType the_type, char *word_or_string, bool allocate)
+wxExpr::wxExpr(wxExprType the_type, wxChar *word_or_string, bool allocate)
{
wxExpr *secondNode = firstNode->next;
if ((secondNode->type == wxExprWord) &&
{
wxExpr *secondNode = firstNode->next;
if ((secondNode->type == wxExprWord) &&
- (strcmp((const char *)word, secondNode->value.word) == 0))
+ (wxStrcmp((const wxChar *)word, secondNode->value.word) == 0))
wxString wxExpr::Functor(void) const // Use only for a clause
{
if ((type != wxExprList) || !value.first)
wxString wxExpr::Functor(void) const // Use only for a clause
{
if ((type != wxExprList) || !value.first)
+ return wxString(_T(""));
if (value.first->type == wxExprWord)
return wxString(value.first->value.word);
else
if (value.first->type == wxExprWord)
return wxString(value.first->value.word);
else
+ return wxString(_T(""));
}
bool wxExpr::IsFunctor(const wxString& f) const // Use only for a clause
}
bool wxExpr::IsFunctor(const wxString& f) const // Use only for a clause
return FALSE;
return (value.first->type == wxExprWord &&
return FALSE;
return (value.first->type == wxExprWord &&
- (strcmp((const char *)f, value.first->value.word) == 0));
+ (wxStrcmp((const wxChar *)f, value.first->value.word) == 0));
}
// Return nth argument of a clause (starting from 1)
}
// Return nth argument of a clause (starting from 1)
{
wxExpr *secondNode = firstNode->next;
if ((secondNode->type == wxExprWord) &&
{
wxExpr *secondNode = firstNode->next;
if ((secondNode->type == wxExprWord) &&
- (strcmp((const char *)attribute, secondNode->value.word) == 0))
+ (wxStrcmp((const wxChar *)attribute, secondNode->value.word) == 0))
{
wxExpr *nextExpr = expr->next;
delete expr;
{
wxExpr *nextExpr = expr->next;
delete expr;
// DeleteAttributeValue(attribute);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
// DeleteAttributeValue(attribute);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
- wxExpr *pequals = new wxExpr(wxExprWord, "=");
+ wxExpr *pequals = new wxExpr(wxExprWord, _T("="));
wxExpr *listExpr = new wxExpr(wxExprList);
wxExpr *listExpr = new wxExpr(wxExprList);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
wxExpr *pval = new wxExpr(val);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
wxExpr *pval = new wxExpr(val);
- wxExpr *pequals = new wxExpr(wxExprWord, "=");
+ wxExpr *pequals = new wxExpr(wxExprWord, _T("="));
wxExpr *listExpr = new wxExpr(wxExprList);
wxExpr *listExpr = new wxExpr(wxExprList);
// DeleteAttributeValue(attribute);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
wxExpr *pval = new wxExpr(val);
// DeleteAttributeValue(attribute);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
wxExpr *pval = new wxExpr(val);
- wxExpr *pequals = new wxExpr(wxExprWord, "=");
+ wxExpr *pequals = new wxExpr(wxExprWord, _T("="));
wxExpr *listExpr = new wxExpr(wxExprList);
wxExpr *listExpr = new wxExpr(wxExprList);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
wxExpr *pval = new wxExpr(wxExprString, val);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
wxExpr *pval = new wxExpr(wxExprString, val);
- wxExpr *pequals = new wxExpr(wxExprWord, "=");
+ wxExpr *pequals = new wxExpr(wxExprWord, _T("="));
wxExpr *listExpr = new wxExpr(wxExprList);
wxExpr *listExpr = new wxExpr(wxExprList);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
wxExpr *pval = new wxExpr(wxExprWord, val);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
wxExpr *pval = new wxExpr(wxExprWord, val);
- wxExpr *pequals = new wxExpr(wxExprWord, "=");
+ wxExpr *pequals = new wxExpr(wxExprWord, _T("="));
wxExpr *listExpr = new wxExpr(wxExprList);
wxExpr *listExpr = new wxExpr(wxExprList);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
wxExpr *pval = new wxExpr(val);
wxExpr *patt = new wxExpr(wxExprWord, attribute);
wxExpr *pval = new wxExpr(val);
- wxExpr *pequals = new wxExpr(wxExprWord, "=");
+ wxExpr *pequals = new wxExpr(wxExprWord, _T("="));
wxExpr *listExpr = new wxExpr(wxExprList);
wxExpr *listExpr = new wxExpr(wxExprList);
// Now make an (=, Att, Value) triple
wxExpr *patt = new wxExpr(wxExprWord, attribute);
// Now make an (=, Att, Value) triple
wxExpr *patt = new wxExpr(wxExprWord, attribute);
- wxExpr *pequals = new wxExpr(wxExprWord, "=");
+ wxExpr *pequals = new wxExpr(wxExprWord, _T("="));
wxExpr *listExpr2 = new wxExpr(wxExprList);
wxExpr *listExpr2 = new wxExpr(wxExprList);
-void wxExpr::AssignAttributeValue(char *att, char **var) const
+void wxExpr::AssignAttributeValue(wxChar *att, wxChar **var) const
{
wxString str;
if (GetAttributeValue(att, str))
{
if (*var)
delete[] *var;
{
wxString str;
if (GetAttributeValue(att, str))
{
if (*var)
delete[] *var;
- *var = copystring((const char *) str);
+ *var = copystring((const wxChar *) str);
- int len = strlen(value.string);
+ wxWX2MBbuf val = wxConv_libc.cWX2MB(value.string);
+ int len = strlen(val);
for (i = 0; i < len; i++)
{
for (i = 0; i < len; i++)
{
- char ch = value.string[i];
if (ch == '"' || ch == '\\')
stream << "\\";
stream << ch;
if (ch == '"' || ch == '\\')
stream << "\\";
stream << ch;
case wxExprWord:
{
bool quote_it = FALSE;
case wxExprWord:
{
bool quote_it = FALSE;
- int len = strlen(value.word);
- if ((len == 0) || (len > 0 && (value.word[0] > 64 && value.word[0] < 91)))
+ wxWX2MBbuf val = wxConv_libc.cWX2MB(value.word);
+ int len = strlen(val);
+ if ((len == 0) || (len > 0 && (val[0] > 64 && val[0] < 91)))
quote_it = TRUE;
else
{
int i;
for (i = 0; i < len; i++)
quote_it = TRUE;
else
{
int i;
for (i = 0; i < len; i++)
- if ((!isalpha(value.word[i])) && (!isdigit(value.word[i])) &&
- (value.word[i] != '_'))
+ if ((!isalpha(val[i])) && (!isdigit(val[i])) &&
+ (val[i] != '_'))
{ quote_it = TRUE; i = len; }
}
if (quote_it)
stream << "'";
{ quote_it = TRUE; i = len; }
}
if (quote_it)
stream << "'";
if (quote_it)
stream << "'";
if (quote_it)
stream << "'";
{
wxExpr *expr = value.first;
{
wxExpr *expr = value.first;
- if ((expr->Type() == wxExprWord) && (strcmp(expr->WordValue(), "=") == 0))
+ if ((expr->Type() == wxExprWord) && (wxStrcmp(expr->WordValue(), _T("=")) == 0))
{
wxExpr *arg1 = expr->next;
wxExpr *arg2 = arg1->next;
{
wxExpr *arg1 = expr->next;
wxExpr *arg2 = arg1->next;
wxExpr *expr = clause->AttributeValue(attribute_to_hash);
if (expr)
{
wxExpr *expr = clause->AttributeValue(attribute_to_hash);
if (expr)
{
- long functor_key = hash_table->MakeKey((char *)(const char *)functor);
+ long functor_key = hash_table->MakeKey(WXSTRINGCAST functor);
long value_key = 0;
if (expr && expr->Type() == wxExprString)
{
long value_key = 0;
if (expr && expr->Type() == wxExprString)
{
- value_key = hash_table->MakeKey((char *)(const char *)expr->StringValue());
- hash_table->Put(functor_key + value_key, (char *)(const char *)expr->StringValue(), (wxObject *)clause);
+ value_key = hash_table->MakeKey(WXSTRINGCAST expr->StringValue());
+ hash_table->Put(functor_key + value_key, WXSTRINGCAST expr->StringValue(), (wxObject *)clause);
}
else if (expr && expr->Type() == wxExprInteger)
{
}
else if (expr && expr->Type() == wxExprInteger)
{
wxExpr *wxExprDatabase::HashFind(const wxString& functor, long value) const
{
wxExpr *wxExprDatabase::HashFind(const wxString& functor, long value) const
{
- long key = hash_table->MakeKey((char *)(const char *)functor) + value;
+ long key = hash_table->MakeKey(WXSTRINGCAST functor) + value;
// The key alone isn't guaranteed to be unique:
// must supply value too. Let's assume the value of the
// The key alone isn't guaranteed to be unique:
// must supply value too. Let's assume the value of the
wxExpr *wxExprDatabase::HashFind(const wxString& functor, const wxString& value) const
{
wxExpr *wxExprDatabase::HashFind(const wxString& functor, const wxString& value) const
{
- long key = hash_table->MakeKey((char *)(const char *)functor) + hash_table->MakeKey((char *)(const char *)value);
- return (wxExpr *)hash_table->Get(key, (char *)(const char *)value);
+ long key = hash_table->MakeKey(WXSTRINGCAST functor) + hash_table->MakeKey(WXSTRINGCAST value);
+ return (wxExpr *)hash_table->Get(key, WXSTRINGCAST value);
}
void wxExprDatabase::ClearDatabase(void)
}
void wxExprDatabase::ClearDatabase(void)
- FILE *f = fopen((const char *)filename, "r");
+ FILE *f = fopen(filename.fn_str(), "r");
if (f)
{
thewxExprDatabase = this;
if (f)
{
thewxExprDatabase = this;
noErrors = 0;
thewxExprDatabase = this;
noErrors = 0;
thewxExprDatabase = this;
- LexFromString((char *)(const char *)buffer);
+ wxWX2MBbuf buf = buffer.mb_str();
+ LexFromString(MBSTRINGCAST buf);
yyparse();
wxExprCleanUp();
return (noErrors == 0);
yyparse();
wxExprCleanUp();
return (noErrors == 0);
bool wxExprDatabase::Write(const wxString& fileName)
{
bool wxExprDatabase::Write(const wxString& fileName)
{
- ofstream str((char *)(const char *)fileName);
+ ofstream str(MBSTRINGCAST fileName.mb_str());
if (str.bad())
return FALSE;
return Write(str);
if (str.bad())
return FALSE;
return Write(str);
char *wxmake_string(char *str)
{
char *wxmake_string(char *str)
{
+ wxMB2WXbuf sbuf = wxConv_libc.cMB2WX(str);
str++; /* skip leading quote */
str++; /* skip leading quote */
- len = strlen(str) - 1; /* ignore trailing quote */
+ len = wxStrlen(sbuf) - 1; /* ignore trailing quote */
+ s = new wxChar[len + 1];
t = s;
for(i=0; i<len; i++)
{
t = s;
for(i=0; i<len; i++)
{
- if (str[i] == '\\' && str[i+1] == '"')
+ if (sbuf[i] == _T('\\') && sbuf[i+1] == _T('"'))
- else if (str[i] == '\\' && str[i+1] == '\\')
+ else if (sbuf[i] == _T('\\') && sbuf[i+1] == _T('\\'))
wxExpr *x = new wxExpr(wxExprString, s, FALSE);
return (char *)x;
wxExpr *x = new wxExpr(wxExprString, s, FALSE);
return (char *)x;