ÈçºÎд³öרҵµÄCÍ·Îļþ
×öµ½×¨Òµ£¬Ó¦¸ÃÊÇÿ¸öÖ°Òµ³ÌÐòÔ±Ó¦¸ÃÒªÇó×Ô¼º×öµ½µÄ¡£
ÈÃÎÒÃÇ¿´¿´lua
ÊÇ
ÔõôдͷÎļþµÄ¡£
1.License Agreement
License
Agreement
Ó¦¸Ã¼ÓÔÚÿ¸öÍ·ÎļþµÄ¶¥²¿¡£
Lua Sample:
/*
** $Id: lua.h,v 1.175b 2003/03/18 12:31:39 roberto Exp $
** Lua - An Extensible Extension Language
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
**
http://www.lua.org
mailto:info@lua.org
** See Copyright Notice at the end of this file
*/
2.guard define
Õû¸öÍ·ÎļþÓ¦¸ÃÔÚguard
define
Ö®¼ä
#ifndef lua_h
#define
lua_h
#endif
ÁíÍ⣬Èç¹ûÕâ¸öÍ·Îļþ¿ÉÄܸø
c++
ʹÓã¬Òª¼ÓÉÏ
#ifdef __cplusplus
extern
"
C
"
{
#endif
/*
The lines within extern "C"
*/
#ifdef __cplusplus
}
#endif
3.
¾¡Á¿²»ÒªÔÚÍ·ÎļþÖб©Â¶Êý¾Ý½á¹¹
ÕâÑù¿ÉÒÔÓû§¶ÔÄãµÄʵÏÖµÄÒÀÀµ£¬Ò²¼õÉÙÁËÓû§µÄ±àÒëʱ¼ä
typedef
struct
lua_State lua_State;
LUA_API lua_State
*
lua_open (
void
);
LUA_API
void
lua_close (lua_State
*
L);
¿ÉÒÔ¿´µ½ËäÈ»Óû§»áһֱʹÓÃ
lua_State,
µ«ÊDz¢²»ÖªµÀ
lua_State
µÄ
½á¹¹ÊÇʲô
´ÓÒ»¸öʹÓÃ
lua
µÄÀý×Ó³ÌÐò¿ÉÒÔ¿´³ö£º
#include
"
lua.h
"
#include
"
lauxlib.h
"
#include
"
lualib.h
"
int
main(
int
argc,
char
*
argv[])
{
lua_State
*
L
=
lua_open();
const
char
*
buf
=
"
var = 100
"
;
int
var ;
luaopen_base(L);
luaopen_io(L);
lua_dostring(L, buf);
&n
Ïà¹ØÎĵµ£º
½ñÌì¿´K&RµÄÊéµÄʱºò˳±ãÎÂÏ°ÁËCµÄÁíÒ»ÖØÒªÊý¾Ý½á¹¹bit-fields£¬ÎÒÏëbit-fieldsÔÚ±àдµ×²ãÇý¶¯
Çý¶¯³ÌÐòµÄʱºòÓ¦¸Ã±È½ÏºÃÓã¬Ëü¿ÉÒÔÈÆ¿ª"&"ºÍ"|"½øÐÐλ²Ù×÷£¬¶øÇÒ¸ü¼Ó½ÚÔ¼ÄÚ´æ¿Õ¼ä¡£·Ï»°²»¶à˵
ÁË£¬»¹ÊÇÏÈÀ´¿´¿´ËüµÄÕæÃæÄ¿°É£º
bit-fieldÀ´Ô´:
bit-fieldÊÇΪÁ˽ÚÔ¼´æ´¢¿Õ¼ä¶ø´´ÔìµÄÒ»ÖÖÊý¾ ......
Óë &£º ÈκÎλÓÃ&ÔËËãÓë0½áºÏ½á¹ûΪ0£¬Óë1½áºÏ½á¹ûΪÆä±¾Éí£»
»ò | £º ÈκÎλÓÃ|ÔËËãÓë0½áºÏ½á¹ûΪÆä±¾Éí£¬Óë1½áºÏ½á¹ûΪ1£»
Òì»ò ^ £º ÈκÎλÓÃ^ÔËËãÓë0½áºÏ½á¹ûΪÆä±¾Éí£¬Óë1½áºÏÔòÈ¡·´£» ......
ÉÏһƪÀïµÄLAMEÏîÄ¿ÒѾչʾÁËpythonÈçºÎÓëCÓïÑÔ½»»¥£¬µ«³ÌÐòÈÔ²»¹»ÀíÏ룬ÔÚpythonÕâÒ»¶Ë½ö½öÊÇ´«µÝÔ´ÎļþºÍÄ¿±êÎļþµÄ·¾¶£¬ÔÙµ÷ÓÃCÄ£¿éµÄencode·½·¨À´½øÐбàÂ룬µ«ÎÊÌâÔÚÓÚÄãÎÞ·¨¿ØÖÆencodeº¯Êý£¬±ÈÈçÄãÏë±àÂëµÄÔ´ÎļþÈç¹û²»ÊÇÔʼÊý¾Ý£¬¶øÊÇwavÎļþ»òÕßÆäËû¸ñʽÄØ£¿¶ÔÓÚÕâ¸öÎÊÌ⣬ÓÐÁ½ÖÖ·½·¨¿ÉÒÔÑ¡Ôñ£¬Ò»ÖÖÄ£·ÂÇ°ÃæµÄCÄ£ ......
ת
ÔØ×Ôhttp://www.builder.com.cn/
static
ÊÇc++Öкܳ£ÓõÄÐÞÊηû£¬Ëü±»ÓÃÀ´¿ØÖƱäÁ¿µÄ´æ´¢·½Ê½ºÍ¿É¼ûÐÔ£¬ÏÂÃæÎÒ½«´Ó static ÐÞÊηûµÄ²úÉúÔÒò¡¢×÷ÓÃ̸Æð£¬È«Ãæ·ÖÎöstatic
ÐÞÊηûµÄʵÖÊ¡£
¡¡¡¡static µÄÁ½´ó×÷ÓÃ:
¡¡¡¡Ò»¡¢¿ØÖÆ´æ´¢·½Ê½£º
¡¡¡¡static±»ÒýÈëÒÔ¸æÖª±àÒëÆ÷£¬½«±ä ......