
include "safe.h" "safe.oh"

const EXIT_SUCCESS=0
const EXIT_FAILURE=-1

const SEEK_SET=0
const SEEK_END=2

const Tab=0x9
const Space=0x20
const Comma=0x2c
const ZeroChar=0x30
const NineChar=0x39
const Equal=0x3d
const A=0x41
const F=0x46
const Cl=0x63
const El=0x65
const Fl=0x66
const Il=0x69
const Ml=0x6d
const Rl=0x72

#override include_sec 1
einclude "../include/xlog.h" "../include/xlog.oh" #e? xlog_id is else
include "oadbgdatas.h" "oadbgdatas.oh"

const mark_nothing=-1
const no_index=-1

const sprites_realloc_onepart=10*:
#to be at least 2, for presprites_init; and 1 for sprite_done (root 0 move to final)

function preoadata()
	valuexu presprites#1
	dataxu size#1
end
function presprite() #presprites_size is intern
	valuexu apreframe#1

	valuexu preframes#1
	dataxu  size#1     #same as parent, at button is extra, here are ui16 frames, copy sprites mechanism that is padded for debugger
end
function preframe()
	valuexu ustrings#1
	dataxu ussize#1  ;#Count=ui16 * :
	#attention that in a constantpool of actionrecordheader of ui16 there are, at maximum, 3 bytes constants(null and two bytes) counting in total 0xffff/3
	#null and one byte are 255 maximum
	valueu restore_ustrings#1

	valuexu strings#1
	dataxu ssize#1  ;#Count=ui16 * :
	valueu restore_dstrings#1

	dataxu size#1  #DoAction has ui32 but overall also is a ui32

	valueu abranch#1

	valueu branchpointer#1  #starting from abranch and descending

	valueu action_last#1
	valuexu actions_if#1 ;#is also between action calls, if jump forwards to End must set if_flag
	dataxu actions_if_size#1
	valuexu actions_jump#1 #here is ok to have NULL next if to End
	dataxu actions_jump_size#1

	#log only
	value log_recalculation#1 #can be on 32 bits, multiple actions with a big pool, or multiple actions constant16 to constant8 reductions. good at log
	#
	valueu log_mem#1
	valueu log_size#1
	valueu log_allsize#1  #this is increasing so much at last indents
	dataxu log_indents#1  #same as functions
	#
	valueu log_xsize#1   ;#example: a[a[a]]=a[a[a]] is 40 size vs 192 xsize
	dataxu log_branchid#1 #for strings log
	dataxu log_sizedfunctions#1  #why to make something spacial for oadata when here is fast
end
function branch()
	valueu cuts#1
	valueu size#1  # there are examples which tends to x4 from DoAction to .x. a branchcut has 12(16 if aligned), there are no 3 size(tag+end) DoAction from actionswf lib

	valuexu innerbranches#1 #for define functions and for 3rd part
	dataxu isize#1  #same as oadata functions plus for 3rd that is bigger, a jump,push,define at least

	valueu topbranch#1
	valueu suprabranch#1
	valueu subbranch#1

	dataxu offset#1       #at jumpforward, and at log
	dataxu offset_loop#1  #if the branch has a loop start, else use no_loop . and at forin_breaks
	dataxu offset_break#1 #only 1 is logical, at second must error else will do segmentation
	valueu action_top#1      #branch start action, for mark, after compare
	valueu action_if#1   #is last suprabranch action (if is not root) to resolve jumpforward (ActionIf) if will be the case
	valueu action_loop#1 #if is an offset_loop, next will be the action_loop that can be linked (there are exceptions like ret_cont_break cases)
	valueu action_break#1
	valueu action_cut#1  #to resolve cuts, can be the same with action_loop when whiletrue and then the cuts

	dataxu log_id#1  #for strings log
	wordxu log_fn#1  #nostalgia
	wordxu log_backjumps#1 #not dataxu? totalvalues is short
	wordxu log_fwdjumps#1  #not dataxu? totalvalues is short
end
function branchcut()
	vdataxu x#1   #ints everywhere and pointers for strings, will not memcpy
	dataxu size#1 #same x size doctrine
end
function ustring()
	valueu base#1
	valueu off#1
	valueu ubranch#1
end
function string()
	valueu base#1
	valueu off#1
	valuexu branches#1
	dataxu size#1 #same as number of branches
end

const from_action=0
const from_show=1

const pad_default=0x100

const no_loop=0xffFFffFF

const output_nl=xlog_nl #this must be the same with what is in memnl(), or change it
