code wiki / (root) / nx_prepared_character_bundle.nx

nx_prepared_character_bundle.nx source

↩ module page · 27 lines · 858 B

1import "nx_prepared_motion_candidate_t316.nx" 2import "nx_character_prepared_runtime.nx" 3import "nx_syscalls.nx" 4 5func nx_prepared_character_bundle_len(s:*u8)->i64{ 6 var n:i64=0 7 while s[n]!=(0 as u8){n=n+1} 8 return n 9} 10func nx_prepared_character_bundle_cat(dst:*u8,off:i64,s:*u8)->i64{ 11 var i:i64=0 12 while s[i]!=(0 as u8){dst[off]=s[i];off=off+1;i=i+1} 13 return off 14} 15func nx_prepared_character_bundle_js()->*u8{ 16 let a:*u8=nx_prepared_motion_js() 17 let b:*u8=nx_character_prepared_runtime_js() 18 let na:i64=nx_prepared_character_bundle_len(a) 19 let nb:i64=nx_prepared_character_bundle_len(b) 20 if na<=0||nb<=0{return 0 as *u8} 21 let out:*u8=sys_mmap(na+nb+2) 22 let o:i64=nx_prepared_character_bundle_cat(out,0,a) 23 nx_prepared_character_bundle_cat(out,o,b) 24 out[na+nb]=10 as u8 25 out[na+nb+1]=0 as u8 26 return out 27}