You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
2.9 KiB
102 lines
2.9 KiB
/******************************************************************************
|
|
|
|
版权所有 (C), 2018-2099, Radkil
|
|
|
|
******************************************************************************
|
|
文 件 名 : lua_base.h
|
|
版 本 号 : 初稿
|
|
作 者 : Radkil
|
|
生成日期 : 2026年5月24日
|
|
最近修改 :
|
|
功能描述 : lua.c 的头文件
|
|
|
|
修改历史 :
|
|
1.日 期 : 2026年5月24日
|
|
作 者 : Radkil
|
|
修改内容 : 创建文件
|
|
|
|
******************************************************************************/
|
|
|
|
/*----------------------------------------------*
|
|
* 外部变量说明 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 外部函数原型说明 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 内部函数原型说明 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 全局变量 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 模块级变量 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 常量定义 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 宏定义 *
|
|
*----------------------------------------------*/
|
|
|
|
#ifndef __LUA_BASE_H__
|
|
#define __LUA_BASE_H__
|
|
|
|
|
|
#ifdef __cplusplus
|
|
#if __cplusplus
|
|
extern "C"{
|
|
#endif
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
/*==============================================*
|
|
* include header files *
|
|
*----------------------------------------------*/
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
#include <lua.h>
|
|
#include <lauxlib.h>
|
|
#include <lualib.h>
|
|
#include "common.h"
|
|
|
|
/*==============================================*
|
|
* constants or macros define *
|
|
*----------------------------------------------*/
|
|
#define PROMPT "> "
|
|
#define CONT_PROMPT ">> "
|
|
|
|
#define MAX_HISTORY_LINES 10
|
|
#define MAX_HISTORY_LEN 256
|
|
|
|
typedef void (*lua_output)(const char *fmt, ...);
|
|
|
|
/*==============================================*
|
|
* project-wide global variables *
|
|
*----------------------------------------------*/
|
|
extern lua_output lua_print;
|
|
|
|
|
|
/*==============================================*
|
|
* routines' or functions' implementations *
|
|
*----------------------------------------------*/
|
|
int lua_init(lua_output _lua_print);
|
|
int lua_repl(char *_pcBuffer, int _iSize, int _iEcho);
|
|
void luaprint_stdout(const char *fmt, ...);
|
|
|
|
#ifdef __cplusplus
|
|
#if __cplusplus
|
|
}
|
|
#endif
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
#endif /* __LUA_BASE_H__ */
|
|
|