Author Topic: lost sqT(n)  (Read 2749 times)

Offline mmkider

  • Almost regular
  • **
  • Posts: 150
lost sqT(n)
« on: October 28, 2008, 09:38:33 am »
#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
« Last Edit: October 28, 2008, 11:20:12 am by mmkider »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: lost sqT(n)
« Reply #1 on: October 28, 2008, 10:15:33 am »
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."

Offline mmkider

  • Almost regular
  • **
  • Posts: 150
Re: lost sqT(n)
« Reply #2 on: October 28, 2008, 11:19:31 am »
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
« Last Edit: October 29, 2008, 07:32:48 am by mmkider »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6507
    • My Best Post
Re: lost sqT(n)
« Reply #3 on: October 29, 2008, 06:20:58 am »
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.

Code: [Select]
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
« Last Edit: October 29, 2008, 06:28:58 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline mmkider

  • Almost regular
  • **
  • Posts: 150
Re: lost sqT(n)
« Reply #4 on: October 29, 2008, 07:39:31 am »
sqplus.h
Code: [Select]
#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
Code: [Select]
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
Code: [Select]
// 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
« Last Edit: October 29, 2008, 08:46:36 am by mmkider »