; ; HSP help writer script ; onitama/onion software 1999 ; #include "hspext.as" ; app="HSP help Writer ver0.3" ; chdir exedir ; EXEのあるディレクトリをカレントに sdim fname,256 fname="default.hs" wx=640:wy=640 xx=dispx-wx/2:yy=dispy-wy/2 screen 0,wx,wy,paluse,xx,yy screen 2,200,338 title "Index一覧" cls 1 objmode 1 dim regidx,$200 sdim reghis,$6000 pos 2,2 objsize 194,24 listbox hisnum,302,reghis objsize 140,24 pos 2,312 button "選択",*main7 objsize 48,24 pos 148,312 button "削除",*main8 screen 3,320,460 title "詳細情報" cls 1 objmode 1 sdim i_type,256 sdim i_ver,256 sdim i_date,256 sdim i_author,256 sdim i_dll,256 sdim i_url,256 sdim i_note,$4000 a=0:gettime a,0:str a,2:i_date=a+"/" a=0:gettime a,1:str a,2:i_date+=a+"/" a=0:gettime a,3:str a,2:i_date+=a sdim cb_group,512 cb_type="内蔵命令\n拡張命令\nユーザー拡張命令" cb_group={"命令概要 プリプロセッサ命令 代入命令 特殊代入命令 プログラム制御命令 基本入出力制御命令 拡張入出力制御命令 オブジェクト制御命令 画面制御命令 拡張画面制御命令 文字列操作命令 メモリ管理命令 マルチメディア制御命令 ファイル操作命令 拡張ファイル操作命令 通信制御命令 OSシステム制御命令 HSPシステム制御命令 その他の命令 "} n_type=0 font "MS ゴシック",13 pos 8,6 mes "%type" pos 80,2 objsize 240,24 combox n_type,100,cb_type ; ID0 pos 8,38 mes "%ver" pos 80,36 objsize 200,24 input i_ver ; ID1 pos 8,68 mes "%date" pos 80,70 objsize 200,24 input i_date ; ID2 pos 8,98 mes "%author" pos 80,100 input i_author ; ID3 pos 8,128 mes "%dll/add" pos 80,130 input i_dll ; ID4 pos 8,160 mes "%url" pos 8,180 mesbox i_url,320-6,60,1 ; ID5 pos 8,250 mes "%note(補足)" pos 8,270 mesbox i_note,320-6,160,1 ; ID6 objsize 100,24 pos 216,434 button "変更",*main5 *main1 gsel 0 cls 1 objmode 1 sdim info,$8000 ; メッセージ表示バッファ(32K) sdim refinf,$4000 ; 関連項目表示バッファ(16K) sdim prminf,$4000 ; パラメータ表示バッファ(16K) sdim smpinf,$6000 ; サンプル表示バッファ(32K) sdim anskey,256 sdim anstitle,256 n_group=0 font "MS ゴシック",13 pos 2,wy-636 mes "%index(検索キー)" pos 2,wy-620 objsize 160,24 input anskey ; ID0 pos 200,wy-636 mes "見出し" pos 200,wy-620 objsize 420,24 input anstitle ; ID1 pos 2,wy-546 mes "%prm(パラメータ)" pos 2,wy-530 mesbox prminf,wx-6,80,1 ; ID2 pos 2,wy-436 mes "%inst(説明)" objmode 2 font "MS ゴシック",13 pos 2,wy-420 mesbox info,wx-6,210,1 ; ID3 objmode 1 pos 2,wy-196 mes "%sample(サンプル)" pos 2,wy-180 mesbox smpinf,wx-6,80,1 ; ID4 pos 2,wy-96 mes "%href(参照)" pos 2,wy-80 mesbox refinf,300,64,1 ; ID5 pos 64,wy-576 mes "%group(グループ)" pos 200,wy-580 combox n_group,100,cb_group ; ID6 objsize 54,64 x=320:px=60 pos x,wy-80:x+=px button "追加",*main2 pos x,wy-80:x+=px button "修正",*main9 pos x,wy-80:x+=px button "クリア",*allnew pos x,wy-80:x+=px button "CLIP",*main3 objsize 54,30 pos x,wy-80 button "新規File",*main4 pos x,wy-46:x+=px button "開くFile",*main6 gosub *hischk *wrtmain gsel 0 title app+" ["+fname+"]" tid=0 objsel tid *keymain a=0 *km0 wait 1 getkey a,27 if a : goto *km0 *km1 wait 1 getkey a,27 if a : goto *km2 goto *km1 *km2 ginfo 1 if prmx!0 : goto *keymain ; objsel -1:tid=stat tid+:if tid>5 : tid=0 objsel tid goto *keymain *main2 ; hsファイルに項目を追加 ; if anskey="" : goto *adderr if anstitle="" : goto *adderr ; sdim buf,$18000 exist fname:if strsize<0 : dialog "ファイルを指定してください" : goto *keymain bload fname,buf *bufadd buf+="\n\n%index\n"+anskey+"\n"+anstitle+"\n" notesel cb_group:noteget btmp,n_group buf+="%group\n"+btmp+"\n" if prminf!="" : buf+="%prm\n"+prminf+"\n" buf+="%inst\n"+info+"\n" if refinf!="" : buf+="%href\n"+refinf+"\n" if smpinf!="" : buf+="%sample\n"+smpinf+"\n" buf+="\n" ; strlen a,buf bsave fname,buf,a ; gosub *hischk goto *wrtmain *allnew gsel 0,1 ; info="" refinf="" prminf="" smpinf="" anskey="" anstitle="" ; repeat 6:objprm cnt,"":loop tid=0 ; goto *wrtmain *adderr dialog "必要な項目が入力されていません" goto *keymain *getln ; get 1line ; if a>=amx : return noteget ln,a a+ return *srchln ; search ts strings ; if a>=amx : ln="" : return gosub *getln if ln!=ts : goto *srchln noteget ln,a a+ return *cuthed ; header space,tab wipe ; sdim th,256 hi=0:hc=0 repeat 256 peek hc,t,cnt if hc=0 : break if hc=9 : goto *cutok if hc=32 : goto *cutok poke th,hi,hc hi+ *cutok loop t=th return *cuthed2 ; header space,tab wipe ; hc=0 peek hc,t,0 if hc=9 : goto *cutgo if hc=32 : goto *cutgo return *cutgo getstr t,t,1,0 goto *cuthed2 *main3 ; clipboard get ; sdim ln,256 sdim t,$4000 sdim tt,$4000 clipget tt,$4000 ; if tt="" : goto *cliperr ; i=0 a=0:amx=0 notesel tt : notemax amx ; ts="
"
	gosub *srchln
	if ln="" : goto *cliperr
	;
	getstr anskey,ln,0,' '
	i=strsize
	objprm 0,anskey
	;
	getstr prminf,ln,i,9
	i+=strsize
	;
	getstr t,ln,i
	gosub *cuthed
	anstitle=t
	objprm 1,anstitle
	;
	a+:gosub *getln
	if ln!="
" : goto *nogprm prminf+="\n" *gprm gosub *getln if ln="
" : goto *nogprm if ln="
" : goto *gprm prminf+=ln+"\n" goto *gprm *cliperr dialog "クリップボード取り込みエラー" goto *keymain *nogprm objprm 2,prminf ; ts="
  • 説明

    ":gosub *srchln info="" *ginst if ln="

    " : ln="\n" if ln="
    " : ln="" if ln="" : goto *ginstok ; t=ln:gosub *cuthed2 info+=t+"\n" ; gosub *getln goto *ginst *ginstok objprm 3,info smpinf="" refinf="" objprm 4,smpinf objprm 5,refinf ; goto *keymain *main4 ; ファイル作成 ; dialog "hs",17,"HSPヘルプデータ" if stat=0 : dialog "キャンセルしました" : goto *keymain fname=refstr instr a,fname,".hs" if a<0 : fname+=".hs" ; reghis="" exist fname:if strsize=0 : bsave fname,reghis,1 goto *allnew *main5 ; headerを変更してセーブ ; sdim buf,$18000 exist fname:if strsize<0 : dialog "ファイルを指定してください" : goto *keymain ; sdim btmp,256 sdim buf2,$18000 bload fname,buf2 ; buf+=";\n; HSP help manager用 HELPソースファイル\n; (先頭が「;」の行はコメントとして処理されます)\n;\n\n" ; notesel cb_type:noteget btmp,n_type buf+="%type\n"+btmp+"\n" ; if i_ver!="" : buf+="%ver\n"+i_ver+"\n" if i_note!="" : buf+="%note\n"+i_note+"\n" if i_date!="" : buf+="%date\n"+i_date+"\n" if i_author!="" : buf+="%author\n"+i_author+"\n" if i_dll!="" : buf+="%dll\n"+i_dll+"\n" if i_url!="" : buf+="%url\n"+i_url+"\n" buf+="\n\n" ; notesel buf2 notemax max a=-1 repeat max noteget btmp,cnt if btmp="%index" : a=cnt : break loop ; if a<0 : goto *hsv1 *hsv2 noteget btmp,a buf+=btmp+"\n" a+ if a=bufmax : break getstr ln,buf,i,0:i+=strsize peek c,ln,0 if c=0 : goto *hischk1 if c=';' : goto *hischk1 if c!=$25 : tmp+=ln+"\n" : goto *hischk1 ; '%' check ; a=tagname strmid tagname,ln,1,64 if a="note" : i_note=tmp if a="url" : i_url=tmp ; getstr tmp,tmp,0,0 if a="index" : reghis+=tmp+"\n" : regidx.regnum=tagofs : regnum+ if a="type" : gosub *hischk3 if a="ver" : i_ver=tmp if a="dll" : i_dll=tmp if a="date" : i_date=tmp if a="author" : i_author=tmp ; tagofs=i tmp="" *hischk1 loop ; *hischk2 gsel 3 objprm 0,n_type objprm 1,i_ver objprm 2,i_date objprm 3,i_author objprm 4,i_dll objprm 5,i_url objprm 6,i_note ; gsel 2 objprm 0,reghis title "Index一覧("+regnum+")" return *hischk3 n_type=0 notesel cb_type notemax j repeat j noteget ln,cnt if ln=tmp : n_type=cnt loop return *main7 ; index呼び出し ; if hisnum<0 : goto *keymain ; gsel 0 tagofs=regidx.hisnum sdim buf,$18000 bload fname,buf strlen bufmax,buf ; sdim a,256 sdim ln,256 sdim tagname,256 sdim tmp,$8000 ; データ一時格納バッファ btmp="" ; c=0 i=tagofs ;getstr ln,buf,i,0:i+=strsize ;if ln!="%%index" : dialog "データが不正です["+ln+"]"+i : goto *keymain getstr anskey,buf,i,0:i+=strsize getstr anstitle,buf,i,0:i+=strsize ; info="" refinf="" prminf="" smpinf="" ; repeat if i>=bufmax : goto *hschk2 getstr ln,buf,i,0:i+=strsize peek c,ln,0 if c=0 : goto *hschk1 if c=';' : goto *hschk1 if c!=$25 : tmp+=ln+"\n" : goto *hschk1 ; '%' check ; *hschk2 a=tagname strmid tagname,ln,1,64 ; if a="inst" : info=tmp if a="prm" : prminf=tmp if a="href" : refinf=tmp if a="sample" : smpinf=tmp ; getstr tmp,tmp,0,0 if a="group" : btmp=tmp ; if tagname="index" : break ; tmp="" if i>=bufmax : break *hschk1 loop ; gosub *hschk3 n_group=i ; gsel 0 objprm 0,anskey objprm 1,anstitle objprm 2,prminf objprm 3,info objprm 4,smpinf objprm 5,refinf objprm 6,n_group ; goto *wrtmain *hschk3 i=0 notesel cb_group notemax c repeat c noteget ln,cnt if btmp=ln : i=cnt loop return *main8 ; index削除 ; if hisnum<0 : goto *keymain ; a=0 ; gsel 0 tagofs=regidx.hisnum tagofs -= 8 ; "%index"+CR/LF を戻す ; gosub *idwipe ; strlen a,buf bsave fname,buf,a ; gosub *hischk ; goto *allnew *idwipe sdim buf,$18000 sdim tmp,$18000 ; データ一時格納バッファ sdim ln,1024 ; bload fname,buf strlen a,buf ; i=0:c=1 *hschk4 if i>=a : goto *hschk5 getstr ln,buf,i,0 if i=tagofs : c=0 : ln="" i+=strsize ; if c=0 : if ln="%index" : c=1 if c : tmp+=ln+"\n" goto *hschk4 *hschk5 buf=tmp return *main9 ; index修正 ; if hisnum<0 : goto *keymain if anskey="" : goto *adderr if anstitle="" : goto *adderr ; a=0 ; gsel 0 tagofs=regidx.hisnum tagofs -= 8 ; "%index"+CR/LF を戻す ; gosub *idwipe ; goto *bufadd