⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _win16.h

📁 gaca源码
💻 H
📖 第 1 页 / 共 2 页
字号:
#define _MD_EINTR                 WSAEINTR
#define _MD_EINVAL                EINVAL
#define _MD_EISCONN               WSAEISCONN
#define _MD_ENETUNREACH           WSAENETUNREACH
#define _MD_ENOENT                ENOENT
#define _MD_ENOTCONN              WSAENOTCONN
#define _MD_ENOTSOCK              WSAENOTSOCK
#define _MD_EOPNOTSUPP            WSAEOPNOTSUPP
#define _MD_EWOULDBLOCK           WSAEWOULDBLOCK
#define _MD_GET_SOCKET_ERROR()    WSAGetLastError()
#define _MD_SET_SOCKET_ERROR(_err) WSASetLastError(_err)

#define _MD_INIT_FILEDESC(fd)
#define _MD_MAKE_NONBLOCK             _PR_MD_MAKE_NONBLOCK
#define _MD_SHUTDOWN                  _PR_MD_SHUTDOWN
#define _MD_LISTEN                      _PR_MD_LISTEN
#define _MD_CLOSE_SOCKET              _PR_MD_CLOSE_SOCKET
#define _MD_SENDTO                    _PR_MD_SENDTO
#define _MD_RECVFROM                  _PR_MD_RECVFROM
#define _MD_SOCKETPAIR(s, type, proto, sv) -1
#define _MD_GETSOCKNAME               _PR_MD_GETSOCKNAME
#define _MD_GETPEERNAME               _PR_MD_GETPEERNAME
#define _MD_GETSOCKOPT                _PR_MD_GETSOCKOPT
#define _MD_SETSOCKOPT                _PR_MD_SETSOCKOPT
#define _MD_SELECT                    select
#define _MD_FSYNC                     _PR_MD_FSYNC
#define _MD_SOCKETAVAILABLE           _PR_MD_SOCKETAVAILABLE

#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT(x)       (*x++)
#define _MD_ATOMIC_ADD(ptr, val)      ((*x) += val)
#define _MD_ATOMIC_DECREMENT(x)       (*x--)
#define _MD_ATOMIC_SET(x,y)           (*x, y)

#define _MD_INIT_IO                   _PR_MD_INIT_IO

/* win95 doesn't have async IO */
#define _MD_SOCKET                    _PR_MD_SOCKET
#define _MD_CONNECT                   _PR_MD_CONNECT
#define _MD_ACCEPT                    _PR_MD_ACCEPT
#define _MD_BIND                      _PR_MD_BIND
#define _MD_RECV                      _PR_MD_RECV
#define _MD_SEND                      _PR_MD_SEND

#define _MD_CHECK_FOR_EXIT()

/* --- Scheduler stuff --- */
#define _MD_PAUSE_CPU                 _PR_MD_PAUSE_CPU

/* --- DIR stuff --- */
#define PR_DIRECTORY_SEPARATOR        '\\'
#define PR_DIRECTORY_SEPARATOR_STR    "\\"
#define PR_PATH_SEPARATOR		';'
#define PR_PATH_SEPARATOR_STR		";"
#define _MD_OPEN_DIR                  _PR_MD_OPEN_DIR
#define _MD_CLOSE_DIR                 _PR_MD_CLOSE_DIR
#define _MD_READ_DIR                  _PR_MD_READ_DIR

/* --- Segment stuff --- */
#define _MD_INIT_SEGS()
#define _MD_ALLOC_SEGMENT           _MD_AllocSegment
#define _MD_FREE_SEGMENT            _MD_FreeSegment

/* --- Environment Stuff --- */
#define _MD_GET_ENV                 _PR_MD_GET_ENV
#define _MD_PUT_ENV                 _PR_MD_PUT_ENV

/* --- Threading Stuff --- */
#define _MD_DEFAULT_STACK_SIZE      32767L
#define _MD_INIT_THREAD             _PR_MD_INIT_THREAD
#define _MD_CREATE_THREAD(t,f,p,sc,st,stsiz) (PR_SUCCESS)
#define _MD_YIELD                   _PR_MD_YIELD
#define _MD_SET_PRIORITY(t,p)            
#define _MD_CLEAN_THREAD(t)
#define _MD_SETTHREADAFFINITYMASK   _PR_MD_SETTHREADAFFINITYMASK
#define _MD_GETTHREADAFFINITYMASK   _PR_MD_GETTHREADAFFINITYMASK
#define _MD_EXIT_THREAD
#define _MD_SUSPEND_THREAD          _PR_MD_SUSPEND_THREAD
#define _MD_RESUME_THREAD           _PR_MD_RESUME_THREAD
#define _MD_SUSPEND_CPU             _PR_MD_SUSPEND_CPU
#define _MD_RESUME_CPU              _PR_MD_RESUME_CPU
#define _MD_BEGIN_SUSPEND_ALL()
#define _MD_BEGIN_RESUME_ALL()
#define _MD_END_SUSPEND_ALL()
#define _MD_END_RESUME_ALL()

/* --- Lock stuff --- */
/*
** Win16 does not need MD locks.
*/
#define _PR_LOCK                    _MD_LOCK
#define _PR_UNLOCK                  _MD_UNLOCK

#define _MD_NEW_LOCK(l)             (PR_SUCCESS)
#define _MD_FREE_LOCK(l)
#define _MD_LOCK(l)
#define _MD_TEST_AND_LOCK(l)        (-1)
#define _MD_UNLOCK(l)

/* --- lock and cv waiting --- */
#define _MD_WAIT                      _PR_MD_WAIT
#define _MD_WAKEUP_WAITER(a)
#define _MD_WAKEUP_CPUS               _PR_MD_WAKEUP_CPUS

/* --- CVar ------------------- */
#define _MD_WAIT_CV					  _PR_MD_WAIT_CV
#define _MD_NEW_CV					  _PR_MD_NEW_CV
#define _MD_FREE_CV					  _PR_MD_FREE_CV
#define _MD_NOTIFY_CV				  _PR_MD_NOTIFY_CV	
#define _MD_NOTIFYALL_CV			  _PR_MD_NOTIFYALL_CV

   /* XXXMB- the IOQ stuff is certainly not working correctly yet. */
#define _MD_IOQ_LOCK()                
#define _MD_IOQ_UNLOCK()              


/* --- Initialization stuff --- */
NSPR_API(void) _MD_INIT_RUNNING_CPU(struct _PRCPU *cpu );
#define _MD_START_INTERRUPTS()
#define _MD_STOP_INTERRUPTS()
#define _MD_DISABLE_CLOCK_INTERRUPTS()
#define _MD_ENABLE_CLOCK_INTERRUPTS()
#define _MD_BLOCK_CLOCK_INTERRUPTS()
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
#define _MD_EARLY_INIT                  _PR_MD_EARLY_INIT
#define _MD_FINAL_INIT                  _PR_MD_FINAL_INIT
#define _MD_INIT_CPUS()

/* --- User Threading stuff --- */
#define _MD_EXIT

#define _MD_CLEANUP_BEFORE_EXIT              _PR_MD_CLEANUP_BEFORE_EXIT

/* --- Intervals --- */
#define _MD_INTERVAL_INIT                 _PR_MD_INTERVAL_INIT
#define _MD_GET_INTERVAL                  _PR_MD_GET_INTERVAL
#define _MD_INTERVAL_PER_SEC              _PR_MD_INTERVAL_PER_SEC
#define _MD_INTERVAL_PER_MILLISEC()       (_PR_MD_INTERVAL_PER_SEC() / 1000)
#define _MD_INTERVAL_PER_MICROSEC()       (_PR_MD_INTERVAL_PER_SEC() / 1000000)

/* --- Scheduler stuff --- */
#define LOCK_SCHEDULER()                 0
#define UNLOCK_SCHEDULER()               0
#define _PR_LockSched()                	 0
#define _PR_UnlockSched()                0

/* --- Initialization stuff --- */
#define _MD_INIT_LOCKS()

/* --- Stack stuff --- */
#define _MD_INIT_STACK                   _PR_MD_INIT_STACK
#define _MD_CLEAR_STACK(stack)

/*
** Watcom needs to see this to make the linker work.
**
*/
NSPR_API(void) _PR_NativeDestroyThread(PRThread *thread);
NSPR_API(void) _PR_UserDestroyThread(PRThread *thread);


/*
** If thread emulation is used, then setjmp/longjmp stores the register
** state of each thread.
**
** CatchBuf layout:
**  context[0] - IP
**  context[1] - CS
**  context[2] - SP
**  context[3] - BP
**  context[4] - SI
**  context[5] - DI
**  context[6] - DS
**  context[7] - ?? (maybe flags)
**  context[8] - SS
*/
#define PR_CONTEXT_TYPE     CATCHBUF
#define PR_NUM_GCREGS       9

#define _MD_GET_SP(thread)  ((thread)->md.SP)
#define CONTEXT(_t)  ((_t)->md.context)

/*
** Initialize a thread context to run "e(o,a)" when started
*/
#define _MD_INIT_CONTEXT(_t, sp, epa, stat )   \
{                                              \
     *(stat) = PR_TRUE;                        \
     Catch((_t)->md.context );             \
     (_t)->md.context[0] = OFFSETOF(epa);         \
     (_t)->md.context[1] = SELECTOROF(epa);                       \
     (_t)->md.context[2] = OFFSETOF(_pr_top_of_task_stack - 64);  \
     (_t)->md.context[3]  = 0;                 \
}

#define _MD_SWITCH_CONTEXT(_t)                 \
    if (!Catch((_t)->md.context)) {            \
        int     garbCollPlaceHolder;           \
        (_t)->md.errcode = errno;              \
        (_t)->md.SP = &garbCollPlaceHolder;    \
        _PR_Schedule();                        \
    }

#define _MD_SAVE_CONTEXT(_t)                    \
    {                                           \
        int     garbCollPlaceHolder;            \
        Catch((_t)->md.context);                \
        (_t)->md.errcode = errno;               \
        (_t)->md.SP = &garbCollPlaceHolder;     \
    }

/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _PR_MD_RESTORE_CONTEXT  _MD_RESTORE_CONTEXT

/*
 * Memory-mapped files
 */

struct _MDFileMap {
    PRInt8 unused;
};

extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap

extern PRInt32 _MD_GetMemMapAlignment(void);
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment

extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
        PRUint32 len);
#define _MD_MEM_MAP _MD_MemMap

extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
#define _MD_MEM_UNMAP _MD_MemUnmap

extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap


/* --- Error mapping ----------------------------------- */
extern void _PR_MD_map_error( int err );

#define _PR_MD_MAP_OPENDIR_ERROR        _PR_MD_map_error
#define _PR_MD_MAP_CLOSEDIR_ERROR       _PR_MD_map_error
#define _PR_MD_MAP_READDIR_ERROR        _PR_MD_map_error
#define _PR_MD_MAP_DELETE_ERROR         _PR_MD_map_error
#define _PR_MD_MAP_STAT_ERROR           _PR_MD_map_error
#define _PR_MD_MAP_FSTAT_ERROR          _PR_MD_map_error
#define _PR_MD_MAP_RENAME_ERROR         _PR_MD_map_error
#define _PR_MD_MAP_ACCESS_ERROR         _PR_MD_map_error
#define _PR_MD_MAP_MKDIR_ERROR          _PR_MD_map_error
#define _PR_MD_MAP_RMDIR_ERROR          _PR_MD_map_error
#define _PR_MD_MAP_READ_ERROR           _PR_MD_map_error
#define _PR_MD_MAP_TRANSMITFILE_ERROR   _PR_MD_map_error
#define _PR_MD_MAP_WRITE_ERROR          _PR_MD_map_error
#define _PR_MD_MAP_LSEEK_ERROR          _PR_MD_map_error
#define _PR_MD_MAP_FSYNC_ERROR          _PR_MD_map_error
#define _PR_MD_MAP_CLOSE_ERROR          _PR_MD_map_error
#define _PR_MD_MAP_SOCKET_ERROR         _PR_MD_map_error
#define _PR_MD_MAP_RECV_ERROR           _PR_MD_map_error
#define _PR_MD_MAP_RECVFROM_ERROR       _PR_MD_map_error
#define _PR_MD_MAP_SEND_ERROR           _PR_MD_map_error
#define _PR_MD_MAP_SENDTO_ERROR         _PR_MD_map_error
#define _PR_MD_MAP_ACCEPT_ERROR         _PR_MD_map_error
#define _PR_MD_MAP_ACCEPTEX_ERROR       _PR_MD_map_error
#define _PR_MD_MAP_CONNECT_ERROR        _PR_MD_map_error
#define _PR_MD_MAP_BIND_ERROR           _PR_MD_map_error
#define _PR_MD_MAP_LISTEN_ERROR         _PR_MD_map_error
#define _PR_MD_MAP_SHUTDOWN_ERROR       _PR_MD_map_error
#define _PR_MD_MAP_GETSOCKNAME_ERROR    _PR_MD_map_error
#define _PR_MD_MAP_GETPEERNAME_ERROR    _PR_MD_map_error
#define _PR_MD_MAP_GETSOCKOPT_ERROR     _PR_MD_map_error
#define _PR_MD_MAP_SETSOCKOPT_ERROR     _PR_MD_map_error
#define _PR_MD_MAP_OPEN_ERROR           _PR_MD_map_error
#define _PR_MD_MAP_GETHOSTNAME_ERROR    _PR_MD_map_error
#define _PR_MD_MAP_SELECT_ERROR         _PR_MD_map_error
#define _PR_MD_MAP_LOCKF_ERROR          _PR_MD_map_error
#define _PR_MD_MAP_WSASTARTUP_ERROR     _PR_MD_map_error

#endif /* nspr_win16_defs_h___ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -