source: CIVL/text/include/civlc.h@ 517b138

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 517b138 was 517b138, checked in by Stephen Siegel <siegel@…>, 12 years ago

Commented out types/functions related to ranges in civlc.h since these are now part of the grammar.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@1158 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/* This header file defines standard types and provides
2 * function prototypes used in the CIVL-C language.
3 */
4
5#ifdef __CIVLC__
6#else
7#include<civlc-common.h>
8#define __CIVLC__
9
10/* A message formed by $message_pack
11struct __message__ {
12 int source;
13 int dest;
14 int tag;
15 $bundle data;
16 int size;
17};
18*/
19
20
21
22/* creates a new message, copying data from the specified buffer */
23$message $message_pack(int source, int dest, int tag,
24 void *data, int size) {
25 $message result;
26
27 result.source = source;
28 result.dest = dest;
29 result.tag = tag;
30 result.data = $bundle_pack(data, size);
31 result.size = size;
32 return result;
33}
34
35/* returns the message source */
36int $message_source($message message) {
37 return message.source;
38}
39
40/* returns the message tag */
41int $message_tag($message message) {
42 return message.tag;
43}
44
45/* returns the message destination */
46int $message_dest($message message) {
47 return message.dest;
48}
49
50/* returns the message size */
51int $message_size($message message) {
52 return message.size;
53}
54
55/* transfers message data to buf, throwing exception if message
56 * size exceeds specified size */
57void $message_unpack($message message, void *buf, int size) {
58 $bundle_unpack(message.data, buf);
59 $assert(message.size <= size,
60 "Message of size %d exceeds the specified size %d.", message.size, size);
61}
62
63/* Returns the place of the local communicator. This is the same as the
64 * place argument used to create the local communicator. */
65int $comm_place($comm comm){
66 return comm->place;
67}
68
69void $barrier_call($barrier barrier) {
70 $barrier_enter(barrier);
71 $barrier_exit(barrier);
72}
73
74// range consisting of lo, lo+step, lo+2*step, ...
75// the sequence stops just before the first number
76// greater than hi.
77// $range $range_regular(int lo, int hi, int step){
78// $range range = {.lo = lo, .hi = hi, .step = step};
79//
80// return range;
81// }
82#endif
Note: See TracBrowser for help on using the repository browser.