X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3f4a0c5be34be837210768501c13dbcff81e533c..bbc1265c400d44962621a6b2c7c36ccff097207c:/include/wx/wxexpr.h diff --git a/include/wx/wxexpr.h b/include/wx/wxexpr.h index 613726f841..304aeb09c9 100644 --- a/include/wx/wxexpr.h +++ b/include/wx/wxexpr.h @@ -12,22 +12,22 @@ #ifndef _WX_WXEXPRH__ #define _WX_WXEXPRH__ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "wxexpr.h" #endif -#include +#if wxUSE_PROLOGIO #include "wx/defs.h" #include "wx/string.h" -#include "wx/ioswrap.h" - #include "wx/list.h" #include "wx/hash.h" #include "wx/expr.h" +#include + // Compatibility #define PrologExpr wxExpr #define PrologDatabase wxExprDatabase @@ -52,9 +52,6 @@ typedef bool (*wxExprErrorHandler) (int errorType, char *msg); WXDLLEXPORT_DATA(extern wxExprErrorHandler) currentwxExprErrorHandler; -extern "C" WXDLLEXPORT_DATA(FILE*) yyin; - -extern "C" WXDLLEXPORT int yyparse(void); typedef enum { wxExprNull, @@ -74,8 +71,8 @@ class WXDLLEXPORT wxExpr wxExprType type; union { long integer; - char *word; - char *string; + wxChar *word; + wxChar *string; double real; wxExpr *first; // If is a list expr, points to the first node } value; @@ -83,9 +80,9 @@ class WXDLLEXPORT wxExpr wxExpr *next; // If this is a node in a list, points to the next node wxExpr *last; // If is a list expr, points to the last node - wxExpr(wxExprType the_type, char *word_or_string, bool allocate); + wxExpr(wxExprType the_type, wxChar *word_or_string, bool allocate); wxExpr(const wxString& functor); // Assume this is a new clause - pass functor - wxExpr(wxExprType the_type, const wxString& word_or_string = ""); + wxExpr(wxExprType the_type, const wxString& word_or_string = wxT("")); wxExpr(long the_integer); wxExpr(double the_real); wxExpr(wxList *the_list); @@ -114,7 +111,7 @@ class WXDLLEXPORT wxExpr return value.word; else if (type == wxExprString) return wxString(value.string); - else return wxString(""); + else return wxString(wxT("")); } inline wxString StringValue(void) const { @@ -122,7 +119,7 @@ class WXDLLEXPORT wxExpr return wxString(value.string); else if (type == wxExprWord) return wxString(value.word); - else return wxString(""); + else return wxString(wxT("")); } // Get nth arg of clause (starting from 1) @@ -141,9 +138,8 @@ class WXDLLEXPORT wxExpr wxExpr *AttributeValue(const wxString& word) const; // Use only for a clause wxString Functor(void) const; // Only for a clause bool IsFunctor(const wxString& s) const; // Only for a clause - void WriteClause(ostream& stream); // Write this expression as a top-level clause - void WriteExpr(ostream& stream); // Write as any other subexpression - void WriteLispExpr(ostream& stream); + void WriteClause(FILE* stream); // Write this expression as a top-level clause + void WriteExpr(FILE* stream); // Write as any other subexpression // Append an expression to a list void Append(wxExpr *expr); @@ -179,12 +175,12 @@ class WXDLLEXPORT wxExpr bool GetAttributeValue(const wxString& att, wxExpr **var) const; // Compatibility with old PrologIO - inline void AssignAttributeValue(char *att, int *var) const { GetAttributeValue(att, *var); } - inline void AssignAttributeValue(char *att, long *var) const { GetAttributeValue(att, *var); } - inline void AssignAttributeValue(char *att, float *var) const { GetAttributeValue(att, *var); } - inline void AssignAttributeValue(char *att, double *var) const { GetAttributeValue(att, *var); } - inline void AssignAttributeValue(char *att, wxExpr **var) const { GetAttributeValue(att, var); } - void AssignAttributeValue(char *att, char **var) const ; // Word OR string -> string + inline void AssignAttributeValue(wxChar *att, int *var) const { GetAttributeValue(att, *var); } + inline void AssignAttributeValue(wxChar *att, long *var) const { GetAttributeValue(att, *var); } + inline void AssignAttributeValue(wxChar *att, float *var) const { GetAttributeValue(att, *var); } + inline void AssignAttributeValue(wxChar *att, double *var) const { GetAttributeValue(att, *var); } + inline void AssignAttributeValue(wxChar *att, wxExpr **var) const { GetAttributeValue(att, var); } + void AssignAttributeValue(wxChar *att, wxChar **var) const ; // Word OR string -> string // Add string items to list if the list attribute exists bool GetAttributeValueStringList(const wxString& att, wxList *var) const; @@ -194,6 +190,8 @@ class WXDLLEXPORT wxExpr // so we can index into the wxExpr database and fish out the pointer. inline void SetClientData(wxObject *data) { client_data = data; } inline wxObject *GetClientData(void) const { return client_data; } + + DECLARE_NO_COPY_CLASS(wxExpr) }; class WXDLLEXPORT wxExprDatabase: public wxList @@ -244,16 +242,19 @@ public: bool Read(const wxString& filename); bool ReadFromString(const wxString& buffer); bool Write(const wxString& fileName); - bool Write(ostream& stream); - void WriteLisp(ostream& stream); + bool Write(FILE* stream); // Compatibility - inline bool ReadProlog(char *filename) { return Read(wxString(filename)); } - inline bool ReadPrologFromString(char *buffer) { return ReadFromString(wxString(buffer)); } - inline void WriteProlog(ostream& stream) { Write(stream); } + inline bool ReadProlog(wxChar *filename) { return Read(wxString(filename)); } + inline bool ReadPrologFromString(char *buffer) + { + return ReadFromString(wxString(buffer, wxConvLibc)); + } + inline void WriteProlog(FILE* stream) { Write(stream); } private: DECLARE_DYNAMIC_CLASS(wxExprDatabase) + DECLARE_NO_COPY_CLASS(wxExprDatabase) }; // Function call-style interface - some more convenience wrappers/unwrappers @@ -276,5 +277,7 @@ WXDLLEXPORT_DATA(extern wxExprDatabase*) thewxExprDatabase; // YACC/LEX can leave memory lying around... extern "C" WXDLLEXPORT int wxExprCleanUp(); -#endif +#endif // wxUSE_PROLOGIO + +#endif // _WX_WXEXPRH__