int dma_pulse_DRQ(int ch, Bit8u * buf) { int ret = DMA_DACK; if (MASKED(DI(ch), CI(ch))) { q_printf("DMA: channel %i masked, DRQ ignored\n", ch); ret = DMA_NO_DACK; } if ((dma[DI(ch)].status & 0xf0) || dma[DI(ch)].request) { error("DMA: channel %i already active! (m=%#x s=%#x r=%#x)\n", ch, dma[DI(ch)].chans[CI(ch)].mode, dma[DI(ch)].status, dma[DI(ch)].request); ret = DMA_NO_DACK; } #if 0 q_printf("DMA: pulse DRQ on channel %d\n", ch); #endif if (ret == DMA_DACK) { DMA_LOCK(); dma[DI(ch)].status |= 1 << (CI(ch) + 4); memcpy(dma_data_bus, buf, 1 << DI(ch)); dma_run_channel(DI(ch), CI(ch)); memcpy(buf, dma_data_bus, 1 << DI(ch)); DMA_UNLOCK(); } else { memset(buf, 0xff, 1 << DI(ch)); } return ret; }
void CodeViewDebug::maybeRecordLocation(DebugLoc DL, const MachineFunction *MF) { // Skip this instruction if it has the same location as the previous one. if (DL == CurFn->LastLoc) return; const DIScope *Scope = DL.get()->getScope(); if (!Scope) return; // Skip this line if it is longer than the maximum we can record. LineInfo LI(DL.getLine(), DL.getLine(), /*IsStatement=*/true); if (LI.getStartLine() != DL.getLine() || LI.isAlwaysStepInto() || LI.isNeverStepInto()) return; ColumnInfo CI(DL.getCol(), /*EndColumn=*/0); if (CI.getStartColumn() != DL.getCol()) return; if (!CurFn->HaveLineInfo) CurFn->HaveLineInfo = true; unsigned FileId = 0; if (CurFn->LastLoc.get() && CurFn->LastLoc->getFile() == DL->getFile()) FileId = CurFn->LastFileId; else FileId = CurFn->LastFileId = maybeRecordFile(DL->getFile()); CurFn->LastLoc = DL; unsigned FuncId = CurFn->FuncId; if (const DILocation *Loc = DL->getInlinedAt()) { // If this location was actually inlined from somewhere else, give it the ID // of the inline call site. FuncId = getInlineSite(DL.get()).SiteFuncId; // Ensure we have links in the tree of inline call sites. const DILocation *ChildLoc = nullptr; while (Loc->getInlinedAt()) { InlineSite &Site = getInlineSite(Loc); if (ChildLoc) { // Record the child inline site if not already present. auto B = Site.ChildSites.begin(), E = Site.ChildSites.end(); if (std::find(B, E, Loc) != E) break; Site.ChildSites.push_back(Loc); } ChildLoc = Loc; } } Asm->OutStreamer->EmitCVLocDirective(FuncId, FileId, DL.getLine(), DL.getCol(), /*PrologueEnd=*/false, /*IsStmt=*/false, DL->getFilename()); }
llvm::Module *NodeCompiler::compile(const char *fileName) { // Add filename as the last argument of the compiler char globfilename[512]; strcpy(globfilename, SRC_DIR"/"); strcat(globfilename, fileName); m_args.push_back(globfilename); const llvm::OwningPtr<Compilation> Compilation( //m_driver->BuildCompilation(llvm::makeArrayRef(m_args))); m_driver->BuildCompilation(m_args)); // Compilation Job to get the correct arguments const JobList &Jobs = Compilation->getJobs(); const Command *Cmd = llvm::cast<Command>(*Jobs.begin()); const ArgStringList *const CC1Args = &Cmd->getArguments(); //m_driver->PrintActions(*Compilation); llvm::OwningPtr<CompilerInvocation> CI(new CompilerInvocation); CompilerInvocation::CreateFromArgs( *CI, CC1Args->data() + 1, CC1Args->data() + CC1Args->size(), *m_diagEngine); // Show the invocation, with -v. // TO debug the -fvectorize issue //if (CI->getHeaderSearchOpts().Verbose) { // llvm::errs() << "clang invocation:\n"; // Compilation->PrintJob(llvm::errs(), Jobs, "\n", true); // llvm::errs() << "\n"; //} // Create the compiler instance m_clang->setInvocation(CI.take()); // Diagnostics m_clang->createDiagnostics(); //m_args.pop_back(); // Remove filename for future compilation if (!m_clang->hasDiagnostics()) return NULL; // Emit only llvm code llvm::Module *mod=NULL; std::cout << "emitting llvm code" << "\n"; if (!m_clang->ExecuteAction(*m_action)) { std::cout << "unable to generate llvm code" << "\n"; } else { mod = m_action->takeModule(); } std::cout << "code generated\n"; return mod; }
CI operator () ( const W &width, const RI &observer, const RL &light, const I &intersection, const CI &incident, const G & ) const { typedef typename RI::local_coord_type accuracy; const accuracy ci = -dot(observer.direction(), intersection.direction()); const unit_vector< accuracy > ri( observer.direction() + intersection.direction() * accuracy(2) * ci); const accuracy costheta(dot(ri, light.direction())); if ( costheta > accuracy() ) { return incident * std::pow(costheta, width); } else { return CI(); } }
void quadratic_prog(const Vector6d &f, double &lambda, double &miu) { const double a=f[0], b=f[3], c=f[1], d=f[4], e=f[5]; double sum = 0.0; const int N = 2; Matrix<double> G(N, N); G[0][0]=2*a, G[0][1]=b; G[1][0]=b, G[1][1]=2*c; Vector<double> g0(N); g0[0]=d, g0[1]=e; //eq constraints /* Matrix<double> CE(n, m); CE[0][0]=1, CE[1][0]=1; Vector<double> ce0(m); ce0[0]=-3; */ Matrix<double> CE; Vector<double> ce0; //in-eq constraints Matrix<double> CI(N, N); CI[0][0]=1, CI[0][1]=0; CI[1][0]=0, CI[1][1]=1; Vector<double> ci0(N); ci0[0]=0, ci0[1]=-0.001; //=========================== Vector<double> x(N); const double rr = solve_quadprog(G, g0, CE, ce0, CI, ci0, x) + f.z; std::cout << "MinF: " << rr << " x: " << x[0] <<", " <<x[1] << std::endl; lambda = x[0]; miu = x[1]; }
{ "agf", NULL, agf_f, 0, 1, 1, N_("[agno]"), N_("set address to agf header"), agf_help }; const field_t agf_hfld[] = { { "", FLDT_AGF, OI(0), C1, 0, TYP_NONE }, { NULL } }; #define OFF(f) bitize(offsetof(xfs_agf_t, agf_ ## f)) #define SZ(f) bitszof(xfs_agf_t, agf_ ## f) const field_t agf_flds[] = { { "magicnum", FLDT_UINT32X, OI(OFF(magicnum)), C1, 0, TYP_NONE }, { "versionnum", FLDT_UINT32D, OI(OFF(versionnum)), C1, 0, TYP_NONE }, { "seqno", FLDT_AGNUMBER, OI(OFF(seqno)), C1, 0, TYP_NONE }, { "length", FLDT_AGBLOCK, OI(OFF(length)), C1, 0, TYP_NONE }, { "roots", FLDT_AGBLOCK, OI(OFF(roots)), CI(XFS_BTNUM_AGF), FLD_ARRAY|FLD_SKIPALL, TYP_NONE }, { "bnoroot", FLDT_AGBLOCK, OI(OFF(roots) + XFS_BTNUM_BNO * SZ(roots[XFS_BTNUM_BNO])), C1, 0, TYP_BNOBT }, { "cntroot", FLDT_AGBLOCK, OI(OFF(roots) + XFS_BTNUM_CNT * SZ(roots[XFS_BTNUM_CNT])), C1, 0, TYP_CNTBT }, { "levels", FLDT_UINT32D, OI(OFF(levels)), CI(XFS_BTNUM_AGF), FLD_ARRAY|FLD_SKIPALL, TYP_NONE }, { "bnolevel", FLDT_UINT32D, OI(OFF(levels) + XFS_BTNUM_BNO * SZ(levels[XFS_BTNUM_BNO])), C1, 0, TYP_NONE }, { "cntlevel", FLDT_UINT32D, OI(OFF(levels) + XFS_BTNUM_CNT * SZ(levels[XFS_BTNUM_CNT])), C1, 0, TYP_NONE },
static const WCHAR stKOI8[]={'A','a','B','b',0}; /* KOI-8 */ static const WCHAR stIso88593[]={'A','a','B','b',0}; /* ISO-8859-3 */ static const WCHAR stIso88594[]={'A','a','B','b',0}; /* ISO-8859-4 */ static const WCHAR stIso885910[]={'A','a','B','b',0}; /* ISO-8859-10 */ static const WCHAR stCeltic[]={'A','a','B','b',0};/* Celtic */ static const WCHAR * const sample_lang_text[]={ stWestern,stSymbol,stShiftJis,stHangul,stGB2312, stBIG5,stGreek,stTurkish,stHebrew,stArabic, stBaltic,stVietname,stCyrillic,stEastEur,stThai, stJohab,stMac,stOEM,stVISCII,stTCVN, stKOI8,stIso88593,stIso88594,stIso885910,stCeltic}; static const BYTE CHARSET_ORDER[256]={ CI(ANSI), 0, CI(SYMBOL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(MAC), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(JIS), CI(HANGUL), CI(JOHAB), 0, 0, 0, CI(GB2312), 0, CI(BIG5), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(GREEK), CI(TURKISH), CI(VIETNAMESE), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(HEBREW), CI(ARABIC), 0, 0, 0, 0, 0, 0, 0, CI(BALTIC), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(RUSSIAN), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(THAI), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CI(EE), 0, CI(VISCII), CI(TCVN), CI(KOI8), CI(ISO3), CI(ISO4), CI(ISO10), CI(CELTIC), 0, 0, 0, 0, 0, 0, 0, 0, CI(OEM),
void bupdate(void) { static win_t *lwin = NULL; int waiting, widthx = secs_getvar_int("winlistchars"), M = widthx, #ifdef ENABLE_FORCEASCII fascii = secs_getvar_int("forceascii"), #endif bb, line = 0; conn_t *conn = curconn; wbuddy_widthy = secs_getvar_int("winlistheight")*faimconf.wstatus.widthy/100; if (wbuddy_widthy > faimconf.wstatus.widthy) wbuddy_widthy = faimconf.wstatus.widthy; #ifdef ENABLE_FORCEASCII # define LINEDRAW(ch,as) ((fascii == 1) ? as : ch) #else # define LINEDRAW(ch,as) ch #endif #define ACS_ULCORNER_C LINEDRAW(ACS_ULCORNER,',') #define ACS_LLCORNER_C LINEDRAW(ACS_LLCORNER,'`') #define ACS_URCORNER_C LINEDRAW(ACS_URCORNER,'.') #define ACS_LRCORNER_C LINEDRAW(ACS_LRCORNER,'\'') #define ACS_LTEE_C LINEDRAW(ACS_LTEE,'+') #define ACS_RTEE_C LINEDRAW(ACS_RTEE,'+') #define ACS_BTEE_C LINEDRAW(ACS_BTEE,'+') #define ACS_TTEE_C LINEDRAW(ACS_TTEE,'+') #define ACS_HLINE_C LINEDRAW(ACS_HLINE,'-') #define ACS_VLINE_C LINEDRAW(ACS_VLINE,'|') #define ACS_PLUS_C LINEDRAW(ACS_PLUS,'+') #define ACS_RARROW_C LINEDRAW(ACS_RARROW,'>') nw_erase(&win_buddy); nw_vline(&win_buddy, ACS_VLINE_C | A_BOLD | COLOR_PAIR(C(WINLIST,TEXT)%COLOR_PAIRS), wbuddy_widthy); bb = buddyc; buddyc = 0; if (conn == NULL) return; waiting = 0; if (inconn) { int autoclose = getvar_int(curconn, "autoclose"); assert(curconn->curbwin != NULL); if ((autoclose > 0) && (curconn->curbwin->et == BUDDY) && !USER_PERMANENT(curconn->curbwin->e.buddy) && (curconn->curbwin->waiting != 0)) curconn->curbwin->closetime = now + 60*autoclose; curconn->curbwin->waiting = 0; if ((curconn->curbwin->et == CHAT) && curconn->curbwin->e.chat->isaddressed) curconn->curbwin->e.chat->isaddressed = 0; } do { buddywin_t *bwin = conn->curbwin; char *lastgroup = NULL; int hidegroup = 0, autosort = getvar_int(conn, "autosort"); assert(conn->winname != NULL); if (line < wbuddy_widthy) { nw_move(&win_buddy, line, 0); if (line == 0) nw_addch(&win_buddy, ACS_ULCORNER_C | A_BOLD | COLOR_PAIR(C(WINLIST,TEXT)%COLOR_PAIRS)); else nw_addch(&win_buddy, ACS_LTEE_C | A_BOLD | COLOR_PAIR(C(WINLIST,TEXT)%COLOR_PAIRS)); nw_hline(&win_buddy, ACS_HLINE_C | A_BOLD | COLOR_PAIR(C(WINLIST,TEXT)%COLOR_PAIRS), widthx); nw_move(&win_buddy, line++, widthx-strlen(conn->winname)); if (conn->online <= 0) { nw_printf(&win_buddy, C(WINLIST,BUDDY_OFFLINE), 1, " %s", conn->winname); if (line < wbuddy_widthy) { nw_move(&win_buddy, line++, 1); nw_printf(&win_buddy, C(WINLIST,TEXT), 1, "%s", " You are offline"); buddyc++; } } else nw_printf(&win_buddy, C(WINLIST,TEXT), 1, " %s", conn->winname); } buddyc++; if (bwin == NULL) continue; if (autosort == 2) { if (bwin->et == BUDDY) STRREPLACE(lastgroup, USER_GROUP(bwin->e.buddy)); else STRREPLACE(lastgroup, CHAT_GROUP); } bsort(conn); do { if ((inconn && (conn == curconn)) || bwin->waiting) { char buf[256], *group; int col = -1; assert(bwin->winname != NULL); buddyc++; if (bwin->et == BUDDY) { user_name(buf, sizeof(buf), conn, bwin->e.buddy); group = USER_GROUP(bwin->e.buddy); } else { snprintf(buf, sizeof(buf), "%s", bwin->winname); group = CHAT_GROUP; } if (autosort == 2) { if (strcmp(lastgroup, group) != 0) { if (line < wbuddy_widthy) { nw_move(&win_buddy, line++, widthx-strlen(group)-1); nw_printf(&win_buddy, C(WINLIST,TEXT), hidegroup?0:1, "%c%s%c", hidegroup?'<':'[', group, hidegroup?'>':']'); buddyc++; } STRREPLACE(lastgroup, group); } } if (bwin->waiting && !waiting) { char tmp[64]; if (conn == curconn) snprintf(tmp, sizeof(tmp), " [Ctrl-N to %s]", buf); else snprintf(tmp, sizeof(tmp), " [Ctrl-N to %s:%s]", conn->winname, buf); secs_setvar("ifpending", tmp); waiting = 1; } if (printtitle && bwin->waiting && (waiting < 2) && ((bwin->et == BUDDY) || ((bwin->et == CHAT) && bwin->e.chat->isaddressed))) { nw_titlef("[%s:%s]", conn->winname, buf); waiting = 2; } if (line >= wbuddy_widthy) continue; if (strlen(buf) > M) { buf[M-1] = '>'; buf[M] = 0; } if ((bwin->et == CHAT) && bwin->e.chat->isaddressed) { assert(bwin->waiting); col = C(WINLIST,BUDDY_ADDRESSED); } else if (bwin->waiting) if (bwin->et == BUDDY) col = C(WINLIST,BUDDY_ADDRESSED); else col = C(WINLIST,BUDDY_WAITING); else if (bwin->pouncec > 0) col = C(WINLIST,BUDDY_QUEUED); else switch (bwin->et) { case BUDDY: if (bwin->e.buddy->tag != NULL) col = CI(WINLIST,BUDDY_TAGGED); else if (bwin->e.buddy->offline) col = C(WINLIST,BUDDY_OFFLINE); else if (bwin->e.buddy->ismobile) col = C(WINLIST,BUDDY_MOBILE); else if (bwin->e.buddy->isaway) col = C(WINLIST,BUDDY_AWAY); else if (bwin->e.buddy->isidle) col = C(WINLIST,BUDDY_IDLE); else col = C(WINLIST,BUDDY); break; case CHAT: assert(bwin->e.chat != NULL); if (bwin->e.chat->offline) col = C(WINLIST,BUDDY_OFFLINE); else col = C(WINLIST,BUDDY); break; case TRANSFER: col = C(WINLIST,BUDDY); break; } assert(col != -1); if (bwin == curconn->curbwin) { int affect = col/COLOR_PAIRS, back; #if 0 if (faimconf.b[cIMWIN] == faimconf.b[cWINLIST]) back = (faimconf.b[cIMWIN]+1)%nw_COLORS; else back = faimconf.b[cIMWIN]; #else back = faimconf.b[cWINLISTHIGHLIGHT]; #endif col %= nw_COLORS; col += nw_COLORS*back; col += affect*COLOR_PAIRS; } nw_move(&win_buddy, line, 1); if ((col >= 2*COLOR_PAIRS) || (col < COLOR_PAIRS)) nw_printf(&win_buddy, col%COLOR_PAIRS, 1, "%*s", M, buf); else nw_printf(&win_buddy, col%COLOR_PAIRS, 0, "%*s", M, buf); if (bwin->waiting) { nw_move(&win_buddy, line, 0); nw_addch(&win_buddy, ACS_LTEE_C | A_BOLD | COLOR_PAIR(C(WINLIST,TEXT)%COLOR_PAIRS)); nw_addch(&win_buddy, ACS_RARROW_C | A_BOLD | COLOR_PAIR(col%COLOR_PAIRS)); } line++; } assert(buddyc < 1000); } while ((bwin = bwin->next) != conn->curbwin); if (autosort == 2) { free(lastgroup); lastgroup = NULL; } else assert(lastgroup == NULL); } while ((conn = conn->next) != curconn); nw_move(&win_buddy, line-1, 0); if (line != 1) nw_addch(&win_buddy, ACS_LLCORNER_C | A_BOLD | COLOR_PAIR(C(WINLIST,TEXT)%COLOR_PAIRS)); else nw_addch(&win_buddy, ACS_HLINE_C | A_BOLD | COLOR_PAIR(C(WINLIST,TEXT)%COLOR_PAIRS)); if (printtitle && (waiting != 2)) nw_titlef(""); if (waiting) buddyc = -buddyc; else secs_setvar("ifpending", ""); if (inconn) assert(curconn->curbwin != NULL); if ((buddyc != bb) || (inconn && (&(curconn->curbwin->nwin) != lwin)) || (!inconn && (&(curconn->nwin) != lwin))) { if (inconn) lwin = &(curconn->curbwin->nwin); else lwin = &(curconn->nwin); bb = buddyc - bb; buddyc = buddyc - bb; bb = buddyc + bb; naim_changetime(); buddyc = bb; } iupdate(); }
{ "rextents", FLDT_DRTBNO, OI(OFF(rextents)), C1, 0, TYP_NONE }, { "uuid", FLDT_UUID, OI(OFF(uuid)), C1, 0, TYP_NONE }, { "logstart", FLDT_DFSBNO, OI(OFF(logstart)), C1, 0, TYP_LOG }, { "rootino", FLDT_INO, OI(OFF(rootino)), C1, 0, TYP_INODE }, { "rbmino", FLDT_INO, OI(OFF(rbmino)), C1, 0, TYP_INODE }, { "rsumino", FLDT_INO, OI(OFF(rsumino)), C1, 0, TYP_INODE }, { "rextsize", FLDT_AGBLOCK, OI(OFF(rextsize)), C1, 0, TYP_NONE }, { "agblocks", FLDT_AGBLOCK, OI(OFF(agblocks)), C1, 0, TYP_NONE }, { "agcount", FLDT_AGNUMBER, OI(OFF(agcount)), C1, 0, TYP_NONE }, { "rbmblocks", FLDT_EXTLEN, OI(OFF(rbmblocks)), C1, 0, TYP_NONE }, { "logblocks", FLDT_EXTLEN, OI(OFF(logblocks)), C1, 0, TYP_NONE }, { "versionnum", FLDT_UINT16X, OI(OFF(versionnum)), C1, 0, TYP_NONE }, { "sectsize", FLDT_UINT16D, OI(OFF(sectsize)), C1, 0, TYP_NONE }, { "inodesize", FLDT_UINT16D, OI(OFF(inodesize)), C1, 0, TYP_NONE }, { "inopblock", FLDT_UINT16D, OI(OFF(inopblock)), C1, 0, TYP_NONE }, { "fname", FLDT_CHARNS, OI(OFF(fname)), CI(SZC(fname)), 0, TYP_NONE }, { "blocklog", FLDT_UINT8D, OI(OFF(blocklog)), C1, 0, TYP_NONE }, { "sectlog", FLDT_UINT8D, OI(OFF(sectlog)), C1, 0, TYP_NONE }, { "inodelog", FLDT_UINT8D, OI(OFF(inodelog)), C1, 0, TYP_NONE }, { "inopblog", FLDT_UINT8D, OI(OFF(inopblog)), C1, 0, TYP_NONE }, { "agblklog", FLDT_UINT8D, OI(OFF(agblklog)), C1, 0, TYP_NONE }, { "rextslog", FLDT_UINT8D, OI(OFF(rextslog)), C1, 0, TYP_NONE }, { "inprogress", FLDT_UINT8D, OI(OFF(inprogress)), C1, 0, TYP_NONE }, { "imax_pct", FLDT_UINT8D, OI(OFF(imax_pct)), C1, 0, TYP_NONE }, { "icount", FLDT_UINT64D, OI(OFF(icount)), C1, 0, TYP_NONE }, { "ifree", FLDT_UINT64D, OI(OFF(ifree)), C1, 0, TYP_NONE }, { "fdblocks", FLDT_UINT64D, OI(OFF(fdblocks)), C1, 0, TYP_NONE }, { "frextents", FLDT_UINT64D, OI(OFF(frextents)), C1, 0, TYP_NONE }, { "uquotino", FLDT_INO, OI(OFF(uquotino)), C1, 0, TYP_INODE }, { "gquotino", FLDT_INO, OI(OFF(gquotino)), C1, 0, TYP_INODE }, { "qflags", FLDT_UINT16X, OI(OFF(qflags)), C1, 0, TYP_NONE },
void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu) { struct pvr_s pvr; int temp; /* for saving temp value */ get_pvr(&pvr); CI(ver_code, VERSION); if (!ci->ver_code) { pr_err("ERROR: MB has broken PVR regs -> use DTS setting\n"); return; } temp = PVR_USE_BARREL(pvr) | PVR_USE_MSR_INSTR(pvr) | PVR_USE_PCMP_INSTR(pvr) | PVR_USE_DIV(pvr); if (ci->use_instr != temp) err_printk("BARREL, MSR, PCMP or DIV"); ci->use_instr = temp; temp = PVR_USE_HW_MUL(pvr) | PVR_USE_MUL64(pvr); if (ci->use_mult != temp) err_printk("HW_MUL"); ci->use_mult = temp; temp = PVR_USE_FPU(pvr) | PVR_USE_FPU2(pvr); if (ci->use_fpu != temp) err_printk("HW_FPU"); ci->use_fpu = temp; ci->use_exc = PVR_OPCODE_0x0_ILLEGAL(pvr) | PVR_UNALIGNED_EXCEPTION(pvr) | PVR_ILL_OPCODE_EXCEPTION(pvr) | PVR_IOPB_BUS_EXCEPTION(pvr) | PVR_DOPB_BUS_EXCEPTION(pvr) | PVR_DIV_ZERO_EXCEPTION(pvr) | PVR_FPU_EXCEPTION(pvr) | PVR_FSL_EXCEPTION(pvr); CI(pvr_user1, USER1); CI(pvr_user2, USER2); CI(mmu, USE_MMU); CI(mmu_privins, MMU_PRIVINS); CI(endian, ENDIAN); CI(use_icache, USE_ICACHE); CI(icache_tagbits, ICACHE_ADDR_TAG_BITS); CI(icache_write, ICACHE_ALLOW_WR); ci->icache_line_length = PVR_ICACHE_LINE_LEN(pvr) << 2; CI(icache_size, ICACHE_BYTE_SIZE); CI(icache_base, ICACHE_BASEADDR); CI(icache_high, ICACHE_HIGHADDR); CI(use_dcache, USE_DCACHE); CI(dcache_tagbits, DCACHE_ADDR_TAG_BITS); CI(dcache_write, DCACHE_ALLOW_WR); ci->dcache_line_length = PVR_DCACHE_LINE_LEN(pvr) << 2; CI(dcache_size, DCACHE_BYTE_SIZE); CI(dcache_base, DCACHE_BASEADDR); CI(dcache_high, DCACHE_HIGHADDR); temp = PVR_DCACHE_USE_WRITEBACK(pvr); if (ci->dcache_wb != temp) err_printk("DCACHE WB"); ci->dcache_wb = temp; CI(use_dopb, D_OPB); CI(use_iopb, I_OPB); CI(use_dlmb, D_LMB); CI(use_ilmb, I_LMB); CI(num_fsl, FSL_LINKS); CI(irq_edge, INTERRUPT_IS_EDGE); CI(irq_positive, EDGE_IS_POSITIVE); CI(area_optimised, AREA_OPTIMISED); CI(hw_debug, DEBUG_ENABLED); CI(num_pc_brk, NUMBER_OF_PC_BRK); CI(num_rd_brk, NUMBER_OF_RD_ADDR_BRK); CI(num_wr_brk, NUMBER_OF_WR_ADDR_BRK); CI(fpga_family_code, TARGET_FAMILY); }
// ====================================================================== // Add the autocorrelation for the end section of previous Window / start of current window void AddAC (LPC_WORD const *hbuf, LPC_WORD const *ibuf, int nc, LPC_CORR *ac) { int i; // Copy integer data to float -- speeds things up slightly... LPC_FLOAT buf[PMAX*2]; int n = nc-1; // Number of samples is always one less than nc value for (i = 0; i < n ; i++) { buf[i] = (LPC_FLOAT) hbuf[i]; buf[i + n] = (LPC_FLOAT) ibuf[i]; } while (nc-- > 1) { LPC_CORR c = 0; LPC_FLOAT const *lbuf = buf + nc; // Points to current sample + nc int istop; #define CI(I) ( ((XPN)buf[I] * (XPN)lbuf[I]) ) //#define CI(I) (buf[I] * lbuf[I]) istop = n - 15; // Process 16 steps at a time for speed... i = n - nc; for (; i < istop; i += 16) c = (LPN) ( (XPN) c + CI(i+0) + CI(i+1) + CI(i+2) + CI(i+3) + CI(i+4) + CI(i+5) + CI(i+6) + CI(i+7) + CI(i+8) + CI(i+9) + CI(i+10)+ CI(i+11)+ CI(i+12)+ CI(i+13)+ CI(i+14)+ CI(i+15) ); istop = n; // Process any remainder, one step at a time... for (; i < istop; i++) c = (LPN) ( (XPN) c + (XPN) CI(i) ); ac[nc] = (LPN) ( (XPN) ac[nc] + (XPN) c ); #undef CI } }
// ====================================================================== // Compute the autocorrelation void autocorrelation(int n, LPC_WORD const *ibuf, int nc, LPC_CORR *ac) { int i; // Copy integer data to float -- speeds things up slightly... LPC_FLOAT buf[ZWINMAX]; for (i = 0; i < n ; i++) buf[i] = (LPC_FLOAT) ibuf[i]; while (nc--) { LPC_CORR c = 0; LPC_FLOAT const *lbuf = buf + nc; // Points to current sample + nc #define CI(I) ( ((XPN)buf[I] * (XPN)lbuf[I]) ) //#define CI(I) (buf[I] * lbuf[I]) int istop = n - nc - 15; // Process 16 steps at a time for speed... for (i = 0; i < istop; i += 16) c = (LPN) ((XPN) c + CI(i+0) + CI(i+1) + CI(i+2) + CI(i+3) + CI(i+4) + CI(i+5) + CI(i+6) + CI(i+7) + CI(i+8) + CI(i+9) + CI(i+10)+ CI(i+11)+ CI(i+12)+ CI(i+13)+ CI(i+14)+ CI(i+15) ); istop = n - nc; // Process any remainder, one step at a time... for (; i < istop; i++) c = (LPN) ( (XPN) c + CI(i) ); ac[nc] = c; #undef CI } }
int main(int argc, char **argv) { //********************************************* // D I A G N O S T I C S //Diagnostic used for error and warning!! its possible to create a DiagnosticClient for handling displays of it llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions> DiagOpts = new clang::DiagnosticOptions(); //Options for controlling the compiler diagnostics engine. //the printing client clang::TextDiagnosticPrinter *DiagClient = new clang::TextDiagnosticPrinter(llvm::errs(), &*DiagOpts); //Can be used and shared by multiple Diagnostics for multiple translation units. llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> pDiagIDs; //Concrete class used by the front-end to report problems and issues. clang::DiagnosticsEngine Diags(pDiagIDs, &*DiagOpts, DiagClient); //had false at the end?? //ins: _ClangExecutable, _DefaultTargetTriple, _DefaultImageName, _Diags // std::string Path = "/mnt/storage/workspaces/yuk_dev/llvm_testProject/src/clang_interpreter/aa"; clang::driver::Driver TheDriver("", llvm::sys::getProcessTriple(), "a.out", Diags); // Encapsulate logic for constructing compilation processes from a set of gcc-driver-like command line arguments TheDriver.setTitle("cppjittest"); llvm::SmallVector<const char *, 16> Args(argv, argv + argc); Args.push_back("test.cpp"); Args.push_back("-fsyntax-only"); llvm::OwningPtr<clang::driver::Compilation> C(TheDriver.BuildCompilation(Args)); //Construct a compilation object for a command line argument vector. if (!C) { printf("unable to create compiler\n"); return 0; } // We expect to get back exactly one command job, if we didn't something // failed. Extract that job from the compilation. const clang::driver::JobList &Jobs = C->getJobs(); if (Jobs.size() != 1 || !llvm::isa<clang::driver::Command>(*Jobs.begin())) { llvm::SmallString<256> Msg; llvm::raw_svector_ostream OS(Msg); Jobs.Print(OS, "; ", true); Diags.Report(clang::diag::err_fe_expected_compiler_job) << OS.str(); return 1; } const clang::driver::Command *Cmd = llvm::cast<clang::driver::Command>(*Jobs.begin()); if (llvm::StringRef(Cmd->getCreator().getName()) != "clang") { Diags.Report(clang::diag::err_fe_expected_clang_command); return 1; } // Initialize a compiler invocation object from the clang (-cc1) arguments. helper class for holding the data necessary to invoke the compile const clang::driver::ArgStringList &CCArgs = Cmd->getArguments(); //nasty fix to remove -disable-free, otherwise leaks clang::driver::ArgStringList newArgList; for(unsigned int i = 0; i < CCArgs.size(); ++i) { if("-disable-free" == CCArgs[i]) continue; newArgList.push_back(CCArgs[i]); } llvm::OwningPtr<clang::CompilerInvocation> CI(new clang::CompilerInvocation); clang::CompilerInvocation::CreateFromArgs(*CI, const_cast<const char **>(newArgList.data()), const_cast<const char **>(newArgList.data()) + newArgList.size(), Diags); //for now CI->getHeaderSearchOpts().Verbose = 1; // Show the invocation, with -v. if (CI->getHeaderSearchOpts().Verbose) { llvm::errs() << "clang invocation:\n"; Jobs.Print(llvm::errs(), "\n", true); llvm::errs() << "\n"; } // Create a compiler instance to handle the actual work. clang::CompilerInstance Clang; Clang.setInvocation(CI.take()); // Create the compilers actual diagnostics engine. Clang.createDiagnostics(); if (!Clang.hasDiagnostics()) { printf("unable to create diagnostics"); return 1; } // Infer the builtin include path if unspecified. if (Clang.getHeaderSearchOpts().UseBuiltinIncludes && Clang.getHeaderSearchOpts().ResourceDir.empty()) { printf("no resources, should setup resource here i guess??\n"); return 1; } //! @warning hardcoded path!!!! Clang.getHeaderSearchOpts().AddPath("/mnt/storage/development/cpp/llvm/checkout/install/lib/clang/3.4/include", clang::frontend::Angled, false, false); // ----// // Create and execute the frontend to generate an LLVM bitcode module. llvm::OwningPtr<clang::CodeGenAction> Act(new clang::EmitLLVMOnlyAction()); if (!Clang.ExecuteAction(*Act)) return 1; llvm::Module *Module = Act->takeModule(); // Print all functions in the module for (llvm::Module::FunctionListType::iterator i = Module->getFunctionList().begin(); i != Module->getFunctionList().end(); ++i) printf("%s\n", i->getName().str().c_str()); llvm::outs() << *Module; (void)Execute(Module); C->getJobs().clear(); llvm::llvm_shutdown(); return 0; }
/** Cache J2000 rotation quaternion over a time range. * * This method will load an internal cache with frames over a time * range. This prevents the NAIF kernels from being read over-and-over * again and slowing an application down due to I/O performance. Once the * cache has been loaded then the kernels can be unloaded from the NAIF * system. * * @internal * @history 2010-12-23 Debbie A. Cook Added set of full cache time * parameters */ void LineScanCameraRotation::LoadCache() { NaifStatus::CheckErrors(); double startTime = p_cacheTime[0]; int size = p_cacheTime.size(); double endTime = p_cacheTime[size-1]; SetFullCacheParameters(startTime, endTime, size); // TODO Add a label value to indicate pointing is already decomposed to line scan angles // and set p_pointingDecomposition=none,framing angles, or line scan angles. // Also add a label value to indicate jitterOffsets=jitterFileName // Then we can decide whether to simply grab the crot angles or do new decomposition and whether // to apply jitter or throw an error because jitter has already been applied. // *** May need to do a frame trace and load the frames (at least the constant ones) *** // Loop and load the cache double state[6]; double lt; NaifStatus::CheckErrors(); double R[3]; // Direction of radial axis of line scan camera double C[3]; // Direction of cross-track axis double I[3]; // Direction of in-track axis double *velocity; std::vector<double> IB(9); std::vector<double> CI(9); SpiceRotation *prot = p_spi->bodyRotation(); SpiceRotation *crot = p_spi->instrumentRotation(); for(std::vector<double>::iterator i = p_cacheTime.begin(); i < p_cacheTime.end(); i++) { double et = *i; prot->SetEphemerisTime(et); crot->SetEphemerisTime(et); // The following code will be put into method LoadIBcache() spkezr_c("MRO", et, "IAU_MARS", "NONE", "MARS", state, <); NaifStatus::CheckErrors(); // Compute the direction of the radial axis (3) of the line scan camera vscl_c(1. / vnorm_c(state), state, R); // vscl and vnorm only operate on first 3 members of state // Compute the direction of the cross-track axis (2) of the line scan camera velocity = state + 3; vscl_c(1. / vnorm_c(velocity), velocity, C); vcrss_c(R, C, C); // Compute the direction of the in-track axis (1) of the line scan camera vcrss_c(C, R, I); // Load the matrix IB and enter it into the cache vequ_c(I, (SpiceDouble( *)) &IB[0]); vequ_c(C, (SpiceDouble( *)) &IB[3]); vequ_c(R, (SpiceDouble( *)) &IB[6]); p_cacheIB.push_back(IB); // end IB code // Compute the CIcr matrix - in-track, cross-track, radial frame to constant frame mxmt_c((SpiceDouble( *)[3]) & (crot->TimeBasedMatrix())[0], (SpiceDouble( *)[3]) & (prot->Matrix())[0], (SpiceDouble( *)[3]) &CI[0]); // Put CI into parent cache to use the parent class methods on it mxmt_c((SpiceDouble( *)[3]) &CI[0], (SpiceDouble( *)[3]) &IB[0], (SpiceDouble( *)[3]) &CI[0]); p_cache.push_back(CI); } p_cachesLoaded = true; SetSource(Memcache); NaifStatus::CheckErrors(); }
int main(int argc, char *argv[]) { (argc+1 ? has_destructor() : throw 0); CI((argc+1 ? throw 0 : has_destructor())); CI((0 ? has_destructor() : throw 0)); CI((1 ? throw 0 : has_destructor())); (0 ? throw 0 : has_destructor()); (1 ? has_destructor() : throw 0); (argc+1 ? no_destructor() : throw 0); CI((argc+1 ? throw 0 : no_destructor())); CI((0 ? no_destructor() : throw 0)); CI((1 ? throw 0 : no_destructor())); (0 ? throw 0 : no_destructor()); (1 ? no_destructor() : throw 0); int i = 1; CI(throw PI(i)); if (i != 2) abort(); (1 ? 0 : throw PI(i)); if (i != 2) abort(); CI(0 ? 0 : throw PI(i)); if (i != 3) abort(); CI(0 ? has_destructor() : throw PI(i)); if (i != 4) abort(); (argc+1 ? has_destructor() : throw PI(i)); if (i != 4) abort(); i = 1; CI(throw i++); if (i != 2) abort(); (1 ? 0 : throw i++); if (i != 2) abort(); CI(0 ? 0 : throw i++); if (i != 3) abort(); CI(0 ? has_destructor() : throw i++); if (i != 4) abort(); (argc+1 ? has_destructor() : throw i++); if (i != 4) abort(); }
}; #define OFF(f) bitize(offsetof(xfs_agi_t, agi_ ## f)) const field_t agi_flds[] = { { "magicnum", FLDT_UINT32X, OI(OFF(magicnum)), C1, 0, TYP_NONE }, { "versionnum", FLDT_UINT32D, OI(OFF(versionnum)), C1, 0, TYP_NONE }, { "seqno", FLDT_AGNUMBER, OI(OFF(seqno)), C1, 0, TYP_NONE }, { "length", FLDT_AGBLOCK, OI(OFF(length)), C1, 0, TYP_NONE }, { "count", FLDT_AGINO, OI(OFF(count)), C1, 0, TYP_NONE }, { "root", FLDT_AGBLOCK, OI(OFF(root)), C1, 0, TYP_INOBT }, { "level", FLDT_UINT32D, OI(OFF(level)), C1, 0, TYP_NONE }, { "freecount", FLDT_AGINO, OI(OFF(freecount)), C1, 0, TYP_NONE }, { "newino", FLDT_AGINO, OI(OFF(newino)), C1, 0, TYP_INODE }, { "dirino", FLDT_AGINO, OI(OFF(dirino)), C1, 0, TYP_INODE }, { "unlinked", FLDT_AGINONN, OI(OFF(unlinked)), CI(XFS_AGI_UNLINKED_BUCKETS), FLD_ARRAY, TYP_NONE }, { NULL } }; static void agi_help(void) { dbprintf(_( "\n" " set allocation group inode btree\n" "\n" " Example:\n" "\n" " agi 3 (set location to 3rd allocation group inode btree and type to 'agi')\n" "\n" " Located in the 3rd 512 byte block of each allocation group,\n"
/********************************************************************* * The Tree *********************************************************************/ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : QTreeWidget( _parent ), p_intf( _p_intf ) { /* General Qt options */ setAlternatingRowColors( true ); setHeaderHidden( true ); setIconSize( QSize( ITEM_HEIGHT,ITEM_HEIGHT ) ); setTextElideMode( Qt::ElideNone ); setUniformRowHeights( true ); CONNECT( this, itemExpanded(QTreeWidgetItem*), this, resizeColumns() ); /* Nice icons */ #define BI( a,b) QIcon a##_icon = QIcon( b ) BI( audio, ":/prefsmenu/advanced/audio" ); BI( video, ":/prefsmenu/advanced/video" ); BI( input, ":/prefsmenu/advanced/codec" ); BI( sout, ":/prefsmenu/advanced/sout" ); BI( advanced, ":/prefsmenu/advanced/extended" ); BI( playlist, ":/prefsmenu/advanced/playlist" ); BI( interface, ":/prefsmenu/advanced/intf" ); #undef BI /* Build the tree for the main module */ module_t *p_module = module_get_main(); /* Initialisation and get the confsize */ PrefsItemData *data = NULL; PrefsItemData *data_sub = NULL; QTreeWidgetItem *current_item = NULL; unsigned confsize; module_config_t *const p_config = module_config_get (p_module, &confsize); /* Go through the list of conf */ for( size_t i = 0; i < confsize; i++ ) { const char *psz_help; QIcon icon; /* Work on a new item */ module_config_t *p_item = p_config + i; switch( p_item->i_type ) { /* This is a category */ case CONFIG_CATEGORY: if( p_item->value.i == -1 ) break; /* PrefsItemData Init */ data = new PrefsItemData(); data->name = qtr( config_CategoryNameGet( p_item->value.i ) ); psz_help = config_CategoryHelpGet( p_item->value.i ); if( psz_help ) data->help = qtr( psz_help ); else data->help.clear(); data->i_type = TYPE_CATEGORY; data->i_object_id = p_item->value.i; /* This is a category, put a nice icon */ switch( p_item->value.i ) { #define CI(a,b) case a: icon = b##_icon;break CI( CAT_AUDIO, audio ); CI( CAT_VIDEO, video ); CI( CAT_INPUT, input ); CI( CAT_SOUT, sout ); CI( CAT_ADVANCED, advanced ); CI( CAT_PLAYLIST, playlist ); CI( CAT_INTERFACE, interface ); } #undef CI /* Create a new QTreeItem to display it in the tree at top level */ current_item = new QTreeWidgetItem(); current_item->setText( 0, data->name ); current_item->setIcon( 0 , icon ); //current_item->setSizeHint( 0, QSize( -1, ITEM_HEIGHT ) ); current_item->setData( 0, Qt::UserRole, qVariantFromValue( data ) ); addTopLevelItem( current_item ); break; /* This is a subcategory */ case CONFIG_SUBCATEGORY: if( p_item->value.i == -1 ) break; /* Special cases: move the main subcategories to the parent cat*/ if( data && ( p_item->value.i == SUBCAT_VIDEO_GENERAL || p_item->value.i == SUBCAT_ADVANCED_MISC || p_item->value.i == SUBCAT_INPUT_GENERAL || p_item->value.i == SUBCAT_INTERFACE_GENERAL || p_item->value.i == SUBCAT_SOUT_GENERAL|| p_item->value.i == SUBCAT_PLAYLIST_GENERAL|| p_item->value.i == SUBCAT_AUDIO_GENERAL ) ) { /* Data still contains the correct thing */ data->i_type = TYPE_CATSUBCAT; data->i_subcat_id = p_item->value.i; data->name = qtr( config_CategoryNameGet( p_item->value.i ) ); psz_help = config_CategoryHelpGet( p_item->value.i ); if( psz_help ) data->help = qtr( psz_help ); else data->help.clear(); current_item->setData( 0, Qt::UserRole, QVariant::fromValue( data ) ); continue; } /* Normal Subcategories */ /* Process the Data */ data_sub = new PrefsItemData(); data_sub->name = qtr( config_CategoryNameGet( p_item->value.i) ); psz_help = config_CategoryHelpGet( p_item->value.i ); if( psz_help ) data_sub->help = qtr( psz_help ); else data_sub->help.clear(); data_sub->i_type = TYPE_SUBCATEGORY; data_sub->i_object_id = p_item->value.i; /* Create a new TreeWidget */ QTreeWidgetItem *subcat_item = new QTreeWidgetItem(); subcat_item->setText( 0, data_sub->name ); subcat_item->setData( 0, Qt::UserRole, qVariantFromValue( data_sub ) ); //subcat_item->setSizeHint( 0, QSize( -1, ITEM_HEIGHT ) ); /* Add it to the parent */ assert( current_item ); current_item->addChild( subcat_item ); break; /* Other items don't need yet a place on the tree */ } } module_config_free( p_config ); module_t **p_list = module_list_get( NULL ); /* Build the tree of plugins */ for( size_t i = 0; (p_module = p_list[i]) != NULL; i++ ) { // Main module excluded if( module_is_main( p_module) ) continue; unsigned confsize; int i_subcategory = 0, i_category = 0; bool b_options = false; module_config_t *const p_config = module_config_get (p_module, &confsize); /* Loop through the configurations items */ for (size_t i = 0; i < confsize; i++) { const module_config_t *p_item = p_config + i; if( p_item->i_type == CONFIG_CATEGORY ) i_category = p_item->value.i; else if( p_item->i_type == CONFIG_SUBCATEGORY ) i_subcategory = p_item->value.i; if( CONFIG_ITEM(p_item->i_type) ) b_options = true; if( b_options && i_category && i_subcategory ) break; } module_config_free (p_config); /* Dummy item, please proceed */ if( !b_options || i_category == 0 || i_subcategory == 0 ) continue; // Locate the category item; QTreeWidgetItem *subcat_item = NULL; bool b_found = false; for( int i_cat_index = 0 ; i_cat_index < topLevelItemCount(); i_cat_index++ ) { /* Get the treeWidgetItem that correspond to the category */ QTreeWidgetItem *cat_item = topLevelItem( i_cat_index ); PrefsItemData *data = cat_item->data( 0, Qt::UserRole ). value<PrefsItemData *>(); /* If we match the good category */ if( data->i_object_id == i_category ) { for( int i_sc_index = 0; i_sc_index < cat_item->childCount(); i_sc_index++ ) { subcat_item = cat_item->child( i_sc_index ); PrefsItemData *sc_data = subcat_item->data(0, Qt::UserRole). value<PrefsItemData *>(); if( sc_data && sc_data->i_object_id == i_subcategory ) { b_found = true; break; } } if( !b_found ) { subcat_item = cat_item; b_found = true; } break; } } if( !b_found ) continue; PrefsItemData *module_data = new PrefsItemData(); module_data->i_type = TYPE_MODULE; module_data->psz_name = strdup( module_get_object( p_module ) ); module_data->name = qtr( module_get_name( p_module, false ) ); module_data->help.clear(); const char *psz_help = module_get_help( p_module ); if ( psz_help ) module_data->help = qtr( psz_help ); QTreeWidgetItem *module_item = new QTreeWidgetItem(); module_item->setText( 0, module_data->name ); module_item->setData( 0, Qt::UserRole, QVariant::fromValue( module_data) ); //module_item->setSizeHint( 0, QSize( -1, ITEM_HEIGHT ) ); subcat_item->addChild( module_item ); } /* We got everything, just sort a bit */ sortItems( 0, Qt::AscendingOrder ); module_list_free( p_list ); resizeColumnToContents( 0 ); }
static const cmdinfo_t dquot_cmd = { "dquot", NULL, dquot_f, 1, 2, 1, N_("[-g|-p|-u] id"), N_("set current address to a group, project or user quota block for given ID"), dquot_help, }; const field_t dqblk_hfld[] = { { "", FLDT_DQBLK, OI(0), C1, 0, TYP_NONE }, { NULL } }; #define DDOFF(f) bitize(offsetof(xfs_dqblk_t, dd_ ## f)) #define DDSZC(f) szcount(xfs_dqblk_t, dd_ ## f) const field_t dqblk_flds[] = { { "diskdq", FLDT_DISK_DQUOT, OI(DDOFF(diskdq)), C1, 0, TYP_NONE }, { "fill", FLDT_CHARS, OI(DDOFF(fill)), CI(DDSZC(fill)), FLD_SKIPALL, TYP_NONE }, { "crc", FLDT_CRC, OI(DDOFF(crc)), C1, 0, TYP_NONE }, { "lsn", FLDT_UINT64X, OI(DDOFF(lsn)), C1, 0, TYP_NONE }, { "uuid", FLDT_UUID, OI(DDOFF(uuid)), C1, 0, TYP_NONE }, { NULL } }; #define DOFF(f) bitize(offsetof(xfs_disk_dquot_t, d_ ## f)) const field_t disk_dquot_flds[] = { { "magic", FLDT_UINT16X, OI(DOFF(magic)), C1, 0, TYP_NONE }, { "version", FLDT_UINT8X, OI(DOFF(version)), C1, 0, TYP_NONE }, { "flags", FLDT_UINT8X, OI(DOFF(flags)), C1, 0, TYP_NONE }, { "id", FLDT_DQID, OI(DOFF(id)), C1, 0, TYP_NONE }, { "blk_hardlimit", FLDT_QCNT, OI(DOFF(blk_hardlimit)), C1, 0, TYP_NONE },
{ "nameidx", FLDT_UINT16D, OI(LEOFF(nameidx)), C1, 0, TYP_NONE }, { "namelen", FLDT_UINT8D, OI(LEOFF(namelen)), C1, 0, TYP_NONE }, { "pad2", FLDT_UINT8X, OI(LEOFF(pad2)), C1, FLD_SKIPALL, TYP_NONE }, { NULL } }; #define LHOFF(f) bitize(offsetof(xfs_dir_leaf_hdr_t, f)) const field_t dir_leaf_hdr_flds[] = { { "info", FLDT_DIR_BLKINFO, OI(LHOFF(info)), C1, 0, TYP_NONE }, { "count", FLDT_UINT16D, OI(LHOFF(count)), C1, 0, TYP_NONE }, { "namebytes", FLDT_UINT16D, OI(LHOFF(namebytes)), C1, 0, TYP_NONE }, { "firstused", FLDT_UINT16D, OI(LHOFF(firstused)), C1, 0, TYP_NONE }, { "holes", FLDT_UINT8D, OI(LHOFF(holes)), C1, 0, TYP_NONE }, { "pad1", FLDT_UINT8X, OI(LHOFF(pad1)), C1, FLD_SKIPALL, TYP_NONE }, { "freemap", FLDT_DIR_LEAF_MAP, OI(LHOFF(freemap)), CI(XFS_DIR_LEAF_MAPSIZE), FLD_ARRAY, TYP_NONE }, { NULL } }; #define LMOFF(f) bitize(offsetof(xfs_dir_leaf_map_t, f)) const field_t dir_leaf_map_flds[] = { { "base", FLDT_UINT16D, OI(LMOFF(base)), C1, 0, TYP_NONE }, { "size", FLDT_UINT16D, OI(LMOFF(size)), C1, 0, TYP_NONE }, { NULL } }; #define LNOFF(f) bitize(offsetof(xfs_dir_leaf_name_t, f)) const field_t dir_leaf_name_flds[] = { { "inumber", FLDT_DIR_INO, OI(LNOFF(inumber)), C1, 0, TYP_INODE }, { "name", FLDT_CHARNS, OI(LNOFF(name)), dir_leaf_name_count, FLD_COUNT, TYP_NONE },
/* Compute analytic dynamics */ void computeAnalyticOutputs(std::map<const std::string, bool> &outs, struct PARAMETERS * p) { // energy spacing in bulk std::complex <double> dE ((p->kBandTop-p->kBandEdge)/(p->Nk-1), 0); // bulk-QD coupling std::complex <double> Vee (p->Vnobridge[0], 0); // rate constant (can be defined also as K/2) std::complex <double> K = std::complex <double> (3.1415926535,0)*pow(Vee,2)/dE; // time std::complex <double> t (0, 0); // energy differences std::complex <double> wnm (0, 0); std::complex <double> wnnp (0, 0); std::complex <double> wnpm (0, 0); // coefficients std::complex <double> cm (0, 0); std::complex <double> cn (0, 0); std::complex <double> cn_term1 (0, 0); std::complex <double> cn_term2 (0, 0); std::complex <double> cn_diag (0, 0); std::complex <double> cn_offdiag (0, 0); double cn_tot; // complex numbers are dumb std::complex <double> C0 (0.0, 0.0); std::complex <double> C1 (1.0, 0.0); std::complex <double> NEGC1 (-1.0, 0.0); std::complex <double> CI (0.0, 1.0); std::complex <double> NEGCI (0.0, -1.0); // unpack params a bit int Nk = p->Nk; int Nc = p->Nc; int Ik = p->Ik; int Ic = p->Ic; int N = p->NEQ; double * energies = &(p->energies[0]); double * startWfn = &(p->startWfn[0]); // Create matrix of energy differences std::vector<std::complex <double>> Elr (Nk*Nc, std::complex <double> (0.0, 0.0)); for (int ii = 0; ii < Nk; ii++) { for (int jj = 0; jj < Nc; jj++) { // array follows convention that first index is for QC state // e.g. Elr[i*Nc + j] = E_{ij} Elr[ii*Nc + jj] = std::complex <double> (energies[Ik + ii] - energies[Ic + jj], 0); } } #ifdef DEBUG_ANALYTIC std::cout << std::endl; std::cout << "Energy gaps:" << std::endl; for (int ii = 0; ii < Nc*Nk; ii++) { std::cout << Elr[ii] << " "; } std::cout << std::endl; std::cout << std::endl; #endif // Create matrix of prefactors for each QC (n) state std::complex <double> pref; std::vector<std::complex <double>> prefQC (Nk*Nc, std::complex <double> (0.0, 0.0)); for (int ii = 0; ii < Nk; ii++) { // V*c_l/(E_{lr} + i\kappa) pref = Vee*(std::complex <double> (startWfn[Ik + ii], startWfn[Ik + N + ii])); std::cout << startWfn[Ik + ii] << "," << pref << " "; for (int jj = 0; jj < Nc; jj++) { prefQC[ii*Nc + jj] = pref/(Elr[ii*Nc + jj] + CI*K); } } #ifdef DEBUG_ANALYTIC std::cout << std::endl; for (int ii = 0; ii < Nc*Nk; ii++) { std::cout << prefQC[ii] << " "; } std::cout << std::endl; std::cout << std::endl; #endif // calculate wavefunction coefficients on electron-accepting side over time std::vector<std::complex <double>> crt (Nc*p->numOutputSteps, std::complex <double> (0.0, 0.0)); int timeIndex = 0; for (std::complex <double> t = C0; std::real(t) <= p->tout; t += std::complex <double> (p->tout/p->numOutputSteps, 0.0), timeIndex++) { for (int ii = 0; ii < Nc; ii++) { // TODO add bit for multiple state terms for (int jj = 0; jj < Nk; jj++) { crt[timeIndex*Nc + ii] += prefQC[jj]*(exp(NEGCI*Elr[jj*Nc + ii]*t) - exp(NEGC1*K*t)); } } } // calculate populations on electron-accepting side over time std::vector<double> Prt (Nc*p->numOutputSteps, 0.0); for (int ii = 0; ii <= p->numOutputSteps; ii++) { for (int jj = 0; jj < Nc; jj++) { Prt[ii*Nc + jj] = pow(real(crt[ii*Nc + jj]), 2) + pow(imag(crt[ii*Nc + jj]), 2); } } if (isOutput(outs, "analytic_tcprob.out")) { std::ofstream output("analytic_tcprob.out"); for (int ii = 0; ii <= p->numOutputSteps; ii++) { output << p->times[ii]; for (int jj = 0; jj < Nc; jj++) { output << " " << Prt[ii*Nc + jj]; output << " " << real(crt[ii*Nc + jj]) << " " << imag(crt[ii*Nc + jj]); } output << std::endl; } output.close(); } return; }