func init
    this.setfield('W_connect', 1)
    this.W_connect = 0
    for(i = 0; i <= this.numworks-1; i++) 
        if(not this.pt_work(i).point == 0)
    		this.W_connect = this.W_connect + 1
		end
	end

    if(this.W_connect > 1)
		//   
		//    
		type = this.pt_event(0).point.datatype
		
		// declares method
		sys.blocks_store()
		
		.println('{').inc()
		
		for(i = 1; i <= this.numevents; i++)
            event('onEvent' + i, field)
    	end	
		
		.dec().println('}')
		sys.blocks_restore()
    end
end

func doEvent(data, index)
	dt = data
	if(this.W_connect > 1)
        type = this.pt_event(i-1).point.datatype
    	if(type==0)
        	type = 2
    	end
        blk.println('\'   user sub #'+this.id)
           .println(this.codename, '(', sys.to_type(dt, type),')')
	else
		for(i = 1; i <= this.numevents; i++)
			evn = 'onEvent' + i
			if(len(index))
				if(len(dt))
					event(evn, dt)
				else
					event(evn)
				end
			else
				event(evn)
			end
		end
	end
end