Пример #1
0
void semafor_down()
{
	int* shmem = get_mem();

	fore(getpid());
	print("Proceso 1 intenta bajar semaforo\n");

	sem_down();

	fore(getpid());
	print("Proceso 1 baja semaforo:\n");
	print("    Variable en shared memory tiene valor:\n");
	print("    ");
	printint(*shmem);
	*shmem = *shmem + 2;
	print("\n    Se le suma 2 y ahora tiene valor:\n");
	print("    ");
	printint(*shmem);
	print("\n");

	sleep(5);

	sem_up();
	fore(getpid());
	print("Proceso 1 levanta semaforo\n");

	fore(getppid());
	while(1);
}
Пример #2
0
static inline const char* fore(Level level) {
    Color color;
    switch (level) {
    case LEVEL_DEBUG:
        color = foreDebug;
        break;
    case LEVEL_INFO:
        color = foreInfo;
        break;
    case LEVEL_NORMAL:
        color = foreNormal;
        break;
    case LEVEL_WARNING:
        color = foreWarning;
        break;
    case LEVEL_ERROR:
        color = foreError;
        break;
    default:  // case LEVEL_OFF:
        assert(false);
        color = COLOR_DEFAULT;
        break;
    }
    return fore(color);
}
Пример #3
0
void stack2()
{
	int a;
	print("a vale: ");
	printint(a);
	print("\n");
	a=15;
	print("ahora a vale: ");
	printint(a);
	print("\n");
	fore(getppid());
	while(1);
}
Пример #4
0
void TaxMan(void)
{
	double tax;
	int i;
	char c;

	JOUST(PLAYER.Level);
	d *= 1000.;
	if(PLAYER.Gold + PLAYER.Bank > d) {
		NL;
		tax = PLAYER.Gold + PLAYER.Bank - d;
		sprintf(outbuf, "%s, the tax collector, looks at your bulging money purse", IRSREC->Handle);
		OUT(outbuf); NL;
		OUT("and says, \"Ah, it is time to pay your taxes!\"  You check out the two burly"); NL;
		sprintf(outbuf, "guards who stand ready to enforce %s's will.", SYSREC->Handle);
		OUT(outbuf); NL; NL;
		Delay(100);
		sprintf(outbuf, "The tax will cost you %s.", money(tax,ANSI));
		OUT(outbuf); NL; NL;
		Delay(100);
		sprintf(prompt, "%sWill you pay the tax (Y/N)? ", fore(CYN));
		do {
			OUT(prompt);
			c = inkey('Y', 'Y');
			NL;
		} while(c != 'Y' && c != 'N');
		NL;
		if(c == 'N') {
			sound2("taxman", 0);
			OUT("The tax collector orders his guards, \"Run this outlaw through!\""); NL; NL;
			Delay(100);
			for(i = 0; i < 2; i++) {
				memset(RPC[1][i], 0, sizeof(struct RPC));
				sprintf(RPC[1][i]->user.Handle, "City Guard #%d", i + 1);
				sprintf(RPC[1][i]->user.Class, "%s.%s", table->class[0]->Origin, table->class[0]->Character[dice(MAXCLASS(0))-1]->Name);
				RPC[1][i]->user.Level = PLAYER.Level / 2 + 1;
				RPC[1][i]->user.Sex = 'I';
				sprintf(RPC[1][i]->user.Weapon, "NATURAL.%u", RPC[1][i]->user.Level/2 + dice(RPC[1][i]->user.Level/2));
				sprintf(RPC[1][i]->user.Armor, "NATURAL.%u", RPC[1][i]->user.Level/4 + dice(RPC[1][i]->user.Level/4));
				CreateRPC(RPC[1][i]);
				RPC[1][i]->user.Poison = (UWORD)~0;
				if(RPC[1][i]->SP)
					RPC[1][i]->user.Spell = HEAL_SPELL | BLAST_SPELL;
			}
			from = '\0';
			Battle();
			if(RPC[1][0]->HP > 0 || RPC[1][1]->HP > 0 || !ONLINE->HP)
				c = 'Y';
		}
Пример #5
0
void stack1()
{
	print("dummy\n");
	fore(getppid());
	while(1);
}
Пример #6
0
void OutputTabWindow::InitStyle(wxStyledTextCtrl* sci, int lexer, bool folding)
{
    sci->SetLexer(lexer);
    sci->StyleClearAll();

    for(int i = 0; i <= wxSTC_STYLE_DEFAULT; i++) {
        sci->StyleSetBackground(i, DrawingUtils::GetOutputPaneBgColour());
        sci->StyleSetForeground(i, DrawingUtils::GetOutputPaneFgColour());
    }

    wxFont defFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
    wxFont font = EditorConfigST::Get()->GetLexer("text")->GetFontForSyle(0);
    sci->StyleSetFont(0, font);

    sci->SetIndicatorCurrent(1);
#ifdef __WXMSW__
    int facttor = 2;
#else
    int facttor = 5;
#endif
    sci->IndicatorSetForeground(1, MakeColourLighter(wxT("GOLD"), facttor));
    sci->IndicatorSetForeground(2, MakeColourLighter(wxT("RED"), 4));
    sci->IndicatorSetStyle(1, wxSTC_INDIC_ROUNDBOX);
    sci->IndicatorSetStyle(2, wxSTC_INDIC_ROUNDBOX);
    sci->IndicatorSetUnder(1, true);
    sci->IndicatorSetUnder(2, true);

    // sci->IndicatorSetAlpha(1, 70);
    // sci->IndicatorSetAlpha(2, 70);

    sci->SetHotspotActiveUnderline(true);
    sci->SetHotspotActiveForeground(true, wxT("BLUE"));
    sci->SetHotspotSingleLine(true);
    sci->SetMarginType(1, wxSTC_MARGIN_SYMBOL);
    sci->SetMarginMask(4, wxSTC_MASK_FOLDERS);

    sci->SetMarginWidth(0, 0);
    sci->SetMarginWidth(1, 0);
    sci->SetMarginWidth(2, 0);

    if(folding) {
        sci->SetMarginWidth(4, 16);
        sci->SetProperty(wxT("fold"), wxT("1"));
        sci->SetMarginSensitive(4, true);
    }

    // current line marker
    DefineMarker(sci, 0x7, wxSTC_MARK_ARROW, wxColor(0x00, 0x00, 0x00), wxColor(0xff, 0xc8, 0xc8));

    wxColor fore(0xff, 0xff, 0xff);
    wxColor back(0x80, 0x80, 0x80);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDER, wxSTC_MARK_ARROW, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_BACKGROUND, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_BACKGROUND, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_ARROW, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_BACKGROUND, fore, back);

    sci->SetWrapStartIndent(4);
    sci->SetWrapVisualFlags(2);

    sci->SetScrollWidthTracking(true);

    sci->SetReadOnly(true);
}