Format ElfObj64

include "../include/prog.h" "../include/prog.oh"
include "../include/throw.h" "../include/throw.oh"
include "stdarg.h" "stdarg.oh"

import "for_in_ptr" for_in_ptr
import "is_ainit" is_ainit

importx "free" free

import "ebase" ebase
#aftercallimport ebool

import "action_local" action_local
import "actionf_va" actionf_va
import "actionsf_va" actionsf_va

#this/an action

functionX action(ss ac)
	base globala.jmp_data;call ebase(globala.jmp_data)
#ss ac       actionscript string to be parsed
	call is_ainit((xlog_ainit_false))
	callg action_local(ac)
endfunction
#see at part_done functionX action_init(ss ac)
functionXv actionf(ss buffer) # ,ss format chatgpt: "it ignores your incorrect hint" (va_start)
#ss buffer   the buffer where to sprintf the format and the arguments
#ss format   the format
#...         % arguments here
	%<buffer
	!sv the_va_list=:
	!add the_va_list #buffer
	sv ?ret
	setg ret actionf_va(buffer,the_va_list)
	%>
	return ret
endfunction
functionXv actionsf(svu psize,sv pbuffer)
	%<pbuffer
	!sv the_va_list=:
	!add the_va_list #pbuffer
	callg actionsf_va(psize,pbuffer,the_va_list)
	%>
endfunction
#see at part_done functionXv actionf_init(ss buffer,ss *format)
functionX actiond(ss ac) #deprecated
	sd ptr;set ptr for_in_ptr()
	sd was;set was ptr#
	set ptr# (flag_forin1)
	call action(ac)
	set ptr# was
end

#sprite

import "action_sprite_base" action_sprite_base

functionX action_sprite(sd ?sprite,ss actions)
	base globala.jmp_data;call ebase(globala.jmp_data)
#sd sprite    sprite id
#ss actions   same as action
	call is_ainit((xlog_ainit_false))
	callg action_sprite_base(sprite,actions,(TRUE))
endfunction
functionX action_init_sprite(sd ?sprite,ss actions)
	base globala.jmp_data;call ebase(globala.jmp_data)
	call is_ainit((xlog_ainit_true))
	callg action_sprite_base(sprite,actions,(TRUE))
end

import "actionsf_sprite_va" actionsf_sprite_va

functionXv actionf_sprite(sd ?sprite,ss buffer) #,ss format
#sd sprite    sprite id
#ss buffer    same as actionf
#ss format    same as actionf
	%<buffer
	!sv the_va_list=:
	!add the_va_list #buffer
	callg actionsf_sprite_va(sprite,(xlog_ainit_false),(NULL),#buffer,the_va_list)
	%>
endfunction
functionXv actionf_init_sprite(sd ?sprite,ss buffer)
	%<buffer
	!sv the_va_list=:
	!add the_va_list #buffer
	callg actionsf_sprite_va(sprite,(xlog_ainit_true),(NULL),#buffer,the_va_list)
	%>
end
functionXv actionsf_sprite(sd ?sprite,svu psize,sv pbuffer)
	%<pbuffer
	!sv the_va_list=:
	!add the_va_list #pbuffer
	callg actionsf_sprite_va(sprite,(xlog_ainit_false),psize,pbuffer,the_va_list)
	%>
endfunction
functionXv actionsf_init_sprite(sd ?sprite,svu psize,sv pbuffer)
	%<pbuffer
	!sv the_va_list=:
	!add the_va_list #pbuffer
	callg actionsf_sprite_va(sprite,(xlog_ainit_true),psize,pbuffer,the_va_list)
	%>
end

#both

functionX actions_free(ss buffer)
	call free(buffer)
end

entryraw globala()
