static void writetiff_(const char * fname, int sx, int sy, int sz, uint8_t * img, int Bpp, WICPixelFormatGUID pixfmt, enum WICTiffCompressionOption compression) { IWICBitmapEncoder *encoder; IWICBitmapFrameEncode *frame; IWICStream *stream; IPropertyBag2 *props; const unsigned plane_stride_bytes = Bpp*sx*sy; init(); CALL(factory,CreateEncoder,&GUID_ContainerFormatTiff,NULL,&encoder); CALL(factory,CreateStream,&stream); //CopyFileA(fname,"backup.tmp",FALSE); CALL(stream,InitializeFromFilename,wide(fname),GENERIC_WRITE); CALL(encoder,Initialize,(IStream*)stream,WICBitmapEncoderNoCache); { for(int z=0;z<sz;++z,img+=plane_stride_bytes){ CALL(encoder,CreateNewFrame,&frame,&props); { /* Set properties: See Note (1) below */ PROPBAG2 option={0}; VARIANT v; VariantInit(&v); v.vt = VT_UI1; v.bVal = compression; option.pstrName=L"TiffCompressionMethod"; CALL(props,Write,1,&option,&v); } CALL(frame,Initialize,props); CALL(frame,SetSize,sx,sy); { /* Some pixel formats don't work. */ WICPixelFormatGUID fmt = pixfmt; CALL(frame, SetPixelFormat, &fmt); /* might coerce the requested pixel format */ WARN(IsEqualGUID(&fmt,&pixfmt)); } CALL(frame,WritePixels,sy,sx*Bpp,plane_stride_bytes,(BYTE*)img); CALL0(frame,Commit); }} CALL0(encoder,Commit); RELEASE(frame); RELEASE(stream); RELEASE(encoder); //DeleteFileA("backup.tmp"); Error:; //CopyFileA("backup.tmp",fname,FALSE); //DeleteFileA("backup.tmp"); exit(-1); }
void CALLBACK timer_callback (UINT uTimerId,UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) { // printf("--> TIMER START\n"); fflush(stdout); GC_process_hook(DLL_THREAD_ATTACH); CALL0((P)dwUser); GC_process_hook(DLL_THREAD_DETACH); // printf("<-- TIMER END\n"); fflush(stdout); }
int tas_supported_mixers(void) { CALL0(supported_mixers); }
int tas_leave_sleep(void) { CALL0(leave_sleep); }
int tas_enter_sleep(void) { CALL0(enter_sleep); }
int tas_post_init(void) { CALL0(post_init); }
int tas_stereo_mixers(void) { CALL0(stereo_mixers); }
#include "Process.class.h" #include <TaskManager/Task.ns.h> #include <Process.iface.h> #include <UserManager/Usr.ns.h> #include <VirtualTerminal.iface.h> #include <SyscallManager/Res.ns.h> #define ISPARENT Task::currProcess()->getPid() == m_ppid call_t Process::m_callTable[] = { CALL0(PRIF_EXIT, &Process::exitSC), CALL2(PRIF_ALLOCPAGES, &Process::allocPagesSC), CALL2(PRIF_FREEPAGES, &Process::freePagesSC), CALL0(PRIF_GETPID, &Process::getPid), CALL0(PRIF_GETPPID, &Process::getPpid), CALL0(PRIF_GETUID, &Process::getUid), CALL0(PRIF_ARGC, &Process::argcSC), CALL1(PRIF_ARGV, &Process::argvSC), CALL0(PRIF_START, &Process::startSC), CALL1(PRIF_AUTODELETE, &Process::autoDeleteSC), CALL1(PRIF_PUSHARG, &Process::pushArgSC), CALL1(PRIF_SETOUTVT, &Process::setOutVTSC), CALL1(PRIF_SETINVT, &Process::setInVTSC), CALL2(PRIF_AUTHPW, &Process::authPWSC), CALL1(PRIF_AUTHNOPW, &Process::authNoPWSC), CALL0(0, 0) }; u32int Process::scall(u8int wat, u32int a, u32int b, u32int c, u32int d) { if (wat == PRIF_SGETCPR) return Task::currProcess()->resId(); if (wat == PRIF_SRUN) {
#include "FSNode.proto.h" #include <VFS/VFS.ns.h> #include <SyscallManager/Res.ns.h> #include <UserManager/Usr.ns.h> #include <TaskManager/Task.ns.h> call_t FSNode::m_callTable[] = { CALL0(FNIF_GETNAME, &FSNode::getNameSC), CALL0(FNIF_TYPE, &FSNode::typeSC), CALL0(FNIF_GETPARENT, &FSNode::getParentSC), CALL0(FNIF_GETLENGTH, &FSNode::getLengthSC), CALL0(FNIF_GETUID, &FSNode::getUid), CALL0(FNIF_GETGID, &FSNode::getGid), CALL0(FNIF_GETPERM, &FSNode::getPermissions), CALL0(FNIF_GETPATH, &FSNode::getPathSC), CALL0(FNIF_SETCWD, &FSNode::setCwdSC), CALL0(FNIF_REMOVE, &FSNode::removeSC), CALL0(0, 0) }; u32int FSNode::scall(u8int wat, u32int a, u32int b, u32int c, u32int d) { if (wat == FNIF_SGETRFN) return VFS::getRootNode()->resId(); if (wat == FNIF_SGETCWD) return Task::currProcess()->getCwd()->resId(); if (wat == FNIF_SFIND) { String* path = (String*)a; FSNode* n; if (b == 0) { n = VFS::find(*path); } else { n = VFS::find(*path, Res::get<DirectoryNode>(b, FNIF_OBJTYPE)); }