Показать сообщение отдельно
Старый 17.12.2007, 01:28   #27
jimon
 
Сообщений: n/a
Re: Синтаксис в блице

ну так не честно в одном я решил по читерить ...
вот программка для blitzmax которая щитает количество
строк во всех инклудах

SuperStrict

Type TComments
	Field Lines%
	Field Comments%
	Field Size%
End Type

Function ReadComments:TComments(File_name$)
	Local file:TStream = ReadFile(File_name)
	Local comments:TComments = New TComments
	Local line$
	ChangeDir(CurrentDir() +"/"+ ExtractDir(File_name))
	comments.Size = file.size()
	While Not Eof(file)
		line$ = Lower(Trim(ReadLine(file)))
		If Instr(line,"'") Then 
			comments.Comments:+1
		Else
			If Instr(line,"include "+Chr(34)) Then
				Local line2$ = Replace(line,"include "+Chr(34),"")
				line2 = Replace(line2,Chr(34),"")
				line2 = Trim(line2)
				Local dir$ = CurrentDir()
				Local com:TComments = ReadComments(line2)
				comments.Lines:+com.Lines
				comments.Comments:+com.Comments
				comments.Size:+com.Size
				ChangeDir(dir)		
			End If
		End If
		comments.Lines:+1
	Wend
	CloseFile(file)
	Return comments
End Function


Function Calculate(File$)

	Local coms:TComments = ReadComments(File)

	DebugLog "---------"
	DebugLog "File : " + File
	DebugLog "Size : " + coms.Size + " bytes"
	DebugLog "Lines : " + coms.Lines
	DebugLog "Comments : " + coms.Comments
	DebugLog "Percents : " + ((Float(coms.Comments)/Float(coms.Lines))*100) + " %" 
	
End Function

Calculate("jAqua.bmx")
Calculate("jEditor.bmx")
в результате :
---------
File : jAqua.bmx
Size : 311112 bytes
Lines : 70028
Comments : 801
Percents : 1.14382815 %
---------
File : jEditor.bmx
Size : 352299 bytes
Lines : 71445
Comments : 811
Percents : 1.13513887 %
там просто редактор юзает код от игры
в принципе я удивлен что настрочил 70 тыс строчек с 800
закоментироваными строчками ... из них половина - убраный код
 
Ответить с цитированием