📄 machine_md.h
字号:
/*0001*//*
/*0002./ * Copyright (c) 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
/*0003./ *
/*0004./ * This software is the confidential and proprietary information of Sun
/*0005./ * Microsystems, Inc. ("Confidential Information"). You shall not
/*0006./ * disclose such Confidential Information and shall use it only in
/*0007./ * accordance with the terms of the license agreement you entered into
/*0008./ * with Sun.
/*0009./ *
/*0010./ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
/*0011./ * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
/*0012./ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
/*0013./ * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
/*0014./ * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
/*0015./ * THIS SOFTWARE OR ITS DERIVATIVES.
/*0016./ *
/*0017./ */
/*0018*/
/*0019*//*=========================================================================
/*0020./ * KVM
/*0021./ *=========================================================================
/*0022./ * SYSTEM: KVM
/*0023./ * FILE: machine_md.h (for Windows)
/*0024./ * OVERVIEW: This file is included in every compilation. It contains
/*0025./ * definitions that are specific to the Windows port of KVM.
/*0026./ * AUTHOR: Frank Yellin
/*0027./ * Ioi Lam
/*0028./ * Richard Berlin
/*0029./ * NOTE: This file overrides many of the default compilation
/*0030./ * flags and macros defined in VmCommon/h/main.h.
/*0031./ *=======================================================================*/
/*0032*/
/*0033*//*=========================================================================
/*0034./ * Platform definition
/*0035./ *=======================================================================*/
/*0036*/
/*0037*/#define WINDOWS 1
/*0038*/
/*0039*//*=========================================================================
/*0040./ * Include files
/*0041./ *=======================================================================*/
/*0042*/
/*0043*/#include <stdio.h>
/*0044*/#include <string.h>
/*0045*/#include <stdlib.h>
/*0046*/#include <ctype.h>
/*0047*/#include <time.h>
/*0048*/#include <math.h>
/*0049*/#define WIN32_LEAN_AND_MEAN
/*0050*/#include <windows.h>
/*0051*/#undef CONST
/*0052*/
/*0053*//*=========================================================================
/*0054./ * Platform-specific datatype definitions
/*0055./ *=======================================================================*/
/*0056*/
/*0057*/typedef long Long;
/*0058*/typedef char Boolean;
/*0059*/
/*0060*/#ifdef GCC
/*0061*/typedef long long long64; /* 64-bit signed integer type */
/*0062*/typedef unsigned long long ulong64; /* 64-bit unsigned integer type */
/*0063*/#else
/*0064*/typedef __int64 long64; /* 64-bit signed integer type */
/*0065*/typedef unsigned __int64 ulong64; /* 64-bit unsigned integer type */
/*0066*/#endif
/*0067*/
/*0068*/#ifndef Calendar_md
/*0069*/unsigned long *Calendar_md();
/*0070*/#endif
/*0071*/
/*0072*/#define PATH_SEPARATOR ';'
/*0073*/
/*0074*//*=========================================================================
/*0075./ * Compilation flags and macros that override values defined in main.h
/*0076./ *=======================================================================*/
/*0077*/
/*0078*//* This is a little-endian target platform */
/*0079*/#define LITTLE_ENDIAN 1
/*0080*/
/*0081*//* Make the VM run a little faster (can afford the extra space) */
/*0082*/#define ENABLEFASTBYTECODES 1
/*0083*/
/*0084*//* Use asynchronous native functions on Windows */
/*0085*/#define ASYNCHRONOUS_NATIVE_FUNCTIONS 1
/*0086*/
/*0087*/#define SLEEP_UNTIL(wakeupTime) \
/*0088*/ { long delta = (long)(wakeupTime - CurrentTime_md()); \
/*0089*/ Sleep(delta); \
/*0090*/ }
/*0091*/
/*0092*//*=========================================================================
/*0093./ * Platform-specific macros and function prototypes
/*0094./ *=======================================================================*/
/*0095*/
/*0096*/#define InitializeVM()
/*0097*/#define FinalizeVM()
/*0098*/
/*0099*/#define freeHeap(x) free(x)
/*0100*/#define RandomNumber_md() rand()
/*0101*/
/*0102*/void InitializeWindowSystem();
/*0103*/void FinalizeWindowSystem(void);
/*0104*/
/*0105*/ulong64 sysTimeMillis(void);
/*0106*/
/*0107*//*=========================================================================
/*0108./ * The following are used in several different places, and its worthwhile
/*0109./ * to define them just once
/*0110./ *=======================================================================*/
/*0111*/
/*0112*/void* allocateVirtualMemory_md(long size);
/*0113*/void freeVirtualMemory_md(void *address, long size);
/*0114*/enum { PVM_NoAccess, PVM_ReadOnly, PVM_ReadWrite };
/*0115*/void protectVirtualMemory_md(void *address, long size, int protection);
/*0116*/int getpagesize();
/*0117*/
/*0118*//*=========================================================================
/*0119./ * Graphics system operations
/*0120./ *=======================================================================*/
/*0121*/
/*0122*/void winDrawRectangle(int x, int y, int width, int height, int mode);
/*0123*/void winFillRectangle(int x, int y, int width, int height,
/*0124*/ int cornerDiam, int mode);
/*0125*/void winDrawLine(int x1, int y1, int x2, int y2, int mode);
/*0126*/
/*0127*/int winCharWidth(int c);
/*0128*/void winDrawChar(int c, int x, int y, int mode);
/*0129*/void winRefreshScreen(int x, int y, int width, int height);
/*0130*/void winSetClip(int x, int y, int width, int height);
/*0131*/void winResetClip();
/*0132*/void winCopyRegion(int x, int y, int width, int height, int dstX, int dstY, int mode);
/*0133*/void winCopyRectangle(int srcWin, int dstWin, int x, int y,
/*0134*/ int width, int height, int dstX, int dstY, int mode);
/*0135*/void winDrawMonoBitmap(int x, int y, int width, int height, int rowBytes, char *bitmap);
/*0136*/
/*0137*//*
/*0138./ * Things to make general native code build under Windows
/*0139./ */
/*0140*/
/*0141*/#include <io.h>
/*0142*/#include <fcntl.h>
/*0143*/#include <sys\stat.h>
/*0144*/#include <direct.h>
/*0145*/
/*0146*/#ifndef __GNUC__
/*0147*//*
/*0148./ * The following is already defined in GCC from the Cygwin32 distribution
/*0149./ */
/*0150*/#define open _open
/*0151*/#define close _close
/*0152*/#define read _read
/*0153*/#define write _write
/*0154*/#define access _access
/*0155*/#define umask _umask
/*0156*/#define fstat _fstat
/*0157*/#define stat _stat
/*0158*/#define mkdir _mkdir
/*0159*/
/*0160*/#define S_IFMT _S_IFMT
/*0161*/#define S_IFREG _S_IFREG
/*0162*/#define S_IFCHR _S_IFCHR
/*0163*/#define S_IFFIFO _S_IFIFO
/*0164*/#define S_IFDIR _S_IFDIR
/*0165*/#define S_IFBLK _S_IFBLK
/*0166*/
/*0167*/#define O_BINARY _O_BINARY
/*0168*/
/*0169*/#endif /* __GNUC__ */
/*0170*/
/*0171*/#ifndef S_ISREG
/*0172*/#define S_ISREG(mode) ( ((mode) & S_IFMT) == S_IFREG )
/*0173*/#define S_ISCHR(mode) ( ((mode) & S_IFMT) == S_IFCHR )
/*0174*/#define S_ISFIFO(mode) ( ((mode) & S_IFMT) == S_ISFIFO )
/*0175*/#define S_ISDIR(mode) ( ((mode) & S_IFMT) == S_IFDIR )
/*0176*/#define S_ISBLK(mode) ( ((mode) & S_IFMT) == S_IFBLK )
/*0177*/#endif
/*0178*/
/*0179*/
/*0180*//*
/*0181./ * Thread processing routines
/*0182./ */
/*0183*/
/*0184*/void releaseAsyncThread(void);
/*0185*/void processAcyncThread(void);
/*0186*/void Yield_md(void);
/*0187*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -