4 * Copyright 1993 Alexandre Julliard
24 /* Object types for EnumObjects() */
28 /***********************************************************************
32 static BRUSHOBJ WhiteBrush
=
34 { 0, BRUSH_MAGIC
, 1 }, /* header */
35 { BS_SOLID
, RGB(255,255,255), 0 } /* logbrush */
38 static BRUSHOBJ LtGrayBrush
=
40 { 0, BRUSH_MAGIC
, 1 }, /* header */
41 /* FIXME : this should perhaps be BS_HATCHED, at least for 1 bitperpixel */
42 { BS_SOLID
, RGB(192,192,192), 0 } /* logbrush */
45 static BRUSHOBJ GrayBrush
=
47 { 0, BRUSH_MAGIC
, 1 }, /* header */
48 /* FIXME : this should perhaps be BS_HATCHED, at least for 1 bitperpixel */
49 { BS_SOLID
, RGB(128,128,128), 0 } /* logbrush */
52 static BRUSHOBJ DkGrayBrush
=
54 { 0, BRUSH_MAGIC
, 1 }, /* header */
55 /* This is BS_HATCHED, for 1 bitperpixel. This makes the spray work in pbrush */
56 /* NB_HATCH_STYLES is an index into HatchBrushes */
57 { BS_HATCHED
, RGB(0,0,0), NB_HATCH_STYLES
} /* logbrush */
60 static BRUSHOBJ BlackBrush
=
62 { 0, BRUSH_MAGIC
, 1 }, /* header */
63 { BS_SOLID
, RGB(0,0,0), 0 } /* logbrush */
66 static BRUSHOBJ NullBrush
=
68 { 0, BRUSH_MAGIC
, 1 }, /* header */
69 { BS_NULL
, 0, 0 } /* logbrush */
72 static PENOBJ WhitePen
=
74 { 0, PEN_MAGIC
, 1 }, /* header */
75 { PS_SOLID
, { 1, 0 }, RGB(255,255,255) } /* logpen */
78 static PENOBJ BlackPen
=
80 { 0, PEN_MAGIC
, 1 }, /* header */
81 { PS_SOLID
, { 1, 0 }, RGB(0,0,0) } /* logpen */
84 static PENOBJ NullPen
=
86 { 0, PEN_MAGIC
, 1 }, /* header */
87 { PS_NULL
, { 1, 0 }, 0 } /* logpen */
90 static FONTOBJ OEMFixedFont
=
92 { 0, FONT_MAGIC
, 1 }, /* header */
93 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, OEM_CHARSET
,
94 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
, "" }
97 static FONTOBJ AnsiFixedFont
=
99 { 0, FONT_MAGIC
, 1 }, /* header */
100 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
101 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
, "" }
104 static FONTOBJ AnsiVarFont
=
106 { 0, FONT_MAGIC
, 1 }, /* header */
107 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
108 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
, "MS Sans Serif" }
111 static FONTOBJ SystemFont
=
113 { 0, FONT_MAGIC
, 1 },
114 { 16, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
115 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
, "System" }
118 static FONTOBJ DeviceDefaultFont
=
120 { 0, FONT_MAGIC
, 1 }, /* header */
121 { 12, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
122 0, 0, DEFAULT_QUALITY
, VARIABLE_PITCH
| FF_SWISS
, "" }
125 static FONTOBJ SystemFixedFont
=
127 { 0, FONT_MAGIC
, 1 }, /* header */
128 { 12, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
129 0, 0, DEFAULT_QUALITY
, FIXED_PITCH
| FF_MODERN
, "" }
133 static GDIOBJHDR
* StockObjects
[NB_STOCK_OBJECTS
] =
135 (GDIOBJHDR
*) &WhiteBrush
,
136 (GDIOBJHDR
*) &LtGrayBrush
,
137 (GDIOBJHDR
*) &GrayBrush
,
138 (GDIOBJHDR
*) &DkGrayBrush
,
139 (GDIOBJHDR
*) &BlackBrush
,
140 (GDIOBJHDR
*) &NullBrush
,
141 (GDIOBJHDR
*) &WhitePen
,
142 (GDIOBJHDR
*) &BlackPen
,
143 (GDIOBJHDR
*) &NullPen
,
145 (GDIOBJHDR
*) &OEMFixedFont
,
146 (GDIOBJHDR
*) &AnsiFixedFont
,
147 (GDIOBJHDR
*) &AnsiVarFont
,
148 (GDIOBJHDR
*) &SystemFont
,
149 (GDIOBJHDR
*) &DeviceDefaultFont
,
150 NULL
, /* DEFAULT_PALETTE created by PALETTE_Init */
151 (GDIOBJHDR
*) &SystemFixedFont
154 /******************************************************************************
156 * void ReadFontInformation(
157 * char const *fontName,
165 * ReadFontInformation() checks the Wine configuration file's Tweak.Fonts
166 * section for entries containing fontName.Height, fontName.Bold, etc.,
167 * where fontName is the name specified in the call (e.g., "System"). It
168 * attempts to be user friendly by accepting 'n', 'N', 'f', 'F', or '0' as
169 * the first character in the boolean attributes (bold, italic, and
171 *****************************************************************************/
173 static void ReadFontInformation(
174 char const *fontName
,
184 sprintf(key
, "%s.Height", fontName
);
185 font
->logfont
.lfHeight
=
186 PROFILE_GetWineIniInt("Tweak.Fonts", key
, defHeight
);
188 sprintf(key
, "%s.Bold", fontName
);
189 font
->logfont
.lfWeight
=
190 (PROFILE_GetWineIniBool("Tweak.Fonts", key
, defBold
)) ?
193 sprintf(key
, "%s.Italic", fontName
);
194 font
->logfont
.lfItalic
=
195 PROFILE_GetWineIniBool("Tweak.Fonts", key
, defItalic
);
197 sprintf(key
, "%s.Underline", fontName
);
198 font
->logfont
.lfUnderline
=
199 PROFILE_GetWineIniBool("Tweak.Fonts", key
, defUnderline
);
201 sprintf(key
, "%s.StrikeOut", fontName
);
202 font
->logfont
.lfStrikeOut
=
203 PROFILE_GetWineIniBool("Tweak.Fonts", key
, defStrikeOut
);
209 /***********************************************************************
212 * GDI initialization.
214 BOOL32
GDI_Init(void)
216 extern BOOL32
X11DRV_Init(void);
217 extern BOOL32
DIB_Init(void);
219 /* TWEAK: Initialize font hints */
220 ReadFontInformation("OEMFixed", &OEMFixedFont
, 12, 0, 0, 0, 0);
221 ReadFontInformation("AnsiFixed", &AnsiFixedFont
, 12, 0, 0, 0, 0);
222 ReadFontInformation("AnsiVar", &AnsiVarFont
, 12, 0, 0, 0, 0);
223 ReadFontInformation("System", &SystemFont
, 16, 1, 0, 0, 0);
224 ReadFontInformation("SystemFixed", &SystemFixedFont
, 12, 1, 0, 0, 0);
226 /* Initialize drivers */
228 DIB_Init(); /* always before X11DRV_Init() */
232 /* Create default palette */
234 /* DR well *this* palette can't be moveable (?) */
236 HPALETTE16 hpalette
= PALETTE_Init();
240 StockObjects
[DEFAULT_PALETTE
] = (GDIOBJHDR
*)GDI_HEAP_LOCK( hpalette
);
248 /***********************************************************************
251 HGDIOBJ16
GDI_AllocObject( WORD size
, WORD magic
)
253 static DWORD count
= 0;
256 if ( magic
== DC_MAGIC
|| magic
== METAFILE_DC_MAGIC
)
257 handle
= GDI_HEAP_ALLOC( size
);
259 handle
= GDI_HEAP_ALLOC_MOVEABLE( size
);
260 if (!handle
) return 0;
261 obj
= (GDIOBJHDR
*) GDI_HEAP_LOCK( handle
);
264 obj
->dwCount
= ++count
;
265 GDI_HEAP_UNLOCK( handle
);
270 /***********************************************************************
273 BOOL32
GDI_FreeObject( HGDIOBJ16 handle
)
277 /* Can't free stock objects */
278 if ((handle
>= FIRST_STOCK_HANDLE
) && (handle
<= LAST_STOCK_HANDLE
))
281 object
= (GDIOBJHDR
*) GDI_HEAP_LOCK( handle
);
282 if (!object
) return FALSE
;
283 object
->wMagic
= 0; /* Mark it as invalid */
287 GDI_HEAP_FREE( handle
);
291 /***********************************************************************
294 * Return a pointer to the GDI object associated to the handle.
295 * Return NULL if the object has the wrong magic number.
296 * Movable GDI objects are locked in memory: it is up to the caller to unlock
297 * it after the caller is done with the pointer.
299 GDIOBJHDR
* GDI_GetObjPtr( HGDIOBJ16 handle
, WORD magic
)
301 GDIOBJHDR
* ptr
= NULL
;
303 if ((handle
>= FIRST_STOCK_HANDLE
) && (handle
<= LAST_STOCK_HANDLE
))
304 ptr
= StockObjects
[handle
- FIRST_STOCK_HANDLE
];
306 ptr
= (GDIOBJHDR
*) GDI_HEAP_LOCK( handle
);
307 if (!ptr
) return NULL
;
308 if ((magic
!= MAGIC_DONTCARE
) && (ptr
->wMagic
!= magic
))
310 GDI_HEAP_UNLOCK( handle
);
317 /***********************************************************************
318 * DeleteObject16 (GDI.69)
320 BOOL16 WINAPI
DeleteObject16( HGDIOBJ16 obj
)
322 return DeleteObject32( obj
);
326 /***********************************************************************
327 * DeleteObject32 (GDI32.70)
329 BOOL32 WINAPI
DeleteObject32( HGDIOBJ32 obj
)
331 /* Check if object is valid */
334 if (HIWORD(obj
)) return FALSE
;
335 if ((obj
>= FIRST_STOCK_HANDLE
) && (obj
<= LAST_STOCK_HANDLE
))
337 if (!(header
= (GDIOBJHDR
*) GDI_HEAP_LOCK( obj
))) return FALSE
;
339 dprintf_gdi(stddeb
, "DeleteObject: %04x\n", obj
);
343 switch(header
->wMagic
)
345 case PEN_MAGIC
: return GDI_FreeObject( obj
);
346 case BRUSH_MAGIC
: return BRUSH_DeleteObject( obj
, (BRUSHOBJ
*)header
);
347 case FONT_MAGIC
: return GDI_FreeObject( obj
);
348 case PALETTE_MAGIC
: return PALETTE_DeleteObject(obj
,(PALETTEOBJ
*)header
);
349 case BITMAP_MAGIC
: return BITMAP_DeleteObject( obj
, (BITMAPOBJ
*)header
);
350 case REGION_MAGIC
: return REGION_DeleteObject( obj
, (RGNOBJ
*)header
);
356 /***********************************************************************
357 * GetStockObject16 (GDI.87)
359 HGDIOBJ16 WINAPI
GetStockObject16( INT16 obj
)
361 return (HGDIOBJ16
)GetStockObject32( obj
);
365 /***********************************************************************
366 * GetStockObject32 (GDI32.220)
368 HGDIOBJ32 WINAPI
GetStockObject32( INT32 obj
)
370 if ((obj
< 0) || (obj
>= NB_STOCK_OBJECTS
)) return 0;
371 if (!StockObjects
[obj
]) return 0;
372 dprintf_gdi(stddeb
, "GetStockObject: returning %d\n",
373 FIRST_STOCK_HANDLE
+ obj
);
374 return (HGDIOBJ16
)(FIRST_STOCK_HANDLE
+ obj
);
378 /***********************************************************************
379 * GetObject16 (GDI.82)
381 INT16 WINAPI
GetObject16( HANDLE16 handle
, INT16 count
, LPVOID buffer
)
383 GDIOBJHDR
* ptr
= NULL
;
385 dprintf_gdi(stddeb
, "GetObject16: %04x %d %p\n", handle
, count
, buffer
);
386 if (!count
) return 0;
388 if ((handle
>= FIRST_STOCK_HANDLE
) && (handle
<= LAST_STOCK_HANDLE
))
389 ptr
= StockObjects
[handle
- FIRST_STOCK_HANDLE
];
391 ptr
= (GDIOBJHDR
*) GDI_HEAP_LOCK( handle
);
397 result
= PEN_GetObject16( (PENOBJ
*)ptr
, count
, buffer
);
400 result
= BRUSH_GetObject16( (BRUSHOBJ
*)ptr
, count
, buffer
);
403 result
= BITMAP_GetObject16( (BITMAPOBJ
*)ptr
, count
, buffer
);
406 result
= FONT_GetObject16( (FONTOBJ
*)ptr
, count
, buffer
);
409 result
= PALETTE_GetObject( (PALETTEOBJ
*)ptr
, count
, buffer
);
412 GDI_HEAP_UNLOCK( handle
);
417 /***********************************************************************
418 * GetObject32A (GDI32.204)
420 INT32 WINAPI
GetObject32A( HANDLE32 handle
, INT32 count
, LPVOID buffer
)
422 GDIOBJHDR
* ptr
= NULL
;
424 dprintf_gdi(stddeb
, "GetObject32A: %08x %d %p\n", handle
, count
, buffer
);
425 if (!count
) return 0;
427 if ((handle
>= FIRST_STOCK_HANDLE
) && (handle
<= LAST_STOCK_HANDLE
))
428 ptr
= StockObjects
[handle
- FIRST_STOCK_HANDLE
];
430 ptr
= (GDIOBJHDR
*) GDI_HEAP_LOCK( handle
);
436 result
= PEN_GetObject32( (PENOBJ
*)ptr
, count
, buffer
);
439 result
= BRUSH_GetObject32( (BRUSHOBJ
*)ptr
, count
, buffer
);
442 result
= BITMAP_GetObject32( (BITMAPOBJ
*)ptr
, count
, buffer
);
445 result
= FONT_GetObject32A( (FONTOBJ
*)ptr
, count
, buffer
);
448 fprintf( stderr
, "GetObject32: magic %04x not implemented\n",
452 GDI_HEAP_UNLOCK( handle
);
457 /***********************************************************************
458 * GetObject32W (GDI32.206)
460 INT32 WINAPI
GetObject32W( HANDLE32 handle
, INT32 count
, LPVOID buffer
)
462 return GetObject32A( handle
, count
, buffer
);
466 /***********************************************************************
467 * SelectObject16 (GDI.45)
469 HGDIOBJ16 WINAPI
SelectObject16( HDC16 hdc
, HGDIOBJ16 handle
)
471 return (HGDIOBJ16
)SelectObject32( hdc
, handle
);
475 /***********************************************************************
476 * SelectObject32 (GDI32.299)
478 HGDIOBJ32 WINAPI
SelectObject32( HDC32 hdc
, HGDIOBJ32 handle
)
480 DC
* dc
= DC_GetDCPtr( hdc
);
481 if (!dc
|| !dc
->funcs
->pSelectObject
) return 0;
482 dprintf_gdi(stddeb
, "SelectObject: hdc=%04x %04x\n", hdc
, handle
);
483 return dc
->funcs
->pSelectObject( dc
, handle
);
487 /***********************************************************************
488 * UnrealizeObject16 (GDI.150)
490 BOOL16 WINAPI
UnrealizeObject16( HGDIOBJ16 obj
)
492 return UnrealizeObject32( obj
);
496 /***********************************************************************
497 * UnrealizeObject (GDI32.358)
499 BOOL32 WINAPI
UnrealizeObject32( HGDIOBJ32 obj
)
501 BOOL32 result
= TRUE
;
502 /* Check if object is valid */
504 GDIOBJHDR
* header
= (GDIOBJHDR
*) GDI_HEAP_LOCK( obj
);
505 if (!header
) return FALSE
;
507 dprintf_gdi( stddeb
, "UnrealizeObject: %04x\n", obj
);
509 /* Unrealize object */
511 switch(header
->wMagic
)
514 result
= PALETTE_UnrealizeObject( obj
, (PALETTEOBJ
*)header
);
518 /* Windows resets the brush origin. We don't need to. */
521 GDI_HEAP_UNLOCK( obj
);
526 /***********************************************************************
527 * EnumObjects16 (GDI.71)
529 INT16 WINAPI
EnumObjects16( HDC16 hdc
, INT16 nObjType
,
530 GOBJENUMPROC16 lpEnumFunc
, LPARAM lParam
)
532 /* Solid colors to enumerate */
533 static const COLORREF solid_colors
[] =
534 { RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff),
535 RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00),
536 RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00),
537 RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff),
538 RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00),
539 RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80),
540 RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80),
541 RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0)
546 LOGBRUSH16
*brush
= NULL
;
548 dprintf_gdi( stddeb
, "EnumObjects16: %04x %d %08lx %08lx\n",
549 hdc
, nObjType
, (DWORD
)lpEnumFunc
, lParam
);
553 /* Enumerate solid pens */
554 if (!(pen
= SEGPTR_NEW(LOGPEN16
))) break;
555 for (i
= 0; i
< sizeof(solid_colors
)/sizeof(solid_colors
[0]); i
++)
557 pen
->lopnStyle
= PS_SOLID
;
558 pen
->lopnWidth
.x
= 1;
559 pen
->lopnWidth
.y
= 0;
560 pen
->lopnColor
= solid_colors
[i
];
561 retval
= lpEnumFunc( SEGPTR_GET(pen
), lParam
);
562 dprintf_gdi( stddeb
, "EnumObjects16: solid pen %08lx, ret=%d\n",
563 solid_colors
[i
], retval
);
570 /* Enumerate solid brushes */
571 if (!(brush
= SEGPTR_NEW(LOGBRUSH16
))) break;
572 for (i
= 0; i
< sizeof(solid_colors
)/sizeof(solid_colors
[0]); i
++)
574 brush
->lbStyle
= BS_SOLID
;
575 brush
->lbColor
= solid_colors
[i
];
577 retval
= lpEnumFunc( SEGPTR_GET(brush
), lParam
);
578 dprintf_gdi( stddeb
, "EnumObjects16: solid brush %08lx, ret=%d\n",
579 solid_colors
[i
], retval
);
583 /* Now enumerate hatched brushes */
584 if (retval
) for (i
= HS_HORIZONTAL
; i
<= HS_DIAGCROSS
; i
++)
586 brush
->lbStyle
= BS_HATCHED
;
587 brush
->lbColor
= RGB(0,0,0);
589 retval
= lpEnumFunc( SEGPTR_GET(brush
), lParam
);
590 dprintf_gdi( stddeb
, "EnumObjects16: hatched brush %d, ret=%d\n",
598 fprintf( stderr
, "EnumObjects16: invalid type %d\n", nObjType
);
605 /***********************************************************************
606 * EnumObjects32 (GDI32.89)
608 INT32 WINAPI
EnumObjects32( HDC32 hdc
, INT32 nObjType
,
609 GOBJENUMPROC32 lpEnumFunc
, LPARAM lParam
)
611 /* Solid colors to enumerate */
612 static const COLORREF solid_colors
[] =
613 { RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff),
614 RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00),
615 RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00),
616 RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff),
617 RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00),
618 RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80),
619 RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80),
620 RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0)
627 dprintf_gdi( stddeb
, "EnumObjects32: %04x %d %08lx %08lx\n",
628 hdc
, nObjType
, (DWORD
)lpEnumFunc
, lParam
);
632 /* Enumerate solid pens */
633 for (i
= 0; i
< sizeof(solid_colors
)/sizeof(solid_colors
[0]); i
++)
635 pen
.lopnStyle
= PS_SOLID
;
638 pen
.lopnColor
= solid_colors
[i
];
639 retval
= lpEnumFunc( &pen
, lParam
);
640 dprintf_gdi( stddeb
, "EnumObjects32: solid pen %08lx, ret=%d\n",
641 solid_colors
[i
], retval
);
647 /* Enumerate solid brushes */
648 for (i
= 0; i
< sizeof(solid_colors
)/sizeof(solid_colors
[0]); i
++)
650 brush
.lbStyle
= BS_SOLID
;
651 brush
.lbColor
= solid_colors
[i
];
653 retval
= lpEnumFunc( &brush
, lParam
);
654 dprintf_gdi( stddeb
, "EnumObjects32: solid brush %08lx, ret=%d\n",
655 solid_colors
[i
], retval
);
659 /* Now enumerate hatched brushes */
660 if (retval
) for (i
= HS_HORIZONTAL
; i
<= HS_DIAGCROSS
; i
++)
662 brush
.lbStyle
= BS_HATCHED
;
663 brush
.lbColor
= RGB(0,0,0);
665 retval
= lpEnumFunc( &brush
, lParam
);
666 dprintf_gdi( stddeb
, "EnumObjects32: hatched brush %d, ret=%d\n",
673 /* FIXME: implement Win32 types */
674 fprintf( stderr
, "EnumObjects32: invalid type %d\n", nObjType
);
681 /***********************************************************************
682 * IsGDIObject (GDI.462)
684 * returns type of object if valid (W95 system programming secrets p. 264-5)
686 BOOL16 WINAPI
IsGDIObject( HGDIOBJ16 handle
)
688 GDIOBJHDR
*object
= (GDIOBJHDR
*) GDI_HEAP_LOCK( handle
);
691 UINT16 magic
= object
->wMagic
;
692 GDI_HEAP_UNLOCK( handle
);
693 if (magic
>= PEN_MAGIC
&& magic
<= METAFILE_DC_MAGIC
)
694 return magic
- PEN_MAGIC
+ 1;
700 /***********************************************************************
701 * SetObjectOwner16 (GDI.461)
703 void WINAPI
SetObjectOwner16( HGDIOBJ16 handle
, HANDLE16 owner
)
709 /***********************************************************************
710 * SetObjectOwner32 (GDI32.386)
712 void WINAPI
SetObjectOwner32( HGDIOBJ32 handle
, HANDLE32 owner
)
718 /***********************************************************************
719 * GdiGetBatchLimit (GDI32.129)
721 DWORD WINAPI
GdiGetBatchLimit(void)
723 return 1; /* FIXME */
727 /***********************************************************************
728 * GdiSetBatchLimit (GDI32.139)
730 DWORD WINAPI
GdiSetBatchLimit( DWORD limit
)
732 return 1; /* FIXME */
736 /***********************************************************************
739 INT16 WINAPI
MulDiv16( INT16 foo
, INT16 bar
, INT16 baz
)
742 if (!baz
) return -32768;
743 ret
= (foo
* bar
) / baz
;
744 if ((ret
> 32767) || (ret
< -32767)) return -32768;
749 /***********************************************************************
750 * MulDiv32 (KERNEL32.391)
752 INT32 WINAPI
MulDiv32( INT32 foo
, INT32 bar
, INT32 baz
)
757 ret
= ((long long)foo
* bar
) / baz
;
758 if ((ret
> 2147483647) || (ret
< -2147483647)) return -1;
762 return (foo
* bar
) / baz
;