/* ** Query the database for all TICKET fields for the specific ** ticket whose name is given by the "name" CGI parameter. ** Load the values for all fields into the interpreter. ** ** Only load those fields which do not already exist as ** variables. ** ** Fields of the TICKET table that begin with "private_" are ** expanded using the db_reveal() function. If g.okRdAddr is ** true, then the db_reveal() function will decode the content ** using the CONCEALED table so that the content legable. ** Otherwise, db_reveal() is a no-op and the content remains ** obscured. */ static void initializeVariablesFromDb(void){ const char *zName; Stmt q; int i, n, size, j; zName = PD("name","-none-"); db_prepare(&q, "SELECT datetime(tkt_mtime) AS tkt_datetime, *" " FROM ticket WHERE tkt_uuid GLOB '%q*'", zName); if( db_step(&q)==SQLITE_ROW ){ n = db_column_count(&q); for(i=0; i<n; i++){ const char *zVal = db_column_text(&q, i); const char *zName = db_column_name(&q, i); char *zRevealed = 0; if( zVal==0 ){ zVal = ""; }else if( strncmp(zName, "private_", 8)==0 ){ zVal = zRevealed = db_reveal(zVal); } for(j=0; j<nField; j++){ if( strcmp(azField[j],zName)==0 ){ azValue[j] = mprintf("%s", zVal); break; } } if( Th_Fetch(zName, &size)==0 ){ Th_Store(zName, zVal); } free(zRevealed); } }else{ db_finalize(&q); db_prepare(&q, "PRAGMA table_info(ticket)"); if( Th_Fetch("tkt_uuid",&size)==0 ){ Th_Store("tkt_uuid",zName); } while( db_step(&q)==SQLITE_ROW ){ const char *zField = db_column_text(&q, 1); if( Th_Fetch(zField, &size)==0 ){ Th_Store(zField, ""); } } if( Th_Fetch("tkt_datetime",&size)==0 ){ Th_Store("tkt_datetime",""); } } db_finalize(&q); }
int main() { int res; DIR *dir; int fd; dir = opendir("dir1"); assert(dir); fd = dirfd(dir); res = fchdir(fd); PD(res); system("ls -ld ."); return 0; }
HRESULT Mesh::LoadTextures() { HRESULT hr; for( UINT i = 0; i < mNumMaterials; i++ ) { if ( mMaterials[i].pTextureFilename ) { CHAR* filename_c = mMaterials[i].pTextureFilename; DWORD length = MultiByteToWideChar( CP_ACP, 0, filename_c, -1, NULL, 0 ); WCHAR* filename_w = new WCHAR[length]; MultiByteToWideChar( CP_ACP, 0, filename_c, -1, filename_w, length ); WCHAR filepathrel[120]; WCHAR filepath[120]; Concat( filepathrel, GetDirectory(), filename_w ); AppendToRootDir(filepath, filepathrel); OutputDebugString( L"texture specified for material:\n" ); OutputDebugString( filepath ); OutputDebugString( L"\n" ); IDirect3DTexture9* texture; hr = D3DXCreateTextureFromFileEx( mDevice, filepath, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &texture ); PD( hr, L"create texture from file" ); if( FAILED(hr) ) return hr; mTextures.push_back( texture ); hasTextures = true; delete [] filename_w; } else { OutputDebugString( L"no texture specified for material\n" ); mTextures.push_back( NULL ); } } return D3D_OK; }
HRESULT DirectXMesh::SaveMeshToFile(const WCHAR* filename) { HRESULT hr; DWORD dwFormat = D3DXF_FILEFORMAT_TEXT; DWORD numFaces = mMesh->GetNumFaces(); PD(L"number of faces: ", numFaces); PD(L"number of vertices: ", mMesh->GetNumVertices()); DWORD* pAdjacency = new DWORD[numFaces * 3]; hr = mMesh->GenerateAdjacency(1e-6f, pAdjacency); PD(hr, L"generate adjacency"); if(FAILED(hr)) return hr; DWORD dwNumMeshes = 0; hr = mMesh->GetAttributeTable( NULL, &dwNumMeshes ); PD(hr, L"get number of meshes"); if(FAILED(hr)) return hr; PD(L"number of meshes: ", dwNumMeshes); D3DXMATERIAL* materials = new D3DXMATERIAL[dwNumMeshes]; for(int i = 0; i < dwNumMeshes; ++i) { materials[i].MatD3D.Ambient = D3DXCOLOR(0.0f, 0.0f, 0.0f, 0.0f); materials[i].MatD3D.Specular = D3DXCOLOR(0.0f, 0.0f, 0.0f, 0.0f); materials[i].MatD3D.Emissive = D3DXCOLOR(0.0f, 0.0f, 0.0f, 0.0f); materials[i].MatD3D.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 0.0f); materials[i].pTextureFilename = NULL; } PD(L"save mesh with #vertices: ", mMesh->GetNumVertices()); PD(L"save mesh with #faces: ", mMesh->GetNumFaces()); hr = D3DXSaveMeshToX(filename, mMesh, pAdjacency, materials, NULL, dwNumMeshes, dwFormat); PD(hr, L"save mesh to file"); PD(hr); delete [] pAdjacency; return hr; }
int main() { int res; int fd; ssize_t size; fd = open("in", O_RDWR); assert(fd >= 0); res = lseek(fd, 100, SEEK_END); PD(res); size = write(fd, "mao", 3); PL(size); close(fd); return 0; }
/* * Calculate PLL output frequency */ static uint32_t calc_pll(uint32_t pllreg, uint32_t base_freq) { int32_t mfn = MFN(pllreg); /* Numerator */ uint32_t mfi = MFI(pllreg); /* Integer part */ uint32_t mfd = 1 + MFD(pllreg); /* Denominator */ uint32_t pd = 1 + PD(pllreg); /* Pre-divider */ if (mfi < 5) { mfi = 5; } /* mfn is 10-bit signed twos-complement */ mfn <<= 32 - 10; mfn >>= 32 - 10; return ((2 * (base_freq >> 10) * (mfi * mfd + mfn)) / (mfd * pd)) << 10; }
int main() { int fd; off_t ofset; int res; int fd1; fd = open("in", O_RDWR); assert(fd >= 0); fd1 = dup(fd); PD(fd1); write(fd1, "mao", 3); close(fd1); assert(close(fd) == 0); return 0; }
/** * proto_add_announce_hook - connect protocol to a routing table * @p: protocol instance * @t: routing table to connect to * @stats: per-table protocol statistics * * This function creates a connection between the protocol instance @p * and the routing table @t, making the protocol hear all changes in * the table. * * The announce hook is linked in the protocol ahook list and, if the * protocol accepts routes, also in the table ahook list. Announce * hooks are allocated from the routing table resource pool, they are * unlinked from the table ahook list after the protocol went down, * (in proto_schedule_flush()) and they are automatically freed after the * protocol is flushed (in proto_fell_down()). * * Unless you want to listen to multiple routing tables (as the Pipe * protocol does), you needn't to worry about this function since the * connection to the protocol's primary routing table is initialized * automatically by the core code. */ struct announce_hook * proto_add_announce_hook(struct proto *p, struct rtable *t, struct proto_stats *stats) { struct announce_hook *h; DBG("Connecting protocol %s to table %s\n", p->name, t->name); PD(p, "Connected to table %s", t->name); h = mb_allocz(rt_table_pool, sizeof(struct announce_hook)); h->table = t; h->proto = p; h->stats = stats; h->next = p->ahooks; p->ahooks = h; if (p->rt_notify) add_tail(&t->hooks, &h->n); return h; }
int main() { FILE *fp; int res; size_t size; char buf[128]; fp = fopen("in", "r+"); assert(fp); res = fseek(fp, 1, SEEK_SET); PD(res); size = fread(buf, 1, 1, fp); PUL(size); PC(buf[0]); fclose(fp); return 0; }
int main() { QTemporaryFile file; file.setFileTemplate(file.fileTemplate() + ".jpg"); const int N = 100; for(int j = 0 ; j < N ; j++) { file.open(); QImage img(800, 600, QImage::Format_RGB32); img.save(&file); file.close(); QString address = file.fileName(); cv::Mat image = cv::imread(address.toStdString(),0); PD_Classifier_VEC.push_back(image); } while (!PD_Classifier_VEC.empty()) PD(); cv::waitKey(); return 0; }
void InterpolatorKNN::CalculateBaryzentricCoordinates(NNCandidate candidates[3], Vertex v) { D3DXVECTOR3 v_01 = Normalize(candidates[1].vertex.pos-candidates[0].vertex.pos); D3DXVECTOR3 v_02 = Normalize(candidates[2].vertex.pos-candidates[0].vertex.pos); // project v onto plane <v_01, v_02> with hesse normal form D3DXVECTOR3 normal = Normalize(CrossProd(v_01, v_02)); D3DXVECTOR3 pointOnPlane = candidates[0].vertex.pos; float d = DotProd(normal, pointOnPlane); float distance = DotProd(normal, v.pos) - d; v.pos = v.pos + distance * (-normal); float translate = 0.0f; if(v.pos.x == 0 && v.pos.y == 0 && v.pos.z == 0) { translate = 10; } candidates[0].vertex.pos.x += translate; candidates[1].vertex.pos.x += translate; candidates[2].vertex.pos.x += translate; v.pos.x += translate; D3DXVECTOR3 res = SolveLES( candidates[0].vertex.pos, candidates[1].vertex.pos, candidates[2].vertex.pos, v.pos); candidates[0].weight = res.x; candidates[1].weight = res.y; candidates[2].weight = res.z; D3DXVECTOR3 check = candidates[0].weight * candidates[0].vertex.pos + candidates[1].weight * candidates[1].vertex.pos + candidates[2].weight * candidates[2].vertex.pos - v.pos; float error = abs(check.x) + abs(check.y) + abs(check.z); if(error > 0.00001) { PD(L"big error solving lgs: ", error); } }
void pagetable_init(uint64_t max_addr, uint32_t kernel_end) { uint32_t i; page_table_area = kernel_end; memset((uint8_t *)page_table_area, 0, PT_NUM_PAGES(max_addr) * PAGE_SIZE); printk("page_table_area: 0x%lx\n", page_table_area); printk("page_table_end: 0x%lx\n", page_table_area + PT_NUM_PAGES(max_addr) * PAGE_SIZE); /* direct map all but the zero page in the page tables */ for (i = 1; i < NUM_PTES(max_addr); i++ ) { struct dw *pt = (struct dw *)PT(i); pt->lo = PTE(i) | ENTRY_RW | ENTRY_PRESENT; } /* set up the page directories */ for (i = 0; i < NUM_PTPGS(max_addr); i++) { struct dw *pd = (struct dw *)PD(i); pd->lo = PDE(i) | ENTRY_RW | ENTRY_PRESENT; } /* set up the pdp's */ for (i = 0; i < NUM_PDPGS(max_addr); i++) { struct dw *pdp = (struct dw *)PDP(i); pdp->lo = PDPE(i) | ENTRY_RW | ENTRY_PRESENT; } /* set up the pml4 */ for (i = 0; i < NUM_PDPPGS(max_addr); i++) { struct dw *pml4 = (struct dw *)PML4(i); pml4->lo = PML4E(i) | ENTRY_RW | ENTRY_PRESENT; } walk_pagetable(max_addr); to64_prep_paging(PML4(0)); //return PML4(0); }
PD operator+(const PD &a, const PD &b) { return PD(a.XX+b.XX, a.YY+b.YY); }
HRESULT XFileCreator::CreateMesh(std::vector<Vertex> vertices, std::vector<Face> faces) { HRESULT hr; DWORD numFaces = faces.size(); DWORD numVertices = vertices.size(); PD(L"number of vertices: ", numVertices); PD(L"number of faces: ", numFaces); D3DVERTEXELEMENT9 localVertDecl[MAX_FVF_DECL_SIZE] = { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0}, D3DDECL_END() }; hr = D3DXCreateMesh(numFaces, numVertices, D3DXMESH_MANAGED | D3DXMESH_32BIT, localVertDecl, mDevice, &mMesh); PD(hr, L"create mesh"); if(FAILED(hr)) return hr; LOCAL_VERTEX *pVertices = NULL; hr = mMesh->LockVertexBuffer(0, (void**)&pVertices); PD(hr, L"lock vertex buffer"); if(FAILED(hr)) return hr; for ( DWORD i = 0; i < numVertices; ++i ) { pVertices[i].pos = D3DXVECTOR3(vertices[i].pos.x, vertices[i].pos.y, vertices[i].pos.z); } hr = mMesh->UnlockVertexBuffer(); PD(hr, L"unlock vertex buffer"); if(FAILED(hr)) return hr; DWORD* pIndices = NULL; hr = mMesh->LockIndexBuffer(0, (void**)&pIndices); PD(hr, L"lock index buffer"); if(FAILED(hr)) return hr; for ( DWORD i = 0; i < numFaces; i++ ) { pIndices[3 * i] = faces[i].vertices[0]; pIndices[3 * i + 1] = faces[i].vertices[1]; pIndices[3 * i + 2] = faces[i].vertices[2]; } hr = mMesh->UnlockIndexBuffer(); PD(hr, L"unlock index buffer"); if(FAILED(hr)) return hr; DWORD* pAdjacency = new DWORD[numFaces * 3]; hr = mMesh->GenerateAdjacency(1e-6f, pAdjacency); PD(hr, L"generate adjacency"); if(FAILED(hr)) return hr; hr = D3DXComputeNormals(mMesh, pAdjacency); PD(hr, L"compute normals"); if(FAILED(hr)) return hr; delete [] pAdjacency; return D3D_OK; }
/* ** WEBPAGE: doc ** URL: /doc?name=BASELINE/PATH ** URL: /doc/BASELINE/PATH ** ** BASELINE can be either a baseline uuid prefix or magic words "tip" ** to mean the most recently checked in baseline or "ckout" to mean the ** content of the local checkout, if any. PATH is the relative pathname ** of some file. This method returns the file content. ** ** If PATH matches the patterns *.wiki or *.txt then formatting content ** is added before returning the file. For all other names, the content ** is returned straight without any interpretation or processing. */ void doc_page(void){ const char *zName; /* Argument to the /doc page */ const char *zMime; /* Document MIME type */ int vid = 0; /* Artifact of baseline */ int rid = 0; /* Artifact of file */ int i; /* Loop counter */ Blob filebody; /* Content of the documentation file */ char zBaseline[UUID_SIZE+1]; /* Baseline UUID */ login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } zName = PD("name", "tip/index.wiki"); for(i=0; zName[i] && zName[i]!='/'; i++){} if( zName[i]==0 || i>UUID_SIZE ){ zName = "index.html"; goto doc_not_found; } memcpy(zBaseline, zName, i); zBaseline[i] = 0; zName += i; while( zName[0]=='/' ){ zName++; } if( !file_is_simple_pathname(zName) ){ int n = strlen(zName); if( n>0 && zName[n-1]=='/' ){ zName = mprintf("%sindex.html", zName); if( !file_is_simple_pathname(zName) ){ goto doc_not_found; } }else{ goto doc_not_found; } } if( fossil_strcmp(zBaseline,"ckout")==0 && db_open_local()==0 ){ sqlite3_snprintf(sizeof(zBaseline), zBaseline, "tip"); } if( fossil_strcmp(zBaseline,"ckout")==0 ){ /* Read from the local checkout */ char *zFullpath; db_must_be_within_tree(); zFullpath = mprintf("%s/%s", g.zLocalRoot, zName); if( !file_isfile(zFullpath) ){ goto doc_not_found; } if( blob_read_from_file(&filebody, zFullpath)<0 ){ goto doc_not_found; } }else{ db_begin_transaction(); if( fossil_strcmp(zBaseline,"tip")==0 ){ vid = db_int(0, "SELECT objid FROM event WHERE type='ci'" " ORDER BY mtime DESC LIMIT 1"); }else{ vid = name_to_typed_rid(zBaseline, "ci"); } /* Create the baseline cache if it does not already exist */ db_multi_exec( "CREATE TABLE IF NOT EXISTS vcache(\n" " vid INTEGER, -- baseline ID\n" " fname TEXT, -- filename\n" " rid INTEGER, -- artifact ID\n" " UNIQUE(vid,fname,rid)\n" ")" ); /* Check to see if the documentation file artifact ID is contained ** in the baseline cache */ rid = db_int(0, "SELECT rid FROM vcache" " WHERE vid=%d AND fname=%Q", vid, zName); if( rid==0 && db_exists("SELECT 1 FROM vcache WHERE vid=%d", vid) ){ goto doc_not_found; } if( rid==0 ){ Stmt s; Manifest *pM; ManifestFile *pFile; /* Add the vid baseline to the cache */ if( db_int(0, "SELECT count(*) FROM vcache")>10000 ){ db_multi_exec("DELETE FROM vcache"); } pM = manifest_get(vid, CFTYPE_MANIFEST); if( pM==0 ){ goto doc_not_found; } db_prepare(&s, "INSERT INTO vcache(vid,fname,rid)" " SELECT %d, :fname, rid FROM blob" " WHERE uuid=:uuid", vid ); manifest_file_rewind(pM); while( (pFile = manifest_file_next(pM,0))!=0 ){ db_bind_text(&s, ":fname", pFile->zName); db_bind_text(&s, ":uuid", pFile->zUuid); db_step(&s); db_reset(&s); } db_finalize(&s); manifest_destroy(pM); /* Try again to find the file */ rid = db_int(0, "SELECT rid FROM vcache" " WHERE vid=%d AND fname=%Q", vid, zName); } if( rid==0 ){ goto doc_not_found; } /* Get the file content */ if( content_get(rid, &filebody)==0 ){ goto doc_not_found; } db_end_transaction(0); } /* The file is now contained in the filebody blob. Deliver the ** file to the user */ zMime = P("mimetype"); if( zMime==0 ){ zMime = mimetype_from_name(zName); } Th_Store("doc_name", zName); Th_Store("doc_version", db_text(0, "SELECT '[' || substr(uuid,1,10) || ']'" " FROM blob WHERE rid=%d", vid)); Th_Store("doc_date", db_text(0, "SELECT datetime(mtime) FROM event" " WHERE objid=%d AND type='ci'", vid)); if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ Blob title, tail; if( wiki_find_title(&filebody, &title, &tail) ){ style_header(blob_str(&title)); wiki_convert(&tail, 0, 0); }else{ style_header("Documentation"); wiki_convert(&filebody, 0, 0); } style_footer(); }else if( fossil_strcmp(zMime, "text/plain")==0 ){ style_header("Documentation"); @ <blockquote><pre>
/** \fn dumpx265Setup */ void dumpx265Setup(x265_param *param) { #define PI(x) printf(#x"\t:%d\n",(int)param->x) #define PD(x) printf(#x"\t:%d\n",(double)param->x) #define PS(x) printf(#x"\t:%s\n",param->x) printf("*************************************\n"); printf("*** Encoder Environment ***\n"); printf("*************************************\n"); PI(cpuid); PI(bEnableWavefront); #if X265_BUILD >= 47 PS(numaPools); #else PI(poolNumThreads); #endif PI(frameNumThreads); PI(logLevel); PI(bLogCuStats); PI(bEnablePsnr); PI(bEnableSsim); PI(decodedPictureHashSEI); printf("*************************************\n"); printf("** Internal Picture Specification **\n"); printf("*************************************\n"); PI(internalBitDepth); PI(internalCsp); PI(fpsNum); PI(fpsDenom); PI(sourceWidth); PI(sourceHeight); PI(levelIdc); PI(interlaceMode); PI(bRepeatHeaders); PI(bEnableAccessUnitDelimiters); PI(bEmitHRDSEI); printf("*************************************\n"); printf("*** Coding Unit (CU) Definitions ***\n"); printf("*************************************\n"); PI(maxCUSize); PI(tuQTMaxInterDepth); PI(tuQTMaxIntraDepth); printf("*************************************\n"); printf("*** GOP Structure and Lookahead ***\n"); printf("*************************************\n"); PI(bOpenGOP); PI(keyframeMin); PI(keyframeMax); PI(maxNumReferences); PI(bFrameAdaptive); PI(bframes); PI(bBPyramid); PI(lookaheadDepth); PI(bFrameBias); PI(scenecutThreshold); printf("*************************************\n"); printf("*** Intra Coding Tools ***\n"); printf("*************************************\n"); PI(bEnableConstrainedIntra); PI(bEnableStrongIntraSmoothing); printf("*************************************\n"); printf("*** Inter Coding Tools ***\n"); printf("*************************************\n"); PI(searchMethod); PI(subpelRefine); PI(searchRange); PI(maxNumMergeCand); PI(bEnableWeightedPred); PI(bEnableWeightedBiPred); printf("*************************************\n"); printf("*** Analysis Tools ***\n"); printf("*************************************\n"); PI(bEnableAMP); PI(bEnableRectInter); #if X265_BUILD < 45 PI(bEnableCbfFastMode); #endif PI(bEnableEarlySkip); PI(rdPenalty); PI(rdLevel); PD(psyRd); printf("*************************************\n"); printf("*** Coding Tools ***\n"); printf("*************************************\n"); PI(bEnableSignHiding); PI(bEnableTransformSkip); PI(bEnableTSkipFast); PI(bEnableLoopFilter); PI(bEnableSAO); #if X265_BUILD >= 33 PI(bSaoNonDeblocked); #else PI(saoLcuBoundary); #endif #if X265_BUILD < 32 PI(saoLcuBasedOptimization); #endif PI(cbQpOffset); PI(crQpOffset); PI(bIntraInBFrames); #if X265_BUILD >= 40 PI(noiseReductionIntra); PI(noiseReductionInter); #else PI(noiseReduction); #endif PI(bLossless); PI(bCULossless); #define RI(x) printf(#x"\t:%d\n",(int)param->rc.x) #define RD(x) printf(#x"\t:%f\n",(double)param->rc.x) printf("*************************************\n"); printf("*** Rate Control ***\n"); printf("*************************************\n"); RI(rateControlMode); RI(qp); RI(bitrate); #if X265_BUILD >= 41 RI(bStrictCbr); #else RD(rateTolerance); #endif RD(qCompress); RD(ipFactor); RD(pbFactor); RI(qpStep); RD(rfConstant); RI(aqMode); RD(aqStrength); RI(vbvMaxBitrate); RI(vbvBufferSize); RD(vbvBufferInit); RI(cuTree); RD(rfConstantMax); RD(rfConstantMin); RI(bStatWrite); RI(bStatRead); RD(qblur); RD(complexityBlur); #define VI(x) printf(#x"\t:%d\n",(int)param->vui.x) printf("*************************************\n"); printf("*** Video Usability Information ***\n"); printf("*************************************\n"); VI(aspectRatioIdc); VI(sarWidth); VI(sarHeight); VI(bEnableOverscanInfoPresentFlag); VI(bEnableOverscanAppropriateFlag); VI(bEnableVideoSignalTypePresentFlag); VI(videoFormat); VI(bEnableVideoFullRangeFlag); VI(bEnableColorDescriptionPresentFlag); VI(colorPrimaries); VI(transferCharacteristics); VI(matrixCoeffs); VI(bEnableChromaLocInfoPresentFlag); VI(chromaSampleLocTypeTopField); VI(chromaSampleLocTypeBottomField); VI(bEnableDefaultDisplayWindowFlag); VI(defDispWinLeftOffset); VI(defDispWinRightOffset); VI(defDispWinTopOffset); VI(defDispWinBottomOffset); }
/* ** WEBPAGE: tktview ** URL: tktview?name=UUID ** ** View a ticket. */ void tktview_page(void){ const char *zScript; char *zFullName; const char *zUuid = PD("name",""); login_check_credentials(); if( !g.perm.RdTkt ){ login_needed(); return; } if( g.perm.WrTkt || g.perm.ApndTkt ){ style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T", g.zTop, PD("name","")); } if( g.perm.History ){ style_submenu_element("History", "History Of This Ticket", "%s/tkthistory/%T", g.zTop, zUuid); style_submenu_element("Timeline", "Timeline Of This Ticket", "%s/tkttimeline/%T", g.zTop, zUuid); style_submenu_element("Check-ins", "Check-ins Of This Ticket", "%s/tkttimeline/%T?y=ci", g.zTop, zUuid); } if( g.perm.NewTkt ){ style_submenu_element("New Ticket", "Create a new ticket", "%s/tktnew", g.zTop); } if( g.perm.ApndTkt && g.perm.Attach ){ style_submenu_element("Attach", "Add An Attachment", "%s/attachadd?tkt=%T&from=%s/tktview/%t", g.zTop, zUuid, g.zTop, zUuid); } style_header("View Ticket"); if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW<br />\n", -1); ticket_init(); initializeVariablesFromDb(); zScript = ticket_viewpage_code(); if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW_SCRIPT<br />\n", -1); Th_Render(zScript); if( g.thTrace ) Th_Trace("END_TKTVIEW<br />\n", -1); zFullName = db_text(0, "SELECT tkt_uuid FROM ticket" " WHERE tkt_uuid GLOB '%q*'", zUuid); if( zFullName ){ int cnt = 0; Stmt q; db_prepare(&q, "SELECT datetime(mtime,'localtime'), filename, user" " FROM attachment" " WHERE isLatest AND src!='' AND target=%Q" " ORDER BY mtime DESC", zFullName); while( db_step(&q)==SQLITE_ROW ){ const char *zDate = db_column_text(&q, 0); const char *zFile = db_column_text(&q, 1); const char *zUser = db_column_text(&q, 2); if( cnt==0 ){ @ <hr /><h2>Attachments:</h2> @ <ul> } cnt++; @ <li> if( g.perm.Read && g.perm.History ){ @ <a href="%s(g.zTop)/attachview?tkt=%s(zFullName)&file=%t(zFile)"> @ %h(zFile)</a> }else{ @ %h(zFile) } @ added by %h(zUser) on hyperlink_to_date(zDate, "."); if( g.perm.WrTkt && g.perm.Attach ){ @ [<a href="%s(g.zTop)/attachdelete?tkt=%s(zFullName)&file=%t(zFile)&from=%s(g.zTop)/tktview%%3fname=%s(zFullName)">delete</a>] }
struct platform_device *__init at32_add_device_eth(unsigned int id, struct eth_platform_data *data) { struct platform_device *pdev; switch (id) { case 0: pdev = &macb0_device; select_peripheral(PC(3), PERIPH_A, 0); /* TXD0 */ select_peripheral(PC(4), PERIPH_A, 0); /* TXD1 */ select_peripheral(PC(7), PERIPH_A, 0); /* TXEN */ select_peripheral(PC(8), PERIPH_A, 0); /* TXCK */ select_peripheral(PC(9), PERIPH_A, 0); /* RXD0 */ select_peripheral(PC(10), PERIPH_A, 0); /* RXD1 */ select_peripheral(PC(13), PERIPH_A, 0); /* RXER */ select_peripheral(PC(15), PERIPH_A, 0); /* RXDV */ select_peripheral(PC(16), PERIPH_A, 0); /* MDC */ select_peripheral(PC(17), PERIPH_A, 0); /* MDIO */ if (!data->is_rmii) { select_peripheral(PC(0), PERIPH_A, 0); /* COL */ select_peripheral(PC(1), PERIPH_A, 0); /* CRS */ select_peripheral(PC(2), PERIPH_A, 0); /* TXER */ select_peripheral(PC(5), PERIPH_A, 0); /* TXD2 */ select_peripheral(PC(6), PERIPH_A, 0); /* TXD3 */ select_peripheral(PC(11), PERIPH_A, 0); /* RXD2 */ select_peripheral(PC(12), PERIPH_A, 0); /* RXD3 */ select_peripheral(PC(14), PERIPH_A, 0); /* RXCK */ select_peripheral(PC(18), PERIPH_A, 0); /* SPD */ } break; case 1: pdev = &macb1_device; select_peripheral(PD(13), PERIPH_B, 0); /* TXD0 */ select_peripheral(PD(14), PERIPH_B, 0); /* TXD1 */ select_peripheral(PD(11), PERIPH_B, 0); /* TXEN */ select_peripheral(PD(12), PERIPH_B, 0); /* TXCK */ select_peripheral(PD(10), PERIPH_B, 0); /* RXD0 */ select_peripheral(PD(6), PERIPH_B, 0); /* RXD1 */ select_peripheral(PD(5), PERIPH_B, 0); /* RXER */ select_peripheral(PD(4), PERIPH_B, 0); /* RXDV */ select_peripheral(PD(3), PERIPH_B, 0); /* MDC */ select_peripheral(PD(2), PERIPH_B, 0); /* MDIO */ if (!data->is_rmii) { select_peripheral(PC(19), PERIPH_B, 0); /* COL */ select_peripheral(PC(23), PERIPH_B, 0); /* CRS */ select_peripheral(PC(26), PERIPH_B, 0); /* TXER */ select_peripheral(PC(27), PERIPH_B, 0); /* TXD2 */ select_peripheral(PC(28), PERIPH_B, 0); /* TXD3 */ select_peripheral(PC(29), PERIPH_B, 0); /* RXD2 */ select_peripheral(PC(30), PERIPH_B, 0); /* RXD3 */ select_peripheral(PC(24), PERIPH_B, 0); /* RXCK */ select_peripheral(PD(15), PERIPH_B, 0); /* SPD */ } break; default: return NULL; } memcpy(pdev->dev.platform_data, data, sizeof(struct eth_platform_data)); platform_device_register(pdev); return pdev; }
void InterpolatorTopology::GetInterpolationWeight(NNCandidate candidates[3], int* indices, float* weights, Vertex v) { Vertex* vertices = mApproxMesh->GetVertices(); DWORD* faces = mApproxMesh->GetFaces(); vector<DWORD>* vertexFaceAdjazency = mApproxMesh->GetVertexFaceAdjazency(); Vertex bestMatch = candidates[0].vertex; DWORD indexOfBestMatch = candidates[0].index; vector<DWORD> adjazentFaces = vertexFaceAdjazency[indexOfBestMatch]; Vertex faceVertices[3]; float maxDotProd = -2.0f; DWORD indexOfBestTriangle = 0; for(int i=0; i<adjazentFaces.size(); ++i) { DWORD face = adjazentFaces[i]; faceVertices[0] = vertices[faces[face*3+0]]; faceVertices[1] = vertices[faces[face*3+1]]; faceVertices[2] = vertices[faces[face*3+2]]; D3DXVECTOR3 faceNormal = Normalize(faceVertices[0].normal + faceVertices[1].normal + faceVertices[2].normal); if(DotProd(v.normal, faceNormal) > maxDotProd) { maxDotProd = DotProd(v.normal, faceNormal); indexOfBestTriangle = face; } } for(int i=0; i<3; ++i){ DWORD index = faces[indexOfBestTriangle*3+i]; indices[i] = index; faceVertices[i] = vertices[index]; } D3DXVECTOR3 v01 = Normalize(faceVertices[1].pos-faceVertices[0].pos); D3DXVECTOR3 v02 = Normalize(faceVertices[2].pos-faceVertices[0].pos); if(abs(DotProd(v01,v02))>0.999f){ PD(L"warning vectors spanning triangle might be linear dependent"); } // project v onto plane <v01, v02> with hesse normal form D3DXVECTOR3 normal = Normalize(CrossProd(v01, v02)); D3DXVECTOR3 pointOnPlane = faceVertices[0].pos; float d = DotProd(normal, pointOnPlane); float distance = DotProd(normal, v.pos) - d; v.pos = v.pos + distance * (-normal); // assure that v.pos != (0,0,0) float translate = 0.0f; if(v.pos.x == 0 && v.pos.y == 0 && v.pos.z == 0) { PD(L"translate les points to aviod trivial solution"); translate = 10; } faceVertices[0].pos.x += translate; faceVertices[1].pos.x += translate; faceVertices[2].pos.x += translate; v.pos.x += translate; D3DXVECTOR3 result = SolveLES(faceVertices[0].pos, faceVertices[1].pos, faceVertices[2].pos, v.pos); //check if solution is correct D3DXVECTOR3 check = result.x * faceVertices[0].pos + result.y * faceVertices[1].pos + result.z * faceVertices[2].pos - v.pos; float error = abs(check.x) + abs(check.y) + abs(check.z); if(error > 0.00001) { PD(L"big error solving lgs: ", error); } weights[0] = result.x; weights[1] = result.y; weights[2] = result.z; }
static void SetValue(ST_PACKHEAD *head, ST_PACK *pack,int ids,const char *data,int len = -1) { long lv; double dv; #define PC(a) do{ \ if(len == -1 || len < sizeof(pack->a)) len = sizeof(pack->a);\ SetParmBit(head,ids);\ strncpy((char *)pack->a,data,len);\ pack->a[sizeof(pack->a)-1]=0;\ }while(0) #define PI(a) do{ SetParmBit(head,ids);lv=atol(data);memcpy(&pack->a,&lv,sizeof(pack->a));}while(0)//INT #define PD(a) do{ SetParmBit(head,ids);dv=atof(data);memcpy(&pack->a,&dv,sizeof(pack->a));}while(0)//LONG switch(ids) { case F_SCUST_NO: PC(scust_no); break; case F_SCUST_NO2: PC(scust_no2); break; case F_SHOLDER_AC_NO: PC(sholder_ac_no); break; case F_SHOLDER_AC_NO2: PC(sholder_ac_no2); break; case F_SHOLDER_TYPE: PC(sholder_type); break; case F_SHOLDER_TYPE2: PC(sholder_type2); break; case F_SNAME: PC(sname); break; case F_SNAME2: PC(sname2); break; case F_SALL_NAME: PC(sall_name); break; case F_SMARKET_CODE: PC(smarket_code); break; case F_SMARKET_CODE2: PC(smarket_code2); break; case F_SDATE0: PC(sdate0); break; case F_SDATE1: PC(sdate1); break; case F_SDATE2: PC(sdate2); break; case F_SDATE3: PC(sdate3); break; case F_STIME0: PC(stime0); break; case F_STIME1: PC(stime1); break; case F_STIME2: PC(stime2); break; case F_STIME3: PC(stime3); break; case F_LVOL0: PI(lvol0); break; case F_LVOL1: PI(lvol1); break; case F_LVOL2: PI(lvol2); break; case F_LVOL3: PI(lvol3); break; case F_LVOL4: PI(lvol4); break; case F_LVOL5: PI(lvol5); break; case F_LVOL6: PI(lvol6); break; case F_LVOL7: PI(lvol7); break; case F_LVOL8: PI(lvol8); break; case F_LVOL9: PI(lvol9); break; case F_LVOL10: PI(lvol10); break; case F_LVOL11: PI(lvol11); break; case F_LVOL12: PI(lvol12); break; case F_DAMT0: PD(damt0); break; case F_DAMT1: PD(damt1); break; case F_DAMT2: PD(damt2); break; case F_DAMT3: PD(damt3); break; case F_DAMT4: PD(damt4); break; case F_DAMT5: PD(damt5); break; case F_DAMT6: PD(damt6); break; case F_DAMT7: PD(damt7); break; case F_DAMT8: PD(damt8); break; case F_DAMT9: PD(damt9); break; case F_DAMT10: PD(damt10); break; case F_DAMT11: PD(damt11); break; case F_DAMT12: PD(damt12); break; case F_DAMT13: PD(damt13); break; case F_DAMT14: PD(damt14); break; case F_DAMT15: PD(damt15); break; case F_DAMT16: PD(damt16); break; case F_DAMT17: PD(damt17); break; case F_DAMT18: PD(damt18); break; case F_DAMT19: PD(damt19); break; case F_DAMT20: PD(damt20); break; case F_DAMT21: PD(damt21); break; case F_DAMT22: PD(damt22); break; case F_DAMT23: PD(damt23); break; case F_DAMT24: PD(damt24); break; case F_DAMT25: PD(damt25); break; case F_DAMT26: PD(damt26); break; case F_DAMT27: PD(damt27); break; case F_DAMT28: PD(damt28); break; case F_DAMT29: PD(damt29); break; case F_DAMT30: PD(damt30); break; case F_DAMT31: PD(damt31); break; case F_DAMT32: PD(damt32); break; case F_DAMT33: PD(damt33); break; case F_SSTOCK_CODE: PC(sstock_code); break; case F_SSTOCK_CODE2: PC(sstock_code2); break; case F_SCUST_TYPE: PC(scust_type); break; case F_SCUST_TYPE2: PC(scust_type2); break; case F_SSTAT_TYPE: PC(sstat_type); break; case F_SSTAT_TYPE2: PC(sstat_type2); break; case F_SROOM_NO: PC(sroom_no); break; case F_SROOM_NO2: PC(sroom_no2); break; case F_SOPEN_EMP: PC(sopen_emp); break; case F_SCLOSE_EMP: PC(sclose_emp); break; case F_SCHANGE_EMP: PC(schange_emp); break; case F_SCHECK_EMP: PC(scheck_emp); break; case F_SEMP: PC(semp); break; case F_SNATION_CODE: PC(snation_code); break; case F_LCERT_CODE: PI(lcert_code); break; case F_STX_PWD: PC(stx_pwd); break; case F_STX_PWD2: PC(stx_pwd2); break; case F_SWITHDRAW_PWD: PC(swithdraw_pwd); break; case F_SWITHDRAW_PWD2: PC(swithdraw_pwd2); break; case F_SEMP_PWD: PC(semp_pwd); break; case F_SEMP_PWD2: PC(semp_pwd2); break; case F_SBANK_PWD: PC(sbank_pwd); break; case F_SBANK_PWD2: PC(sbank_pwd2); break; case F_SCUST_AUTH: PC(scust_auth); break; case F_SCUST_AUTH2: PC(scust_auth2); break; case F_SCUST_LIMIT: PC(scust_limit); break; case F_SCUST_LIMIT2: PC(scust_limit2); break; case F_LSAFE_LEVEL: PI(lsafe_level); break; case F_LSAFE_LEVEL2: PI(lsafe_level2); break; case F_SPOST_CODE: PC(spost_code); break; case F_SPOST_CODE2: PC(spost_code2); break; case F_SPHONE: PC(sphone); break; case F_SPHONE2: PC(sphone2); break; case F_SPHONE3: PC(sphone3); break; case F_SPAGER: PC(spager); break; case F_SEMAIL: PC(semail); break; case F_SEMAIL2: PC(semail2); break; case F_SNOTE: PC(snote); break; case F_SNOTE2: PC(snote2); break; case F_SCERT_NO: PC(scert_no); break; case F_SCERT_NO2: PC(scert_no2); break; case F_SCERT_ADDR: PC(scert_addr); break; case F_SSTATUS0: PC(sstatus0); break; case F_SSTATUS1: PC(sstatus1); break; case F_SSTATUS2: PC(sstatus2); break; case F_SSTATUS3: PC(sstatus3); break; case F_SSTATUS4: PC(sstatus4); break; case F_LWITHDRAW_FLAG: PI(lwithdraw_flag); break; case F_SADDR: PC(saddr); break; case F_SADDR2: PC(saddr2); break; case F_SSERIAL0: PC(sserial0); break; case F_SSERIAL1: PC(sserial1); break; case F_SSERIAL2: PC(sserial2); break; case F_SSERIAL3: PC(sserial3); break; case F_SSERIAL4: PC(sserial4); break; case F_SCURRENCY_TYPE: PC(scurrency_type); break; case F_SCURRENCY_TYPE2: PC(scurrency_type2); break; case F_SBRANCH_CODE0: PC(sbranch_code0); break; case F_SBRANCH_CODE1: PC(sbranch_code1); break; case F_SBRANCH_CODE2: PC(sbranch_code2); break; case F_USSET0: PC(usset0); break; case F_USSET1: PC(usset1); break; case F_USSET2: PC(usset2); break; case F_USSET3: PC(usset3); break; case F_USSET4: PC(usset4); break; case F_USSET5: PC(usset5); break; case F_USSET6: PC(usset6); break; case F_SSTATION0: PC(sstation0); break; case F_SSTATION1: PC(sstation1); break; case F_SBANK_ACC: PC(sbank_acc); break; case F_SBANK_ACC2: PC(sbank_acc2); break; case F_LBANK_ACC_TYPE: PI(lbank_acc_type); break; case F_LBANK_ACC_TYPE2: PI(lbank_acc_type2); break; case F_SMAIN_FLAG: PC(smain_flag); break; case F_SMAIN_FLAG2: PC(smain_flag2); break; case F_SBANK_CODE: PC(sbank_code); break; case F_SBANK_CODE2: PC(sbank_code2); break; case F_SEMP_NO: PC(semp_no); break; case F_SEMP_NO2: PC(semp_no2); break; case F_DRATE0: PD(drate0); break; case F_DRATE1: PD(drate1); break; case F_LSERIAL0: PI(lserial0); break; case F_LSERIAL1: PI(lserial1); break; case F_SBANKNAME: PC(sbankname); break; case F_SBANKNAME2: PC(sbankname2); break; case F_SCARD0: PC(scard0); break; case F_SCARD1: PC(scard1); break; case F_SORDER0: PC(sorder0); break; case F_SORDER1: PC(sorder1); break; case F_SORDER2: PC(sorder2); break; case F_VSMESS: PC(vsmess); break; case F_SCUSTTYPES: PC(scusttypes); break; case F_SSECTYPES: PC(ssectypes); break; case F_VSVARSTR0: PC(vsvarstr0); break; case F_VSVARSTR1: PC(vsvarstr1); break; case F_VSVARSTR2: PC(vsvarstr2); break; case F_VSVARSTR3: PC(vsvarstr3); break; default: printf("not existed parameter=%d....\n",ids); } }
public: typedef int n; }; struct DD { ~DD() = delete; // expected-note 2{{here}} typedef int n; }; struct A { decltype(PD()) s; // ok decltype(PD())::n n; // ok decltype(DD()) *p = new decltype(DD()); // ok }; // Two errors here: one for the decltype, one for the variable. decltype(PD(), PD()) pd1; // expected-error 2{{private destructor}} decltype(DD(), DD()) dd1; // expected-error 2{{deleted function}} decltype(((13, ((DD())))))::n dd_parens; // ok decltype(((((42)), PD())))::n pd_parens_comma; // ok // Ensure parens aren't stripped from a decltype node. extern decltype(PD()) pd_ref; // ok decltype((pd_ref)) pd_ref3 = pd_ref; // ok, PD & decltype(pd_ref) pd_ref2 = pd_ref; // expected-error {{private destructor}} namespace libcxx_example { struct nat { nat() = delete; nat(const nat&) = delete; nat &operator=(const nat&) = delete;
PD operator-(const PD &a, const PD &b) { return PD(a.XX-b.XX, a.YY-b.YY); }
CFileSystem() { KeEnableNotification(NfKe_TerminateProcess); KeEnableNotification(NfFileSystem_AddDisk); KeEnableCallRequest(ClFileSystem_GetDiskCount); KeEnableCallRequest(ClFileSystem_ReadFile); KeEnableCallRequest(ClFileSystem_GetFileSize); KeEnableCallRequest(ClFileSystem_FindFirstFile); KeEnableCallRequest(ClFileSystem_FindNextFile); KeSetSymbol(SmFileSystem_Ready); CCallRequest<0x100> CR; CNotification<0x100> N; for (;;) { KeWaitFor(3); dword NfCount; dword CallCount; KeGetNfClCount(NfCount, CallCount); for (dword z = 0; z < NfCount; z++) { N.Recv(); if (N.GetID() == NfFileSystem_AddDisk) { CFileSystemDeviceInfo FSDI; FSDI.m_DeviceID = N.GetDword(0); FSDI.m_ReadFileFunc = N.GetDword(1); FSDI.m_GetFileSizeFunc = N.GetDword(2); FSDI.m_FindFirstFileFunc = N.GetDword(3); FSDI.m_FindNextFileFunc = N.GetDword(4); m_FSDIs.PushBack(FSDI); KeSetSymbol(SmFileSystem_DiskReady); } else if (N.GetID() == NfKe_TerminateProcess) return; } for (dword z = 0; z < CallCount; z++) { CR.Recv(); if (CR.GetTypeID() == ClFileSystem_GetDiskCount) { CR.Respond(m_FSDIs.Size()); } else if (CR.GetTypeID() == ClFileSystem_ReadFile) { dword SMID = CR.GetDword(0); CStringA FSPath; CStringA Path = CStringA(PC(CR.GetBuf() + 4)); dword FSDevID = ParsePath(Path, FSPath); byte Buf[256]; (PD(Buf))[0] = SMID; (PD(Buf))[1] = m_FSDIs[FSDevID].m_DeviceID; for (dword i = 0; i < FSPath.Len(); i++) Buf[i + 8] = FSPath.GetCh(i); Buf[FSPath.Len() + 8] = 0; KeRequestCall(m_FSDIs[FSDevID].m_ReadFileFunc, Buf, FSPath.Len() + 8 + 1, null, 0); CR.Respond(); } else if (CR.GetTypeID() == ClFileSystem_GetFileSize) { dword FileSize = 0; CStringA FSPath; CStringA Path = CStringA(PC(CR.GetBuf())); dword FSDevID = ParsePath(Path, FSPath); byte Buf[256]; (PD(Buf))[0] = m_FSDIs[FSDevID].m_DeviceID; for (dword i = 0; i < FSPath.Len(); i++) Buf[i + 4] = FSPath.GetCh(i); Buf[FSPath.Len() + 4] = 0; KeRequestCall(m_FSDIs[FSDevID].m_GetFileSizeFunc, Buf, FSPath.Len() + 4 + 1, PB(&FileSize), 4); CR.Respond(FileSize); } else if (CR.GetTypeID() == ClFileSystem_FindFirstFile) { byte OutBuf[64]; dword BufSize = 4; dword DeviceIndex = CR.GetDword(0); KeRequestCall(m_FSDIs[DeviceIndex].m_FindFirstFileFunc, PB(&m_FSDIs[DeviceIndex].m_DeviceID), 4, OutBuf, 64); for (; OutBuf[BufSize]; BufSize++); BufSize++; CR.Respond(PB(&OutBuf), BufSize); } else if (CR.GetTypeID() == ClFileSystem_FindNextFile) { byte OutBuf[64]; dword BufSize = 4; dword PrevPosition = CR.GetDword(0); dword DeviceIndex = CR.GetDword(1); dword FindBuf[2]; FindBuf[0] = PrevPosition; FindBuf[1] = m_FSDIs[DeviceIndex].m_DeviceID; KeRequestCall(m_FSDIs[DeviceIndex].m_FindNextFileFunc, PB(&FindBuf), 8, OutBuf, 64); for (; OutBuf[BufSize]; BufSize++); BufSize++; CR.Respond(PB(&OutBuf), BufSize); } } } }
/* ** Implementation of the /json/login page. ** */ cson_value * json_page_login(){ char preciseErrors = /* if true, "complete" JSON error codes are used, else they are "dumbed down" to a generic login error code. */ #if 1 g.json.errorDetailParanoia ? 0 : 1 #else 0 #endif ; /* FIXME: we want to check the GET/POST args in this order: - GET: name, n, password, p - POST: name, password but a bug in cgi_parameter() is breaking that, causing PD() to return the last element of the PATH_INFO instead. Summary: If we check for P("name") first, then P("n"), then ONLY a GET param of "name" will match ("n" is not recognized). If we reverse the order of the checks then both forms work. Strangely enough, the "p"/"password" check is not affected by this. */ char const * name = cson_value_get_cstr(json_req_payload_get("name")); char const * pw = NULL; char const * anonSeed = NULL; cson_value * payload = NULL; int uid = 0; /* reminder to self: Fossil internally (for the sake of /wiki) interprets paths in the form /foo/bar/baz such that P("name") == "bar/baz". This collides with our name/password checking, and thus we do some rather elaborate name=... checking. */ pw = cson_value_get_cstr(json_req_payload_get("password")); if( !pw ){ pw = PD("p",NULL); if( !pw ){ pw = PD("password",NULL); } } if(!pw){ g.json.resultCode = preciseErrors ? FSL_JSON_E_LOGIN_FAILED_NOPW : FSL_JSON_E_LOGIN_FAILED; return NULL; } if( !name ){ name = PD("n",NULL); if( !name ){ name = PD("name",NULL); if( !name ){ g.json.resultCode = preciseErrors ? FSL_JSON_E_LOGIN_FAILED_NONAME : FSL_JSON_E_LOGIN_FAILED; return NULL; } } } if(0 == strcmp("anonymous",name)){ /* check captcha/seed values... */ enum { SeedBufLen = 100 /* in some JSON tests i once actually got an 80-digit number. */ }; static char seedBuffer[SeedBufLen]; cson_value const * jseed = json_getenv(FossilJsonKeys.anonymousSeed); seedBuffer[0] = 0; if( !jseed ){ jseed = json_req_payload_get(FossilJsonKeys.anonymousSeed); if( !jseed ){ jseed = json_getenv("cs") /* name used by HTML interface */; } } if(jseed){ if( cson_value_is_number(jseed) ){ sprintf(seedBuffer, "%"CSON_INT_T_PFMT, cson_value_get_integer(jseed)); anonSeed = seedBuffer; }else if( cson_value_is_string(jseed) ){ anonSeed = cson_string_cstr(cson_value_get_string(jseed)); } } if(!anonSeed){ g.json.resultCode = preciseErrors ? FSL_JSON_E_LOGIN_FAILED_NOSEED : FSL_JSON_E_LOGIN_FAILED; return NULL; } } #if 0 { /* only for debugging the PD()-incorrect-result problem */ cson_object * o = NULL; uid = login_search_uid( name, pw ); payload = cson_value_new_object(); o = cson_value_get_object(payload); cson_object_set( o, "n", cson_value_new_string(name,strlen(name))); cson_object_set( o, "p", cson_value_new_string(pw,strlen(pw))); return payload; } #endif uid = anonSeed ? login_is_valid_anonymous(name, pw, anonSeed) : login_search_uid(name, pw) ; if( !uid ){ g.json.resultCode = preciseErrors ? FSL_JSON_E_LOGIN_FAILED_NOTFOUND : FSL_JSON_E_LOGIN_FAILED; return NULL; }else{ char * cookie = NULL; cson_object * po; char * cap = NULL; if(anonSeed){ login_set_anon_cookie(NULL, &cookie); }else{ login_set_user_cookie(name, uid, &cookie); } payload = cson_value_new_object(); po = cson_value_get_object(payload); cson_object_set(po, "authToken", json_new_string(cookie)); free(cookie); cson_object_set(po, "name", json_new_string(name)); cap = db_text(NULL, "SELECT cap FROM user WHERE login=%Q", name); cson_object_set(po, "capabilities", cap ? json_new_string(cap) : cson_value_null() ); free(cap); cson_object_set(po, "loginCookieName", json_new_string( login_cookie_name() ) ); /* TODO: add loginExpiryTime to the payload. To do this properly we "should" add an ([unsigned] int *) to login_set_user_cookie() and login_set_anon_cookie(), to which the expiry time is assigned. (Remember that JSON doesn't do unsigned int.) For non-anonymous users we could also simply query the user.cexpire db field after calling login_set_user_cookie(), but for anonymous we need to get the time when the cookie is set because anon does not get a db entry like normal users do. Anonymous cookies currently have a hard-coded lifetime in login_set_anon_cookie() (currently 6 hours), which we "should arguably" change to use the time configured for non-anonymous users (see login_set_user_cookie() for details). */ return payload; } }
PD operator*(const PD &p, const double &t) { return PD(t*p.XX, t*p.YY); }
void PD(HRESULT result, const char* str) { WCHAR* wchar = 0; CharArrayToWCharArray(str, wchar); PD(result, wchar); delete [] wchar; }
void pr_inputrec(FILE *fp,int indent,const char *title,t_inputrec *ir, gmx_bool bMDPformat) { const char *infbuf="inf"; int i; if (available(fp,ir,indent,title)) { if (!bMDPformat) indent=pr_title(fp,indent,title); PS("integrator",EI(ir->eI)); PSTEP("nsteps",ir->nsteps); PSTEP("init-step",ir->init_step); PS("ns-type",ENS(ir->ns_type)); PI("nstlist",ir->nstlist); PI("ndelta",ir->ndelta); PI("nstcomm",ir->nstcomm); PS("comm-mode",ECOM(ir->comm_mode)); PI("nstlog",ir->nstlog); PI("nstxout",ir->nstxout); PI("nstvout",ir->nstvout); PI("nstfout",ir->nstfout); PI("nstcalcenergy",ir->nstcalcenergy); PI("nstenergy",ir->nstenergy); PI("nstxtcout",ir->nstxtcout); PR("init-t",ir->init_t); PR("delta-t",ir->delta_t); PR("xtcprec",ir->xtcprec); PI("nkx",ir->nkx); PI("nky",ir->nky); PI("nkz",ir->nkz); PI("pme-order",ir->pme_order); PR("ewald-rtol",ir->ewald_rtol); PR("ewald-geometry",ir->ewald_geometry); PR("epsilon-surface",ir->epsilon_surface); PS("optimize-fft",BOOL(ir->bOptFFT)); PS("ePBC",EPBC(ir->ePBC)); PS("bPeriodicMols",BOOL(ir->bPeriodicMols)); PS("bContinuation",BOOL(ir->bContinuation)); PS("bShakeSOR",BOOL(ir->bShakeSOR)); PS("etc",ETCOUPLTYPE(ir->etc)); PI("nsttcouple",ir->nsttcouple); PS("epc",EPCOUPLTYPE(ir->epc)); PS("epctype",EPCOUPLTYPETYPE(ir->epct)); PI("nstpcouple",ir->nstpcouple); PR("tau-p",ir->tau_p); pr_matrix(fp,indent,"ref-p",ir->ref_p,bMDPformat); pr_matrix(fp,indent,"compress",ir->compress,bMDPformat); PS("refcoord-scaling",EREFSCALINGTYPE(ir->refcoord_scaling)); if (bMDPformat) fprintf(fp,"posres-com = %g %g %g\n",ir->posres_com[XX], ir->posres_com[YY],ir->posres_com[ZZ]); else pr_rvec(fp,indent,"posres-com",ir->posres_com,DIM,TRUE); if (bMDPformat) fprintf(fp,"posres-comB = %g %g %g\n",ir->posres_comB[XX], ir->posres_comB[YY],ir->posres_comB[ZZ]); else pr_rvec(fp,indent,"posres-comB",ir->posres_comB,DIM,TRUE); PI("andersen-seed",ir->andersen_seed); PR("rlist",ir->rlist); PR("rlistlong",ir->rlistlong); PR("rtpi",ir->rtpi); PS("coulombtype",EELTYPE(ir->coulombtype)); PR("rcoulomb-switch",ir->rcoulomb_switch); PR("rcoulomb",ir->rcoulomb); PS("vdwtype",EVDWTYPE(ir->vdwtype)); PR("rvdw-switch",ir->rvdw_switch); PR("rvdw",ir->rvdw); if (ir->epsilon_r != 0) PR("epsilon-r",ir->epsilon_r); else PS("epsilon-r",infbuf); if (ir->epsilon_rf != 0) PR("epsilon-rf",ir->epsilon_rf); else PS("epsilon-rf",infbuf); PR("tabext",ir->tabext); PS("implicit-solvent",EIMPLICITSOL(ir->implicit_solvent)); PS("gb-algorithm",EGBALGORITHM(ir->gb_algorithm)); PR("gb-epsilon-solvent",ir->gb_epsilon_solvent); PI("nstgbradii",ir->nstgbradii); PR("rgbradii",ir->rgbradii); PR("gb-saltconc",ir->gb_saltconc); PR("gb-obc-alpha",ir->gb_obc_alpha); PR("gb-obc-beta",ir->gb_obc_beta); PR("gb-obc-gamma",ir->gb_obc_gamma); PR("gb-dielectric-offset",ir->gb_dielectric_offset); PS("sa-algorithm",ESAALGORITHM(ir->gb_algorithm)); PR("sa-surface-tension",ir->sa_surface_tension); PS("DispCorr",EDISPCORR(ir->eDispCorr)); PS("free-energy",EFEPTYPE(ir->efep)); PR("init-lambda",ir->init_lambda); PR("delta-lambda",ir->delta_lambda); if (!bMDPformat) { PI("n-foreign-lambda",ir->n_flambda); } if (ir->n_flambda > 0) { pr_indent(fp,indent); fprintf(fp,"foreign-lambda%s",bMDPformat ? " = " : ":"); for(i=0; i<ir->n_flambda; i++) { fprintf(fp," %10g",ir->flambda[i]); } fprintf(fp,"\n"); } PR("sc-alpha",ir->sc_alpha); PI("sc-power",ir->sc_power); PR("sc-sigma",ir->sc_sigma); PR("sc-sigma-min",ir->sc_sigma_min); PI("nstdhdl", ir->nstdhdl); PS("separate-dhdl-file", SEPDHDLFILETYPE(ir->separate_dhdl_file)); PS("dhdl-derivatives", DHDLDERIVATIVESTYPE(ir->dhdl_derivatives)); PI("dh-hist-size", ir->dh_hist_size); PD("dh-hist-spacing", ir->dh_hist_spacing); PI("nwall",ir->nwall); PS("wall-type",EWALLTYPE(ir->wall_type)); PI("wall-atomtype[0]",ir->wall_atomtype[0]); PI("wall-atomtype[1]",ir->wall_atomtype[1]); PR("wall-density[0]",ir->wall_density[0]); PR("wall-density[1]",ir->wall_density[1]); PR("wall-ewald-zfac",ir->wall_ewald_zfac); PS("pull",EPULLTYPE(ir->ePull)); if (ir->ePull != epullNO) pr_pull(fp,indent,ir->pull); PS("rotation",BOOL(ir->bRot)); if (ir->bRot) pr_rot(fp,indent,ir->rot); PS("disre",EDISRETYPE(ir->eDisre)); PS("disre-weighting",EDISREWEIGHTING(ir->eDisreWeighting)); PS("disre-mixed",BOOL(ir->bDisreMixed)); PR("dr-fc",ir->dr_fc); PR("dr-tau",ir->dr_tau); PR("nstdisreout",ir->nstdisreout); PR("orires-fc",ir->orires_fc); PR("orires-tau",ir->orires_tau); PR("nstorireout",ir->nstorireout); PR("dihre-fc",ir->dihre_fc); PR("em-stepsize",ir->em_stepsize); PR("em-tol",ir->em_tol); PI("niter",ir->niter); PR("fc-stepsize",ir->fc_stepsize); PI("nstcgsteep",ir->nstcgsteep); PI("nbfgscorr",ir->nbfgscorr); PS("ConstAlg",ECONSTRTYPE(ir->eConstrAlg)); PR("shake-tol",ir->shake_tol); PI("lincs-order",ir->nProjOrder); PR("lincs-warnangle",ir->LincsWarnAngle); PI("lincs-iter",ir->nLincsIter); PR("bd-fric",ir->bd_fric); PI("ld-seed",ir->ld_seed); PR("cos-accel",ir->cos_accel); pr_matrix(fp,indent,"deform",ir->deform,bMDPformat); PS("adress",BOOL(ir->bAdress)); if (ir->bAdress){ PS("adress_type",EADRESSTYPE(ir->adress->type)); PR("adress_const_wf",ir->adress->const_wf); PR("adress_ex_width",ir->adress->ex_width); PR("adress_hy_width",ir->adress->hy_width); PS("adress_interface_correction",EADRESSICTYPE(ir->adress->icor)); PS("adress_site",EADRESSSITETYPE(ir->adress->site)); PR("adress_ex_force_cap",ir->adress->ex_forcecap); PS("adress_do_hybridpairs", BOOL(ir->adress->do_hybridpairs)); pr_rvec(fp,indent,"adress_reference_coords",ir->adress->refs,DIM,TRUE); } PI("userint1",ir->userint1); PI("userint2",ir->userint2); PI("userint3",ir->userint3); PI("userint4",ir->userint4); PR("userreal1",ir->userreal1); PR("userreal2",ir->userreal2); PR("userreal3",ir->userreal3); PR("userreal4",ir->userreal4); pr_grp_opts(fp,indent,"grpopts",&(ir->opts),bMDPformat); pr_cosine(fp,indent,"efield-x",&(ir->ex[XX]),bMDPformat); pr_cosine(fp,indent,"efield-xt",&(ir->et[XX]),bMDPformat); pr_cosine(fp,indent,"efield-y",&(ir->ex[YY]),bMDPformat); pr_cosine(fp,indent,"efield-yt",&(ir->et[YY]),bMDPformat); pr_cosine(fp,indent,"efield-z",&(ir->ex[ZZ]),bMDPformat); pr_cosine(fp,indent,"efield-zt",&(ir->et[ZZ]),bMDPformat); PS("bQMMM",BOOL(ir->bQMMM)); PI("QMconstraints",ir->QMconstraints); PI("QMMMscheme",ir->QMMMscheme); PR("scalefactor",ir->scalefactor); pr_qm_opts(fp,indent,"qm-opts",&(ir->opts)); } }
int picdraw_linearrow(int xox, int xoy, ob *xu, ns *xns) { ob* pf; ob* pt; int x1, y1; int x2, y2; printf("+ # linearrow head %d %d %d\n", xu->cob.arrowheadpart, xu->cob.arrowbackheadtype, xu->cob.arrowbackheadtype); x1 = xox+xu->csx; y1 = xoy+xu->csy; x2 = xox+xu->cex; y2 = xoy+xu->cey; pf = NULL; if(xu->cafrom) { pf = ns_find_obj(xns, xu->cafrom); printf("%s: pf %p\n", __func__, pf); if(!pf) { goto to_phase; } if(pf->cfixed) { printf(" from %d,%d\n", pf->gx, pf->gy); x1 = pf->gx; y1 = pf->gy; } } to_phase: pt = NULL; if(xu->cafrom) { pt = ns_find_obj(xns, xu->cato); printf("%s: pt %p\n", __func__, pt); if(!pt) { goto apply; } if(pt->cfixed) { printf(" to %d,%d\n", pt->gx, pt->gy); x2 = pt->gx; y2 = pt->gy; } } apply: printf("%s: from (%d,%d) to (%d,%d)\n", __func__, x1, y1, x2, y2); #if 0 printf("+ line from (%d,%d) to (%d,%d) # line\n", x1, y1, x2, y2); #endif printf("+ line from (%d,%d) to (%d,%d) <-> thick 2 # line\n", x1, y1, x2, y2); #if 0 if(xu->cob.arrowforeheadtype>0) { #endif if(xu->cob.arrowheadpart & AR_FORE) { int xdir; xdir = (int)(atan2((y2-y1),(x2-x1))/rf); picdraw_arrowhead(xu->cob.arrowforeheadtype, xdir, x2, y2); } #if 0 if(xu->cob.arrowbackheadtype>0) { #endif if(xu->cob.arrowheadpart & AR_BACK) { int xdir; xdir = (int)(atan2((y1-y2),(x1-x2))/rf); picdraw_arrowhead(xu->cob.arrowbackheadtype, xdir, x1, y1); } out: return 0; } int picdraw_line(int xox, int xoy, ob *xu, ns *xns) { ob* pf; ob* pt; int x1, y1; int x2, y2; printf("+ # linearrow\n"); x1 = xox+xu->csx; y1 = xoy+xu->csy; x2 = xox+xu->cex; y2 = xoy+xu->cey; pf = NULL; if(xu->cafrom) { pf = ns_find_obj(xns, xu->cafrom); printf("%s: pf %p\n", __func__, pf); if(!pf) { goto to_phase; } if(pf->cfixed) { printf(" from %d,%d\n", pf->gx, pf->gy); x1 = pf->gx; y1 = pf->gy; } } to_phase: pt = NULL; if(xu->cafrom) { pt = ns_find_obj(xns, xu->cato); printf("%s: pt %p\n", __func__, pt); if(!pt) { goto apply; } if(pt->cfixed) { printf(" to %d,%d\n", pt->gx, pt->gy); x2 = pt->gx; y2 = pt->gy; } } apply: printf("%s: from (%d,%d) to (%d,%d)\n", __func__, x1, y1, x2, y2); printf("+ line from (%d,%d) to (%d,%d) # line\n", x1, y1, x2, y2); out: return 0; } int picdrawobj(ob *u, int *xdir, int ox, int oy, ns *xns) { int wd, ht; int g; printf("%s: oid %d xdir %d ox,oy %d,%d\n", __func__, u->oid, *xdir, ox, oy); wd = u->crx-u->clx; ht = u->cty-u->cby; printf("%s: b oid %d - %d,%d s %d,%d e %d,%d o %d,%d\n", __func__, u->oid, u->cx, u->cy, u->csx, u->csy, u->cex, u->cey, u->ox, u->coy); printf("+ # oid %d, type %d START\n", u->oid, u->type); #if 0 PB(u); PQQ(u); #endif PD(ox+u->csx, oy+u->csy); #if 0 #endif printf("+ line from (%d,%d) to (%d,%d) thick 0.1 # sxy->exy\n", ox+u->csx, oy+u->csy, ox+u->cex, oy+u->cey); g = eval_dir(u, xdir); if(g>0) { goto out; } if(u->type==CMD_LINE) { printf("+ line from (%d,%d) to (%d,%d) thick 1.5 \"%d\" \"\" # line\n", ox+u->csx, oy+u->csy, ox+u->cex, oy+u->cey, u->oid); picdraw_linearrow(ox, oy, u, xns); } if(u->type==CMD_ARROW) { picdraw_linearrow(ox, oy, u, xns); #if 0 int dx, dy; int r; printf("+ line from (%d,%d) to (%d,%d) thick 1.5 \"%d\" \"\" # arrow\n", ox+u->csx, oy+u->csy, ox+u->cex, oy+u->cey, u->oid); #if 0 r = u->cht/2; #endif r = def_arrowsize; dx = (int)(r*cos((*xdir+180+def_arrowangle/2)*rf)); dy = (int)(r*sin((*xdir+180+def_arrowangle/2)*rf)); printf("+ line from (%d,%d) to (%d,%d) thick 1.5\n", ox+u->cex, oy+u->cey, ox+u->cex+dx, oy+u->cey+dy); dx = (int)(r*cos((*xdir+180-def_arrowangle/2)*rf)); dy = (int)(r*sin((*xdir+180-def_arrowangle/2)*rf)); printf("+ line from (%d,%d) to (%d,%d) thick 1.5\n", ox+u->cex, oy+u->cey, ox+u->cex+dx, oy+u->cey+dy); #endif } if(u->type==CMD_PLINE) { int dx, dy; int r; if(u->cht < u->cwd) { r = u->cht; } else { r = u->cwd; } r = r/2; dx = (int)(r*cos((*xdir+90)*rf)); dy = (int)(r*sin((*xdir+90)*rf)); printf("+ # dir %d; dx,dy %d,%d\n", *xdir, dx, dy); printf("+ line from (%d,%d) to (%d,%d) thick 0.1\n", ox+u->clx, oy+u->cy, ox+u->crx, oy+u->cy); printf("+ line from (%d,%d) to (%d,%d) thick 0.1\n", ox+u->csx, oy+u->csy, ox+u->cex, oy+u->cey); printf("+ line from (%d,%d) to (%d,%d) thick 1.5 \"%d \"# pline\n", ox+u->cx-dx, oy+u->cy-dy, ox+u->cx+dx, oy+u->cy+dy, u->oid); } if(u->type==CMD_MOVE) { printf("+ # empty as \"move\"\n"); printf("+ box at (%d,%d) width %d height %d \"%d\" invis\n", ox+u->cx, oy+u->cy, u->crx-u->clx, u->cty-u->cby, u->oid); } if(u->type==CMD_DMY1) { printf("+ box at (%d,%d) width %d height %d rad %d \"%d\"\n", ox+u->cx, oy+u->cy, u->crx-u->clx, u->cty-u->cby, wd/8, u->oid); } if(u->type==CMD_DMY2) { printf("+ box at (%d,%d) width %d height %d rad %d \"%d\"\n", ox+u->cx, oy+u->cy, u->crx-u->clx, u->cty-u->cby, wd/8, u->oid); } if(u->type==CMD_BOX) { printf("+ box at (%d,%d) width %d height %d rad %d \"%d\"\n", ox+u->cx, oy+u->cy, u->crx-u->clx, u->cty-u->cby, wd/8, u->oid); printf("+ box at (%d,%d) width %d height %d rad %d thickness %d \"%d\"\n", ox+u->cx, oy+u->cy, u->crx-u->clx, u->cty-u->cby, wd/8, u->cob.outlinethick, u->oid); } if(u->type==CMD_CIRCLE) { printf("+ circle at (%d,%d) rad %d \"%d\"\n", ox+u->cx, oy+u->cy, u->cwd/2, u->oid); } if(u->type==CMD_ELLIPSE) { printf("+ ellipse at (%d,%d) width %d height %d \"%d\"\n", ox+u->cx, oy+u->cy, u->crx-u->clx, u->cty-u->cby, u->oid); } if(u->type==CMD_POLYGON) { #if 0 printf("+ box at (%d,%d) width %d height %d \"%p\"\n", ox+u->cx, oy+u->cy, u->crx-u->clx, u->cty-u->cby, u); #endif printf("+ line from (%d,%d) to (%d,%d) to (%d,%d) to (%d,%d)\n", ox+u->clx, oy+u->cby, ox+(u->clx+u->crx)/2, oy+u->cty, ox+u->crx, oy+u->cby, ox+u->clx, oy+u->cby); } printf("+ # oid %d, type %d DONE\n", u->oid, u->type); out: printf("%s: a oid %d - %d,%d s %d,%d e %d,%d o %d,%d\n", __func__, u->oid, u->cx, u->cy, u->csx, u->csy, u->cex, u->cey, u->ox, u->coy); return 0; }
typedef int n; }; struct DD { ~DD() = delete; // expected-note 2{{here}} typedef int n; }; struct A { decltype(PD()) s; // ok decltype(PD())::n n; // ok decltype(DD()) *p = new decltype(DD()); // ok }; // Two errors here: one for the decltype, one for the variable. decltype( PD(), // expected-error {{private destructor}} PD()) pd1; // expected-error {{private destructor}} decltype(DD(), // expected-error {{deleted function}} DD()) dd1; // expected-error {{deleted function}} decltype( PD(), // expected-error {{temporary of type 'PD' has private destructor}} 0) pd2; decltype(((13, ((DD())))))::n dd_parens; // ok decltype(((((42)), PD())))::n pd_parens_comma; // ok // Ensure parens aren't stripped from a decltype node. extern decltype(PD()) pd_ref; // ok decltype((pd_ref)) pd_ref3 = pd_ref; // ok, PD & decltype(pd_ref) pd_ref2 = pd_ref; // expected-error {{private destructor}}
struct platform_device *__init at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, unsigned long fbmem_start, unsigned long fbmem_len) { struct platform_device *pdev; struct atmel_lcdfb_info *info; struct fb_monspecs *monspecs; struct fb_videomode *modedb; unsigned int modedb_size; /* * Do a deep copy of the fb data, monspecs and modedb. Make * sure all allocations are done before setting up the * portmux. */ monspecs = kmemdup(data->default_monspecs, sizeof(struct fb_monspecs), GFP_KERNEL); if (!monspecs) return NULL; modedb_size = sizeof(struct fb_videomode) * monspecs->modedb_len; modedb = kmemdup(monspecs->modedb, modedb_size, GFP_KERNEL); if (!modedb) goto err_dup_modedb; monspecs->modedb = modedb; switch (id) { case 0: pdev = &atmel_lcdfb0_device; select_peripheral(PC(19), PERIPH_A, 0); /* CC */ select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */ select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */ select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */ select_peripheral(PC(23), PERIPH_A, 0); /* DVAL */ select_peripheral(PC(24), PERIPH_A, 0); /* MODE */ select_peripheral(PC(25), PERIPH_A, 0); /* PWR */ select_peripheral(PC(26), PERIPH_A, 0); /* DATA0 */ select_peripheral(PC(27), PERIPH_A, 0); /* DATA1 */ select_peripheral(PC(28), PERIPH_A, 0); /* DATA2 */ select_peripheral(PC(29), PERIPH_A, 0); /* DATA3 */ select_peripheral(PC(30), PERIPH_A, 0); /* DATA4 */ select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */ select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */ select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */ select_peripheral(PD(2), PERIPH_A, 0); /* DATA8 */ select_peripheral(PD(3), PERIPH_A, 0); /* DATA9 */ select_peripheral(PD(4), PERIPH_A, 0); /* DATA10 */ select_peripheral(PD(5), PERIPH_A, 0); /* DATA11 */ select_peripheral(PD(6), PERIPH_A, 0); /* DATA12 */ select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */ select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */ select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */ select_peripheral(PD(10), PERIPH_A, 0); /* DATA16 */ select_peripheral(PD(11), PERIPH_A, 0); /* DATA17 */ select_peripheral(PD(12), PERIPH_A, 0); /* DATA18 */ select_peripheral(PD(13), PERIPH_A, 0); /* DATA19 */ select_peripheral(PD(14), PERIPH_A, 0); /* DATA20 */ select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */ select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */ select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */ clk_set_parent(&atmel_lcdfb0_pixclk, &pll0); clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0)); break; default: goto err_invalid_id; } if (fbmem_len) { pdev->resource[2].start = fbmem_start; pdev->resource[2].end = fbmem_start + fbmem_len - 1; pdev->resource[2].flags = IORESOURCE_MEM; } info = pdev->dev.platform_data; memcpy(info, data, sizeof(struct atmel_lcdfb_info)); info->default_monspecs = monspecs; platform_device_register(pdev); return pdev; err_invalid_id: kfree(modedb); err_dup_modedb: kfree(monspecs); return NULL; }