/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* generate signal features
*/
#include <signal.h>
struct _m_
{
char* text;
char* name;
int value;
};
#define elementsof(x) (sizeof(x)/sizeof(x[0]))
{
#ifdef SIGABRT
#endif
#ifdef SIGAIO
#endif
#ifdef SIGALRM
#endif
#ifdef SIGAPOLLO
#endif
#ifdef SIGBUS
#endif
#ifdef SIGCHLD
#endif
#ifdef SIGCLD
#endif
#ifdef SIGCONT
#endif
#ifdef SIGDANGER
#endif
#ifdef SIGDEBUG
#endif
#ifdef SIGDIL
#endif
#ifdef SIGEMT
#endif
#ifdef SIGERR
#endif
#ifdef SIGEXIT
#endif
#ifdef SIGFPE
#endif
#ifdef SIGFREEZE
#endif
#ifdef SIGHUP
#endif
#ifdef SIGILL
#endif
#ifdef SIGINT
#endif
#ifdef SIGIO
#endif
#ifdef SIGIOT
#endif
#ifdef SIGKILL
#endif
#ifdef SIGLAB
#endif
#ifdef SIGLOST
#endif
#ifdef SIGLWP
#endif
#ifdef SIGMIGRATE
#endif
#ifdef SIGPHONE
#endif
#ifdef SIGPIPE
#endif
#ifdef SIGPOLL
#endif
#ifdef SIGPROF
#endif
#ifdef SIGPWR
#endif
#ifdef SIGQUIT
#endif
#ifdef SIGSEGV
#endif
#ifdef SIGSOUND
#endif
#ifdef SIGSSTOP
#endif
#ifdef SIGSTKFLT
#endif
#ifdef gould
"Stack overflow", "STKOV", 28,
#endif
#ifdef SIGSTOP
#endif
#ifdef SIGSYS
#endif
#ifdef SIGTERM
#endif
#ifdef SIGTHAW
#endif
#ifdef SIGTINT
#endif
#ifdef SIGTRAP
#endif
#ifdef SIGTSTP
#endif
#ifdef SIGTTIN
#endif
#ifdef SIGTTOU
#endif
#ifdef SIGURG
#endif
#ifdef SIGUSR1
#endif
#ifdef SIGUSR2
#endif
#ifdef SIGVTALRM
#endif
#ifdef SIGWAITING
#endif
#ifdef SIGWINCH
#endif
#ifdef SIGWIND
#endif
#ifdef SIGWINDOW
#endif
#ifdef SIGXCPU
#endif
#ifdef SIGXFSZ
#endif
0
};
#if _lib_strsignal
extern char* strsignal(int);
#endif
int
main()
{
register int i;
register int j;
register int k;
int m;
int n;
#if _lib_strsignal
char* s;
#endif
k = 0;
{
if (j > k)
k = j;
mapindex[j] = i;
}
#ifdef SIGRTMIN
i = SIGRTMIN;
#ifdef SIGRTMAX
j = SIGRTMAX;
#else
j = i;
#endif
if (j >= elementsof(mapindex))
{
if (j > k)
k = j;
n = 1;
while (++i < j)
}
#endif
printf("#pragma prototyped\n");
printf("#define SIG_MAX %d\n", k);
printf("\n");
printf("static const char* const sig_name[] =\n");
printf("{\n");
for (i = 0; i <= k; i++)
if (!(j = mapindex[i]))
printf(" \"%d\",\n", i);
else if (j & RANGE_RT)
{
if (j & RANGE_MIN)
printf(" \"RTMIN\",\n");
else if (j & RANGE_MAX)
printf(" \"RTMAX\",\n");
else
{
m = j & RANGE_SIG;
if (m > n / 2)
printf(" \"RTMAX-%d\",\n", n - m);
else
printf(" \"RTMIN+%d\",\n", m);
}
}
else
printf(" 0\n");
printf("};\n");
printf("\n");
printf("static const char* const sig_text[] =\n");
printf("{\n");
for (i = 0; i <= k; i++)
if (!(j = mapindex[i]))
printf(" \"Signal %d\",\n", i);
else if (j & RANGE_RT)
printf(" \"Realtime priority %d%s\",\n", j & RANGE_SIG, (j & RANGE_MIN) ? " (lo)" : (j & RANGE_MAX) ? " (hi)" : "");
#if _lib_strsignal
else if (s = strsignal(i))
printf(" \"%s\",\n", s);
#endif
else
printf(" \"Signal %d\",\n", i);
printf(" 0\n");
printf("};\n");
return 0;
}