Exemple #1
0
void TEPty::setWriteable(bool writeable)
{
    struct stat sbuf;
    stat(pty()->ttyName(), &sbuf);
    if(writeable)
        chmod(pty()->ttyName(), sbuf.st_mode | S_IWGRP);
    else
        chmod(pty()->ttyName(), sbuf.st_mode & ~(S_IWGRP | S_IWOTH));
}
Exemple #2
0
static
Value *
_pow(const Ast *expr) {
	Ast *op1 = expr->child;
	Ast *op2 = expr->child->next;

	Value *v1 = eval(op1);
	Value *v2 = eval(op2);
	Value *rval = v1;

	switch(expr->eval_type) {
	case T_INT:
		value_set_int(rval, pow(NATIVE_NUMBER(v1),  NATIVE_NUMBER(v2)));
		break;
	case T_FLOAT:
		value_set_float(rval, powf(NATIVE_NUMBER(v1),  NATIVE_NUMBER(v2)));
		break;
	default:
		pty(expr->eval_type);
		assert(false);
	}
	value_free(v2);

	return rval;
}
Exemple #3
0
static
Value *
_add(const Ast *expr) {
	Ast *op1 = expr->child;
	Ast *op2 = expr->child->next;

	Value *v1 = eval(op1);
	Value *v2 = eval(op2);
	Value *rval = v1;

	switch(expr->eval_type) {
	case T_INT:
		value_set_int(rval, NATIVE_NUMBER(v1) + NATIVE_NUMBER(v2));
		break;
	case T_FLOAT:
		value_set_float(rval, NATIVE_NUMBER(v1) + NATIVE_NUMBER(v2));
		break;
	case T_STRING:
		// TODO String concat?
	default:
		pty(expr->eval_type);
		assert(false);
	}
	value_free(v2);

	return rval;
}
Exemple #4
0
void TEPty::setErase(char erase)
{
    struct termios tios;
    int fd = pty()->slaveFd();

    if(tcgetattr(fd, &tios))
    {
        qWarning("Uh oh.. can't get terminal attributes..");
        return;
    }
    tios.c_cc[VERASE] = erase;
    if(tcsetattr(fd, TCSANOW, &tios))
        qWarning("Uh oh.. can't set terminal attributes..");
}
Exemple #5
0
static
Value *
_mod(const Ast *expr) {
	Ast *op1 = expr->child;
	Ast *op2 = expr->child->next;

	Value *v1 = eval(op1);
	Value *v2 = eval(op2);
	Value *rval = v1;

	switch(expr->eval_type) {
	case T_INT:
		value_set_int(rval, v1->as_int % v2->as_int);
		break;
	default:
		pty(expr->eval_type);
		assert(false);
	}
	value_free(v2);

	return rval;
}
Exemple #6
0
void TEPty::setSize(int lines, int cols)
{
    pty()->setWinSize(lines, cols);
}
Exemple #7
0
void TEPty::useUtf8(bool on)
{
    pty()->setUtf8Mode(on);
}
Exemple #8
0
void TEPty::setXonXoff(bool on)
{
    pty()->setXonXoff(on);
}