OSDN Git Service

2005-03-29 Ed Falis <falis@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-tfsetr-vxworks.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS               --
4 --                                                                          --
5 --                     S Y S T E M . T R A C E S . S E N D                  --
6 --                                                                          --
7 --                                  B o d y                                 --
8 --                                                                          --
9 --             Copyright (C) 2001 Free Software Foundation, Inc.            --
10 --                                                                          --
11 -- GNARL is free software; you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNARL; see file COPYING.  If not, write --
19 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, USA.                                                      --
21 --                                                                          --
22 -- As a special exception,  if other files  instantiate  generics from this --
23 -- unit, or you link  this unit with other files  to produce an executable, --
24 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
25 -- covered  by the  GNU  General  Public  License.  This exception does not --
26 -- however invalidate  any other reasons why  the executable file  might be --
27 -- covered by the  GNU Public License.                                      --
28 --                                                                          --
29 -- GNAT was originally developed  by the GNAT team at  New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
34 --  This version is for VxWorks targets.
35
36 --  Trace information is sent to WindView using the wvEvent function.
37
38 --  Note that wvEvent is from the VxWorks API.
39
40 --  When adding a new event, just give an Id to then event, and then modify
41 --  the WindView events database.
42
43 --  Refer to WindView User's Guide for more details on how to add new events
44 --  to the events database.
45
46 ----------------
47 -- Send_Trace --
48 ----------------
49
50 --  This procedure formats the string, maps the event Id to an Id
51 --  recognized by WindView, and send the event using wvEvent
52
53 separate (System.Traces.Format)
54 procedure Send_Trace (Id : Trace_T; Info : String) is
55
56    procedure Wv_Event
57      (Id : Integer;
58       Buffer : System.Address;
59       Size : Integer);
60    pragma Import (C, Wv_Event, "wvEvent");
61
62    Info_Trace : String_Trace;
63    Id_Event   : Integer;
64
65 begin
66    Info_Trace := Format_Trace (Info);
67
68    case Id is
69       when M_Accept_Complete => Id_Event := 30000;
70       when M_Select_Else     => Id_Event := 30001;
71       when M_RDV_Complete    => Id_Event := 30002;
72       when M_Call_Complete   => Id_Event := 30003;
73       when M_Delay           => Id_Event := 30004;
74       when E_Kill            => Id_Event := 30005;
75       when E_Missed          => Id_Event := 30006;
76       when E_Timeout         => Id_Event := 30007;
77
78       when W_Call            => Id_Event := 30010;
79       when W_Accept          => Id_Event := 30011;
80       when W_Select          => Id_Event := 30012;
81       when W_Completion      => Id_Event := 30013;
82       when W_Delay           => Id_Event := 30014;
83       when WT_Select         => Id_Event := 30015;
84       when WT_Call           => Id_Event := 30016;
85       when WT_Completion     => Id_Event := 30017;
86       when WU_Delay          => Id_Event := 30018;
87
88       when PO_Call           => Id_Event := 30020;
89       when POT_Call          => Id_Event := 30021;
90       when PO_Run            => Id_Event := 30022;
91       when PO_Lock           => Id_Event := 30023;
92       when PO_Unlock         => Id_Event := 30024;
93       when PO_Done           => Id_Event := 30025;
94
95       when T_Create          => Id_Event := 30030;
96       when T_Activate        => Id_Event := 30031;
97       when T_Abort           => Id_Event := 30032;
98       when T_Terminate       => Id_Event := 30033;
99
100       --  Unrecognized events are given the special Id_Event value 29999
101
102       when others            => Id_Event := 29999;
103
104    end case;
105
106    Wv_Event (Id_Event, Info_Trace'Address, Max_Size);
107 end Send_Trace;