int CAht::BuildPartsSub( int id, char *fname ) { // 簡易ahtパース // int i,res,maxline; CStrNote note; CMemBuf tmp; AHTPARTS *p; char s1[256]; p = GetParts( id ); if ( p == NULL ) return -2; p->classname[0] = 0; p->name[0] = 0; p->icon = 0; res = tmp.PutFile( fname ); if ( res < 0 ) { return -1; } note.Select( tmp.GetBuffer() ); maxline = note.GetMaxLine(); getpath( fname, p->name, 1+8+16 ); // 仮にファイル名を入れておく for(i=0;i<maxline;i++) { pickptr = 0; note.GetLine( linebuf, i, 255 ); PickLineBuffer( s1 ); if ( tstrcmp( s1,"#aht" ) ) { PickLineBuffer( s1 ); if ( tstrcmp( s1,"iconid" ) ) { PickLineBuffer( s1 ); p->icon = atoi( s1 ); } if ( tstrcmp( s1,"name" ) ) { PickLineBuffer( s1 ); strcpy( p->name, s1 ); } if ( tstrcmp( s1,"class" ) ) { PickLineBuffer( s1 ); strcpy( p->classname, s1 ); } } } return 0; }
EXPORT BOOL WINAPI sortstr( HSPEXINFO *hei, int p1, int p2, int p3 ) { // // sortstr val, order (type$202) // int i,len,sflag,size; char *p; char *psrc; PVal *pv; APTR ap; CMemBuf buf; ap = hei->HspFunc_prm_getva( &pv ); // パラメータ1:変数 sflag = hei->HspFunc_prm_getdi( 0 ); // パラメータ2:数値 if (( pv->flag != 2 )||( pv->len[2] != 0 )||( ap != 0 )) return -1; len = pv->len[1]; DataIni( len ); for(i=0;i<len;i++) { int pos = buf.GetSize(); p = (char *)Hsp3GetBlockSize( hei, pv, i, &size ); buf.PutStrBlock( p ); dtmp[i].as.ikey = pos; dtmp[i].info = i; } for(i=0;i<len;i++) { dtmp[i].as.skey = buf.GetBuffer() + dtmp[i].as.ikey; } BubbleSortStr( dtmp, len, sflag ); for(i=0;i<len;i++) { psrc = dtmp[i].as.skey; hei->HspFunc_prm_setva( pv, i, HSPVAR_FLAG_STR, psrc ); // 変数に値を代入 } return 0; }