♪ずんずんずん と来りゃ♪ずざざん ざん と来りゃ♪おいらのサイトは ずざざんざん♪製作、運営 y.repeat mail to:y.tack2010@gmail.com 

#include "hsp3util.as"
//	注:hsp3util.asが必要です
t={"//	Nil.java
import java.io.*;

public class Nil implements Sexp {
	static Nil NIL = new Nil();	// static 変数版 NIL
	
	public Nil(){}

/**
 * NIL のプリンタ
 */
	public void print(PrintWriter pw) throws Exception {
		pw.print(\"NIL\");
	}
	
/**
 * NIL のシリアライズ(文字列化)
 */
	public java.lang.String serialize(){
		return \"NIL\";
	}
}

"}
screen 2,800,480
cls 2
objsize 150,20
button "元整理",*l_moto
button "済整理",*l_ato
button "比較",*l_on
button "クリア",*l_clear
pos 400,80
_4MB_C=""
mesbox _4MB_C,400,200,1
ID4MB_C=stat
pos 400,280
_4MB_D=""
mesbox _4MB_D,400,200,1
ID4MB_D=stat
_4MB_show=""
pos 0,80
mesbox _4MB_show,400,400,1
ID4MB_show=stat
goto *@f
*l_moto
	gosub *do_on_S
	gsel 2
	objprm ID4MB_C,str_sC
	stop
*l_ato
	gosub *do_on_T
	gsel 2
	objprm ID4MB_D,str_tC
	stop
*l_on
	gsel 2
	gosub *do_on_S
	objprm ID4MB_C,str_sC
	
	gosub *do_on_T
	objprm ID4MB_D,str_tC
	
	gosub *l_do_cmp
	stop
*l_clear
	_4MB_t=""
	_4MB_s=""
	_4note=""
	gsel 0
	objprm 0,_4MB_t
	gsel 1
	objprm 0,_4MB_s
	stop
*@
gsel 0
;mes t
sdim _4note,2000
_4note=t
notesel _4note

_4MB_t=""
_4MB_t=_4note
mesbox _4MB_t,800,480,1



screen 1
s={"--- Nil.java ---------------------------------
import java.io.*;

public class Nil implements Sexp {
  static Nil NIL = new Nil();    // static 変数版 NIL

  public Nil() {}                
  
  /**
   *  NIL のプリンタ
   */
  public void print(PrintWriter pw) throws Exception {
    pw.print(\"NIL\"); 
  }

  /**
   *  NIL のシリアライズ(文字列化)
   */
  public java.lang.String serialize(){
    return \"NIL\";
  }
}
-----------------------------------------------
"}
_4note=s
notesel _4note


_4MB_s=""
_4MB_s=_4note
mesbox _4MB_s,800,480,1
stop

//////////////////////////////////////////////////////////
// t_MB サブルーチン
*do_on_T
_4note=_4MB_t


// "\t"を" "に変換
repeat notemax
tmp4ntg=""
noteget tmp4ntg,cnt
while 1
if instr(tmp4ntg,0,"\t")==-1:_break
strrep tmp4ntg,"\t"," "
wend
noteadd tmp4ntg,cnt,1
loop

// "  "を" "に変換 全部
repeat notemax
tmp4ntg=""
noteget tmp4ntg,cnt
while 1
if instr(tmp4ntg,0,"  ")==-1:_break
strrep tmp4ntg,"  "," "
wend
noteadd tmp4ntg,cnt,1
loop

// 行末の" "を削除
repeat notemax
tmp4ntg=""
noteget tmp4ntg,cnt
tmp4ntg=strtrim(tmp4ntg,2,' ')
noteadd tmp4ntg,cnt,1
loop

// 空行削除
;mes _4note
str_tB=_4note
i=0
*tmp_begin_while
while i<notemax
;repeat notemax
tmp4ntg=""
noteget tmp4ntg,i
if tmp4ntg=="":notedel i:goto *tmp_begin_while
i++
await 1
wend
;mes _4note

//	文字列を配列化
str_tC=_4note
sdim ar_t,notemax
l_ar_t=notemax
note2array ar_t,str_tC

	return
//////////////////////////////////////////////////////////
// s_MB サブルーチン
*do_on_S
_4note=_4MB_s

// "\t"を" "に変換
repeat notemax
tmp4ntg=""
noteget tmp4ntg,cnt
while 1
if instr(tmp4ntg,0,"\t")==-1:_break
strrep tmp4ntg,"\t"," "
wend
noteadd tmp4ntg,cnt,1
loop
//mes s

// "  "を" "に変換 全部
repeat notemax
tmp4ntg=""
noteget tmp4ntg,cnt
while 1
if instr(tmp4ntg,0,"  ")==-1:_break
strrep tmp4ntg,"  "," "
wend
noteadd tmp4ntg,cnt,1
loop

// 行末の" "を削除
repeat notemax
tmp4ntg=""
noteget tmp4ntg,cnt
tmp4ntg=strtrim(tmp4ntg,2,' ')
noteadd tmp4ntg,cnt,1
loop

// 空行削除
;mes _4note
str_tC=_4note
i=0
*tmp_begin_while_B
while i<notemax
;repeat notemax
tmp4ntg=""
noteget tmp4ntg,i
if tmp4ntg=="":notedel i:goto *tmp_begin_while_B
i++
await 1
wend
;mes _4note


//	文字列を配列化
str_sC=_4note
sdim ar_s,notemax
l_ar_s=notemax
note2array ar_s,str_sC
	return
	
//////////////////////////////////////////////////////////
//	do cmp実際に比較
*l_do_cmp
	u=""
l4rep_S=l_ar_t
l4rep_L=l_ar_t
if l4rep_S>=l_ar_s{
	l4rep_S=l_ar_s
}else{
	l4rep_L=l_ar_s	
}
repeat l4rep_S
if ar_t.cnt!=ar_s.cnt{
	logmes ""+ar_t.cnt
	logmes "→ "+ar_s.cnt
	u+=""+ar_t.cnt+"\n"
	u+="→ "+ar_s.cnt+"\n"
}
loop
repeat (l4rep_L-l4rep_S),l4rep_S
	logmes ""+ar_t.cnt
	u+=""+ar_t.cnt+"\n"
loop
	gsel 2
	objprm ID4MB_show,u
	return
なんか二日で出来たw
行単位で大体同じ内容か行単位でcheckします
(空行は無視なので)
\tは" "に置き換えし
" "は" "に置き換えます
行末の" "も削除します
" "は意味があることが多いので半分くらい残ると思います

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

管理人/副管理人のみ編集できます