From 96bfaa339b1061db08887e95b043cf641b9c2474 Mon Sep 17 00:00:00 2001
From: jsalmon3 <>
Date: Wed, 1 Oct 2003 01:51:31 +0000
Subject: [PATCH] Cleanup

---
 src/ui/script_ui.cpp | 3417 +++++++++++++++++++++---------------------
 1 file changed, 1719 insertions(+), 1698 deletions(-)

diff --git a/src/ui/script_ui.cpp b/src/ui/script_ui.cpp
index d32ba9dac..da76370e3 100644
--- a/src/ui/script_ui.cpp
+++ b/src/ui/script_ui.cpp
@@ -77,35 +77,38 @@ global char* DamageMissile;
 // helper functions used for actions that need target selection
 global void ChooseTargetBegin(int action)
 {
-    CursorState=CursorStateSelect;
-    GameCursor=TheUI.YellowHair.Cursor;
-    CursorAction=action;
-    MustRedraw|=RedrawCursor;
+    CursorState = CursorStateSelect;
+    GameCursor = TheUI.YellowHair.Cursor;
+    CursorAction = action;
+    MustRedraw |= RedrawCursor;
     
-    if( ChooseTargetBeginHook == NIL ) {
+    if (ChooseTargetBeginHook == NIL) {
 	DebugLevel0Fn("Hook is NIL!\n");
     } else {
-        gh_eval(ChooseTargetBeginHook,NIL);
+        gh_eval(ChooseTargetBeginHook, NIL);
     }
     // FIXME: maybe write this from ccl?
     SetStatusLine("Select Target");
 }
 
+/**
+**	FIXME: docu
+*/
 global void ChooseTargetFinish(void)
 {
-    if( CursorState!=CursorStateSelect ) {
+    if (CursorState != CursorStateSelect) {
 	return;
     }
     ClearStatusLine();
-    CursorState=CursorStatePoint;
-    GameCursor=TheUI.Point.Cursor;
-    MustRedraw|=RedrawCursor;
-    CursorBuilding=0;
+    CursorState = CursorStatePoint;
+    GameCursor = TheUI.Point.Cursor;
+    MustRedraw |= RedrawCursor;
+    CursorBuilding = 0;
     
-    if( ChooseTargetFinishHook == NIL ) {
+    if (ChooseTargetFinishHook == NIL) {
 	DebugLevel0Fn("Hook is NIL!\n");
     } else {
-	gh_eval(ChooseTargetFinishHook,NIL);
+	gh_eval(ChooseTargetFinishHook, NIL);
     }
 }
 
@@ -141,9 +144,9 @@ local SCM CclCommandAttack(void)
 */
 local SCM CclCommandCancelUpgrade(void)
 {
-    if( Selected[0]->Orders[0].Action==UnitActionUpgradeTo ) {
+    if (Selected[0]->Orders[0].Action == UnitActionUpgradeTo) {
 	SendCommandCancelUpgradeTo(Selected[0]);
-    } else if( Selected[0]->Orders[0].Action==UnitActionResearch ) {
+    } else if (Selected[0]->Orders[0].Action == UnitActionResearch) {
 	SendCommandCancelResearch(Selected[0]);
     }
     // FIXME: must call SelectedUnitChanged() here?
@@ -155,17 +158,18 @@ local SCM CclCommandCancelUpgrade(void)
 */
 local SCM CclCommandBuild(SCM arg)
 {
-    char * ident;
+    char* ident;
+    UnitType* type;
+
     ident = gh_scm2newstr(arg, NULL);
-    UnitType * type;
-    type=UnitTypeByIdent(ident);
+    type = UnitTypeByIdent(ident);
     free(ident);
 
-    if( !PlayerCheckUnitType(ThisPlayer,type) ) {
+    if (!PlayerCheckUnitType(ThisPlayer, type)) {
 	ChooseTargetBegin(ButtonBuild);
-	GameCursor=TheUI.Point.Cursor;
-	CursorBuilding=type;
-	MustRedraw|=RedrawCursor;
+	GameCursor = TheUI.Point.Cursor;
+	CursorBuilding = type;
+	MustRedraw |= RedrawCursor;
     }
 
     return SCM_UNSPECIFIED;
@@ -176,26 +180,26 @@ local SCM CclCommandBuild(SCM arg)
 */
 local SCM CclCommandTrainUnit(SCM arg)
 {
-    char * ident;
+    char* ident;
+    UnitType* type;
+
     ident = gh_scm2newstr(arg, NULL);
-    UnitType * type;
-    type=UnitTypeByIdent(ident);
+    type = UnitTypeByIdent(ident);
     free(ident);
 
     // FIXME: Johns: I want to place commands in queue, even if not
     // FIXME:	enough resources are available.
     // FIXME: training queue full check is not correct for network.
     // FIXME: this can be correct written, with a little more code.
-    if( Selected[0]->Orders[0].Action==UnitActionTrain
-	&& (Selected[0]->Data.Train.Count==MAX_UNIT_TRAIN
-	    || !EnableTrainingQueue) ) {
-	NotifyPlayer(Selected[0]->Player,NotifyYellow,Selected[0]->X,
-		     Selected[0]->Y, "Unit training queue is full" );
-    } else if( PlayerCheckFood(ThisPlayer,type)
-	       && !PlayerCheckUnitType(ThisPlayer,type) ) {
+    if (Selected[0]->Orders[0].Action == UnitActionTrain &&
+	    (Selected[0]->Data.Train.Count == MAX_UNIT_TRAIN ||
+		!EnableTrainingQueue)) {
+	NotifyPlayer(Selected[0]->Player, NotifyYellow,Selected[0]->X,
+	     Selected[0]->Y, "Unit training queue is full");
+    } else if (PlayerCheckFood(ThisPlayer, type) &&
+	    !PlayerCheckUnitType(ThisPlayer, type)) {
 	//PlayerSubUnitType(ThisPlayer,type);
-	SendCommandTrainUnit(Selected[0],type
-			     ,!(KeyModifiers&ModifierShift));
+	SendCommandTrainUnit(Selected[0],type, !(KeyModifiers & ModifierShift));
 	ClearStatusLine();
     }
 
@@ -208,39 +212,38 @@ local SCM CclCommandTrainUnit(SCM arg)
 local SCM CclCommandCastSpell(SCM arg)
 {
     int i;
-    char * spell_str;
+    char* spell_str;
     SpellType * spell;
     int spell_id;
 
-    spell_str=gh_scm2newstr(arg,NULL);
-    spell=SpellTypeByIdent(spell_str);
-    spell_id=SpellIdByIdent(spell_str);
+    spell_str = gh_scm2newstr(arg, NULL);
+    spell = SpellTypeByIdent(spell_str);
+    spell_id = SpellIdByIdent(spell_str);
     free(spell_str);
 
     // FIXME: maxy: make the modifiers available from ccl (and maybe
     // which mouse button was pressed, too, for the action scripts)
 
-    if( KeyModifiers&ModifierControl ) {
+    if (KeyModifiers & ModifierControl) {
 	// auto-cast the spell
 	int autocast;
-	if( !CanAutoCastSpell(spell) ) {
-	    PlayGameSound(GameSounds.PlacementError.Sound
-			  ,MaxSampleVolume);
+	if (!CanAutoCastSpell(spell)) {
+	    PlayGameSound(GameSounds.PlacementError.Sound, MaxSampleVolume);
 	    return SCM_UNSPECIFIED;
 	}
 
-	autocast=0;
+	autocast = 0;
 	// If any selected unit doesn't have autocast on turn it on
 	// for everyone
-	for( i=0; i<NumSelected; ++i ) {
-	    if( Selected[i]->AutoCastSpell!=spell) {
-		autocast=1;
+	for (i = 0; i < NumSelected; ++i) {
+	    if (Selected[i]->AutoCastSpell != spell) {
+		autocast = 1;
 		break;
 	    }
 	}
-	for( i=0; i<NumSelected; ++i ) {
-	    if( !autocast || Selected[i]->AutoCastSpell!=spell ) {
-		SendCommandAutoSpellCast(Selected[i],spell_id,autocast);
+	for (i = 0; i < NumSelected; ++i) {
+	    if (!autocast || Selected[i]->AutoCastSpell != spell) {
+		SendCommandAutoSpellCast(Selected[i], spell_id, autocast);
 	    }
 	}
     } else {
@@ -266,7 +269,8 @@ local SCM CclCommandMove(void)
 local SCM CclCommandStop(void)
 {
     int i;
-    for( i=0; i<NumSelected; ++i ) {
+
+    for (i = 0; i < NumSelected; ++i) {
 	SendCommandStopUnit(Selected[i]);
     }
     return SCM_UNSPECIFIED;
@@ -277,18 +281,18 @@ local SCM CclCommandStop(void)
 */
 local SCM CclCommandResearch(SCM arg)
 {
-    char * what;
-    Upgrade * upgrade;
+    char* what;
+    Upgrade* upgrade;
 
-    what = gh_scm2newstr(arg,NULL);
-    upgrade=UpgradeByIdent( what );
+    what = gh_scm2newstr(arg, NULL);
+    upgrade = UpgradeByIdent(what);
     free(what);
 
-    if( !PlayerCheckCosts(ThisPlayer,upgrade->Costs) ) {
+    if (!PlayerCheckCosts(ThisPlayer,upgrade->Costs)) {
 	//PlayerSubCosts(ThisPlayer,Upgrades[i].Costs);
 	// FIXME: key modifier check does not belong here
-	SendCommandResearch(Selected[0],upgrade
-			    ,!(KeyModifiers&ModifierShift));
+	SendCommandResearch(Selected[0], upgrade,
+	    !(KeyModifiers & ModifierShift));
 	ClearStatusLine();
     }
     return SCM_UNSPECIFIED;
@@ -309,27 +313,28 @@ local SCM CclCommandUnload(void)
 local SCM CclGetCostString(SCM arg)
 {
     char s[80];
-    char * pos;
-    char * ident;
+    char* pos;
+    char* ident;
     int i;
-    int * costs;
+    int* costs;
+    UnitType* type;
+    Upgrade* upgrade;
+
     ident = gh_scm2newstr(arg, NULL);
-    UnitType * type;
-    Upgrade * upgrade;
     costs = NULL;
-    type=UnitTypeByIdent(ident);
-    if( type ) {
-	costs=type->Stats[ThisPlayer->Player].Costs;
+    type = UnitTypeByIdent(ident);
+    if (type) {
+	costs = type->Stats[ThisPlayer->Player].Costs;
     } else {
-	upgrade=UpgradeByIdent(ident);
-	if( upgrade ) {
-	    costs=upgrade->Costs;
+	upgrade = UpgradeByIdent(ident);
+	if (upgrade) {
+	    costs = upgrade->Costs;
 	}
 	/* TODO: mana costs
-	   SetCosts(SpellTypeById( v )->ManaCost,0,NULL);
+	   SetCosts(SpellTypeById(v)->ManaCost, 0, NULL);
 	*/
     }
-    if( !costs ) {
+    if (!costs) {
 	sprintf(s, "[NO COSTS: '%s']", ident);
 	free(ident);
 	return gh_str02scm(s);
@@ -338,8 +343,8 @@ local SCM CclGetCostString(SCM arg)
 
     pos = s;
     // do not draw time cost
-    for( i=1; i<MaxCosts; i++ ) {
-	if( costs[i] ) {
+    for (i = 1; i < MaxCosts; ++i) {
+	if (costs[i]) {
 	    pos += sprintf(pos, "$%d %d  ", i, costs[i]);
 	}
     }
@@ -352,14 +357,15 @@ local SCM CclGetCostString(SCM arg)
 local SCM CclCheckAllowed(SCM arg)
 {
     int allow;
-    char * what;
-    what = gh_scm2newstr(arg,NULL);
-    allow = CheckDependByIdent( ThisPlayer,what );
-    if( allow && !strncmp( what, "upgrade-", 8 ) ) {
-	allow=UpgradeIdentAllowed( ThisPlayer, what )=='A';
+    char* what;
+
+    what = gh_scm2newstr(arg, NULL);
+    allow = CheckDependByIdent(ThisPlayer, what);
+    if (allow && !strncmp(what, "upgrade-", 8)) {
+	allow = UpgradeIdentAllowed(ThisPlayer, what) == 'A';
     }
     free(what);
-    return allow?SCM_BOOL_T:SCM_BOOL_F;
+    return allow ? SCM_BOOL_T : SCM_BOOL_F;
 }
 
 /**
@@ -367,20 +373,19 @@ local SCM CclCheckAllowed(SCM arg)
 */
 local SCM CclCommandUpgradeTo(SCM arg)
 {
-    char * what;
-    UnitType * type;
-    what = gh_scm2newstr(arg,NULL);
+    char* what;
+    UnitType* type;
+
+    what = gh_scm2newstr(arg, NULL);
     type = UnitTypeByIdent(what);
     free(what);
 
-    if( !PlayerCheckUnitType(ThisPlayer,type) ) {
-	DebugLevel3("Upgrade to %s %d %d\n"
-		    _C_ type->Ident
-		    _C_ type->_Costs[GoldCost]
-		    _C_ type->_Costs[WoodCost]);
+    if (!PlayerCheckUnitType(ThisPlayer, type)) {
+	DebugLevel3("Upgrade to %s %d %d\n" _C_ type->Ident _C_
+	    type->_Costs[GoldCost] _C_ type->_Costs[WoodCost]);
 	// FIXME: should not check for key modifiers here
-	SendCommandUpgradeTo(Selected[0],type
-			     ,!(KeyModifiers&ModifierShift));
+	SendCommandUpgradeTo(Selected[0],type,
+	    !(KeyModifiers & ModifierShift));
 	ClearStatusLine();
     }
     return SCM_UNSPECIFIED;
@@ -401,10 +406,10 @@ local SCM CclCommandAttackGround(void)
 local SCM CclCommandReturnGoods(void)
 {
     int i;
-    for( i=0; i<NumSelected; ++i ) {
+    for (i = 0; i < NumSelected; ++i) {
 	// FIXME: should not check for key modifiers here
-	SendCommandReturnGoods(Selected[i],NoUnitP
-			       ,!(KeyModifiers&ModifierShift));
+	SendCommandReturnGoods(Selected[i],NoUnitP,
+	    !(KeyModifiers & ModifierShift));
     }
     return SCM_UNSPECIFIED;
 }
@@ -415,12 +420,12 @@ local SCM CclCommandReturnGoods(void)
 */
 local SCM CclCommandCancel(void)
 {
-    if( CursorState==CursorStateSelect ) {
+    if (CursorState == CursorStateSelect) {
 	ClearStatusLine();
-	GameCursor=TheUI.Point.Cursor;
-	CursorBuilding=NULL;
-	CursorState=CursorStatePoint;
-	MustRedraw|=RedrawCursor;
+	GameCursor = TheUI.Point.Cursor;
+	CursorBuilding = NULL;
+	CursorState = CursorStatePoint;
+	MustRedraw |= RedrawCursor;
     }
     return SCM_UNSPECIFIED;
 }
@@ -431,7 +436,7 @@ local SCM CclCommandCancel(void)
 local SCM CclCommandCancelBuilding(void)
 {
     SendCommandCancelBuilding(Selected[0],
-			      Selected[0]->Data.Builded.Worker);
+	Selected[0]->Data.Builded.Worker);
     ClearStatusLine();
     return SCM_UNSPECIFIED;
 }
@@ -441,9 +446,9 @@ local SCM CclCommandCancelBuilding(void)
 */
 local SCM CclCommandCancelTrainUnit(void)
 {
-    DebugCheck( Selected[0]->Orders[0].Action!=UnitActionTrain
-		|| !Selected[0]->Data.Train.Count );
-    SendCommandCancelTraining(Selected[0],-1,NULL);
+    DebugCheck(Selected[0]->Orders[0].Action!=UnitActionTrain ||
+	!Selected[0]->Data.Train.Count);
+    SendCommandCancelTraining(Selected[0], -1, NULL);
     ClearStatusLine();
     // The SelectedUnitChanged hook will be called when the command
     // finally got through, I hope.
@@ -465,10 +470,11 @@ local SCM CclCommandRepair(void)
 local SCM CclCommandStandGround(void)
 {
     int i;
-    for( i=0; i<NumSelected; ++i ) {
+
+    for (i = 0; i < NumSelected; ++i) {
 	// FIXME: key modifiers don't belong here
-	SendCommandStandGround(Selected[i]
-			       ,!(KeyModifiers&ModifierShift));
+	SendCommandStandGround(Selected[i],
+	    !(KeyModifiers & ModifierShift));
     }
     return SCM_UNSPECIFIED;
 }
@@ -488,10 +494,10 @@ local SCM CclCommandDemolish(void)
 */
 local SCM CclSelectedIsBuilding(void)
 {
-    if( NumSelected == 0) {
+    if (NumSelected == 0) {
 	return SCM_UNSPECIFIED;
     }
-    if( Selected[0]->Type->Building ) {
+    if (Selected[0]->Type->Building) {
 	return SCM_BOOL_T;
     } else {
 	return SCM_BOOL_F;
@@ -503,10 +509,10 @@ local SCM CclSelectedIsBuilding(void)
 */
 local SCM CclSelectedIsRepairing(void)
 {
-    if( NumSelected == 0) {
+    if (NumSelected == 0) {
 	return SCM_UNSPECIFIED;
     }
-    if( Selected[0]->Orders[0].Action==UnitActionTrain ) {
+    if (Selected[0]->Orders[0].Action == UnitActionTrain) {
 	return SCM_BOOL_T;
     } else {
 	return SCM_BOOL_F;
@@ -518,10 +524,10 @@ local SCM CclSelectedIsRepairing(void)
 */
 local SCM CclSelectedIsTraining(void)
 {
-    if( NumSelected == 0) {
+    if (NumSelected == 0) {
 	return SCM_UNSPECIFIED;
     }
-    if( Selected[0]->Orders[0].Action==UnitActionTrain ) {
+    if (Selected[0]->Orders[0].Action == UnitActionTrain) {
 	return SCM_BOOL_T;
     } else {
 	return SCM_BOOL_F;
@@ -533,11 +539,11 @@ local SCM CclSelectedIsTraining(void)
 */
 local SCM CclSelectedIsUpgrading(void)
 {
-    if( NumSelected == 0) {
+    if (NumSelected == 0) {
 	return SCM_UNSPECIFIED;
     }
-    if( Selected[0]->Orders[0].Action==UnitActionResearch 
-	|| Selected[0]->Orders[0].Action==UnitActionUpgradeTo ) {
+    if (Selected[0]->Orders[0].Action == UnitActionResearch ||
+	    Selected[0]->Orders[0].Action == UnitActionUpgradeTo) {
 	return SCM_BOOL_T;
     } else {
 	return SCM_BOOL_F;
@@ -549,7 +555,7 @@ local SCM CclSelectedIsUpgrading(void)
 */
 local SCM CclSelectedGetRace(void)
 {
-    if( NumSelected == 0 ) {
+    if (NumSelected == 0) {
 	return SCM_UNSPECIFIED;
     }
     DebugLevel0Fn("RaceString: %s\n" _C_ Selected[0]->Player->RaceName);
@@ -562,10 +568,10 @@ local SCM CclSelectedGetRace(void)
 */
 local SCM CclSelectedGetSpeed(void)
 {
-    if( NumSelected == 0 ) {
+    if (NumSelected == 0) {
 	return SCM_UNSPECIFIED;
     }
-   return gh_int2scm(Selected[0]->Stats->Speed);
+    return gh_int2scm(Selected[0]->Stats->Speed);
 }
 
 /**
@@ -573,10 +579,10 @@ local SCM CclSelectedGetSpeed(void)
 */
 local SCM CclSelectedOwnedByPlayer(void)
 {
-    if( NumSelected == 0) {
+    if (NumSelected == 0) {
 	return SCM_BOOL_F;
     }
-    if( Selected[0]->Player==ThisPlayer ) {
+    if (Selected[0]->Player == ThisPlayer) {
 	return SCM_BOOL_T;
     } else {
 	return SCM_BOOL_F;
@@ -590,21 +596,22 @@ local SCM CclSelectedResourceLoaded(void)
 {
     int i;
     int type;
-    Unit * unit;
+    Unit* unit;
+
     type = -1;
-    for ( i=0; i<NumSelected; i++ ) {
+    for (i = 0; i<NumSelected; ++i) {
 	unit = Selected[i];
-	if( unit->CurrentResource && unit->Value && 
-	    (!unit->Type->ResInfo[unit->CurrentResource]->LoseResources || 
-	     unit->Value >= unit->Type->ResInfo[unit->CurrentResource]->ResourceCapacity) ) {
-	    if( type == -1 ) {
+	if (unit->CurrentResource && unit->Value && 
+		(!unit->Type->ResInfo[unit->CurrentResource]->LoseResources || 
+		    unit->Value >= unit->Type->ResInfo[unit->CurrentResource]->ResourceCapacity)) {
+	    if (type == -1) {
 		type = unit->CurrentResource;
-	    } else if( type != unit->CurrentResource ) {
+	    } else if (type != unit->CurrentResource) {
 		return gh_str02scm("mixed");
 	    }
 	}
     }
-    if( type == -1 ) {
+    if (type == -1) {
 	return SCM_UNSPECIFIED;
     }
     return gh_str02scm(DefaultResourceNames[type]);
@@ -616,14 +623,15 @@ local SCM CclSelectedResourceLoaded(void)
 local SCM CclSelectedMixedUnits(void)
 {
     int i;
-    UnitType * type;
-    if( NumSelected<2 ) {
+    UnitType* type;
+
+    if (NumSelected < 2) {
 	return SCM_BOOL_F;
     }
 
     type = Selected[0]->Type;
-    for ( i=1; i<NumSelected; i++ ) {
-	if ( Selected[i]->Type != type ) {
+    for (i = 1; i < NumSelected; ++i) {
+	if (Selected[i]->Type != type) {
 	    return SCM_BOOL_T;
 	}
     }
@@ -638,41 +646,41 @@ local SCM CclSelectedGetAction(void)
     int j;
     UnitAction action;
 
-    if( NumSelected == 0 ) {
+    if (NumSelected == 0) {
 	return gh_str02scm("Invalid");
     }
     action = Selected[0]->Orders[0].Action;
-    for( j=1; j<NumSelected; ++j ) {
-	if( Selected[j]->Orders[0].Action!=action ) {
+    for (j = 1; j < NumSelected; ++j) {
+	if (Selected[j]->Orders[0].Action != action) {
 	    return gh_str02scm("Mixed");
 	}
     }
 
     switch (action) {
-    case UnitActionNone: return gh_str02scm("None");
-    case UnitActionStill: return gh_str02scm("Still"); break;
-    case UnitActionStandGround: return gh_str02scm("StandGround"); break;
-    case UnitActionFollow: return gh_str02scm("Follow"); break;
-    case UnitActionMove: return gh_str02scm("Move"); break;
-    case UnitActionAttack: return gh_str02scm("Attack"); break;
-    case UnitActionAttackGround: return gh_str02scm("AttackGround"); break;
-    case UnitActionDie: return gh_str02scm("Die"); break;
-    case UnitActionSpellCast: return gh_str02scm("SpellCast"); break;
-    case UnitActionTrain: return gh_str02scm("Train"); break;
-    case UnitActionUpgradeTo: return gh_str02scm("UpgradeTo"); break;
-    case UnitActionResearch: return gh_str02scm("Research"); break;
-    case UnitActionBuilded: return gh_str02scm("Builded"); break;
-    case UnitActionBoard: return gh_str02scm("Board"); break;
-    case UnitActionUnload: return gh_str02scm("Unload"); break;
-    case UnitActionPatrol: return gh_str02scm("Patrol"); break;
-    case UnitActionBuild: return gh_str02scm("Build"); break;
-    case UnitActionRepair: return gh_str02scm("Repair"); break;
-    case UnitActionResource: return gh_str02scm("Resource"); break;
-    case UnitActionReturnGoods: return gh_str02scm("ReturnGoods"); break;
-    case UnitActionDemolish: return gh_str02scm("Demolish"); break;
-    default:
-	DebugLevel0Fn("FIXME: invalid action id %d\n" _C_ action);
-	return gh_str02scm("invalid");
+	case UnitActionNone: return gh_str02scm("None");
+	case UnitActionStill: return gh_str02scm("Still"); break;
+	case UnitActionStandGround: return gh_str02scm("StandGround"); break;
+	case UnitActionFollow: return gh_str02scm("Follow"); break;
+	case UnitActionMove: return gh_str02scm("Move"); break;
+	case UnitActionAttack: return gh_str02scm("Attack"); break;
+	case UnitActionAttackGround: return gh_str02scm("AttackGround"); break;
+	case UnitActionDie: return gh_str02scm("Die"); break;
+	case UnitActionSpellCast: return gh_str02scm("SpellCast"); break;
+	case UnitActionTrain: return gh_str02scm("Train"); break;
+	case UnitActionUpgradeTo: return gh_str02scm("UpgradeTo"); break;
+	case UnitActionResearch: return gh_str02scm("Research"); break;
+	case UnitActionBuilded: return gh_str02scm("Builded"); break;
+	case UnitActionBoard: return gh_str02scm("Board"); break;
+	case UnitActionUnload: return gh_str02scm("Unload"); break;
+	case UnitActionPatrol: return gh_str02scm("Patrol"); break;
+	case UnitActionBuild: return gh_str02scm("Build"); break;
+	case UnitActionRepair: return gh_str02scm("Repair"); break;
+	case UnitActionResource: return gh_str02scm("Resource"); break;
+	case UnitActionReturnGoods: return gh_str02scm("ReturnGoods"); break;
+	case UnitActionDemolish: return gh_str02scm("Demolish"); break;
+	default:
+	    DebugLevel0Fn("FIXME: invalid action id %d\n" _C_ action);
+	    return gh_str02scm("invalid");
     }
 }
 
@@ -681,8 +689,8 @@ local SCM CclSelectedGetAction(void)
 */
 local SCM CclSelectedDrawButtons(void)
 {
-    if( NumSelected > 0 ) {
-	if( Selected[0]->Type->AddButtonsHook == NIL ) {
+    if (NumSelected > 0) {
+	if (Selected[0]->Type->AddButtonsHook == NIL) {
 	    DebugLevel0Fn("Hook is NIL!\n");
 	} else {
 	    /*
@@ -690,7 +698,7 @@ local SCM CclSelectedDrawButtons(void)
 	    gh_display(Selected[0]->Type->AddButtonsHook);
 	    gh_newline();
 	    */
-	    gh_eval(Selected[0]->Type->AddButtonsHook,NIL);
+	    gh_eval(Selected[0]->Type->AddButtonsHook, NIL);
 	}
     }
     return SCM_UNSPECIFIED;
@@ -707,14 +715,14 @@ local SCM CclSetColorCycleAll(SCM flag)
 {
     int old;
 
-    old=ColorCycleAll;
-    if( gh_boolean_p(flag) ) {
-	ColorCycleAll=gh_scm2bool(flag);
+    old = ColorCycleAll;
+    if (gh_boolean_p(flag)) {
+	ColorCycleAll = gh_scm2bool(flag);
     } else {
-	ColorCycleAll=gh_scm2int(flag);
+	ColorCycleAll = gh_scm2int(flag);
     }
 
-    return old<0 ? gh_int2scm(old) : gh_bool2scm(old);
+    return old < 0 ? gh_int2scm(old) : gh_bool2scm(old);
 }
 
 /**
@@ -727,8 +735,8 @@ local SCM CclSetMouseScrollSpeedDefault(SCM speed)
 {
     int old;
 
-    old=TheUI.MouseScrollSpeedDefault;
-    TheUI.MouseScrollSpeedDefault=gh_scm2int(speed);
+    old = TheUI.MouseScrollSpeedDefault;
+    TheUI.MouseScrollSpeedDefault = gh_scm2int(speed);
 
     return gh_int2scm(old);
 }
@@ -743,8 +751,8 @@ local SCM CclSetMouseScrollSpeedControl(SCM speed)
 {
     int old;
 
-    old=TheUI.MouseScrollSpeedControl;
-    TheUI.MouseScrollSpeedControl=gh_scm2int(speed);
+    old = TheUI.MouseScrollSpeedControl;
+    TheUI.MouseScrollSpeedControl = gh_scm2int(speed);
 
     return gh_int2scm(old);
 }
@@ -760,10 +768,10 @@ local SCM CclSetMouseAdjust(SCM adjust)
     SCM old;
     int i;
 
-    old=gh_int2scm(TheUI.MouseAdjust);
-    i=gh_scm2int(adjust);
-    if( i>0 ) {
-	TheUI.MouseAdjust=i;
+    old = gh_int2scm(TheUI.MouseAdjust);
+    i = gh_scm2int(adjust);
+    if (i > 0) {
+	TheUI.MouseAdjust = i;
     }
 
     return old;
@@ -779,8 +787,8 @@ local SCM CclSetMouseScale(SCM scale)
 {
     SCM old;
 
-    old=gh_int2scm(TheUI.MouseScale);
-    TheUI.MouseScale=gh_scm2int(scale);
+    old = gh_int2scm(TheUI.MouseScale);
+    TheUI.MouseScale = gh_scm2int(scale);
 
     return old;
 }
@@ -795,16 +803,16 @@ local SCM CclSetClickMissile(SCM missile)
 {
     SCM old;
 
-    old=NIL;
+    old = NIL;
     
-    if( ClickMissile ) {
-	old=gh_str02scm(ClickMissile);
-	free( ClickMissile );
+    if (ClickMissile) {
+	old = gh_str02scm(ClickMissile);
+	free(ClickMissile);
 	ClickMissile = NULL;
     }
 
-    if( !gh_null_p(missile) ) {
-	ClickMissile=gh_scm2newstr(missile,NULL);
+    if (!gh_null_p(missile)) {
+	ClickMissile = gh_scm2newstr(missile, NULL);
     }
     return old;
 }
@@ -819,16 +827,16 @@ local SCM CclSetDamageMissile(SCM missile)
 {
     SCM old;
 
-    old=NIL;
+    old = NIL;
 
-    if( DamageMissile ) {
-	old=gh_str02scm(DamageMissile);
-	free( DamageMissile );
+    if (DamageMissile) {
+	old = gh_str02scm(DamageMissile);
+	free(DamageMissile);
 	DamageMissile = NULL;
     }
 
-    if( !gh_null_p(missile) ) {
-	DamageMissile=gh_scm2newstr(missile,NULL);
+    if (!gh_null_p(missile)) {
+	DamageMissile = gh_scm2newstr(missile, NULL);
     }
     return old;
 }
@@ -843,16 +851,16 @@ local SCM CclSetContrast(SCM contrast)
     int i;
     SCM old;
 
-    old=gh_int2scm(TheUI.Contrast);
-    i=gh_scm2int(contrast);
-    if( i<0 || i>400 ) {
+    old = gh_int2scm(TheUI.Contrast);
+    i = gh_scm2int(contrast);
+    if (i < 0 || i > 400) {
 	PrintFunction();
-	fprintf(stdout,"Contrast should be 0-400\n");
-	i=100;
+	fprintf(stdout, "Contrast should be 0-400\n");
+	i = 100;
     }
-    TheUI.Contrast=i;
+    TheUI.Contrast = i;
     VideoCreatePalette(GlobalPalette);	// rebuild palette
-    MustRedraw=RedrawEverything;
+    MustRedraw = RedrawEverything;
 
     return old;
 }
@@ -868,16 +876,16 @@ local SCM CclSetBrightness(SCM brightness)
     int i;
     SCM old;
 
-    old=gh_int2scm(TheUI.Brightness);
-    i=gh_scm2int(brightness);
-    if( i<-100 || i>100 ) {
+    old = gh_int2scm(TheUI.Brightness);
+    i = gh_scm2int(brightness);
+    if (i < -100 || i > 100) {
 	PrintFunction();
-	fprintf(stdout,"Brightness should be -100-100\n");
-	i=0;
+	fprintf(stdout, "Brightness should be -100-100\n");
+	i = 0;
     }
-    TheUI.Brightness=i;
+    TheUI.Brightness = i;
     VideoCreatePalette(GlobalPalette);	// rebuild palette
-    MustRedraw=RedrawEverything;
+    MustRedraw = RedrawEverything;
 
     return old;
 }
@@ -893,16 +901,16 @@ local SCM CclSetSaturation(SCM saturation)
     int i;
     SCM old;
 
-    old=gh_int2scm(TheUI.Saturation);
-    i=gh_scm2int(saturation);
-    if( i<-100 || i>200 ) {
+    old = gh_int2scm(TheUI.Saturation);
+    i = gh_scm2int(saturation);
+    if (i < -100 || i > 200) {
 	PrintFunction();
-	fprintf(stdout,"Saturation should be -100-200\n");
-	i=0;
+	fprintf(stdout, "Saturation should be -100-200\n");
+	i = 0;
     }
-    TheUI.Saturation=i;
+    TheUI.Saturation = i;
     VideoCreatePalette(GlobalPalette);	// rebuild palette
-    MustRedraw=RedrawEverything;
+    MustRedraw = RedrawEverything;
 
     return old;
 }
@@ -915,11 +923,11 @@ local SCM CclSetSaturation(SCM saturation)
 */
 local SCM CclSetVideoResolution(SCM width,SCM height)
 {
-    if( CclInConfigFile ) {
+    if (CclInConfigFile) {
 	// May have been set from the command line
-	if( !VideoWidth || !VideoHeight ) {
-	    VideoWidth=gh_scm2int(width);
-	    VideoHeight=gh_scm2int(height);
+	if (!VideoWidth || !VideoHeight) {
+	    VideoWidth = gh_scm2int(width);
+	    VideoHeight = gh_scm2int(height);
 	}
     }
     return SCM_UNSPECIFIED;
@@ -936,9 +944,9 @@ local SCM CclSetVideoFullscreen(SCM fullscreen)
 {
     SCM old;
 
-    old=gh_int2scm(VideoFullScreen);
-    if( CclInConfigFile ) {
-	VideoFullScreen=gh_scm2bool(fullscreen);
+    old = gh_int2scm(VideoFullScreen);
+    if (CclInConfigFile) {
+	VideoFullScreen = gh_scm2bool(fullscreen);
     }
     return old;
 }
@@ -954,17 +962,17 @@ local SCM CclSetTitleScreen(SCM title)
 {
     SCM old;
 
-    old=NIL;
-    if( TitleScreen ) {
-	old=gh_str02scm(TitleScreen);
+    old = NIL;
+    if (TitleScreen) {
+	old = gh_str02scm(TitleScreen);
     }
-    if( !gh_null_p(title) ) {
-	if( TitleScreen ) {
+    if (!gh_null_p(title)) {
+	if (TitleScreen) {
 	    free(TitleScreen);
-	    TitleScreen=NULL;
+	    TitleScreen = NULL;
 	}
 
-	TitleScreen=gh_scm2newstr(title,NULL);
+	TitleScreen = gh_scm2newstr(title, NULL);
     }
     return old;
 }
@@ -980,17 +988,17 @@ local SCM CclSetTitleMusic(SCM music)
 {
     SCM old;
 
-    old=NIL;
-    if( TitleMusic ) {
-	old=gh_str02scm(TitleMusic);
+    old = NIL;
+    if (TitleMusic) {
+	old = gh_str02scm(TitleMusic);
     }
-    if( !gh_null_p(music) ) {
-	if( TitleMusic ) {
+    if (!gh_null_p(music)) {
+	if (TitleMusic) {
 	    free(TitleMusic);
-	    TitleMusic=NULL;
+	    TitleMusic = NULL;
 	}
 
-	TitleMusic=gh_scm2newstr(music,NULL);
+	TitleMusic = gh_scm2newstr(music, NULL);
     }
     return old;
 }
@@ -1006,17 +1014,17 @@ local SCM CclSetMenuBackground(SCM background)
 {
     SCM old;
 
-    old=NIL;
-    if( MenuBackground ) {
-	old=gh_str02scm(MenuBackground);
+    old = NIL;
+    if (MenuBackground) {
+	old = gh_str02scm(MenuBackground);
     }
-    if( !gh_null_p(background) ) {
-	if( MenuBackground ) {
+    if (!gh_null_p(background)) {
+	if (MenuBackground) {
 	    free(MenuBackground);
-	    MenuBackground=NULL;
+	    MenuBackground = NULL;
 	}
 
-	MenuBackground=gh_scm2newstr(background,NULL);
+	MenuBackground = gh_scm2newstr(background, NULL);
     }
     return old;
 }
@@ -1032,17 +1040,17 @@ local SCM CclSetMenuBackgroundWithTitle(SCM background)
 {
     SCM old;
 
-    old=NIL;
-    if( MenuBackgroundWithTitle ) {
-	old=gh_str02scm(MenuBackgroundWithTitle);
+    old = NIL;
+    if (MenuBackgroundWithTitle) {
+	old = gh_str02scm(MenuBackgroundWithTitle);
     }
-    if( !gh_null_p(background) ) {
-	if( MenuBackgroundWithTitle ) {
+    if (!gh_null_p(background)) {
+	if (MenuBackgroundWithTitle) {
 	    free(MenuBackgroundWithTitle);
-	    MenuBackgroundWithTitle=NULL;
+	    MenuBackgroundWithTitle = NULL;
 	}
 
-	MenuBackgroundWithTitle=gh_scm2newstr(background,NULL);
+	MenuBackgroundWithTitle = gh_scm2newstr(background, NULL);
     }
     return old;
 }
@@ -1058,17 +1066,17 @@ local SCM CclSetMenuMusic(SCM music)
 {
     SCM old;
 
-    old=NIL;
-    if( MenuMusic ) {
-	old=gh_str02scm(MenuMusic);
+    old = NIL;
+    if (MenuMusic) {
+	old = gh_str02scm(MenuMusic);
     }
-    if( !gh_null_p(music) ) {
-	if( MenuMusic ) {
+    if (!gh_null_p(music)) {
+	if (MenuMusic) {
 	    free(MenuMusic);
-	    MenuMusic=NULL;
+	    MenuMusic = NULL;
 	}
 
-	MenuMusic=gh_scm2newstr(music,NULL);
+	MenuMusic = gh_scm2newstr(music, NULL);
     }
     return old;
 }
@@ -1084,8 +1092,8 @@ local SCM CclDisplayPicture(SCM file)
 {
     char* name;
 
-    name=gh_scm2newstr(file,NULL);
-    SetClipping(0,0,VideoWidth-1,VideoHeight-1);
+    name = gh_scm2newstr(file, NULL);
+    SetClipping(0, 0, VideoWidth - 1, VideoHeight - 1);
     DisplayPicture(name);
     Invalidate();
     free(name);
@@ -1123,8 +1131,8 @@ local SCM CclSetOriginalResources(SCM flag)
 {
     int old;
 
-    old=TheUI.OriginalResources;
-    TheUI.OriginalResources=gh_scm2bool(flag);
+    old = TheUI.OriginalResources;
+    TheUI.OriginalResources = gh_scm2bool(flag);
 
     return gh_bool2scm(old);
 }
@@ -1143,36 +1151,36 @@ local SCM CclDefineCursor(SCM list)
     CursorType* ct;
 
     //	Get identifier
-    value=gh_car(list);
-    list=gh_cdr(list);
-    s1=gh_scm2newstr(value,NULL);
-    value=gh_car(list);
-    list=gh_cdr(list);
-    s2=gh_scm2newstr(value,NULL);
-    if( !strcmp(s2,"any") ) {
+    value = gh_car(list);
+    list = gh_cdr(list);
+    s1 = gh_scm2newstr(value, NULL);
+    value = gh_car(list);
+    list = gh_cdr(list);
+    s2 = gh_scm2newstr(value, NULL);
+    if (!strcmp(s2, "any")) {
 	free(s2);
-	s2=NULL;
+	s2 = NULL;
     }
 
     //
     //	Look if this kind of cursor already exists.
     //
-    ct=NULL;
-    i=0;
-    if( Cursors ) {
-	for( ; Cursors[i].OType; ++i ) {
+    ct = NULL;
+    i = 0;
+    if (Cursors) {
+	for (; Cursors[i].OType; ++i) {
 	    //
 	    //	Race not same, not found.
 	    //
-	    if( Cursors[i].Race && s2 ) {
-		if( strcmp(Cursors[i].Race,s2) ) {
+	    if (Cursors[i].Race && s2) {
+		if (strcmp(Cursors[i].Race, s2)) {
 		    continue;
 		}
-	    } else if( Cursors[i].Race!=s2 ) {
+	    } else if (Cursors[i].Race != s2) {
 		continue;
 	    }
-	    if( !strcmp(Cursors[i].Ident,s1) ) {
-		ct=&Cursors[i];
+	    if (!strcmp(Cursors[i].Ident, s1)) {
+		ct = &Cursors[i];
 		break;
 	    }
 	}
@@ -1180,49 +1188,49 @@ local SCM CclDefineCursor(SCM list)
     //
     //	Not found, make a new slot.
     //
-    if( ct ) {
+    if (ct) {
 	free(s1);
 	free(s2);
     } else {
-	ct=calloc(i+2,sizeof(CursorType));
-	memcpy(ct,Cursors,sizeof(CursorType)*i);
+	ct = calloc(i + 2, sizeof(CursorType));
+	memcpy(ct, Cursors, sizeof(CursorType) * i);
 	free(Cursors);
-	Cursors=ct;
-	ct=&Cursors[i];
-	ct->OType=CursorTypeType;
-	ct->Ident=s1;
-	ct->Race=s2;
-	ct->FrameRate=200;
+	Cursors = ct;
+	ct = &Cursors[i];
+	ct->OType = CursorTypeType;
+	ct->Ident = s1;
+	ct->Race = s2;
+	ct->FrameRate = 200;
     }
 
     //
     //	Parse the arguments, already the new tagged format.
     //
-    while( !gh_null_p(list) ) {
-	value=gh_car(list);
-	list=gh_cdr(list);
-	if( gh_eq_p(value,gh_symbol2scm("image")) ) {
+    while (!gh_null_p(list)) {
+	value = gh_car(list);
+	list = gh_cdr(list);
+	if (gh_eq_p(value, gh_symbol2scm("image"))) {
 	    free(ct->File);
-	    ct->File=gh_scm2newstr(gh_car(list),NULL);
-	} else if( gh_eq_p(value,gh_symbol2scm("hot-spot")) ) {
-	    value=gh_car(list);
-	    ct->HotX=gh_scm2int(gh_car(value));
-	    value=gh_cdr(value);
-	    ct->HotY=gh_scm2int(gh_car(value));
-	} else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
-	    value=gh_car(list);
-	    ct->Width=gh_scm2int(gh_car(value));
-	    value=gh_cdr(value);
-	    ct->Height=gh_scm2int(gh_car(value));
-	} else if( gh_eq_p(value,gh_symbol2scm("rate")) ) {
-	    value=gh_car(list);
-	    ct->FrameRate=gh_scm2int(value);
+	    ct->File = gh_scm2newstr(gh_car(list), NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("hot-spot"))) {
+	    value = gh_car(list);
+	    ct->HotX = gh_scm2int(gh_car(value));
+	    value = gh_cdr(value);
+	    ct->HotY = gh_scm2int(gh_car(value));
+	} else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+	    value = gh_car(list);
+	    ct->Width = gh_scm2int(gh_car(value));
+	    value = gh_cdr(value);
+	    ct->Height = gh_scm2int(gh_car(value));
+	} else if (gh_eq_p(value, gh_symbol2scm("rate"))) {
+	    value = gh_car(list);
+	    ct->FrameRate = gh_scm2int(value);
 	} else {
-	    s1=gh_scm2newstr(value,NULL);
-	    fprintf(stderr,"Unsupported tag %s\n",s1);
+	    s1 = gh_scm2newstr(value, NULL);
+	    fprintf(stderr, "Unsupported tag %s\n", s1);
 	    free(s1);
 	}
-	list=gh_cdr(list);
+	list = gh_cdr(list);
     }
 
     return SCM_UNSPECIFIED;
@@ -1237,8 +1245,8 @@ local SCM CclSetGameCursor(SCM ident)
 {
     char* str;
 
-    str=gh_scm2newstr(ident,NULL);
-    GameCursor=CursorTypeByIdent(str);
+    str = gh_scm2newstr(ident, NULL);
+    GameCursor = CursorTypeByIdent(str);
     free(str);
 
     return SCM_UNSPECIFIED;
@@ -1255,68 +1263,69 @@ local MenuButtonId scm2buttonid(SCM value)
 {
     MenuButtonId id;
 
-    if ( gh_eq_p(value, gh_symbol2scm("main")) ) {
-        id=MBUTTON_MAIN;
-    } else if ( gh_eq_p(value, gh_symbol2scm("network")) ) {
-        id=MBUTTON_NETWORK;
-    } else if ( gh_eq_p(value, gh_symbol2scm("gm-half")) ) {
-        id=MBUTTON_GM_HALF;
-    } else if ( gh_eq_p(value, gh_symbol2scm("132")) ) {
-        id=MBUTTON_132;
-    } else if ( gh_eq_p(value, gh_symbol2scm("gm-full")) ) {
-        id=MBUTTON_GM_FULL;
-    } else if ( gh_eq_p(value, gh_symbol2scm("gem-round")) ) {
-        id=MBUTTON_GEM_ROUND;
-    } else if ( gh_eq_p(value, gh_symbol2scm("gem-square")) ) {
-        id=MBUTTON_GEM_SQUARE;
-    } else if ( gh_eq_p(value, gh_symbol2scm("up-arrow")) ) {
-        id=MBUTTON_UP_ARROW;
-    } else if ( gh_eq_p(value, gh_symbol2scm("down-arrow")) ) {
-        id=MBUTTON_DOWN_ARROW;
-    } else if ( gh_eq_p(value, gh_symbol2scm("left-arrow")) ) {
-        id=MBUTTON_LEFT_ARROW;
-    } else if ( gh_eq_p(value, gh_symbol2scm("right-arrow")) ) {
-        id=MBUTTON_RIGHT_ARROW;
-    } else if ( gh_eq_p(value, gh_symbol2scm("s-knob")) ) {
-        id=MBUTTON_S_KNOB;
-    } else if ( gh_eq_p(value, gh_symbol2scm("s-vcont")) ) {
-        id=MBUTTON_S_VCONT;
-    } else if ( gh_eq_p(value, gh_symbol2scm("s-hcont")) ) {
-        id=MBUTTON_S_HCONT;
-    } else if ( gh_eq_p(value, gh_symbol2scm("pulldown")) ) {
-        id=MBUTTON_PULLDOWN;
-    } else if ( gh_eq_p(value, gh_symbol2scm("vthin")) ) {
-        id=MBUTTON_VTHIN;
-    } else if ( gh_eq_p(value, gh_symbol2scm("folder")) ) {
-        id=MBUTTON_FOLDER;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-gem-round")) ) {
-        id=MBUTTON_SC_GEM_ROUND;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-gem-square")) ) {
-        id=MBUTTON_SC_GEM_SQUARE;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-up-arrow")) ) {
-        id=MBUTTON_SC_UP_ARROW;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-down-arrow")) ) {
-        id=MBUTTON_SC_DOWN_ARROW;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-left-arrow")) ) {
-        id=MBUTTON_SC_LEFT_ARROW;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-right-arrow")) ) {
-        id=MBUTTON_SC_RIGHT_ARROW;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-s-knob")) ) {
-        id=MBUTTON_SC_S_KNOB;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-s-vcont")) ) {
-        id=MBUTTON_SC_S_VCONT;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-s-hcont")) ) {
-        id=MBUTTON_SC_S_HCONT;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-pulldown")) ) {
-        id=MBUTTON_SC_PULLDOWN;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-button-left")) ) {
-        id=MBUTTON_SC_BUTTON_LEFT;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-button")) ) {
-        id=MBUTTON_SC_BUTTON;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-button-right")) ) {
-        id=MBUTTON_SC_BUTTON_RIGHT;
+    if (gh_eq_p(value, gh_symbol2scm("main"))) {
+        id = MBUTTON_MAIN;
+    } else if (gh_eq_p(value, gh_symbol2scm("network"))) {
+        id = MBUTTON_NETWORK;
+    } else if (gh_eq_p(value, gh_symbol2scm("gm-half"))) {
+        id = MBUTTON_GM_HALF;
+    } else if (gh_eq_p(value, gh_symbol2scm("132"))) {
+        id = MBUTTON_132;
+    } else if (gh_eq_p(value, gh_symbol2scm("gm-full"))) {
+        id = MBUTTON_GM_FULL;
+    } else if (gh_eq_p(value, gh_symbol2scm("gem-round"))) {
+        id = MBUTTON_GEM_ROUND;
+    } else if (gh_eq_p(value, gh_symbol2scm("gem-square"))) {
+        id = MBUTTON_GEM_SQUARE;
+    } else if (gh_eq_p(value, gh_symbol2scm("up-arrow"))) {
+        id = MBUTTON_UP_ARROW;
+    } else if (gh_eq_p(value, gh_symbol2scm("down-arrow"))) {
+        id = MBUTTON_DOWN_ARROW;
+    } else if (gh_eq_p(value, gh_symbol2scm("left-arrow"))) {
+        id = MBUTTON_LEFT_ARROW;
+    } else if (gh_eq_p(value, gh_symbol2scm("right-arrow"))) {
+        id = MBUTTON_RIGHT_ARROW;
+    } else if (gh_eq_p(value, gh_symbol2scm("s-knob"))) {
+        id = MBUTTON_S_KNOB;
+    } else if (gh_eq_p(value, gh_symbol2scm("s-vcont"))) {
+        id = MBUTTON_S_VCONT;
+    } else if (gh_eq_p(value, gh_symbol2scm("s-hcont"))) {
+        id = MBUTTON_S_HCONT;
+    } else if (gh_eq_p(value, gh_symbol2scm("pulldown"))) {
+        id = MBUTTON_PULLDOWN;
+    } else if (gh_eq_p(value, gh_symbol2scm("vthin"))) {
+        id = MBUTTON_VTHIN;
+    } else if (gh_eq_p(value, gh_symbol2scm("folder"))) {
+        id = MBUTTON_FOLDER;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-gem-round"))) {
+        id = MBUTTON_SC_GEM_ROUND;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-gem-square"))) {
+        id = MBUTTON_SC_GEM_SQUARE;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-up-arrow"))) {
+        id = MBUTTON_SC_UP_ARROW;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-down-arrow"))) {
+        id = MBUTTON_SC_DOWN_ARROW;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-left-arrow"))) {
+        id = MBUTTON_SC_LEFT_ARROW;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-right-arrow"))) {
+        id = MBUTTON_SC_RIGHT_ARROW;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-s-knob"))) {
+        id = MBUTTON_SC_S_KNOB;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-s-vcont"))) {
+        id = MBUTTON_SC_S_VCONT;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-s-hcont"))) {
+        id = MBUTTON_SC_S_HCONT;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-pulldown"))) {
+        id = MBUTTON_SC_PULLDOWN;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-button-left"))) {
+        id = MBUTTON_SC_BUTTON_LEFT;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-button"))) {
+        id = MBUTTON_SC_BUTTON;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-button-right"))) {
+        id = MBUTTON_SC_BUTTON_RIGHT;
     } else {
-	char *s1=gh_scm2newstr(value, NULL);
+	char *s1;
+	s1 = gh_scm2newstr(value, NULL);
         fprintf(stderr, "Unsupported button %s\n", s1);
         free(s1);
 	return 0;
@@ -1325,20 +1334,20 @@ local MenuButtonId scm2buttonid(SCM value)
 }
 
 /// Get an integer value from a list.
-local int SCM_PopInt(SCM * list)
+local int SCM_PopInt(SCM* list)
 {
     SCM value;
-    value=gh_car(*list);
-    *list=gh_cdr(*list);
+    value = gh_car(*list);
+    *list = gh_cdr(*list);
     return gh_scm2int(value);
 }
 
 /// Get a string value from a list.
-local char* SCM_PopNewStr(SCM * list)
+local char* SCM_PopNewStr(SCM* list)
 {
     SCM value;
-    value=gh_car(*list);
-    *list=gh_cdr(*list);
+    value = gh_car(*list);
+    *list = gh_cdr(*list);
     return gh_scm2newstr(value, NULL);
 }
 
@@ -1353,7 +1362,7 @@ local SCM CclDefineUI(SCM list)
     SCM value;
     SCM sublist;
     char* str;
-    char *s1;
+    char* s1;
     int	x;
     int	y;
     int i;
@@ -1361,43 +1370,43 @@ local SCM CclDefineUI(SCM list)
     void* v;
 
     //	Get identifier
-    value=gh_car(list);
-    list=gh_cdr(list);
-    str=gh_scm2newstr(value,NULL);
-    value=gh_car(list);
-    list=gh_cdr(list);
-    x=gh_scm2int(value);
-    value=gh_car(list);
-    list=gh_cdr(list);
-    y=gh_scm2int(value);
+    value = gh_car(list);
+    list = gh_cdr(list);
+    str = gh_scm2newstr(value, NULL);
+    value = gh_car(list);
+    list = gh_cdr(list);
+    x = gh_scm2int(value);
+    value = gh_car(list);
+    list = gh_cdr(list);
+    y = gh_scm2int(value);
 
     // Find slot: new or redefinition
     ui=NULL;
     i=0;
-    if( UI_Table ) {
-	for( ; UI_Table[i]; ++i ) {
-	    if( UI_Table[i]->Width==x && UI_Table[i]->Height==y
-		    && !strcmp(UI_Table[i]->Name,str) ) {
+    if (UI_Table) {
+	for (; UI_Table[i]; ++i) {
+	    if (UI_Table[i]->Width == x && UI_Table[i]->Height == y &&
+		    !strcmp(UI_Table[i]->Name, str)) {
 		CleanUI(UI_Table[i]);
-		ui=calloc(1,sizeof(UI));
-		UI_Table[i]=ui;
+		ui = calloc(1, sizeof(UI));
+		UI_Table[i] = ui;
 		break;
 	    }
 	}
     }
-    if( !ui ) {
-	ui=calloc(1,sizeof(UI));
-	v=malloc(sizeof(UI*)*(i+2));
-	memcpy(v,UI_Table,i*sizeof(UI*));
+    if (!ui) {
+	ui = calloc(1, sizeof(UI));
+	v = malloc(sizeof(UI*) * (i + 2));
+	memcpy(v, UI_Table, i * sizeof(UI*));
 	free(UI_Table);
-	UI_Table=v;
-	UI_Table[i]=ui;
-	UI_Table[i+1]=NULL;
+	UI_Table = v;
+	UI_Table[i] = ui;
+	UI_Table[i + 1] = NULL;
     }
 
-    ui->Name=str;
-    ui->Width=x;
-    ui->Height=y;
+    ui->Name = str;
+    ui->Width = x;
+    ui->Height = y;
 
     //
     //	Some value defaults
@@ -1405,555 +1414,555 @@ local SCM CclDefineUI(SCM list)
 
     // This save the setup values FIXME: They are set by CCL.
 
-    ui->Contrast=TheUI.Contrast;
-    ui->Brightness=TheUI.Brightness;
-    ui->Saturation=TheUI.Saturation;
+    ui->Contrast = TheUI.Contrast;
+    ui->Brightness = TheUI.Brightness;
+    ui->Saturation = TheUI.Saturation;
 
-    ui->MouseScroll=TheUI.MouseScroll;
-    ui->KeyScroll=TheUI.KeyScroll;
-    ui->MouseScrollSpeedDefault=TheUI.MouseScrollSpeedDefault;
-    ui->MouseScrollSpeedControl=TheUI.MouseScrollSpeedControl;
+    ui->MouseScroll = TheUI.MouseScroll;
+    ui->KeyScroll = TheUI.KeyScroll;
+    ui->MouseScrollSpeedDefault = TheUI.MouseScrollSpeedDefault;
+    ui->MouseScrollSpeedControl = TheUI.MouseScrollSpeedControl;
 
-    ui->MouseWarpX=-1;
-    ui->MouseWarpY=-1;
+    ui->MouseWarpX = -1;
+    ui->MouseWarpY = -1;
 
-    ui->MouseAdjust=TheUI.MouseAdjust;
-    ui->MouseScale=TheUI.MouseScale;
+    ui->MouseAdjust = TheUI.MouseAdjust;
+    ui->MouseScale = TheUI.MouseScale;
 
-    ui->OriginalResources=TheUI.OriginalResources;
+    ui->OriginalResources = TheUI.OriginalResources;
 
-    ui->Resource.File=NULL;
-    ui->ResourceX=-1;
-    ui->ResourceY=-1;
+    ui->Resource.File = NULL;
+    ui->ResourceX = -1;
+    ui->ResourceY = -1;
 
-    ui->InfoPanel.File=NULL;
-    ui->InfoPanelX=-1;
-    ui->InfoPanelY=-1;
+    ui->InfoPanel.File = NULL;
+    ui->InfoPanelX = -1;
+    ui->InfoPanelY = -1;
 
-    ui->ButtonPanel.File=NULL;
-    ui->ButtonPanelX=-1;
-    ui->ButtonPanelY=-1;
+    ui->ButtonPanel.File = NULL;
+    ui->ButtonPanelX = -1;
+    ui->ButtonPanelY = -1;
 
-    ui->MenuButtonGraphic.File=NULL;
-    ui->MenuButtonGraphicX=-1;
-    ui->MenuButtonGraphicY=-1;
+    ui->MenuButtonGraphic.File = NULL;
+    ui->MenuButtonGraphicX = -1;
+    ui->MenuButtonGraphicY = -1;
     
-    ui->MinimapPanel.File=NULL;
-    ui->MinimapPanelX=-1;
-    ui->MinimapPanelY=-1;
+    ui->MinimapPanel.File = NULL;
+    ui->MinimapPanelX = -1;
+    ui->MinimapPanelY = -1;
 
-    ui->MinimapPosX=-1;
-    ui->MinimapPosY=-1;
+    ui->MinimapPosX = -1;
+    ui->MinimapPosY = -1;
 
     //
     //	Parse the arguments, already the new tagged format.
     //  maxy: this could be much simpler
     //
 
-    while( !gh_null_p(list) ) {
-	value=gh_car(list);
-	list=gh_cdr(list);
+    while (!gh_null_p(list)) {
+	value = gh_car(list);
+	list = gh_cdr(list);
 
-	if( gh_eq_p(value,gh_symbol2scm("normal-font-color")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    ui->NormalFontColor=gh_scm2newstr(value,NULL);
-	} else if( gh_eq_p(value,gh_symbol2scm("reverse-font-color")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    ui->ReverseFontColor=gh_scm2newstr(value,NULL);
-	} else if( gh_eq_p(value,gh_symbol2scm("filler")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
+	if (gh_eq_p(value, gh_symbol2scm("normal-font-color"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    ui->NormalFontColor = gh_scm2newstr(value, NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("reverse-font-color"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    ui->ReverseFontColor = gh_scm2newstr(value, NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("filler"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
 	    ui->NumFillers++;
-	    ui->Filler=realloc(ui->Filler,ui->NumFillers*sizeof(*ui->Filler));
-	    ui->FillerX=realloc(ui->FillerX,ui->NumFillers*sizeof(*ui->FillerX));
-	    ui->FillerY=realloc(ui->FillerY,ui->NumFillers*sizeof(*ui->FillerY));
-	    while( !gh_null_p(sublist) ) {
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		if( gh_eq_p(value,gh_symbol2scm("file")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->Filler[ui->NumFillers-1].File=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->FillerX[ui->NumFillers-1]=gh_scm2int(gh_car(value));
-		    ui->FillerY[ui->NumFillers-1]=gh_scm2int(gh_car(gh_cdr(value)));
+	    ui->Filler = realloc(ui->Filler, ui->NumFillers * sizeof(*ui->Filler));
+	    ui->FillerX = realloc(ui->FillerX, ui->NumFillers * sizeof(*ui->FillerX));
+	    ui->FillerY = realloc(ui->FillerY, ui->NumFillers * sizeof(*ui->FillerY));
+	    while (!gh_null_p(sublist)) {
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		if (gh_eq_p(value, gh_symbol2scm("file"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->Filler[ui->NumFillers - 1].File = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->FillerX[ui->NumFillers - 1] = gh_scm2int(gh_car(value));
+		    ui->FillerY[ui->NumFillers - 1] = gh_scm2int(gh_car(gh_cdr(value)));
 		} else {
-		    errl("Unsupported tag",value);
+		    errl("Unsupported tag", value);
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("resource-line")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    ui->Resource.File=SCM_PopNewStr(&sublist);
-	    ui->ResourceX=SCM_PopInt(&sublist);
-	    ui->ResourceY=SCM_PopInt(&sublist);
-	} else if( gh_eq_p(value,gh_symbol2scm("resources")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(sublist) ) {
+	} else if (gh_eq_p(value, gh_symbol2scm("resource-line"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    ui->Resource.File = SCM_PopNewStr(&sublist);
+	    ui->ResourceX = SCM_PopInt(&sublist);
+	    ui->ResourceY = SCM_PopInt(&sublist);
+	} else if (gh_eq_p(value, gh_symbol2scm("resources"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(sublist)) {
 		SCM slist;
 		int res;
 		char* name;
 
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		name=gh_scm2newstr(value,NULL);
-		for( res=0; res<MaxCosts; ++res ) {
-		    if( !strcmp(name,DefaultResourceNames[res]) ) {
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		name = gh_scm2newstr(value, NULL);
+		for (res=0; res < MaxCosts; ++res) {
+		    if (!strcmp(name, DefaultResourceNames[res])) {
 			break;
 		    }
 		}
-		if( res==MaxCosts ) {
-		    if( !strcmp(name,"food") ) {
-			res=FoodCost;
-		    } else if( !strcmp(name,"score") ) {
-			res=ScoreCost;
+		if (res == MaxCosts) {
+		    if (!strcmp(name, "food")) {
+			res = FoodCost;
+		    } else if (!strcmp(name, "score")) {
+			res = ScoreCost;
 		    } else {
-			errl("Resource not found",value);
+			errl("Resource not found", value);
 		    }
 		}
 		free(name);
-		slist=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		while( !gh_null_p(slist) ) {
-		    value=gh_car(slist);
-		    slist=gh_cdr(slist);
-		    if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-			value=gh_car(slist);
-			slist=gh_cdr(slist);
-			ui->Resources[res].IconX=gh_scm2int(gh_car(value));
-			ui->Resources[res].IconY=gh_scm2int(gh_car(gh_cdr(value)));
-		    } else if( gh_eq_p(value,gh_symbol2scm("file")) ) {
-			value=gh_car(slist);
-			slist=gh_cdr(slist);
-			ui->Resources[res].Icon.File=gh_scm2newstr(value,NULL);
-		    } else if( gh_eq_p(value,gh_symbol2scm("row")) ) {
-			value=gh_car(slist);
-			slist=gh_cdr(slist);
-			ui->Resources[res].IconRow=gh_scm2int(value);
-		    } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
-			value=gh_car(slist);
-			slist=gh_cdr(slist);
-			ui->Resources[res].IconW=gh_scm2int(gh_car(value));
-			ui->Resources[res].IconH=gh_scm2int(gh_car(gh_cdr(value)));
-		    } else if( gh_eq_p(value,gh_symbol2scm("text-pos")) ) {
-			value=gh_car(slist);
-			slist=gh_cdr(slist);
-			ui->Resources[res].TextX=gh_scm2int(gh_car(value));
-			ui->Resources[res].TextY=gh_scm2int(gh_car(gh_cdr(value)));
+		slist = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		while (!gh_null_p(slist)) {
+		    value = gh_car(slist);
+		    slist = gh_cdr(slist);
+		    if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+			value = gh_car(slist);
+			slist = gh_cdr(slist);
+			ui->Resources[res].IconX = gh_scm2int(gh_car(value));
+			ui->Resources[res].IconY = gh_scm2int(gh_car(gh_cdr(value)));
+		    } else if (gh_eq_p(value, gh_symbol2scm("file"))) {
+			value = gh_car(slist);
+			slist = gh_cdr(slist);
+			ui->Resources[res].Icon.File = gh_scm2newstr(value, NULL);
+		    } else if (gh_eq_p(value, gh_symbol2scm("row"))) {
+			value = gh_car(slist);
+			slist = gh_cdr(slist);
+			ui->Resources[res].IconRow = gh_scm2int(value);
+		    } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+			value = gh_car(slist);
+			slist = gh_cdr(slist);
+			ui->Resources[res].IconW = gh_scm2int(gh_car(value));
+			ui->Resources[res].IconH = gh_scm2int(gh_car(gh_cdr(value)));
+		    } else if (gh_eq_p(value, gh_symbol2scm("text-pos"))) {
+			value = gh_car(slist);
+			slist = gh_cdr(slist);
+			ui->Resources[res].TextX = gh_scm2int(gh_car(value));
+			ui->Resources[res].TextY = gh_scm2int(gh_car(gh_cdr(value)));
 		    } else {
-			errl("Unsupported tag",value);
+			errl("Unsupported tag", value);
 		    }
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("info-panel")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    ui->InfoPanel.File=SCM_PopNewStr(&sublist);
-	    ui->InfoPanelX=SCM_PopInt(&sublist);
-	    ui->InfoPanelY=SCM_PopInt(&sublist);
-	    ui->InfoPanelW=SCM_PopInt(&sublist);
-	    ui->InfoPanelH=SCM_PopInt(&sublist);
-	} else if( gh_eq_p(value,gh_symbol2scm("completed-bar")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(sublist) ) {
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		if( gh_eq_p(value,gh_symbol2scm("color")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->CompleteBarColor=gh_scm2int(value);
-		} else if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->CompleteBarX=gh_scm2int(gh_car(value));
-		    ui->CompleteBarY=gh_scm2int(gh_car(gh_cdr(value)));
-		} else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->CompleteBarW=gh_scm2int(gh_car(value));
-		    ui->CompleteBarH=gh_scm2int(gh_car(gh_cdr(value)));
-		} else if( gh_eq_p(value,gh_symbol2scm("text")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->CompleteBarText=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("font")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->CompleteBarFont=CclFontByIdentifier(value);
-		} else if( gh_eq_p(value,gh_symbol2scm("text-pos")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->CompleteTextX=gh_scm2int(gh_car(value));
-		    ui->CompleteTextY=gh_scm2int(gh_car(gh_cdr(value)));
+	} else if (gh_eq_p(value, gh_symbol2scm("info-panel"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    ui->InfoPanel.File = SCM_PopNewStr(&sublist);
+	    ui->InfoPanelX = SCM_PopInt(&sublist);
+	    ui->InfoPanelY = SCM_PopInt(&sublist);
+	    ui->InfoPanelW = SCM_PopInt(&sublist);
+	    ui->InfoPanelH = SCM_PopInt(&sublist);
+	} else if (gh_eq_p(value, gh_symbol2scm("completed-bar"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(sublist)) {
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		if (gh_eq_p(value, gh_symbol2scm("color"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->CompleteBarColor = gh_scm2int(value);
+		} else if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->CompleteBarX = gh_scm2int(gh_car(value));
+		    ui->CompleteBarY = gh_scm2int(gh_car(gh_cdr(value)));
+		} else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->CompleteBarW = gh_scm2int(gh_car(value));
+		    ui->CompleteBarH = gh_scm2int(gh_car(gh_cdr(value)));
+		} else if (gh_eq_p(value, gh_symbol2scm("text"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->CompleteBarText = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("font"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->CompleteBarFont = CclFontByIdentifier(value);
+		} else if (gh_eq_p(value, gh_symbol2scm("text-pos"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->CompleteTextX = gh_scm2int(gh_car(value));
+		    ui->CompleteTextY = gh_scm2int(gh_car(gh_cdr(value)));
 		} else {
-		    errl("Unsupported tag",value);
+		    errl("Unsupported tag", value);
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("button-panel")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    ui->ButtonPanel.File=SCM_PopNewStr(&sublist);
-	    ui->ButtonPanelX=SCM_PopInt(&sublist);
-	    ui->ButtonPanelY=SCM_PopInt(&sublist);
-	} else if( gh_eq_p(value,gh_symbol2scm("map-area")) ) {
+	} else if (gh_eq_p(value, gh_symbol2scm("button-panel"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    ui->ButtonPanel.File = SCM_PopNewStr(&sublist);
+	    ui->ButtonPanelX = SCM_PopInt(&sublist);
+	    ui->ButtonPanelY = SCM_PopInt(&sublist);
+	} else if (gh_eq_p(value, gh_symbol2scm("map-area"))) {
 	    int w;
 	    int h;
 	    
-	    w=0;
-	    h=0;
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(sublist) ) {
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->MapArea.X=gh_scm2int(gh_car(value));
-		    ui->MapArea.Y=gh_scm2int(gh_car(gh_cdr(value)));
-		} else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    w=gh_scm2int(gh_car(value));
-		    h=gh_scm2int(gh_car(gh_cdr(value)));
+	    w = 0;
+	    h = 0;
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(sublist)) {
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->MapArea.X = gh_scm2int(gh_car(value));
+		    ui->MapArea.Y = gh_scm2int(gh_car(gh_cdr(value)));
+		} else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    w = gh_scm2int(gh_car(value));
+		    h = gh_scm2int(gh_car(gh_cdr(value)));
 		} else {
-		    errl("Unsupported tag",value);
+		    errl("Unsupported tag", value);
 		}
 	    }
-	    ui->MapArea.EndX=ui->MapArea.X+w-1;
-	    ui->MapArea.EndY=ui->MapArea.Y+h-1;
-	} else if( gh_eq_p(value,gh_symbol2scm("menu-panel")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    ui->MenuButtonGraphic.File=SCM_PopNewStr(&sublist);
-	    ui->MenuButtonGraphicX=SCM_PopInt(&sublist);
-	    ui->MenuButtonGraphicY=SCM_PopInt(&sublist);
-	} else if( gh_eq_p(value,gh_symbol2scm("minimap-panel")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    ui->MinimapPanel.File=SCM_PopNewStr(&sublist);
-	    ui->MinimapPanelX=SCM_PopInt(&sublist);
-	    ui->MinimapPanelY=SCM_PopInt(&sublist);
-	} else if( gh_eq_p(value,gh_symbol2scm("minimap-pos")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    ui->MinimapPosX=SCM_PopInt(&sublist);
-	    ui->MinimapPosY=SCM_PopInt(&sublist);
-	} else if( gh_eq_p(value,gh_symbol2scm("status-line")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(sublist) ) {
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		if( gh_eq_p(value,gh_symbol2scm("file")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->StatusLine.File=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->StatusLineX=gh_scm2int(gh_car(value));
-		    ui->StatusLineY=gh_scm2int(gh_car(gh_cdr(value)));
-		} else if( gh_eq_p(value,gh_symbol2scm("text-pos")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->StatusLineTextX=gh_scm2int(gh_car(value));
-		    ui->StatusLineTextY=gh_scm2int(gh_car(gh_cdr(value)));
-		} else if( gh_eq_p(value,gh_symbol2scm("font")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->StatusLineFont=CclFontByIdentifier(value);
+	    ui->MapArea.EndX = ui->MapArea.X + w - 1;
+	    ui->MapArea.EndY = ui->MapArea.Y + h - 1;
+	} else if (gh_eq_p(value, gh_symbol2scm("menu-panel"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    ui->MenuButtonGraphic.File = SCM_PopNewStr(&sublist);
+	    ui->MenuButtonGraphicX = SCM_PopInt(&sublist);
+	    ui->MenuButtonGraphicY = SCM_PopInt(&sublist);
+	} else if (gh_eq_p(value, gh_symbol2scm("minimap-panel"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    ui->MinimapPanel.File = SCM_PopNewStr(&sublist);
+	    ui->MinimapPanelX = SCM_PopInt(&sublist);
+	    ui->MinimapPanelY = SCM_PopInt(&sublist);
+	} else if (gh_eq_p(value, gh_symbol2scm("minimap-pos"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    ui->MinimapPosX = SCM_PopInt(&sublist);
+	    ui->MinimapPosY = SCM_PopInt(&sublist);
+	} else if (gh_eq_p(value, gh_symbol2scm("status-line"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(sublist)) {
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		if (gh_eq_p(value, gh_symbol2scm("file"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->StatusLine.File = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->StatusLineX = gh_scm2int(gh_car(value));
+		    ui->StatusLineY = gh_scm2int(gh_car(gh_cdr(value)));
+		} else if (gh_eq_p(value, gh_symbol2scm("text-pos"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->StatusLineTextX = gh_scm2int(gh_car(value));
+		    ui->StatusLineTextY = gh_scm2int(gh_car(gh_cdr(value)));
+		} else if (gh_eq_p(value, gh_symbol2scm("font"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->StatusLineFont = CclFontByIdentifier(value);
 		} else {
-		    errl("Unsupported tag",value);
+		    errl("Unsupported tag", value);
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("menu-button")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(sublist) ) {
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->MenuButton.X=gh_scm2int(gh_car(value));
-		    ui->MenuButton.Y=gh_scm2int(gh_car(gh_cdr(value)));
-		} else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->MenuButton.Width=gh_scm2int(gh_car(value));
-		    ui->MenuButton.Height=gh_scm2int(gh_car(gh_cdr(value)));
-		} else if( gh_eq_p(value,gh_symbol2scm("caption")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->MenuButton.Text=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("style")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->MenuButton.Button=scm2buttonid(value);
+	} else if (gh_eq_p(value, gh_symbol2scm("menu-button"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(sublist)) {
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->MenuButton.X = gh_scm2int(gh_car(value));
+		    ui->MenuButton.Y = gh_scm2int(gh_car(gh_cdr(value)));
+		} else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->MenuButton.Width = gh_scm2int(gh_car(value));
+		    ui->MenuButton.Height = gh_scm2int(gh_car(gh_cdr(value)));
+		} else if (gh_eq_p(value, gh_symbol2scm("caption"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->MenuButton.Text = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("style"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->MenuButton.Button = scm2buttonid(value);
 		} else {
-		    errl("Unsupported tag",value);
+		    errl("Unsupported tag", value);
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("network-menu-button")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(sublist) ) {
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->NetworkMenuButton.X=gh_scm2int(gh_car(value));
-		    ui->NetworkMenuButton.Y=gh_scm2int(gh_car(gh_cdr(value)));
-		} else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->NetworkMenuButton.Width=gh_scm2int(gh_car(value));
-		    ui->NetworkMenuButton.Height=gh_scm2int(gh_car(gh_cdr(value)));
-		} else if( gh_eq_p(value,gh_symbol2scm("caption")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->NetworkMenuButton.Text=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("style")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->NetworkMenuButton.Button=scm2buttonid(value);
+	} else if (gh_eq_p(value, gh_symbol2scm("network-menu-button"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(sublist)) {
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->NetworkMenuButton.X = gh_scm2int(gh_car(value));
+		    ui->NetworkMenuButton.Y = gh_scm2int(gh_car(gh_cdr(value)));
+		} else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->NetworkMenuButton.Width = gh_scm2int(gh_car(value));
+		    ui->NetworkMenuButton.Height = gh_scm2int(gh_car(gh_cdr(value)));
+		} else if (gh_eq_p(value, gh_symbol2scm("caption"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->NetworkMenuButton.Text = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("style"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->NetworkMenuButton.Button = scm2buttonid(value);
 		} else {
-		    errl("Unsupported tag",value);
+		    errl("Unsupported tag", value);
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("network-diplomacy-button")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(sublist) ) {
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->NetworkDiplomacyButton.X=gh_scm2int(gh_car(value));
-		    ui->NetworkDiplomacyButton.Y=gh_scm2int(gh_car(gh_cdr(value)));
-		} else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->NetworkDiplomacyButton.Width=gh_scm2int(gh_car(value));
-		    ui->NetworkDiplomacyButton.Height=gh_scm2int(gh_car(gh_cdr(value)));
-		} else if( gh_eq_p(value,gh_symbol2scm("caption")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->NetworkDiplomacyButton.Text=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("style")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->NetworkDiplomacyButton.Button=scm2buttonid(value);
+	} else if (gh_eq_p(value, gh_symbol2scm("network-diplomacy-button"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(sublist)) {
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->NetworkDiplomacyButton.X = gh_scm2int(gh_car(value));
+		    ui->NetworkDiplomacyButton.Y = gh_scm2int(gh_car(gh_cdr(value)));
+		} else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->NetworkDiplomacyButton.Width = gh_scm2int(gh_car(value));
+		    ui->NetworkDiplomacyButton.Height = gh_scm2int(gh_car(gh_cdr(value)));
+		} else if (gh_eq_p(value, gh_symbol2scm("caption"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->NetworkDiplomacyButton.Text = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("style"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->NetworkDiplomacyButton.Button = scm2buttonid(value);
 		} else {
-		    errl("Unsupported tag",value);
+		    errl("Unsupported tag", value);
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("info-buttons")) ) {
+	} else if (gh_eq_p(value, gh_symbol2scm("info-buttons"))) {
 	    SCM slist;
 	    SCM sslist;
 	    Button* b;
 
-	    slist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(slist) ) {
-		sslist=gh_car(slist);
-		slist=gh_cdr(slist);
+	    slist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(slist)) {
+		sslist = gh_car(slist);
+		slist = gh_cdr(slist);
 		ui->NumInfoButtons++;
-		ui->InfoButtons=realloc(ui->InfoButtons,
-					ui->NumInfoButtons*sizeof(*ui->InfoButtons));
-		b=&ui->InfoButtons[ui->NumInfoButtons-1];
-		while( !gh_null_p(sslist) ) {
-		    value=gh_car(sslist);
-		    sslist=gh_cdr(sslist);
-		    if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-			value=gh_car(sslist);
-			sslist=gh_cdr(sslist);
-			b->X=gh_scm2int(gh_car(value));
-			b->Y=gh_scm2int(gh_car(gh_cdr(value)));
-		    } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
-			value=gh_car(sslist);
-			sslist=gh_cdr(sslist);
-			b->Width=gh_scm2int(gh_car(value));
-			b->Height=gh_scm2int(gh_car(gh_cdr(value)));
+		ui->InfoButtons = realloc(ui->InfoButtons,
+		    ui->NumInfoButtons*sizeof(*ui->InfoButtons));
+		b = &ui->InfoButtons[ui->NumInfoButtons - 1];
+		while (!gh_null_p(sslist)) {
+		    value = gh_car(sslist);
+		    sslist = gh_cdr(sslist);
+		    if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+			value = gh_car(sslist);
+			sslist = gh_cdr(sslist);
+			b->X = gh_scm2int(gh_car(value));
+			b->Y = gh_scm2int(gh_car(gh_cdr(value)));
+		    } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+			value = gh_car(sslist);
+			sslist = gh_cdr(sslist);
+			b->Width = gh_scm2int(gh_car(value));
+			b->Height = gh_scm2int(gh_car(gh_cdr(value)));
 		    } else {
-			errl("Unsupported tag",value);
+			errl("Unsupported tag", value);
 		    }
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("training-buttons")) ) {
+	} else if (gh_eq_p(value, gh_symbol2scm("training-buttons"))) {
 	    SCM slist;
 	    SCM sslist;
 	    Button* b;
 
-	    slist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(slist) ) {
-		sslist=gh_car(slist);
-		slist=gh_cdr(slist);
+	    slist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(slist)) {
+		sslist = gh_car(slist);
+		slist = gh_cdr(slist);
 		ui->NumTrainingButtons++;
 		ui->TrainingButtons=realloc(ui->TrainingButtons,
-					    ui->NumTrainingButtons*sizeof(*ui->TrainingButtons));
-		b=&ui->TrainingButtons[ui->NumTrainingButtons-1];
-		while( !gh_null_p(sslist) ) {
-		    value=gh_car(sslist);
-		    sslist=gh_cdr(sslist);
-		    if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-			value=gh_car(sslist);
-			sslist=gh_cdr(sslist);
-			b->X=gh_scm2int(gh_car(value));
-			b->Y=gh_scm2int(gh_car(gh_cdr(value)));
-		    } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
-			value=gh_car(sslist);
-			sslist=gh_cdr(sslist);
-			b->Width=gh_scm2int(gh_car(value));
-			b->Height=gh_scm2int(gh_car(gh_cdr(value)));
+		    ui->NumTrainingButtons * sizeof(*ui->TrainingButtons));
+		b=&ui->TrainingButtons[ui->NumTrainingButtons - 1];
+		while (!gh_null_p(sslist)) {
+		    value = gh_car(sslist);
+		    sslist = gh_cdr(sslist);
+		    if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+			value = gh_car(sslist);
+			sslist = gh_cdr(sslist);
+			b->X = gh_scm2int(gh_car(value));
+			b->Y = gh_scm2int(gh_car(gh_cdr(value)));
+		    } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+			value = gh_car(sslist);
+			sslist = gh_cdr(sslist);
+			b->Width = gh_scm2int(gh_car(value));
+			b->Height = gh_scm2int(gh_car(gh_cdr(value)));
 		    } else {
-			errl("Unsupported tag",value);
+			errl("Unsupported tag", value);
 		    }
 
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("button-buttons")) ) {
+	} else if (gh_eq_p(value, gh_symbol2scm("button-buttons"))) {
 	    SCM slist;
 	    SCM sslist;
 	    Button* b;
 	    
-	    slist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(slist) ) {
-		sslist=gh_car(slist);
-		slist=gh_cdr(slist);
+	    slist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(slist)) {
+		sslist = gh_car(slist);
+		slist = gh_cdr(slist);
 		ui->NumButtonButtons++;
-		ui->ButtonButtons=realloc(ui->ButtonButtons,
-					  ui->NumButtonButtons*sizeof(*ui->ButtonButtons));
-		b=&ui->ButtonButtons[ui->NumButtonButtons-1];
-		while( !gh_null_p(sslist) ) {
-		    value=gh_car(sslist);
-		    sslist=gh_cdr(sslist);
-		    if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-			value=gh_car(sslist);
-			sslist=gh_cdr(sslist);
-			b->X=gh_scm2int(gh_car(value));
-			b->Y=gh_scm2int(gh_car(gh_cdr(value)));
-		    } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
-			value=gh_car(sslist);
-			sslist=gh_cdr(sslist);
-			b->Width=gh_scm2int(gh_car(value));
-			b->Height=gh_scm2int(gh_car(gh_cdr(value)));
+		ui->ButtonButtons = realloc(ui->ButtonButtons,
+		    ui->NumButtonButtons * sizeof(*ui->ButtonButtons));
+		b = &ui->ButtonButtons[ui->NumButtonButtons - 1];
+		while (!gh_null_p(sslist)) {
+		    value = gh_car(sslist);
+		    sslist = gh_cdr(sslist);
+		    if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+			value = gh_car(sslist);
+			sslist = gh_cdr(sslist);
+			b->X = gh_scm2int(gh_car(value));
+			b->Y = gh_scm2int(gh_car(gh_cdr(value)));
+		    } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+			value = gh_car(sslist);
+			sslist = gh_cdr(sslist);
+			b->Width = gh_scm2int(gh_car(value));
+			b->Height = gh_scm2int(gh_car(gh_cdr(value)));
 		    } else {
-			errl("Unsupported tag",value);
+			errl("Unsupported tag", value);
 		    }
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("cursors")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(sublist) ) {
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		if( gh_eq_p(value,gh_symbol2scm("point")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->Point.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("glass")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->Glass.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("cross")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->Cross.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("yellow")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->YellowHair.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("green")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->GreenHair.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("red")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->RedHair.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("scroll")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->Scroll.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("arrow-e")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->ArrowE.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("arrow-ne")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->ArrowNE.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("arrow-n")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->ArrowN.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("arrow-nw")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->ArrowNW.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("arrow-w")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->ArrowW.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("arrow-sw")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->ArrowSW.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("arrow-s")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->ArrowS.Name=gh_scm2newstr(value,NULL);
-		} else if( gh_eq_p(value,gh_symbol2scm("arrow-se")) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
-		    ui->ArrowSE.Name=gh_scm2newstr(value,NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("cursors"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(sublist)) {
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		if (gh_eq_p(value, gh_symbol2scm("point"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->Point.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("glass"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->Glass.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("cross"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->Cross.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("yellow"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->YellowHair.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("green"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->GreenHair.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("red"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->RedHair.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("scroll"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->Scroll.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("arrow-e"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->ArrowE.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("arrow-ne"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->ArrowNE.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("arrow-n"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->ArrowN.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("arrow-nw"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->ArrowNW.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("arrow-w"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->ArrowW.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("arrow-sw"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->ArrowSW.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("arrow-s"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->ArrowS.Name = gh_scm2newstr(value, NULL);
+		} else if (gh_eq_p(value, gh_symbol2scm("arrow-se"))) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
+		    ui->ArrowSE.Name = gh_scm2newstr(value, NULL);
 		} else {
-		    errl("Unsupported tag",value);
+		    errl("Unsupported tag", value);
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("menu-panels")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
-	    while( !gh_null_p(sublist) ) {
+	} else if (gh_eq_p(value, gh_symbol2scm("menu-panels"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
+	    while (!gh_null_p(sublist)) {
 		MenuPanel** menupanel;
 
-		menupanel=&ui->MenuPanels;
-		while( *menupanel ) {
-		    menupanel=&(*menupanel)->Next;
+		menupanel = &ui->MenuPanels;
+		while (*menupanel) {
+		    menupanel = &(*menupanel)->Next;
 		}
-		*menupanel=calloc(1,sizeof(**menupanel));
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		(*menupanel)->Ident=gh_scm2newstr(value,NULL);
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		(*menupanel)->Panel.File=gh_scm2newstr(value,NULL);
+		*menupanel = calloc(1, sizeof(**menupanel));
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		(*menupanel)->Ident = gh_scm2newstr(value, NULL);
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		(*menupanel)->Panel.File = gh_scm2newstr(value, NULL);
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("victory-background")) ) {
+	} else if (gh_eq_p(value, gh_symbol2scm("victory-background"))) {
 	    //	Backgrounds
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    ui->VictoryBackground.File=gh_scm2newstr(value,NULL);
-	} else if( gh_eq_p(value,gh_symbol2scm("defeat-background")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    ui->DefeatBackground.File=gh_scm2newstr(value,NULL);
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    ui->VictoryBackground.File = gh_scm2newstr(value, NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("defeat-background"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    ui->DefeatBackground.File = gh_scm2newstr(value, NULL);
 	} else {
-	    s1=gh_scm2newstr(value,NULL);
-	    fprintf(stderr,"Unsupported tag %s\n",s1);
+	    s1 = gh_scm2newstr(value, NULL);
+	    fprintf(stderr, "Unsupported tag %s\n", s1);
 	    free(s1);
 	}
     }
@@ -1973,26 +1982,26 @@ local SCM CclDefineViewports(SCM list)
     UI* ui;
     int i;
 
-    i=0;
-    ui=&TheUI;
-    while( !gh_null_p(list) ) {
-	value=gh_car(list);
-	list=gh_cdr(list);
-	if( gh_eq_p(value,gh_symbol2scm("mode")) ) {
-	    ui->ViewportMode=gh_scm2int(gh_car(list));
-	    list=gh_cdr(list);
-	} else if( gh_eq_p(value,gh_symbol2scm("viewport")) ) {
-	    sublist=gh_car(list);
-	    ui->Viewports[i].MapX=gh_scm2int(gh_car(sublist));
-	    sublist=gh_cdr(sublist);
-	    ui->Viewports[i].MapY=gh_scm2int(gh_car(sublist));
+    i = 0;
+    ui = &TheUI;
+    while (!gh_null_p(list)) {
+	value = gh_car(list);
+	list = gh_cdr(list);
+	if (gh_eq_p(value, gh_symbol2scm("mode"))) {
+	    ui->ViewportMode = gh_scm2int(gh_car(list));
+	    list = gh_cdr(list);
+	} else if (gh_eq_p(value, gh_symbol2scm("viewport"))) {
+	    sublist = gh_car(list);
+	    ui->Viewports[i].MapX = gh_scm2int(gh_car(sublist));
+	    sublist = gh_cdr(sublist);
+	    ui->Viewports[i].MapY = gh_scm2int(gh_car(sublist));
 	    ++i;
-	    list=gh_cdr(list);
+	    list = gh_cdr(list);
 	} else {
-	    errl("Unsupported tag",value);
+	    errl("Unsupported tag", value);
 	}
     }
-    ui->NumViewports=i;
+    ui->NumViewports = i;
 
     return SCM_UNSPECIFIED;
 }
@@ -2007,8 +2016,8 @@ local SCM CclSetMouseScroll(SCM flag)
 {
     int old;
 
-    old=TheUI.MouseScroll;
-    TheUI.MouseScroll=gh_scm2bool(flag);
+    old = TheUI.MouseScroll;
+    TheUI.MouseScroll = gh_scm2bool(flag);
 
     return gh_bool2scm(old);
 }
@@ -2024,12 +2033,12 @@ local SCM CclSetMouseScrollSpeed(SCM num)
     int speed;
     int old;
 
-    old=SpeedMouseScroll;
-    speed=gh_scm2int(num);
+    old = SpeedMouseScroll;
+    speed = gh_scm2int(num);
     if (speed < 1 || speed > FRAMES_PER_SECOND) {
-	SpeedMouseScroll=MOUSE_SCROLL_SPEED;
+	SpeedMouseScroll = MOUSE_SCROLL_SPEED;
     } else {
-	SpeedMouseScroll=speed;
+	SpeedMouseScroll = speed;
     }
     return gh_int2scm(old);
 }
@@ -2042,7 +2051,7 @@ local SCM CclSetMouseScrollSpeed(SCM num)
 */
 local SCM CclSetGrabMouse(SCM flag)
 {
-    if( gh_scm2bool(flag) ) {
+    if (gh_scm2bool(flag)) {
 	ToggleGrabMouse(1);
     } else {
 	ToggleGrabMouse(-1);
@@ -2062,8 +2071,8 @@ local SCM CclSetLeaveStops(SCM flag)
 {
     int old;
 
-    old=LeaveStops;
-    LeaveStops=gh_scm2bool(flag);
+    old = LeaveStops;
+    LeaveStops = gh_scm2bool(flag);
 
     return gh_bool2scm(old);
 }
@@ -2078,8 +2087,8 @@ local SCM CclSetKeyScroll(SCM flag)
 {
     int old;
 
-    old=TheUI.KeyScroll;
-    TheUI.KeyScroll=gh_scm2bool(flag);
+    old = TheUI.KeyScroll;
+    TheUI.KeyScroll = gh_scm2bool(flag);
 
     return gh_bool2scm(old);
 }
@@ -2095,12 +2104,12 @@ local SCM CclSetKeyScrollSpeed(SCM num)
     int speed;
     int old;
 
-    old=SpeedKeyScroll;
-    speed=gh_scm2int(num);
+    old = SpeedKeyScroll;
+    speed = gh_scm2int(num);
     if (speed < 1 || speed > FRAMES_PER_SECOND) {
-	SpeedKeyScroll=KEY_SCROLL_SPEED;
+	SpeedKeyScroll = KEY_SCROLL_SPEED;
     } else {
-	SpeedKeyScroll=speed;
+	SpeedKeyScroll = speed;
     }
     return gh_int2scm(old);
 }
@@ -2115,8 +2124,8 @@ local SCM CclSetShowCommandKey(SCM flag)
 {
     int old;
 
-    old=ShowCommandKey;
-    ShowCommandKey=gh_scm2bool(flag);
+    old = ShowCommandKey;
+    ShowCommandKey = gh_scm2bool(flag);
 #ifndef NEW_UI
     UpdateButtonPanel();
 #else
@@ -2131,7 +2140,7 @@ local SCM CclSetShowCommandKey(SCM flag)
 */
 local SCM CclRightButtonAttacks(void)
 {
-    RightButtonAttacks=1;
+    RightButtonAttacks = 1;
 
     return SCM_UNSPECIFIED;
 }
@@ -2141,7 +2150,7 @@ local SCM CclRightButtonAttacks(void)
 */
 local SCM CclRightButtonMoves(void)
 {
-    RightButtonAttacks=0;
+    RightButtonAttacks = 0;
 
     return SCM_UNSPECIFIED;
 }
@@ -2156,8 +2165,8 @@ local SCM CclSetFancyBuildings(SCM flag)
 {
     int old;
 
-    old=FancyBuildings;
-    FancyBuildings=gh_scm2bool(flag);
+    old = FancyBuildings;
+    FancyBuildings = gh_scm2bool(flag);
 
     return gh_bool2scm(old);
 }
@@ -2172,69 +2181,71 @@ local SCM CclSetFancyBuildings(SCM flag)
 local SCM CclDefineMenu(SCM list)
 {
     SCM value;
-    Menu *menu, item;
-    char *name = NULL;
-    char *s1;
-    void **func;
+    Menu* menu;
+    Menu item;
+    char* name;
+    char* s1;
+    void** func;
 
     DebugLevel3Fn("Define menu\n");
 
+    name = NULL;
     TheUI.Offset640X = (VideoWidth - 640) / 2;
     TheUI.Offset480Y = (VideoHeight - 480) / 2;
 
     //
     //	Parse the arguments, already the new tagged format.
     //
-    memset(&item,0,sizeof(Menu));
+    memset(&item, 0, sizeof(Menu));
 
-    while ( !gh_null_p(list) ) {
-	value=gh_car(list);
-	list=gh_cdr(list);
-	if( gh_eq_p(value,gh_symbol2scm("geometry")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
+    while (!gh_null_p(list)) {
+	value = gh_car(list);
+	list = gh_cdr(list);
+	if (gh_eq_p(value, gh_symbol2scm("geometry"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
 
-	    item.X=gh_scm2int(gh_car(value));
-	    value=gh_cdr(value);
-	    item.Y=gh_scm2int(gh_car(value));
-	    value=gh_cdr(value);
-	    item.Width=gh_scm2int(gh_car(value));
-	    value=gh_cdr(value);
-	    item.Height=gh_scm2int(gh_car(value));
+	    item.X = gh_scm2int(gh_car(value));
+	    value = gh_cdr(value);
+	    item.Y = gh_scm2int(gh_car(value));
+	    value = gh_cdr(value);
+	    item.Width = gh_scm2int(gh_car(value));
+	    value = gh_cdr(value);
+	    item.Height = gh_scm2int(gh_car(value));
 
-	} else if( gh_eq_p(value,gh_symbol2scm("name")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    name=gh_scm2newstr(value, NULL);
-	} else if( gh_eq_p(value,gh_symbol2scm("panel")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    if( !gh_eq_p(value,gh_symbol2scm("none")) ) {
-		item.Panel=gh_scm2newstr(value,NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("name"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    name = gh_scm2newstr(value, NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("panel"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    if (!gh_eq_p(value, gh_symbol2scm("none"))) {
+		item.Panel = gh_scm2newstr(value, NULL);
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("default")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    item.DefSel=gh_scm2int(value);
+	} else if (gh_eq_p(value, gh_symbol2scm("default"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    item.DefSel = gh_scm2int(value);
 /*
-	} else if( gh_eq_p(value,gh_symbol2scm("nitems")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    item.nitems=gh_scm2int(value);
+	} else if (gh_eq_p(value, gh_symbol2scm("nitems"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    item.nitems = gh_scm2int(value);
 */
-	} else if( gh_eq_p(value,gh_symbol2scm("netaction")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    s1 = gh_scm2newstr(value,NULL);
-	    func = (void **)hash_find(MenuFuncHash, s1);
+	} else if (gh_eq_p(value, gh_symbol2scm("netaction"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    s1 = gh_scm2newstr(value, NULL);
+	    func = (void**)hash_find(MenuFuncHash, s1);
 	    if (func != NULL) {
-		item.NetAction=(void *)*func;
+		item.NetAction = (void*)*func;
 	    } else {
-		fprintf(stderr,"Can't find function: %s\n", s1);
+		fprintf(stderr, "Can't find function: %s\n", s1);
 	    }
 	    free(s1);
 	} else {
-	    s1=gh_scm2newstr(value, NULL);
+	    s1 = gh_scm2newstr(value, NULL);
 	    fprintf(stderr, "Unsupported tag %s\n", s1);
 	    free(s1);
 	}
@@ -2244,13 +2255,13 @@ local SCM CclDefineMenu(SCM list)
 	menu = FindMenu(name);
 	if (!menu) {
 	    menu = malloc(sizeof(Menu));
-	    *(Menu **)hash_add(MenuHash,name) = menu;
+	    *(Menu**)hash_add(MenuHash, name) = menu;
 	} else {
 	    int i;
 	    int mitype;
 
 	    free(menu->Panel);
-	    for (i=0; i<menu->NumItems; ++i) {
+	    for (i = 0; i < menu->NumItems; ++i) {
 		mitype = menu->Items[i].mitype;
 		if (mitype == MI_TYPE_TEXT) {
 		    if (menu->Items[i].d.text.text) {
@@ -2275,7 +2286,7 @@ local SCM CclDefineMenu(SCM list)
 		} else if (mitype == MI_TYPE_PULLDOWN) {
 		    int j;
 		    j = menu->Items[i].d.pulldown.noptions-1;
-		    for (; j>=0; --j) {
+		    for (; j >= 0; --j) {
 			free(menu->Items[i].d.pulldown.options[j]);
 		    }
 		    free(menu->Items[i].d.pulldown.options);
@@ -2331,7 +2342,7 @@ local SCM CclDefineMenu(SCM list)
 	//printf("Me:%s\n", name);
 	free(name);
     } else {
-	fprintf(stderr,"Name of menu is missed, skip definition\n");
+	fprintf(stderr, "Name of menu is missed, skip definition\n");
     }
 
     return SCM_UNSPECIFIED;
@@ -2339,27 +2350,30 @@ local SCM CclDefineMenu(SCM list)
 
 local int scm2hotkey(SCM value)
 {
-    char *s;
-    int l, key=0, f;
+    char* s;
+    int l;
+    int key;
+    int f;
 
-    s = gh_scm2newstr(value,NULL);
+    key = 0;
+    s = gh_scm2newstr(value, NULL);
     l = strlen(s);
 
-    if (l==0) {
-	key=0;
-    } else if (l==1) {
-	key=s[0];
-    } else if (!strcmp(s,"esc")) {
-	key=27;
-    } else if (s[0]=='f' && l>1 && l<4) {
-	f = atoi(s+1);
+    if (l == 0) {
+	key = 0;
+    } else if (l == 1) {
+	key = s[0];
+    } else if (!strcmp(s, "esc")) {
+	key = 27;
+    } else if (s[0] == 'f' && l > 1 && l < 4) {
+	f = atoi(s + 1);
 	if (f > 0 && f < 13) {
-	    key = KeyCodeF1+f-1; // if key-order in include/interface.h is linear
+	    key = KeyCodeF1 + f - 1; // if key-order in include/interface.h is linear
 	} else {
-	    printf("Unknow key '%s'\n", s);
+	    printf("Unknown key '%s'\n", s);
 	}
     } else {
-	printf("Unknow key '%s'\n", s);
+	printf("Unknown key '%s'\n", s);
     }
     free(s);
     return key;
@@ -2369,12 +2383,13 @@ local int scm2style(SCM value)
 {
     int id;
 
-    if ( gh_eq_p(value, gh_symbol2scm("sc-vslider")) ) {
-        id=MI_STYLE_SC_VSLIDER;
-    } else if ( gh_eq_p(value, gh_symbol2scm("sc-hslider")) ) {
-        id=MI_STYLE_SC_HSLIDER;
+    if (gh_eq_p(value, gh_symbol2scm("sc-vslider"))) {
+        id = MI_STYLE_SC_VSLIDER;
+    } else if (gh_eq_p(value, gh_symbol2scm("sc-hslider"))) {
+        id = MI_STYLE_SC_HSLIDER;
     } else {
-	char *s1=gh_scm2newstr(value, NULL);
+	char* s1;
+	s1 = gh_scm2newstr(value, NULL);
         fprintf(stderr, "Unsupported style %s\n", s1);
         free(s1);
 	return 0;
@@ -2384,617 +2399,620 @@ local int scm2style(SCM value)
 
 local SCM CclDefineMenuItem(SCM list)
 {
-    SCM value, sublist;
+    SCM value;
+    SCM sublist;
     char* s1;
     char* name;
     Menuitem *item;
-    Menu **tmp, *menu;
-    void **func;
+    Menu** tmp;
+    Menu* menu;
+    void** func;
 
     DebugLevel3Fn("Define menu-item\n");
 
     name = NULL;
-    item = (Menuitem*)calloc(1,sizeof(Menuitem));
+    item = (Menuitem*)calloc(1, sizeof(Menuitem));
 
     //
     //	Parse the arguments, already the new tagged format.
     //
-    while( !gh_null_p(list) ) {
-	value=gh_car(list);
-	list=gh_cdr(list);
-	if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
+    while (!gh_null_p(list)) {
+	value = gh_car(list);
+	list = gh_cdr(list);
+	if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
 
-	    item->xofs=gh_scm2int(gh_car(value));
-	    value=gh_cdr(value);
-	    item->yofs=gh_scm2int(gh_car(value));
+	    item->xofs = gh_scm2int(gh_car(value));
+	    value = gh_cdr(value);
+	    item->yofs = gh_scm2int(gh_car(value));
 
-	} else if( gh_eq_p(value,gh_symbol2scm("menu")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    name=gh_scm2newstr(value, NULL);
-	} else if( gh_eq_p(value,gh_symbol2scm("flags")) ) {
-	    sublist=gh_car(list);
-	    list=gh_cdr(list);
+	} else if (gh_eq_p(value, gh_symbol2scm("menu"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    name = gh_scm2newstr(value, NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("flags"))) {
+	    sublist = gh_car(list);
+	    list = gh_cdr(list);
 
-	    while ( !gh_null_p(sublist) ) {
+	    while (!gh_null_p(sublist)) {
 	    
 		value = gh_car(sublist);
 		sublist = gh_cdr(sublist);
 	    
-		if ( gh_eq_p(value,gh_symbol2scm("active")) ) {
-		    item->flags|=MenuButtonActive;
-		} else if ( gh_eq_p(value,gh_symbol2scm("clicked")) ) {
-		    item->flags|=MenuButtonClicked;
-		} else if ( gh_eq_p(value,gh_symbol2scm("selected")) ) {
-		    item->flags|=MenuButtonSelected;
-		} else if ( gh_eq_p(value,gh_symbol2scm("disabled")) ) {
-		    item->flags|=MenuButtonDisabled;
+		if (gh_eq_p(value, gh_symbol2scm("active"))) {
+		    item->flags |= MenuButtonActive;
+		} else if (gh_eq_p(value, gh_symbol2scm("clicked"))) {
+		    item->flags |= MenuButtonClicked;
+		} else if (gh_eq_p(value, gh_symbol2scm("selected"))) {
+		    item->flags |= MenuButtonSelected;
+		} else if (gh_eq_p(value, gh_symbol2scm("disabled"))) {
+		    item->flags |= MenuButtonDisabled;
 		} else {
-		    s1=gh_scm2newstr(gh_car(value),NULL);
-		    fprintf(stderr,"Unknow flag %s\n",s1);
+		    s1 = gh_scm2newstr(gh_car(value), NULL);
+		    fprintf(stderr, "Unknown flag %s\n", s1);
 		    free(s1);
 		}
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("font")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    item->font=CclFontByIdentifier(value);
-	} else if( gh_eq_p(value,gh_symbol2scm("init")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
+	} else if (gh_eq_p(value, gh_symbol2scm("font"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    item->font = CclFontByIdentifier(value);
+	} else if (gh_eq_p(value, gh_symbol2scm("init"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
 
-	    s1 = gh_scm2newstr(value,NULL);
-	    func = (void **)hash_find(MenuFuncHash,s1);
+	    s1 = gh_scm2newstr(value, NULL);
+	    func = (void**)hash_find(MenuFuncHash, s1);
 	    if (func != NULL) {
-		item->initfunc=(void *)*func;
+		item->initfunc = (void*)*func;
 	    } else {
-	        fprintf(stderr,"Can't find function: %s\n", s1);
+	        fprintf(stderr, "Can't find function: %s\n", s1);
 	    }
 	    free(s1);
-	} else if( gh_eq_p(value,gh_symbol2scm("exit")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
+	} else if (gh_eq_p(value, gh_symbol2scm("exit"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
 
-	    s1 = gh_scm2newstr(value,NULL);
-	    func = (void **)hash_find(MenuFuncHash,s1);
+	    s1 = gh_scm2newstr(value, NULL);
+	    func = (void**)hash_find(MenuFuncHash, s1);
 	    if (func != NULL) {
-		item->exitfunc=(void *)*func;
+		item->exitfunc=(void*)*func;
 	    } else {
-	        fprintf(stderr,"Can't find function: %s\n", s1);
+	        fprintf(stderr, "Can't find function: %s\n", s1);
 	    }
 	    free(s1);
 /* Menu types */
-	} else if( !item->mitype ) {
-	    if ( gh_eq_p(value,gh_symbol2scm("text")) ) {
-		sublist=gh_car(list);
-		list=gh_cdr(list);
-		item->mitype=MI_TYPE_TEXT;
+	} else if (!item->mitype) {
+	    if (gh_eq_p(value, gh_symbol2scm("text"))) {
+		sublist = gh_car(list);
+		list = gh_cdr(list);
+		item->mitype = MI_TYPE_TEXT;
 		item->d.text.text = NULL;
 
-		while ( !gh_null_p(sublist) ) {
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
+		while (!gh_null_p(sublist)) {
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
 
-		    if ( gh_eq_p(value,gh_symbol2scm("align")) ) {
-			value=gh_car(sublist);
-			if (gh_eq_p(value,gh_symbol2scm("left")) ) {
-			    item->d.text.align=MI_TFLAGS_LALIGN;
-			} else if (gh_eq_p(value,gh_symbol2scm("right")) ) {
-			    item->d.text.align=MI_TFLAGS_RALIGN;
-			} else if (gh_eq_p(value,gh_symbol2scm("center")) ) {
-			    item->d.text.align=MI_TFLAGS_CENTERED;
+		    if (gh_eq_p(value, gh_symbol2scm("align"))) {
+			value = gh_car(sublist);
+			if (gh_eq_p(value, gh_symbol2scm("left"))) {
+			    item->d.text.align = MI_TFLAGS_LALIGN;
+			} else if (gh_eq_p(value, gh_symbol2scm("right"))) {
+			    item->d.text.align = MI_TFLAGS_RALIGN;
+			} else if (gh_eq_p(value, gh_symbol2scm("center"))) {
+			    item->d.text.align = MI_TFLAGS_CENTERED;
 			}
-		    } else if ( gh_eq_p(value,gh_symbol2scm("caption")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.text.text=gh_scm2newstr(gh_car(sublist), NULL);
+		    } else if (gh_eq_p(value, gh_symbol2scm("caption"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.text.text = gh_scm2newstr(gh_car(sublist), NULL);
 			}
-		    } else if ( gh_eq_p(value, gh_symbol2scm("func")) ) {
-			value=gh_car(sublist);
-	    		s1 = gh_scm2newstr(value,NULL);
-			func = (void **)hash_find(MenuFuncHash,s1);
+		    } else if (gh_eq_p(value, gh_symbol2scm("func"))) {
+			value = gh_car(sublist);
+	    		s1 = gh_scm2newstr(value, NULL);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-		    	item->d.text.action=(void *)*func;
+		    	    item->d.text.action = (void*)*func;
 			} else {
-		    	    fprintf(stderr,"Can't find function: %s\n", s1);
+		    	    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-normal")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.text.normalcolor=gh_scm2newstr(gh_car(sublist), NULL);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-normal"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.text.normalcolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-reverse")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.text.reversecolor=gh_scm2newstr(gh_car(sublist), NULL);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-reverse"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.text.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
 		    } else {
-			//s1=gh_scm2newstr(value, NULL);
+			//s1 = gh_scm2newstr(value, NULL);
 			//fprintf(stderr, "Unsupported property %s\n", s1);
 			//free(s1);
 		    }
 		}
-	    } else if ( gh_eq_p(value,gh_symbol2scm("button")) ) {
-		sublist=gh_car(list);
-		list=gh_cdr(list);
-		item->mitype=MI_TYPE_BUTTON;
+	    } else if (gh_eq_p(value, gh_symbol2scm("button"))) {
+		sublist = gh_car(list);
+		list = gh_cdr(list);
+		item->mitype = MI_TYPE_BUTTON;
 
-		while ( !gh_null_p(sublist) ) {
+		while (!gh_null_p(sublist)) {
 
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
 
-		    if ( gh_eq_p(value, gh_symbol2scm("size")) ) {
-			item->d.button.xsize=gh_scm2int(gh_car(gh_car(sublist)));
-			value=gh_cdr(gh_car(sublist));
-			item->d.button.ysize=gh_scm2int(gh_car(value));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("caption")) ) {
+		    if (gh_eq_p(value, gh_symbol2scm("size"))) {
+			item->d.button.xsize = gh_scm2int(gh_car(gh_car(sublist)));
+			value = gh_cdr(gh_car(sublist));
+			item->d.button.ysize = gh_scm2int(gh_car(value));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("caption"))) {
 			item->d.button.text = NULL;
-			if ( !gh_null_p(gh_car(sublist)) ) {
+			if (!gh_null_p(gh_car(sublist))) {
 			    item->d.button.text = gh_scm2newstr(
-				gh_car(sublist),NULL);
+				gh_car(sublist), NULL);
 			}
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("hotkey")) ) {
-			item->d.button.hotkey=scm2hotkey(gh_car(sublist));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("func")) ) {
-	    		s1 = gh_scm2newstr(gh_car(sublist),NULL);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("hotkey"))) {
+			item->d.button.hotkey = scm2hotkey(gh_car(sublist));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("func"))) {
+	    		s1 = gh_scm2newstr(gh_car(sublist), NULL);
 			//item->d.button.handler=hash_mini_get(MenuHndlrHash, s1);
-			func = (void **)hash_find(MenuFuncHash, s1);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-			    item->d.button.handler=(void *)*func;
+			    item->d.button.handler = (void*)*func;
 			} else {
-			    fprintf(stderr,"Can't find function: %s\n", s1);
+			    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("style")) ) {
-			value=gh_car(sublist);
-			item->d.button.button=scm2buttonid(value);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-normal")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.button.normalcolor=gh_scm2newstr(gh_car(sublist), NULL);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("style"))) {
+			value = gh_car(sublist);
+			item->d.button.button = scm2buttonid(value);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-normal"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.button.normalcolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-reverse")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.button.reversecolor=gh_scm2newstr(gh_car(sublist), NULL);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-reverse"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.button.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
 		    } else {
-			//s1=gh_scm2newstr(value, NULL);
+			//s1 = gh_scm2newstr(value, NULL);
 			//fprintf(stderr, "Unsupported property %s\n", s1);
 			//free(s1);
 		    }
 		}
-	    } else if ( gh_eq_p(value,gh_symbol2scm("pulldown")) ) {
-		sublist=gh_car(list);
-		list=gh_cdr(list);
+	    } else if (gh_eq_p(value, gh_symbol2scm("pulldown"))) {
+		sublist = gh_car(list);
+		list = gh_cdr(list);
 		item->mitype=MI_TYPE_PULLDOWN;
 
-		while ( !gh_null_p(sublist) ) {
+		while (!gh_null_p(sublist)) {
 
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
 
-		    if ( gh_eq_p(value, gh_symbol2scm("size")) ) {
-			item->d.pulldown.xsize=gh_scm2int(gh_car(gh_car(sublist)));
-			value=gh_cdr(gh_car(sublist));
-			item->d.pulldown.ysize=gh_scm2int(gh_car(value));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("options")) ) {
-			value=gh_car(sublist);
+		    if (gh_eq_p(value, gh_symbol2scm("size"))) {
+			item->d.pulldown.xsize = gh_scm2int(gh_car(gh_car(sublist)));
+			value = gh_cdr(gh_car(sublist));
+			item->d.pulldown.ysize = gh_scm2int(gh_car(value));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("options"))) {
+			value = gh_car(sublist);
 			if (gh_list_p(value)) {
-			    int n, i;
+			    int n;
+			    int i;
 
 			    n = item->d.pulldown.noptions = gh_length(value);
-			    item->d.pulldown.options = (unsigned char **)malloc(sizeof(char*)*n);
-			    for (i=0; i<n; i++) {
-				item->d.pulldown.options[i]=gh_scm2newstr(gh_car(value),NULL);
+			    item->d.pulldown.options = (unsigned char**)malloc(sizeof(unsigned char*)*n);
+			    for (i = 0; i < n; ++i) {
+				item->d.pulldown.options[i] = gh_scm2newstr(gh_car(value), NULL);
 				value = gh_cdr(value);
 			    }
 			}
-		    } else if ( gh_eq_p(value, gh_symbol2scm("func")) ) {
-	    		s1 = gh_scm2newstr(gh_car(sublist),NULL);
-			func = (void **)hash_find(MenuFuncHash,s1);
+		    } else if (gh_eq_p(value, gh_symbol2scm("func"))) {
+	    		s1 = gh_scm2newstr(gh_car(sublist), NULL);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-			    item->d.pulldown.action=(void *)*func;
+			    item->d.pulldown.action = (void*)*func;
 			} else {
-			    fprintf(stderr,"Can't find function: %s\n", s1);
+			    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("style")) ) {
-			value=gh_car(sublist);
-			item->d.pulldown.button=scm2buttonid(value);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("state")) ) {
-			value=gh_car(sublist);
-			if ( gh_eq_p(value, gh_symbol2scm("passive")) ) {
-			    item->d.pulldown.state=MI_PSTATE_PASSIVE;
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("style"))) {
+			value = gh_car(sublist);
+			item->d.pulldown.button = scm2buttonid(value);
+		    } else if (gh_eq_p(value, gh_symbol2scm("state"))) {
+			value = gh_car(sublist);
+			if (gh_eq_p(value, gh_symbol2scm("passive"))) {
+			    item->d.pulldown.state = MI_PSTATE_PASSIVE;
 			}
-		    } else if ( gh_eq_p(value, gh_symbol2scm("default")) ) {
-			item->d.pulldown.defopt=gh_scm2int(gh_car(sublist));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("current")) ) {
-			item->d.pulldown.curopt=gh_scm2int(gh_car(sublist));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-normal")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.pulldown.normalcolor=gh_scm2newstr(gh_car(sublist), NULL);
+		    } else if (gh_eq_p(value, gh_symbol2scm("default"))) {
+			item->d.pulldown.defopt = gh_scm2int(gh_car(sublist));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("current"))) {
+			item->d.pulldown.curopt = gh_scm2int(gh_car(sublist));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-normal"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.pulldown.normalcolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-reverse")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.pulldown.reversecolor=gh_scm2newstr(gh_car(sublist), NULL);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-reverse"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.pulldown.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
 		    } else {
-			//s1=gh_scm2newstr(value, NULL);
+			//s1 = gh_scm2newstr(value, NULL);
 			//fprintf(stderr, "Unsupported property %s\n", s1);
 			//free(s1);
 		    }
 		}
-	    } else if ( gh_eq_p(value,gh_symbol2scm("listbox")) ) {
-		sublist=gh_car(list);
-		list=gh_cdr(list);
-		item->mitype=MI_TYPE_LISTBOX;
+	    } else if (gh_eq_p(value, gh_symbol2scm("listbox"))) {
+		sublist = gh_car(list);
+		list = gh_cdr(list);
+		item->mitype = MI_TYPE_LISTBOX;
 
-		while ( !gh_null_p(sublist) ) {
+		while (!gh_null_p(sublist)) {
 
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
 
-		    if ( gh_eq_p(value, gh_symbol2scm("size")) ) {
-			item->d.listbox.xsize=gh_scm2int(gh_car(gh_car(sublist)));
-			value=gh_cdr(gh_car(sublist));
-			item->d.listbox.ysize=gh_scm2int(gh_car(value));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("func")) ) {
-	    		s1 = gh_scm2newstr(gh_car(sublist),NULL);
-			func = (void **)hash_find(MenuFuncHash,s1);
+		    if (gh_eq_p(value, gh_symbol2scm("size"))) {
+			item->d.listbox.xsize = gh_scm2int(gh_car(gh_car(sublist)));
+			value = gh_cdr(gh_car(sublist));
+			item->d.listbox.ysize = gh_scm2int(gh_car(value));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("func"))) {
+	    		s1 = gh_scm2newstr(gh_car(sublist), NULL);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-			    item->d.listbox.action=(void *)*func;
+			    item->d.listbox.action = (void*)*func;
 			} else {
-			    fprintf(stderr,"Can't find function: %s\n", s1);
+			    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("handler")) ) {
-	    		s1 = gh_scm2newstr(gh_car(sublist),NULL);
-			func = (void **)hash_find(MenuFuncHash,s1);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("handler"))) {
+	    		s1 = gh_scm2newstr(gh_car(sublist), NULL);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-			    item->d.listbox.handler=(void *)*func;
+			    item->d.listbox.handler = (void*)*func;
 			} else {
-			    fprintf(stderr,"Can't find function: %s\n", s1);
+			    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("retopt")) ) {
-	    		s1 = gh_scm2newstr(gh_car(sublist),NULL);
-			func = (void **)hash_find(MenuFuncHash,s1);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("retopt"))) {
+	    		s1 = gh_scm2newstr(gh_car(sublist), NULL);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-			    item->d.listbox.retrieveopt=(void *)(*func);
+			    item->d.listbox.retrieveopt = (void*)(*func);
 			} else {
-			    fprintf(stderr,"Can't find function: %s\n", s1);
+			    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("style")) ) {
-			value=gh_car(sublist);
-			item->d.listbox.button=scm2buttonid(value);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("default")) ) {
-			item->d.listbox.defopt=gh_scm2int(gh_car(sublist));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("startline")) ) {
-			item->d.listbox.startline=gh_scm2int(gh_car(sublist));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("nlines")) ) {
-			item->d.listbox.nlines=gh_scm2int(gh_car(sublist));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("current")) ) {
-			item->d.listbox.curopt=gh_scm2int(gh_car(sublist));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-normal")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.listbox.normalcolor=gh_scm2newstr(gh_car(sublist), NULL);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("style"))) {
+			value = gh_car(sublist);
+			item->d.listbox.button = scm2buttonid(value);
+		    } else if (gh_eq_p(value, gh_symbol2scm("default"))) {
+			item->d.listbox.defopt = gh_scm2int(gh_car(sublist));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("startline"))) {
+			item->d.listbox.startline = gh_scm2int(gh_car(sublist));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("nlines"))) {
+			item->d.listbox.nlines = gh_scm2int(gh_car(sublist));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("current"))) {
+			item->d.listbox.curopt = gh_scm2int(gh_car(sublist));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-normal"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.listbox.normalcolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-reverse")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.listbox.reversecolor=gh_scm2newstr(gh_car(sublist), NULL);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-reverse"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.listbox.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
 		    } else {
-			//s1=gh_scm2newstr(value, NULL);
+			//s1 = gh_scm2newstr(value, NULL);
 			//fprintf(stderr, "Unsupported property %s\n", s1);
 			//free(s1);
 		    }
 		}
-	    } else if ( gh_eq_p(value,gh_symbol2scm("vslider")) ) {
-		sublist=gh_car(list);
-		list=gh_cdr(list);
-		item->mitype=MI_TYPE_VSLIDER;
-		item->d.vslider.defper=-1;
+	    } else if (gh_eq_p(value, gh_symbol2scm("vslider"))) {
+		sublist = gh_car(list);
+		list = gh_cdr(list);
+		item->mitype = MI_TYPE_VSLIDER;
+		item->d.vslider.defper = -1;
 
-		while ( !gh_null_p(sublist) ) {
+		while (!gh_null_p(sublist)) {
 
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
 
-		    if ( gh_eq_p(value, gh_symbol2scm("size")) ) {
-			item->d.vslider.xsize=gh_scm2int(gh_car(gh_car(sublist)));
-			value=gh_cdr(gh_car(sublist));
-			item->d.vslider.ysize=gh_scm2int(gh_car(value));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("flags")) ) {
+		    if (gh_eq_p(value, gh_symbol2scm("size"))) {
+			item->d.vslider.xsize = gh_scm2int(gh_car(gh_car(sublist)));
+			value = gh_cdr(gh_car(sublist));
+			item->d.vslider.ysize = gh_scm2int(gh_car(value));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("flags"))) {
 			SCM slist;
 
 			slist = gh_car(sublist);
-			while ( !gh_null_p(slist) ) {
+			while (!gh_null_p(slist)) {
 	    
 			    value = gh_car(slist);
 			    slist = gh_cdr(slist);
 	    
-			    if ( gh_eq_p(value,gh_symbol2scm("up")) ) {
-				item->d.vslider.cflags|=MI_CFLAGS_UP;
-			    } else if ( gh_eq_p(value,gh_symbol2scm("down")) ) {
-				item->d.vslider.cflags|=MI_CFLAGS_DOWN;
-			    } else if ( gh_eq_p(value,gh_symbol2scm("left")) ) {
-				item->d.vslider.cflags|=MI_CFLAGS_LEFT;
-			    } else if ( gh_eq_p(value,gh_symbol2scm("right")) ) {
-				item->d.vslider.cflags|=MI_CFLAGS_RIGHT;
-			    } else if ( gh_eq_p(value,gh_symbol2scm("knob")) ) {
-				item->d.vslider.cflags|=MI_CFLAGS_KNOB;
-			    } else if ( gh_eq_p(value,gh_symbol2scm("cont")) ) {
-				item->d.vslider.cflags|=MI_CFLAGS_CONT;
+			    if (gh_eq_p(value, gh_symbol2scm("up"))) {
+				item->d.vslider.cflags |= MI_CFLAGS_UP;
+			    } else if (gh_eq_p(value, gh_symbol2scm("down"))) {
+				item->d.vslider.cflags |= MI_CFLAGS_DOWN;
+			    } else if (gh_eq_p(value, gh_symbol2scm("left"))) {
+				item->d.vslider.cflags |= MI_CFLAGS_LEFT;
+			    } else if (gh_eq_p(value, gh_symbol2scm("right"))) {
+				item->d.vslider.cflags |= MI_CFLAGS_RIGHT;
+			    } else if (gh_eq_p(value, gh_symbol2scm("knob"))) {
+				item->d.vslider.cflags |= MI_CFLAGS_KNOB;
+			    } else if (gh_eq_p(value, gh_symbol2scm("cont"))) {
+				item->d.vslider.cflags |= MI_CFLAGS_CONT;
 			    } else {
-				s1=gh_scm2newstr(gh_car(value),NULL);
-				fprintf(stderr,"Unknow flag %s\n",s1);
+				s1 = gh_scm2newstr(gh_car(value), NULL);
+				fprintf(stderr, "Unknown flag %s\n", s1);
 				free(s1);
 			    }
 			}
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("func")) ) {
-	    		s1 = gh_scm2newstr(gh_car(sublist),NULL);
-			func = (void **)hash_find(MenuFuncHash,s1);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("func"))) {
+	    		s1 = gh_scm2newstr(gh_car(sublist), NULL);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-			    item->d.vslider.action=(void *)*func;
+			    item->d.vslider.action = (void*)*func;
 			} else {
-			    fprintf(stderr,"Can't find function: %s\n", s1);
+			    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("handler")) ) {
-	    		s1 = gh_scm2newstr(gh_car(sublist),NULL);
-			func = (void **)hash_find(MenuFuncHash,s1);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("handler"))) {
+	    		s1 = gh_scm2newstr(gh_car(sublist), NULL);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-			    item->d.vslider.handler=(void *)*func;
+			    item->d.vslider.handler = (void*)*func;
 			} else {
-			    fprintf(stderr,"Can't find function: %s\n", s1);
+			    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("default")) ) {
-			item->d.vslider.defper=gh_scm2int(gh_car(sublist));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("current")) ) {
-			item->d.vslider.percent=gh_scm2int(gh_car(sublist));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("style")) ) {
-			value=gh_car(sublist);
-			item->d.vslider.style=scm2style(value);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("default"))) {
+			item->d.vslider.defper = gh_scm2int(gh_car(sublist));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("current"))) {
+			item->d.vslider.percent = gh_scm2int(gh_car(sublist));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("style"))) {
+			value = gh_car(sublist);
+			item->d.vslider.style = scm2style(value);
 		    } else {
-			//s1=gh_scm2newstr(value, NULL);
+			//s1 = gh_scm2newstr(value, NULL);
 			//fprintf(stderr, "Unsupported property %s\n", s1);
 			//free(s1);
 		    }
 		}
-	    } else if ( gh_eq_p(value,gh_symbol2scm("drawfunc")) ) {
-		value=gh_car(list);
-		list=gh_cdr(list);
-		item->mitype=MI_TYPE_DRAWFUNC;
+	    } else if (gh_eq_p(value, gh_symbol2scm("drawfunc"))) {
+		value = gh_car(list);
+		list = gh_cdr(list);
+		item->mitype = MI_TYPE_DRAWFUNC;
 
-		s1 = gh_scm2newstr(value,NULL);
-		func = (void **)hash_find(MenuFuncHash,s1);
+		s1 = gh_scm2newstr(value, NULL);
+		func = (void**)hash_find(MenuFuncHash, s1);
 		if (func != NULL) {
-		    item->d.drawfunc.draw=(void *)*func;
+		    item->d.drawfunc.draw = (void*)*func;
 		} else {
-		    fprintf(stderr,"Can't find function: %s\n", s1);
+		    fprintf(stderr, "Can't find function: %s\n", s1);
 		}
 		free(s1);
-	    } else if ( gh_eq_p(value,gh_symbol2scm("input")) ) {
-		sublist=gh_car(list);
-		list=gh_cdr(list);
-		item->mitype=MI_TYPE_INPUT;
+	    } else if (gh_eq_p(value, gh_symbol2scm("input"))) {
+		sublist = gh_car(list);
+		list = gh_cdr(list);
+		item->mitype = MI_TYPE_INPUT;
 
-		while ( !gh_null_p(sublist) ) {
+		while (!gh_null_p(sublist)) {
 
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
 
-		    if ( gh_eq_p(value, gh_symbol2scm("size")) ) {
-			item->d.input.xsize=gh_scm2int(gh_car(gh_car(sublist)));
-			value=gh_cdr(gh_car(sublist));
-			item->d.input.ysize=gh_scm2int(gh_car(value));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("func")) ) {
-	    		s1 = gh_scm2newstr(gh_car(sublist),NULL);
-			func = (void **)hash_find(MenuFuncHash, s1);
+		    if (gh_eq_p(value, gh_symbol2scm("size"))) {
+			item->d.input.xsize = gh_scm2int(gh_car(gh_car(sublist)));
+			value = gh_cdr(gh_car(sublist));
+			item->d.input.ysize = gh_scm2int(gh_car(value));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("func"))) {
+	    		s1 = gh_scm2newstr(gh_car(sublist), NULL);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-			    item->d.input.action=(void *)*func;
+			    item->d.input.action = (void*)*func;
 			} else {
-			    fprintf(stderr,"Can't find function: %s\n", s1);
+			    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("style")) ) {
-			value=gh_car(sublist);
-			item->d.input.button=scm2buttonid(value);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("maxch")) ) {
-			value=gh_car(sublist);
-			item->d.input.maxch=gh_scm2int(value);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-normal")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.input.normalcolor=gh_scm2newstr(gh_car(sublist), NULL);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("style"))) {
+			value = gh_car(sublist);
+			item->d.input.button = scm2buttonid(value);
+		    } else if (gh_eq_p(value, gh_symbol2scm("maxch"))) {
+			value = gh_car(sublist);
+			item->d.input.maxch = gh_scm2int(value);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-normal"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.input.normalcolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-reverse")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.input.reversecolor=gh_scm2newstr(gh_car(sublist), NULL);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-reverse"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.input.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
 		    } else {
-			//s1=gh_scm2newstr(value, NULL);
+			//s1 = gh_scm2newstr(value, NULL);
 			//fprintf(stderr, "Unsupported property %s\n", s1);
 			//free(s1);
 		    }
 		}
-	    } else if ( gh_eq_p(value,gh_symbol2scm("gem")) ) {
-		sublist=gh_car(list);
-		list=gh_cdr(list);
-		item->mitype=MI_TYPE_GEM;
+	    } else if (gh_eq_p(value, gh_symbol2scm("gem"))) {
+		sublist = gh_car(list);
+		list = gh_cdr(list);
+		item->mitype = MI_TYPE_GEM;
 
-		while ( !gh_null_p(sublist) ) {
+		while (!gh_null_p(sublist)) {
 
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
 
-		    if ( gh_eq_p(value, gh_symbol2scm("size")) ) {
-			item->d.gem.xsize=gh_scm2int(gh_car(gh_car(sublist)));
-			value=gh_cdr(gh_car(sublist));
-			item->d.gem.ysize=gh_scm2int(gh_car(value));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("state")) ) {
-			value=gh_car(sublist);
-			if ( gh_eq_p(value, gh_symbol2scm("unchecked")) ) {
-			    item->d.gem.state=MI_GSTATE_UNCHECKED;
-			} else if ( gh_eq_p(value, gh_symbol2scm("passive")) ) {
-			    item->d.gem.state=MI_GSTATE_PASSIVE;
-			} else if ( gh_eq_p(value, gh_symbol2scm("invisible")) ) {
-			    item->d.gem.state=MI_GSTATE_INVISIBLE;
-			} else if ( gh_eq_p(value, gh_symbol2scm("checked")) ) {
-			    item->d.gem.state=MI_GSTATE_CHECKED;
+		    if (gh_eq_p(value, gh_symbol2scm("size"))) {
+			item->d.gem.xsize = gh_scm2int(gh_car(gh_car(sublist)));
+			value = gh_cdr(gh_car(sublist));
+			item->d.gem.ysize = gh_scm2int(gh_car(value));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("state"))) {
+			value = gh_car(sublist);
+			if (gh_eq_p(value, gh_symbol2scm("unchecked"))) {
+			    item->d.gem.state = MI_GSTATE_UNCHECKED;
+			} else if (gh_eq_p(value, gh_symbol2scm("passive"))) {
+			    item->d.gem.state = MI_GSTATE_PASSIVE;
+			} else if (gh_eq_p(value, gh_symbol2scm("invisible"))) {
+			    item->d.gem.state = MI_GSTATE_INVISIBLE;
+			} else if (gh_eq_p(value, gh_symbol2scm("checked"))) {
+			    item->d.gem.state = MI_GSTATE_CHECKED;
 			}
-		    } else if ( gh_eq_p(value, gh_symbol2scm("func")) ) {
-	    		s1 = gh_scm2newstr(gh_car(sublist),NULL);
-			func = (void **)hash_find(MenuFuncHash,s1);
+		    } else if (gh_eq_p(value, gh_symbol2scm("func"))) {
+	    		s1 = gh_scm2newstr(gh_car(sublist), NULL);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-			    item->d.gem.action=(void *)*func;
+			    item->d.gem.action = (void*)*func;
 			} else {
-			    fprintf(stderr,"Can't find function: %s\n", s1);
+			    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("style")) ) {
-			value=gh_car(sublist);
-			item->d.gem.button=scm2buttonid(value);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("text")) ) {
-			value=gh_car(sublist);
-			item->d.gem.text=gh_scm2newstr(value, NULL);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-normal")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.gem.normalcolor=gh_scm2newstr(gh_car(sublist), NULL);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("style"))) {
+			value = gh_car(sublist);
+			item->d.gem.button = scm2buttonid(value);
+		    } else if (gh_eq_p(value, gh_symbol2scm("text"))) {
+			value = gh_car(sublist);
+			item->d.gem.text = gh_scm2newstr(value, NULL);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-normal"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.gem.normalcolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
-		    } else if ( gh_eq_p(value, gh_symbol2scm("color-reverse")) ) {
-			if ( !gh_null_p(gh_car(sublist)) ) {
-			    item->d.gem.reversecolor=gh_scm2newstr(gh_car(sublist), NULL);
+		    } else if (gh_eq_p(value, gh_symbol2scm("color-reverse"))) {
+			if (!gh_null_p(gh_car(sublist))) {
+			    item->d.gem.reversecolor = gh_scm2newstr(gh_car(sublist), NULL);
 			}
 		    } else {
-			//s1=gh_scm2newstr(value, NULL);
+			//s1 = gh_scm2newstr(value, NULL);
 			//fprintf(stderr, "Unsupported property %s\n", s1);
 			//free(s1);
 		    }
 		}
-	    } else if ( gh_eq_p(value,gh_symbol2scm("hslider")) ) {
-		sublist=gh_car(list);
-		list=gh_cdr(list);
-		item->mitype=MI_TYPE_HSLIDER;
-		item->d.hslider.defper=-1;
+	    } else if (gh_eq_p(value, gh_symbol2scm("hslider"))) {
+		sublist = gh_car(list);
+		list = gh_cdr(list);
+		item->mitype = MI_TYPE_HSLIDER;
+		item->d.hslider.defper = -1;
 
-		while ( !gh_null_p(sublist) ) {
+		while (!gh_null_p(sublist)) {
 
-		    value=gh_car(sublist);
-		    sublist=gh_cdr(sublist);
+		    value = gh_car(sublist);
+		    sublist = gh_cdr(sublist);
 
-		    if ( gh_eq_p(value, gh_symbol2scm("size")) ) {
-			item->d.hslider.xsize=gh_scm2int(gh_car(gh_car(sublist)));
-			value=gh_cdr(gh_car(sublist));
-			item->d.hslider.ysize=gh_scm2int(gh_car(value));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("flags")) ) {
+		    if (gh_eq_p(value, gh_symbol2scm("size"))) {
+			item->d.hslider.xsize = gh_scm2int(gh_car(gh_car(sublist)));
+			value = gh_cdr(gh_car(sublist));
+			item->d.hslider.ysize = gh_scm2int(gh_car(value));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("flags"))) {
 			SCM slist;
 
 			slist = gh_car(sublist);
-			while ( !gh_null_p(slist) ) {
+			while (!gh_null_p(slist)) {
 	    
 			    value = gh_car(slist);
 			    slist = gh_cdr(slist);
 	    
-			    if ( gh_eq_p(value,gh_symbol2scm("up")) ) {
-				item->d.hslider.cflags|=MI_CFLAGS_UP;
-			    } else if ( gh_eq_p(value,gh_symbol2scm("down")) ) {
-				item->d.hslider.cflags|=MI_CFLAGS_DOWN;
-			    } else if ( gh_eq_p(value,gh_symbol2scm("left")) ) {
-				item->d.hslider.cflags|=MI_CFLAGS_LEFT;
-			    } else if ( gh_eq_p(value,gh_symbol2scm("right")) ) {
-				item->d.hslider.cflags|=MI_CFLAGS_RIGHT;
-			    } else if ( gh_eq_p(value,gh_symbol2scm("knob")) ) {
-				item->d.hslider.cflags|=MI_CFLAGS_KNOB;
-			    } else if ( gh_eq_p(value,gh_symbol2scm("cont")) ) {
-				item->d.hslider.cflags|=MI_CFLAGS_CONT;
+			    if (gh_eq_p(value, gh_symbol2scm("up"))) {
+				item->d.hslider.cflags |= MI_CFLAGS_UP;
+			    } else if (gh_eq_p(value, gh_symbol2scm("down"))) {
+				item->d.hslider.cflags |= MI_CFLAGS_DOWN;
+			    } else if (gh_eq_p(value, gh_symbol2scm("left"))) {
+				item->d.hslider.cflags |= MI_CFLAGS_LEFT;
+			    } else if (gh_eq_p(value, gh_symbol2scm("right"))) {
+				item->d.hslider.cflags |= MI_CFLAGS_RIGHT;
+			    } else if (gh_eq_p(value, gh_symbol2scm("knob"))) {
+				item->d.hslider.cflags |= MI_CFLAGS_KNOB;
+			    } else if (gh_eq_p(value, gh_symbol2scm("cont"))) {
+				item->d.hslider.cflags |= MI_CFLAGS_CONT;
 			    } else {
-				s1=gh_scm2newstr(gh_car(value),NULL);
-				fprintf(stderr,"Unknow flag %s\n",s1);
+				s1 = gh_scm2newstr(gh_car(value), NULL);
+				fprintf(stderr, "Unknown flag %s\n",s1);
 				free(s1);
 			    }
 			}
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("func")) ) {
-	    		s1 = gh_scm2newstr(gh_car(sublist),NULL);
-			func = (void **)hash_find(MenuFuncHash,s1);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("func"))) {
+	    		s1 = gh_scm2newstr(gh_car(sublist), NULL);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-			    item->d.hslider.action=(void *)*func;
+			    item->d.hslider.action = (void*)*func;
 			} else {
-			    fprintf(stderr,"Can't find function: %s\n", s1);
+			    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("handler")) ) {
-	    		s1 = gh_scm2newstr(gh_car(sublist),NULL);
-			func = (void **)hash_find(MenuFuncHash,s1);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("handler"))) {
+	    		s1 = gh_scm2newstr(gh_car(sublist), NULL);
+			func = (void**)hash_find(MenuFuncHash, s1);
 			if (func != NULL) {
-			    item->d.hslider.handler=(void *)*func;
+			    item->d.hslider.handler = (void*)*func;
 			} else {
-			    fprintf(stderr,"Can't find function: %s\n", s1);
+			    fprintf(stderr, "Can't find function: %s\n", s1);
 			}
 			free(s1);
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("default")) ) {
-			item->d.hslider.defper=gh_scm2int(gh_car(sublist));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("current")) ) {
-			item->d.hslider.percent=gh_scm2int(gh_car(sublist));
-			sublist=gh_cdr(sublist);
-		    } else if ( gh_eq_p(value, gh_symbol2scm("style")) ) {
-			value=gh_car(sublist);
-			item->d.hslider.style=scm2style(value);
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("default"))) {
+			item->d.hslider.defper = gh_scm2int(gh_car(sublist));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("current"))) {
+			item->d.hslider.percent = gh_scm2int(gh_car(sublist));
+			sublist = gh_cdr(sublist);
+		    } else if (gh_eq_p(value, gh_symbol2scm("style"))) {
+			value = gh_car(sublist);
+			item->d.hslider.style = scm2style(value);
 		    } else {
-			//s1=gh_scm2newstr(value, NULL);
+			//s1 = gh_scm2newstr(value, NULL);
 			//fprintf(stderr, "Unsupported property %s\n", s1);
 			//free(s1);
 		    }
 		}
 	    }
 	} else {
-	    s1=gh_scm2newstr(value, NULL);
+	    s1 = gh_scm2newstr(value, NULL);
 	    fprintf(stderr, "Unsupported tag %s\n", s1);
 	    free(s1);
 	}
     }
 
-    if ( (tmp = (Menu **)hash_find(MenuHash,name)) ) {
+    if ((tmp = (Menu**)hash_find(MenuHash, name))) {
 	menu = *tmp;
 	if (menu->Items) {
-	    menu->Items=(Menuitem*)realloc(menu->Items,sizeof(Menuitem)*(menu->NumItems+1));
+	    menu->Items = (Menuitem*)realloc(menu->Items, sizeof(Menuitem) * (menu->NumItems + 1));
 	} else {
-	    menu->Items=(Menuitem*)malloc(sizeof(Menuitem));
+	    menu->Items = (Menuitem*)malloc(sizeof(Menuitem));
 	}
 	item->menu = menu;
-	memcpy(menu->Items+menu->NumItems,item,sizeof(Menuitem));
+	memcpy(menu->Items + menu->NumItems, item, sizeof(Menuitem));
 	menu->NumItems++;
     }
     free(name);
@@ -3015,27 +3033,27 @@ local SCM CclDefineMenuGraphics(SCM list)
     int i;
 
     i = 0;
-    while( !gh_null_p(list) ) {
-	sublist=gh_car(list);
-	list=gh_cdr(list);
-	while( !gh_null_p(sublist) ) {
-	    value=gh_car(sublist);
-	    sublist=gh_cdr(sublist);
-	    if( gh_eq_p(value,gh_symbol2scm("file")) ) {
-		value=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		if( MenuButtonGfx.File[i] ) {
+    while (!gh_null_p(list)) {
+	sublist = gh_car(list);
+	list = gh_cdr(list);
+	while (!gh_null_p(sublist)) {
+	    value = gh_car(sublist);
+	    sublist = gh_cdr(sublist);
+	    if (gh_eq_p(value, gh_symbol2scm("file"))) {
+		value = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		if (MenuButtonGfx.File[i]) {
 		    free(MenuButtonGfx.File[i]);
 		}
-		MenuButtonGfx.File[i]=gh_scm2newstr(value,NULL);
-	    } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
+		MenuButtonGfx.File[i] = gh_scm2newstr(value, NULL);
+	    } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
 		SCM sublist2;
 
-		sublist2=gh_car(sublist);
-		sublist=gh_cdr(sublist);
-		MenuButtonGfx.Width[i]=gh_scm2int(gh_car(sublist2));
-		sublist2=gh_cdr(sublist2);
-		MenuButtonGfx.Height[i]=gh_scm2int(gh_car(sublist2));
+		sublist2 = gh_car(sublist);
+		sublist = gh_cdr(sublist);
+		MenuButtonGfx.Width[i] = gh_scm2int(gh_car(sublist2));
+		sublist2 = gh_cdr(sublist2);
+		MenuButtonGfx.Height[i] = gh_scm2int(gh_car(sublist2));
 	    }
 	}
 	++i;
@@ -3061,180 +3079,180 @@ local SCM CclDefineButton(SCM list)
 
     DebugLevel3Fn("Define button\n");
 
-    memset(&ba,0,sizeof(ba));
+    memset(&ba, 0, sizeof(ba));
     //
     //	Parse the arguments, already the new tagged format.
     //
-    while( !gh_null_p(list) ) {
-	value=gh_car(list);
-	list=gh_cdr(list);
-	if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    ba.Pos=gh_scm2int(value);
-	} else if( gh_eq_p(value,gh_symbol2scm("level")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    ba.Level=gh_scm2int(value);
-	} else if( gh_eq_p(value,gh_symbol2scm("icon")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    ba.Icon.Name=gh_scm2newstr(value,NULL);
-	} else if( gh_eq_p(value,gh_symbol2scm("action")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    if( gh_eq_p(value,gh_symbol2scm("move")) ) {
-		ba.Action=ButtonMove;
-	    } else if( gh_eq_p(value,gh_symbol2scm("stop")) ) {
-		ba.Action=ButtonStop;
-	    } else if( gh_eq_p(value,gh_symbol2scm("attack")) ) {
-		ba.Action=ButtonAttack;
-	    } else if( gh_eq_p(value,gh_symbol2scm("repair")) ) {
-		ba.Action=ButtonRepair;
-	    } else if( gh_eq_p(value,gh_symbol2scm("harvest")) ) {
-		ba.Action=ButtonHarvest;
-	    } else if( gh_eq_p(value,gh_symbol2scm("button")) ) {
-		ba.Action=ButtonButton;
-	    } else if( gh_eq_p(value,gh_symbol2scm("build")) ) {
-		ba.Action=ButtonBuild;
-	    } else if( gh_eq_p(value,gh_symbol2scm("train-unit")) ) {
-		ba.Action=ButtonTrain;
-	    } else if( gh_eq_p(value,gh_symbol2scm("patrol")) ) {
-		ba.Action=ButtonPatrol;
-	    } else if( gh_eq_p(value,gh_symbol2scm("stand-ground")) ) {
-		ba.Action=ButtonStandGround;
-	    } else if( gh_eq_p(value,gh_symbol2scm("attack-ground")) ) {
-		ba.Action=ButtonAttackGround;
-	    } else if( gh_eq_p(value,gh_symbol2scm("return-goods")) ) {
-		ba.Action=ButtonReturn;
-	    } else if( gh_eq_p(value,gh_symbol2scm("demolish")) ) {
-		ba.Action=ButtonDemolish;
-	    } else if( gh_eq_p(value,gh_symbol2scm("cast-spell")) ) {
-		ba.Action=ButtonSpellCast;
-	    } else if( gh_eq_p(value,gh_symbol2scm("research")) ) {
-		ba.Action=ButtonResearch;
-	    } else if( gh_eq_p(value,gh_symbol2scm("upgrade-to")) ) {
-		ba.Action=ButtonUpgradeTo;
-	    } else if( gh_eq_p(value,gh_symbol2scm("unload")) ) {
-		ba.Action=ButtonUnload;
-	    } else if( gh_eq_p(value,gh_symbol2scm("cancel")) ) {
-		ba.Action=ButtonCancel;
-	    } else if( gh_eq_p(value,gh_symbol2scm("cancel-upgrade")) ) {
-		ba.Action=ButtonCancelUpgrade;
-	    } else if( gh_eq_p(value,gh_symbol2scm("cancel-train-unit")) ) {
-		ba.Action=ButtonCancelTrain;
-	    } else if( gh_eq_p(value,gh_symbol2scm("cancel-build")) ) {
-		ba.Action=ButtonCancelBuild;
+    while (!gh_null_p(list)) {
+	value = gh_car(list);
+	list = gh_cdr(list);
+	if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    ba.Pos = gh_scm2int(value);
+	} else if (gh_eq_p(value, gh_symbol2scm("level"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    ba.Level = gh_scm2int(value);
+	} else if (gh_eq_p(value, gh_symbol2scm("icon"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    ba.Icon.Name = gh_scm2newstr(value, NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("action"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    if (gh_eq_p(value, gh_symbol2scm("move"))) {
+		ba.Action = ButtonMove;
+	    } else if (gh_eq_p(value, gh_symbol2scm("stop"))) {
+		ba.Action = ButtonStop;
+	    } else if (gh_eq_p(value, gh_symbol2scm("attack"))) {
+		ba.Action = ButtonAttack;
+	    } else if (gh_eq_p(value, gh_symbol2scm("repair"))) {
+		ba.Action = ButtonRepair;
+	    } else if (gh_eq_p(value, gh_symbol2scm("harvest"))) {
+		ba.Action = ButtonHarvest;
+	    } else if (gh_eq_p(value, gh_symbol2scm("button"))) {
+		ba.Action = ButtonButton;
+	    } else if (gh_eq_p(value, gh_symbol2scm("build"))) {
+		ba.Action = ButtonBuild;
+	    } else if (gh_eq_p(value, gh_symbol2scm("train-unit"))) {
+		ba.Action = ButtonTrain;
+	    } else if (gh_eq_p(value, gh_symbol2scm("patrol"))) {
+		ba.Action = ButtonPatrol;
+	    } else if (gh_eq_p(value, gh_symbol2scm("stand-ground"))) {
+		ba.Action = ButtonStandGround;
+	    } else if (gh_eq_p(value, gh_symbol2scm("attack-ground"))) {
+		ba.Action = ButtonAttackGround;
+	    } else if (gh_eq_p(value, gh_symbol2scm("return-goods"))) {
+		ba.Action = ButtonReturn;
+	    } else if (gh_eq_p(value, gh_symbol2scm("demolish"))) {
+		ba.Action = ButtonDemolish;
+	    } else if (gh_eq_p(value, gh_symbol2scm("cast-spell"))) {
+		ba.Action = ButtonSpellCast;
+	    } else if (gh_eq_p(value, gh_symbol2scm("research"))) {
+		ba.Action = ButtonResearch;
+	    } else if (gh_eq_p(value, gh_symbol2scm("upgrade-to"))) {
+		ba.Action = ButtonUpgradeTo;
+	    } else if (gh_eq_p(value, gh_symbol2scm("unload"))) {
+		ba.Action = ButtonUnload;
+	    } else if (gh_eq_p(value, gh_symbol2scm("cancel"))) {
+		ba.Action = ButtonCancel;
+	    } else if (gh_eq_p(value, gh_symbol2scm("cancel-upgrade"))) {
+		ba.Action = ButtonCancelUpgrade;
+	    } else if (gh_eq_p(value, gh_symbol2scm("cancel-train-unit"))) {
+		ba.Action = ButtonCancelTrain;
+	    } else if (gh_eq_p(value, gh_symbol2scm("cancel-build"))) {
+		ba.Action = ButtonCancelBuild;
 	    } else {
-		s1=gh_scm2newstr(value,NULL);
-		fprintf(stderr,"Unsupported action %s\n",s1);
+		s1 = gh_scm2newstr(value, NULL);
+		fprintf(stderr, "Unsupported action %s\n",s1);
 		free(s1);
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("value")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    if( gh_exact_p(value) ) {
-		sprintf(buf,"%ld",gh_scm2long(value));
-		s1=strdup(buf);
+	} else if (gh_eq_p(value, gh_symbol2scm("value"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    if (gh_exact_p(value)) {
+		sprintf(buf, "%ld", gh_scm2long(value));
+		s1 = strdup(buf);
 	    } else {
-		s1=gh_scm2newstr(value,NULL);
+		s1 = gh_scm2newstr(value, NULL);
 	    }
-	    ba.ValueStr=s1;
-	} else if( gh_eq_p(value,gh_symbol2scm("allowed")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    if( gh_eq_p(value,gh_symbol2scm("check-true")) ) {
-		ba.Allowed=ButtonCheckTrue;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-false")) ) {
-		ba.Allowed=ButtonCheckFalse;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-upgrade")) ) {
-		ba.Allowed=ButtonCheckUpgrade;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-units-or")) ) {
-		ba.Allowed=ButtonCheckUnitsOr;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-units-and")) ) {
-		ba.Allowed=ButtonCheckUnitsAnd;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-network")) ) {
-		ba.Allowed=ButtonCheckNetwork;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-no-network")) ) {
-		ba.Allowed=ButtonCheckNoNetwork;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-no-work")) ) {
-		ba.Allowed=ButtonCheckNoWork;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-no-research")) ) {
-		ba.Allowed=ButtonCheckNoResearch;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-attack")) ) {
-		ba.Allowed=ButtonCheckAttack;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-upgrade-to")) ) {
-		ba.Allowed=ButtonCheckUpgradeTo;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-research")) ) {
-		ba.Allowed=ButtonCheckResearch;
-	    } else if( gh_eq_p(value,gh_symbol2scm("check-single-research")) ) {
-		ba.Allowed=ButtonCheckSingleResearch;
+	    ba.ValueStr = s1;
+	} else if (gh_eq_p(value, gh_symbol2scm("allowed"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    if (gh_eq_p(value, gh_symbol2scm("check-true"))) {
+		ba.Allowed = ButtonCheckTrue;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-false"))) {
+		ba.Allowed = ButtonCheckFalse;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-upgrade"))) {
+		ba.Allowed = ButtonCheckUpgrade;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-units-or"))) {
+		ba.Allowed = ButtonCheckUnitsOr;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-units-and"))) {
+		ba.Allowed = ButtonCheckUnitsAnd;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-network"))) {
+		ba.Allowed = ButtonCheckNetwork;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-no-network"))) {
+		ba.Allowed = ButtonCheckNoNetwork;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-no-work"))) {
+		ba.Allowed = ButtonCheckNoWork;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-no-research"))) {
+		ba.Allowed = ButtonCheckNoResearch;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-attack"))) {
+		ba.Allowed = ButtonCheckAttack;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-upgrade-to"))) {
+		ba.Allowed = ButtonCheckUpgradeTo;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-research"))) {
+		ba.Allowed = ButtonCheckResearch;
+	    } else if (gh_eq_p(value, gh_symbol2scm("check-single-research"))) {
+		ba.Allowed = ButtonCheckSingleResearch;
 	    } else {
-		s1=gh_scm2newstr(value,NULL);
-		fprintf(stderr,"Unsupported action %s\n",s1);
+		s1 = gh_scm2newstr(value, NULL);
+		fprintf(stderr, "Unsupported action %s\n", s1);
 		free(s1);
 	    }
-	} else if( gh_eq_p(value,gh_symbol2scm("allow-arg")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    s1=strdup("");
-	    while( !gh_null_p(value) ) {
-		s2=gh_scm2newstr(gh_car(value),NULL);
-		s1=realloc(s1,strlen(s1)+strlen(s2)+2);
-		strcat(s1,s2);
+	} else if (gh_eq_p(value, gh_symbol2scm("allow-arg"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    s1 = strdup("");
+	    while (!gh_null_p(value)) {
+		s2 = gh_scm2newstr(gh_car(value), NULL);
+		s1 = realloc(s1, strlen(s1) + strlen(s2) + 2);
+		strcat(s1, s2);
 		free(s2);
-		value=gh_cdr(value);
-		if( !gh_null_p(value) ) {
-		    strcat(s1,",");
+		value = gh_cdr(value);
+		if (!gh_null_p(value)) {
+		    strcat(s1, ",");
 		}
 	    }
-	    ba.AllowStr=s1;
-	} else if( gh_eq_p(value,gh_symbol2scm("key")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    s1=gh_scm2newstr(value,NULL);
-	    ba.Key=*s1;
+	    ba.AllowStr = s1;
+	} else if (gh_eq_p(value, gh_symbol2scm("key"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    s1 = gh_scm2newstr(value, NULL);
+	    ba.Key = *s1;
 	    free(s1);
-	} else if( gh_eq_p(value,gh_symbol2scm("hint")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    ba.Hint=gh_scm2newstr(value,NULL);
-	} else if( gh_eq_p(value,gh_symbol2scm("for-unit")) ) {
+	} else if (gh_eq_p(value, gh_symbol2scm("hint"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    ba.Hint = gh_scm2newstr(value, NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("for-unit"))) {
 	    // FIXME: ba.UnitMask shouldn't be a string
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    s1=strdup(",");
-	    while( !gh_null_p(value) ) {
-		s2=gh_scm2newstr(gh_car(value),NULL);
-		s1=realloc(s1,strlen(s1)+strlen(s2)+2);
-		strcat(s1,s2);
-		strcat(s1,",");
-		value=gh_cdr(value);
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    s1 = strdup(",");
+	    while (!gh_null_p(value)) {
+		s2 = gh_scm2newstr(gh_car(value), NULL);
+		s1 = realloc(s1, strlen(s1) + strlen(s2) + 2);
+		strcat(s1, s2);
+		strcat(s1, ",");
+		value = gh_cdr(value);
 		free(s2);
 	    }
-	    ba.UnitMask=s1;
-	    if( !strncmp(ba.UnitMask,",*,",3) ) {
+	    ba.UnitMask = s1;
+	    if (!strncmp(ba.UnitMask, ",*,", 3)) {
 		free(ba.UnitMask);
-		ba.UnitMask=strdup("*");
+		ba.UnitMask = strdup("*");
 	    }
 	} else {
-	    s1=gh_scm2newstr(value,NULL);
-	    fprintf(stderr,"Unsupported tag %s\n",s1);
+	    s1 = gh_scm2newstr(value, NULL);
+	    fprintf(stderr, "Unsupported tag %s\n", s1);
 	    free(s1);
 	}
     }
-    AddButton(ba.Pos,ba.Level,ba.Icon.Name,ba.Action,ba.ValueStr,
-	    ba.Allowed,ba.AllowStr,ba.Key,ba.Hint,ba.UnitMask);
-    if( ba.ValueStr ) {
+    AddButton(ba.Pos, ba.Level, ba.Icon.Name, ba.Action, ba.ValueStr,
+	ba.Allowed, ba.AllowStr, ba.Key, ba.Hint, ba.UnitMask);
+    if (ba.ValueStr) {
 	free(ba.ValueStr);
     }
-    if( ba.AllowStr ) {
+    if (ba.AllowStr) {
 	free(ba.AllowStr);
     }
-    if( ba.Hint ) {
+    if (ba.Hint) {
         free(ba.Hint);
     }
-    if( ba.UnitMask ) {
+    if (ba.UnitMask) {
         free(ba.UnitMask);
     }
 
@@ -3254,56 +3272,57 @@ local SCM CclAddButton(SCM list)
     char* s1;
     int pos;
     ButtonAction ba;
+ 
     pos = -1;
 
     //DebugLevel3Fn("Add button\n");
     DebugLevel0Fn("Add button\n");
 
-    memset(&ba,0,sizeof(ba));
+    memset(&ba, 0, sizeof(ba));
     //
     //	Parse the arguments, already the new tagged format.
     //
-    while( !gh_null_p(list) ) {
-	value=gh_car(list);
-	list=gh_cdr(list);
-	if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    pos=gh_scm2int(value);
-	} else if( gh_eq_p(value,gh_symbol2scm("icon")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    ba.Icon.Name=gh_scm2newstr(value,NULL);
-	} else if( gh_eq_p(value,gh_symbol2scm("action")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
+    while (!gh_null_p(list)) {
+	value = gh_car(list);
+	list = gh_cdr(list);
+	if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    pos = gh_scm2int(value);
+	} else if (gh_eq_p(value, gh_symbol2scm("icon"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    ba.Icon.Name = gh_scm2newstr(value, NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("action"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
 	    // Protect the action script against the garbage collector
 	    CclGcProtect(value);
-	    ba.Action=value;
-	} else if( gh_eq_p(value,gh_symbol2scm("key")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    s1=gh_scm2newstr(value,NULL);
-	    ba.Key=*s1;
+	    ba.Action = value;
+	} else if (gh_eq_p(value, gh_symbol2scm("key"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    s1 = gh_scm2newstr(value, NULL);
+	    ba.Key = *s1;
 	    free(s1);
-	} else if( gh_eq_p(value,gh_symbol2scm("highlight")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    ba.Highlight=gh_scm2bool(value);
-	} else if( gh_eq_p(value,gh_symbol2scm("hint")) ) {
-	    value=gh_car(list);
-	    list=gh_cdr(list);
-	    ba.Hint=gh_scm2newstr(value,NULL);
+	} else if (gh_eq_p(value, gh_symbol2scm("highlight"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    ba.Highlight = gh_scm2bool(value);
+	} else if (gh_eq_p(value, gh_symbol2scm("hint"))) {
+	    value = gh_car(list);
+	    list = gh_cdr(list);
+	    ba.Hint = gh_scm2newstr(value, NULL);
 	} else {
-	    s1=gh_scm2newstr(value,NULL);
-	    fprintf(stderr,"Unsupported tag %s\n",s1);
+	    s1 = gh_scm2newstr(value, NULL);
+	    fprintf(stderr, "Unsupported tag %s\n", s1);
 	    free(s1);
 	}
     }
 
 
     // maxy: allocated memory goes into currentButtons[], must not be freed
-    AddButton(pos,ba.Icon.Name,ba.Action,ba.Key,ba.Hint,ba.Highlight);
+    AddButton(pos, ba.Icon.Name, ba.Action, ba.Key, ba.Hint, ba.Highlight);
 
     return SCM_UNSPECIFIED;
 }
@@ -3335,7 +3354,7 @@ local SCM CclRemoveButton(SCM id)
 */
 local SCM CclSetChooseTargetBeginHook(SCM script)
 {
-    if( ChooseTargetBeginHook ) {
+    if (ChooseTargetBeginHook) {
 	CclGcUnprotect(ChooseTargetBeginHook);
     }
     CclGcProtect(script);
@@ -3350,7 +3369,7 @@ local SCM CclSetChooseTargetBeginHook(SCM script)
 */
 local SCM CclSetChooseTargetFinishHook(SCM script)
 {
-    if( ChooseTargetFinishHook ) {
+    if (ChooseTargetFinishHook) {
 	CclGcUnprotect(ChooseTargetFinishHook);
     }
     CclGcProtect(script);
@@ -3365,7 +3384,7 @@ local SCM CclSetChooseTargetFinishHook(SCM script)
 */
 local SCM CclSetSelectionChangedHook(SCM script)
 {
-    if( SelectionChangedHook ) {
+    if (SelectionChangedHook) {
 	CclGcUnprotect(SelectionChangedHook);
     }
     CclGcProtect(script);
@@ -3380,7 +3399,7 @@ local SCM CclSetSelectionChangedHook(SCM script)
 */
 local SCM CclSetSelectedUnitChangedHook(SCM script)
 {
-    if( SelectedUnitChangedHook ) {
+    if (SelectedUnitChangedHook) {
 	CclGcUnprotect(SelectedUnitChangedHook);
     }
     CclGcProtect(script);
@@ -3396,7 +3415,7 @@ global void SelectionChanged(void)
 {
 #ifndef NEW_UI
     UpdateButtonPanel();
-    MustRedraw|=RedrawInfoPanel;
+    MustRedraw |= RedrawInfoPanel;
 #else
     // could be in the middle of choosing a place to build when a
     // worker gets killed
@@ -3406,16 +3425,16 @@ global void SelectionChanged(void)
 	return;
     }
     DebugLevel0Fn("Calling the selection-changed-hook.\n");
-    if( !gh_null_p(SelectionChangedHook) ) {
-	//if( [ccl debugging] ) {               // display executed command
+    if (!gh_null_p(SelectionChangedHook)) {
+	//if ([ccl debugging]) {               // display executed command
 	gh_display(SelectionChangedHook);
 	gh_newline();
 	//}
-        gh_eval(SelectionChangedHook,NIL);
+        gh_eval(SelectionChangedHook, NIL);
     } else {
 	DebugLevel0Fn("Hook empty!\n");
     }
-    MustRedraw|=RedrawInfoPanel;
+    MustRedraw |= RedrawInfoPanel;
 #endif
 }
 
@@ -3431,13 +3450,13 @@ global void SelectedUnitChanged(void)
     if (!GameRunning) {
 	return;
     }
-    if( !gh_null_p(SelectionChangedHook) ) {
-	//if( [ccl debugging] ) {               // display executed command
+    if (!gh_null_p(SelectionChangedHook)) {
+	//if ([ccl debugging]) {               // display executed command
 	//gh_display(gh_car(SelectedUnitChangedHook));
 	//gh_display(SelectedUnitChangedHook);
 	//gh_newline();
 	//}
-        gh_eval(SelectedUnitChangedHook,NIL);
+        gh_eval(SelectedUnitChangedHook, NIL);
     } else {
 	DebugLevel0Fn("Hook empty!\n");
     }
@@ -3496,8 +3515,8 @@ local SCM CclSetDoubleClickDelay(SCM delay)
 {
     int i;
 
-    i=DoubleClickDelay;
-    DoubleClickDelay=gh_scm2int(delay);
+    i = DoubleClickDelay;
+    DoubleClickDelay = gh_scm2int(delay);
 
     return gh_int2scm(i);
 }
@@ -3512,8 +3531,8 @@ local SCM CclSetHoldClickDelay(SCM delay)
 {
     int i;
 
-    i=HoldClickDelay;
-    HoldClickDelay=gh_scm2int(delay);
+    i = HoldClickDelay;
+    HoldClickDelay = gh_scm2int(delay);
 
     return gh_int2scm(i);
 }
@@ -3528,24 +3547,24 @@ local SCM CclSetSelectionStyle(SCM style)
 {
     SCM old;
 
-    old=NIL;
+    old = NIL;
 
-    if( !gh_null_p(style) ) {
-	if( gh_eq_p(style,gh_symbol2scm("rectangle")) ) {
-	    DrawSelection=DrawSelectionRectangle;
-	} else if( gh_eq_p(style,gh_symbol2scm("alpha-rectangle")) ) {
-	    DrawSelection=DrawSelectionRectangleWithTrans;
-	} else if( gh_eq_p(style,gh_symbol2scm("circle")) ) {
-	    DrawSelection=DrawSelectionCircle;
-	} else if( gh_eq_p(style,gh_symbol2scm("alpha-circle")) ) {
-	    DrawSelection=DrawSelectionCircleWithTrans;
-	} else if( gh_eq_p(style,gh_symbol2scm("corners")) ) {
-	    DrawSelection=DrawSelectionCorners;
+    if (!gh_null_p(style)) {
+	if (gh_eq_p(style, gh_symbol2scm("rectangle"))) {
+	    DrawSelection = DrawSelectionRectangle;
+	} else if (gh_eq_p(style, gh_symbol2scm("alpha-rectangle"))) {
+	    DrawSelection = DrawSelectionRectangleWithTrans;
+	} else if (gh_eq_p(style, gh_symbol2scm("circle"))) {
+	    DrawSelection = DrawSelectionCircle;
+	} else if (gh_eq_p(style, gh_symbol2scm("alpha-circle"))) {
+	    DrawSelection = DrawSelectionCircleWithTrans;
+	} else if (gh_eq_p(style, gh_symbol2scm("corners"))) {
+	    DrawSelection = DrawSelectionCorners;
 	} else {
-	    errl("Unsupported selection style",style);
+	    errl("Unsupported selection style", style);
 	}
     } else {
-	DrawSelection=DrawSelectionNone;
+	DrawSelection = DrawSelectionNone;
     }
     return old;
 }
@@ -3561,17 +3580,17 @@ local SCM CclSetShowSightRange(SCM flag)
 {
     int old;
 
-    old=ShowSightRange;
-    if( !gh_null_p(flag) ) {
-	if( gh_eq_p(flag,gh_symbol2scm("rectangle")) ) {
-	    ShowSightRange=1;
-	} else if( gh_eq_p(flag,gh_symbol2scm("circle")) ) {
-	    ShowSightRange=2;
+    old = ShowSightRange;
+    if (!gh_null_p(flag)) {
+	if (gh_eq_p(flag, gh_symbol2scm("rectangle"))) {
+	    ShowSightRange = 1;
+	} else if (gh_eq_p(flag, gh_symbol2scm("circle"))) {
+	    ShowSightRange = 2;
 	} else {
-	    ShowSightRange=3;
+	    ShowSightRange = 3;
 	}
     } else {
-	ShowSightRange=0;
+	ShowSightRange = 0;
     }
 
     return gh_int2scm(old);
@@ -3588,17 +3607,17 @@ local SCM CclSetShowReactionRange(SCM flag)
 {
     int old;
 
-    old=ShowReactionRange;
-    if( !gh_null_p(flag) ) {
-	if( gh_eq_p(flag,gh_symbol2scm("rectangle")) ) {
-	    ShowReactionRange=1;
-	} else if( gh_eq_p(flag,gh_symbol2scm("circle")) ) {
-	    ShowReactionRange=2;
+    old = ShowReactionRange;
+    if (!gh_null_p(flag)) {
+	if (gh_eq_p(flag, gh_symbol2scm("rectangle"))) {
+	    ShowReactionRange = 1;
+	} else if (gh_eq_p(flag, gh_symbol2scm("circle"))) {
+	    ShowReactionRange = 2;
 	} else {
-	    ShowReactionRange=3;
+	    ShowReactionRange = 3;
 	}
     } else {
-	ShowReactionRange=0;
+	ShowReactionRange = 0;
     }
 
     return gh_int2scm(old);
@@ -3615,8 +3634,8 @@ local SCM CclSetShowAttackRange(SCM flag)
 {
     int old;
 
-    old=!ShowAttackRange;
-    ShowAttackRange=gh_scm2bool(flag);
+    old = !ShowAttackRange;
+    ShowAttackRange = gh_scm2bool(flag);
 
     return gh_bool2scm(old);
 }
@@ -3632,14 +3651,14 @@ local SCM CclSetShowOrders(SCM flag)
 {
     int old;
 
-    old=!ShowOrders;
-    if( gh_boolean_p(flag) ) {
-	ShowOrders=gh_scm2bool(flag);
-	if( ShowOrders ) {
-	    ShowOrders=SHOW_ORDERS_ALWAYS;
+    old = !ShowOrders;
+    if (gh_boolean_p(flag)) {
+	ShowOrders = gh_scm2bool(flag);
+	if (ShowOrders) {
+	    ShowOrders = SHOW_ORDERS_ALWAYS;
 	}
     } else {
-	ShowOrders=gh_scm2int(flag);
+	ShowOrders = gh_scm2int(flag);
     }
 
     return gh_bool2scm(old);
@@ -3652,7 +3671,7 @@ local SCM CclSetShowOrders(SCM flag)
 */
 local SCM CclAddMessage(SCM message)
 {
-    const char *str;
+    const char* str;
 
     str = get_c_string(message);
     SetMessage("%s", str);
@@ -3688,38 +3707,40 @@ local SCM CclResetKeystrokeHelp(void)
 local SCM CclAddKeystrokeHelp(SCM list)
 {
     SCM value;
-    char *s1 = 0;
-    char *s2 = 0;
+    char* s1;
+    char* s2;
     int n;
 
+    s1 = s2 = NULL;
+
     if (!gh_null_p(list)) {
-	value=gh_car(list);
-	list=gh_cdr(list);
-	s1=gh_scm2newstr(value,NULL);
+	value = gh_car(list);
+	list = gh_cdr(list);
+	s1 = gh_scm2newstr(value, NULL);
     }
     if (!gh_null_p(list)) {
-	value=gh_car(list);
-	list=gh_cdr(list);
-	s2=gh_scm2newstr(value,NULL);
+	value = gh_car(list);
+	list = gh_cdr(list);
+	s2 = gh_scm2newstr(value, NULL);
 
 	n = nKeyStrokeHelps;
 	if (!n) {
 	    n = 1;
 	    KeyStrokeHelps = malloc(2 * sizeof(char *));
 	} else {
-	    n++;
+	    ++n;
 	    KeyStrokeHelps = realloc(KeyStrokeHelps, n * 2 * sizeof(char *));
 	}
 	if (KeyStrokeHelps) {
 	    nKeyStrokeHelps = n;
-	    n--;
+	    --n;
 	    KeyStrokeHelps[n * 2] = s1;
 	    KeyStrokeHelps[n * 2 + 1] = s2;
 	}
     }
 
-    while( !gh_null_p(list) ) {
-	list=gh_cdr(list);
+    while (!gh_null_p(list)) {
+	list = gh_cdr(list);
     }
 
     return SCM_UNSPECIFIED;
@@ -3733,39 +3754,39 @@ global void UserInterfaceCclRegister(void)
 
     gh_new_procedure1_0("add-message", CclAddMessage);
 
-    gh_new_procedure1_0("set-color-cycle-all!",CclSetColorCycleAll);
-    gh_new_procedure1_0("set-mouse-scroll-speed-default!",CclSetMouseScrollSpeedDefault);
-    gh_new_procedure1_0("set-mouse-scroll-speed-control!",CclSetMouseScrollSpeedControl);
+    gh_new_procedure1_0("set-color-cycle-all!", CclSetColorCycleAll);
+    gh_new_procedure1_0("set-mouse-scroll-speed-default!", CclSetMouseScrollSpeedDefault);
+    gh_new_procedure1_0("set-mouse-scroll-speed-control!", CclSetMouseScrollSpeedControl);
 
-    gh_new_procedure1_0("set-mouse-adjust!",CclSetMouseAdjust);
-    gh_new_procedure1_0("set-mouse-scale!",CclSetMouseScale);
+    gh_new_procedure1_0("set-mouse-adjust!", CclSetMouseAdjust);
+    gh_new_procedure1_0("set-mouse-scale!", CclSetMouseScale);
 
-    gh_new_procedure1_0("set-click-missile!",CclSetClickMissile);
-    gh_new_procedure1_0("set-damage-missile!",CclSetDamageMissile);
+    gh_new_procedure1_0("set-click-missile!", CclSetClickMissile);
+    gh_new_procedure1_0("set-damage-missile!", CclSetDamageMissile);
 
-    gh_new_procedure1_0("set-contrast!",CclSetContrast);
-    gh_new_procedure1_0("set-brightness!",CclSetBrightness);
-    gh_new_procedure1_0("set-saturation!",CclSetSaturation);
+    gh_new_procedure1_0("set-contrast!", CclSetContrast);
+    gh_new_procedure1_0("set-brightness!", CclSetBrightness);
+    gh_new_procedure1_0("set-saturation!", CclSetSaturation);
 
-    gh_new_procedure2_0("set-video-resolution!",CclSetVideoResolution);
-    gh_new_procedure1_0("set-video-fullscreen!",CclSetVideoFullscreen);
+    gh_new_procedure2_0("set-video-resolution!", CclSetVideoResolution);
+    gh_new_procedure1_0("set-video-fullscreen!", CclSetVideoFullscreen);
 
-    gh_new_procedure1_0("set-title-screen!",CclSetTitleScreen);
-    gh_new_procedure1_0("set-menu-background!",CclSetMenuBackground);
+    gh_new_procedure1_0("set-title-screen!", CclSetTitleScreen);
+    gh_new_procedure1_0("set-menu-background!", CclSetMenuBackground);
     gh_new_procedure1_0("set-menu-background-with-title!",
-	    CclSetMenuBackgroundWithTitle);
-    gh_new_procedure1_0("set-title-music!",CclSetTitleMusic);
-    gh_new_procedure1_0("set-menu-music!",CclSetMenuMusic);
+	CclSetMenuBackgroundWithTitle);
+    gh_new_procedure1_0("set-title-music!", CclSetTitleMusic);
+    gh_new_procedure1_0("set-menu-music!", CclSetMenuMusic);
 
-    gh_new_procedure1_0("display-picture",CclDisplayPicture);
-    gh_new_procedure1_0("process-menu",CclProcessMenu);
+    gh_new_procedure1_0("display-picture", CclDisplayPicture);
+    gh_new_procedure1_0("process-menu", CclProcessMenu);
 
-    gh_new_procedure1_0("set-original-resources!",CclSetOriginalResources);
+    gh_new_procedure1_0("set-original-resources!", CclSetOriginalResources);
 
-    gh_new_procedureN("define-cursor",CclDefineCursor);
-    gh_new_procedure1_0("set-game-cursor!",CclSetGameCursor);
-    gh_new_procedureN("define-ui",CclDefineUI);
-    gh_new_procedureN("define-viewports",CclDefineViewports);
+    gh_new_procedureN("define-cursor", CclDefineCursor);
+    gh_new_procedure1_0("set-game-cursor!", CclSetGameCursor);
+    gh_new_procedureN("define-ui", CclDefineUI);
+    gh_new_procedureN("define-viewports", CclDefineViewports);
 
     gh_new_procedure1_0("set-grab-mouse!", CclSetGrabMouse);
     gh_new_procedure1_0("set-leave-stops!", CclSetLeaveStops);
@@ -3774,100 +3795,100 @@ global void UserInterfaceCclRegister(void)
     gh_new_procedure1_0("set-mouse-scroll!", CclSetMouseScroll);
     gh_new_procedure1_0("set-mouse-scroll-speed!", CclSetMouseScrollSpeed);
 
-    gh_new_procedure1_0("set-show-command-key!",CclSetShowCommandKey);
-    gh_new_procedure0_0("right-button-attacks",CclRightButtonAttacks);
-    gh_new_procedure0_0("right-button-moves",CclRightButtonMoves);
-    gh_new_procedure1_0("set-fancy-buildings!",CclSetFancyBuildings);
+    gh_new_procedure1_0("set-show-command-key!", CclSetShowCommandKey);
+    gh_new_procedure0_0("right-button-attacks", CclRightButtonAttacks);
+    gh_new_procedure0_0("right-button-moves", CclRightButtonMoves);
+    gh_new_procedure1_0("set-fancy-buildings!", CclSetFancyBuildings);
 
 #ifndef NEW_UI
-    gh_new_procedureN("define-button",CclDefineButton);
+    gh_new_procedureN("define-button", CclDefineButton);
 #else
-    gh_new_procedure1_0("set-selection-changed-hook",CclSetSelectionChangedHook);
-    gh_new_procedure1_0("set-selected-unit-changed-hook",CclSetSelectedUnitChangedHook);
-    gh_new_procedure1_0("set-choose-target-begin-hook",CclSetChooseTargetBeginHook);
-    gh_new_procedure1_0("set-choose-target-finish-hook",CclSetChooseTargetFinishHook);
-    gh_new_procedureN("add-button",CclAddButton);
-    gh_new_procedure1_0("remove-button",CclRemoveButton);
-    gh_new_procedure0_0("remove-all-buttons",CclRemoveAllButtons);
+    gh_new_procedure1_0("set-selection-changed-hook", CclSetSelectionChangedHook);
+    gh_new_procedure1_0("set-selected-unit-changed-hook", CclSetSelectedUnitChangedHook);
+    gh_new_procedure1_0("set-choose-target-begin-hook", CclSetChooseTargetBeginHook);
+    gh_new_procedure1_0("set-choose-target-finish-hook", CclSetChooseTargetFinishHook);
+    gh_new_procedureN("add-button", CclAddButton);
+    gh_new_procedure1_0("remove-button", CclRemoveButton);
+    gh_new_procedure0_0("remove-all-buttons", CclRemoveAllButtons);
 #endif
 
-    gh_new_procedureN("define-menu-item",CclDefineMenuItem);
-    gh_new_procedureN("define-menu",CclDefineMenu);
-    gh_new_procedureN("define-menu-graphics",CclDefineMenuGraphics);
+    gh_new_procedureN("define-menu-item", CclDefineMenuItem);
+    gh_new_procedureN("define-menu", CclDefineMenu);
+    gh_new_procedureN("define-menu-graphics", CclDefineMenuGraphics);
 
     //
     //	Color cycling
     //
-    gh_new_procedure1_0("set-color-water-cycle-start!",CclSetColorWaterCycleStart);
-    gh_new_procedure1_0("set-color-water-cycle-end!",CclSetColorWaterCycleEnd);
-    gh_new_procedure1_0("set-color-icon-cycle-start!",CclSetColorIconCycleStart);
-    gh_new_procedure1_0("set-color-icon-cycle-end!",CclSetColorIconCycleEnd);
-    gh_new_procedure1_0("set-color-building-cycle-start!",CclSetColorBuildingCycleStart);
-    gh_new_procedure1_0("set-color-building-cycle-end!",CclSetColorBuildingCycleEnd);
+    gh_new_procedure1_0("set-color-water-cycle-start!", CclSetColorWaterCycleStart);
+    gh_new_procedure1_0("set-color-water-cycle-end!", CclSetColorWaterCycleEnd);
+    gh_new_procedure1_0("set-color-icon-cycle-start!", CclSetColorIconCycleStart);
+    gh_new_procedure1_0("set-color-icon-cycle-end!", CclSetColorIconCycleEnd);
+    gh_new_procedure1_0("set-color-building-cycle-start!", CclSetColorBuildingCycleStart);
+    gh_new_procedure1_0("set-color-building-cycle-end!", CclSetColorBuildingCycleEnd);
 
     //
     //	Correct named functions
     //
-    gh_new_procedure1_0("set-double-click-delay!",CclSetDoubleClickDelay);
-    gh_new_procedure1_0("set-hold-click-delay!",CclSetHoldClickDelay);
+    gh_new_procedure1_0("set-double-click-delay!", CclSetDoubleClickDelay);
+    gh_new_procedure1_0("set-hold-click-delay!", CclSetHoldClickDelay);
 
     //
     //	Look and feel of units
     //
-    gh_new_procedure1_0("set-selection-style!",CclSetSelectionStyle);
-    gh_new_procedure1_0("set-show-sight-range!",CclSetShowSightRange);
-    gh_new_procedure1_0("set-show-reaction-range!",CclSetShowReactionRange);
-    gh_new_procedure1_0("set-show-attack-range!",CclSetShowAttackRange);
-    gh_new_procedure1_0("set-show-orders!",CclSetShowOrders);
+    gh_new_procedure1_0("set-selection-style!", CclSetSelectionStyle);
+    gh_new_procedure1_0("set-show-sight-range!", CclSetShowSightRange);
+    gh_new_procedure1_0("set-show-reaction-range!", CclSetShowReactionRange);
+    gh_new_procedure1_0("set-show-attack-range!", CclSetShowAttackRange);
+    gh_new_procedure1_0("set-show-orders!", CclSetShowOrders);
 
     //
     //	Keystroke helps
     //
-    gh_new_procedure0_0("reset-keystroke-help",CclResetKeystrokeHelp);
-    gh_new_procedureN("add-keystroke-help",CclAddKeystrokeHelp);
+    gh_new_procedure0_0("reset-keystroke-help", CclResetKeystrokeHelp);
+    gh_new_procedureN("add-keystroke-help", CclAddKeystrokeHelp);
 
 #ifdef NEW_UI
     //
     //  Commands for buttons
     //
-    gh_new_procedure0_0("command-patrol",CclCommandPatrol);
-    gh_new_procedure0_0("command-harvest",CclCommandHarvest);
-    gh_new_procedure0_0("command-attack",CclCommandAttack);
-    gh_new_procedure0_0("command-cancel-upgrade",CclCommandCancelUpgrade);
-    gh_new_procedure1_0("command-build",CclCommandBuild);
-    gh_new_procedure1_0("command-train-unit",CclCommandTrainUnit);
-    gh_new_procedure1_0("command-cast-spell",CclCommandCastSpell);
-    gh_new_procedure0_0("command-move",CclCommandMove);
-    gh_new_procedure0_0("command-stop",CclCommandStop);
-    gh_new_procedure1_0("command-research",CclCommandResearch);
-    gh_new_procedure0_0("command-unload",CclCommandUnload);
-    gh_new_procedure1_0("command-upgrade-to",CclCommandUpgradeTo);
-    gh_new_procedure0_0("command-attack-ground",CclCommandAttackGround);
-    gh_new_procedure0_0("command-return-goods",CclCommandReturnGoods);
-    gh_new_procedure0_0("command-cancel",CclCommandCancel);
-    gh_new_procedure0_0("command-cancel-building",CclCommandCancelBuilding);
-    gh_new_procedure0_0("command-cancel-train-unit",CclCommandCancelTrainUnit);
-    gh_new_procedure0_0("command-repair",CclCommandRepair);
-    gh_new_procedure0_0("command-stand-ground",CclCommandStandGround);
-    gh_new_procedure0_0("command-demolish",CclCommandDemolish);
+    gh_new_procedure0_0("command-patrol", CclCommandPatrol);
+    gh_new_procedure0_0("command-harvest", CclCommandHarvest);
+    gh_new_procedure0_0("command-attack", CclCommandAttack);
+    gh_new_procedure0_0("command-cancel-upgrade", CclCommandCancelUpgrade);
+    gh_new_procedure1_0("command-build", CclCommandBuild);
+    gh_new_procedure1_0("command-train-unit", CclCommandTrainUnit);
+    gh_new_procedure1_0("command-cast-spell", CclCommandCastSpell);
+    gh_new_procedure0_0("command-move", CclCommandMove);
+    gh_new_procedure0_0("command-stop", CclCommandStop);
+    gh_new_procedure1_0("command-research", CclCommandResearch);
+    gh_new_procedure0_0("command-unload", CclCommandUnload);
+    gh_new_procedure1_0("command-upgrade-to", CclCommandUpgradeTo);
+    gh_new_procedure0_0("command-attack-ground", CclCommandAttackGround);
+    gh_new_procedure0_0("command-return-goods", CclCommandReturnGoods);
+    gh_new_procedure0_0("command-cancel", CclCommandCancel);
+    gh_new_procedure0_0("command-cancel-building", CclCommandCancelBuilding);
+    gh_new_procedure0_0("command-cancel-train-unit", CclCommandCancelTrainUnit);
+    gh_new_procedure0_0("command-repair", CclCommandRepair);
+    gh_new_procedure0_0("command-stand-ground", CclCommandStandGround);
+    gh_new_procedure0_0("command-demolish", CclCommandDemolish);
 
-    gh_new_procedure1_0("check-allowed",CclCheckAllowed);
-    gh_new_procedure1_0("get-cost-string",CclGetCostString);
+    gh_new_procedure1_0("check-allowed", CclCheckAllowed);
+    gh_new_procedure1_0("get-cost-string", CclGetCostString);
 
     //
     //  FIXME: make those functions use an unit handle instead
     //  and add (get-selected-unit).
     //
-    gh_new_procedure0_0("selected-is-building",CclSelectedIsBuilding);
-    gh_new_procedure0_0("selected-is-training",CclSelectedIsTraining);
-    gh_new_procedure0_0("selected-is-upgrading",CclSelectedIsUpgrading);
-    gh_new_procedure0_0("selected-get-race",CclSelectedGetRace);
-    gh_new_procedure0_0("selected-get-speed",CclSelectedGetSpeed);
-    gh_new_procedure0_0("selected-owned-by-player",CclSelectedOwnedByPlayer);
-    gh_new_procedure0_0("selected-mixed-units",CclSelectedMixedUnits);
-    gh_new_procedure0_0("selected-get-action",CclSelectedGetAction);
-    gh_new_procedure0_0("selected-resource-loaded",CclSelectedResourceLoaded);
-    gh_new_procedure0_0("selected-draw-buttons",CclSelectedDrawButtons);
+    gh_new_procedure0_0("selected-is-building", CclSelectedIsBuilding);
+    gh_new_procedure0_0("selected-is-training", CclSelectedIsTraining);
+    gh_new_procedure0_0("selected-is-upgrading", CclSelectedIsUpgrading);
+    gh_new_procedure0_0("selected-get-race", CclSelectedGetRace);
+    gh_new_procedure0_0("selected-get-speed", CclSelectedGetSpeed);
+    gh_new_procedure0_0("selected-owned-by-player", CclSelectedOwnedByPlayer);
+    gh_new_procedure0_0("selected-mixed-units", CclSelectedMixedUnits);
+    gh_new_procedure0_0("selected-get-action", CclSelectedGetAction);
+    gh_new_procedure0_0("selected-resource-loaded", CclSelectedResourceLoaded);
+    gh_new_procedure0_0("selected-draw-buttons", CclSelectedDrawButtons);
 
 #endif
     InitMenuFuncHash();