Esempio n. 1
0
static bool opt_workspace_frame(Tokenizer *tokz, int n, Token *toks)
{
	WRectangle geom;
	int id;
	WFrame *frame;
	
	if(!check_splits(tokz, toks[1].line))
		return FALSE;
	
	id=TOK_LONG_VAL(&(toks[1]));
	geom=get_geom();
	
	frame=create_frame(current_screen, geom, id, 0);
	
	if(frame==NULL)
		return FALSE;
	
	if(current_split==NULL)
		current_ws->splitree=(WObj*)frame;
	else if(current_split->tl==NULL)
		current_split->tl=(WObj*)frame;
	else
		current_split->br=(WObj*)frame;
	
	frame->win.split=current_split;

	add_workspace_window(current_ws, (WWindow*)frame);
	
	return TRUE;
}
Esempio n. 2
0
static bool test3_fn(Tokenizer *tokz, int n, Token *toks)
{
    if(n<=2)
        printf("test3_fn() %d \"%s\"\n", n, TOK_STRING_VAL(toks+1));
    else
        printf("test3_fn() %d \"%s\" %ld\n", n, TOK_STRING_VAL(toks+1), TOK_LONG_VAL(toks+2));

    return TRUE;
}
Esempio n. 3
0
static bool opt_workspace_split(int dir, Tokenizer *tokz, int n, Token *toks)
{
	WRectangle geom;
	WWsSplit *split;
	int brs, tls;
	int w, h;
	
	if(!check_splits(tokz, toks[1].line))
		return FALSE;
	   
	tls=TOK_LONG_VAL(&(toks[1]));
	brs=TOK_LONG_VAL(&(toks[2]));
	
	geom=get_geom();
	
	if(dir==HORIZONTAL)
		tls=geom.w*tls/(tls+brs);
	else
		tls=geom.h*tls/(tls+brs);
	
	split=create_split(dir, NULL, NULL, geom);
	
	if(split==NULL)
		return FALSE;
		
	split->tmpsize=tls;
	
	if(current_split==NULL)
		current_ws->splitree=(WObj*)split;
	else if(current_split->tl==NULL)
		current_split->tl=(WObj*)split;
	else
		current_split->br=(WObj*)split;
	
	split->parent=current_split;
	
	current_split=split;
	
	return TRUE;
}
Esempio n. 4
0
int main(int argc, char *argv[])
{
	Tokenizer*tokz;
	Token tok=TOK_INIT;
	
	libtu_init(argv[0]);
	
	if(!(tokz=tokz_open_file(stdin, "stdin")))
		return EXIT_FAILURE;

	while(tokz_get_token(tokz, &tok)){
		switch(tok.type){
		case TOK_LONG:
			printf("long - %ld\n", TOK_LONG_VAL(&tok));
			break;
		case TOK_DOUBLE:
			printf("double - %g\n", TOK_DOUBLE_VAL(&tok));
			break;
		case TOK_CHAR:
			printf("char - '%c'\n", TOK_CHAR_VAL(&tok));
			break;
		case TOK_STRING:
			printf("string - \"%s\"\n", TOK_STRING_VAL(&tok));
			break;
		case TOK_IDENT:
			printf("ident - %s\n", TOK_IDENT_VAL(&tok));
			break;
		case TOK_COMMENT:
			printf("comment - %s\n", TOK_COMMENT_VAL(&tok));
			break;
		case TOK_OP:
			printf("operator - %03x\n", TOK_OP_VAL(&tok));
			break;
		}
	}
	   
	return EXIT_SUCCESS;
}