-
大小: 869KB文件類型: .gz金幣: 1下載: 0 次發(fā)布日期: 2021-06-05
- 語言: 其他
- 標(biāo)簽: ctemplate-2.??
資源簡(jiǎn)介
ctemplate-2.2.tar
代碼片段和文件信息
/*?Copyright?(c)?2007?Google?Inc.
?*?All?rights?reserved.
?*
?*?Redistribution?and?use?in?source?and?binary?forms?with?or?without
?*?modification?are?permitted?provided?that?the?following?conditions?are
?*?met:
?*
?*?????*?Redistributions?of?source?code?must?retain?the?above?copyright
?*?notice?this?list?of?conditions?and?the?following?disclaimer.
?*?????*?Redistributions?in?binary?form?must?reproduce?the?above
?*?copyright?notice?this?list?of?conditions?and?the?following?disclaimer
?*?in?the?documentation?and/or?other?materials?provided?with?the
?*?distribution.
?*?????*?Neither?the?name?of?Google?Inc.?nor?the?names?of?its
?*?contributors?may?be?used?to?endorse?or?promote?products?derived?from
?*?this?software?without?specific?prior?written?permission.
?*
?*?THIS?SOFTWARE?IS?PROVIDED?BY?THE?COPYRIGHT?HOLDERS?AND?CONTRIBUTORS
?*?“AS?IS“?AND?ANY?EXPRESS?OR?IMPLIED?WARRANTIES?INCLUDING?BUT?NOT
?*?LIMITED?TO?THE?IMPLIED?WARRANTIES?OF?MERCHANTABILITY?AND?FITNESS?FOR
?*?A?PARTICULAR?PURPOSE?ARE?DISCLAIMED.?IN?NO?EVENT?SHALL?THE?COPYRIGHT
?*?OWNER?OR?CONTRIBUTORS?BE?LIABLE?FOR?ANY?DIRECT?INDIRECT?INCIDENTAL
?*?SPECIAL?EXEMPLARY?OR?CONSEQUENTIAL?DAMAGES?(INCLUDING?BUT?NOT
?*?LIMITED?TO?PROCUREMENT?OF?SUBSTITUTE?GOODS?OR?SERVICES;?LOSS?OF?USE
?*?DATA?OR?PROFITS;?OR?BUSINESS?INTERRUPTION)?HOWEVER?CAUSED?AND?ON?ANY
?*?THEORY?OF?LIABILITY?WHETHER?IN?CONTRACT?STRICT?LIABILITY?OR?TORT
?*?(INCLUDING?NEGLIGENCE?OR?OTHERWISE)?ARISING?IN?ANY?WAY?OUT?OF?THE?USE
?*?OF?THIS?SOFTWARE?EVEN?IF?ADVISED?OF?THE?POSSIBILITY?OF?SUCH?DAMAGE.
?*?---
?*
?*?Author:?falmeida@google.com?(Filipe?Almeida)
?*/
#include?
#include?
#include?
#include?
#include?“htmlparser/statemachine.h“
/*?So?we?can?support?both?C?and?C++?compilers?we?use?the?CAST()?macro?instead
?*?of?using?C?style?casts?or?static_cast<>()?directly.
?*/
#ifdef?__cplusplus
??#define?CAST(type?expression)?(static_cast(expression))
#else
??#define?CAST(type?expression)?((type)(expression))
#endif
#ifdef?__cplusplus
namespace?HTMLPARSER_NAMESPACE?{
#endif
#define?MAX_CHAR_8BIT?256
/*?Populates?the?statemachine?definition.
?*/
void?statemachine_definition_populate(statemachine_definition?*def
??????????????????????????????????????const?int*?const*?transition_table
??????????????????????????????????????const?char*?const*?state_names)
{
??assert(def?!=?NULL);
??assert(transition_table?!=?NULL);
??def->transition_table?=?transition_table;
??def->state_names?=?state_names;
}
/*?Add‘s?the?callback?for?the?event?in_state?that?is?called?when?the
?*?statemachine?is?in?state?st.
?*
?*?This?event?is?called?everytime?the?the?statemachine?is?in?the?specified
?*?state?forevery?character?in?the?input?stream?even?if?the?state?remains
?*?the?same.
?*
?*?This?is?event?is?the?last?event?to?be?called?and?is?fired?after?both?events
?*?exit_state?and?enter_state.
?*/
void?statemachine_in_state(statemachine_definition?*def?int?st
???????????????????????????state
評(píng)論
共有 條評(píng)論