Beispiel #1
0
int eqp(int addr1, int addr2){
    if((numberp(addr1)) && (numberp(addr2))
        && ((GET_NUMBER(addr1)) == (GET_NUMBER(addr2))))
        return(1);
    else if ((symbolp(addr1)) && (symbolp(addr2))
        && (SAME_NAME(addr1,addr2)))
        return(1);
    else
        return(0);
}
Beispiel #2
0
int f_minus(int arglist){
        int arg,res;
    
    res = GET_NUMBER(car(arglist));
    while(!(IS_NIL(arglist))){
        arg = GET_NUMBER(car(arglist));
        arglist = cdr(arglist);
        res = res - arg;
    }
    return(makenum(res));
}
Beispiel #3
0
int f_smaller(int arglist){
    int num1,num2;
    
    checkarg(LEN2_TEST, "<", arglist);
    checkarg(NUMLIST_TEST, "<", arglist);
    num1 = GET_NUMBER(car(arglist));
    num2 = GET_NUMBER(cadr(arglist));
    
    if(num1 < num2)
        return(T);
    else
        return(NIL);
}
Beispiel #4
0
int f_eqgreater(int arglist){
	int num1,num2;
    
    checkarg(LEN2_TEST, ">=", arglist);
    checkarg(NUMLIST_TEST, ">=", arglist);
    num1 = GET_NUMBER(car(arglist));
    num2 = GET_NUMBER(cadr(arglist));
    
    if(num1 >= num2)
    	return(makeT());
    else
    	return(makeNIL());
}    
Beispiel #5
0
int f_div(int arglist){
    int arg,res;
    
    checkarg(NUMLIST_TEST, "/", arglist);
    res = GET_NUMBER(car(arglist));
    arglist = cdr(arglist);
    while(!(IS_NIL(arglist))){
        arg = GET_NUMBER(car(arglist));
        arglist = cdr(arglist);
        res = res / arg;
    }
    return(makenum(res));
}  
Beispiel #6
0
int f_numeqp(int arglist){
    int num1,num2;
    
    checkarg(LEN2_TEST, "=", arglist);
    checkarg(NUMLIST_TEST, "=", arglist);
    num1 = GET_NUMBER(car(arglist));
    num2 = GET_NUMBER(cadr(arglist));
    
    if(num1 == num2)
        return(T);
    else
        return(NIL);
}
Beispiel #7
0
int eval(int addr){
        int res;
    
    if(atomp(addr)){
                if(IS_NUMBER(addr))
                return(addr);
        if(IS_SYMBOL(addr)){
                res = findsym(GET_NAME(addr));
            switch(GET_TAG(res)){
                case NUM:       return(makenum(GET_NUMBER(res)));
                case SYM:       return(GET_BIND(res));
                case LIS:       return(GET_BIND(res));
            }
        }
    }
    else{
    if(HAS_NAME(car(addr),"quote"))
        return(cadr(addr));
    if(subrp(car(addr)))
        return(apply(symname(car(addr)),evlis(cdr(addr))));
    if(fsubrp(car(addr)))
        return(apply(symname(car(addr)),cdr(addr)));
    if(lambdap(car(addr)))
        return(apply(symname(car(addr)),evlis(cdr(addr))));
    }
    return(NIL);
}
Beispiel #8
0
int f_dump(int arglist){
        int arg1;
    
    arg1 = GET_NUMBER(car(arglist));
        dump(arg1,arg1+10);
    return(0);
}
Beispiel #9
0
//deep-bindによる。シンボルが見つからなかったら登録。
//見つかったらそこに値をいれておく。
void bindsym(int symaddr, int valaddr){
        int addr,num;
    char *name;
    
    name = symname(symaddr);
    if((addr=findsym(name)) == NIL){
        addr = freshcell();
        SET_NAME(addr,name);
        SET_CDR(addr,E);
        E = addr;
    }
    switch(GET_TAG(valaddr)){
                case NUM: {     SET_TAG(addr,NUM);
                                num = GET_NUMBER(valaddr);
                    SET_NUMBER(addr,num);
                    break; }
        case SYM: {     SET_TAG(addr,SYM);
                                name = GET_NAME(valaddr);
                                SET_NAME(addr,name);
                                break; }
        case LIS: {     SET_TAG(addr,LIS);
                                SET_BIND(addr,valaddr);
                                break; }
    }
}
Beispiel #10
0
int rtsp_fillStreamMenu(interfaceMenu_t *pMenu, void* pArg)
{
	int which;
	//int position = 0;
	char *str;

	which = GET_NUMBER(pArg);

	interface_clearMenuEntries((interfaceMenu_t*)&rtspStreamMenu);

	str = _T("SEARCHING_MOVIES");
	interface_addMenuEntryDisabled((interfaceMenu_t*)&rtspStreamMenu, str, thumbnail_search);

	collectFlag++;

	if( collectThread == 0)
	{
		pthread_create(&collectThread, NULL, rtsp_list_updater, SET_NUMBER(which));
		pthread_detach(collectThread);
	}

	interface_setSelectedItem((interfaceMenu_t*)&rtspStreamMenu, MENU_ITEM_MAIN);

	interface_menuActionShowMenu(pMenu, (void*)&rtspStreamMenu);

	return 0;
}
Beispiel #11
0
void print(int addr){    
        switch(GET_TAG(addr)){
        case NUM:       printf("%d", GET_NUMBER(addr)); break;
        case SYM:       printf("%s", GET_NAME(addr)); break;
        case LIS: {     printf("(");
                                printlist(addr); break;}
    }
}       
Beispiel #12
0
/**
 * putChar
 */
JSValueRef putCharForJSBuffer (JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    BUFFER(buffer);
    ARGCOUNTMIN(1);
    GET_JSARRAY(0, values, values_size);
    if (values != nullptr) {
        GET_NUMBER(1,index);
        CHECK_SIZE_AND_GROW(sizeof(char),(index + values_size - 1));
        SET_JSVALUES_AS_PRIMITIVE(char, index, values, values_size);
    } else {
        GET_CHAR(0,value);
        GET_NUMBER(1,index);
        CHECK_SIZE_AND_GROW(sizeof(char),index);
        PRIMITIVE_SET(char,index);
    }
    return object;
}
Beispiel #13
0
int f_argstkdump(int arglist){
	int arg1;
    
    checkarg(LEN1_TEST, "hdmp", arglist);
    arg1 = GET_NUMBER(car(arglist));
	argstkdump(arg1,arg1+10);
    return(makeT());
}
Beispiel #14
0
/**
 * growChar
 */
JSValueRef growCharForJSBuffer (JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    BUFFER(buffer);
    ARGCOUNTMIN(1);
    GET_NUMBER(0,count);
    CHECK_SIZE_AND_GROW(sizeof(char),(count-1));
    return object;
}
Beispiel #15
0
/**
 * toLongLong
 */
JSValueRef toLongLongForJSBuffer (JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    BUFFER(buffer);
    PRIMITIVE_GET_ARRAY(long long);
    GET_NUMBER(0,index);
    long long v = value[(size_t)index];
    return JSValueMakeNumber(ctx, v);
}
Beispiel #16
0
int f_heapdump(int arglist){
    int arg1;
    
    checkarg(LEN1_TEST, "hdmp", arglist);
    arg1 = GET_NUMBER(car(arglist));
    heapdump(arg1,arg1+10);
    return(T);
}
Beispiel #17
0
/**
 * grow
 */
JSValueRef growForJSBuffer (JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    BUFFER(buffer);
    ARGCOUNTMIN(1);
    GET_NUMBER(0,length);
    CHECK_SIZE_AND_GROW(length, 0);
    return object;
}
Beispiel #18
0
/**
 * toBool
 */
JSValueRef toBoolForJSBuffer (JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    BUFFER(buffer);
    PRIMITIVE_GET_ARRAY(bool);
    GET_NUMBER(0,index);
    bool v = value[(size_t)index];
    return JSValueMakeBoolean(ctx,v);
}
Beispiel #19
0
static int rtsp_setChannelFromURL(interfaceMenu_t *pMenu, const char *value, const char* description, const char* thumbnail, void* pArg)
{
	int which = GET_NUMBER(pArg);
	int res;
	rtsp_stream_info sinfo;
	url_desc_t url;

	if( value == NULL )
		return 1;

	strcpy(rtsp_lasturl, value);

	memset(&sinfo, 0, sizeof(rtsp_stream_info));

	if ((res = parseURL(value, &url)) != 0)
	{
		interface_showMessageBox(_T("ERR_INCORRECT_URL"), thumbnail_error, 0);
		return -1;
	}

	if (url.protocol != mediaProtoRTSP)
	{
		interface_showMessageBox(_T("ERR_INCORRECT_PROTO"), thumbnail_error, 0);
		return -1;
	}

	inet_addr_prepare(url.address);
	if (inet_addr(url.address) == INADDR_NONE || inet_addr(url.address) == INADDR_ANY)
	{
		struct hostent * h = gethostbyname(url.address);
		if (!h){
			interface_showMessageBox(_T("ERR_INCORRECT_IP"), thumbnail_error, 0);
			return -1;
		}
		strcpy(url.address, inet_ntoa(*(struct in_addr*)h->h_addr));
		//eprintf ("%s: %s\n", __FUNCTION__, url.address);
	}

	strcpy(sinfo.ip, url.address);
	sinfo.port = url.port;
	strcpy(sinfo.streamname, url.stream);
	sinfo.custom_url = 1;
	memcpy(&stream_info, &sinfo, sizeof(rtsp_stream_info));

	if( !description )
		snprintf(appControlInfo.playbackInfo.description, sizeof(appControlInfo.playbackInfo.description),
			"%s: rtsp://%s:%d/%s", _T("MOVIE"), stream_info.ip, stream_info.port, stream_info.streamname);
	else
		strcpy(appControlInfo.playbackInfo.description, description);
	if( !thumbnail )
		appControlInfo.playbackInfo.thumbnail[0] = 0;
	else
		strcpy(appControlInfo.playbackInfo.thumbnail, thumbnail);

	dprintf("%s: Change to %s\n", __FUNCTION__, sinfo.streamname);

	return rtsp_stream_change(pMenu, CHANNEL_INFO_SET(which, CHANNEL_CUSTOM));
}
Beispiel #20
0
int f_regsetq(int arglist){
    int arg1,arg2;
    
    checkarg(LEN2_TEST, "regsetq", arglist);
    checkarg(SYMBOL_TEST, "regsetq", car(arglist));
    arg1 = car(arglist);
    arg2 = cadr(arglist);
    if(HAS_NAME(arg1,"H"))
    	H = GET_NUMBER(arg2);
    else 
    if(HAS_NAME(arg1,"E"))
    	E = GET_NUMBER(arg2);
    else
    if(HAS_NAME(arg1,"F"))
    	F = GET_NUMBER(arg2);
    else
    if(HAS_NAME(arg1,"S"))
        S = GET_NUMBER(arg2);
    else
    if(HAS_NAME(arg1,"C"))
        C = GET_NUMBER(arg2);
    else
    if(HAS_NAME(arg1,"A"))
        A = GET_NUMBER(arg2);
    else
    if(HAS_NAME(arg1,"P"))
        P = GET_NUMBER(arg2);
    
    return(makeT());
}
Beispiel #21
0
static LispObject ToRad(LispObject args)
{
    double r;
    
    CHECK_NUMBER(args);
    r = GET_NUMBER(args);
    r = M_PI / 180.0 * r;
    return MakeFloat(r);
}
Beispiel #22
0
static LispObject ToDeg(LispObject args)
{
    double r;
    
    CHECK_NUMBER(args);
    r = GET_NUMBER(args);
    r = 180.0 / M_PI * r;
    return MakeFloat(r);
}
Beispiel #23
0
//要デバグ。replが落ちてしまう。
int f_error(int arglist){
        int arg1;
    
    switch(GET_NUMBER(car(arglist))){
        case EVAL_ERR:  printf("eval error\n"); break;
        case ARG_ERR:   printf("arg error\n"); break;
    }
    longjmp(buf,0);
}
Beispiel #24
0
/**
 * slice
 */
JSValueRef sliceForJSBuffer (JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    BUFFER(buffer);
    MIN_SIZE(2);
    GET_NUMBER(0,index);
    GET_NUMBER(1,length);
    if (length > buffer->length)
    {
        JSStringRef string = JSStringCreateWithUTF8CString("length requested is greater than internal buffer length");
        JSValueRef message = JSValueMakeString(ctx, string);
        JSStringRelease(string);
        *exception = JSObjectMakeError(ctx, 1, &message, 0);
        return JSValueMakeUndefined(ctx);
    }
    if ((int)index >= buffer->length || (int)index < 0)
    {
        JSStringRef string = JSStringCreateWithUTF8CString("index requested is invalid");
        JSValueRef message = JSValueMakeString(ctx, string);
        JSStringRelease(string);
        *exception = JSObjectMakeError(ctx, 1, &message, 0);
        return JSValueMakeUndefined(ctx);
    }
    if (buffer->type!=JSBufferTypePointer)
    {
        JSStringRef string = JSStringCreateWithUTF8CString("cannot slice a non-pointer buffer");
        JSValueRef message = JSValueMakeString(ctx, string);
        JSStringRelease(string);
        *exception = JSObjectMakeError(ctx, 1, &message, 0);
        return JSValueMakeUndefined(ctx);
    }

	throw ref new Exception(0, "JSBuffer's sliceForJSBuffer has not been implemented on Windows yet.");
    /*void *memory = malloc(length);
    void *start = &(buffer->buffer[(int)index]);
    memcpy(memory,start,length);
    JSBuffer *newbuffer = (JSBuffer *)malloc(sizeof(JSBuffer));
    newbuffer->buffer = memory;
    newbuffer->length = length;
    newbuffer->type = JSBufferTypePointer;

    return MakeObjectForJSBuffer(ctx,newbuffer);*/
}
Beispiel #25
0
static void *rtsp_list_updater(void *pArg)
{
	int i;
	int which;
	int sleepTime = 1;

	which = GET_NUMBER(pArg);

	while (collectFlag)
	{
		interface_showLoadingAnimation();

		dprintf("%s: rtsp_list_updater: collecting/waiting\n", __FUNCTION__);

		i = 0;
		while (i++ < sleepTime*10)
		{
			if (collectFlag)
			{
				usleep(100000);
			} else
			{
				dprintf("%s: stop waiting\n", __FUNCTION__);
				interface_hideLoadingAnimation();
				break;
			}
		}

		if (collectFlag)
		{
			get_rtsp_streams(ppstream_head);

			if(ppstream_head == NULL)
			{
				collectFlag--;
			} else
			{
				collectFlag = 0;
			}

			interface_hideLoadingAnimation();

			rtsp_displayStreamMenu(SET_NUMBER(which));

			sleepTime = 2;
		}
	}

	collectThread = 0;

	dprintf("%s: exit normal\n", __FUNCTION__);

	return NULL;
}
Beispiel #26
0
int f_oddp(int arglist){
	int arg;
    
    checkarg(LEN1_TEST, "oddp", arglist);
    checkarg(NUMBER_TEST, "oddp", car(arglist));
    arg = GET_NUMBER(car(arglist));
    if((arg % 2) == 1)
    	return(T);
    else
    	return(NIL);
}
Beispiel #27
0
/**
 * toChar
 */
JSValueRef toCharForJSBuffer (JSContextRef ctx, JSObjectRef function, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
    BUFFER(buffer);
    PRIMITIVE_GET_ARRAY(char);
    GET_NUMBER(0,index);
    JSChar buf[1];
    buf[0] = (JSChar)value[(size_t)index];
    JSStringRef stringRef = JSStringCreateWithCharacters(buf, 1);
    JSValueRef result = JSValueMakeString(ctx,stringRef);
    JSStringRelease(stringRef);
    return result;
}
Beispiel #28
0
//-----print------------------
void print(int addr){    
    switch(GET_TAG(addr)){
        case NUM:   printf("%d", GET_NUMBER(addr)); break;
        case SYM:   printf("%s", GET_NAME(addr)); break;
        case SUBR:  printf("<subr>"); break;
        case FSUBR: printf("<fsubr>"); break;
        case FUNC:  printf("<function>"); break;
        case LIS: { printf("(");
                    printlist(addr); break;}
        default:    printf("<undef>"); break;
    }
}   
Beispiel #29
0
//デバッグ用    
void cellprint(int addr){
        switch(GET_TAG(addr)){
        case EMP:       printf("EMP "); break;
        case NUM:       printf("NUM "); break;
        case SYM:       printf("SYM "); break;
        case LIS:       printf("LIS "); break;
        case FUN:       printf("FUN "); break;
    }
    printf("name=%s ", GET_NAME(addr));
    printf("car=%d ", GET_CAR(addr));
    printf("cdr=%d ", GET_CDR(addr));
    printf("num=%d ", GET_NUMBER(addr));
    printf("bind=&d ", GET_BIND(addr));
    printf("subr=%d\n", heap[addr].subr);
}   
Beispiel #30
0
static int rtsp_displayStreamMenu(void* pArg)
{
	char channelEntry[MENU_ENTRY_INFO_LENGTH];
	streams_struct* stream_ptr=NULL;
	int which = GET_NUMBER(pArg);
	interfaceMenu_t *rtspMenu = (interfaceMenu_t*)&rtspStreamMenu;

	interface_clearMenuEntries(rtspMenu);
	interface_showLoadingAnimation();

	int streamNumber = 0;
	for (stream_ptr = pstream_head; stream_ptr != NULL; stream_ptr = stream_ptr->next)
	{
		sprintf(channelEntry, "%d: %s", streamNumber+1, stream_ptr->name ? stream_ptr->name : stream_ptr->stream);

		int entryIndex = interface_addMenuEntry(rtspMenu, channelEntry, rtsp_stream_change, CHANNEL_INFO_SET(which, streamNumber), thumbnail_vod) - 1;
		interface_setMenuEntryImage(rtspMenu, entryIndex, stream_ptr->thumb);
		//dprintf("%s: Compare current %s\n", __FUNCTION__, channelEntry);
		if ( strcmp(stream_info.ip, appControlInfo.rtspInfo.streamIP) == 0 && 
		     strcmp(stream_info.streamname, stream_ptr->stream) == 0 )
		{
			interface_setSelectedItem(rtspMenu, streamNumber);
		}
		streamNumber++;
	}

	if (streamNumber == 0)
	{
		char *str;
		str = _T("NO_MOVIES");
		interface_addMenuEntryDisabled(rtspMenu, str, thumbnail_info);
	}

	interface_hideLoadingAnimation();
	interface_displayMenu(1);

	return 0;
}