コード例 #1
0
ファイル: process.c プロジェクト: joewing/itop
/****************************************************************************
 * List the process information.
 ****************************************************************************/
void ListProcesses(int line, int max) {
	int x;
	int number;
	int limit;

	printf("\033[%d;%dH\033[2K\033[1m\033[7m", line, 0);
	printf("%10s %10s USERNAME PRI  SIZE   RES STATE    TIME"
		" TRS  RCPU%% COMMAND", "PID", "PGRP");
	printf("\033[0m");

	limit = (max < listSize) ? max : listSize;
	number = line + 1;
	for(x = 0; x < limit; x++) {
		if(!displayIdle && list[x].pcpu < IDLE_THRESHOLD) {
			continue;
		}
		if(displayUser >= 0 && displayUser != list[x].uid) {
			continue;
		}
		printf("\033[%d;%dH\033[2K", number, 0);
		printf("%10lu %10lu", (long)list[x].pid, (long)list[x].pgrp);
		if(list[x].username) {
			printf(" %-8s ", list[x].username);
		} else {
			printf(" %-8s ", "?");
		}
		printf("%3d ", list[x].priority);
		PrintInteger(list[x].size);
		printf(" ");
		PrintInteger(list[x].res);
		printf(" ");
		if(list[x].state == STATE_RUN) {
			printf(STATE_NAME[list[x].state], list[x].cpu);
		} else {
			printf(STATE_NAME[list[x].state]);
		}
		printf("%5lu:%02lu", list[x].t / 60, list[x].t % 60);
		printf("%4lu", list[x].threads);
		if(processTotal) {
			printf(" %6.2f ", (double)list[x].pcpu * 100.0
				/ (double)processTotal);
		} else {
			printf(" %6.2f ", 0.0);
		}
		printf("%-7s", list[x].command);
		++number;
	}
	while(number <= maxLines + line) {
		printf("\033[%d;%dH\033[2K", number, 0);
		++number;
	}

}
コード例 #2
0
ファイル: pasm.c プロジェクト: neutered/propgcc
static void
PrintGasConstantDecl(FILE *f, AST *ast, int inlineAsm)
{
    startLine(f, inlineAsm);
    fprintf(f, "\t\t.equ\t%s, ", ast->d.string);
    PrintInteger(f, EvalConstExpr(ast));
    endLine(f, inlineAsm);
}
コード例 #3
0
ファイル: main.c プロジェクト: VIJESHG/project
int main(){
	Integer ans;
	char arr[128];
	scanf("%[^\n]", arr);   /* expression */
	ans = infix(arr);
	printf("Answer: ");
	PrintInteger(ans);
	return 0;
}
コード例 #4
0
ファイル: Source.cpp プロジェクト: RoryVaughn/Homework
int main()
{
	int the_variable = 1;
	PrintInteger(the_variable);
	{
		PrintInteger(the_variable);
		int the_variable = 2;
		PrintInteger(the_variable);
		{
			PrintInteger(the_variable);
			int the_variable = 3;
			PrintInteger(the_variable);
		}
		PrintInteger(the_variable);
	}
	PrintInteger(the_variable);
	
}//the output of this fuction is: 1, 1, 2, 2, 3, 2, 1
コード例 #5
0
ファイル: Source.cpp プロジェクト: brockbarlow/Homework
int main()
{
	int the_variable = 1;
	PrintInteger(the_variable);
	{
		PrintInteger(the_variable);
		int the_variable = 2;
		PrintInteger(the_variable);
		{
			PrintInteger(the_variable);
			int the_variable = 3;
			PrintInteger(the_variable);
		}
		PrintInteger(the_variable);
	}
	PrintInteger(the_variable);
	system("pause");

	/*Output is 1,1,2,2,3,2,1*/
}