/* SavePrefs.xdme */

options results
'rxresult $filename'
outfile = result || ".xsrc"

'rxresult $mode'
mode = result
select
    when mode = "ANSI C / C++" then md = "c-mode"
    when mode = "K&R C" then md = "krc-mode"
    otherwise md = translate(mode,"mopgraft","MOPGRAFT") || "-mode"
end
'rxresult $indcol'
i = result
'rxresult $parcol'
p = result
'rxresult $margin'
m = result
line = md "setindcol" i "setparcol" p "margin" m
call open(output, outfile, "W")
call writeln(output, line)
vars = "_f0 _f1 _ff _h0 _h1 _hf _l _r _t _b _p _N _Tl"
do i = 1 to words(vars)
    call writevar(word(vars,i))
end
call close(output)

exit

WriteVar:
    parse arg v
    xcom = "rxresult $" || v
    xcom
    x = result
    if x = "RESULT" then x = ""
    line = "settvar" v "(" || x || ")"
    call writeln(output, line)
return
