void fxWriteBreakpoints(txMachine* the) { char *breakpoints; FskFile fref = NULL; txSlot *aBreakpoint = NULL; FskInt64 size = 0; FskECMAScriptGetDebug(NULL, &breakpoints, NULL); if ((NULL == breakpoints) || (0 == *breakpoints)) goto bail; FskFileCreate(breakpoints); if (kFskErrNone != FskFileOpen(breakpoints, kFskFilePermissionReadWrite, &fref)) goto bail; if (kFskErrNone != FskFileSetSize(fref, &size)) goto bail; while (true) { char aPath[1024], aLine[32]; aBreakpoint = fxGetNextBreakpoint(the, aBreakpoint, aPath, aLine); if (NULL == aBreakpoint) break; FskFileWrite(fref, FskStrLen(aPath), (void *)aPath, NULL); FskFileWrite(fref, 1, (void *)"\t", NULL); FskFileWrite(fref, FskStrLen(aLine), (void *)aLine, NULL); FskFileWrite(fref, 1, (void *)"\n", NULL); } bail: FskFileClose(fref); }
void KPR_system_set_backGesture(xsMachine *the) { FskErr err = kFskErrNone; char* path = NULL; char* pathName = NULL; FskFile file = NULL; char* data = xsToString(xsArg(0)); xsIntegerValue size = FskStrLen(data); #if MINITV pathName = TOUCHD_CONF; // system("/etc/init.d/touchd.sh stop"); #else bailIfError(FskDirectoryGetSpecialPath(kFskDirectorySpecialTypeApplicationPreference, true, NULL, &path)); pathName = FskStrDoCat(path, "touchd.conf"); bailIfNULL(pathName); #endif err = FskFileOpen(pathName, kFskFilePermissionReadWrite, &file); if (kFskErrFileNotFound == err) { bailIfError(FskFileCreate(pathName)); err = FskFileOpen(pathName, kFskFilePermissionReadWrite, &file); } else { FskInt64 zero = 0; err = FskFileSetSize(file, &zero); } bailIfError(err); bailIfError(FskFileWrite(file, size, data, NULL)); bail: FskFileClose(file); #if MINITV int pipe = open(TOUCH_PIPE, O_WRONLY | O_NONBLOCK); if (pipe >= 0) { char data = 1; write(pipe, &data, 1); close(pipe); } // system("/etc/init.d/touchd.sh start"); #endif if (path) { FskMemPtrDispose(path); FskMemPtrDispose(pathName); } xsThrowIfFskErr(err); }