muse_misc.c File Reference

#include "muse_opcodes.h"
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <sys/time.h>
#include "muse_port.h"

Include dependency graph for muse_misc.c:


Data Structures

struct  ticktock_t

Functions

muse_int muse_hash_data (const unsigned char *start, const unsigned char *end, muse_int initial)
 Creates a simple hash of the given data.
muse_int muse_hash_text (const muse_char *start, const muse_char *end, muse_int initial)
 A hash similar to muse_hash_data, but tailored for text.
muse_int muse_hash (muse_cell obj)
 Hashes a given cell reference.
void * muse_tick ()
 Used for performance timing.
muse_int muse_tock (void *arg)
 When passed the timing handle returned by muse_tick(), it returns the time elapsed between the muse_tick() call and this muse_tock() call in microseconds.
void muse_sleep (muse_int time_us)
 Sleeps the muse process for the given time in microseconds.
FILE * muse_fopen (const muse_char *filename, const muse_char *options)
 A wrapper to the common fopen function so that we can call _wfopen if available, or the narrow version if the wide version isn't available.
int muse_unicode_to_utf8 (char *out, int out_maxlen, const muse_char *win, int win_len)
 Converts the given double-byte unicode string to multibyte UTF8 string.
int muse_utf8_to_unicode (muse_char *wout, int wout_maxlen, const char *in, int in_len)
 Converts the given UTF8 string to double-byte unicode string.
int muse_utf8_size (const muse_char *wstr, int length)
 Returns an estimate of the number of bytes (conservative upper bound) that might be needed to represent the given number of unicode characters using UTF8 encoding.
int muse_unicode_size (const char *utf8, int nbytes)
 Returns an estimate (conservative upper bound) of the number of bytes that will be required to store the converted unicode version of the given utf8 string.
void muse_assert_failed (const char *file, int line, const char *condtext)
 Prints out an muse_assertion failure message in debug builds.
const muse_charmuse_typename (muse_cell thing)
 Returns a non-mutable string describing the type of the thing passed as the parameter.
static void muse_exception (muse_cell args)
static int muse_sprintf_object (muse_char *buffer, int maxlen, muse_cell thing)
static int muse_sprintf_list (muse_char *buffer, int maxlen, muse_cell list)
static int muse_sprintf_text (muse_char *buffer, int maxlen, muse_cell thing)
static int muse_vsprintf_object (muse_char *buffer, int maxlen, va_list *argv)
static int muse_vsprintf_type (muse_char *buffer, int maxlen, va_list *argv)
static int muse_vsprintf (muse_char *buffer, int maxlen, const muse_char *format, va_list *argv)
int muse_sprintf (muse_char *buffer, int maxlen, const muse_char *format,...)
 Formats a string consisting of the given format string with the other argument objects inserted at specified positions.
void muse_message (const muse_char *context, const muse_char *message,...)
 Displays a message string formatted according to the given message string with format codes.
static muse_boolean muse_test (const muse_char *context, const muse_char *spec, va_list *argv)
static muse_boolean muse_test_one (const muse_char *context, muse_boolean force, muse_boolean invert, muse_cell symbol, muse_cell value, const muse_char *spec, va_list *argv, muse_char *failure_descr)
static int levenshtein_distance (const muse_char *s1, const muse_char *s2)
muse_boolean muse_expect (const muse_char *context, const muse_char *spec,...)
 Checks whether a set of expectations are satisfied by some values.
muse_cell muse_similar_symbol (muse_cell symbol, int *outDistance)
 Sometimes, it is useful to know whether another symbol that's very similar in textual representation from a known symbol.
muse_cell muse_symbol_with_value (muse_cell value)
 Searches the symbol table to find a symbol whose current value is the given cell.
static muse_boolean muse_test_limit (const muse_char *context, muse_boolean force, muse_cell symbol, muse_cell value, muse_float limit, int comparison, int invert, const muse_char *descr, muse_char *failure_descr)
static int min3 (int x, int y, int z)

Detailed Description

Author:
Srikumar K. S. (mailto:kumar@muvee.com)
Copyright (c) 2006 Jointly owned by Srikumar K. S. and muvee Technologies Pte. Ltd.

All rights reserved. See LICENSE.txt distributed with this source code or http://muvee-symbolic-expressions.googlecode.com/svn/trunk/LICENSE.txt for terms and conditions under which this software is provided to you.


Function Documentation

void muse_assert_failed ( const char *  file,
int  line,
const char *  condtext 
)

Prints out an muse_assertion failure message in debug builds.

static void muse_exception ( muse_cell  args  )  [static]

static int muse_sprintf_object ( muse_char buffer,
int  maxlen,
muse_cell  thing 
) [static]

static int muse_sprintf_list ( muse_char buffer,
int  maxlen,
muse_cell  list 
) [static]

static int muse_sprintf_text ( muse_char buffer,
int  maxlen,
muse_cell  thing 
) [static]

static int muse_vsprintf_object ( muse_char buffer,
int  maxlen,
va_list *  argv 
) [static]

static int muse_vsprintf_type ( muse_char buffer,
int  maxlen,
va_list *  argv 
) [static]

static int muse_vsprintf ( muse_char buffer,
int  maxlen,
const muse_char format,
va_list *  argv 
) [static]

static muse_boolean muse_test ( const muse_char context,
const muse_char spec,
va_list *  argv 
) [static]

static muse_boolean muse_test_one ( const muse_char context,
muse_boolean  force,
muse_boolean  invert,
muse_cell  symbol,
muse_cell  value,
const muse_char spec,
va_list *  argv,
muse_char failure_descr 
) [static]

static int levenshtein_distance ( const muse_char s1,
const muse_char s2 
) [static]

static muse_boolean muse_test_limit ( const muse_char context,
muse_boolean  force,
muse_cell  symbol,
muse_cell  value,
muse_float  limit,
int  comparison,
int  invert,
const muse_char descr,
muse_char failure_descr 
) [static]

static int min3 ( int  x,
int  y,
int  z 
) [static]


Generated on Mon Sep 25 23:12:47 2006 for muSE by  doxygen 1.4.7