📄 imf.h
字号:
/***************************************************************************
* Copyright (c) 1993 - 2001 Accelerated Technology, Inc.
*
* PROPRIETARY RIGHTS of Accelerated Technology are involved in the subject
* matter of this material. All manufacturing, reproduction, use and sales
* rights pertaining to this subject matter are governed by the license
* agreement. The recipient of this software implicity accepts the terms
* of the license.
*
****************************************************************************/
/****************************************************************************
*
* FILENAME VERSION
*
* IMF.H 1.0
*
* COMPONENT
*
* File Abstraction Layer
*
* DESCRIPTION
*
* This file contains the In-Memory File System function prototypes
* and miscellaneous defines.
*
* DATA STRUCTURES
*
* mem_file An In-Memory File System file.
*
* FUNCTIONS
*
* None
*
* DEPENDENCIES
*
* nucleus.h
* target.h
*
****************************************************************************/
#ifndef IMF_H
#define IMF_H
#include "plus/nucleus.h"
#include "net/target.h"
#ifdef __cplusplus
extern "C" { /* C declarations in C++ */
#endif /* _cplusplus */
extern INT p_errno;
#define MAX_FILES 2
#define MAX_FILE_SIZE 40000UL
#define NAME_LENGTH 12
#define PSEEK_SET 0 /* Offset from beginning of file. */
#define PSEEK_CUR 1 /* Offset from current file pointer. */
#define PSEEK_END 2 /* Offset from end of file. */
#define IMF_EOF -1
/* File access flags */
#define IMF_RDONLY 0x0000 /* Open for read only*/
#define IMF_WRONLY 0x0001 /* Open for write only*/
#define IMF_RDWR 0x0002 /* Read/write access allowed.*/
#define IMF_APPEND 0x0008 /* Seek to eof on each write*/
#define IMF_CREAT 0x0100 /* Create the file if it does not exist.*/
#define IMF_TRUNC 0x0200 /* Truncate the file if it already exists*/
#define IMF_EXCL 0x0400 /* Fail if creating and already exists*/
#define IMF_NOSHAREANY 0x0004 /* Wants this open to fail if already
* open. Other opens will fail while
* this open is active */
#define IMF_NOSHAREWRITE 0x0800 /* Wants this opens to fail if already
* open for write. Other open for
* write calls will fail while this
* open is active. */
/* IMF has been allocated 2501-2750 for error codes */
#define IMF_NO_BUFFERS -2501 /* No free buffers to open a new file */
#define IMF_FILE_OPEN -2502 /* File is open */
#define IMF_FILE_CLOSED -2503 /* File is closed */
#define IMF_NO_FILE -2504 /* File does not exist */
#define IMF_INVAL_DESC -2505 /* Invalid file descriptor */
#define IMF_END_FILE -2506 /* Reached end of file */
#define IMF_FILE_EXISTS -2507 /* File already exists */
#define IMF_INVAL_FLAG -2508 /* Invalid flag was passed */
#define IMF_INVAL_BUFFER -2509 /* Invalid buffer */
#define IMF_FILE_READONLY -2510 /* The file cannot be written */
#define IMF_FILE_WRITEONLY -2511 /* The file cannot be read */
#define IMF_BUFFER_FULL -2512 /* No room to write to the buffer */
typedef struct mem_file {
HUGE CHAR *start;
HUGE CHAR *end;
HUGE CHAR *file_ptr;
HUGE CHAR *eof_ptr;
UINT32 max_length;
UINT32 length;
UINT32 flag;
CHAR name[NAME_LENGTH + 1];
INT16 used; /* Used to indicate that a file is in use.*/
INT16 open; /* Used to indicate that a file is currently
open. */
} MEM_FILE;
extern MEM_FILE file_desc_ary[MAX_FILES];
extern NU_MEMORY_POOL System_Memory;
INT IMF_Open(CHAR *path, INT16 flag);
INT IMF_Find_File(CHAR *path, INT16 flag);
INT IMF_Close(INT file);
INT32 IMF_Write(CHAR *buf, INT size, INT file);
INT32 IMF_Read(CHAR *buffer, INT buffersize, INT file_desc);
INT IMF_Delete(CHAR *name);
INT32 IMF_Seek(INT file_desc, INT32 offset, INT16 origin);
INT IMF_Store_Name(CHAR *name, MEM_FILE *r_file);
CHAR * IMF_Fgets(CHAR *line, INT16 size, INT file);
INT IMF_Rename(CHAR *rename_path, CHAR *curr_name);
#ifdef __cplusplus
}
#endif /* _cplusplus */
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -