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

📄 cmdline.h

📁 < 虚拟机设计与实现> 的source code, linux版本
💻 H
字号:
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                                                                   +
+ cmdline.h - commandline handle                                    +
+                                                                   +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

#ifndef _CMDLINE_H
#define _CMDLINE_H

#include "common.h"

#ifdef OS_WIN 
#include "win32.h"
#else
#include "linux.h"
#endif

#define DBG_CMDLINE		1

#ifdef DBG_CMDLINE
#define DBG_CMDLINE0(str)				printf("handleArguments(): "); printf(str);
#define DBG_CMDLINE1(str,arg1)			printf("handleArguments(): "); printf(str,arg1);
#define DBG_CMDLINE2(str,arg1,arg2)		printf("handleArguments(): "); printf(str,arg1,arg2);
#else
#define DBG_CMDLINE0(str)
#define DBG_CMDLINE1(str,arg1)
#define DBG_CMDLINE2(str,arg1,arg2) 
#endif	

#define DEF_HEAP		   64		/* default heap = 64KB = 65,536 bytes */
#define DEF_STACK		   64		/* default stack = 64KB = 65,536 bytes */

#define FNAME_SIZE	       255		/*maximum size of file name*/
#define MAX_PROGRAM_ARGS	32

struct CmdLine
{
	char * binaryFile;		/* name of the bytecode file to execute */
	U8 heapRequest;			/* RAM to allocate for heap in KB*/
	U8 stackRequest;		/* RAM to allocate for stack in KB*/
	U1 debug;				/* if TRUE, start in debug mode */
	U1 ok;					/*TRUE or FALSE*/
};

struct ProgramArgs
{
	char *args[MAX_PROGRAM_ARGS];	/* program arguments */
	U1 nArgs;						/* number of arguments */
};

struct ApplicationMetaData
{
	char * fileName;	/*cmdline.c in bytes*/
	U8 fileSize;		/*init.c*/
	U8 szSymTbl;		/*init.c*/
	U8 szStrTbl;		/*init.c*/
	U8 szByteCode;		/*init.c*/
	U8 bCodeFileStart;	/*init.c*//* file information */
	U8 bCodeFileEnd;	/*init.c*//*----------------------*/
	U8 ram;				/*init.c*//* memory information */
	U8 heapSize;		/*init.c in bytes*/
	U8 stackSize;		/*init.c in bytes*/
};

extern struct ApplicationMetaData appMetaData;

extern struct ProgramArgs programArgs;

struct CmdLine handleArguments(int argc, char *argv[]);

#endif

⌨️ 快捷键说明

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