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

📄 errors.h

📁 COP8 CPU的一个解释型BASIC源码
💻 H
字号:
////////////////////////////////////////////////////////////////
//
//                S C R I P T H E R M
//             A SCRIPTABLE THERMOMETER
// 
// entry of the National Semiconductor COP8FLASH Design Contest
//        submitted by Alberto Ricci Bitti (C) 2001
//              a.riccibitti@ra.nettuno.it
//
//--------------------------------------------------------------
//       FOR A BETTER VIEW SET TAB SIZE=4, INDENT SIZE=4
//--------------------------------------------------------------
// FILE   : errors.h
// PURPOSE: prints error message and aborts current task
//          using a setjmp
//          See also the #defines in error.h 
//
////////////////////////////////////////////////////////////////

#ifndef ERRORS_INCLUDED
#define ERRORS_INCLUDED

#include <setjmp.h>

// error messages
//ensure that strings match the type_error enumeration
#define error_messages_initilializer {		\
		"Syntax error",						\
		"Unbalanced parens",				\
		"No expression present",			\
		"Not a variable/procedure",			\
		"Expected: THEN",					\
		"Program too complex",				\
		"Repeat/Ifs unbalanced"				\
		"Too many variables/procedures"		\
		};

typedef enum {	
	SYNTAX_ERROR,		UNBALANCED_PARENS,	NO_EXPRESSION,		EXPECTED_NAME, 
	EXPECTED_THEN,  	NESTING_TOO_DEEP,	NESTING_UNBALANCED, TOO_MANY_NAMES,
} type_error;


#define error_occurred()		setjmp( error_mark )

//issues the specified error if the condition is not met
#define ensure( condition, error )  { if (!(condition)) syntax_error(error); }

extern void syntax_error(type_error error); 

#endif

⌨️ 快捷键说明

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