示例#1
0
文件: QTREE6.cpp 项目: bailehang/Code
 inline void rot(int x) {
     int f = fa[x], ff = fa[f];
     int p = d(x), pp = d(f);
     if(isRoot(f)) fa[x] = ff;
     else setc(ff, x, pp);
     setc(f, c[x][p^1], p), setc(x, f, p^1);
     pushUp(f);
 }
示例#2
0
文件: QTREE6.cpp 项目: bailehang/Code
 inline void access(int x) {
     for(int y = 0; x; y = x, x = fa[x]) {
         splay(x);
         s[x][lc[c[x][1]]] += maxl[c[x][1]];
         s[x][lc[y]] -= maxl[y];
         setc(x, y, 1), pushUp(x);
     }
 }
示例#3
0
文件: QTREE7.cpp 项目: bailehang/Code
 inline void access(int x) {
     for(int y = 0; x; y = x, x = fa[x]) {
         splay(x);
         if(c[x][1]) m[x][lc[c[x][1]]].insert(maxl[c[x][1]]);
         if(y) m[x][lc[y]].erase(m[x][lc[y]].find(maxl[y]));
         setc(x, y, 1), pushUp(x);
     }
 }
示例#4
0
 inline void rot() {
     int p = dir();
     node *f = fa;
     if(f->isroot()) fa = f->fa;
     else f->fa->setc(this, f->dir());
     f->setc(c[p^1], p), setc(f, p^1);
     f->pushup();
 }
示例#5
0
void Statusflags::checkc(int addsub = 0, char val1 = 0x00, char val2 = 0x00, int Cin=0){
	int tempval1, tempval2, tempoutput;
	tempval1 = (int)val1;
	tempval2 = (int)val2;

	switch (addsub){
	case 0:
		tempoutput = tempval1 + tempval2 + Cin;
		break;
	case 1:
		tempoutput = tempval1 - tempval2 - Cin;
		break;
	}
	tempoutput=tempoutput & 0x0100;
	if (tempoutput != 0){
		setc(1);
	} else {
		setc(0);
	}
}
示例#6
0
void lisp_init(void)
{
    int i;

    fromspace = malloc(heapsize);
    tospace   = malloc(heapsize);
    curheap = fromspace;
    lim = curheap+heapsize-sizeof(cons_t);

    NIL = symbol("nil");
    setc(NIL, NIL);
    T   = symbol("t");
    setc(T,   T);
    LAMBDA = symbol("lambda");
    MACRO = symbol("macro");
    LABEL = symbol("label");
    QUOTE = symbol("quote");
    for (i=0; i < (int)N_BUILTINS; i++)
        setc(symbol(builtin_names[i]), builtin(i));
    setc(symbol("princ"), builtin(F_PRINT));
}
示例#7
0
文件: main.c 项目: Darthsternie/PSP
void printfc(int x, int y, char *fmt, ...)
{	
	char msg[256];

	va_list list;
	va_start(list, fmt);
	vsprintf(msg, fmt, list);
	va_end(list);

	setc(x, y);
	printf(msg);
	setcolor(WHITE);
}
示例#8
0
 PSR& operator=(uint32 data) {
   setf(data), sets(data), setx(data), setc(data);
   return *this;
 }
示例#9
0
文件: main.c 项目: Darthsternie/PSP
int main() 
{

   	pspDebugScreenInit();
	int devkit = sceKernelDevkitVersion(),
	cursor = 0;
	
		if(devkit != 0x06060010)
		Exit("This program supports only 6.60!");

    printf("USB Mod Flasher\n\n");    
	setcolor(RED);
	printf("This Mod is only for the TN-V8 eCFW for the PS Vita!");
	setcolor(WHITE);
	printf("\n\n\n\n\n\n\n\n\n\n\n\nCredits:\nXMB Mod by The Z\nInstaller Port by KanadeEngel\n\nSpecial Thanks to:\nfrostegater");

	while(1)
	{
		if(cursor > 2)
			cursor = 0;
		else if(cursor < 0)
			cursor = 2;

		if(cursor == 0) setbcolor(GRAY);
		printfc(3, 4, " Install XMB Mod.                       ");
		setbcolor(BLACK);
		if(cursor == 1) setbcolor(GRAY);
		printfc(3, 5, " Restore Original Files.                ");
		setbcolor(BLACK);
		if(cursor == 2) setbcolor(GRAY);
		printfc(3, 6, " Exit.                                  ");
		setbcolor(BLACK);

		int i;
		for(i = 0; i < 4; i++)
			printfc(1, 4 + i, " ");

		setcolor(BLUE);
		printfc(1, 4 + cursor, ">");

		unsigned int Buttons = wait_press(PSP_CTRL_CROSS | PSP_CTRL_UP | PSP_CTRL_DOWN);
		wait_release(PSP_CTRL_CROSS | PSP_CTRL_UP | PSP_CTRL_DOWN);

		SceCtrlData pad;
		sceCtrlReadBufferPositive(&pad, 1);

		if(Buttons & PSP_CTRL_CROSS)
		{
			if(cursor != 2)
			{
				setc(0, 9);
				if(assign_flash_zero() < 0)
					Exit("\n Error in 'flash0:/' assign.");
	

					{
						if(cursor == 0)//Install Mod Module
						{
							flash_file("flash0:/vsh/resource/topmenu_icon.rco", _660_install_X_icon, size__660_install_X_icon);
						}
	                    else if(cursor == 1)//Restore Original Module
							flash_file("flash0:/vsh/resource/topmenu_icon.rco", _660_original_X_icon, size__660_original_X_icon);
						}
					}
			else
				Exit("");

			break;
		}
		else if(Buttons & PSP_CTRL_UP)
			cursor--;
		else if(Buttons & PSP_CTRL_DOWN)
			cursor++;
	}

	Exit("Done.");
   sceKernelExitGame();
	return 0;
}
示例#10
0
/**
 * Moves the cursor to a given position.
 * @param	nLine	The cursor's new line number
 * @param	nCol	The cursor's new column number
 * @return	true if successful, false otherwise (cursor interface was not
 *			obtained)
 */
bool EditorPage::setCursorPos(uint nLine, uint nCol)
{
	// Cannot accept line 0
	if (nLine == 0)
		return false;
	
	// Adjust to 0-based counting
	nLine--;
	nCol--;
		
#if 0 // TODO
	Kate::View* pKateView;
	// NOTE: The following code is a fix to a bug in Kate, which wrongly
	// calculates the column number in setCursorPosition.
	pKateView = dynamic_cast<Kate::View*>(m_pView);
	if (pKateView != NULL) {
		KTextEditor::EditInterface* pEditIf;
		const char* szLine;
		uint nRealCol;
		uint nTabAdjust;
		
		// Get a pointer to the edit interface
		pEditIf = dynamic_cast<KTextEditor::EditInterface*>(m_pDoc);
		if (!pEditIf)
			return false;
		
		nRealCol = 0;
		
		// Check for out of bound line numbers
		if (nLine < pEditIf->numLines()) {
			// Get the contents of the requested line
			szLine = pEditIf->textLine(nLine).latin1();
			
			// Check for empty line
			if (szLine != NULL) {
				// The number of columns which a tab character adds
				nTabAdjust = pKateView->tabWidth() - 1;
				
				// Calculate the real column, based on the tab width
				for (; nRealCol < nCol && szLine[nRealCol] != 0; nRealCol++) {
					if (szLine[nRealCol] == '\t')
						nCol -= nTabAdjust;
				}
			}
		}
		else {
			// Marker set beyond end of file, move to the last line
			nLine = pEditIf->numLines() - 1;
		}
		// Set the cursor position
        KTextEditor::cursor setc(nLine, nRealCol);
		m_pView->setCursorPosition(setc);
	}
	else {
		// Non-Kate editors: set the cursor position normally
        KTextEditor::cursor setc(nLine, nRealCol);
		m_pView->setCursorPosition(setc);
	}
#endif
    KTextEditor::Cursor c(nLine, nCol);
    m_pView->setCursorPosition(c);
	
	return true;
}