示例#1
0
文件: ONSCRN.C 项目: kytulendu/CW141
void writetab(void)
{
    int i = 0;
    prblank(wind.col,3);
    while (((i + firstcol + 1) < leftmar) && (i < wind.length)) {
      prblank(wind.col + i,3);
      i++;
    }
    if ((i < wind.length) && ((i + firstcol + 1) == leftmar)) {
      prchar('L',0,wind.col + i,3);
      i++;
    }
    while (((i + firstcol + 1) < rightmar) && (i < wind.length)) {
      if (tab[i+firstcol] == NO)
        prchar('-',0,wind.col + i,3);
      else
        prchar('!',0,wind.col + i,3);
      i++;
    }
    if ((rightmar - 1 - firstcol) < wind.length) {
      prchar('R',0,wind.col + rightmar - 1 - firstcol,3);
    }
    i++;
    while (i < wind.length) {
      prblank(wind.col + i,3);
      i++;
    }
}
示例#2
0
文件: CSCRN.C 项目: kytulendu/TW
void dispstrhgc( unsigned char *p_string, int p_xPos, int p_yPos, font_attr p_attr ) {
	while ( ( *p_string != '\0' ) && ( p_xPos < 90 ) ) {
		if ( *p_string < 32 ) {
			togglefont( &p_attr, *p_string );
		} else {
			if ( whatlevel( *p_string ) == MIDDLE ) {
				prchar( *p_string, p_attr, p_xPos, p_yPos );
				if ( ( p_attr & ENLARGEATTR ) == ENLARGEATTR ) {
					p_xPos++;
				}
				p_xPos++;
			} else {
				if ( ( p_attr & ENLARGEATTR ) == ENLARGEATTR ) {
					if ( p_xPos >= 2 ) {
						prchar( *p_string, p_attr, p_xPos - 2, p_yPos );
					}
				} else {
					if ( p_xPos >= 1 ) {
						prchar( *p_string, p_attr, p_xPos - 1, p_yPos );
					}
				}
			}
		}
		p_string++;
	}
}
示例#3
0
文件: KBD.C 项目: kytulendu/TW
void dispkey( register unsigned int p_key ) {
	dispstrhgc( "   ", wind.col, 2, NORMALATTR );
	if ( ( p_key & 0xff ) < 32 ) {
		prchar( '^', NORMALATTR, wind.col, REVERSEATTR );
		prchar( ( p_key & 0xff ) + 0x40, NORMALATTR, wind.col + 1, REVERSEATTR );
	}
}
示例#4
0
文件: EDIT.C 项目: kytulendu/CW141
void disppagebreak(unsigned y)
{
    register unsigned i = 0,j;
    y += wind.row;
    j = wind.col + wind.length - 1;
    while (i != j) {
      prchar('-',0,wind.col + i,y);
      i++;
    }
    prchar('P',0,i,y);
}
示例#5
0
文件: ONSCRN.C 项目: kytulendu/CW141
void onscreen(unsigned x,unsigned y)
{
    int key;
    dispkey(CNTRL_O);
    waitkbd(3,2);
    key = ebioskey(0);
    prchar(key,0,3,2);
    doonscrn(key,x,y);
}
示例#6
0
int kpline(char *line)
{
    struct para *p = &printer;
    P(&p->mutex);              // one process prints LINE at a time 
      while (*line)
	prchar(*line++);
    P(&p->done);              // wait until pbuf[ ] is DONE */
    V(&p->mutex);             // allow another process to print
}   
示例#7
0
文件: MOVE.C 项目: MegaGod/TW
void quick( unsigned int *x, unsigned int *y ) {
	register int key;

	dispkey( CNTRL_Q );
	waitkbd( 3, 2 );
	key = ebioskey( 0 ) & 0xff;
	prchar( key, 0, 3, 2 );
	if ( !isalpha( key ) && !iscntrl( key ) ) {
		return;
	}
	switch ( key & 0x1f ) {
	case 'r' - 'a' + 1:
		topfile( x );
		break;
	case 'c' - 'a' + 1:
		endfile( x );
		break;
	case 'f' - 'a' + 1:
		searching( x, y );
		break;
	case 'a' - 'a' + 1:
		replacing( x, y );
		break;
	case 'y' - 'a' + 1:
		deltoendline( *x, *y );
		break;
	case 'l' - 'a' + 1:
		loadtoline( curline->text );
		refreshline( 0, *y );
		break;
	case 'b' - 'a' + 1:
		gobeginblk( x );
		break;
	case 'k' - 'a' + 1:
		goendblk( x );
		break;
	case 'd' - 'a' + 1:
		endline( x );
		break;
	case 's' - 'a' + 1:
		home( x );
		break;
	case 'x' - 'a' + 1:
		bottom_of_page( );
		break;
	case 'e' - 'a' + 1:
		top_of_page( );
		break;
	}
}
示例#8
0
void tri(int height,int set_height)
{
     int i;
     if(height==1)
     {
         for(i=1;i<=set_height;i++)
         {
             printf("*");
         }
     }
     else
     {
         tri(height-1,set_height);
         printf("\n");
         prchar(height,set_height);
     }
}
示例#9
0
static int
store_prchar(char c, off_t pos)
{
	char *s;

	/*
	 * Convert to printable representation.
	 */
	s = prchar(c);

	/*
	 * Make sure we can get the entire representation
	 * of the character on this line.
	 */
	if (column + (int)strlen(s) - 1 +
	    pwidth(' ', binattr, 0) + attr_ewidth(binattr) > sc_width)
		return (1);

	for (; *s != 0; s++) {
		STORE_CHAR(*s, AT_BINARY, NULL, pos);
	}
	return (0);
}
示例#10
0
文件: p1.c 项目: HellBlazzar/Learning
void Stat(Gradebook *gb, int num)
{
    float temp=0;
    int flag1=0,flag2=0,flag3=0,flag4=0,flag5=0;
    int i,j,k,l;
    for(k=0; k<num; k++)
    {
        if((*gb).grade[k]==100)
        {
            flag1++;
        }
        if(((*gb).grade[k]>=90)&&((*gb).grade[k]<=99))
        {
            flag2++;
        }
        if(((*gb).grade[k]>=80)&&((*gb).grade[k]<=89))
        {
            flag3++;
        }
        if(((*gb).grade[k]>=70)&&((*gb).grade[k]<=79))
        {
            flag4++;
        }
        if(((*gb).grade[k]>=60)&&((*gb).grade[k]<=69))
        {
            flag5++;
        }
    }
    printf("100 [%d]",flag1);
    prchar('*',flag1);
    printf("\n");
    printf("90~99 [%2d]",flag2);
    prchar('*',flag2);
    printf("\n");
    printf("80~89 [%2d]",flag3);
    prchar('*',flag3);
    printf("\n");
    printf("70~79 [%2d]",flag4);
    prchar('*',flag4);
    printf("\n");
    printf("60~69 [%2d]",flag5);
    prchar('*',flag5);
    printf("\n");


    for(j=0; j<num; j++)
    {
        if(j==0)
        {
            (*gb).max=(*gb).grade[j];
            (*gb).min=(*gb).grade[j];
        }
        if((*gb).grade[j]>(*gb).max)
        {
            (*gb).max=(*gb).grade[j];
        }
        if((*gb).grade[j]<(*gb).min)
        {
            (*gb).min=(*gb).grade[j];
        }
    }
    printf("Min = %d\n",(*gb).min);
    printf("Max = %d\n",(*gb).max);

    for(i=0; i<num; i++)
    {
        temp+=(*gb).grade[i];
    }
    (*gb).average=temp/num;
    printf("Average = %.1f",(*gb).average);
}
示例#11
0
文件: STATUS.C 项目: kytulendu/TW
void writedriveno( void ) {
	dispstrhgc( "ä´Ã¿ì  :", 40, 0, NORMALATTR );
	prchar( 'A' + getdisk( ), BOLDATTR, 45, NORMALATTR );
}
示例#12
0
文件: CSCRN.C 项目: kytulendu/TW
void dispblank( int p_xPos, int p_yPos, size_t p_count, font_attr p_attr ) {
	p_count++;
	while ( p_count-- ) {
		prchar( ' ', p_attr, p_xPos++, p_yPos );
	}
}
示例#13
0
文件: CSCRN.C 项目: kytulendu/TW
void framebox( int p_xStart, int p_yStart, int p_xEnd, int p_yEnd, int p_attr ) {
	register int i;
	register int j;

	i = p_xStart;
	prchar( ' ', p_attr, i++, p_yStart );
	prchar( '˜', p_attr, i, p_yStart );
	for ( i++, j = p_xEnd - 1; i < j; i++ ) {
		prchar( '•', p_attr, i, p_yStart );
	}
	prchar( '™', p_attr, i++, p_yStart );
	prchar( ' ', p_attr, i, p_yStart );

	for ( j = p_yStart + 1; j < p_yEnd; j++ ) {
		for ( i = p_xStart; i <= p_xEnd; i++ ) {
			prchar( ' ', p_attr, i, j );
		}
		prchar( '–', p_attr, p_xEnd - 1, j );
		prchar( '–', p_attr, p_xStart + 1, j );
	}
	i = p_xStart;
	prchar( ' ', p_attr, i++, p_yEnd );
	prchar( 'š', p_attr, i, p_yEnd );
	for ( i++, j = p_xEnd - 1; i < j; i++ ) {
		prchar( '•', p_attr, i, p_yEnd );
	}
	prchar( '›', p_attr, i++, p_yEnd );
	prchar( ' ', p_attr, i, p_yEnd );
}
示例#14
0
文件: EDIT.C 项目: kytulendu/CW141
void displine(struct line_node *line,unsigned y,unsigned linenum)
{
    register unsigned x = 0;
    int count = firstcol;
    font_attr tempfont, curfont = 0;
    char *st;

    st = line->text;
    y += wind.row;
    while ((count > 0) && (*st != '\0')) {
      if (whatlevel(*st) == MIDDLE) {
        if (*st < 32) {
          togglefont(&curfont,*st);
        } else {
          if ((curfont & ENLARGEATTR) == ENLARGEATTR) {
            count--;
          }
          count--;
        }
      }
      st++;
    }
    if ((count < 0) && ((curfont & ENLARGEATTR) == ENLARGEATTR)) {
      x++;
    }
    while ((*st != '\0') && (x < (wind.length - 2))){
      if (*st < 32) {
        togglefont(&curfont,*st);
      } else {
        tempfont = curfont;
        if (haveblock() && inblock(linenum,x + firstcol) && dispblock) {
          curfont = curfont | REVERSEATTR;
        }
        if (whatlevel(*st) != MIDDLE) {
          if (x > 0) {
            if ((curfont & ENLARGEATTR) == ENLARGEATTR) {
              if (x >= 2) {
                prchar(*st,curfont,wind.col+x-2,y);
              }
            } else {
              prchar(*st,curfont,wind.col+x-1,y);
            }
          }
        } else {
          if ((*st != ' ') || (curfont != 0)) {
            if ((curfont & ENLARGEATTR) != ENLARGEATTR) {
              prchar(*st,curfont,wind.col+x,y);
              x++;
            } else {
              prchar(*st,curfont,wind.col+x,y);
              x += 2;
            }
          } else { /* if it's blank and normal attribute,use prblank to speed up */
            prblank(wind.col+x,y);
            x++;
          }
        }
        curfont = tempfont;
      }
      st++;
    }
    clrline(wind.col+x,y,wind.col+wind.length-1);
    if (line->wrap == NO) {
       prchar('<',0,wind.col + wind.length - 1,y);
    }
    if (*st != '\0') {
      prchar('+',0,wind.col + wind.length - 1,y);
    }
    y -= wind.row;
    /*
    if (graphbuff[y] != NULL)
      paintlinegraph(graphbuff[y],y);
    */
}
示例#15
0
static void
handlema(void)
{
	char vichar;
	char cap[2];
	int i, j, found;
	char *infostr;

	if (verbose > 1)
		(void) fprintf(trace, "working on termcap ma string.\n");

	if (ostrval[uselevel][cap_ma] == NULL)
		return;

	cap[1] = '\0';
	for (i = 0; ostrval[uselevel][cap_ma][i] != '\0'; ) {
		/* isolate the key's value */
		cap[0] = ostrval[uselevel][cap_ma][i++];
		if (verbose > 1) {
			(void) fprintf(trace, "key value is '");
			tpr(trace, cap);
			(void) fprintf(trace, "'.\n");
		}

		if (ostrval[uselevel][cap_ma][i] == '\0')
			break;

		/* isolate the vi key name */
		vichar = ostrval[uselevel][cap_ma][i++];
		if (verbose > 1) {
			(void) fprintf(trace, "the vi key is '");
			prchar(trace, vichar);
			(void) fprintf(trace, "'.\n");
		}

		/* match up the vi name in our list */
		found = 0;
		for (j = 0; !found && ma_map[j].keyedinfoname != NULL; j++) {
			if (verbose > 1) {
				(void) fprintf(trace, "looking at vi "
				    "character '");
				prchar(trace, ma_map[j].vichar);
				(void) fprintf(trace, "'\n");
			}
			if (vichar == ma_map[j].vichar) {
				infostr = getinfostr(ma_map[j].keyedinfoname);
				if (infostr == NULL)
					putstr(ma_map[j].keyedinfoname, cap);
				else if (strcmp(cap, infostr) != 0) {
					(void) fprintf(stderr, "%s: TERM=%s: "
					    "the vi character '", progname,
					    term_name);
					prchar(stderr, vichar);
					(void) fprintf(stderr,
					    "' (info '%s') has the value '",
					    ma_map[j].keyedinfoname);
					tpr(stderr, infostr);
					(void) fprintf(stderr, "', but 'ma' "
					    "gives '");
					prchar(stderr, cap[0]);
					(void) fprintf(stderr, "'.\n");
				}
				found = 1;
			}
		}

		if (!found) {
			(void) fprintf(stderr, "%s: the unknown vi key '",
			    progname);
			prchar(stderr, vichar);
			(void) fprintf(stderr, "' was\n");
			(void) fprintf(stderr, "specified in the 'ma' termcap "
			    "capability.\n");
		}
	}
}