int Phrasing( ChewingData *pgdata ) { TreeDataType treeData; InitPhrasing( &treeData ); FindInterval( pgdata, &treeData ); SetInfo( pgdata->nPhoneSeq, &treeData ); Discard1( &treeData ); Discard2( &treeData ); SaveList( &treeData ); CountMatchCnnct( &treeData, pgdata->bUserArrCnnct, pgdata->nPhoneSeq ); SortListByScore( &treeData ); NextCut( &treeData, &pgdata->phrOut ); #ifdef ENABLE_DEBUG ShowList( &treeData ); DEBUG_FLUSH; #endif /* set phrasing output */ OutputRecordStr( pgdata, pgdata->phrOut.chiBuf, sizeof(pgdata->phrOut.chiBuf), ( treeData.phList )->arrIndex, ( treeData.phList )->nInter, pgdata->phoneSeq, pgdata->nPhoneSeq, pgdata->selectStr, pgdata->selectInterval, pgdata->nSelect, &treeData ); SaveDispInterval( &pgdata->phrOut, &treeData ); /* free "phrase" */ CleanUpMem( &treeData ); return 0; }
int Phrasing( ChewingData *pgdata, /* FIXME: Remove other parameters since they are all in pgdata. */ PhrasingOutput *ppo, uint16_t phoneSeq[], int nPhoneSeq, char selectStr[][ MAX_PHONE_SEQ_LEN * MAX_UTF8_SIZE + 1 ], IntervalType selectInterval[], int nSelect, int bArrBrkpt[], int bUserArrCnnct[] ) { TreeDataType treeData; InitPhrasing( &treeData ); FindInterval( pgdata, phoneSeq, nPhoneSeq, selectStr, selectInterval, nSelect, bArrBrkpt, &treeData ); SetInfo( nPhoneSeq, &treeData ); Discard1( &treeData ); Discard2( &treeData ); SaveList( &treeData ); CountMatchCnnct( &treeData, bUserArrCnnct, nPhoneSeq ); SortListByScore( &treeData ); NextCut( &treeData, ppo ); #ifdef ENABLE_DEBUG ShowList( &treeData ); DEBUG_FLUSH; #endif /* set phrasing output */ OutputRecordStr( pgdata, ppo->chiBuf, sizeof(ppo->chiBuf), ( treeData.phList )->arrIndex, ( treeData.phList )->nInter, phoneSeq, nPhoneSeq, selectStr, selectInterval, nSelect, &treeData ); SaveDispInterval( ppo, &treeData ); /* free "phrase" */ CleanUpMem( &treeData ); return 0; }
//------------------------------------------------------------------------ // Name: DoExport() // Desc: Start the exporter! //------------------------------------------------------------------------ int SMDExporter::DoExport( const TCHAR* name,ExpInterface* ei,Interface* i, BOOL suppressPrompts,DWORD options ) { // Set a global prompt display switch showPrompts = suppressPrompts ? FALSE : TRUE; exportSelected = (options & SCENE_EXPORT_SELECTED) ? TRUE : FALSE; // Store the Interface pointer m_ip = i; m_sFilename = name; if( showPrompts ) { // If user click "Cancel" then exit the plug-in if( !DialogBoxParam(hInstance,"SMDExporterDlg",m_ip->GetMAXHWnd(),ExporterDlgProc,(LPARAM)this) ) return TRUE; } // Open a file to write data m_pFile = fopen( name,"wb" ); if( !m_pFile ) return FALSE; // Startup the progress bar. m_ip->ProgressStart( GetString(IDS_PROGRESS_MSG),TRUE,fn,NULL ); // Get the total node count by traversing the scene // It's nice to have a accurate progress bar m_nTotalNodeCount = 0; m_nCurNode = 0; PreProcess( m_ip->GetRootNode(),m_nTotalNodeCount ); // Call our node Enumerator. // The nodeEnum function will recourse itself and // Export each object found in the scene int numChildren = m_ip->GetRootNode()->NumberOfChildren(); fputc( 'S',m_pFile ); fputc( 'M',m_pFile ); fputc( 'D',m_pFile ); fputc( '\0',m_pFile ); ExportBinaryHeader(); // Check the count of mesh m_nNumMeshes = m_nTotalNodeCount; m_pMeshes = new SMDMESH[m_nNumMeshes]; memset( m_pMeshes,0,sizeof(SMDMESH)*m_nNumMeshes ); for( int c=0;c<numChildren;c++ ) { if( m_ip->GetCancel() ) break; nodeEnum( m_ip->GetRootNode()->GetChildNode(c) ); } // Exported all datas, Close the file m_ip->ProgressEnd(); fclose( m_pFile ); // Clean up the memory CleanUpMem(); return TRUE; }