Changeset 2270


Ignore:
Timestamp:
Jan 22, 2007, 5:20:03 PM (14 years ago)
Author:
orlov
Message:
  • Changes to support MinGW.
Location:
to-imperative/trunk/c++
Files:
1 added
18 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/c++/lib/Dos/time.cc

    r2187 r2270  
    99#include <locale.h>
    1010
    11 #ifdef WINDOWS
     11#ifdef _MSC_VER
    1212#include <sys/timeb.h>
    1313#else
     
    2828 unsigned uu;
    2929
    30 #ifdef WINDOWS
     30#ifdef _MSC_VER
    3131
    3232 struct __timeb64 timebuffer;
  • to-imperative/trunk/c++/libp++/pxx_common.cc

    r2187 r2270  
    118118    char* s = setlocale(LC_ALL, "");
    119119#ifdef WINDOWS
    120     s = setlocale(LC_ALL, "C");
     120//    s = setlocale(LC_ALL, "C");
    121121    _setmbcp(_MB_CP_LOCALE);
    122122#endif
  • to-imperative/trunk/c++/libp++/pxx_common.hh

    r2199 r2270  
    3131#define __STDC_FORMAT_MACROS
    3232
    33 #ifndef WINDOWS
     33#ifndef _MSC_VER
    3434#include <inttypes.h>
    3535#include <unistd.h>    // ssize_t in FreeBSD
    3636#else
    3737#include <stddef.h>    // for integer types like intptr_t and size_t
    38 #include <malloc.h>    // for _alloca()
    3938#include <io.h>        // for _access()
    4039#endif
     
    4544
    4645#ifdef WINDOWS
     46#include <malloc.h>    // for _alloca()
     47#endif
     48
     49#ifdef _MSC_VER
    4750#define WSTRPREFIX  L
    4851#else
     
    5053#endif
    5154
    52 #ifdef WINDOWS
     55#ifdef _MSC_VER
    5356#define snprintf             _snprintf
    5457#define alloca               _alloca
    5558#define __PRETTY_FUNCTION__  __FUNCTION__
    56 #define sleep                ::Sleep
    5759
    5860#ifdef  _WIN64
     
    132134//#define NOGDI
    133135
    134 #endif // WINDOWS
    135 
     136#endif // _MSC_VER
    136137
    137138namespace pxx
  • to-imperative/trunk/c++/libp++/pxx_heap_allocator.ih

    r2187 r2270  
    5555}
    5656
    57 #ifdef WINDOWS
     57#ifdef _MSC_VER
    5858# pragma warning( disable : 4355 )
    5959#endif
     
    6161  BlockHeader (this, this)
    6262{}
    63 #ifdef WINDOWS
     63#ifdef _MSC_VER
    6464# pragma warning( default : 4355 )
    6565#endif
  • to-imperative/trunk/c++/runtime/rf_box.hh

    r2187 r2270  
    44#include "rf_symbol.ih"
    55#include "rf_expr.ih"
     6#include "rf_sysdefs.hh"
    67
    78namespace rftype
  • to-imperative/trunk/c++/runtime/rf_channel.ih

    r2187 r2270  
    55#include "rf_object.ih"
    66#include "rf_expr.ih"
    7 
    8 #include <typeinfo>
     7#include "rf_sysdefs.hh"
    98
    109namespace rftype
  • to-imperative/trunk/c++/runtime/rf_char.cc

    r2187 r2270  
    4848    setlocale(LC_CTYPE, _locale);
    4949  }
    50   mbstate_t ps;
    51   memset(&ps, '\0', sizeof(ps));
    5250  char const* s = _str;
    53   size_t len = mbsrtowcs(null, &s, 0, &ps);
     51  size_t len = mbstowcs(null, s, 0);
    5452  if (len == (size_t)(-1)) FATAL("Error while converting a string");
    5553  Expr e = Term::create_flat_expr(len);
    5654  Term* p = e.get_first();
    57   s = _str;
     55  wchar_t wc;
    5856  while (len-- > 0) {
    59     wchar_t wc;
    60     size_t l = mbrtowc(&wc, s, MB_CUR_MAX * 8, &ps);
     57    size_t l = mbtowc(&wc, s, MB_CUR_MAX);
    6158    new(p) Char(wc);
    6259    p++; s += l;
  • to-imperative/trunk/c++/runtime/rf_closure.ih

    r2187 r2270  
    77#include "rf_symbol.ih"
    88#include "rf_expr.ih"
     9#include "rf_sysdefs.hh"
    910
    1011namespace rftype
  • to-imperative/trunk/c++/runtime/rf_common.hh

    r2187 r2270  
    5959#   define D(x)   x
    6060#else
    61 #   define D(x)   /*empty*/
     61#   define D(x)
    6262#endif
    6363
  • to-imperative/trunk/c++/runtime/rf_core.hh

    r2187 r2270  
    2424#define __rf_core_hh__
    2525
     26#include "pxx_heap_allocator.ih"
     27#include "pxx_chunk_allocator.ih"
     28#include "pxx_common.ih"
     29#include "pxx_sys_error.ih"
     30
    2631#include "rf_common.hh"
    2732#include "rf_term.ih"
     
    4853#include "rf_symbol.ih"
    4954#include "rf_box.hh"
    50 
    51 #include "pxx_heap_allocator.ih"
    52 #include "pxx_chunk_allocator.ih"
    53 #include "pxx_common.ih"
    54 #include "pxx_sys_error.ih"
    5555
    5656namespace rfrt
  • to-imperative/trunk/c++/runtime/rf_expr.ih

    r2187 r2270  
    1212#define __rf_expr_ih__
    1313
     14#include <wchar.h>
     15#include <wctype.h>
     16
     17#include "pxx_heap_allocator.ih"
     18#include "pxx_common.ih"
     19#include "pxx_string.ih"
    1420#include "rf_expr.hh"
    1521#include "rf_term.ih"
     
    1723#include "rf_object_ref.ih"
    1824#include "rf_static_object.ih"
     25#include "rf_expr_constr.hh"
    1926#include "rf_common.ih"
    20 #include "rf_expr_constr.hh"
    21 #include "pxx_heap_allocator.ih"
    22 #include "pxx_common.ih"
    23 #include "pxx_string.ih"
    24 
    25 #include <wchar.h>
    26 #include <wctype.h>
    2727
    2828namespace rfrt
  • to-imperative/trunk/c++/runtime/rf_memory_chunk.hh

    r2187 r2270  
    66#define __rf_memory_chunk_hh__
    77
    8 #include "rf_common.ih"
    98#include "pxx_heap_allocator.hh"
    109#include "pxx_heap_allocator.ih"
     10#include "rf_common.hh"
    1111
    1212namespace rfrt {
  • to-imperative/trunk/c++/runtime/rf_object.ih

    r2187 r2270  
    22#define __rf_object_ih__
    33
     4#include <new>
     5#include "pxx_heap_allocator.ih"
    46#include "rf_object.hh"
    57#include "rf_common.ih"
    6 #include "pxx_heap_allocator.ih"
    7 #include <new>
     8#include "rf_sysdefs.hh"
    89
    910namespace rftype
  • to-imperative/trunk/c++/runtime/rf_string.ih

    r2187 r2270  
    22#define __rf_string_ih__
    33
     4#include "pxx_string.ih"
    45#include "rf_string.hh"
    5 #include "rf_common.ih"
    66#include "rf_object.ih"
    77#include "rf_types.ih"
    88#include "rf_static_object.hh"
    9 #include "pxx_string.ih"
     9#include "rf_common.ih"
    1010
    1111namespace rftype
  • to-imperative/trunk/c++/runtime/rf_table.ih

    r2187 r2270  
    33#define __rf_table_ih__
    44
    5 #include <typeinfo>
     5#include <new>
    66#include "rf_table.hh"
    77#include "rf_object.ih"
    88#include "rf_expr.ih"
    9 #include <new>
     9#include "rf_sysdefs.hh"
    1010
    1111namespace rftype
  • to-imperative/trunk/c++/runtime/rf_term.ih

    r2187 r2270  
    1818#include "rf_object_ref.ih"
    1919#include "rf_word.ih"
     20#include "rf_sysdefs.hh"
    2021
    2122namespace rfrt
  • to-imperative/trunk/c++/runtime/rf_vector.ih

    r2187 r2270  
    66#include "rf_expr.ih"
    77#include "pxx_vector.ih"
    8 #include <typeinfo>
     8#include "rf_sysdefs.hh"
    99
    1010namespace rftype
  • to-imperative/trunk/c++/runtime/rf_word.ih

    r2187 r2270  
    11#ifndef __rf_word_ih__
    22#define __rf_word_ih__
    3 
    4 #include "rf_word.hh"
    5 #include "rf_common.ih"
    63
    74#include <wctype.h>
    85#include <wchar.h>
    96#include <locale.h>
     7
     8#include "rf_word.hh"
     9#include "rf_common.ih"
    1010
    1111namespace rftype
     
    5151  }
    5252  char const* s = _str;
    53   mbstate_t ps;
    54   memset(&ps, '\0', sizeof(ps));
    55   size_t len = mbsrtowcs(null, &s, 0, &ps);
    56 //  if (len == (size_t)(-1)) throw_sys_error(errno);
     53  size_t len = mbstowcs(null, s, 0);
     54  if (len == (size_t)(-1)) FATAL("Error while converting a string");
    5755  Header* h = static_cast<Header*>(
    5856    allocator->allocate(sizeof(Header) + len * sizeof(wchar_t)));
    5957  h->ref_count = 1;
    6058  h->length = len;
    61   s = _str;
    6259  uint32_t hash = 0;
    6360  for (size_t i = 0; i < len; i++) {
    64     size_t l = mbrtowc(h->content + i, s, MB_CUR_MAX, &ps);
     61    size_t l = mbtowc(h->content + i, s, MB_CUR_MAX);
    6562    s += l;
    6663    hash = update_hash(hash, h->content + i, sizeof(wchar_t));
     
    7067  if (_locale != null) setlocale(LC_CTYPE, saved_locale);
    7168}
    72  
     69
    7370inline Word::Word (Word const& _word) :
    7471  Term (type_word)
Note: See TracChangeset for help on using the changeset viewer.