The relevant syscall (giving the status of a terminated process) is waitpid(2). The 139 is for WIFSIGNALED and WTERMSIG etc... On Linux the actual bits are described in internal file /usr/include/bits/waitstatus.h which is included from <sys/wait.h> header
The wait, waitpid call is standard in POSIX and so are the macro names (like WTERMSIG etc...). The actual implementation of these macros, and the actual signal numbers, hence the code given by the shell, are implementation specific.
The signal(7) Linux man page gives the number of the signals.