OSDN Git Service

Warning fixes:
[pf3gnuchains/gcc-fork.git] / libchill / printevent.c
1 /* Implement tasking-related runtime actions for CHILL.
2    Copyright (C) 1992,1993 Free Software Foundation, Inc.
3    Author: Wilfried Moser
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
20
21 /* As a special exception, if you link this library with other files,
22    some of which are compiled with GCC, to produce an executable,
23    this library does not by itself cause the resulting executable
24    to be covered by the GNU General Public License.
25    This exception does not however invalidate any other reasons why
26    the executable file might be covered by the GNU General Public License.  */
27
28 #include <stdio.h>
29 #include "rtltypes.h"
30 #include "rts.h"
31
32 typedef char *(*fetch_names) (int number);
33 extern fetch_names      __RTS_FETCH_NAMES__;
34
35 /*
36  * function print_instance
37  *
38  */
39
40 static char *print_instance (ins)
41      INSTANCE ins;
42 {
43   static char  buf[256];
44   char *f;
45
46   if (!__RTS_FETCH_NAMES__)
47     f = 0;
48   else
49     f = (*__RTS_FETCH_NAMES__) (ins.ptype);
50   if (!f)
51     sprintf (buf, "[%u;%u]", ins.ptype, ins.pcopy);
52   else
53     sprintf (buf, "[%s;%u]", f, ins.pcopy);
54   return buf;
55 }
56
57 /*
58  * function __print_event
59  *
60  * parameters:
61  *     event      event location
62  *
63  * returns:
64  *     void
65  *
66  * exceptions:
67  *     none
68  *
69  * abstract:
70  *     Function is used for debugging purposes only to print an
71  *     event queue
72  */
73
74 void
75 __print_event (evaddr, name)
76      Event_Queue   **evaddr;
77      char           *name;
78 {
79   Event_Queue    *ev;
80   int            cnt = 0;
81
82   if (name)
83     printf ("Event %s:\n", name);
84   else
85     printf ("Event at address H'%X:\n", evaddr);
86
87   memcpy (&ev, evaddr, sizeof (Event_Queue *));
88   while (ev)
89     {
90       printf (" %3d: ", ++cnt);
91       printf ("Process %s, ", print_instance (ev->this));
92       printf ("Priority %d", ev->priority);
93       if (ev->is_continued)
94         printf (" ,Continued by %s", print_instance (ev->who_continued));
95       printf ("\n");
96       ev = ev->forward;
97     }
98   if (!cnt)
99     printf ("EMPTY\n");
100 }