* gjavah.c (main): Handle --output-class-directory argument.
[official-gcc.git] / libchill / printbuffer.c
blob883f15d58337937bde5a4d320a337229ebb32594
1 /* Implement tasking-related runtime actions for CHILL.
2 Copyright (C) 1992,1993 Free Software Foundation, Inc.
3 Author: Wilfried Moser
5 This file is part of GNU CC.
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.
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.
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. */
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. */
28 #include <stdio.h>
29 #include "rtltypes.h"
30 #include "rts.h"
32 typedef char *(*fetch_names) (int number);
33 extern fetch_names __RTS_FETCH_NAMES__;
36 * function print_instance
40 static char *print_instance (ins)
41 INSTANCE ins;
43 static char buf[256];
44 char *f;
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;
58 * function __print_buffer
60 * parameters:
61 * buffer buffer location
63 * returns:
64 * void
66 * exceptions:
67 * none
69 * abstract:
70 * Function is used for debugging purposes only to print a
71 * buffer queue
74 void
75 __print_buffer (buffer, name)
76 Buffer_Queue **buffer;
77 char *name;
79 Buffer_Queue *bq;
80 int bsqcnt = 0, bwqcnt = 0;
81 Buffer_Send_Queue *bsq;
82 Buffer_Wait_Queue *bwq;
84 if (name)
85 printf ("Buffer %s:\n", name);
86 else
87 printf ("Buffer at address H'%X:\n", buffer);
89 memcpy (&bq, buffer, sizeof (Buffer_Queue *));
90 if (bq == 0)
92 printf ("EMPTY\n");
93 return;
96 bsq = bq->sendqueue;
97 if (bsq != 0)
98 printf ("Send Queue:\n");
99 while (bsq)
101 printf (" %3d: ", ++bsqcnt);
102 printf ("Process %s, ", print_instance (bsq->this));
103 printf ("Priority %d", bsq->priority);
104 if (bsq->is_delayed)
105 printf (", Delayed");
106 printf ("\n");
107 bsq = bsq->forward;
109 bwq = bq->waitqueue;
110 if (bwq != 0)
111 printf ("Wait Queue:\n");
112 while (bwq)
114 printf (" %3d: ", ++bwqcnt);
115 printf ("Process %s, ", print_instance (bwq->this));
116 if (bwq->is_sent)
117 printf (", Send by %s", print_instance (bwq->who_sent));
118 printf ("\n");
119 bwq = bwq->forward;
121 if (bsqcnt == 0 && bwqcnt == 0)
122 printf ("EMPTY\n");