static inline M* HANDLE (Handle<Value>v) {
    if (v->IsNull()) {
        ThrowException(String::New("Handle is NULL"));
        return NULL;
    }
    return (M *) JSEXTERN(v);
}
Beispiel #2
0
static inline STATE* log_HANDLE (Handle<Value>v) {
    if (v->IsNull()) {
        ThrowException(String::New("Handle is NULL"));
        return NULL;
    }
    STATE *state = (STATE *) JSEXTERN(v);
    return state;
}
Beispiel #3
0
static JSVAL popen_puts (JSARGS args) {
    HandleScope scope;
    FILE *fp = (FILE *) JSEXTERN(args[0]);
    String::Utf8Value s(args[1]->ToString());
    if (fputs(*s, fp) == EOF) {
        return scope.Close(False());
    }
    return scope.Close(True());
}
Beispiel #4
0
static JSVAL popen_close (JSARGS args) {
    HandleScope scope;
    FILE *fp = (FILE *) JSEXTERN(args[0]);
#ifdef WIN32
	fclose(fp);
#else
    pclose(fp);
#endif
    return Undefined();
}
Beispiel #5
0
static JSVAL popen_gets (JSARGS args) {
    HandleScope scope;
    FILE *fp = (FILE *) JSEXTERN(args[0]);
    int size = 4096;
    if (args.Length() > 1) {
        size = args[1]->IntegerValue();
    }
    char *buf = new char[size];
    char *result = fgets(buf, size, fp);
    if (!result) {
        delete [] buf;
        return scope.Close(False());
    }
    Handle<String>s = String::New(buf);
    delete [] buf;
    return scope.Close(s);
}
Beispiel #6
0
static SFTP *HANDLE (Handle<Value> arg) {
    return (SFTP *) JSEXTERN(arg);
}
Beispiel #7
0
static SSH2 *HANDLE(Handle<Value> arg) {
	return (SSH2 *)JSEXTERN(arg);
}