Unnamed Fossil Project

Check-in [c92a6d63a0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:updated
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c92a6d63a0d460520ea9743957bedfe4e8522be9
User & Date: alexey@sudachen.name 2011-09-12 09:42:37
Context
2011-09-16
14:29
LPC added check-in: abd80f058b user: alexey@sudachen.name tags: trunk
2011-09-12
09:42
updated check-in: c92a6d63a0 user: alexey@sudachen.name tags: trunk
2011-09-07
09:25
updated check-in: 2cc2bfbd1b user: alexey@sudachen.name tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to core.hc.

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
..
61
62
63
64
65
66
67
68
69









70
71
72
73
74
75
76
77
78
79
80
81
#pragma warning(disable:4996) /*The POSIX name for this item is deprecated*/
# ifndef _CRT_SECURE_NO_WARNINGS
#   define _CRT_SECURE_NO_WARNINGS
# endif
#endif

/* markers */
#define __Acquire /* a function acquire the ownership of argument */

#ifndef __yoTa
# define __yoTa(Text,NumId) Text
#endif

#define __FOUR_CHARS(C1,C2,C3,C4) ((uint_t)(C4)<<24)|((uint_t)(C3)<<16)|((uint_t)(C2)<<8)|((uint_t)(C1))
#define __USE_GNU
................................................................................
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <locale.h>

#if defined __WIN32 || defined _MSC_VER || defined __MINGW32_VERSION
# define __windoze









# if !defined _WINDOWS_
#  if !defined _X86_ 
#   if !defined __x86_64 && !defined __i386__
#     define _X86_ 1
#   endif
#  endif
# endif
# if !defined WINVER
#  define WINVER 0x500
# endif
# include <windef.h>
# include <winbase.h>







|







 







|

>
>
>
>
>
>
>
>
>

|
<
|
<







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
..
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

81

82
83
84
85
86
87
88
#pragma warning(disable:4996) /*The POSIX name for this item is deprecated*/
# ifndef _CRT_SECURE_NO_WARNINGS
#   define _CRT_SECURE_NO_WARNINGS
# endif
#endif

/* markers */
#define __Acquire /* a function acquires the ownership of argument */

#ifndef __yoTa
# define __yoTa(Text,NumId) Text
#endif

#define __FOUR_CHARS(C1,C2,C3,C4) ((uint_t)(C4)<<24)|((uint_t)(C3)<<16)|((uint_t)(C2)<<8)|((uint_t)(C1))
#define __USE_GNU
................................................................................
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <locale.h>

#if defined _WIN32 || defined _MSC_VER || defined __MINGW32_VERSION
# define __windoze
# if !defined __i386 && !defined __x86_64
#  ifdef _M_IX86
#   define __i386
#  elif defined _M_AMD64
#   define __x86_64
#  else
#   error "unknown processor"
#  endif
# endif
# if !defined _WINDOWS_
#  if !defined _X86_ && defined __i386

#   define _X86_ 1

#  endif
# endif
# if !defined WINVER
#  define WINVER 0x500
# endif
# include <windef.h>
# include <winbase.h>

Changes to extra/picture.hc.

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
typedef struct _YOYO_BGR8
  {
    byte_t b;
    byte_t g;
    byte_t r;
  } YOYO_BGR8;

//YOYO_PICTURE *Pict_Convert(YOYO_PICTURE *pict, int format)
//  {
//  }

#ifdef __windoze
HBITMAP Pict_Create_HBITMAP(YOYO_PICTURE *pict)
#ifdef _YOYO_PICTURE_BUILTIN
  {
    struct BI
      {
        BITMAPINFOHEADER ihdr;







<
<
<
<







101
102
103
104
105
106
107




108
109
110
111
112
113
114
typedef struct _YOYO_BGR8
  {
    byte_t b;
    byte_t g;
    byte_t r;
  } YOYO_BGR8;





#ifdef __windoze
HBITMAP Pict_Create_HBITMAP(YOYO_PICTURE *pict)
#ifdef _YOYO_PICTURE_BUILTIN
  {
    struct BI
      {
        BITMAPINFOHEADER ihdr;

Changes to extra/uname.hc.

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
...
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
      }
      
    return ret;
  }
#endif
  ;
  
char *Get_Target_OS()
#ifdef _YOYO_UNAME_BUILTIN
  {
  #ifdef __windoze 
    return "windows";
  #elif defined __APPLE__
    return "darwin";
  #elif defined __linux__
................................................................................
        else if ( Maj == 6 && Min == 0 )
          if ( osinfo.wProductType == VER_NT_WORKSTATION ) osname = "Windows Vista";
          else osname = "Windows Server 2008";
        else if ( Maj == 6 && Min == 1 )
          if ( osinfo.wProductType == VER_NT_WORKSTATION ) osname = "Windows 7";
          else osname = "Windows Server 2008 R2";
        else
          osname = __Format("Unknwon Windows %d.%d",Maj,Min);
        osname = __Format("%s build %d",osname,osinfo.dwBuildNumber);
        if ( osinfo.szCSDVersion[0] )
          osname = __Format("%s (%s)",osname,osinfo.szCSDVersion);
      }
    return osname;
  #else
    return "";
  #endif
  }
#endif
  ;
  
#endif /* C_once_B6590472_37D1_4589_84F6_BFC339C3E407 */







|







 







|













198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
...
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
      }
      
    return ret;
  }
#endif
  ;
  
char *Get_OS_Target()
#ifdef _YOYO_UNAME_BUILTIN
  {
  #ifdef __windoze 
    return "windows";
  #elif defined __APPLE__
    return "darwin";
  #elif defined __linux__
................................................................................
        else if ( Maj == 6 && Min == 0 )
          if ( osinfo.wProductType == VER_NT_WORKSTATION ) osname = "Windows Vista";
          else osname = "Windows Server 2008";
        else if ( Maj == 6 && Min == 1 )
          if ( osinfo.wProductType == VER_NT_WORKSTATION ) osname = "Windows 7";
          else osname = "Windows Server 2008 R2";
        else
          osname = __Format("Unknown Windows %d.%d",Maj,Min);
        osname = __Format("%s build %d",osname,osinfo.dwBuildNumber);
        if ( osinfo.szCSDVersion[0] )
          osname = __Format("%s (%s)",osname,osinfo.szCSDVersion);
      }
    return osname;
  #else
    return "";
  #endif
  }
#endif
  ;
  
#endif /* C_once_B6590472_37D1_4589_84F6_BFC339C3E407 */

Changes to file.hc.

1564
1565
1566
1567
1568
1569
1570















































1571
1572
1573
1574
1575
1576
1577
....
1588
1589
1590
1591
1592
1593
1594

















1595
1596
1597
1598
1599
      };
    YOYO_BUFFER_FILE *file = __Object(sizeof(YOYO_BUFFER_FILE),funcs);
    file->bf = __Refe(bf);
    return file;
  }
#endif
  ;
















































void Oj_Print(void *foj, char *S)
#ifdef _YOYO_FILE_BUILTIN
  {
    int S_len = S?strlen(S):0;
    if ( S_len )
      Oj_Write_Full(foj,S,S_len);
................................................................................
        char *text;
        va_start(va,fmt);
        text = __Pool(Yo_Format_(fmt,va));
        va_end(va);
        Oj_Print(foj,text);
      }
  }

















#endif
  ;

#endif /* C_once_E9479D04_5D69_4A1A_944F_0C99A852DC0B */








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
....
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
      };
    YOYO_BUFFER_FILE *file = __Object(sizeof(YOYO_BUFFER_FILE),funcs);
    file->bf = __Refe(bf);
    return file;
  }
#endif
  ;

void YOYO_MEMORY_FILE_Destruct(YOYO_BUFFER_FILE *file)
#ifdef _YOYO_FILE_BUILTIN
  {
    free(file->bf);
    __Destruct(file);
  }
#endif
  ;

int Memory_File_Write(YOYO_BUFFER_FILE *f, void *buf, int count, int min_count)
#ifdef _YOYO_FILE_BUILTIN
  {
    if (f->bf->count < f->offs + count )
      __Raise(YOYO_ERROR_OUT_OF_RANGE,"out of memory range");
    memcpy(f->bf->at+f->offs,buf,count);
    f->offs += count;
    return count;
  }
#endif
  ;

void *Memory_As_File(void *mem, int mem_len)
#ifdef _YOYO_FILE_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Destruct_OjMID,    YOYO_MEMORY_FILE_Destruct},
        {Oj_Close_OjMID,       Buffer_File_Close},
        {Oj_Read_OjMID,        Buffer_File_Read},
        {Oj_Write_OjMID,       Memory_File_Write},
        {Oj_Available_OjMID,   Buffer_File_Available},
        {Oj_Eof_OjMID,         Buffer_File_Eof},
        {Oj_Length_OjMID,      Buffer_File_Length},
        {Oj_Seek_OjMID,        Buffer_File_Seek},
        {Oj_Tell_OjMID,        Buffer_File_Tell},
        {0}
      };
      
    YOYO_BUFFER_FILE *file = __Object(sizeof(YOYO_BUFFER_FILE),funcs);
    file->bf = __Zero_Malloc_Npl(sizeof(YOYO_BUFFER));
    file->bf->at = mem;
    file->bf->count = mem_len;
    return file;
  }
#endif
  ;

void Oj_Print(void *foj, char *S)
#ifdef _YOYO_FILE_BUILTIN
  {
    int S_len = S?strlen(S):0;
    if ( S_len )
      Oj_Write_Full(foj,S,S_len);
................................................................................
        char *text;
        va_start(va,fmt);
        text = __Pool(Yo_Format_(fmt,va));
        va_end(va);
        Oj_Print(foj,text);
      }
  }
#endif
  ;

void Oj_Fill(void *fobj, byte_t val, int count)
#ifdef _YOYO_FILE_BUILTIN
  {
    byte_t bf[512];
    
    REQUIRE(count >= 0);
    memset(bf,val,sizeof(bf));
    while ( count > 0 )
      {
        int L = Yo_MIN(count,sizeof(bf));
        Oj_Write_Full(fobj,bf,L);
        count -= L;
      }
  }
#endif
  ;

#endif /* C_once_E9479D04_5D69_4A1A_944F_0C99A852DC0B */

Changes to lzss.hc.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
..
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
..
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
    LZSS_MIN_LEN = 4,
    LZSS_MAX_LEN = 15,
    LZSS_TABLE_MOD = 4095, /*4095, */
    LZSS_TABLE_LEN = LZSS_TABLE_MOD+1,
  };
#endif

int LZSS_Search_Index(char **table_L, char**iE, char* val, int strong, int *p_l, int maxl)
#ifdef _YOYO_LZSS_BUILTIN
  {
    char **iS = table_L;
    int len = iE - iS;
    int half;
    char ** middle;
    int  l = 0, ll = 0;
    if (p_l) *p_l = 0;

    while (len > 0)
................................................................................
          }
      }

    if ( iS != iE )
      {
        char **p = iS-1;
        for ( l = 0; l < maxl && (*iS)[l] == val[l]; ) ++l;
        if ( p >= table_L && strong == 2 )
          {
            for ( ll = 0; ll < maxl && (*p)[ll] == val[ll]; ) ++ll;
            if ( ll > l ) iS = p, l = ll;
          }
      }
    else
      l = 0;
................................................................................

    if ( strong == 1 )
      {
        char **k = iS;
        STRICT_REQUIRE ( iS != iE );

        if ( *k != val )
          for ( ; k >= table_L ; --k ) if (*k == val || **k != *val) break;
        if ( *k != val )
          for ( k = iS ; k != iE ; ++k ) if (*k == val || **k != *val) break;
        if ( *k == val )
          iS = k;
      }

    STRICT_REQUIRE ( strong!=1 || *iS == val );
    STRICT_REQUIRE ( !l || memcmp(val,*iS,l) == 0 );
    if ( p_l ) *p_l = l;
    return iS-table_L;
  }
#endif
  ;

void LZSS_Replace_String(char **table, char *in_b, int r_i)
#ifdef _YOYO_LZSS_BUILTIN
  {







|


|







 







|







 







|









|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
..
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
..
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
    LZSS_MIN_LEN = 4,
    LZSS_MAX_LEN = 15,
    LZSS_TABLE_MOD = 4095, /*4095, */
    LZSS_TABLE_LEN = LZSS_TABLE_MOD+1,
  };
#endif

int LZSS_Search_Index(char **table_S, char**iE, char* val, int strong, int *p_l, int maxl)
#ifdef _YOYO_LZSS_BUILTIN
  {
    char **iS = table_S;
    int len = iE - iS;
    int half;
    char ** middle;
    int  l = 0, ll = 0;
    if (p_l) *p_l = 0;

    while (len > 0)
................................................................................
          }
      }

    if ( iS != iE )
      {
        char **p = iS-1;
        for ( l = 0; l < maxl && (*iS)[l] == val[l]; ) ++l;
        if ( p >= table_S && strong == 2 )
          {
            for ( ll = 0; ll < maxl && (*p)[ll] == val[ll]; ) ++ll;
            if ( ll > l ) iS = p, l = ll;
          }
      }
    else
      l = 0;
................................................................................

    if ( strong == 1 )
      {
        char **k = iS;
        STRICT_REQUIRE ( iS != iE );

        if ( *k != val )
          for ( ; k > table_S ; --k ) if (*k == val || **k != *val) break;
        if ( *k != val )
          for ( k = iS ; k != iE ; ++k ) if (*k == val || **k != *val) break;
        if ( *k == val )
          iS = k;
      }

    STRICT_REQUIRE ( strong!=1 || *iS == val );
    STRICT_REQUIRE ( !l || memcmp(val,*iS,l) == 0 );
    if ( p_l ) *p_l = l;
    return iS-table_S;
  }
#endif
  ;

void LZSS_Replace_String(char **table, char *in_b, int r_i)
#ifdef _YOYO_LZSS_BUILTIN
  {

Changes to pefile.hc.

477
478
479
480
481
482
483











484
485
486
487
488
489
490
      return Pe_GET_NTH_32(pe)->OptionalHeader.ImageBase;
    else
      return Pe_GET_NTH_64(pe)->OptionalHeader.ImageBase;
  }
#endif
  ;












PE_DATA_DIRECTORY *Pe_Get_Dir(void *pe, int idx)
#ifdef _YOYO_PEFILE_BUILTIN
  {
    REQUIRE(idx < 16 && idx >= 0 );
    if ( Is_PE_32(pe) )
      return &Pe_GET_NTH_32(pe)->OptionalHeader.DataDirectory[idx];
    else







>
>
>
>
>
>
>
>
>
>
>







477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
      return Pe_GET_NTH_32(pe)->OptionalHeader.ImageBase;
    else
      return Pe_GET_NTH_64(pe)->OptionalHeader.ImageBase;
  }
#endif
  ;

quad_t Pe_Get_SizeOfImage(void *pe)
#ifdef _YOYO_PEFILE_BUILTIN
  {
    if ( Is_PE_32(pe) )
      return Pe_GET_NTH_32(pe)->OptionalHeader.SizeOfImage;
    else
      return Pe_GET_NTH_64(pe)->OptionalHeader.SizeOfImage;
  }
#endif
  ;
  
PE_DATA_DIRECTORY *Pe_Get_Dir(void *pe, int idx)
#ifdef _YOYO_PEFILE_BUILTIN
  {
    REQUIRE(idx < 16 && idx >= 0 );
    if ( Is_PE_32(pe) )
      return &Pe_GET_NTH_32(pe)->OptionalHeader.DataDirectory[idx];
    else

Changes to prog.hc.

225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
      #ifdef __windoze
        __Gogo
          {
            int L = 256;
            wchar_t *buf = __Malloc((256+1)*sizeof(wchar_t));
            GetModuleFileNameW(0,buf,L);
            Prog_Nam_S = Str_Unicode_To_Utf8_Npl(buf);
            printf("appname: %d, %s\n",L,Prog_Nam_S);
          }
      #else
        Prog_Nam_S = __Retain(Path_Fullname(argv[0]));
      #endif
        Prog_Dir_S = __Retain(Path_Dirname(Prog_Nam_S));
        REQUIRE(Prog_Dir_S != 0);
        rt = 1;







<







225
226
227
228
229
230
231

232
233
234
235
236
237
238
      #ifdef __windoze
        __Gogo
          {
            int L = 256;
            wchar_t *buf = __Malloc((256+1)*sizeof(wchar_t));
            GetModuleFileNameW(0,buf,L);
            Prog_Nam_S = Str_Unicode_To_Utf8_Npl(buf);

          }
      #else
        Prog_Nam_S = __Retain(Path_Fullname(argv[0]));
      #endif
        Prog_Dir_S = __Retain(Path_Dirname(Prog_Nam_S));
        REQUIRE(Prog_Dir_S != 0);
        rt = 1;