type
stringclasses
5 values
content
stringlengths
9
163k
functions
void agent_cleanup() { int agentState = kAgentCleanup; rlBufferClear(&theBuffer); rlSendBufferData(rlGetAgentConnection(), &theBuffer, agentState); rlBufferClear(&theBuffer); rlRecvBufferData(rlGetAgentConnection(), &theBuffer, &agentState); assert(agentState == kAgentCleanup); rlBufferDestroy(&theBuff...
includes
#include <igraph.h>
includes
#include <stdio.h>
defines
#define apply(m,a,b) \
functions
void print_matrix(igraph_matrix_t *m) { long int i, j; for (i=0; i<igraph_matrix_nrow(m); i++) { for (j=0; j<igraph_matrix_ncol(m); j++) { printf(" %g", MATRIX(*m, i, j)); }
functions
void print_vector(igraph_vector_t *v) { long int i, n=igraph_vector_size(v); for (i=0; i<n; i++) { printf(" %g", VECTOR(*v)[i]); }
functions
void byrow(igraph_matrix_t *m) { long int r=igraph_matrix_nrow(m), c=igraph_matrix_ncol(m); long int n=0, i, j; for (i=0; i<r; i++) { for (j=0; j<c; j++) { MATRIX(*m, i, j) = n++; }
main
int main() { igraph_matrix_t m, m2; igraph_vector_t v; long int i, j, i2, j2; igraph_real_t r1, r2; igraph_matrix_init(&m, 4, 3); byrow(&m); /* igraph_matrix_e */ printf("igraph_matrix_e\n"); apply(m, printf("%i ", (int)igraph_matrix_e(&m, i, j)), printf("\n")); /* igraph_matrix_e_ptr */ prin...
includes
#include <stdio.h>
includes
#include <setjmp.h>
defines
#define TRUE 1
defines
#define FALSE 0
defines
#define EOS (char) 0
defines
#define EQL 0
defines
#define NEQ 1
defines
#define LSS 2
defines
#define LEQ 3
defines
#define GTR 4
defines
#define GEQ 5
defines
#define OCTAL 8
defines
#define DECIMAL 10
defines
#define ungetch() nxtch--
defines
#define getch() *nxtch++
functions
int query() { register int bool, true_val, false_val; bool = lor(); if (skipws() != '?') { ungetch(); return bool; }
functions
int lor() { register int c, vl, vr; vl = land(); while ((c = skipws()) == '|' && getch() == '|') { vr = land(); vl = vl || vr; }
functions
int land() { register int c, vl, vr; vl = bor(); while ((c = skipws()) == '&' && getch() == '&') { vr = bor(); vl = vl && vr; }
functions
int bor() { register int vl, vr, c; vl = bxor(); while ((c = skipws()) == '|' && getch() != '|') { ungetch(); vr = bxor(); vl |= vr; }
functions
int bxor() { register int vl, vr; vl = band(); while (skipws() == '^') { vr = band(); vl ^= vr; }
functions
int band() { register int vl, vr, c; vl = eql(); while ((c = skipws()) == '&' && getch() != '&') { ungetch(); vr = eql(); vl &= vr; }
functions
int eql() { register int vl, vr, rel; vl = relat(); while ((rel = geteql()) != -1) { vr = relat(); switch (rel) { case EQL: vl = (vl == vr); break; case NEQ: vl = (vl != vr); break; }
functions
int relat() { register int vl, vr, rel; vl = shift(); while ((rel = getrel()) != -1) { vr = shift(); switch (rel) { case LEQ: vl = (vl <= vr); break; case LSS: vl = (vl < vr); break; case GTR: vl = (vl > vr); break; case GEQ: vl = (vl >= vr); break; }
functions
int shift() { register int vl, vr, c; vl = primary(); while (((c = skipws()) == '<' || c == '>') && c == getch()) { vr = primary(); if (c == '<') vl <<= vr; else vl >>= vr; }
functions
int primary() { register int c, vl, vr; vl = term(); while ((c = skipws()) == '+' || c == '-') { vr = term(); if (c == '+') vl += vr; else vl -= vr; }
functions
int term() { register int c, vl, vr; vl = unary(); while ((c = skipws()) == '*' || c == '/' || c == '%') { vr = unary(); switch (c) { case '*': vl *= vr; break; case '/': vl /= vr; break; case '%': vl %= vr; break; }
functions
int unary() { register int val, c; if ((c = skipws()) == '!' || c == '~' || c == '-') { val = unary(); switch (c) { case '!': return !val; case '~': return ~val; case '-': return -val; }
functions
int factor() { register int val; if (skipws() == '(') { val = query(); if (skipws() != ')') experr("bad factor"); return val; }
functions
int constant() { register int i; register int value; register char c; int v[sizeof(int)]; if (skipws() != '\'') { ungetch(); return num(); }
functions
int num() { register int rval, c, base; int ndig; base = ((c = skipws()) == '0') ? OCTAL : DECIMAL; rval = 0; ndig = 0; while (c >= '0' && c <= (base == OCTAL ? '7' : '9')) { rval *= base; rval += (c - '0'); c = getch(); ndig++; }
functions
int geteql() { register int c1, c2; c1 = skipws(); c2 = getch(); switch (c1) { case '=': if (c2 != '=') ungetch(); return EQL; case '!': if (c2 == '=') return NEQ; ungetch(); ungetch(); return -1; default: ungetch(); ungetch(); return -1; }
functions
int getrel() { register int c1, c2; c1 = skipws(); c2 = getch(); switch (c1) { case '<': if (c2 == '=') return LEQ; ungetch(); return LSS; case '>': if (c2 == '=') return GEQ; ungetch(); return GTR; default: ungetch(); ungetch(); return -1; }
functions
int skipws() { register char c; while ((c = getch()) <= ' ' && c > EOS) ; return c; }
includes
#include <linux/init.h>
includes
#include <linux/errno.h>
includes
#include <linux/smp.h>
includes
#include <linux/io.h>
includes
#include <linux/of_address.h>
includes
#include <linux/vexpress.h>
includes
#include <asm/mcpm.h>
includes
#include <asm/smp_scu.h>
includes
#include <asm/mach/map.h>
includes
#include <plat/platsmp.h>
functions
__init vexpress_smp_init_ops(void) { #ifdef CONFIG_MCPM /* * The best way to detect a multi-cluster configuration at the moment * is to look for the presence of a CCI in the system. * Override the default vexpress_smp_ops if so. */ struct device_node *node; node = of_find_compatible_node(NULL, NULL, "arm,cci...
functions
__init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus) { struct device_node *scu = of_find_matching_node(NULL, vexpress_smp_dt_scu_match); if (scu) scu_enable(of_iomap(scu, 0)); /* * Write the address of secondary startup into the * system-wide flags register. The boot monitor waits * until it recei...
functions
double get_seconds() { struct timeval tp; gettimeofday(&tp, NULL); return (double) (tp.tv_sec + ((1e-6)*tp.tv_usec)); }
functions
void prefix_sums(LONG_T *input, LONG_T* result, LONG_T* p, LONG_T n) { LONG_T i; #ifdef _OPENMP LONG_T j, r, start, end, add_value; int tid, nthreads; tid = omp_get_thread_num(); nthreads = omp_get_num_threads(); r = n/nthreads; result[0] = 0; #pragma omp for for (i=1; i...
functions
barrier if (tid>0) { add_value=p[tid-1]; for (j=start-1; j<end; j++) result[j] += add_value; }
includes
#include <linux/sched.h>
includes
#include <asm/atomic.h>
includes
#include <asm/semaphore.h>
functions
int __sem_update_count(struct semaphore *sem, int incr) { int old_count, tmp; __asm__ __volatile__("\n" "1: lwarx %0,0,%3\n" " srawi %1,%0,31\n" " andc %1,%0,%1\n" " add %1,%1,%4\n" " stwcx. %1,0,%3\n" " bne 1b" : "=&r" (old_count), "=&r" (tmp), "=m" (sem->count) : "r" (&sem->count), "r" (incr), "m" (sem->count) ...
functions
void __up(struct semaphore *sem) { /* * Note that we incremented count in up() before we came here, * but that was ineffective since the result was <= 0, and * any negative value of count is equivalent to 0. * This ends up setting count to 1, unless count is now > 0 * (i.e. because some other cpu has called ...
functions
void __down(struct semaphore *sem) { struct task_struct *tsk = current; DECLARE_WAITQUEUE(wait, tsk); tsk->state = TASK_UNINTERRUPTIBLE; add_wait_queue_exclusive(&sem->wait, &wait); smp_wmb(); /* * Try to get the semaphore. If the count is > 0, then we've * got the semaphore; we decrement count and exit th...
functions
int __down_interruptible(struct semaphore * sem) { int retval = 0; struct task_struct *tsk = current; DECLARE_WAITQUEUE(wait, tsk); tsk->state = TASK_INTERRUPTIBLE; add_wait_queue_exclusive(&sem->wait, &wait); smp_wmb(); while (__sem_update_count(sem, -1) <= 0) { if (signal_pending(current)) { /* * A ...
includes
#include <string.h>
includes
#include <glib/gi18n-lib.h>
includes
#include <nm-setting-connection.h>
includes
#include <nm-setting-infiniband.h>
includes
#include <nm-utils.h>
defines
#define NM_DEVICE_INFINIBAND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandPrivate))
functions
gboolean nm_device_infiniband_get_carrier (NMDeviceInfiniband *device) { g_return_val_if_fail (NM_IS_DEVICE_INFINIBAND (device), FALSE); return NM_DEVICE_INFINIBAND_GET_PRIVATE (device)->carrier; }
functions
gboolean connection_compatible (NMDevice *device, NMConnection *connection, GError **error) { NMSettingInfiniband *s_infiniband; const char *hwaddr, *setting_hwaddr; if (!NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->connection_compatible (device, connection, error)) return FALSE; if (!nm_connection_is_t...
functions
GType get_setting_type (NMDevice *device) { return NM_TYPE_SETTING_INFINIBAND; }
functions
void nm_device_infiniband_init (NMDeviceInfiniband *device) { _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_INFINIBAND); }
functions
void init_dbus (NMObject *object) { NMDeviceInfinibandPrivate *priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (object); const NMPropertiesInfo property_info[] = { { NM_DEVICE_INFINIBAND_HW_ADDRESS, &priv->hw_address }
functions
void finalize (GObject *object) { NMDeviceInfinibandPrivate *priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (object); g_free (priv->hw_address); G_OBJECT_CLASS (nm_device_infiniband_parent_class)->finalize (object); }
functions
void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { NMDeviceInfiniband *device = NM_DEVICE_INFINIBAND (object); switch (prop_id) { case PROP_HW_ADDRESS: g_value_set_string (value, nm_device_infiniband_get_hw_address (device)); break; ...
functions
void nm_device_infiniband_class_init (NMDeviceInfinibandClass *ib_class) { GObjectClass *object_class = G_OBJECT_CLASS (ib_class); NMObjectClass *nm_object_class = NM_OBJECT_CLASS (ib_class); NMDeviceClass *device_class = NM_DEVICE_CLASS (ib_class); g_type_class_add_private (ib_class, sizeof (NMDeviceInfinibandPri...
includes
#include <config.h>
includes
#include <Defn.h>
includes
#include <Internal.h>
includes
#include <float.h>
includes
#include <Print.h>
includes
#include <Fileio.h>
includes
#include <trioremap.h>
defines
#define R_USE_SIGNALS 1
defines
#define BUFSIZE 512
defines
#define MIN_Cutoff 20
defines
#define DEFAULT_Cutoff 60
defines
#define MAX_Cutoff (BUFSIZE - 12)
defines
#define SIMPLE_OPTS (~QUOTEEXPRESSIONS & ~SHOWATTRIBUTES & ~DELAYPROMISES)
defines
#define NB 1000 /* Same as printutils.c */
functions
attribute_hidden do_deparse(SEXP call, SEXP op, SEXP args, SEXP rho) { SEXP ca1; int cut0, backtick, opts, nlines; checkArity(op, args); if(length(args) < 1) error(_("too few arguments")); ca1 = CAR(args); args = CDR(args); cut0 = DEFAULT_Cutoff; if(!isNull(CAR(args))) { cut0 = asIntege...
functions
SEXP deparse1(SEXP call, Rboolean abbrev, int opts) { Rboolean backtick = TRUE; return deparse1WithCutoff(call, abbrev, DEFAULT_Cutoff, backtick, opts, -1); }
functions
SEXP deparse1w(SEXP call, Rboolean abbrev, int opts) { Rboolean backtick = TRUE; return deparse1WithCutoff(call, abbrev, R_print.cutoff, backtick, opts, -1); }
functions
SEXP deparse1WithCutoff(SEXP call, Rboolean abbrev, int cutoff, Rboolean backtick, int opts, int nlines) { /* Arg. abbrev: If abbrev is TRUE, then the returned value is a STRSXP of length 1 with at most 13 characters. This is used for plot labelling etc. */ SEXP svec; int savedigits; Rboolean n...
functions
else if(need_ellipses) { SET_STRING_ELT(svec, R_BrowseLines, mkChar(" ...")); }
functions
SEXP deparse1line(SEXP call, Rboolean abbrev) { SEXP temp; Rboolean backtick=TRUE; int lines; PROTECT(temp = deparse1WithCutoff(call, abbrev, MAX_Cutoff, backtick, SIMPLEDEPARSE, -1)); if ((lines = length(temp)) > 1) { char *buf; int i; size_t len; const void *vmax; cetype_t enc = CE_N...
functions
attribute_hidden deparse1s(SEXP call) { SEXP temp; Rboolean backtick=TRUE; temp = deparse1WithCutoff(call, FALSE, DEFAULT_Cutoff, backtick, DEFAULTDEPARSE, 1); return(temp); }
functions
void con_cleanup(void *data) { Rconnection con = data; if(con->isopen) con->close(con); }
functions
attribute_hidden do_dput(SEXP call, SEXP op, SEXP args, SEXP rho) { SEXP saveenv, tval; int i, ifile, res; Rboolean wasopen, havewarned = FALSE, opts; Rconnection con = (Rconnection) 1; /* stdout */ RCNTXT cntxt; checkArity(op, args); tval = CAR(args); saveenv = R_NilValue; /* -Wall */...