Skip to content

Commit

Permalink
de-ugglify missing else if
Browse files Browse the repository at this point in the history
adding up to 7 GDB instructions per call to `color (for black; zero instructions for white)
  • Loading branch information
GitMensch committed Jul 26, 2024
1 parent 40c819b commit cd4f9e4
Showing 1 changed file with 32 additions and 39 deletions.
71 changes: 32 additions & 39 deletions gdbinit
Original file line number Diff line number Diff line change
Expand Up @@ -128,45 +128,38 @@ set $COLOR_CPUFLAGS = $RED
# this is ugly but there's no else if available :-(
define color
if $USECOLOR == 1
# BLACK
if $arg0 == 0
echo \033[30m
else
# RED
if $arg0 == 1
echo \033[31m
else
# GREEN
if $arg0 == 2
echo \033[32m
else
# YELLOW
if $arg0 == 3
echo \033[33m
else
# BLUE
if $arg0 == 4
echo \033[34m
else
# MAGENTA
if $arg0 == 5
echo \033[35m
else
# CYAN
if $arg0 == 6
echo \033[36m
else
# WHITE
if $arg0 == 7
echo \033[37m
end
end
end
end
end
end
end
end
# BLACK
if $arg0 == 0
echo \033[30m
end
# RED
if $arg0 == 1
echo \033[31m
end
# GREEN
if $arg0 == 2
echo \033[32m
end
# YELLOW
if $arg0 == 3
echo \033[33m
end
# BLUE
if $arg0 == 4
echo \033[34m
end
# MAGENTA
if $arg0 == 5
echo \033[35m
end
# CYAN
if $arg0 == 6
echo \033[36m
end
# WHITE
if $arg0 == 7
echo \033[37m
end
end
end

Expand Down

0 comments on commit cd4f9e4

Please sign in to comment.