📄 rvstdio.h
字号:
/************************************************************************
File Name : rvstdio.h
Description : This file replaces the ANSI stdio.h for portability.
The functions are a one-to-one mapping with the
ANSI functions in stdio.h.
************************************************************************
Copyright (c) 2001 RADVISION Inc. and RADVISION Ltd.
************************************************************************
NOTICE:
This document contains information that is confidential and proprietary
to RADVISION Inc. and RADVISION Ltd.. No part of this document may be
reproduced in any form whatsoever without written prior approval by
RADVISION Inc. or RADVISION Ltd..
RADVISION Inc. and RADVISION Ltd. reserve the right to revise this
publication and make changes without obligation to notify any person of
such revisions or changes.
***********************************************************************/
#if !defined(RV_STDIO_H)
#define RV_STDIO_H
#include "rvccore.h"
#include "rvansi.h"
#include "rverror.h"
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(RV_STDIO_TYPE) || ((RV_STDIO_TYPE != RV_STDIO_ANSI) && \
(RV_STDIO_TYPE != RV_STDIO_OSE_DEBUG) && \
(RV_STDIO_TYPE != RV_STDIO_STUB) && \
(RV_STDIO_TYPE != RV_STDIO_WINCE_DEBUG))
#error RV_STDIO_TYPE not set properly
#endif
/*$
{package:
{name: Stdio}
{superpackage: CCore}
{description:
{p: This module contains ports for standard I/O functions that
require porting based on OS or compiler. }
}
{attributes scope="public":
{attribute: {t: RvInt } {n: RvEOF } {d: End of file flag constant.}}
{attribute: {t: RvFILE* } {n: RvStderr } {d: Standard error stream.}}
{attribute: {t: RvFILE* } {n: RvStdout } {d: Standard output stream.}}
{attribute: {t: RvFILE* } {n: RvStdin } {d: Standard input stream.}}
}
}
$*/
RvStatus RvStdioInit(void);
RvStatus RvStdioEnd(void);
#if (RV_STDIO_TYPE == RV_STDIO_ANSI) || \
(RV_STDIO_TYPE == RV_STDIO_OSE_DEBUG) || \
(RV_STDIO_TYPE == RV_STDIO_WINCE_DEBUG)
#include <stdio.h>
#if (RV_OS_TYPE != RV_OS_TYPE_WINCE) && \
(RV_OS_TYPE != RV_OS_TYPE_VXWORKS) && \
(RV_OS_TYPE != RV_OS_TYPE_PSOS) && \
(RV_OS_TYPE != RV_OS_TYPE_OSE)
/* VXWORKS, PSOS, WINCE & OSE keeps 'qsort()' in stdlib.h */
#include <search.h> /* for 'qsort()' */
#endif
#if (RV_OS_TYPE == RV_OS_TYPE_TRU64)
#include <string.h>
#include <ctype.h>
/* TRU64 keeps qsort() in stdlib.h */
#include <stdlib.h>
#elif (RV_OS_TYPE == RV_OS_TYPE_OSE)
#include <ctype.h> /* for 'isspace()', 'tolower()', 'isdigit()' etc. */
#endif
/* Data Types */
/*$
{type:
{name: RvFILE}
{superpackage: Stdio}
{include: rvstdio.h}
{description:
{p: This type represents a ANSI stdio FILE type for streams.}
}
}
$*/
#define RvFILE FILE
/*$
{type:
{name: RvFpos_t}
{superpackage: Stdio}
{include: rvstdio.h}
{description:
{p: This type represents a ANSI stdio fpos_t type for file position}
}
}
$*/
#define RvFpos_t fpos_t
#define RvL_tmpnam L_tmpnam
/* Standard Streams */
#define RvStderr stderr
#define RvStdout stdout
#define RvStdin stdin
/* Constants */
#define RvEOF EOF
/* Standard char operations for old WinCE versions */
#if (RV_OS_TYPE == RV_OS_TYPE_WINCE) && (RV_OS_VERSION == RV_OS_WINCE_2_11)
void CharToWChar(RvChar CharIn, WCHAR * wCharOut);
RVCOREAPI RvInt RVCALLCONV __cdecl isupper(RvInt);
RVCOREAPI RvInt RVCALLCONV __cdecl islower(RvInt);
RVCOREAPI RvInt RVCALLCONV __cdecl isspace(RvInt);
RVCOREAPI RvInt RVCALLCONV __cdecl isdigit(RvInt);
RVCOREAPI RvInt RVCALLCONV __cdecl isalnum(RvInt);
RVCOREAPI RvSize_t RVCALLCONV __cdecl strspn(const RvChar * s1, const RvChar * s2);
#endif
/* Sorting functions */
#define RvQsort qsort
/* File Operation */
#define RvFopen fopen
#define RvFreopen freopen
#define RvFlush flush
#define RvFclose fclose
#define RvRemove remove
#define RvRename rename
#define RvTmpfile tmpfile
#define RvTmpnam tmpnam
#define RvSetvbuf setvbuf
#define RvSetbuf setbuf
/* Formatted Output */
#define RvVprintf vprintf
#define RvVfprintf vfprintf
#define RvFprintf fprintf
#if (RV_STDIO_TYPE == RV_STDIO_OSE_DEBUG)
#include <dbgprintf.h>
#define RvPrintf dbgprintf
#elif (RV_STDIO_TYPE == RV_STDIO_WINCE_DEBUG)
RVCOREAPI RvInt RVCALLCONV RvOutputDebugPrintf(const RvChar* format, ...);
#define RvPrintf RvOutputDebugPrintf
#else
#define RvPrintf printf
#define RvOutputDebugPrintf( a ) OutputDebugString((LPCTSTR)a)
#endif
/* Formatted Input */
#define RvFscanf fscanf
/* Character Input ans Output Functions */
#define RvFgetc fgetc
#define RvFgets fgets
#define RvFputc fputc
#define RvFputs fputs
#define RvGetc getc
#define RvGetchar getchar
#define RvGets gets
#define RvPutc putc
#define RvPutchar putchar
#define RvPuts puts
#define RvUngetc ungetc
/* Direct Input and Output Functions */
#define RvFread fread
#define RvFwrite frite
/* File Positioning Functions */
#define RvFseek fseek
#define RvFtell ftell
#define RvRewind rewind
#define RvFgetpos fgetpos
#define RvFsetpos fsetpos
/* Error Functions */
#define RvClearerror clearerror
#define RvFeof feof
#define RvFerror ferror
#define RvPerror perror
#elif (RV_STDIO_TYPE == RV_STDIO_STUB)
#include <stdarg.h>
/* Data Types */
#define RvFILE RvInt
#define RvFpos_t RvInt
/* Standard Streams */
#define RvStderr (RvFILE*)0
#define RvStdout (RvFILE*)1
#define RvStdin (RvFILE*)2
/* Constants */
#define RvEOF -1
#define RvL_tmpnam 32
/* Sorting functions */
#define RvQsort qsort
/* File Operation */
RvFILE* RvFopen(const RvChar* filename, const RvChar* mode);
RvFILE* RvFreopen(const RvChar* filename, const RvChar* mode, RvFILE* stream);
RvInt RvFlush(RvFILE* stream);
RvInt RvFclose(RvFILE* stream);
RvInt RvRemove(const RvChar* filename);
RvInt RvRename(const RvChar* oldname, const RvChar* newname);
RvFILE* RvTmpfile(void);
RvChar* RvTmpnam(RvChar s[RvL_tmpnam]);
RvInt RvSetvbuf(RvFILE stream, RvChar* buf, RvInt mode, RvSize_t size);
void RvSetbuf(RvFILE stream, RvChar* buf);
/* Formatted Output */
RVCOREAPI RvInt RVCALLCONV RvPrintf(const RvChar* format, ...);
RVCOREAPI RvInt RVCALLCONV RvFprintf(RvFILE* stream, const RvChar* format, ...);
RVCOREAPI RvInt RVCALLCONV RvVprintf(const RvChar* format, va_list arg);
RVCOREAPI RvInt RVCALLCONV RvVfprintf(RvFILE* stream, const RvChar* format, va_list arg);
/* Formatted Input */
RvInt RvFscanf(RvFILE* stream, const RvChar* format, ...);
RvInt RvScanf(const RvChar* format, ...);
/* Character Input ans Output Functions */
RvInt RvFgetc(RvFILE* stream);
RvChar* RvFgets(RvChar* s, RvInt n, RvFILE* stream);
RvInt RvFputc(RvInt c, RvFILE* stream);
RvInt RvFputs(const RvChar* s, RvFILE* stream);
RvInt RvGetc(RvFILE* stream);
RvInt RvGetchar(void);
RvChar* RvGets(RvChar* s);
RvInt RvPutc(RvInt c, RvFILE* stream);
RvInt RvPutchar(RvInt c);
RvInt RvPuts(const RvChar* s, RvFILE* stream);
RvInt RvUngetc(RvInt c, RvFILE* stream);
/* Direct Input and Output Functions */
RvSize_t RvFread(void* ptr, RvSize_t size, RvSize_t nobj, RvFILE* stream);
RvSize_t RvFwrite(const void* ptr, RvSize_t size, RvSize_t nobj, RvFILE* stream);
/* File Positioning Functions */
RvInt RvFseek(RvFILE* stream, long offset, RvInt origin);
long RvFtell(RvFILE* stream);
void RvRewind(RvFILE* stream);
RvInt RvFgetpos(RvFILE* stream, RvFpos_t* ptr);
RvInt RvFsetpos(RvFILE* stream, const RvFpos_t* ptr);
/* Error Functions */
void RvClearerror(RvFILE* stream);
RvInt RvFeof(RvFILE* stream);
RvInt RvFerror(RvFILE* stream);
void RvPerror(const RvChar* s);
#endif
/* Binary search function */
RVCOREAPI void* RVCALLCONV RvBsearch(
const void* key,
const void* base,
RvSize_t numOfElements,
RvSize_t elementSize,
RvInt (*compareFunc)(const void* key, const void* ));
/* 64bit Arithmetic operations */
#if (RV_OS_TYPE == RV_OS_TYPE_PSOS) && (RV_OS_VERSION == RV_OS_PSOS_2_0)
RVCOREAPI RvInt64 RVCALLCONV Rv64Multiply(RvInt64 num1, RvInt64 num2);
RVCOREAPI RvInt32 RVCALLCONV Rv64Modulu(RvInt64 num1, RvInt64 num2);
RVCOREAPI RvInt64 RVCALLCONV Rv64Divide(RvInt64 num1, RvInt64 num2);
#else
#define Rv64Multiply( a , b ) (a*b)
#define Rv64Modulu( a , b ) (a%b)
#define Rv64Divide( a , b ) (a/b)
#endif
#ifdef __cplusplus
}
#endif
#endif /* Include guard */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -