OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [lto/] [20091013-1_1.c] - Blame information for rev 689

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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