Exemplo n.º 1
0
void
cairo_destroy (cairo_t *cr)
{
  cairo_destroy_t orig = (cairo_destroy_t)getfn("cairo_destroy");
  fprintf(stderr, "cairo_destroy(%p)\n", cr);
  if(!orig || !cr || orig==&cairo_destroy) {
    fprintf(stderr, "  oops! %p %p\n", orig, cr);
    return;
  }
  (*orig)(cr);
}
Exemplo n.º 2
0
void
cairo_set_operator (cairo_t *cr, cairo_operator_t op)
{
  cairo_set_operator_t orig = (cairo_set_operator_t)getfn("cairo_set_operator");
  fprintf(stderr, "cairo_set_operator(%p, %d)\n", cr, op);
  if(!orig || !cr || orig==&cairo_set_operator) {
    fprintf(stderr, "  oops! %p %p\n", orig, cr);
    return;
  }
  (*orig)(cr, op);
}
Exemplo n.º 3
0
void object_attr_getvalueof(t_object *x, t_symbol *s, long *argc, t_atom **argv)
{
    char realname[MAXPDSTRING];
	method getvalue = NULL;
    sprintf(realname, "get%s", s->s_name);
    argc[0] = 0;
    argv[0] = NULL;
    getvalue = (method)getfn((t_pd *)x, gensym(realname));
    if(getvalue)
        getvalue(x, s, argc, argv);
}
Exemplo n.º 4
0
void eobj_attr_getvalueof(void *x, t_symbol *s, int *argc, t_atom **argv)
{
    char realname[MAXPDSTRING];
    t_typ_method getvalue = NULL;
    sprintf(realname, "get%s", s->s_name);
    argc[0] = 0;
    argv[0] = NULL;
    getvalue = (t_typ_method)getfn((t_pd *)x, gensym(realname));
    if(getvalue)
    {
        getvalue(x, s, argc, argv);
    }
}
Exemplo n.º 5
0
cairo_t *
cairo_create (cairo_surface_t *target)
{
  cairo_t *ret;
  cairo_create_t orig = (cairo_create_t)getfn("cairo_create");
  if(!orig || !target || orig==&cairo_create) {
    fprintf(stderr, "  oops! %p %p\n", orig, target);
    return NULL;
  }
  ret = (*orig)(target);
  fprintf(stderr, "cairo_create(%p) = %p\n", target, ret);
  return ret;
}
Exemplo n.º 6
0
static action_t cont_apply_apply() {
  ref_t func = C(cont)->val[0], args = expr;
  ref_t formals = getformals(func);
  size_t arity = getarity(func);
  C(cont)->closure = getclosure(func);
  for(; arity > 0; arity--, formals = cdr(formals), args = cdr(args))
    bind(car(formals), car(args));
  if (!isnil(formals))
    bind(car(formals), args);
  init_vals(cont);
  if (isbuiltin(func)) {
    getfn(func)();
    pop_cont();
  }
  else
    eval_do(getbody(func));
  return ACTION_APPLY_CONT;
}
Exemplo n.º 7
0
void eobj_attr_setvalueof(void *x, t_symbol* s, int argc, t_atom *argv)
{
    t_typ_method setvalue = (t_typ_method)getfn((t_pd *)x, s);
    setvalue(x, s, argc, argv);
}
Exemplo n.º 8
0
string State::toString()
{
	// formats string
	stringstream retstring;
	retstring << "State Position = (" << x << ", " << y << "), g(n)=" << gn << ", h(n)=" << hn << ", f(n)=" << getfn() << ", Parent=" << ((parent==-1)?"NULL--":"Value--") << ((parent != -1)? AI::closed[parent]->getx():0) << ", " << ((parent != -1)? AI::closed[parent]->gety():0);
	return retstring.str();
}
Exemplo n.º 9
0
int executeCommand(char* command, char* param1, char* param2)
{
	int (*func)(param1, param2) = getfn(command);
  	(*func)(param1, param2);
	return 0;
}
Exemplo n.º 10
0
void object_method(void* x, t_symbol* s, void* z, t_typ_method method, long number, void* other)
{
    t_ret_method nrmethod = (t_ret_method)getfn((t_pd *)x, s);
    nrmethod(x, s, z, method, number, other);
}
Exemplo n.º 11
0
int main( int argc, char *argv[])
{
  
	/* Begin declaration of variables */
	
	char s0[SLEN], s1[SLEN],s2[SLEN],strfn[SLEN];
	
	char s3[SLEN];
	
	char q,qq;
	
	int j,j0,j1;
	FILE *fin, *fout;
	

	q='\'';
	qq='\"';


	if( argc != 3)
	{
		goto hell;
	}
	
	
	
	/* create a string that has relative address to input file*/
	
	sprintf(s0,"./%s",argv[1]);


	sprintf(s3,"./%s",argv[2]);
	
	fin = fopen( s0, "r");	


	fout = fopen( s3,"w");
	
	

	fprintf(fout,"#EXTM3U\n");
	
	while (  fgets(s1,bsize,fin) != NULL  )
	{
		
		removeNL(s1);
		
		sprintf(strfn, "%s",&s1[getfn(s1)] ); 
		
		sprintf(s2,"%c%s%c",qq,s1,qq);
	  
	  
		fprintf(fout,"#EXTINF:1234,%s\n",strfn);

		fprintf(fout,"%s\n",s1);
	
		
	}
	
	fclose(fout);
	fclose(fin);

	return EXIT_SUCCESS;
	
	hell:
	
	return EXIT_FAILURE;
}
Exemplo n.º 12
0
void* object_method(void* x, t_symbol* s, void* z, method method, long number, void* other)
{
    rmethod nrmethod = (rmethod)getfn((t_pd *)x, s);
    return nrmethod(x, s, z, method, number, other);
}
Exemplo n.º 13
0
void object_attr_setvalueof(t_object *x, t_symbol* s, long argc, t_atom* argv)
{
    method setvalue = (method)getfn((t_pd *)x, s);
    setvalue(x, s, argc, argv);
}
Exemplo n.º 14
0
int exec_cmd(int under_glob, int under_until)
	{
	register int status;
	register char *p;
	int n;

	if((status = getrange()) <= ERROR)
		return( status );
	status = ERROR9;

	switch( *lp++ ) {

	case 'i':
		laddr2 = prevln(laddr2);

	case 'a':
		status = append(laddr2, under_glob);
		break;

	case 'b':
			if(!under_glob  &&  !under_until)
				status = branch();
		break;

	case 'c':
		if((status = delete(laddr1, laddr2, SAVE)) == OK)
			status = append(prevln(laddr1), under_glob);
		break;

	case 'd':
		if((status = delete(laddr1, laddr2, SAVE)) == OK && nextln(curln) != 0)
			curln = nextln(curln);
		break;

	case 'e':
		if(lastln  &&  dirty  &&  *lp != 'e') {
			status = ERROR4;
			break;
			}

		if(*lp == 'e')
			++lp;

		if(nladdrs == 0  &&  !under_glob  &&  !under_until  &&
			(status = getfn()) == OK) {
			set_fn(curfile, lp);
			if(lastln != 0)
				delete(1, lastln, NOSAVE);
			num_delete_lines = 0;
			if((status = _read( lp, 0, 0)) == OK) {
				dirty = 0;
				if(lastln)
					curln = 1;
				}
			}
		lp = "\n";
		break;

	case 'f':
		if(nladdrs == 0  &&  (status = getfn()) == OK) {
			set_fn(curfile, lp);
			putmsg(curfile);
			lp = "\n";
			}
		change_state(CMD);
		break;

	case 'g':
		if(!under_glob) {
			if(*lp == '^') {
				++lp;
				n = 0;
				}
			else
				n = 1;
			status = exec_glob(n, under_until);
			}
		break;

	case 'h':
		n = getint();
#ifndef __STDC__
		while(n--)
			for(n1 = 0; n1 < 10; ++n1)
				time_slice();
#endif
		status = OK;
		break;

	case 'j':
		status = join(laddr2);
		break;

	case 'k':
		if((status = get_laddr_expr(&n)) == OK)
			status = kopy(n);
		break;

	case 'l':
		if(nladdrs == 0)
			status = learn();
		break;

	case 'm':
		if((status = get_laddr_expr(&n)) == OK)
			status = move(n);
		break;

	case 'o':
		status = option();
		break;

	case 'p':
	case 'P':
		status = prnt(laddr1, laddr2);
		break;

	case 'q':
		if(nladdrs==0 && !under_glob) {
			if((*lp=='\n' && !dirty) || *lp=='q'  ||  lastln == 0)
				status = EOF;
			else
				status = ERROR4;
		}
		break;

	case 'r':
		if(!under_glob  &&  !under_until  &&  (status = getfn()) == OK)
			status = _read(lp, laddr2, 0);
		lp = "\n";
		break;

	case 's':
		n = getint(); /* read occurance if present */
		if((status=getpat()) == OK  &&  (status=getsubst_str(tbuff)) == OK)
			status = substitute(tbuff, under_glob, n);
		break;

	case 't':
	case 'T':
		if(nladdrs == 0)
			status = translate(*(lp - 1) == 't');
		break;

	case 'u':
		status = until(laddr1, laddr2, under_glob);
		break;

	case 'v':
		if(nladdrs <= 1)
			status = view(laddr1);
		break;

	case 'w':
		n = 0;
		if(*lp == 'w') {
			n |= 2;
			++lp;
			}
		if(*lp == 'a') {
			n |= 1;
			++lp;
			}

		if((status = getfn()) == OK) {
			if(nladdrs == 0) {
				if(curfile[0] == '\0')
					set_fn(curfile, lp);
				else {
					if((n & 2) == 0  &&  strcmp(curfile, lp) != 0) {
						for(p = lp ; *p ; ++p)
							if(*p == '$')
								goto ok;
						puterr(-19);
						lp = "\n";
						break;
						}
					}
				ok:
				if((status = _write(lp, 1, lastln, n & 1, 0)) == OK)
					dirty = 0;
				}
			} else {
				status = _write(lp, laddr1, laddr2, n & 1, 0);
			}
		lp = "\n";
		break;

    case 'x':
		if(!under_glob  &&  !under_until  &&  (status = getfn()) == OK)
			if(nladdrs == 0)
				status = exec_file(lp, under_glob, under_until);
		lp = "\n";
		break;

	case 'y':
		status = yut();
		break;

	case 'z':
		status = zap();
		break;

	case '\n':
		--lp; /* put back newline for main */
		if(laddr2 < 0  ||  laddr2 > lastln)
			status = lastln ? ERROR5 : OK;
		else {
			curln = laddr2;
			status = OK;
			}
		break;

	case ' ':
	case '\t':
	case CMD_CHAR:
		status = OK;
		break;

	case '=':
		dtoc(rbuff, laddr2);
		if(under_glob)
			prnt_screen(rbuff, 1);
		else
			putmsg(rbuff);
		status = OK;
		break;

	case '"':
		lp = "\n";	/* Ignore rest of line */
		status = OK;
		break;

	case '!':
		if(escape_char == 0  ||  restrict_flag) {
			putmsg("Escape from ED inhibited");
			status = NOTHING;
			}
		else
			status = exec_sys_cmd(under_glob, under_until);
		break;

	default:
		status = ERROR2;
		}
	return(status);
	}