Index: Include/basic/command.sbp
===================================================================
--- Include/basic/command.sbp	(revision 21)
+++ Include/basic/command.sbp	(revision 1)
@@ -35,5 +35,5 @@
 
 Macro EXEC(lpFilePath As *Byte)(lpCmdLine As *Byte)
-	ShellExecute(0,"open",lpFilePath,lpCmdLine,0,SW_SHOWNORMAL)
+	ShellExecute(0, "open", lpFilePath, lpCmdLine, 0, SW_SHOWNORMAL)
 End Macro
 
@@ -56,17 +56,17 @@
 '----------------
 
-Macro MSGBOX(hWnd As HWND, lpStr As String)(lpTitle As String, BoxType As DWord, ByRef retAns As DWord)
+Macro MSGBOX(hWnd As HWND, ByRef str As String)(ByRef title As String, boxType As DWord, ByRef retAns As DWord)
 	If VarPtr(retAns) Then
-		retAns=MessageBox(hWnd,lpStr,lpTitle,BoxType)
+		retAns = MessageBox(hWnd, str, title, boxType)
 	Else
-		MessageBox(hWnd,lpStr,lpTitle,BoxType)
+		MessageBox(hWnd, str, title, boxType)
 	End If
 End Macro
 
-Macro WINDOW(ByRef hWnd As Long, hOwner As Long, x As Long, y As Long, nWidth As Long, nHeight As Long, lpTitle As String, dwStyle As DWord)(lpClass As String, id As DWord, lpFunc As DWord, dwExStyle As DWord)
+Macro WINDOW(ByRef hWnd As Long, hOwner As HWND, x As Long, y As Long, nWidth As Long, nHeight As Long, ByRef title As String, dwStyle As DWord)(ByRef className As String, id As DWord, lpFunc As DWord, dwExStyle As DWord)
 	If VarPtr(hWnd) Then
-		hWnd=CreateWindowEx(dwExStyle,lpClass,lpTitle,dwStyle,x,y,nWidth,nHeight,hOwner,id,GetModuleHandle(0),NULL)
+		hWnd = CreateWindowEx(dwExStyle, className.Chars, title, dwStyle, x, y, nWidth, nHeight, hOwner, id, GetModuleHandle(0), NULL)
 	Else
-		CreateWindowEx(dwExStyle,lpClass,lpTitle,dwStyle,x,y,nWidth,nHeight,hOwner,id,GetModuleHandle(0),NULL)
+		CreateWindowEx(dwExStyle, className.Chars, title, dwStyle, x, y, nWidth, nHeight, hOwner, id, GetModuleHandle(0), NULL)
 	End If
 End Macro
@@ -76,26 +76,28 @@
 End Macro
 
-Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)(lpString As String, id As Long, hSubMenu As HMENU, state As Long)
+Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)(ByRef str As String, id As Long, hSubMenu As HMENU, state As Long)
 	Dim mii As MENUITEMINFO
 
-	FillMemory(VarPtr(mii),Len(mii),0)
-	mii.cbSize=Len(mii)
-	mii.fMask=MIIM_TYPE
-
-	If lpString.Length=0 Then
-		mii.fType=MFT_SEPARATOR
-	Else
-		mii.fType=MFT_STRING
-		mii.fMask=mii.fMask or MIIM_STATE or MIIM_ID
-		mii.dwTypeData=StrPtr(lpString)
-		mii.wID=id
-		If hSubMenu Then
-			mii.fMask=mii.fMask or MIIM_SUBMENU
-			mii.hSubMenu=hSubMenu
+	ZeroMemory(VarPtr(mii), Len(mii))
+	With mii
+		.cbSize = Len(mii)
+		.fMask = IIM_TYPE
+
+		If str.Length = 0 Then
+			.fType = MFT_SEPARATOR
+		Else
+			.fType  = MFT_STRING
+			.fMask = .fMask or MIIM_STATE or MIIM_ID
+			.dwTypeData = str.Chars
+			.wID = id
+			If hSubMenu Then
+				.fMask = .fMask or MIIM_SUBMENU
+				.hSubMenu = hSubMenu
+			End If
+			.fState = state
 		End If
-		mii.fState=state
-	End If
-
-	InsertMenuItem(hMenu,PosID,flag,mii)
+	End With
+
+	InsertMenuItem(hMenu, PosID, flag, mii)
 End Macro
 
@@ -105,11 +107,12 @@
 '--------------
 
-Dim _System_hFile(255) As Long
-Macro OPEN(lpFileName As String, AccessFor As Long, FileNumber As Long)
+Dim _System_hFile[255] As HANDLE
+
+Macro OPEN(ByRef fileName As String, AccessFor As Long, FileNumber As Long)
 	Dim dwAccess As Long
 	Dim bAppend As Long
 	Dim dwCreationDisposition As Long
 
-	FileNumber=FileNumber-1
+	FileNumber--
 
 	bAppend=0
@@ -130,14 +133,15 @@
 	End Select
 
-	_System_hFile(FileNumber)=CreateFile(lpFileName,dwAccess,0,ByVal NULL,dwCreationDisposition,FILE_ATTRIBUTE_NORMAL,NULL)
-
-	If bAppend Then SetFilePointer(_System_hFile(FileNumber),0,NULL,FILE_END)
-End Macro
+	_System_hFile[FileNumber] = CreateFile(fileName, dwAccess, 0, ByVal 0, dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0)
+
+	If bAppend Then SetFilePointer(_System_hFile[FileNumber], 0, 0, FILE_END)
+End Macro
+
 Macro CLOSE()(FileNumber As Long)
-	FileNumber=FileNumber-1
+	FileNumber--
 
 	If _System_hFile(FileNumber) Then
-		CloseHandle(_System_hFile(FileNumber))
-		_System_hFile(FileNumber)=0
+		CloseHandle(_System_hFile[FileNumber])
+		_System_hFile(FileNumber) = 0
 	End If
 End Macro
@@ -147,5 +151,5 @@
 Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord
 Sub INPUT_FromFile(FileNumber As Long)
-	Dim i As Long ,i2 As Long, i3 As Long
+	Dim i As Long, i2 As Long, i3 As Long
 	Dim buffer As String
 	Dim temp[1] As Byte
@@ -153,5 +157,5 @@
 	Dim IsStr As Long
 
-	FileNumber=FileNumber-1
+	FileNumber--
 
 	buffer=ZeroString(GetFileSize(_System_hFile[FileNumber],0))
@@ -173,5 +177,5 @@
 		IsStr=0
 		While 1
-			i3=i3+1
+			i3++
 
 			i2=ReadFile(_System_hFile[FileNumber],temp,1,VarPtr(dwAccessBytes),ByVal 0)
@@ -197,5 +201,5 @@
 						If dwAccessBytes=0 Then Exit While
 						If temp[0]=Asc(",") Then Exit While
-						If Not(temp[0]=32 or temp[0]=9) Then
+						If temp[0] <> 32 And temp[0] <> 9 Then
 							SetFilePointer(_System_hFile[FileNumber],-1,0,FILE_CURRENT)
 							Exit While
@@ -227,12 +231,8 @@
 				Dim pTempStr As *String
 				pTempStr=_System_InputDataPtr[i] As *String
-
-				pTempStr->Length=i3
-				pTempStr->Chars=_System_realloc(pTempStr->Chars,pTempStr->Length+1)
-				memcpy(pTempStr->Chars,buffer.Chars,pTempStr->Length)
-				pTempStr->Chars[pTempStr->Length]=0
+				pTempStr->Assign(buffer.Chars, i3)
 		End Select
 
-		i=i+1
+		i++
 		If _System_InputDataPtr[i]=0 Then Exit While
 	Wend
@@ -241,5 +241,5 @@
 Sub PRINT_ToFile(FileNumber As Long, buf As String)
 	Dim dwAccessByte As DWord
-	FileNumber=FileNumber-1
+	FileNumber--
 
 	WriteFile(_System_hFile(FileNumber),buf,Len(buf),VarPtr(dwAccessByte),ByVal NULL)
@@ -263,6 +263,6 @@
 			buffer[i3]=UsingStr[i2]
 			If UsingStr[i2]=0 Then Exit While
-			i2=i2+1
-			i3=i3+1
+			i2++
+			i3++
 		Wend
 
@@ -274,5 +274,5 @@
 
 			Dim length_num As Long, length_buf As Long
-			Dim dblRoundOff=0 As Double
+			Dim dblRoundOff = 0 As Double
 
 
@@ -283,12 +283,12 @@
 			i4=i2
 			While UsingStr[i4]=Asc("#")
-				i4=i4+1
+				i4++
 			Wend
 			If UsingStr[i4]=Asc(".") Then
-				i4=i4+1
+				i4++
 
 				dblRoundOff=0.5
 				While UsingStr[i4]=Asc("#")
-					i4=i4+1
+					i4++
 					dblRoundOff=dblRoundOff/10
 				Wend
@@ -304,10 +304,10 @@
 
 			'符号が有る場合は、一文字分のスペースを考慮する
-			If sign Then length_num=length_num+1
+			If sign Then length_num++
 
 			length_buf=0
 			Do
-				i2=i2+1
-				length_buf=length_buf+1
+				i2++
+				length_buf++
 			Loop While UsingStr[i2]=Asc("#")
 
@@ -315,11 +315,11 @@
 				'通常時
 				FillMemory(StrPtr(buffer)+i3,length_buf-length_num,Asc(" "))
-				i3=i3+(length_buf-length_num)
+				i3 += length_buf - length_num
 
 				If sign Then
 					buffer[i3]=Asc("-")
-					i3=i3+1
-
-					length_num=length_num-1
+					i3++
+
+					length_num--
 				End If
 
@@ -330,15 +330,15 @@
 				End If
 
-				i3=i3+length_num
+				i3 += length_num
 			Else
 				'表示桁が足りないとき
 				FillMemory(StrPtr(buffer)+i3,length_buf,Asc("#"))
-				i3=i3+length_buf
+				i3 += length_buf
 			End If
 
 			If UsingStr[i2]=Asc(".") Then
 				buffer[i3]=UsingStr[i2]
-				i2=i2+1
-				i3=i3+1
+				i2++
+				i3++
 
 				i4=dec
@@ -349,25 +349,25 @@
 						buffer[i3]=temp2[i4]
 					End If
-					i3=i3+1
-					i4=i4+1
-
-					i2=i2+1
+					i3++
+					i4++
+
+					i2++
 				Wend
 			End If
 		ElseIf UsingStr[i2]=Asc("@") Then
-			i2=i2+1
+			i2++1
 
 			lstrcat(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum])
-			i3=i3+lstrlen(_System_UsingStrData[ParmNum])
+			i3 += lstrlen(_System_UsingStrData[ParmNum])
 		ElseIf UsingStr[i2]=Asc("&") Then
 			i4=0
 			Do
-				i4=i4+1
-				i2=i2+1
+				i4++
+				i2++
 			Loop While UsingStr[i2]=Asc(" ")
 
 			If UsingStr[i2]=Asc("&") Then
-				i4=i4+1
-				i2=i2+1
+				i4++
+				i2++
 				i5=lstrlen(_System_UsingStrData[ParmNum])
 				If i4<=i5 Then
@@ -377,24 +377,25 @@
 				End If
 				memcpy(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum],i5)
-				i3=i3+i4
+				i3 += i4
 			Else
-				i2=i2-i4
+				i2 -= i4
 				buffer[i3]=Asc("&")
-				i2=i2+1
-				i3=i3+1
+				i2++
+				i3++
 				Continue
 			End If
 		End If
 
-		ParmNum=ParmNum+1
+		ParmNum++
 	Wend
 
 	_System_GetUsingFormat=Left$(buffer,lstrlen(buffer))
 End Function
+
 Sub PRINTUSING_ToFile(FileNumber As Long, UsingStr As String)
 	Dim dwAccessByte As DWord
 	Dim buf As String
 
-	FileNumber=FileNumber-1
+	FileNumber--
 	buf=_System_GetUsingFormat(UsingStr)
 
@@ -403,14 +404,16 @@
 
 Dim _System_FieldSize(255) As Long
+
 Macro FIELD(FileNumber As Long, FieldSize As Long)
-	FileNumber=FileNumber-1
+	FileNumber--
 
 	_System_FieldSize(FileNumber)=FieldSize
 End Macro
+
 Macro GET(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String)
 	Dim dwAccessByte As Long
 
-	FileNumber=FileNumber-1
-	RecodeNumber=RecodeNumber-1
+	FileNumber--
+	RecodeNumber--
 
 	SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN)
@@ -421,9 +424,10 @@
 	End If
 End Macro
+
 Macro PUT(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String)
 	Dim dwAccessByte As Long
 
-	FileNumber=FileNumber-1
-	RecodeNumber=RecodeNumber-1
+	FileNumber--
+	RecodeNumber--
 
 	SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN)
@@ -431,11 +435,13 @@
 End Macro
 
-Macro CHDIR(path As String)
+Macro CHDIR(ByRef path As String)
 	SetCurrentDirectory(path)
 End Macro
-Macro MKDIR(path As String)
+
+Macro MKDIR(ByRef path As String)
 	CreateDirectory(path,ByVal 0)
 End Macro
-Macro KILL(path As String)
+
+Macro KILL(ByRef path As String)
 	DeleteFile(path)
 End Macro
