annotate liboffloadmic/runtime/liboffload_msg.c @ 136:4627f235cf2a

fix c-next example
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 08 Nov 2018 14:11:56 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /*
kono
parents:
diff changeset
2 Copyright (c) 2014-2016 Intel Corporation. All Rights Reserved.
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 Redistribution and use in source and binary forms, with or without
kono
parents:
diff changeset
5 modification, are permitted provided that the following conditions
kono
parents:
diff changeset
6 are met:
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 * Redistributions of source code must retain the above copyright
kono
parents:
diff changeset
9 notice, this list of conditions and the following disclaimer.
kono
parents:
diff changeset
10 * Redistributions in binary form must reproduce the above copyright
kono
parents:
diff changeset
11 notice, this list of conditions and the following disclaimer in the
kono
parents:
diff changeset
12 documentation and/or other materials provided with the distribution.
kono
parents:
diff changeset
13 * Neither the name of Intel Corporation nor the names of its
kono
parents:
diff changeset
14 contributors may be used to endorse or promote products derived
kono
parents:
diff changeset
15 from this software without specific prior written permission.
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
kono
parents:
diff changeset
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
kono
parents:
diff changeset
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
kono
parents:
diff changeset
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
kono
parents:
diff changeset
21 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
kono
parents:
diff changeset
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
kono
parents:
diff changeset
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
kono
parents:
diff changeset
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
kono
parents:
diff changeset
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
kono
parents:
diff changeset
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
kono
parents:
diff changeset
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
kono
parents:
diff changeset
28 */
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 #include <stdarg.h>
kono
parents:
diff changeset
32 #include <stdio.h>
kono
parents:
diff changeset
33 #include <stdlib.h>
kono
parents:
diff changeset
34 #include <string.h>
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 // ===========================================================================
kono
parents:
diff changeset
37 // Bring in the static string table and the enumerations for indexing into
kono
parents:
diff changeset
38 // it.
kono
parents:
diff changeset
39 // ===========================================================================
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 #include "liboffload_msg.h"
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 # define DYNART_STDERR_PUTS(__message_text__) fputs((__message_text__),stderr)
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 // ===========================================================================
kono
parents:
diff changeset
46 // Now the code for accessing the message catalogs
kono
parents:
diff changeset
47 // ===========================================================================
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 void write_message(FILE * file, int msgCode, va_list args_p) {
kono
parents:
diff changeset
51 va_list args;
kono
parents:
diff changeset
52 char buf[1024];
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 va_copy(args, args_p);
kono
parents:
diff changeset
55 buf[0] = '\n';
kono
parents:
diff changeset
56 vsnprintf(buf + 1, sizeof(buf) - 2,
kono
parents:
diff changeset
57 MESSAGE_TABLE_NAME[ msgCode ], args);
kono
parents:
diff changeset
58 strcat(buf, "\n");
kono
parents:
diff changeset
59 va_end(args);
kono
parents:
diff changeset
60 fputs(buf, file);
kono
parents:
diff changeset
61 fflush(file);
kono
parents:
diff changeset
62 }
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 char const *offload_get_message_str(int msgCode) {
kono
parents:
diff changeset
65 return MESSAGE_TABLE_NAME[ msgCode ];
kono
parents:
diff changeset
66 }