//打印整个语法树 int TSyntaxTreeAnalyse::Print(TMdbSqlParser * pSqlParser,int iLogType) { //#if 0 ST_SQL_STRUCT & stSqlStruct = pSqlParser->m_stSqlStruct; OutPutInfo(iLogType,"#################SqlStruct start################"); OutPutInfo(iLogType,"=========================================="); OutPutInfo(iLogType,"Insert(%d),delete(%d),update(%d),select(%d)",TK_INSERT,TK_DELETE,TK_UPDATE,TK_SELECT); OutPutInfo(iLogType,"[type = %d],[tablename = %s][alias = %s][pMdbTable = %p][pShmDSN= %p][pScanAllIndex= %p][vIndexUsed=%d]", stSqlStruct.iSqlType, ReplaceNull(stSqlStruct.sTableName), ReplaceNull(stSqlStruct.sAlias), stSqlStruct.pMdbTable,stSqlStruct.pShmDSN, stSqlStruct.pScanAllIndex, stSqlStruct.vIndexUsed.size()); OutPutInfo(iLogType,"===========[index used]=================="); PrintIndex(stSqlStruct.vIndexUsed,0,iLogType); OutPutInfo(iLogType,"===========[column list]=================="); PrintExprList(stSqlStruct.pColList,0,iLogType); OutPutInfo(iLogType,"===========[where]========================"); PrintExpr("root",stSqlStruct.pWhere,0,iLogType); OutPutInfo(iLogType,"===========[group by]========================"); PrintExprList(stSqlStruct.pGroupby,0,iLogType); OutPutInfo(iLogType,"===========[having]========================"); PrintExpr("root",stSqlStruct.pHaving,0,iLogType); OutPutInfo(iLogType,"===========[optimised where]=================="); PrintWhereClause(iLogType,stSqlStruct.tWhereOrClause); OutPutInfo(iLogType,"===========[orderby]======================"); PrintExprList(stSqlStruct.pOrderby,0,iLogType); OutPutInfo(iLogType,"===========[limit]========================"); PrintExpr("root",stSqlStruct.pstLimit,0,iLogType); OutPutInfo(iLogType,"===========[offset]======================="); PrintExpr("root",stSqlStruct.pstOffset,0,iLogType); OutPutInfo(iLogType,"===========[idlist]======================="); PrintIdList(stSqlStruct.pstIdList,0,iLogType); OutPutInfo(iLogType,"=========================================="); PrintValues(pSqlParser,iLogType); OutPutInfo(iLogType,"#################SqlStruct end#################"); _ST_DDL_SQL_STRUCT * pstDDLSqlStruct = pSqlParser->m_pDDLSqlStruct; OutPutInfo(iLogType,"###############DDLSqlStruct start##############"); if(pstDDLSqlStruct) { OutPutInfo(iLogType,"[sqltype = [%d][%d]][IfNE = %d]",pstDDLSqlStruct->iSqlType[0],pstDDLSqlStruct->iSqlType[1] ,pstDDLSqlStruct->bIfNE); PrintTable(pstDDLSqlStruct->pTable,iLogType); } OutPutInfo(iLogType,"###############DDLSqlStruct end################"); //#endif return 0; }
/* Print out all the nodes in an index. ** Prints from root downward. */ void PrintIndex(Node_t * n) { int i; Node_t *nn; assert(n); assert(n->level >= 0); if (n->level > 0) { for (i = 0; i < NODECARD; i++) { if ((nn = n->branch[i].child) != NULL) PrintIndex(nn); } } PrintNode(n); }
void GetNetConfig::PrintAdapterInfo(PIP_ADAPTER_INFO pAdapter) { m_pAdapter = pAdapter; PrintName(); // Print Adepter Name & Description PrintMACaddress(); // Print MAC address PrintIndex(); // Print Combo Index & Index PrintIPV4Address(); PrintMaskAddress(); PrintGatewayAddress(); PrintDNSAddress(); if ((m_nOptions & pt_other) == pt_other) { printf("\n"); } PrintDHCP(); PrintWINS(); }
int main() { MapData md = {4, "hello"}; boost::fusion::for_each(md, Printer()); typedef boost::mpl::range_c<int, 0, boost::fusion::result_of::size<MapData>::value> md_range; //boost::mpl::for_each<md_range>(); boost::mpl::for_each<md_range>(PrintIndex(md)); std::vector<int> v(10, 10); //std::reference_wrapper<int> ri(v[5]); auto ri = std::ref(v[5]); ri.get() = 45; boost::copy(v, std::ostream_iterator<int>(std::cout, ", ")); std::cout << std::endl; return 0; }
void PlayBot() { printf("\n\nAt Any Time In The Game If You Want To See The Grid Indexing In Which You Have To Make A Move\n\n"); printf("During Enter A Move Command...Just Press 0 And Press Enter \n\n"); BOARD *board=new BOARD; SetStart(board); printf("The Starting Board\n\n"); PrintBoard(board); char Inp[200]; int Side; printf("\nChoose Your Side...\n\n0. For Black\n1. For White\n"); scanf("%d",&Side); if(Side==0) { MOVE *list1=new MOVE; GenMoves(board,list1); vector<int>BestMove1=SearchPos(board,8); MakeMove(board,BestMove1); PrintBoard(board); } while(1) { printf("\n\nEnter Your Move\n"); getchar(); scanf("%[^\n]",&Inp); if(Inp[0]=='0') { PrintIndex(); continue; } else if(Inp[0]=='1') { printf("\nYour Possible MoveList is\n"); MOVE *YourMoveList=new MOVE; GenMoves(board,YourMoveList); PrintMoveList(YourMoveList); } vector<int>Move=ParseMove(Inp); if(MoveExists(board,Move)) MakeMove(board,Move); else { MOVE *User=new MOVE; GenMoves(board,User); if(User->Count==0) { printf("Sorry You Lost\n\n"); break; } else printf("Invalid Move...Enter Again\n\n"); continue; } PrintBoard(board); printf("-----------------------------------Bot's Turn----------------------------------\n"); MOVE *Bot=new MOVE; GenMoves(board,Bot); if(Bot->Count==0) { printf("--------------------------Congratulations You Win--------------------------\n"); break; } vector<int>BestMove=SearchPos(board,8); MakeMove(board,BestMove); PrintBoard(board); } StartGame(); }