Beispiel #1
0
int icalbdbset_has_uid(icalset *store, const char *uid)
{
    _unused(store);
    _unused(uid);
    assert(0);  /* HACK, not implemented */
    return 0;
}
Beispiel #2
0
icalerrorenum icalbdbset_modify(icalset *set, icalcomponent *old, icalcomponent *newc)
{
    _unused(set);
    _unused(old);
    _unused(newc);
    assert(0);  /* HACK, not implemented */
    return ICAL_NO_ERROR;
}
Beispiel #3
0
icalcomponent *icaldirset_fetch_match(icalset *set, icalcomponent *c)
{
    _unused(set);
    _unused(c);

    fprintf(stderr, " icaldirset_fetch_match is not implemented\n");
    assert(0);
    return 0;
}
Beispiel #4
0
int icaldirset_count_components(icalset *store, icalcomponent_kind kind)
{
    _unused(store);
    _unused(kind);

    /* NOT IMPLEMENTED */
    assert(0);

    return 0;
}
	void observer_generic(const state_type &x, const double &t,const double &dummy_next_dt)
	{
		_unused(dummy_next_dt);
		observer_type ymat;
		ymat=x;
		results_push(t,0,ymat);
	}
Beispiel #6
0
bool
addVariable(Unit *unit,
            const char *name,
            Type *type,
            llvm::Constant *init)
{
    Context *ctx = unit->ctx;
    llvm::Module *mod = unit->module;

    Variable *var = new Variable();
    var->name.append(name);
    var->type = type;
    var->internal_name.append(name);
    var->linkage = Linkage::Extern;
    bool res = ctx->ns()->addVariable(name, var);
    assert(res); _unused(res);

    llvm::Type *var_type =
        ctx->toLLVMType(type, NULL, false, false);
    if (!var_type) {
        return false;
    }

    llvm::GlobalVariable *llvm_var =
        llvm::cast<llvm::GlobalVariable>(
            mod->getOrInsertGlobal(name, var_type)
        );

    llvm_var->setLinkage(ctx->toLLVMLinkage(Linkage::Extern_Weak));
    llvm_var->setInitializer(init);
    var->value = llvm_var;

    return true;
}
Beispiel #7
0
static DNode *
callmacro(int arg_count, void *units, void *mac, DNode **dnodes, MContext *mc)
{
    ffi_type *args[arg_count];
    void *vals[arg_count];

    args[0] = &ffi_type_pointer;
    vals[0] = (void*) &mc;

    for (int i = 1; i < arg_count; i++) {
        args[i] = &ffi_type_pointer;
        vals[i] = (void *) &(dnodes[i - 1]);
    }

    ffi_cif cif;
    ffi_status res = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, arg_count,
                                  &ffi_type_pointer, args);
    _unused(res);
    assert((res == FFI_OK) && "prep_cif failed, cannot run macro");

    DNode *ret_node = NULL;
    ffi_call(&cif, (void (*)()) mac, (void *) &ret_node, vals);

    return ret_node;
}
Beispiel #8
0
icalcomponent *icaldirset_fetch(icalset *set, icalcomponent_kind kind, const char *uid)
{
    icaldirset *dset;
    icalgauge *gauge;
    icalgauge *old_gauge;
    icalcomponent *c;
    char sql[256];

    _unused(kind);

    icalerror_check_arg_rz((set != 0), "set");
    icalerror_check_arg_rz((uid != 0), "uid");

    snprintf(sql, 256, "SELECT * FROM VEVENT WHERE UID = \"%s\"", uid);

    gauge = icalgauge_new_from_sql(sql, 0);
    dset = (icaldirset *) set;
    old_gauge = dset->gauge;
    dset->gauge = gauge;

    c = icaldirset_get_first_component(set);

    dset->gauge = old_gauge;

    if (gauge) {
        icalgauge_free(gauge);
    }

    return c;
}
Beispiel #9
0
void
Units::pop()
{
    Unit *popped = units.top();
    units.pop();

    if (empty()) {
        return;
    }

    Unit *current = units.top();

    std::string link_error;

#if D_LLVM_VERSION_MINOR <= 2
    bool res = current->linker->LinkInModule(popped->module, &link_error);
#else
    bool res = current->linker->linkInModule(popped->module, &link_error);
#endif
    assert(!res && "unable to link modules");
    _unused(res);

    current->ctx->merge(popped->ctx);
    current->ctx->regetPointers(current->module);

    return;
}
Beispiel #10
0
static a_tab_field *help_next_field( a_field *fld, a_field *table )
{
    _unused( table );
    if( fld != NULL ) {
        fld = fld->next;
    }
    return( fld );
}
	void rhs_generic(const state_type &x, state_type &x_dot, const double t)
	{
		_unused(t);
		const double sigma = 10.0;
		const double R = 28.0;
		const double b = 8.0 / 3.0;
		x_dot(0) = sigma * ( x(1) - x(0) );
		x_dot(1) = R * x(0) - x(1) - x(0) * x(2);
		x_dot(2) = -b * x(2) + x(0) * x(1);
	}
Beispiel #12
0
void
linkModule(llvm::Linker *linker, llvm::Module *mod)
{
    std::string error;
    bool result;
#if D_LLVM_VERSION_MINOR <= 2
    result = linker->LinkInModule(mod, &error);
#else
    result = linker->linkInModule(mod, &error);
#endif
    assert(!result && "unable to link module");
    _unused(result);
}
Beispiel #13
0
static int _compare_keys(DB *dbp, const DBT *a, const DBT *b)
{
    /*
     * Returns:
     * < 0 if a < b
     * = 0 if a = b
     * > 0 if a > b
     */

    char *ac = (char *)a->data;
    char *bc = (char *)b->data;

    _unused(dbp);
    return strncmp(ac, bc, a->size);
}
Beispiel #14
0
static char *icalparser_get_value(char *line, char **end, icalvalue_kind kind)
{
    char *str;
    size_t length = strlen(line);

    _unused(kind);

    if (length == 0) {
        return 0;
    }

    *end = line + length;
    str = make_segment(line, *end);

    return str;
}
Beispiel #15
0
icalset *icalbdbset_init(icalset *set, const char *dsn, void *options_in)
{
    icalbdbset *bset = (icalbdbset *) set;
    icalbdbset_options *options = (icalbdbset_options *) options_in;
    int ret;
    DB *cal_db;
    char *subdb_name = NULL;

    _unused(dsn);

    if (options == (icalbdbset_options *) NULL) {
        options = &icalbdbset_options_default;
    }

    switch (options->subdb) {
    case ICALBDB_CALENDARS:
        subdb_name = "calendars";
        break;
    case ICALBDB_EVENTS:
        subdb_name = "events";
        break;
    case ICALBDB_TODOS:
        subdb_name = "todos";
        break;
    case ICALBDB_REMINDERS:
        subdb_name = "reminders";
        break;
    }

    cal_db = icalbdbset_bdb_open(set->dsn,
                                 subdb_name, options->dbtype, options->mode, options->flag);
    if (cal_db == NULL) {
        return NULL;
    }

    bset->dbp = cal_db;
    bset->sdbp = NULL;
    bset->gauge = 0;
    bset->cluster = 0;

    if ((ret = icalbdbset_read_database(bset, options->pfunc)) != ICAL_NO_ERROR) {
        return NULL;
    }

    return (icalset *) bset;
}
Beispiel #16
0
void Model::observer(
	const state_type 			&x ,
	const double 				&t,
	observer_type 				&ymat,
	const intermediate_type 	&last_observed_mids,
	const time_type 			&last_observed_t,
	input_type					&u
	)
{
	intermediate_type mid;
	intermediates(u,x,mid,t,last_observed_mids,last_observed_t);

	

	_unused(ymat);

}
Beispiel #17
0
void
linkFile(llvm::Linker *linker, const char *path)
{
#if D_LLVM_VERSION_MINOR <= 2
    const llvm::sys::Path bb(path);
    bool is_native = false;
    bool res = linker->LinkInFile(bb, is_native);
    assert(!res && "unable to link bitcode file");
#else
    llvm::SMDiagnostic sm_error;
    llvm::Module *path_mod = llvm::ParseIRFile(path, sm_error,
                                               llvm::getGlobalContext());
    std::string error;
    bool res = linker->linkInModule(path_mod, &error);
    assert(!res && "unable to link bitcode file module");
#endif
    _unused(res);
}
Beispiel #18
0
Type *
parseTypeToken(Units *units, Node *node)
{
    Context *ctx = units->top()->ctx;

    Token *token = node->token;
    if (token->type != TokenType::String) {
        Error *e = new Error(IncorrectSingleParameterType, node,
                             "symbol", token->tokenType());
        ctx->er->addError(e);
        return NULL;
    }

    const char *type_str = token->str_value.c_str();

    int base_type = stringToBaseType(type_str);
    if (base_type != -1) {
        Type *type = ctx->tr->getBasicType(base_type);
        if (type) {
            if (!units->top()->is_x86_64
                    && (type->base_type == BaseType::Int128
                     || type->base_type == BaseType::UInt128)) {
                Error *e = new Error(TypeNotSupported, node, type_str);
                ctx->er->addError(e);
                return NULL;
            }
            return type;
        }
    }

    Struct *st = NULL;
    if ((st = ctx->getStruct(type_str))) {
        std::string st_name;
        bool res = ctx->setFullyQualifiedStructName(type_str, &st_name);
        assert(res && "unable to set struct name");
        _unused(res);
        return ctx->tr->getStructType(st_name.c_str());
    }

    Error *err = new Error(TypeNotInScope, node, type_str);
    ctx->er->addError(err);
    return NULL;
}
			static bool invoke_defer(lua_State* L, function_object_impl* impl, invoke_context& ctx, F& f, int& results)
			{
                _unused(f);
				bool exception_caught = false;

				try {
#ifndef LUABIND_NO_INTERNAL_TAG_ARGUMENTS
					results = invoke(L, *impl, ctx, impl->f, Signature(), InjectorList());
#else
					results = invoke<InjectorList, Signature>(L, *impl, ctx, impl->f);
#endif
				}
				catch(...) {
					exception_caught = true;
					handle_exception_aux(L);
				}

				return exception_caught;
			}
Beispiel #20
0
int icalbdbset_cput(DBC *dbcp, DBT *key, DBT *data, u_int32_t access_method)
{
    int ret = 0;

    _unused(access_method);

    key->flags |= DB_DBT_MALLOC;        /* change these to DB_DBT_USERMEM */
    data->flags |= DB_DBT_MALLOC;

    /* fetch the key/data pair */
    if ((ret = dbcp->c_put(dbcp, key, data, 0)) != 0) {
        goto err1;
    }

    return ICAL_NO_ERROR;

  err1:
    return ICAL_FILE_ERROR;
}
Beispiel #21
0
static void icalspanlist_new_callback(icalcomponent *comp, struct icaltime_span *span, void *data)
{
    icaltime_span *s;
    icalspanlist *sl = (icalspanlist *) data;

    _unused(comp);

    if (span->is_busy == 0)
        return;

    if ((s = (icaltime_span *) malloc(sizeof(icaltime_span))) == 0) {
        icalerror_set_errno(ICAL_NEWFAILED_ERROR);
        return;
    }

  /** copy span data into allocated memory.. **/
    *s = *span;
    pvl_insert_ordered(sl->spans, compare_span, (void *)s);
}
double EvtdFunctionSingle::d(int j,int m1,int m2, double theta) {

    assert(j==_j);
    _unused( j );
    assert(m1==_m1);
    assert(m2==_m2);

    double c2=cos(0.5*theta);
    double s2=sin(0.5*theta);

    double d=0.0;

    int k;
    for(k=_kmin; k<=_kmax; k+=2) {
        d+=_coef[(k-_kmin)/2]*pow(c2,(2*_j-2*k+m2-m1)/2)*pow(s2,(2*k-m2+m1)/2);
    }

    return d;

}
Beispiel #23
0
static void icaldirset_unlock(const char *dir)
{
    _unused(dir);
}
 static void postcall(lua_State*, int results, meta::index_list_tag) { _unused(results); }
Beispiel #25
0
/* This populates a cluster with the entire contents of a database */
static icalerrorenum icalbdbset_read_database(icalbdbset *bset, char *(*pfunc) (const DBT *dbt))
{
    DB *dbp;
    DBC *dbcp;
    DBT key, data;
    char *str;
    int ret = EINVAL;
    char keystore[256];
    char datastore[1024];
    char *more_mem = NULL;
    DB_TXN *tid;

    _unused(pfunc);

    memset(&key, 0, sizeof(DBT));
    memset(&data, 0, sizeof(DBT));

    if (bset->sdbp) {
        dbp = bset->sdbp;
    } else {
        dbp = bset->dbp;
    }

    if (!dbp) {
        return ICAL_FILE_ERROR;
    }

    bset->cluster = icalcomponent_new(ICAL_XROOT_COMPONENT);

    if ((ret = ICAL_DB_ENV->txn_begin(ICAL_DB_ENV, NULL, &tid, 0)) != 0) {
        /*char *foo = db_strerror(ret); */
        abort();
    }

    /* acquire a cursor for the database */
    if ((ret = dbp->cursor(dbp, tid, &dbcp, 0)) != 0) {
        dbp->err(dbp, ret, "primary index");
        goto err1;
    }

    key.flags = DB_DBT_USERMEM;
    key.data = keystore;
    key.ulen = (u_int32_t) sizeof(keystore);

    data.flags = DB_DBT_USERMEM;
    data.data = datastore;
    data.ulen = (u_int32_t) sizeof(datastore);

    /* fetch the key/data pair */
    while (1) {
        ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT);
        if (ret == DB_NOTFOUND) {
            break;
        } else if (ret == ENOMEM) {
            if (more_mem) {
                free(more_mem);
            }
            more_mem = malloc(data.ulen + 1024);
            data.data = more_mem;
            data.ulen = data.ulen + 1024;
        } else if (ret == DB_LOCK_DEADLOCK) {
            /*char *foo = db_strerror(ret); */
            abort();    /* should retry in case of DB_LOCK_DEADLOCK */
        } else if (ret) {
            /*char *foo = db_strerror(ret); */
            /* some other weird-ass error  */
            dbp->err(dbp, ret, "cursor");
            abort();
        } else {
            icalcomponent *cl;

            /* this prevents an array read bounds error */
            if ((str = (char *)calloc(data.size + 1, sizeof(char))) == NULL) {
                goto err2;
            }
            memcpy(str, (char *)data.data, data.size);

            cl = icalparser_parse_string(str);

            icalcomponent_add_component(bset->cluster, cl);
            free(str);
        }
    }
    if (ret != DB_NOTFOUND) {
        goto err2;
    }

    if (more_mem) {
        free(more_mem);
        more_mem = NULL;
    }

    if ((ret = dbcp->c_close(dbcp)) != 0) {
        /*char *foo = db_strerror(ret); */
        abort();        /* should retry in case of DB_LOCK_DEADLOCK */
    }

    if ((ret = tid->commit(tid, 0)) != 0) {
        /*char *foo = db_strerror(ret); */
        abort();
    }

    return ICAL_NO_ERROR;

  err2:
    if (more_mem) {
        free(more_mem);
    }
    dbcp->c_close(dbcp);
    abort();    /* should retry in case of DB_LOCK_DEADLOCK */
    return ICAL_INTERNAL_ERROR;

  err1:
    dbp->err(dbp, ret, "cursor index");
    abort();
    return ICAL_FILE_ERROR;
}
Beispiel #26
0
icalcomponent *icalbdbsetiter_to_next(icalset *set, icalsetiter *i)
{
    icalcomponent *comp = NULL;
    struct icaltimetype start, next;
    icalproperty *dtstart, *rrule, *prop, *due;
    struct icalrecurrencetype recur;
    icaltimezone *u_zone;
    int g = 0;
    int orig_time_was_utc = 0;

    _unused(set);

    do {

        /* no pending occurrence, read the next component */
        if (i->last_component == NULL) {
            comp = icalcompiter_next(&(i->iter));
        } else {
            comp = i->last_component;
        }

        /* no next component, simply return */
        if (comp == 0) {
            return NULL;
        }
        if (i->gauge == 0) {
            return comp;
        }

        /* finding the next matched component and return it to the caller */

        rrule = icalcomponent_get_first_property(comp, ICAL_RRULE_PROPERTY);
        g = icalgauge_get_expand(i->gauge);

        /* a recurring component with expand query */
        if (rrule != 0 && g == 1) {

            u_zone = icaltimezone_get_builtin_timezone(i->tzid);

            /* use UTC, if that's all we have. */
            if (!u_zone) {
                u_zone = icaltimezone_get_utc_timezone();
            }

            recur = icalproperty_get_rrule(rrule);
            start = icaltime_from_timet(time(0), 0);

            if (icalcomponent_isa(comp) == ICAL_VEVENT_COMPONENT) {
                dtstart = icalcomponent_get_first_property(comp, ICAL_DTSTART_PROPERTY);
                if (dtstart) {
                    start = icalproperty_get_dtstart(dtstart);
                }
            } else if (icalcomponent_isa(comp) == ICAL_VTODO_COMPONENT) {
                due = icalcomponent_get_first_property(comp, ICAL_DUE_PROPERTY);
                if (due) {
                    start = icalproperty_get_due(due);
                }
            }

            /* Convert to the user's timezone in order to be able to compare
             * the results from the rrule iterator. */
            if (icaltime_is_utc(start)) {
                start = icaltime_convert_to_zone(start, u_zone);
                orig_time_was_utc = 1;
            }

            if (i->ritr == NULL) {
                i->ritr = icalrecur_iterator_new(recur, start);
                next = icalrecur_iterator_next(i->ritr);
                i->last_component = comp;
            } else {
                next = icalrecur_iterator_next(i->ritr);
                if (icaltime_is_null_time(next)) {
                    i->last_component = NULL;
                    icalrecur_iterator_free(i->ritr);
                    i->ritr = NULL;
                    /* no more occurrence, should go to get next component */
                    continue;
                } else {
                    i->last_component = comp;
                }
            }

            /* if it is excluded, do next one */
            if (icalproperty_recurrence_is_excluded(comp, &start, &next)) {
                next = icalrecur_iterator_next(i->ritr);
                continue;
            }

            /* set recurrence-id value to the property if the property already exist;
             * add the recurrence id property and the value if the property does not exist */
            prop = icalcomponent_get_first_property(comp, ICAL_RECURRENCEID_PROPERTY);
            if (prop == 0) {
                icalcomponent_add_property(comp, icalproperty_new_recurrenceid(next));
            } else {
                icalproperty_set_recurrenceid(prop, next);
            }

            if (orig_time_was_utc) {
                next = icaltime_convert_to_zone(next, icaltimezone_get_utc_timezone());
            }
        }
        /* end of recurring event with expand query */
        if (comp != 0 && (i->gauge == 0 || icalgauge_compare(i->gauge, comp) == 1)) {
            /* found a matched, return it */
            return comp;
        }
    } while (comp != 0);

    return NULL;        /*unreachable */
}
	double timer(const state_type &x, const double t)
	{
		_unused(x);
		return t+stop_time;
	}
Beispiel #28
0
int main(int argc, char *argv[])
{
    icalcomponent *c, *next_c = NULL;
    int i = 0;
    int dont_remove;
    icalfileset_options options = { O_RDONLY, 0644, 0, NULL };

    icalset *f = icalset_new(ICAL_FILE_SET, TEST_DATADIR "/process-incoming.ics", &options);
    icalset *trash = icalset_new_file("trash.ics");
    icalset *cal = icalset_new(ICAL_FILE_SET, TEST_DATADIR "/process-calendar.ics", &options);
    icalset *out = icalset_new_file("outgoing.ics");

    const char *this_user = "******";

    _unused(argc);
    _unused(argv);

    assert(f != 0);
    assert(cal != 0);
    assert(trash != 0);
    assert(out != 0);

    /* Foreach incoming message */
    for (c = icalset_get_first_component(f); c != 0; c = next_c) {

        icalproperty_xlicclass class;
        icalcomponent *match;
        icalcomponent *inner;
        icalcomponent *reply = 0;

        assert(c != 0);

        inner = icalcomponent_get_first_real_component(c);

        i++;
        reply = 0;
        dont_remove = 0;

        if (inner == 0) {
            printf("Bad component, no inner\n %s\n", icalcomponent_as_ical_string(c));
            continue;
        }

        /* Find a booked component that is matched to the incoming
           message, based on the incoming component's UID, SEQUENCE
           and RECURRENCE-ID */

        match = icalset_fetch_match(cal, c);

        class = icalclassify(c, match, this_user);

        /* Print out the notes associated with the incoming component
           and the matched component in the */
        {
            const char *inc_note = 0;
            const char *match_note = 0;
            icalproperty *p;

            for (p = icalcomponent_get_first_property(c, ICAL_X_PROPERTY);
                 p != 0; p = icalcomponent_get_next_property(c, ICAL_X_PROPERTY)) {

                if (strcmp(icalproperty_get_x_name(p), "X-LIC-NOTE") == 0) {
                    inc_note = icalproperty_get_x(p);
                }
            }

            if (match != 0) {
                for (p = icalcomponent_get_first_property(match, ICAL_X_PROPERTY);
                     p != 0;
                     p = icalcomponent_get_next_property(match, ICAL_X_PROPERTY)) {
                    if (strcmp(icalproperty_get_x_name(p), "X-LIC-NOTE") == 0) {
                        match_note = icalproperty_get_x(p);
                    }
                }
            }

            if (inc_note != 0) {
                printf("Incoming: %s\n", inc_note);
            }
            if (match_note != 0) {
                printf("Match   : %s\n", match_note);
            }
        }

        /* Main processing structure */

        switch (class) {
        case ICAL_XLICCLASS_NONE:{
                char temp[1024];

                /* Huh? Return an error to sender */
                icalrestriction_check(c);
                icalcomponent_convert_errors(c);

                snprintf(temp, 1024,
                         "I can't understand the component you sent.\n"
                         "Here is the component you sent, possibly with error messages:\n"
                         "%s",
                         icalcomponent_as_ical_string(c));

                reply = icalmessage_new_error_reply(c, this_user, temp, "", ICAL_UNKNOWN_STATUS);

                break;
            }
        case ICAL_XLICCLASS_PUBLISHNEW:{

                /* Don't accept published events from anyone but
                   self. If self, fall through to ICAL_XLICCLASS_REQUESTNEW */
            }
        case ICAL_XLICCLASS_REQUESTNEW:{

                /* Book the new component if it does not overlap
                   anything. If the time is busy and the start time is
                   an even modulo 4, delegate to
                   [email protected]. If the time is busy and
                   is 1 modulo 4, counterpropose for the first
                   available free time. Otherwise, deline the meeting */

                icalcomponent *overlaps = icalclassify_find_overlaps(cal, c);

                if (overlaps == 0) {
                    /* No overlaps, book the meeting */
/*                  icalset_add_component(cal,icalcomponent_new_clone(c));*/

                    /* Return a reply */
                    reply =
                        icalmessage_new_accept_reply(
                            c, this_user, "I can make it to this meeting");

                    (void)icalset_add_component(out, reply);

                } else {
                    /* There was a conflict, so delegate, counterpropose
                       or decline it */
                    struct icaltimetype dtstart = icalcomponent_get_dtstart(c);

                    if (dtstart.hour % 4 == 0) {
                        /* Delegate the meeting */
                        reply =
                            icalmessage_new_delegate_reply(
                                c,
                                this_user,
                                "*****@*****.**",
                                "Unfortunately, I have another commitment that conflicts "
                                "with this meeting. I am delegating my attendance to Bob.");
                        (void)icalset_add_component(out, reply);

                    } else if (dtstart.hour % 4 == 1) {
                        /* Counter propose to next available time */
                        icalcomponent *newc;
                        struct icalperiodtype next_time;

                        icalspanlist *spanl = icalspanlist_new(cal, dtstart,
                                                               icaltime_null_time());

                        next_time =
                            icalspanlist_next_free_time(spanl, icalcomponent_get_dtstart(c));

                        newc = icalcomponent_new_clone(c);

                        icalcomponent_set_dtstart(newc, next_time.start);

                        /* Hack, the duration of the counterproposed
                           meeting may be longer than the free time
                           available */
                        icalcomponent_set_duration(newc, icalcomponent_get_duration(c));

                        reply =
                            icalmessage_new_counterpropose_reply(
                                c,
                                newc,
                                this_user,
                                "Unfortunately, I have another commitment that conflicts with "
                                "this meeting. I am proposing a time that works better for me.");

                        (void)icalset_add_component(out, reply);
                        icalspanlist_free(spanl);
                        icalcomponent_free(newc);

                    } else {
                        /* Decline the meeting */

                        reply =
                            icalmessage_new_decline_reply(
                                c,
                                this_user,
                                "I can't make it to this meeting");

                        (void)icalset_add_component(out, reply);
                    }
                }
                icalcomponent_free(overlaps);
                break;
            }
        case ICAL_XLICCLASS_PUBLISHFREEBUSY:{
                /* Store the busy time information in a file named after
                   the sender */
                break;
            }

        case ICAL_XLICCLASS_PUBLISHUPDATE:{
                /* Only accept publish updates from self. If self, fall
                   through to ICAL_XLICCLASS_REQUESTUPDATE */
            }

        case ICAL_XLICCLASS_REQUESTUPDATE:{
                /* always accept the changes */
                break;
            }

        case ICAL_XLICCLASS_REQUESTRESCHEDULE:{
                /* Use same rules as REQUEST_NEW */
                (void)icalclassify_find_overlaps(cal, c);
                break;
            }
        case ICAL_XLICCLASS_REQUESTDELEGATE:{

                break;
            }
        case ICAL_XLICCLASS_REQUESTNEWORGANIZER:{
                break;
            }
        case ICAL_XLICCLASS_REQUESTFORWARD:{
                break;
            }
        case ICAL_XLICCLASS_REQUESTSTATUS:{
                break;
            }

        case ICAL_XLICCLASS_REQUESTFREEBUSY:{
                break;
            }
        case ICAL_XLICCLASS_REPLYACCEPT:{
                /* Change the PARTSTAT of the sender */
                break;
            }
        case ICAL_XLICCLASS_REPLYDECLINE:{
                /* Change the PARTSTAT of the sender */
                break;
            }
        case ICAL_XLICCLASS_REPLYCRASHERACCEPT:{
                /* Add the crasher to the ATTENDEE list with the
                   appropriate PARTSTAT */
                break;
            }
        case ICAL_XLICCLASS_REPLYCRASHERDECLINE:{
                /* Add the crasher to the ATTENDEE list with the
                   appropriate PARTSTAT */
                break;
            }
        case ICAL_XLICCLASS_ADDINSTANCE:{
                break;
            }
        case ICAL_XLICCLASS_CANCELEVENT:{
                /* Remove the component */
                break;
            }
        case ICAL_XLICCLASS_CANCELINSTANCE:{
                break;
            }
        case ICAL_XLICCLASS_CANCELALL:{
                /* Remove the component */
                break;
            }
        case ICAL_XLICCLASS_REFRESH:{
                /* Resend the latest copy of the request */
                break;
            }
        case ICAL_XLICCLASS_COUNTER:{
                break;
            }
        case ICAL_XLICCLASS_DECLINECOUNTER:{
                break;
            }
        case ICAL_XLICCLASS_MALFORMED:{
                /* Send back an error */
                break;
            }
        case ICAL_XLICCLASS_OBSOLETE:{
                printf(" ** Got an obsolete component:\n%s", icalcomponent_as_ical_string(c));
                /* Send back an error */
                break;
            }
        case ICAL_XLICCLASS_MISSEQUENCED:{
                printf(" ** Got a missequenced component:\n%s", icalcomponent_as_ical_string(c));
                /* Send back an error */
                break;
            }
        case ICAL_XLICCLASS_UNKNOWN:{
                printf(" ** Don't know what to do with this component:\n%s",
                       icalcomponent_as_ical_string(c));
                /* Send back an error */
                break;
            }
        case ICAL_XLICCLASS_X:
        case ICAL_XLICCLASS_REPLYDELEGATE:
        default:{
            }
        }

#if 0
        if (reply != 0) {

            /* Don't send the reply if the RSVP parameter indicates not to */
            icalcomponent *reply_inner;
            icalproperty *attendee;
            icalparameter *rsvp;

            reply_inner = icalcomponent_get_first_real_component(reply);
            attendee = icalcomponent_get_first_property(reply_inner, ICAL_ATTENDEE_PROPERTY);
            rsvp = icalproperty_get_first_parameter(attendee, ICAL_RSVP_PARAMETER);

            if (rsvp == 0 || icalparameter_get_rsvp(rsvp) == 1) {
                icalrestriction_check(reply);
                send_message(reply, this_user);
            }

            icalcomponent_free(reply);
        }
#endif

        if (reply != 0) {
            printf("%s\n", icalcomponent_as_ical_string(reply));
        }

        next_c = icalset_get_next_component(f);

        if (dont_remove == 0) {
            /*icalset_remove_component(f,c);
               icalset_add_component(trash,c); */
        }
    }

#if 0

    for (c = icalset_get_first_component(out); c != 0; c = icalset_get_next_component(out)) {

        printf("%s", icalcomponent_as_ical_string(c));
    }
#endif

    icalset_free(f);
    icalset_free(trash);
    icalset_free(cal);
    icalset_free(out);

    return 0;
}
Beispiel #29
0
 double timer(const state_type &x, const double t)
 {
     _unused(x);
     return t+10000;
 }
Beispiel #30
0
int main(void)
{
  uint32_t j;

  /* Test the 32-bit add-with-carry kiss generator. */
  kiss32a_state_t * kiss32a_state;
  kiss32a_state = (kiss32a_state_t*) malloc(sizeof(kiss32a_state_t));

  kiss32a_state->mx = UINT32_C(123456789);
  kiss32a_state->my = UINT32_C(362436069);
  kiss32a_state->mz = UINT32_C(21288629);
  kiss32a_state->mw = UINT32_C(14921776);
  kiss32a_state->mc = UINT32_C(0);
  /* TODO kiss32a_state_t * seed_kiss32a(kiss32a_t *state, uint32_t mx,
       uint32_t my, uint32_t mz, uint32_t mw, uint32_t mc);
     Populate state (malloc if required). If NULL pointer returned, not
     successful.
  */

  /* Note, the following test corrects the original Usenet posting (Fortran and
     C: United with a kiss) of Marsaglia: we use 100000, not 10000 iterations.
   */
  for (int i = 0; i < 99996; i++)
  {
    _unused(j = kiss32a(kiss32a_state));
  }

  /* Test next four values for correctness */
  assert(kiss32a(kiss32a_state) == UINT32_C( 199275006));
  assert(kiss32a(kiss32a_state) == UINT32_C(  86473693));
  assert(kiss32a(kiss32a_state) == UINT32_C(2209597521));
  assert(kiss32a(kiss32a_state) == UINT32_C(1298124039));

#ifdef UINT64_C
  uint64_t k;

  /* Test the 32-bit multiply-with-carry kiss generator. */
  kiss32_state_t * kiss32_state;
  kiss32_state = (kiss32_state_t*) malloc(sizeof(kiss32_state_t));

  kiss32_state->mx = UINT32_C(123456789);
  kiss32_state->my = UINT32_C(362436000);
  kiss32_state->mz = UINT32_C(521288629);
  kiss32_state->mc = UINT32_C(7654321);
  /* TODO kiss32_state_t * seed_kiss32(kiss32_t *state, uint32_t mx,
       uint32_t my, uint32_t mz, uint32_t mc);
     Populate state (malloc if required). If NULL pointer returned, not
     successful.
  */

  for (int i = 0; i < 1000000; i++)
  {
    _unused(j = kiss32(kiss32_state));
  }

  /* The following test is from simplerandom, see
   * https://bitbucket.org/cmcqueen1975/simplerandom/wiki/Home */
  assert(j == UINT32_C(1010846401));

  /* Test the 64-bit multiply-with-carry kiss generator. */
  kiss64_state_t * kiss64_state;
  kiss64_state = (kiss64_state_t*) malloc(sizeof(kiss64_state_t));

  kiss64_state->mx = UINT64_C(1066149217761810);
  kiss64_state->my = UINT64_C(362436362436362436);
  kiss64_state->mz = UINT64_C(1234567890987654321);
  kiss64_state->mc = UINT64_C(123456123456123456);
  /* TODO kiss64_state_t * seed_kiss64(kiss64_t *state, uint64_t mx,
       uint64_t my, uint64_t mz, uint64_t mc);
     Populate state (malloc if required). If NULL pointer returned, not
     successful.
  */

  for (int i = 0; i < 100000000; i++)
  {
    _unused(k = kiss64(kiss64_state));
  }

  assert(k == UINT64_C(1666297717051644203));

#endif /* ifdef UINT64_C */

  return EXIT_SUCCESS;
}