window:
	res:
		windowType	wstandard
	endres:
endwindow:
close:
	res:
		bitmapPath	$(bitmaps)
		bitmapFile	CLOSE::CBM
	endres:
endclose:
title:
	res:
		leftLabel	'ũ ʱȭ'
		leftKanjiFont	$(kanjiFont)
		leftFont	$(kanaFont)
		switch $(COLOR)
			case MONO:
				bitmapPath	$(bitmaps)
				backgroundFile	GRAY3
				transparent	false
				break
		endswitch
	endres:
endtitle:
dialog: dialogs
	res:
		defaultDistance		#(fWidth)
		dialogType		modeless
	endres:
	ditem: drive_label
		res:
			itemType	bitmap
			leftLabel	'̺:hdxxŸ:smo_s501l'
			leftKanjiFont	$(kanjiFont)
			leftFont	$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
			autoAdjust	true
		endres:
	endditem:
	ditem: disk_label
		res:
			itemType	bitmap
			fromVert	drive_label
			label		'Part(KB) ʱȭϷ ()ʱȭ f(1) w(2) b(3)丮'
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)
		endres:
	endditem:
	ditem: disk_list
		res:
			itemType	scrtext
			fromVert	disk_label
			vertDistance	4
			horizDistance	#(fWidth)
			width		#(fWidth)+1*66
			height		#(lHeight)*5+8
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			bind1		select1
			bind2		select2
			file		/dev/null
		endres:
		act:
			put $(line)
			put $(line)@0 $(PART)
			put $(line)@1 $(SIZE)
			switch $(line)@2
				case +:
					put on $(INITED)
					break
				case -:
					put off $(INITED)
					break
			endswitch
			switch $(line)@3
				case +:
					put on $(REINIT)
					break
				case -:
					put off $(REINIT)
					break
			endswitch
			switch $(line)@4
				case +:
					put on $(DISK_FSCK)
					break
				case -:
					put off $(DISK_FSCK)
					break
			endswitch
			switch $(line)@5
				case +:
					put on $(DISK_WRITE)
					break
				case -:
					put off $(DISK_WRITE)
					break
			endswitch
			switch $(line)@6
				case +:
					put on $(DISK_AUTO)
					break
				case -:
					put off $(DISK_AUTO)
					break
			endswitch
			put $(line)@7 $(DISK_DIR)
		endact:
	endditem:
	ditem: ok
		res:
			itemType	button
			fromVert	disk_label
			fromHoriz	disk_list
			label		' ϡ '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	4
			horizDistance	#(fWidth)*2
		endres:
		act:
			$(bin)/Sopen_check /dev/r$(DRIVE_NO)c 2> /dev/null
			switch #(status)
				case 0:
					break
				default:
					put 3 $(err_no)
					job err
					quit
			endswitch
			put on $(ONRUN)
			put 101 $(menu_no)
			put 1 $(cmd)
			$(onrun) = sub $(commonPath)/onrun ++48++48
			$(etc)/Disk/Sinit_drive.sh init_chk $(PART_LIST)
			switch #(status)
				case 0:
					put on $(init_exist)
					break
				default:
					put off $(init_exist)
					break
			endswitch
			$(pid) = bg $(etc)/Disk/Sinit_drive.sh fstab $(DRIVE_NO) $(DRIVE_TYPE) $(PART_LIST) $(FSTAB_BACK) > $(ERR_LIST)
			$(bgstat) = trap $(pid) init_end
		endact:
	endditem:
	ditem: change
		res:
			itemType	button
			fromVert	ok
			fromHoriz	disk_list
			label		'   '
			kanjiFont	$(kanjiFont)
			font		$(kanaFont)
			vertDistance	#(fWidth)
			horizDistance	#(fWidth)*2
		endres:
		act:
			job change
		endact:
	endditem:
enddialog:
proc: pre
	$(TMP) = mktemp
	put /tmp/$(TMP) $(PART_LIST)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(TMP_LIST)
	$(TMP) = mktemp
	put /tmp/$(TMP) $(ERR_LIST)
	$(TMP) = mktemp
	put /etc/$(TMP) $(FSTAB_BACK)
	put 0 $(menu_no)
	put on $(mapped)
	put off $(opened)
	$(bin)/Ssetdinfo $(DRIVE_NO) $(DRIVE_TYPE)
	$(bin)/Spartlist $(DRIVE_NO) $(DRIVE_TYPE) $(PARTITIONS) 1> $(PART_LIST) 2> /dev/null
	put 0 $(err_no)
	put 0 $(cmd)
endproc:
proc: close
	switch $(ONRUN)
		case on:
			quit
	endswitch
	job off
	close
endproc:
proc: off
	switch #(menu_no)
		case 1:
			close $(chgpart)
			break
	endswitch
	rm -f $(PART_LIST) $(TMP_LIST) $(ERR_LIST) $(FSTAB_BACK)
endproc:
proc: open
	setval drive_label leftLabel '̺:$(DRIVE_NO)Ÿ:$(DRIVE_TYPE)'
	setval disk_list file $(PART_LIST)
	job init
endproc:
proc: init
	setval ok sensitive true
	setval change sensitive false
endproc:
proc: select1
	put off $(bon)
	job bon
	switch $(bon)
		case on:
			setval change sensitive true
			break
		default:
			setval change sensitive false
			break
	endswitch
endproc:
proc: bon
	switch $(PART)
		case '':
			quit
		case b:
			switch $(DRIVE_NO)
				case hd1:
				case od0:
				case sd01:
				case hd0:
				case sd00:
					break
				default:
					put off $(bon)
					quit
			endswitch
			break
	endswitch
	put on $(bon)
endproc:
proc: select2
	put off $(bon)
	job bon
	switch $(bon)
		case off:
			quit
	endswitch
	job change
endproc:
proc: change
	put 1 $(menu_no)
	put off $(CHANGE_PART)
	setval ok sensitive false
	setval change sensitive false
	switch $(PART)
		case b:
			switch $(DISK_DIR)
				case swap:
					put on $(SWAP)
					break
				default:
					put off $(SWAP)
					break
			endswitch
			put off $(FROM_MAIN)
			$(chgpart) = sub $(menu)/swap ++48++48
			trap $(chgpart) swp_end
			break
		default:
			$(chgpart) = sub $(menu)/change1 ++48++48
			trap $(chgpart) chg_end
			break
	endswitch
endproc:
proc: unmap
	switch #(menu_no)
		case 1:
			unmap $(chgpart)
			break
		case 101:
			unmap $(onrun)
			break
		case 102:
			unmap $(n_end)
			break
	endswitch
	put off $(mapped)
endproc:
proc: map
	switch #(menu_no)
		case 1:
			raise $(chgpart)
			map $(chgpart)
			break
		case 101:
			move $(onrun)
			raise $(onrun)
			map $(onrun)
			break
		case 102:
			switch $(opened)
				case on:
					job bgdone
					break
				case off:
					move $(n_end)
					raise $(n_end)
					map $(n_end)
					break
			endswitch
	endswitch
	put on $(mapped)
	put off $(opened)
endproc:
proc: title
	job move
	job up
endproc:
proc: raise
	job up
endproc:
proc: move
	switch #(menu_no)
		case 101:
			move $(onrun)
			break
		case 102:
			move $(n_end)
			break
	endswitch
endproc:
proc: up
	switch #(menu_no)
		case 101:
			raise $(onrun)
			break
		case 102:
			raise $(n_end)
			break
	endswitch
endproc:
proc: n_end
	put off $(ONRUN)
	switch #(cmd)
		case 2:
			switch #(err_no)
				case 0:
					test -f /etc/disklabel
					switch #(status)
						case 0:
							/etc/disklabel -w $(DRIVE_NO) $(DRIVE_TYPE)
							break
						default:
							test -f /etc/setdinfo
							switch #(status)
								case 0:
									/etc/setdinfo $(DRIVE_NO) $(DRIVE_TYPE)
									break
							endswitch
					endswitch
					job off
					put on $(CHANGE_DISK)
					close
					quit
			endswitch
			break
	endswitch
	switch #(err_no)
		case 0:
			break
		default:
			cp $(FSTAB_BACK) /etc/fstab
			put 0 $(err_no)
			break
	endswitch
	put 0 $(menu_no)
endproc:
proc: init_end
	buzzer $(main)
	close $(onrun)
	switch $(mapped)
		case on:
			job bgdone
			break
		default:
			put on $(opened)
			break
	endswitch
	put 102 $(menu_no)
endproc:
proc: bgdone
	switch #(cmd)
		case 1:
			job init0_end
			break
		case 2:
			job init1_end
			break
	endswitch
endproc:
proc: init0_end
	switch #(bgstat)
		case 0:
			switch $(init_exist)
				case on:
					put 2 $(cmd)
					put 'ũ ʱȭ' $(cmdName)
					put 'ũ$(DRIVE_NO)() ʱȭմϴ.' $(confirm_msg1)
					$(n_end) = sub $(commonPath)/confirm1 ++48++48
					trap $(n_end) confirm
					break
				default:
					put 2 $(cmd)
					put 0 $(err_no)
					put 'ũ ʱȭ' $(cmdName)
					$(n_end) = sub $(commonPath)/normalEnd ++48++48
					trap $(n_end) n_end
					break
			endswitch		
			break
		case 0x100:
			put 1 $(err_no)
			job err
			break
		case 0x200:
			put 2 $(err_no)
			job err
			break
	endswitch
endproc:
proc: init1_end
	switch #(bgstat)
		case 0:
			put 0 $(err_no)
			$(n_end) = sub $(commonPath)/normalEnd ++48++48
			trap $(n_end) n_end
			break
	endswitch
endproc:
proc: confirm
	switch $(answer)
		case cancel:
			put off $(ONRUN)
			put 0 $(menu_no)
			cp $(FSTAB_BACK) /etc/fstab
			quit
	endswitch
	$(bin)/Sopen_check /dev/r$(DRIVE_NO)c 2> /dev/null
	switch #(status)
		case 0:
			break
		default:
			put 3 $(err_no)
			job err
			quit
	endswitch
	put on $(ONRUN)
	put 101 $(menu_no)
	$(onrun) = sub $(commonPath)/onrun ++48++48
	switch #(cmd)
		case 2:
			$(pid) = bg $(etc)/Disk/Sinit_drive.sh init $(DRIVE_NO) $(DRIVE_TYPE) $(PART_LIST)
			break
	endswitch
	$(bgstat) = trap $(pid) init_end
endproc:
proc: chg_end
	switch #(menu_no)
		case 1:
			switch $(CHANGE_PART)
				case off:
					job select1
					put off $(selet_on_cmd)
					put 0 $(menu_no)
					setval ok sensitive true
					quit
			endswitch
			switch $(REINIT)
				case on:
					put + $(reinit)
					break
				case off:
					put - $(reinit)
					break
			endswitch
			switch $(DISK_FSCK)
				case on:
					put + $(fsck)
					break
				case off:
					put - $(fsck)
					break
			endswitch
			switch $(DISK_WRITE)
				case on:
					put + $(write)
					break
				case off:
					put - $(write)
					break
			endswitch
			switch $(DISK_AUTO)
				case on:
					put + $(autom)
					break
				case off:
					put - $(autom)
					break
			endswitch
			put $(PART) > $(TMP_LIST)
			$(bin)/Sfile_op -c 3 -ci $(reinit) -f 0 -i $(TMP_LIST) -o $(PART_LIST)
			$(bin)/Sfile_op -c 4 -ci $(fsck) -f 0 -i $(TMP_LIST) -o $(PART_LIST)
			$(bin)/Sfile_op -c 5 -ci $(write) -f 0 -i $(TMP_LIST) -o $(PART_LIST)
			$(bin)/Sfile_op -c 6 -ci $(autom) -f 0 -i $(TMP_LIST) -o $(PART_LIST)
			$(bin)/Sfile_op -c 7 -ci $(DISK_DIR) -f 0 -i $(TMP_LIST) -o $(PART_LIST)
			setval disk_list file $(PART_LIST)
			job init
	endswitch
	put 0 $(menu_no)
endproc:
proc: swp_end
	switch #(menu_no)
		case 1:
			switch $(CHANGE_PART)
				case off:
					job select1
					put off $(selet_on_cmd)
					put 0 $(menu_no)
					setval ok sensitive true
					quit
			endswitch
			switch $(SWAP)
				case on:
					put swap $(swap)
					break
				case off:
					put ------ $(swap)
					break
			endswitch
			put $(PART) > $(TMP_LIST)
			$(bin)/Sfile_op -c 7 -ci $(swap) -f 0 -i $(TMP_LIST) -o $(PART_LIST)
			setval disk_list file $(PART_LIST)
			job init
	endswitch
	put 0 $(menu_no)
endproc:
proc: err
	buzzer
	switch #(err_no)
		case 1:
			put $(error_dir) < $(ERR_LIST)
			put '丮$(error_dir)() ۼ  ϴ.' $(confirm_msg1)
			$(n_end) = sub $(commonPath)/error1 ++48++48
			break
		case 2:
			put $(error_dir) < $(ERR_LIST)
			put '2 ٸ  ý,  丮 ' $(confirm_msg1)
			put ' 丮$(error_dir)() ' $(confirm_msg2)
			put 'ڵ  Ʈ  ϴ.' $(confirm_msg3)
			$(n_end) = sub $(commonPath)/error3 ++48++48
			break
		case 3:
			put '̺꡸$(DRIVE_NO)()   ϴ.' $(confirm_msg1)
			put '̺갡 Ȯ ӵǾ ִ' $(confirm_msg2)
			put '޵(ͣϵũ) Ȯ ƮǾ ִ' $(confirm_msg3)
			put '޵ ˵Ǿ ִ' $(confirm_msg4)
			put ' üũϿ ֽʽÿ.' $(confirm_msg5)
			$(n_end) = sub $(commonPath)/error5 ++48++48
			break
	endswitch
	trap $(n_end) n_end
endproc:
