コード例 #1
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_bass(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance, bass_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_BASS, bass_rec);
}
コード例 #2
0
ファイル: netcdf.cpp プロジェクト: mmase/wgrib2
void NcVar::set_rec(long rec)
{
  // Since we can't ask for the record dimension here
  // just assume [0] is it.....
  set_rec(get_dim(0),rec);
  return;
} 
コード例 #3
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_treble(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance, treble_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_TREBLE, treble_rec);
}
コード例 #4
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_synth(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance, synth_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_SYNTH, synth_rec);
}
コード例 #5
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_line(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance, line_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_LINE, line_rec);
}
コード例 #6
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_cd(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance, cd_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_CD, cd_rec);
}
コード例 #7
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_pcm(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance, pcm_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_PCM, pcm_rec);
}
コード例 #8
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_volume(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance, volume_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_VOLUME, volume_rec);
}
コード例 #9
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_ogain(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance, ogain_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_OGAIN, ogain_rec);
}
コード例 #10
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_imix(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance, imix_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_IMIX, imix_rec);
}
コード例 #11
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_speaker(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance, speaker_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_SPEAKER, speaker_rec);
}
コード例 #12
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_mic(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance, mic_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_MIC, mic_rec);
}
コード例 #13
0
ファイル: next-fit-nee.c プロジェクト: Jannertje/os
void mem_free(long index)
{
	// Check if index is a valid start of a memory block
  if (get_rec(index) != START)
    return;
    
	// Free index
  set_rec(index, FREE);
  
	// Free all folowing USED longs
  for (long i = index + 1; i < N; i++)
  {
    if (get_rec(i) == USED)
    {
      set_rec(i, FREE);
    }
    else
      break;
  }
}
コード例 #14
0
ファイル: chat.c プロジェクト: wyat/kbs
static int ent_chat(int chatnum)
{                               /* 进入聊天室 */
    chatcontext *pthis;
    char inbuf[128];
    int ch, cmdpos;
    int currchar;
    int modified;               /* the line is modified? -- wwj */
    int newmail;
    int page_pending = false;
    int chatting = true;
#ifdef NEW_HELP
    int oldhelpmode=helpmode;
#endif

    if (!strcmp(getCurrentUser()->userid, "guest"))
        return -1;
    pthis = (chatcontext *) malloc(sizeof(chatcontext));
    bzero(pthis, sizeof(chatcontext));
    if (!pthis)
        return -1;
    modify_user_mode(CHAT1);
    ch = ent_chat_conn(pthis, chatnum);
    if (ch != 1) {
        free(pthis);
        return ch;
    }
#ifdef NEW_HELP
    helpmode=HELP_CHAT;
#endif
    add_io(pthis->cfd, 0);
    modified = newmail = cmdpos = currchar = 0;
    /* update uinfo */
    uinfo.in_chat = true;
    strcpy(uinfo.chatid, pthis->chatid);
    UPDATE_UTMP(in_chat, uinfo);
    UPDATE_UTMP_STR(chatid, uinfo);
    /* initiate screen */
    clear();
    pthis->chatline = 2;
    move(s_lines, 0);
    outs(msg_seperator);
    move(1, 0);
    outs(msg_seperator);
    print_chatid(pthis);
    memset(inbuf, 0, 80);
    /* chat begin */
    while (chatting) {
        if (chat_checkparse(pthis) == 0)
            break;
        move(b_lines, currchar + 10);
        pthis->outputcount = 0;
        ch = igetkey();
        if (ch==KEY_TALK) {
            int talkpage = servicepage(0, pthis->buf);

            if (talkpage != page_pending) {
                bell();
                oflush();
                printchatline(pthis, pthis->buf);
                page_pending = talkpage;
            }
        }
        if (chat_checkparse(pthis) == 0)
            break;
        if (ch == I_OTHERDATA)
            continue;
        switch (ch) {
            case KEY_UP:
            case KEY_DOWN:
                if (cmdpos == pthis->cmdpos) {
                    strcpy(pthis->lastcmd[cmdpos], inbuf);
                    modified = 0;
                }
                if (ch == KEY_UP) {
                    if (cmdpos != (pthis->cmdpos + 1) % MAXLASTCMD) {
                        int i = (cmdpos + MAXLASTCMD - 1) % MAXLASTCMD;

                        if (pthis->lastcmd[i][0])
                            cmdpos = i;
                    }
                }
                if (ch == KEY_DOWN) {
                    if (cmdpos != pthis->cmdpos)
                        cmdpos = (cmdpos + 1) % MAXLASTCMD;
                }
                strcpy(inbuf, pthis->lastcmd[cmdpos]);
                if (cmdpos == pthis->cmdpos) {
                    modified = 1;
                }
                move(b_lines, 10);
                clrtoeol();
                ch = inbuf[69];
                inbuf[69] = 0;
                outs(inbuf);
                inbuf[69] = ch;
                currchar = strlen(inbuf);
                continue;
#ifdef CHINESE_CHARACTER
            case Ctrl('R'):
                SET_CHANGEDEFINE(getCurrentUser(), DEF_CHCHAR);
                continue;
#endif
            case KEY_LEFT:
                if (currchar)
                    --currchar;
#ifdef CHINESE_CHARACTER
                if (DEFINE(getCurrentUser(), DEF_CHCHAR)) {
                    int i,j=0;
                    for (i=0;i<currchar;i++)
                        if (j) j=0;
                        else if (inbuf[i]<0) j=1;
                    if (j) {
                        currchar--;
                    }
                }
#endif
                continue;
            case KEY_RIGHT:
                if (inbuf[currchar])
                    ++currchar;
#ifdef CHINESE_CHARACTER
                if (DEFINE(getCurrentUser(), DEF_CHCHAR)) {
                    int i,j=0;
                    for (i=0;i<currchar;i++)
                        if (j) j=0;
                        else if (inbuf[i]<0) j=1;
                    if (j) {
                        if (inbuf[currchar])
                            ++currchar;
                    }
                }
#endif
                continue;
            case KEY_ESC:
            case Ctrl('X'):
                inbuf[0] = 0;
                currchar = 0;
                move(b_lines, currchar + 10);
                clrtoeol();
                modified = 1;
                continue;
            case Ctrl('A'):
                currchar = 0;
                continue;
            case Ctrl('E'):
                currchar = strlen(inbuf);
                continue;
        }
        if (!newmail && chkmail(0)) {   /* check mail */
            newmail = 1;
            printchatline(pthis, "\033[32m*** \033[31m当!你有新信来啦...\033[m");
        }
        if (isprint2(ch)) {
            if (currchar < 126) {       /* 未满一行,print it */
                modified = 1;
                if (inbuf[currchar]) {  /* insert */
                    int i;

                    for (i = currchar; inbuf[i] && i < 127; i++);
                    inbuf[i + 1] = '\0';
                    for (; i > currchar; i--)
                        inbuf[i] = inbuf[i - 1];
                } else {        /* append */
                    inbuf[currchar + 1] = '\0';
                }
                inbuf[currchar] = ch;
                ch = inbuf[69]; /* save the end of line */
                inbuf[69] = 0;
                move(b_lines, currchar + 10);
                outs(&inbuf[currchar++]);
                inbuf[69] = ch;
            }
            continue;
        }
        if (ch == '\n' || ch == '\r') {
            if (currchar) {
                if (modified) {
                    /* add to command history */
                    ch = sizeof(pthis->lastcmd[pthis->cmdpos]) - 1;
                    strncpy(pthis->lastcmd[pthis->cmdpos], inbuf, ch);
                    pthis->lastcmd[pthis->cmdpos][ch] = 0;
                    pthis->cmdpos = (pthis->cmdpos + 1) % MAXLASTCMD;
                    cmdpos = pthis->cmdpos;
                } else {        /* use history, so can +1 */
                    cmdpos = (cmdpos + 1) % MAXLASTCMD;
                }
                if (inbuf[0] == '/' && Isspace(inbuf[1])) {     /* discard / b */
                    printchatline(pthis,
                                  "\x1b[37m*** \x1b[32m请输入正确的指令,使用/h寻求帮助\x1b[37m ***\x1b[m");
                } else {
                    chatting = chat_cmd(pthis, inbuf);  /*local命令处理 */
                    if (chatting == 0)
                        chatting = chat_send(pthis, inbuf);
                    if (inbuf[0] == '/') {
                        ch = 1;
                        while (inbuf[ch] != '\0' && inbuf[ch] != ' ')
                            ch++;
                        if (ch > 1) {
                            if (!strncasecmp(inbuf, "/bye", ch))
                                break;
                            if (!strncasecmp(inbuf, "/exit", ch))
                                break;  /*added by alex, 96.9.5 */
                        }
                    }
                }
                modified = 0;
                inbuf[0] = '\0';
                currchar = 0;
                move(b_lines, 10);
                clrtoeol();
            }
            continue;
        }
        if (ch == Ctrl('H') || ch == '\177') {  /*Backspace */
            if (currchar) {
                currchar--;
                inbuf[127] = '\0';
                memcpy(&inbuf[currchar], &inbuf[currchar + 1],
                       127 - currchar);
                move(b_lines, currchar + 10);
                clrtoeol();
                ch = inbuf[69]; /* save the end of line */
                inbuf[69] = 0;
                outs(&inbuf[currchar]);
                inbuf[69] = ch;
            }
#ifdef CHINESE_CHARACTER
            if (DEFINE(getCurrentUser(), DEF_CHCHAR)) {
                int i,j=0;
                for (i=0;i<currchar;i++)
                    if (j) j=0;
                    else if (inbuf[i]<0) j=1;
                if (j) {
                    currchar--;
                    inbuf[127] = '\0';
                    memcpy(&inbuf[currchar], &inbuf[currchar + 1],
                           127 - currchar);
                    move(b_lines, currchar + 10);
                    clrtoeol();
                    ch = inbuf[69]; /* save the end of line */
                    inbuf[69] = 0;
                    outs(&inbuf[currchar]);
                    inbuf[69] = ch;
                }
            }
#endif
            continue;
        }
        if (ch == Ctrl('Z')) {
            r_lastmsg();        /* Leeward 98.07.30 support msgX */
            inbuf[0] = '\0';
            currchar = 0;
            move(b_lines, 10);
            clrtoeol();
            continue;
        }
        if (ch == Ctrl('C') /*|| ch == Ctrl('D') */) {  /* ^C 退出 */
            chat_send(pthis, "/b");
            if (pthis->rec)
                set_rec(pthis,NULL);
            break;
        }
    }
    /* chat end */
    if (pthis->rec)set_rec(pthis,NULL);
    close(pthis->cfd);
    add_io(0, 0);
    uinfo.in_chat = false;
    uinfo.chatid[0] = '\0';
    UPDATE_UTMP(in_chat, uinfo);
    UPDATE_UTMP(chatid[0], uinfo);
    clear();
    free(pthis);
#ifdef NEW_HELP
    helpmode=oldhelpmode;
#endif
    return 0;
}
コード例 #15
0
ファイル: next-fit-nee.c プロジェクト: Jannertje/os
long  mem_get(long request)
{
  long index, i, current_long, current_hole;
	int record, offset, which_long;
  
	// Find first memory record to check
	index = i = *admin;
  which_long = i * D / L;
	offset = i * D - which_long * L;
	current_long = records[which_long];
	current_long >>= offset;

	// Loop 1 round through memory records
	while(i < *admin + N || current_hole >= 0) 
	{
		
		// Get the current record
		record = current_long & (long) ALL;
		if(current_hole<0) 
		{
			// Check if a hole starts at this index
			if(record == FREE) current_hole = index;
		}
		else 
		{
			if(record == FREE)
			{
				// Index is in memory hole; Check if hole size >= request
				if(index - current_hole == request - 1) {
					// Set the memory records
					set_rec(current_hole, START);
					for (long j = current_hole + 1; j < current_hole + request; j++)
            set_rec(j, USED);
					*admin = current_hole + request;
					return current_hole;
				}
			}
			else
			{
				current_hole = -1;
			}
		}
		
		// Move to the next record
		i++;
		index = i % N;
		offset += D;
		current_long >>= D;

		// Move on to the next long if we reached the end of this one
		if(offset == L) 
		{
			which_long = (which_long+1) % N;
			offset = 0;
			current_long = records[which_long];
		}

		// If we reach the first index, reset the offset and current_long
		if(index == 0) 
		{
			which_long = 0;
			offset = 0;
			current_long = *memory;
			current_hole = -1;
		}
  }
  
	// No free memory available
  return -1;
}