Ejemplo n.º 1
0
static inline struct variable *cfnc_chop(struct context *context, bool snip)
{
    int32_t beginning, foraslongas;

    struct variable *args = (struct variable*)stack_pop(context->operand_stack);
    struct variable *self = (struct variable*)array_get(args->list.ordered, 0);

    enum VarType type = self->type;
    if (type == VAR_NIL)
        return variable_new_nil(context);
    assert_message(self->type == VAR_LST || self->type == VAR_STR, "can't chop");
    
    if (args->list.ordered->length > 1) {
        struct variable *start = (struct variable*)array_get(args->list.ordered, 1);
        assert_message(start->type == VAR_INT, "non-integer index");
        beginning = start->integer;
    }
    else beginning = 0;

    if (args->list.ordered->length > 2) {
        struct variable *length = (struct variable*)array_get(args->list.ordered, 2);
        assert_message(length->type == VAR_INT, "non-integer length");
        foraslongas = length->integer;
    } else
        foraslongas = snip ? 1 : self->str->length - beginning;

    struct variable *result = variable_part(context, self, beginning, foraslongas);
    if (snip)
        variable_remove(self, beginning, foraslongas);
    return result;
}
Ejemplo n.º 2
0
void list_remove(void *data, uint32_t *end, uint32_t start, int32_t length, size_t width) {
    assert_message(data || !length, "list can't remove");
    null_check(end);
    length = length < 0 ? *end - start : length;
    assert_message(!length || (start < *end && start+length <= *end), "index out of bounds");

    memmove((uint8_t*)data+start*width, (uint8_t*)data+(start+length)*width, (*end-start-length)*width);
    *end -= (uint32_t)length;
}
Ejemplo n.º 3
0
static inline struct variable *cfnc_char(struct context *context)
{
    struct variable *args = (struct variable*)stack_pop(context->operand_stack);
    struct variable *from = (struct variable*)array_get(args->list.ordered, 0);
    struct variable *index = (struct variable*)array_get(args->list.ordered, 1);

    assert_message(from->type == VAR_STR, "char from a non-str");
    assert_message(index->type == VAR_INT, "non-int index");
    uint8_t n = byte_array_get(from->str, index->integer);
    return variable_new_int(context, n);
}
Ejemplo n.º 4
0
void byte_array_resize(struct byte_array* ba, uint32_t size)
{
    if (!(size = list_resize(ba->size, size))) // didn't resize
        return;
    assert_message(ba->current >= ba->data, "byte_array corrupt");
    uint32_t delta = (uint32_t)(ba->current - ba->data);
    ba->data = (uint8_t*)realloc(ba->data, size);
    assert_message(ba->data, "could not reallocate data");
    ba->current = ba->data + delta;
    ba->size = size;
    //DEBUGPRINT("byte_array_resize %p->%p\n", ba, ba->data);
}
Ejemplo n.º 5
0
static inline struct variable *cfnc_sort(struct context *context)
{
    struct variable *args = (struct variable*)stack_pop(context->operand_stack);
    struct variable *self = (struct variable*)array_get(args->list.ordered, 0);

    assert_message(self->type == VAR_LST, "sorting a non-list");
    struct variable *comparator = (args->list.ordered->length > 1) ?
        (struct variable*)array_get(args->list.ordered, 1) :
        NULL;

    int num_items = self->list.ordered->length;

    int success = heapsortfg(context, self->list.ordered->data, num_items, sizeof(struct variable*), comparator);
    assert_message(!success, "error sorting");
    return NULL;
}
Ejemplo n.º 6
0
int compar(struct context *context, const void *a, const void *b, struct variable *comparator)
{
    struct variable *av = *(struct variable**)a;
    struct variable *bv = *(struct variable**)b;

    if (comparator) {

        byte_array_reset(comparator->str);
        vm_call(context, comparator, av, bv, NULL);

        struct variable *result = (struct variable*)stack_pop(context->operand_stack);
        if (result->type == VAR_SRC)
            result = array_get(result->list.ordered, 0);
        assert_message(result->type == VAR_INT, "non-integer comparison result");
        return result->integer;

    } else {

        enum VarType at = av->type;
        enum VarType bt = bv->type;

        if (at == VAR_INT && bt == VAR_INT) {
            // DEBUGPRINT("compare %p:%d to %p:%d : %d\n", av, av->integer, bv, bv->integer, av->integer - bv->integer);
            return av->integer - bv->integer;
        } else
            DEBUGPRINT("can't compare %s to %s\n", var_type_str(at), var_type_str(bt));

        vm_exit_message(context, "incompatible types for comparison");
        return 0;
    }
}
Ejemplo n.º 7
0
void CGraphicsPoints::drawText(
                    const char *text,
                    double x, double y,
                    double height)
{
    assert_message("Textos no implementados");
}
Ejemplo n.º 8
0
static inline void cfnc_length(struct context *context) {
    struct variable *args = (struct variable*)stack_pop(context->operand_stack);
    struct variable *indexable = (struct variable*)array_get(args->list, 0);
    assert_message(indexable->type==VAR_LST || indexable->type==VAR_STR, "no length for non-indexable");
    struct variable *result = variable_new_int(context, indexable->list->length);
    stack_push(context->operand_stack, result);
}
Ejemplo n.º 9
0
void *incoming_connection(void *arg)
{
	char readline[MAXLINE];
    struct thread_argument *ta = (struct thread_argument *)arg;
    struct context *context = context_new(true, true);
    context->find = ta->find;

    for (;;)
    {
        bzero(readline, sizeof(readline));
        int n;
        if (((n = CyaSSL_read(ta->ssl, readline, MAXLINE)) <= 0))
        {
            fprintf(stderr, "client closed connection\n");
            goto free_ssl;
        }

        fprintf(stderr, "%d bytes received: %s\n", n, readline);
        struct byte_array *raw_message = byte_array_new_size(n);
        raw_message->data = (uint8_t*)readline;
        int32_t raw_message_length = serial_decode_int(raw_message);
        assert_message(raw_message_length < MAXLINE, "todo: handle long messages");
        struct variable *message = variable_deserialize(context, raw_message);

        struct variable *listener = (struct variable *)map_get(server_listeners, (void*)(VOID_INT)ta->fd);
        vm_call(context, listener, message);
    }

free_ssl:
	CyaSSL_free(ta->ssl); // Free CYASSL object
    free(ta);
    context_del(context);
	return NULL;
}
Ejemplo n.º 10
0
static void test_dragon_moves(CuTest * tc)
{
    faction *f, *f2;
    region *r;
    unit *u, *m;
    struct message *msg;

    create_monsters(&f, &f2, &u, &m);
    rsetmoney(findregion(1, 0), 1000);
    r = findregion(0, 0); // plain
    rsetpeasants(r, 0);
    rsetmoney(r, 0);

    set_level(m, SK_WEAPONLESS, 10);
    config_set("rules.monsters.attack_chance", ".0");
    plan_monsters(f2);

    CuAssertPtrNotNull(tc, find_order("move east", m));

    mt_register(mt_new_va("dragon_growl", "dragon:unit", "number:int", "target:region", "growl:string", 0));

    random_growl(m, findregion(1, 0), 3);

    msg = test_get_last_message(r->msgs);
    assert_message(tc, msg, "dragon_growl", 4);
    assert_pointer_parameter(tc, msg, 0, m);
    assert_int_parameter(tc, msg, 1, 1);
    assert_pointer_parameter(tc, msg, 2, findregion(1,0));
    assert_string_parameter(tc, msg, 3, "growl3");

    test_cleanup();
}
Ejemplo n.º 11
0
// VAR_LST -> VAR_SRC
static inline struct variable *cfnc_pack(struct context *context)
{
    struct variable *args = (struct variable*)stack_pop(context->operand_stack);
    struct variable *indexable = (struct variable*)array_get(args->list.ordered, 0);
    assert_message(indexable->type == VAR_LST, "wrong type for packing");
    indexable->type = VAR_SRC;
    return indexable;
}
Ejemplo n.º 12
0
//    a                b        c
// <sought> <replacement> [<start>]
// <start> <length> <replacement>
static inline struct variable *cfnc_replace(struct context *context)
{
    struct variable *args = (struct variable*)stack_pop(context->operand_stack);
    struct variable *self = (struct variable*)array_get(args->list.ordered, 0);
    struct variable *a = (struct variable*)array_get(args->list.ordered, 1);
    struct variable *b = (struct variable*)array_get(args->list.ordered, 2);
    struct variable *c = args->list.ordered->length > 3 ?
        (struct variable*)array_get(args->list.ordered, 3) : NULL;

    null_check(self);
    null_check(b);
    assert_message(self->type == VAR_STR, "searching in a non-string");

    struct byte_array *replaced = NULL;

    if (a->type == VAR_STR) { // find a, replace with b

        assert_message(b->type == VAR_STR, "non-string replacement");
        int32_t where = 0;

        if (c) { // replace first match after index c

            assert_message(c->type == VAR_INT, "non-integer index");
            if (((where = byte_array_find(self->str, a->str, c->integer)) >= 0))
                replaced = byte_array_replace(self->str, b->str, where, b->str->length);

        } else {

            replaced = byte_array_replace_all(self->str, a->str, b->str);
        }

    } else if (a->type == VAR_INT ) { // replace at index a, length b, insert c

        assert_message(a || a->type == VAR_INT, "non-integer count");
        assert_message(b || b->type == VAR_INT, "non-integer start");
        replaced = byte_array_replace(self->str, c->str, a->integer, b->integer);

    } else exit_message("replacement is not a string");

    null_check(replaced);
    struct variable *result = variable_new_str(context, replaced);
    byte_array_del(replaced);

    return result;
}
Ejemplo n.º 13
0
static void unamb_sub(const HParsedToken* tok, struct result_buf *buf) {
  char* tmpbuf;
  int len;
  if (!tok) {
    append_buf(buf, "NULL", 4);
    return;
  }
  switch (tok->token_type) {
  case TT_NONE:
    append_buf(buf, "null", 4);
    break;
  case TT_BYTES:
    if (tok->bytes.len == 0)
      append_buf(buf, "<>", 2);
    else {
      for (size_t i = 0; i < tok->bytes.len; i++) {
	const char *HEX = "0123456789abcdef";
	append_buf_c(buf, (i == 0) ? '<': '.');
	char c = tok->bytes.token[i];
	append_buf_c(buf, HEX[(c >> 4) & 0xf]);
	append_buf_c(buf, HEX[(c >> 0) & 0xf]);
      }
      append_buf_c(buf, '>');
    }
    break;
  case TT_SINT:
    if (tok->sint < 0)
      len = asprintf(&tmpbuf, "s-%#lx", -tok->sint);
    else
      len = asprintf(&tmpbuf, "s%#lx", tok->sint);
    append_buf(buf, tmpbuf, len);
    free(tmpbuf);
    break;
  case TT_UINT:
    len = asprintf(&tmpbuf, "u%#lx", tok->uint);
    append_buf(buf, tmpbuf, len);
    free(tmpbuf);
    break;
  case TT_ERR:
    append_buf(buf, "ERR", 3);
    break;
  case TT_SEQUENCE: {
    append_buf_c(buf, '(');
    for (size_t i = 0; i < tok->seq->used; i++) {
      if (i > 0)
	append_buf_c(buf, ' ');
      unamb_sub(tok->seq->elements[i], buf);
    }
    append_buf_c(buf, ')');
  }
    break;
  default:
    fprintf(stderr, "Unexpected token type %d\n", tok->token_type);
    assert_message(0, "Should not reach here.");
  }
}
Ejemplo n.º 14
0
// run a file, using the same context
struct context *interpret_file_with(struct context *context, struct byte_array *path) {
    if (NULL == context) {
        context = context_new(NULL, true, true);
    }

    struct byte_array *script = read_file(path, 0, 0);
    assert_message(NULL != script, "file not found: %s\n", byte_array_to_string(path));
    interpret_string(context, script);
    return context;
}
Ejemplo n.º 15
0
static inline struct variable *cfnc_insert(struct context *context) // todo: test
{
    struct variable *args = (struct variable*)stack_pop(context->operand_stack);
    struct variable *self = (struct variable*)array_get(args->list.ordered, 0);
    struct variable *insertion = (struct variable*)array_get(args->list.ordered, 1);
    struct variable *start = args->list.ordered->length > 2 ?
        (struct variable*)array_get(args->list.ordered, 2) : NULL;
    null_check(self);
    null_check(insertion);
    assert_message(!start || start->type == VAR_INT, "non-integer index");

    int32_t position = 0;
    switch (self->type) {
        case VAR_LST: {
            struct array *list = array_new_size(1);
            array_set(list, 0, insertion);
            insertion = variable_new_list(context, list);
            position = self->list.ordered->length;
            array_del(list);
        } break;
        case VAR_STR:
            assert_message(insertion->type == VAR_STR, "insertion doesn't match destination");
            position = self->str->length;
            break;
        default:
            exit_message("bad insertion destination");
            break;
    }

    struct variable *first = variable_part(context, variable_copy(context, self), 0, position);
    struct variable *second = variable_part(context, variable_copy(context, self), position, -1);
    struct variable *joined = variable_concatenate(context, 3, first, insertion, second);
    
    if (self->type == VAR_LST) {
        array_del(self->list.ordered);
        self->list.ordered = array_copy(joined->list.ordered);
    } else {
        byte_array_del(self->str);
        self->str = byte_array_copy(joined->str);
    } return joined;
}
Ejemplo n.º 16
0
struct byte_array* serial_decode_string(struct byte_array* buf)
{
	null_check(buf);
    int32_t len = serial_decode_int(buf);
	assert_message(len>=0, "negative malloc");
    struct byte_array* ba = byte_array_new_size(len);
    ba->data = ba->current = (uint8_t*)malloc(len);
	null_check(ba->data);
    memcpy(ba->data, buf->current, len);
    buf->current += len;
    return ba;
}
Ejemplo n.º 17
0
/* Set equality of HHashSets.
 * Obviously, 'a' and 'b' must use the same equality function.
 * Not strictly necessary, but we also assume the same hash function.
 */
bool h_hashset_equal(const HHashSet *a, const HHashSet *b) {
  if(a->capacity == b->capacity) {
    // iterate over the buckets in parallel
    for(size_t i=0; i < a->capacity; i++) {
      if(!hte_equal(a->equalFunc, &a->contents[i], &b->contents[i]))
        return false;
    }
  } else {
    assert_message(0, "h_hashset_equal called on sets of different capacity");
    // TODO implement general case
  }
  return true;
}
Ejemplo n.º 18
0
// deletes file or folder
struct variable *sys_rm(struct context *context)
{
    struct variable *value = (struct variable*)stack_pop(context->operand_stack);
    struct variable *path = (struct variable*)array_get(value->list.ordered, 1);
    char *path2 = byte_array_to_string(path->str);
    assert_message(strlen(path2)>1, "oops");
    char rmcmd[100];
    sprintf(rmcmd, "rm -rf %s", path2);
    if (system(rmcmd))
        printf("\n\nCould not rm %s\n\n", path2);
    free(path2);
    return NULL;
}
Ejemplo n.º 19
0
struct variable *sys_print(struct context *context)
{
    null_check(context);
    struct variable *args = (struct variable*)stack_pop(context->operand_stack);
    assert_message(args && args->type==VAR_SRC && args->list.ordered, "bad print arg");
    for (int i=1; i<args->list.ordered->length; i++) {
        struct variable *arg = (struct variable*)array_get(args->list.ordered, i);
        struct byte_array *str = variable_value(context, arg);
        if (arg->type == VAR_STR)
            str = byte_array_part(str, 1, str->length-2);
        printf("%s\n", byte_array_to_string(str));
    }
    return NULL;
}
Ejemplo n.º 20
0
void h_pprint(FILE* stream, const HParsedToken* tok, int indent, int delta) {
  switch (tok->token_type) {
  case TT_NONE:
    fprintf(stream, "%*snull\n", indent, "");
    break;
  case TT_BYTES:
    if (tok->bytes.len == 0)
      fprintf(stream, "%*s<>\n", indent, "");
    else {
      fprintf(stream, "%*s", indent, "");
      for (size_t i = 0; i < tok->bytes.len; i++) {
	fprintf(stream,
		"%c%02hhx",
		(i == 0) ? '<' : '.',
		tok->bytes.token[i]);
      }
      fprintf(stream, ">\n");
    }
    break;
  case TT_SINT:
    if (tok->sint < 0)
      fprintf(stream, "%*ss -%#" PRIx64 "\n", indent, "", -tok->sint);
    else
      fprintf(stream, "%*ss %#" PRIx64 "\n", indent, "", tok->sint);
      
    break;
  case TT_UINT:
    fprintf(stream, "%*su %#" PRIx64 "\n", indent, "", tok->uint);
    break;
  case TT_SEQUENCE: {
    fprintf(stream, "%*s[\n", indent, "");
    for (size_t i = 0; i < tok->seq->used; i++) {
      h_pprint(stream, tok->seq->elements[i], indent + delta, delta);
    }
    fprintf(stream, "%*s]\n", indent, "");
  }
    break;
  case TT_USER:
    fprintf(stream, "%*sUSER:%s\n", indent, "", h_get_token_type_name(tok->token_type));
    break;
  default:
    if(tok->token_type > TT_USER) {
      fprintf(stream, "%*sUSER:%s %d\n", indent, "", h_get_token_type_name(tok->token_type), tok->token_type-TT_USER);
    } else {
      assert_message(0, "Should not reach here.");
    }
  }
}
Ejemplo n.º 21
0
struct variable *variable_map_list(struct context *context,
                                   struct variable *indexable,
                                   struct array* (*map_list)(const struct map*))
{
    assert_message(indexable->type == VAR_LST, "values are only for list");
    struct variable *result = variable_new_list(context, NULL);
    if (NULL != indexable->list.map) {
        struct array *a = map_list(indexable->list.map);
        for (int i=0; i<a->length; i++) {
            struct variable *u = variable_copy(context, (struct variable*)array_get(a, i));
            array_add(result->list.ordered, u);
        }
        array_del(a);
    }
    return result;
}
Ejemplo n.º 22
0
struct variable *sys_send(struct context *context)
{
    struct variable *arguments = (struct variable*)stack_pop(context->operand_stack);
    struct variable *sender = (struct variable*)array_get(arguments->list, 1);
    const char *message = param_str(arguments, 2);

    assert_message(sender->type == VAR_INT, "non int fd");
    int32_t fd = sender->integer;
    struct thread_argument *ta = (struct thread_argument*)map_get(socket_listeners, (void*)(VOID_INT)fd);

    printf("send on ssl=%p\n", ta->ssl);
    if (CyaSSL_write(ta->ssl, message, strlen(message)) != strlen(message))
        context->vm_exception = variable_new_str(context, byte_array_from_string("CyaSSL_write error"));

    return NULL;
}
Ejemplo n.º 23
0
static void push_map(struct context *context, struct byte_array *program)
{
    int32_t num_items = serial_decode_int(program);
    DEBUGPRINT("MAP %d", num_items);
    if (!context->runtime)
        VM_DEBUGPRINT("\n");
    struct map *map = map_new();
    while (num_items--) {
        struct variable* value = variable_pop(context);
        struct variable* key = variable_pop(context);
        assert_message(key->type==VAR_STR, "non-string map index");
        map_insert(map, key->str, value);
    }
    struct variable *v = variable_new_map(context, map);
    DEBUGPRINT(": %s\n", variable_value_str(context, v));
    variable_push(context, v);
}
Ejemplo n.º 24
0
void serial_decode(struct byte_array* buf, serial_element se, const void* extra)
{
    while (buf->current < buf->data + buf->length)
    {
        // get key and wire type
        int32_t keyWire = serial_decode_int(buf);
        struct key_value_pair pair = {
            .key = keyWire >> 2,
            .wire_type = (enum serial_type)(keyWire & 0x03)
        };

        // get data
        switch(pair.wire_type) {
            case SERIAL_INT:  /* int */
                pair.value.integer = serial_decode_int(buf);
                break;
            case SERIAL_FLOAT:
                pair.value.floater = serial_decode_float(buf);
            case SERIAL_STRING:  /* bytes */
                pair.value.bytes = serial_decode_string(buf);
                break;
            case SERIAL_ARRAY:
                break;
            default:
                DEBUGPRINT("serial_decode ?\n");
                break;
        }
        if (se(&pair, buf, extra)) {
//            DEBUGPRINT("serial_decode: break\n");
            break;
        }
    }
//    DEBUGPRINT("serial_decode done\n");
}

// assume little endian
struct byte_array *encode_float(struct byte_array *buf, float f)
{
    assert_message(sizeof(float)==4, "bad float size");
    uint8_t *uf = (uint8_t*)&f;
    for (int i=4; i; i--) {
        byte_array_add_byte(buf, *uf);
        uf++;
    }
    return buf;
}
Ejemplo n.º 25
0
struct byte_array *byte_array_concatenate(int n, const struct byte_array* ba, ...)
{
    struct byte_array* result = byte_array_copy(ba);

    va_list argp;
    for(va_start(argp, ba); --n;) {
        struct byte_array* parameter = va_arg(argp, struct byte_array* );
        if (parameter == NULL)
            continue;
        assert_message(result->length + parameter->length < BYTE_ARRAY_MAX_LEN, ERROR_BYTE_ARRAY_LEN);
        byte_array_append(result, parameter);
    }

    va_end(argp);

    if (result)
        result->current = result->data + result->length;
    return result;
}
Ejemplo n.º 26
0
// deletes file or folder
struct variable *sys_mv(struct context *context)
{
    struct variable *value = (struct variable*)stack_pop(context->operand_stack);
    const char *src = param_str(value, 1);
    const char *dst = param_str(value, 2);
    long timestamp = param_int(value, 3);

    assert_message((strlen(src)>1) && (strlen(dst)>1), "oops");

    //printf("mv %s to %s\n", src, dst);
    create_parent_folder_if_needed(dst);
    if (rename(src, dst))
        perror("rename");

    if (timestamp) // to prevent unwanted timestamp updates resulting from the mv
        file_set_timestamp(dst, timestamp);

    return NULL;
}
Ejemplo n.º 27
0
void execute(struct byte_array *program, find_c_var *find)
{
#ifdef DEBUG
    display_program(program);
#endif

    DEBUGPRINT("execute:\n");
    null_check(program);
    program = byte_array_copy(program);
    byte_array_reset(program);

    struct context *context = context_new(false);
    context->find = find;
#ifdef DEBUG
    context->indent = 1;
#endif
    if (!setjmp(trying))
        run(context, program, NULL, false);

    assert_message(stack_empty(context->operand_stack), "operand stack not empty");
}
Ejemplo n.º 28
0
struct byte_array *byte_array_replace(struct byte_array *within, struct byte_array *replacement, uint32_t start, int32_t length)
{
    null_check(within);
    null_check(replacement);
    uint32_t ws = within->length;
    assert_message(start < ws, "index out of bounds");
    if (length < 0)
        length = ws - start;

    int32_t new_length = within->length - length + replacement->length;
    struct byte_array *replaced = byte_array_new_size(new_length);
    replaced->length = new_length;

    memcpy(replaced->data, within->data, start);
    memcpy(replaced->data + start, replacement->data, replacement->length);
    memcpy(replaced->data + start + replacement->length,
           within->data + start + length,
           within->length - start - length);

    //DEBUGPRINT("byte_array_replace %p->%p\n", replaced, replaced->data);
    return replaced;
}
Ejemplo n.º 29
0
struct variable *sys_disconnect(struct context *context)
{
    struct variable *arguments = (struct variable*)stack_pop(context->operand_stack);
    if (arguments->list->length < 2)
    {
        struct variable *sockets = (struct variable *)array_get(arguments->list, 1);
        assert_message(sockets->type == VAR_LST, "non list of sockets");
        for (int i=0; i<sockets->list->length; i++)
        {
            struct thread_argument *tc = (struct thread_argument *)array_get(sockets->list, i);
            close(tc->fd);
            CyaSSL_free(tc->ssl);
        }
    }
    else
    {
        const int32_t fd = param_int(arguments, 1);
        close(fd);
        map_remove(socket_listeners, (void*)(VOID_INT)fd);
    }
    return NULL;
}
Ejemplo n.º 30
0
bool SystemInterface::LogMessage(Rocket::Core::Log::Type type, const Rocket::Core::String& message)
{
	if (fp != NULL)
	{
		// Select a prefix appropriate for the severity of the message.
		const char* prefix;
		switch (type)
		{
			case Rocket::Core::Log::LT_ERROR:
			case Rocket::Core::Log::LT_ASSERT:
				prefix = "-!-";
				break;

			case Rocket::Core::Log::LT_WARNING:
				prefix = "-*-";
				break;

			default:
				prefix = "---";
				break;
		}

		// Print the message and timestamp to file, and force a write in case of a crash.
		fprintf(fp, "%s (%.2f): %s", prefix, GetElapsedTime(), message.CString());
		fflush(fp);

#ifdef ROCKET_PLATFORM_WIN32
		if (type == Rocket::Core::Log::LT_ASSERT)
		{
			Rocket::Core::String assert_message(1024, "%s\nWould you like to interrupt execution?", message.CString());

			// Return TRUE if the user presses NO (continue execution)
			return MessageBox(NULL, assert_message.CString(), "Assertion Failure", MB_YESNO | MB_ICONSTOP | MB_DEFBUTTON2 | MB_SYSTEMMODAL) == IDNO;
		}
#endif
	}

	return true;
}