struct state_key { struct { int ModeRGB; } unit[8]; }; struct ureg { int file; int idx; }; struct texenv_fragment_program { struct ureg src_previous; }; struct ureg emit_texenv(struct texenv_fragment_program *p, int unit) { struct state_key *key; emit_combine(p, key->unit[unit].ModeRGB); } create_new_program() { struct texenv_fragment_program p; int unit; for (; unit; ++unit) p.src_previous = emit_texenv(&p, unit); }