On 6/12/06, Arkady V.Belousov <[EMAIL PROTECTED]> wrote:
> Hi!
>
> 12-Июн-2006 04:55 [EMAIL PROTECTED] (Blair Campbell) wrote to
> [EMAIL PROTECTED]:
>
> BC> +++ cmdinput.c      12 Jun 2006 04:55:42 -0000      1.7
> BC>  static unsigned orgx, orgy;                /* start of current line */
> BC> +int mywherex( void )
> BC> +    return( int )( *( ( char far * )MK_FP( 0x0040, 0x0050 ) ) + 1 );
>
>       Bug! Because in TC/BC `char' is signed by default, in video modes with
> 132 columns (more than 128 columns) you get sign extension and you
> mywherex() returns -126 instead 130.
>
> BC> +static int mywherey( void )
>
>       And why mywherey() is static, whereas mywherex() - not?

Because mywherey is never used anywhere else.

>
> BC> +    return( int )( *( ( char far * )MK_FP( 0x0040, 0x0051 ) ) + 1 );
> BC> +}
>
>       Second, code above not bug, but wrong, because you return position
> only on video page 0, whereas active may be another video page. Ie., you
> should use byte at 0:62 as index in array of positions:

Does FreeCOM ever switch video pages? no.  The point of getting rid of
CONIO was to get rid of unused code...

>
> typedef unsigned char byte; /* eliminate troubles with sign extension */
> #define MK_PTR(type,seg,ofs) \
>   ((type FAR*) MK_FP (seg, ofs)) /* safer edition of MK_FP */
>
> typedef struct { byte col, row; } SCRPOS;
> #define _scr_page      (* MK_PTR (volatile const byte,   0, 0x462))
> #define _scr_pos_array    MK_PTR (volatile const SCRPOS, 0, 0x450)
> unsigned mywherex (void) {
>    return _scr_pos_array [_scr_page].col + 1;
> }
> unsigned mywherey (void) {
>    return _scr_pos_array [_scr_page].row + 1;
> }
>
> BC> +void outc(char c)
> BC> +   fflush( stdout );
> BC>     write( 1, &c, 1 );
>
>       Why not use fwrite() here?

Because the code that's there works just as well.

>
> BC> +++ fcompl2.c       12 Jun 2006 04:55:42 -0000      1.4
> BC> +#undef putchar
> BC> +#define putchar outc
>
>       Why not use outc() explicitly?!

Why?

>
> BC> +++ cbreak.c        12 Jun 2006 04:55:42 -0000      1.3
> BC> +void mycprintf( char *fmt, ... )
> BC> +    vsprintf( buffer, fmt, args );
> BC> +#define cputs mycprintf
>
>       Then you in trouble, if there will be encountered "%" in string.

But % is never encountered because cputs is only ever used to print
\r\n.  You would have known that if you read the code.

>
> BC> +++ prprompt.c      12 Jun 2006 04:55:42 -0000      1.5
> BC> +#define putchar outc
>
>       Same question: why not use outc() explicitly, especially you anyway
> change all occurrence of putchar()?!

Because it's easier and a programmer will still understand what it does.

>
> BC> -      case 'E': putchar("\33");  break; /* Decimal 27 */
> BC> -      case 'H': putchar("\10");   break; /* Decimal 8 */
> BC> +      case 'E': putchar('27');  break; /* Decimal 27 */
> BC> +      case 'H': putchar('8');   break; /* Decimal 8 */
>
>       Bug! You should omit apostrophes (use "outc(8)"), or add backslash
> ("outc('\x8')").
>
>
> _______________________________________________
> Freedos-devel mailing list
> [email protected]
>

Arkady, PLEASE stop reading my changes and trying to find fault with
them, as I am the first to actually make changes to FreeCOM in a
while.  It'd be nice to get some thanks once in while.

I didn't see anyone thank me for fixing some bugzilla bugs...
 https://lists.sourceforge.net/lists/listinfo/freedos-devel
>


-- 
Fall is my favorite season in Los Angeles, watching the birds change
color and fall from the trees.
   David Letterman (1947 - )

See ya

_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to