The R Project SVN R

Rev

Rev 89695 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 89695 Rev 89696
Line -... Line 1...
-
 
1
/*
-
 
2
 *  R : A Computer Language for Statistical Data Analysis
-
 
3
 *  Copyright (C) 2001-2025 The R Core Team.
-
 
4
 *
-
 
5
 *  This header file is free software; you can redistribute it and/or modify
-
 
6
 *  it under the terms of the GNU Lesser General Public License as published by
-
 
7
 *  the Free Software Foundation; either version 2.1 of the License, or
-
 
8
 *  (at your option) any later version.
-
 
9
 *
-
 
10
 *  This file is part of R. R is distributed under the terms of the
-
 
11
 *  GNU General Public License, either Version 2, June 1991 or Version 3,
-
 
12
 *  June 2007. See doc/COPYRIGHTS for details of the copyright status of R.
-
 
13
 *
-
 
14
 *  This program is distributed in the hope that it will be useful,
-
 
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-
 
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-
 
17
 *  GNU Lesser General Public License for more details.
-
 
18
 *
-
 
19
 *  You should have received a copy of the GNU Lesser General Public License
-
 
20
 *  along with this program; if not, a copy is available at
-
 
21
 *  https://www.R-project.org/Licenses/
-
 
22
 */
-
 
23
 
-
 
24
/* 
-
 
25
   Not part of the API, subject to change at any time.
-
 
26
*/
-
 
27
 
-
 
28
#ifndef R_CALLBACKS_H
-
 
29
#define R_CALLBACKS_H
-
 
30
 
-
 
31
/**
-
 
32
  These structures are for C (and R function) top-level task handlers.
-
 
33
  Such routines are called at the end of every (successful) top-level task
-
 
34
  in the regular REPL. 
-
 
35
 */
-
 
36
 
-
 
37
#include <Rinternals.h>
-
 
38
/**
-
 
39
  The signature of the C routine that a callback must implement.
-
 
40
  expr - the expression for the top-level task that was evaluated.
-
 
41
  value - the result of the top-level task, i.e. evaluating expr.
-
 
42
  succeeded - a logical value indicating whether the task completed properly.
-
 
43
  visible - a logical value indicating whether the result was printed to the R ``console''/stdout.
-
 
44
  data - user-level data passed to the registration routine.
-
 
45
 */
-
 
46
typedef Rboolean (*R_ToplevelCallback)(SEXP expr, SEXP value, Rboolean succeeded, Rboolean visible, void *);
-
 
47
 
-
 
48
typedef struct _ToplevelCallback  R_ToplevelCallbackEl;
-
 
49
/** 
-
 
50
 Linked list element for storing the top-level task callbacks.
-
 
51
 */
-
 
52
struct _ToplevelCallback {
-
 
53
    R_ToplevelCallback cb; /* the C routine to call. */
-
 
54
    void *data;            /* the user-level data to pass to the call to cb() */
-
 
55
    void (*finalizer)(void *data); /* Called when the callback is removed. */
-
 
56
 
-
 
57
    char *name;  /* a name by which to identify this element. */ 
-
 
58
 
-
 
59
    R_ToplevelCallbackEl *next; /* the next element in the linked list. */
-
 
60
};
-
 
61
 
-
 
62
#ifdef __cplusplus
-
 
63
extern "C" {
-
 
64
#endif
-
 
65
 
-
 
66
Rboolean Rf_removeTaskCallbackByIndex(int id);
-
 
67
Rboolean Rf_removeTaskCallbackByName(const char *name);
-
 
68
R_ToplevelCallbackEl* Rf_addTaskCallback(R_ToplevelCallback cb, void *data, void (*finalizer)(void *), const char *name, int *pos);
-
 
69
 
-
 
70
#ifdef __cplusplus
-
 
71
}
-
 
72
#endif
-
 
73
 
-
 
74
#endif /* R_CALLBACKS_H */