define xxlist xgetptr $ set $cons = (struct Lisp_Cons *) $ptr xgetptr Qnil set $nil = $ptr set $i = 0 while $cons != $nil && $i < 20 set $car = $cons->u.s.car # xgettype $car # if $type == Lisp_Cons # printf "(cons " # set $consptr = $ptr # xgetptr $car # set $car_ptr = (struct Lisp_Cons *) $ptr # xpp $car_ptr->u.s.car # xgettype $car_ptr->u.s.u.cdr # if $type == Lisp_Cons # printf "..." # end # set $ptr = $consptr # printf ")" # else xpp $car # end xgetptr $cons->u.s.u.cdr set $cons = (struct Lisp_Cons *) $ptr set $i = $i + 1 printf "\n" end if $cons == $nil printf "nil\n" else printf "...\n" p $ptr end end define xpp xgettype $arg0 if $type != Lisp_Misc output $type printf ":" end if $type == Lisp_String xgetptr $arg0 set $caar_str = (struct Lisp_String *) $ptr xprintstr $caar_str end if $type == Lisp_Misc xgetptr $arg0 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type) end if $type == Lisp_Int0 || $type == Lisp_Int1 xgetint $arg0 output $int end if $type == Lisp_Symbol xsymname $arg0 xgetptr $symname set $caar_symname = (struct Lisp_String *) $ptr xprintstr $caar_symname end if $type == Lisp_Cons printf "(" xgetptr $arg0 set $xpp_cons = (struct Lisp_Cons *) $ptr while $xpp_cons != $nil set $xpp_car = $xpp_cons->u.s.car # this will likely fail for nested lists. xpp $xpp_car printf " " set $xpp_cdr = $xpp_cons->u.s.u.cdr xgettype $xpp_cdr if $type == Lisp_Cons xgetptr $xpp_cdr set $xpp_cons = (struct Lisp_Cons *) $ptr else printf ". " xpp $xpp_cdr loop_break end end printf ")" end end