;makeExforceHs.as ExforceのマニュアルからExforce.hsを作る #include "anthspex.as" maxOBufLen=161000 ver="3.08" maxCatLen=63 maxSLen=260 sdim obuf,maxOBufLen+1 sdim path,260 sdim ofile,260 sdim lbuf,1000 sdim s,maxSLen+1 ;目次ファイル file=curdir+"\\Efhelp\\Ef_func.htm" exist file: flen=strsize if flen<0: dialog file+"が見つかりません": end lastchar p,file,'\' strmid path,file,0,p prog="Exforce" ;読み込み sdim buf,flen+1 bload file,buf ;出力ファイル obuf=";\n;HSP help manager用 ヘルプファイル\n;\n\n" obuf+="%type\nユーザー拡張命令\n%ver\n"+ver+"\n%date\n" gettime c,0: s=""+c: gettime t,1: str t,2: s+="."+t int t: gettime t,3: str t,2: s+="."+t obuf+=s+"\n%author\n佐藤 寛之(FORCE)\n%dll\nExforce\n%url\n" obuf+="http://hp.vector.co.jp/authors/VA015266/\n%note\n" obuf+="Exforce for HSP\n\n" strlen obuflen,obuf p=0 ;分類名 instrj buf,"● ",p: p=stat+3 repeat title ""+p+"/"+flen if p>=flen: break divide cat,buf,13,p: q=stat: catlen=q-p-1 if catlen>maxCatLen { dialog "maxCatLenが小さすぎます。"+catlen+"以上必要です。" end } strmid s,cat,catlen-4,4: if s="命令": catlen-=4: poke cat,catlen,0 strmid s,cat,catlen-4,4: if s="関連": catlen-=4: poke cat,catlen,0 p=q instrj buf,"● ",p: last=stat+3 repeat ;詳細ファイル名 instrj buf,"=last: break divide s,buf,'"',p: p=stat if s=="Ef_cmd.HTM": break ifile=path+"\\"+s p+=4 ;命令名 divide cmd,buf,'<',p: p=stat strlen cmdlen,cmd obuflen+=cmdlen+12: gosub *l_chklen obuf+="\n%index\n"+cmd+"\n" ;1行説明 instrj buf,"",p: q=stat+4 instrj buf,"",p: r=stat+4 if q=lbl: break loop } instrj ibuf,"[関連命令]",m: ilast=stat-3 instrj ibuf,"=ilast { break } else { continue } } gosub *l_detail if n==0: break m=n: if m>=ilast: break loop ;関連 instrj ibuf,"[関連命令]",m: m=stat+10 if m',m: m=stat+1 } loop } loop p=last loop strlen l,obuf if l!=obuflen: dialog "l="+l+"!=obuflen="+obuflen: end ofile=prog+".hs" savedlg ofile,"HSPヘルプファイル,*.hs": c=stat: if c==1: end if c: dialog "savedlg error. stat="+c: end bsave ofile,obuf,l lastchar p,ofile,'\': p++: strmid helpdir,ofile,0,p exec helpdir+"mkindex.exe" repeat: wait 1 chkwin "HSP help index builder ver" if stat==0: break loop wait 10 actwin: wait 10 setkey 13: wait 10 end *l_chklen if obuflen>maxOBufLen { dialog "maxOBufLenが小さすぎます。"+obuflen+"以上必要です。" end } return *l_detail ;タブ変換 strlen l,s gosub *l_tab ;タグ削除 i=0 repeat findl s,'<',i: i=stat: if i>=l: break findl s,'>',i: j=stat: if j>=l: break k=j-i+1 strput s,"",i,k: l-=k: if i>=l: break loop if nulc: repeat nulc: s="^\n"+s: l+=3: loop nulc=0 obuflen+=l+2: gosub *l_chklen obuf+=s+"\n" return ;タブ変換 ;入力:s(行データ),l(sの長さ) ;出力:s,l ;破壊:c,i,j,t *l_tab peek c,s,0 if c==9 { strput s,"",0,1: l-- if cmd!="wndstate" { if cmd!="calset" { peek c,s,0: if c==9: strput s,"",0,1: l-- } } } i=0 repeat findl s,9,i: i=stat: if i>=l: break j=8-(i\8): l+=j-1 digit t,"",' ',j strput s,t,i,1 i+=j: if i>=l: break loop return