News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

lost sqT(n)

Started by mmkider, October 28, 2008, 09:38:33 AM

Previous topic - Next topic

mmkider

#if defined(_MSC_VER) || defined(__BORLANDC__)
  #include <tchar.h>
  #ifndef UNICODE
    #define SCSNPRINTF _snprintf
    #define SCPUTS puts
  #else
    #define SCSNPRINTF _snwprintf
    #define SCPUTS _putws
  #endif
  #define  sqT(n) _T(n) //<==  lost this
#else
  // C::B patch: Convert conflicting _T() to sqT() --> applies to nearly *all* files!
//  #define _T(n) n
  #define sqT(n) n
  #define SCSNPRINTF snprintf
  #include <stdio.h> // for snprintf
  #define SCPUTS puts
#endif

thomas

Can you explain what that conflict is, please? I'd think that if there was such a conflict with Sqplus , it shouldn't compile, which it does, however. If _T() wasn't working, I'd expect a million error messages from pretty much every place that uses wxString in Unicode builds (which is default).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

mmkider

#2
sorry
It is my fault

#if defined(_MSC_VER) || defined(__BORLANDC__)
  #include <tchar.h>
  #ifndef UNICODE
    #define SCSNPRINTF _snprintf
    #define SCPUTS puts
  #else
    #define SCSNPRINTF _snwprintf
    #define SCPUTS _putws
  #endif
   #ifdef _UNICODE
       #define sqT(n) _T(n)
   #else
       #define  sqT(n) (n)
   #endif
#else
  // C::B patch: Convert conflicting _T() to sqT() --> applies to nearly *all* files!
//  #define _T(n) n
  #define sqT(n) n
  #define SCSNPRINTF snprintf
  #include <stdio.h> // for snprintf
  #define SCPUTS puts
#endif

stahta01

#3
From where you say the problem is you must be compiling with MSVC or Borland C; I have no idea if Code::Blocks accepts patches to Code::Blocks for building under anything but GCC.

But, I think that you need to post an patch file instead of code snippets to proceed. Also, good idea to say what problem is being fixed.

@thomas here's an patch that adds the code that is missing; it should only be complied by MSVC or Borland C, so would not normally affect CodeBlocks.


Index: src/include/scripting/sqplus/sqplus.h
===================================================================
--- src/include/scripting/sqplus/sqplus.h (revision 5295)
+++ src/include/scripting/sqplus/sqplus.h (working copy)
@@ -32,6 +32,7 @@
     #define SCSNPRINTF _snwprintf
     #define SCPUTS _putws
   #endif
+  #define sqT(n) n
#else
   // C::B patch: Convert conflicting _T() to sqT() --> applies to nearly *all* files!
//  #define _T(n) n


Tim S
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

mmkider

#4
sqplus.h
#if defined(_MSC_VER) || defined(__BORLANDC__)
  #include <tchar.h>
  #ifndef UNICODE
    #define SCSNPRINTF _snprintf
    #define SCPUTS puts
  #else
    #define SCSNPRINTF _snwprintf
    #define SCPUTS _putws
  #endif
 
#ifdef _UNICODE
#define sqT(n) _T(n)
#else
#define  sqT(n) (n)
#endif
#else
  // C::B patch: Convert conflicting _T() to sqT() --> applies to nearly *all* files!
//  #define _T(n) n
  #define sqT(n) n
  #define SCSNPRINTF snprintf
  #include <stdio.h> // for snprintf
  #define SCPUTS puts
#endif


sqstdio.h
SQFILE sqstd_fopen(const SQChar *filename ,const SQChar *mode)
{
// C::B patch: Comment out Unicode stuff
#ifndef SQUNICODE
return (SQFILE)fopen(filename,mode);
#else
return (SQFILE)_wfopen(filename,mode);
#endif
}




squirrel.h

// C::B patch: Comment out Unicode stuff
#ifdef _UNICODE
#define SQUNICODE
#endif






ya, I now try move codeblocks source into vs2005,so I get some trouble.
I choose unicode in vs2005, I get more errors in libsqplus and libsqstdlib
but I try compiling codeblocks code for mingw and got some error for fix code.

sorry, forgot this post.Thx