OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [lto/] [20091013-1_1.c] - Blame information for rev 298

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
typedef struct HDC__ { int unused; } *HDC;
2
typedef struct HFONT__ { int unused; } *HFONT;
3
 
4
typedef struct
5
{
6
  unsigned int ciACP;
7
} CHARSETINFO, *PCHARSETINFO, *LPCHARSETINFO;
8
 
9
typedef struct tagTEXTMETRICW
10
{
11
    int tmCharSet;
12
} TEXTMETRICW, *LPTEXTMETRICW, *PTEXTMETRICW;
13
 
14
struct gdi_obj_funcs
15
{
16
    void* (*pSelectObject)( void* handle, void* hdc );
17
};
18
 
19
typedef struct tagGdiFont GdiFont;
20
 
21
typedef struct tagDC
22
{
23
    int xunused;
24
    GdiFont *gdiFont;
25
    unsigned int font_code_page;
26
} DC;
27
 
28
extern GdiFont* WineEngCreateFontInstance(DC*, HFONT);
29
extern unsigned int WineEngGetTextCharsetInfo(GdiFont *font, void* fs, unsigned int flags);
30
extern int WineEngGetTextMetrics(GdiFont*, LPTEXTMETRICW);
31
extern void* alloc_gdi_handle( void *obj, unsigned short type, const struct gdi_obj_funcs *funcs );
32
 
33
enum __wine_debug_class
34
{
35
    __WINE_DBCL_FIXME,
36
    __WINE_DBCL_ERR,
37
    __WINE_DBCL_WARN,
38
    __WINE_DBCL_TRACE,
39
 
40
    __WINE_DBCL_INIT = 7
41
};
42
 
43
struct __wine_debug_channel
44
{
45
    unsigned char flags;
46
    char name[15];
47
};
48
 
49
extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func,
50
                         const char *format, ... ) __attribute__((format (printf,4,5)));
51
 
52
static struct __wine_debug_channel __wine_dbch_font = { ~0, "font" };
53
static struct __wine_debug_channel * const __wine_dbch___default = &__wine_dbch_font;
54
 
55
static void* FONT_SelectObject( void* handle, void* hdc );
56
 
57
static const struct gdi_obj_funcs font_funcs =
58
{
59
    FONT_SelectObject,
60
};
61
 
62
HFONT CreateFontIndirectW( const void *plf )
63
{
64
    return alloc_gdi_handle( 0, 6, &font_funcs );
65
}
66
 
67
static void update_font_code_page( DC *dc )
68
{
69
    CHARSETINFO csi;
70
    int charset = (unsigned char)1;
71
 
72
    if (dc->gdiFont)
73
        charset = WineEngGetTextCharsetInfo( dc->gdiFont, ((void *)0), 0 );
74
 
75
    if (TranslateCharsetInfo( ((void *)(unsigned long)((unsigned long)charset)), &csi, 1) )
76
        dc->font_code_page = csi.ciACP;
77
    else {
78
        switch(charset) {
79
        case (unsigned char)1:
80
            dc->font_code_page = GetACP();
81
            break;
82
 
83
        case (unsigned char)246:
84
            dc->font_code_page = 0;
85
            break;
86
 
87
        default:
88
            do { if((((__wine_dbch___default))->flags & (1 << __WINE_DBCL_FIXME))) { struct __wine_debug_channel * const __dbch = (__wine_dbch___default); const enum __wine_debug_class __dbcl = __WINE_DBCL_FIXME; wine_dbg_log( __dbcl, __dbch, __FUNCTION__, "Can't find codepage for charset %d\n", charset); } } while(0);
89
            dc->font_code_page = 0;
90
            break;
91
        }
92
    }
93
 
94
    do { if((((__wine_dbch___default))->flags & (1 << __WINE_DBCL_TRACE))) { struct __wine_debug_channel * const __dbch = (__wine_dbch___default); const enum __wine_debug_class __dbcl = __WINE_DBCL_TRACE; wine_dbg_log( __dbcl, __dbch, __FUNCTION__, "charset %d => cp %d\n", charset, dc->font_code_page); } } while(0);
95
}
96
 
97
static void* FONT_SelectObject( void* handle, void* hdc )
98
{
99
    DC *dc;
100
 
101
    dc->gdiFont = WineEngCreateFontInstance( dc, handle );
102
    update_font_code_page( dc );
103
    return 0;
104
}
105
 
106
int GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
107
{
108
    DC * dc;
109
    return WineEngGetTextMetrics(dc->gdiFont, metrics);
110
}
111
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.