Yet Another eXchange Tool  0.9.0
xt_request.c
Go to the documentation of this file.
1 
12 /*
13  * Keywords:
14  * Maintainer: Jörg Behrens <behrens@dkrz.de>
15  * Moritz Hanke <hanke@dkrz.de>
16  * Thomas Jahns <jahns@dkrz.de>
17  * URL: https://doc.redmine.dkrz.de/yaxt/html/
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions are
21  * met:
22  *
23  * Redistributions of source code must retain the above copyright notice,
24  * this list of conditions and the following disclaimer.
25  *
26  * Redistributions in binary form must reproduce the above copyright
27  * notice, this list of conditions and the following disclaimer in the
28  * documentation and/or other materials provided with the distribution.
29  *
30  * Neither the name of the DKRZ GmbH nor the names of its contributors
31  * may be used to endorse or promote products derived from this software
32  * without specific prior written permission.
33  *
34  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
35  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
36  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
37  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
38  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
39  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
40  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
41  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
42  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
43  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
44  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45  */
46 #ifdef HAVE_CONFIG_H
47 #include <config.h>
48 #endif
49 
50 #include <assert.h>
51 #include <stdlib.h>
52 #include <stdio.h>
53 
54 #include "xt/xt_request.h"
55 #include "xt_request_internal.h"
56 
57 void xt_request_wait(Xt_request *request) {
58  assert(request);
59  if (*request != XT_REQUEST_NULL) {
60  (*request)->vtable->wait(*request);
61  *request = XT_REQUEST_NULL;
62  }
63 }
64 
65 void xt_request_test(Xt_request *request, int *flag) {
66  assert(request);
67  int flag_ = 1;
68  Xt_request req = *request;
69  if (req != XT_REQUEST_NULL) {
70  flag_ = req->vtable->test(req);
71  if (flag_) *request = XT_REQUEST_NULL;
72  }
73  *flag = flag_;
74 }
75 
76 /*
77  * Local Variables:
78  * c-basic-offset: 2
79  * coding: utf-8
80  * indent-tabs-mode: nil
81  * show-trailing-whitespace: t
82  * require-trailing-newline: t
83  * End:
84  */
const struct Xt_request_vtable * vtable
int(* test)(Xt_request request)
void xt_request_wait(Xt_request *request)
Definition: xt_request.c:57
void xt_request_test(Xt_request *request, int *flag)
Definition: xt_request.c:65
#define XT_REQUEST_NULL
Definition: xt_request.h:53
Provide non-public declarations common to all requests.