	LUA	PASS1

-- установка длины файлов для компиляции загрузчика
	function GetLenFile(name)
	  local fname
	  local size

	  fname = io.open(name,"r+b")
          size = fname:seek("end")
--print(name)
          fname:close()

	  return size
	end

	local len
	local labname={}
	local secname={}
	local filname={}

	labname[1]="Len_keypress"
	labname[2]="Len_pressopt"
	labname[3]="Len_laser0"
	labname[4]="Len_laser1"
	labname[5]="Len_laser2"
	labname[6]="Len_laser3"
	labname[7]="Len_laser4"
	labname[8]="Len_laser5"
	labname[9]="Len_laser6"
	labname[10]="Len_laser7"
	labname[11]="Len_pilothit"
	labname[12]="Len_enemyhit"
	labname[13]="Len_missile"
	labname[14]="Len_ecm"
	labname[15]="Len_off"
	labname[16]="Len_ebomb"
	labname[17]="Len_gameover"
	labname[18]="Len_drone"
	labname[19]="Len_alien"
	labname[20]="Len_pause"
	labname[21]="Len_cargo"
	labname[22]="Len_refuel"
	labname[23]="Len_descent"
	labname[24]="Len_jumpgate"
	labname[25]="Len_docking"
	labname[26]="Len_launch"
	labname[27]="Len_hypjump"
	labname[28]="Len_collis"
	labname[29]="Len_destroy"

	secname[1]="LenSec_keypress"
	secname[2]="LenSec_pressopt"
	secname[3]="LenSec_laser0"
	secname[4]="LenSec_laser1"
	secname[5]="LenSec_laser2"
	secname[6]="LenSec_laser3"
	secname[7]="LenSec_laser4"
	secname[8]="LenSec_laser5"
	secname[9]="LenSec_laser6"
	secname[10]="LenSec_laser7"
	secname[11]="LenSec_pilothit"
	secname[12]="LenSec_enemyhit"
	secname[13]="LenSec_missile"
	secname[14]="LenSec_ecm"
	secname[15]="LenSec_off"
	secname[16]="LenSec_ebomb"
	secname[17]="LenSec_gameover"
	secname[18]="LenSec_drone"
	secname[19]="LenSec_alien"
	secname[20]="LenSec_pause"
	secname[21]="LenSec_cargo"
	secname[22]="LenSec_refuel"
	secname[23]="LenSec_descent"
	secname[24]="LenSec_jumpgate"
	secname[25]="LenSec_docking"
	secname[26]="LenSec_launch"
	secname[27]="LenSec_hypjump"
	secname[28]="LenSec_collis"
	secname[29]="LenSec_destroy"

	filname[01]="!bin/keypress.gs"
	filname[02]="!bin/pressopt.gs"
	filname[03]="!bin/laser0.gs"
	filname[04]="!bin/laser1.gs"
	filname[05]="!bin/laser2.gs"
	filname[06]="!bin/laser3.gs"
	filname[07]="!bin/laser4.gs"
	filname[08]="!bin/laser5.gs"
	filname[09]="!bin/laser6.gs"
	filname[10]="!bin/laser7.gs"
	filname[11]="!bin/pilothit.gs"
	filname[12]="!bin/enemyhit.gs"
	filname[13]="!bin/missile.gs"
	filname[14]="!bin/ecm.gs"
	filname[15]="!bin/off.gs"
	filname[16]="!bin/ebomb.gs"
	filname[17]="!bin/gameover.gs"
	filname[18]="!bin/drone.gs"
	filname[19]="!bin/alien.gs"
	filname[20]="!bin/pause.gs"
	filname[21]="!bin/cargo.gs"
	filname[22]="!bin/refuel.gs"
	filname[23]="!bin/descent.gs"
	filname[24]="!bin/jumpgate.gs"
	filname[25]="!bin/docking.gs"
	filname[26]="!bin/launch.gs"
	filname[27]="!bin/hypjump.gs"
	filname[28]="!bin/collis.gs"
	filname[29]="!bin/destroy.gs"

	for i=1,#secname,1 do
	  len = GetLenFile(filname[i])
	  if len%256 == 0 then
	    len = len/256
	  else
	    len = len - (len%256) 
	    len = len/256 + 1
	  end
	  sj.insert_label(secname[i], len) 
	end

	for i=1,#labname,1 do
	  len = GetLenFile(filname[i])
	  sj.insert_label(labname[i], len) 
	end

	ENDLUA





