home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!gatech!howland.reston.ans.net!europa.eng.gtefsd.com!emory!ogicse!news.tek.com!saab!billr
- From: billr@saab.CNA.TEK.COM (Bill Randle)
- Newsgroups: comp.sources.games
- Subject: v17i108: nethack31 - display oriented dungeons & dragons (Ver. 3.1), Patch2gg/33
- Message-ID: <1v8j4k$jf9@ying.cna.tek.com>
- Date: 11 Jun 93 00:20:36 GMT
- Article-I.D.: ying.1v8j4k$jf9
- Organization: Tektronix, Inc, Redmond, OR, USA
- Lines: 1260
- Approved: billr@saab.CNA.TEK.COM
- NNTP-Posting-Host: saab.cna.tek.com
- Xref: uunet comp.sources.games:1784
-
- Submitted-by: izchak@linc.cis.upenn.edu (Izchak Miller)
- Posting-number: Volume 17, Issue 108
- Archive-name: nethack31/Patch2gg
- Patch-To: nethack31: Volume 16, Issue 1-116
- Environment: Amiga, Atari, Mac, MS-DOS, Windows-NT, OS2, Unix, VMS, X11
-
-
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 33 (of 33)."
- # Contents: include/mactty.h sys/amiga/winstr.c sys/winnt/nhincl.mak
- # Wrapped by billr@saab on Thu Jun 10 16:55:09 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'include/mactty.h' -a "${1}" != "-c" ; then
- echo shar: Renaming existing file \"'include/mactty.h'\" to \"'include/mactty.h.orig'\"
- mv -f 'include/mactty.h' 'include/mactty.h.orig'
- fi
- echo shar: Extracting \"'include/mactty.h'\" \(13365 characters\)
- sed "s/^X//" >'include/mactty.h' <<'END_OF_FILE'
- X/* SCCS Id: @(#)mactty.h 3.1 93/03/01 */
- X/* Copyright (c) Jon W{tte 1993. */
- X/* NetHack may be freely redistributed. See license for details. */
- X
- X/*
- X * This header is the supported external interface for the "tty" window
- X * package. This package sports care-free handling of "dumb" tty windows
- X * (preferrably using monospaced fonts) - it does NOT remember the strings
- X * sent to it; rather, it uses an offscreen bitmap.
- X *
- X * For best performance, make sure it is aligned on a 32-pixel boundary
- X * (or at least a 16-pixel one) in black & white. For 24bit color,
- X * alignment doesn't matter, and for 8-bit color, alignment to every
- X * fourth pixel is most efficient.
- X *
- X * (c) Copyright 1993 Jon W{tte
- X */
- X
- X/*
- X * You should really not poke in the structures used by the tty window.
- X * However, since it uses the wRefCon of windows (by calling GetWRefCon
- X * and SetWRefCon) you lose that possibility. If you still want to store
- X * information about a window, the FIRST location _pointed to_ by the
- X * wRefCon will be a void * that you can use for whatever reasons. Don't
- X * take the address of this variable and expect it to stay the same
- X * across calls to the tty window.
- X *
- X * void * my_config_ptr = * ( void * * ) GetWRefCon ( tty_window ) ;
- X */
- X
- X/*
- X * The library uses the window's port temporarily through SetPortBits;
- X * that means you shouldn't do any funky things to the clipping region
- X * etc. Actually, you shouldn't even resize the window, as that will clip
- X * new drawing.
- X *
- X * Also, if you use this library under Pascal, remember that the string
- X * passed to add_tty_string() is a "C" style string with NO length byte,
- X * and a terminating zero byte at the end instead.
- X */
- X
- X#ifndef _H_tty_public
- X# define _H_tty_public
- X
- X#include <Windows.h>
- X#include <QDOffscreen.h>
- X#include <Fonts.h>
- X#include <Memory.h>
- X#include <OSUtils.h>
- X#include <Errors.h>
- X#include <GestaltEqu.h>
- X#include <Palettes.h>
- X#include <Desk.h>
- X#include <DiskInit.h>
- X#include <OSEvents.h>
- X
- X
- X/*
- X * If you export this library to Pascal, which doesn't have vsprintf
- X * to rely on, you will need to change this define to 0
- X */
- X#define PRINTF_TTY 1
- X/*
- X * If you want the functions getchar_tty and gets_tty, you have to define
- X * this. Currently not supported.
- X */
- X#define TTY_INPUT 0
- X/*
- X * If you want some fancy operations that not a normal TTY device normally
- X * supports, use EXTENDED_SUPPORT. For frames, area erases and area scrolls,
- X * plus bitmap graphics - RESOLUTION DEPENDENT, be sure to call
- X * get_tty_metrics and use those limits.
- X */
- X#define EXTENDED_SUPPORT 1
- X/*
- X * if you print a lot of single characters, accumulating each one in a
- X * clipping region will take too much time. Instead, define this, which
- X * will clip in rects.
- X */
- X#define CLIP_RECT_ONLY 1
- X
- Xtypedef enum tty_attrib {
- X
- X/*
- X * Flags relating to the general functioning of the window.
- X * These flags are passed at create_tty time, and changing them
- X * later will clear the screen.
- X */
- X TTY_ATTRIB_FLAGS ,
- X/*
- X * When using proportional fonts, this will place each character
- X * separately, ensuring aligned columns (but looking ugly and taking
- X * time)
- X */
- X# define TA_MOVE_EACH_CHAR 1L
- X/*
- X * This means draw each change as it occurs instead of collecting the area
- X * and draw it all at once at update_tty() - slower, but more reliable.
- X */
- X# define TA_ALWAYS_REFRESH 2L
- X/*
- X * When reaching the right end, we either just stop drawing, or wrap to the
- X * next line.
- X */
- X# define TA_WRAP_AROUND 4L
- X/*
- X * Overstrike means that characters are added on top of each other; i e don't
- X * clear the letter beneath. This is faster, using srcOr under QuickDraw
- X */
- X# define TA_OVERSTRIKE 8L
- X/*
- X * We may want the window not to scroll when we reach the end line,
- X * but stop drawing instead.
- X */
- X# define TA_INHIBIT_VERT_SCROLL 16L
- X
- X/*
- X * Foreground and background colors. These only affect characters
- X * drawn by subsequent calls; not what's already there (but it does
- X * affect clears)
- X * On b/w screens these do nothing.
- X */
- X TTY_ATTRIB_FOREGROUND ,
- X TTY_ATTRIB_BACKGROUND ,
- X# define TA_RGB_TO_TTY(r) ((((long)((r).red>>8)&0xff)<<16)+\
- X (((long)((r).green>>8)&0xff)<<8)+((long)((r).blue>>8)&0xff))
- X
- X/*
- X * Attributes relating to the cursor, and character set mappings
- X */
- X TTY_ATTRIB_CURSOR ,
- X/*
- X * Blinking cursor is more noticeable when it's idle
- X */
- X# define TA_BLINKING_CURSOR 1L
- X/*
- X * When handling input, do we echo characters as they are typed?
- X */
- X# define TA_ECHO_INPUT 2L
- X/*
- X * Do we return each character code separately, or map delete etc? Note
- X * that non-raw input means getchar won't return anything until the user
- X * has typed a return.
- X */
- X# define TA_RAW_INPUT 4L
- X/*
- X * Do we print every character as it is (including BS, NL and CR!) or do
- X * do we interpret characters such as NL, BS and CR?
- X */
- X# define TA_RAW_OUTPUT 8L
- X/*
- X * When getting a NL, do we also move to the left?
- X */
- X# define TA_NL_ADD_CR 16L
- X/*
- X * When getting a CR, do we also move down?
- X */
- X# define TA_CR_ADD_NL 32L
- X/*
- X * Wait for input or return what we've got?
- X */
- X# define TA_NONBLOCKING_IO 64L
- X
- X/*
- X * A callback function for command keys entered when locked in an input loop.
- X * Calling convention:
- X * pascal void callback_function ( EventRecord * event , WindowPtr window ) ;
- X */
- X TTY_COMMAND_KEY_CALLBACK ,
- X/*
- X * This function is called to allocate memory for the window. Note that
- X * create_tty doesn't create any memory (except that created by GetNewWindow)
- X * but init_tty_name and init_tty_number do allocate memory.
- X * Calling convention:
- X * pascal short allocate_memory ( WindowPtr window , void * * to_alloc ,
- X * long size ) ;
- X * should return 0 for success, and error code for fail.
- X */
- X TTY_ALLOCATE_MEMORY_FUNCTION ,
- X/*
- X * This is the counterpart to the allocate function, called to free memory.
- X * Calling convention:
- X * pascal short free_memory ( WindowPtr window , void * to_free ) ;
- X * should return 0 for success, and error code for fail.
- X */
- X TTY_FREE_MEMORY_FUNCTION ,
- X/*
- X * Use this function to beep, for instance for too large buffer or for
- X * printing a bell character in non-RAW mode.
- X * pascal void ( * tty_beep ) ( WindowPtr window ) ;
- X */
- X TTY_BEEP_FUNCTION ,
- X/*
- X * Use this macro to cast a function pointer to a tty attribute; this will help
- X * portability to systems where a function pointer doesn't fit in a long
- X */
- X# define TA_ATTRIB_FUNC(x) ((long)(x))
- X
- X/*
- X * This symbolic constant is used to check the number of attributes
- X */
- X TTY_NUMBER_ATTRIBUTES
- X
- X} tty_attrib ;
- X
- X/*
- X * Character returned by end-of-file condition
- X */
- X# define TTY_EOF -1
- X
- X
- X/*
- X * Create the window according to a resource WIND template.
- X * The window pointer pointed to by window should be NULL to
- X * allocate the window record dynamically, or point to a
- X * WindowRecord structure already allocated.
- X *
- X * Passing in_color means you have to be sure there's color support;
- X * on the Mac, this means 32bit QuickDraw present, else it will
- X * crash. Not passing in_color means everything's rendered in
- X * black & white.
- X */
- Xextern pascal short create_tty ( WindowPtr * window , short resource_id ,
- X Boolean in_color ) ;
- X
- X/*
- X * Use init_tty_name or init_tty_number to initialize a window
- X * once allocated by create_tty. Size parameters are in characters.
- X */
- Xextern pascal short init_tty_name ( WindowPtr window ,
- X unsigned char * font_name , short font_size , short x_size ,
- X short y_size ) ;
- Xextern pascal short init_tty_number ( WindowPtr window , short font_number ,
- X short font_size , short x_size , short y_size ) ;
- X
- X/*
- X * Close and deallocate a window and its data
- X */
- Xextern pascal short destroy_tty ( WindowPtr window ) ;
- X
- X/*
- X * Change the font and font size used in the window for drawing after
- X * the calls are made. To change the coordinate system, be sure to call
- X * force_tty_coordinate_system_recalc() - else it may look strange if
- X * the new font doesn't match the old one.
- X */
- Xextern pascal short set_tty_font_name ( WindowPtr window ,
- X unsigned char * name ) ;
- Xextern pascal short set_tty_font_number ( WindowPtr window , short number ) ;
- Xextern pascal short set_tty_font_size ( WindowPtr window , short size ) ;
- Xextern pascal short force_tty_coordinate_system_recalc ( WindowPtr window ) ;
- X
- X/*
- X * Getting some metrics about the tty and its drawing.
- X */
- Xextern pascal short get_tty_metrics ( WindowPtr window , short * x_size ,
- X short * y_size , short * x_size_pixels , short * y_size_pixels ,
- X short * font_number , short * font_size ,
- X short * char_width , short * row_height ) ;
- X
- X/*
- X * The basic move cursor function. 0,0 is topleft.
- X */
- Xextern pascal short move_tty_cursor ( WindowPtr window , short x_pos ,
- X short y_pos ) ;
- X
- X/*
- X * Return the location of the tty cursor
- X */
- Xextern pascal short get_tty_cursor ( WindowPtr window , short * x_pos ,
- X short * y_pos ) ;
- X
- X/*
- X * Flush all changes done to a tty to the screen (see TA_ALWAYS_UPDATE above)
- X */
- Xextern pascal short update_tty ( WindowPtr window ) ;
- X
- X/*
- X * Add a character to the tty and update the cursor position
- X */
- Xextern pascal short add_tty_char ( WindowPtr window , short character ) ;
- X
- X/*
- X * Add a string of characters to the tty and update the cursor
- X * position. The string is 0-terminated!
- X */
- Xextern pascal short add_tty_string ( WindowPtr window , const char * string ) ;
- X
- X#if PRINTF_TTY
- X/*
- X * The cool, standard C printf function, here for convenience. Requires
- X * vsprintf in the libraries. Change the PRINTF_TTY define to remove it.
- X */
- Xextern short printf_tty ( WindowPtr window , const char * format , ... ) ;
- X#endif
- X
- X/*
- X * Change or read an attribute of the tty. Note that some attribute changes
- X * may clear the screen. See the above enum and defines for values.
- X * Attributes can be both function pointers and special flag values.
- X */
- Xextern pascal short get_tty_attrib ( WindowPtr window , tty_attrib attrib ,
- X long * value ) ;
- Xextern pascal short set_tty_attrib ( WindowPtr window , tty_attrib attrib ,
- X long value ) ;
- X
- X/*
- X * Scroll the actual TTY image, in characters, positive means up/left
- X * scroll_tty ( my_tty , 0 , 1 ) means a linefeed. Is always carried out
- X * directly, regardless of the wait-update setting. Does updates before
- X * scrolling.
- X */
- Xextern pascal short scroll_tty ( WindowPtr window , short delta_x ,
- X short delta_y ) ;
- X
- X/*
- X * Erase the offscreen bitmap and move the cursor to 0,0. Re-init some window
- X * values (font etc) Is always carried out directly on-screen, regardless of
- X * the wait-for-update setting. Clears update area.
- X */
- Xextern pascal short clear_tty ( WindowPtr window ) ;
- X
- X/*
- X * We changed our mind about the size we want to draw in - in characters.
- X * You need to change the window size separately with SizeWindow.
- X */
- Xextern pascal short resize_tty_area ( WindowPtr window , short x_size ,
- X short y_size ) ;
- X
- X/*
- X * Call this function after calling WaitNextEvent in your program. It will
- X * return 0 if this was an event handled by the tty window, and you can go
- X * right back to calling WaitNextEvent. Non-0 means you handle the event.
- X */
- Xextern pascal short handle_tty_event ( WindowPtr window ,
- X EventRecord * event ) ;
- X
- X/*
- X * For screen dumps, open the printer port and call this function. Can be used
- X * for clipboard as well (only for a PICT, though; this library doesn't concern
- X * itself with characters, just bitmaps)
- X */
- Xextern pascal short image_tty ( WindowPtr window ) ;
- X
- X#if TTY_INPUT
- X/*
- X * Enter an internal event loop to read a character, that is returned in the
- X * character parameter. Note that several callback attributes may be called
- X * here to handle events the tty cannot handle itself. To handle command keys,
- X * you can install a command key handler. Note that if input isn't raw, you
- X * will not get any input until return is pressed.
- X */
- Xextern pascal short getchar_tty ( WindowPtr window , short * character ) ;
- X
- X/*
- X * Read an entire string, bounded by the length specified.
- X */
- Xextern pascal short gets_tty ( WindowPtr window , char * buffer ,
- X short buffer_length ) ;
- X
- X#endif /* TTY_INPUT */
- X
- X#if EXTENDED_SUPPORT
- X
- X/*
- X * Various versions of delete character/s, insert line/s etc can be handled by
- X * this general-purpose function. Negative num_ means delete, positive means
- X * insert, and you can never be sure which of row and col operations come first
- X * if you specify both...
- X */
- Xextern pascal short mangle_tty_rows_columns ( WindowPtr window ,
- X short from_row , short num_rows , short from_col , short num_cols ) ;
- X
- X/*
- X * For erasing just an area of characters
- X */
- Xextern pascal short clear_tty_window ( WindowPtr window , short from_row ,
- X short from_col , short to_row , short to_col ) ;
- X
- X/*
- X * For framing an area without using grahpics characters.
- X * Note that the given limits are those used for framing, you should not
- X * draw in them. frame_fatness should typically be 1-5, and may be clipped
- X * if it is too large.
- X */
- Xextern pascal short frame_tty_window ( WindowPtr window , short from_row ,
- X short from_col , short to_row , short to_col , short frame_fatness ) ;
- X
- X/*
- X * For inverting specific characters after the fact. May look funny in color.
- X */
- Xextern pascal short invert_tty_window ( WindowPtr window , short from_row ,
- X short from_col , short to_row , short to_col ) ;
- X
- X/*
- X * For drawing lines on the tty - VERY DEVICE DEPENDENT. Use get_tty_metrics.
- X */
- Xextern pascal short draw_tty_line ( WindowPtr window , short from_x ,
- X short from_y , short to_x , short to_y ) ;
- X
- X#endif /* EXTENDED_SUPPORT */
- X
- X#endif /* _H_tty_public */
- END_OF_FILE
- if test 13365 -ne `wc -c <'include/mactty.h'`; then
- echo shar: \"'include/mactty.h'\" unpacked with wrong size!
- fi
- # end of 'include/mactty.h'
- if test -f 'sys/amiga/winstr.c' -a "${1}" != "-c" ; then
- echo shar: Renaming existing file \"'sys/amiga/winstr.c'\" to \"'sys/amiga/winstr.c.orig'\"
- mv -f 'sys/amiga/winstr.c' 'sys/amiga/winstr.c.orig'
- fi
- echo shar: Extracting \"'sys/amiga/winstr.c'\" \(10222 characters\)
- sed "s/^X//" >'sys/amiga/winstr.c' <<'END_OF_FILE'
- X/* SCCS Id: @(#)winstr.c 3.1 93/04/02 */
- X/* Copyright (c) Gregg Wonderly, Naperville, Illinois, 1991,1992,1993. */
- X/* NetHack may be freely redistributed. See license for details. */
- X
- X#include "amiga:windefs.h"
- X#include "amiga:winext.h"
- X#include "amiga:winproto.h"
- X
- X/* Put a string into the indicated window using the indicated attribute */
- X
- Xvoid
- Xamii_putstr(window,attr,str)
- X winid window;
- X int attr;
- X const char *str;
- X{
- X struct Window *w;
- X register struct amii_WinDesc *cw;
- X register char *ob;
- X int i, j, n0, bottom, totalvis, wheight;
- X
- X#ifdef VIEWWINDOW
- X /* Never write text in MAP it would be too small to read */
- X if( window == WIN_MAP )
- X window = WIN_MESSAGE;
- X#endif
- X /* Always try to avoid a panic when there is no window */
- X if( window == WIN_ERR )
- X {
- X window = WIN_BASE;
- X if( window == WIN_ERR )
- X window = WIN_BASE = amii_create_nhwindow( NHW_BASE );
- X }
- X
- X if( window == WIN_ERR || ( cw = amii_wins[window] ) == NULL )
- X {
- X flags.window_inited=0;
- X panic(winpanicstr,window, "putstr");
- X }
- X
- X w = cw->win;
- X
- X if(!str) return;
- X amiIDisplay->lastwin = window; /* do we care??? */
- X
- X /* NHW_MENU windows are not opened immediately, so check if we
- X * have the window pointer yet
- X */
- X
- X if( w )
- X {
- X /* Force the drawing mode and pen colors */
- X
- X SetDrMd( w->RPort, JAM2 );
- X if( cw->type == NHW_STATUS )
- X SetAPen( w->RPort, attr ? C_WHITE : C_RED );
- X else if( cw->type == NHW_MESSAGE )
- X SetAPen( w->RPort, attr ? C_RED : C_WHITE );
- X else
- X SetAPen( w->RPort, attr ? C_RED : C_WHITE );
- X SetBPen( w->RPort, C_BLACK );
- X }
- X else if( cw->type != NHW_MENU && cw->type != NHW_TEXT )
- X {
- X panic( "NULL window pointer in putstr 2: %d", window );
- X }
- X
- X /* Okay now do the work for each type */
- X
- X switch(cw->type)
- X {
- X#define MORE_FUDGE 10 /* 8 for --more--, 1 for preceeding sp, 1 for */
- X /* putstr pad */
- X case NHW_MESSAGE:
- X bottom = w->Height - w->BorderTop - w->BorderBottom - 2;
- X bottom /= w->RPort->TxHeight;
- X if( bottom > 0 )
- X --bottom;
- X
- X wheight = ( w->Height - w->BorderTop -
- X w->BorderBottom - 3 ) / w->RPort->TxHeight;
- X
- X if( attr != -1 && scrollmsg )
- X {
- X if( ++cw->disprows > wheight )
- X {
- X outmore( cw );
- X cw->disprows = 1; /* count this line... */
- X }
- X else
- X {
- X ScrollRaster( w->RPort, 0, w->RPort->TxHeight,
- X w->BorderLeft-1, w->BorderTop+1,
- X w->Width - w->BorderRight-1,
- X w->Height - w->BorderBottom - 1 );
- X }
- X amii_curs( WIN_MESSAGE, 1, bottom );
- X }
- X
- X strncpy( toplines, str, BUFSZ );
- X toplines[ BUFSZ - 1 ] = 0;
- X
- X /* For initial message to be visible, we need to explicitly position the
- X * cursor. This flag, cw->curx == -1 is used elsewhere to force the
- X * cursor to be repositioned to the "bottom".
- X */
- X if( cw->curx == -1 )
- X {
- X amii_curs( WIN_MESSAGE, 1, bottom );
- X cw->curx = 0;
- X }
- X
- X /* If used all of history lines, move them down */
- X
- X if( cw->maxrow >= flags.msg_history )
- X {
- X if( cw->data[ 0 ] )
- X free( cw->data[ 0 ] );
- X memcpy( cw->data, &cw->data[ 1 ],
- X ( flags.msg_history - 1 ) * sizeof( char * ) );
- X cw->data[ flags.msg_history - 1 ] =
- X (char *) alloc( strlen( toplines ) + 5 );
- X strcpy( cw->data[ i = flags.msg_history - 1 ] +
- X SOFF + (scrollmsg!=0), toplines );
- X }
- X else
- X {
- X /* Otherwise, allocate a new one and copy the line in */
- X cw->data[ cw->maxrow ] = (char *)
- X alloc( strlen( toplines ) + 5 );
- X strcpy( cw->data[ i = cw->maxrow++ ] +
- X SOFF + (scrollmsg!=0), toplines );
- X }
- X cw->data[ i ][0] = 1;
- X cw->data[ i ][1] = attr;
- X
- X if( scrollmsg )
- X cw->data[ i ][2] = (cw->wflags & FLMSG_FIRST ) ? '>' : ' ';
- X
- X str = cw->data[i] + SOFF;
- X if( strlen(str) >= (cw->cols-MORE_FUDGE) )
- X {
- X int i;
- X char *p;
- X
- X while( strlen( str ) >= (cw->cols-MORE_FUDGE) )
- X {
- X for(p=(&str[ cw->cols ])-MORE_FUDGE; !isspace(*p) && p != str;)
- X {
- X --p;
- X }
- X if( p == str )
- X p = &str[ cw->cols ];
- X outsubstr( cw, str, i = (long)p-(long)str );
- X cw->curx += i;
- X amii_cl_end( cw, cw->curx );
- X str = p+1;
- X }
- X
- X if( *str )
- X {
- X outsubstr( cw, str, i = strlen( str ) );
- X cw->curx += i;
- X amii_cl_end( cw, cw->curx );
- X }
- X }
- X else
- X {
- X outsubstr( cw, str, i = strlen( str ) );
- X cw->curx += i;
- X amii_cl_end( cw, cw->curx );
- X }
- X cw->wflags &= ~FLMSG_FIRST;
- X for( totalvis = i = 0; i < cw->maxrow; ++i )
- X {
- X if( cw->data[i][1] == 0 )
- X ++totalvis;
- X }
- X if( scrollmsg )
- X {
- X SetPropInfo( w, &MsgScroll,
- X ( w->Height-w->BorderTop-w->BorderBottom ) / w->RPort->TxHeight,
- X totalvis, totalvis );
- X }
- X i = strlen( toplines + SOFF );
- X cw->maxcol = max( cw->maxcol, i );
- X cw->vwy = cw->maxrow;
- X break;
- X
- X case NHW_STATUS:
- X if( cw->data[ cw->cury ] == NULL )
- X panic( "NULL pointer for status window" );
- X ob = &cw->data[cw->cury][j = cw->curx];
- X if(flags.botlx) *ob = 0;
- X
- X /* Display when beam at top to avoid flicker... */
- X WaitTOF();
- X Text(w->RPort,str,strlen(str));
- X if( cw->cols > strlen( str ) )
- X TextSpaces( w->RPort, cw->cols - strlen( str ) );
- X
- X (void) strncpy(cw->data[cw->cury], str, cw->cols );
- X cw->data[cw->cury][cw->cols-1] = '\0'; /* null terminate */
- X cw->cury = (cw->cury+1) % 2;
- X cw->curx = 0;
- X break;
- X
- X case NHW_VIEWBOX:
- X case NHW_VIEW:
- X case NHW_MAP:
- X case NHW_BASE:
- X amii_curs(window, cw->curx+1, cw->cury);
- X Text(w->RPort,str,strlen(str));
- X cw->curx = 0;
- X /* CR-LF is automatic in these windows */
- X cw->cury++;
- X break;
- X
- X case NHW_MENU:
- X case NHW_TEXT:
- X
- X /* always grows one at a time, but alloc 12 at a time */
- X
- X if( cw->cury >= cw->rows || !cw->data ) {
- X char **tmp;
- X
- X /* Allocate 12 more rows */
- X cw->rows += 12;
- X tmp = (char**) alloc(sizeof(char*) * cw->rows);
- X
- X /* Copy the old lines */
- X for(i=0; i<cw->cury; i++)
- X tmp[i] = cw->data[i];
- X
- X if( cw->data )
- X free( cw->data );
- X
- X cw->data = tmp;
- X
- X /* Null out the unused entries. */
- X for(i=cw->cury; i<cw->rows; i++)
- X cw->data[i] = 0;
- X }
- X
- X if( !cw->data )
- X panic("no data storage");
- X
- X /* Shouldn't need to do this, but... */
- X
- X if( cw->data && cw->data[cw->cury] )
- X free( cw->data[cw->cury] );
- X
- X n0 = strlen(str)+1;
- X cw->data[cw->cury] = (char*) alloc(n0+SOFF);
- X
- X /* avoid nuls, for convenience */
- X cw->data[cw->cury][VATTR] = attr+1;
- X cw->data[cw->cury][SEL_ITEM] = 0;
- X Strcpy( cw->data[cw->cury] + SOFF, str);
- X
- X if(n0 > cw->maxcol) cw->maxcol = n0;
- X if(++cw->cury > cw->maxrow) cw->maxrow = cw->cury;
- X break;
- X
- X default:
- X panic("Invalid or unset window type in putstr()");
- X }
- X}
- X
- Xvoid
- Xoutmore( cw )
- X register struct amii_WinDesc *cw;
- X{
- X struct Window *w = cw->win;
- X
- X if((cw->wflags & FLMAP_SKIP) == 0)
- X {
- X if( scrollmsg )
- X {
- X int bottom;
- X bottom = w->Height - w->BorderTop - w->BorderBottom;
- X bottom /= w->RPort->TxHeight;
- X if( bottom > 0 )
- X --bottom;
- X ScrollRaster( w->RPort, 0, w->RPort->TxHeight,
- X w->BorderLeft-1, w->BorderTop+1,
- X w->Width - w->BorderRight-1,
- X w->Height - w->BorderBottom - 1 );
- X amii_curs( WIN_MESSAGE, 1, bottom );
- X Text( w->RPort, "--more--", 9 );
- X }
- X else
- X Text( w->RPort, " --more--", 9 );
- X
- X /* Make sure there are no events in the queue */
- X flushIDCMP( HackPort );
- X
- X /* Allow mouse clicks to clear --more-- */
- X WindowGetchar();
- X if( lastevent.type == WEKEY && lastevent.un.key == '\33' )
- X cw->wflags |= FLMAP_SKIP;
- X }
- X if( !scrollmsg )
- X {
- X amii_curs( WIN_MESSAGE, 1, 0 );
- X amii_cl_end( cw, cw->curx );
- X }
- X}
- X
- Xvoid
- Xoutsubstr( cw, str, len )
- X register struct amii_WinDesc *cw;
- X char *str;
- X int len;
- X{
- X struct Window *w = cw->win;
- X
- X if( cw->curx )
- X {
- X /* Check if this string and --more-- fit, if not,
- X * then put out --more-- and wait for a key.
- X */
- X if( (len + MORE_FUDGE ) + cw->curx >= cw->cols )
- X {
- X if( !scrollmsg )
- X outmore( cw );
- X }
- X else if(topl_addspace)
- X {
- X /* Otherwise, move and put out a blank separator */
- X Text( w->RPort, spaces, 1 );
- X cw->curx += 1;
- X }
- X }
- X
- X Text(w->RPort,str,len);
- X}
- X
- X/* Put a graphics character onto the screen */
- X
- Xvoid
- Xamii_putsym( st, i, y, c )
- X winid st;
- X int i, y;
- X CHAR_P c;
- X{
- X char buf[ 2 ];
- X amii_curs( st, i, y );
- X buf[ 0 ] = c;
- X buf[ 1 ] = 0;
- X amii_putstr( st, 0, buf );
- X}
- X
- X/* Add a line in the message window */
- X
- Xvoid
- Xamii_addtopl(s)
- X const char *s;
- X{
- X amii_putstr(WIN_MESSAGE,0,s); /* is this right? */
- X}
- X
- Xvoid
- XTextSpaces( rp, nr )
- X struct RastPort *rp;
- X int nr;
- X{
- X if( nr < 1 )
- X return;
- X
- X while (nr > sizeof(spaces) - 1)
- X {
- X Text(rp, spaces, (long)sizeof(spaces) - 1);
- X nr -= sizeof(spaces) - 1;
- X }
- X if (nr > 0)
- X Text(rp, spaces, (long)nr);
- X}
- X
- Xvoid
- Xamii_remember_topl()
- X{
- X /* ignore for now. I think this will be done automatically by
- X * the code writing to the message window, but I could be wrong.
- X */
- X}
- X
- Xint
- Xamii_doprev_message()
- X{
- X struct amii_WinDesc *cw;
- X struct Window *w;
- X char *str;
- X
- X if( WIN_MESSAGE == WIN_ERR ||
- X ( cw = amii_wins[ WIN_MESSAGE ] ) == NULL || ( w = cw->win ) == NULL )
- X {
- X panic(winpanicstr,WIN_MESSAGE, "doprev_message");
- X }
- X
- X /* When an interlaced/tall screen is in use, the scroll bar will be there */
- X if( scrollmsg )
- X {
- X struct Gadget *gd;
- X struct PropInfo *pip;
- X int hidden, topidx, i, total, wheight;
- X
- X for( gd = w->FirstGadget; gd && gd->GadgetID != 1; )
- X gd = gd->NextGadget;
- X
- X if( gd )
- X {
- X pip = (struct PropInfo *)gd->SpecialInfo;
- X wheight = ( w->Height - w->BorderTop -
- X w->BorderBottom - 2 ) / w->RPort->TxHeight;
- X hidden = max( cw->maxrow - wheight, 0 );
- X topidx = (((ULONG)hidden * pip->VertPot) + (MAXPOT/2)) >> 16;
- X for( total = i = 0; i < cw->maxrow; ++i )
- X {
- X if( cw->data[i][1] == 0 )
- X ++total;
- X }
- X
- X i = 0;
- X while( (--topidx) >= 0 && i < wheight/2 )
- X {
- X SetPropInfo( w, &MsgScroll, wheight, total, topidx );
- X DisplayData( WIN_MESSAGE, topidx, -1 );
- X ++i;
- X }
- X }
- X return(0);
- X }
- X
- X if( --cw->vwy < 0 )
- X {
- X cw->maxcol = 0;
- X DisplayBeep( NULL );
- X str = "\0\0No more history saved...";
- X }
- X else
- X str = cw->data[ cw->vwy ];
- X
- X amii_cl_end(cw, 0);
- X amii_curs( WIN_MESSAGE, 1, 0 );
- X Text(w->RPort,str+SOFF,strlen(str+SOFF));
- X cw->curx = cw->cols + 1;
- X
- X return( 0 );
- X}
- END_OF_FILE
- if test 10222 -ne `wc -c <'sys/amiga/winstr.c'`; then
- echo shar: \"'sys/amiga/winstr.c'\" unpacked with wrong size!
- fi
- # end of 'sys/amiga/winstr.c'
- if test -f 'sys/winnt/nhincl.mak' -a "${1}" != "-c" ; then
- echo shar: Renaming existing file \"'sys/winnt/nhincl.mak'\" to \"'sys/winnt/nhincl.mak.orig'\"
- mv -f 'sys/winnt/nhincl.mak' 'sys/winnt/nhincl.mak.orig'
- fi
- echo shar: Extracting \"'sys/winnt/nhincl.mak'\" \(10322 characters\)
- sed "s/^X//" >'sys/winnt/nhincl.mak' <<'END_OF_FILE'
- X# =========================================================================
- X# NTWIN32.MAK - Win32 application master NMAKE definitions file for the
- X# Microsoft Win32 SDK for Windows NT programming samples
- X# -------------------------------------------------------------------------
- X# NMAKE Options
- X#
- X# Use the table below to determine the extra options for NMAKE to
- X# generate various application debugging, profiling and performance tuning
- X# information.
- X#
- X# Application Information Type Invoke NMAKE
- X# ---------------------------- ------------
- X# For No Debugging Info nmake nodebug=1
- X# For Working Set Tuner Info nmake tune=1
- X# For Call Attributed Profiling Info nmake profile=1
- X#
- X# Note: Working Set Tuner and Call Attributed Profiling is for Intel
- X# x86 systems only.
- X#
- X# Note: The three options above are mutually exclusive (you may use only
- X# one at complile/link the application).
- X#
- X# Note: using the environment variables NODEBUG, TUNE, and PROFILE is an
- X# alternate method for setting these options.
- X#
- X# Additional NMAKE Options Invoke NMAKE
- X# ---------------------------- ------------
- X# For No ANSI NULL Compliance nmake no_nansi=1
- X# (ANSI NULL is defined as PVOID 0)
- X#
- X# =========================================================================
- X
- X# -------------------------------------------------------------------------
- X# Get CPU Type - exit if CPU environment variable is not defined
- X# -------------------------------------------------------------------------
- X
- X# Intel i386 and i486 systems.
- X!IF "$(CPU)" == "i386"
- XCPUTYPE = 1
- X!ENDIF
- X
- X# MIPS R4000 systems.
- X!IF "$(CPU)" == "MIPS"
- XCPUTYPE = 2
- X!ENDIF
- X
- X!IFNDEF CPUTYPE
- X!ERROR Must specify CPU environment variable ( CPU=i386 or CPU=MIPS )
- X!ENDIF
- X
- X# -------------------------------------------------------------------------
- X# Platform Dependent Binaries Declarations
- X#
- X# If you are using the old Mips compiler then
- X# cc = cc
- X# cvtobj = mip2coff
- X# -------------------------------------------------------------------------
- X
- X# binary declarations for use on Intel i386 and i486 systems.
- X!IF "$(CPU)" == "i386"
- Xcc = cl386
- Xcvtobj = REM !!! CVTOBJ is no longer necessary - please remove !!!
- X!ENDIF
- X
- X# binary declarations for use on self hosted MIPS R4000 systems.
- X!IF "$(CPU)" == "MIPS"
- Xcc = mcl
- Xcvtobj = REM !!! CVTOBJ is no longer necessary - please remove !!!
- X!ENDIF
- X
- X# binary declarations common to all platforms.
- Xlink = link32
- Ximplib = lib32
- Xrc = rc
- Xcvtres = cvtres
- Xhc = hc
- X
- X# -------------------------------------------------------------------------
- X# Platform Dependent Compile Flags - must be specified after $(cc)
- X#
- X# Note: Debug switches are on by default for current release
- X#
- X# These switches allow for source level debugging with WinDebug for local
- X# and global variables.
- X#
- X# Both compilers now use the same front end - you must still define either
- X# _X86_ or _MIPS_. These have replaced the i386 and MIPS definitions which
- X# are not ANSI compliant.
- X#
- X# i386 specific compiler flags:
- X# -G3 - generate 80386 instructions
- X# -Gz - stdcall
- X#
- X# MS MIPS specific compiler flags:
- X#
- X#
- X# Common compiler flags:
- X# -c - compile without linking
- X# -W3 - Set warning level to level 3
- X# -Zi - generate debugging information
- X# -Od - disable all optimizations
- X# -Ox - use maximum optimizations
- X# -Zd - generate only public symbols and line numbers for debugging
- X#
- X# *** OLD MIPS ONLY ***
- X#
- X# The following definitions are for the old Mips compiler.
- X#
- X# OLD MIPS compiler flags:
- X# -c - compile without linking
- X# -std - produce warnings for non-ANSI standard source code.
- X# -g2 - produce a symbol table for debugging
- X# -O - invoke the global optimizer
- X# -EL - produce object modules targeted for
- X# "little-endian" byte ordering
- X# -------------------------------------------------------------------------
- X
- X# declarations common to all compilers.
- Xccommon = -c -W0
- X
- X!IF "$(CPU)" == "i386"
- Xcflags = $(ccommon) -G3 -D_X86_=1
- Xscall = -Gz
- X!ELSE
- Xcflags = $(ccommon) -D_MIPS_=1
- Xscall =
- X!ENDIF
- X
- X!IF "$(CPU)" == "i386"
- X!IFDEF NODEBUG
- Xcdebug = -Ox
- X!ELSE
- X!IFDEF PROFILE
- Xcdebug = -Gh -Zd -Ox
- X!ELSE
- X!IFDEF TUNE
- Xcdebug = -Gh -Zd -Ox
- X!ELSE
- Xcdebug = -Zi -Od
- X!ENDIF
- X!ENDIF
- X!ENDIF
- X!ELSE
- X!IFDEF NODEBUG
- Xcdebug = -Ox
- X!ELSE
- Xcdebug = -Zi -Od
- X!ENDIF
- X!ENDIF
- X
- X# OLD MIPS Complile Flags
- X!IF 0
- X!IF "$(CPU)" == "MIPS"
- Xcflags = -c -std -o $(*B).obj -EL -DMIPS=1 -D_MIPS_=1
- X!IFDEF NODEBUG
- Xcdebug =
- X!ELSE
- Xcdebug = -g2
- X!ENDIF
- X!ENDIF
- X!ENDIF
- X
- X# -------------------------------------------------------------------------
- X# Target Module & Subsystem Dependant Compile Defined Variables - must be
- X# specified after $(cc)
- X#
- X# The following is a table which indicates the various
- X# acceptable combinations of CRTDLL and LIBC(MT) with
- X# respect to DLLs and EXEs, along with the appropriate
- X# compiler flags for each.
- X#
- X# Link EXE Create Exe Link DLL Create DLL
- X# with Using with Using
- X# ----------------------------------------------------
- X# LIBC CVARS None None *
- X# LIBC CVARS LIBC CVARS
- X# LIBC CVARS LIBCMT CVARSMT
- X# LIBCMT CVARSMT None None *
- X# LIBCMT CVARSMT LIBC CVARS
- X# LIBCMT CVARSMT LIBCMT CVARSMT
- X# CRTDLL CVARSDLL None None *
- X# CRTDLL CVARSDLL LIBC CVARS
- X# CRTDLL CVARSDLL LIBCMT CVARSMT
- X# CRTDLL CVARSDLL CRTDLL CVARSDLL *
- X#
- X# Note: Any executable which accesses a DLL linked with CRTDLL.LIB must
- X# also link with CRTDLL.LIB instead of LIBC.LIB or LIBCMT.LIB.
- X# When using DLLs, it is recommended that all of the modules be
- X# linked with CRTDLL.LIB.
- X#
- X# * - Recommended Configurations
- X#
- X# -------------------------------------------------------------------------
- X
- X!IFDEF NO_ANSI
- Xnoansi = -DNULL=0
- X!ENDIF
- Xcvars = -DWIN32 $(noansi)
- Xcvarsmt = $(cvars) -D_MT
- Xcvarsdll = $(cvarsmt) -D_DLL
- Xcvarsmtdll = $(cvarsmt) -D_DLL
- X
- X# For POSIX applications
- Xpsxvars = -D_POSIX_
- X
- X# resource compiler
- Xrcvars = -DWIN32 $(noansi)
- X
- X# -------------------------------------------------------------------------
- X# Platform Dependent Link Flags - must be specified after $(link)
- X#
- X# Note: $(DLLENTRY) should be appended to each -entry: flag on the link line.
- X# -------------------------------------------------------------------------
- X
- X# declarations for use on Intel i386 and i486 systems.
- X!IF "$(CPU)" == "i386"
- XDLLENTRY = @12
- X!ENDIF
- X
- X# declarations for use on self hosted MIPS R4000 systems.
- X!IF "$(CPU)" == "MIPS"
- XDLLENTRY =
- X!ENDIF
- X
- X# -------------------------------------------------------------------------
- X# Target Module Dependent Link Debug Flags - must be specified after $(link)
- X#
- X# These switches allow for source level debugging with WinDebug, profiling
- X# or performance tuning.
- X#
- X# Note: Debug switches are on by default.
- X# -------------------------------------------------------------------------
- X
- X!IF "$(CPU)" == "i386"
- X!IFDEF NODEBUG
- Xldebug =
- X!ELSE
- X!IFDEF PROFILE
- Xldebug = -debug:partial -debugtype:coff
- X!ELSE
- X!IFDEF TUNE
- Xldebug = -debug:partial -debugtype:coff
- X!ELSE
- Xldebug = -debug:full -debugtype:cv
- X!ENDIF
- X!ENDIF
- X!ENDIF
- X!ELSE
- X!IFDEF NODEBUG
- Xldebug =
- X!ELSE
- Xldebug = -debug:full -debugtype:cv
- X!ENDIF
- X!ENDIF
- X
- X# for compatibility with older style makefiles
- Xlinkdebug = $(ldebug)
- X
- X# -------------------------------------------------------------------------
- X# Subsystem Dependent Link Flags - must be specified after $(link)
- X#
- X# These switches allow for source level debugging with WinDebug for local
- X# and global variables.
- X# -------------------------------------------------------------------------
- X
- X# For applications that use the C-Runtime libraries
- Xconlflags = -subsystem:console -entry:mainCRTStartup
- Xguilflags = -subsystem:windows -entry:WinMainCRTStartup
- X
- X# For POSIX applications
- Xpsxlflags = -subsystem:posix -entry:__PosixProcessStartup
- X
- X# for compatibility with older style makefiles
- Xconflags = $(conlflags)
- Xguiflags = $(guilflags)
- Xpsxflags = $(psxlflags)
- X
- X# -------------------------------------------------------------------------
- X# C-Runtime Target Module Dependent Link Libraries
- X#
- X# Below is a table which describes which libraries to use depending on the
- X# target module type, although the table specifically refers to Graphical
- X# User Interface apps, the exact same dependancies apply to Console apps.
- X# I.E. you could replace all occurences of GUI with CON in the following:
- X#
- X# Desired CRT Libraries Desired CRT Libraries
- X# Library to link Library to link
- X# for EXE with EXE for DLL with DLL
- X# ----------------------------------------------------
- X# LIBC GUILIBS None None *
- X# LIBC GUILIBS LIBC GUILIBS
- X# LIBC GUILIBS LIBCMT GUILIBSMT
- X# LIBCMT GUILIBSMT None None *
- X# LIBCMT GUILIBSMT LIBC GUILIBS
- X# LIBCMT GUILIBSMT LIBCMT GUILIBSMT
- X# CRTDLL GUILIBSDLL None None *
- X# CRTDLL GUILIBSDLL LIBC GUILIBS
- X# CRTDLL GUILIBSDLL LIBCMT GUILIBSMT
- X# CRTDLL GUILIBSDLL CRTDLL GUILIBSDLL *
- X#
- X# * - Recommended Configurations.
- X#
- X# Note: Any executable which accesses a DLL linked with CRTDLL.LIB must
- X# also link with CRTDLL.LIB instead of LIBC.LIB or LIBCMT.LIB.
- X#
- X# Note: For POSIX applications, link with $(psxlibs)
- X#
- X# -------------------------------------------------------------------------
- X
- X# optional profiling and tuning libraries
- X!IF "$(CPU)" == "i386"
- X!IFDEF PROFILE
- Xoptlibs = cap.lib
- X!ELSE
- X!IFDEF TUNE
- Xoptlibs = wst.lib
- X!ELSE
- Xoptlibs =
- X!ENDIF
- X!ENDIF
- X!ELSE
- Xoptlibs =
- X!ENDIF
- X
- X# basic subsystem specific libraries less the C-RunTime
- Xbaselibs = kernel32.lib ntdll.lib $(optlibs)
- Xwinlibs = kernel32.lib ntdll.lib user32.lib gdi32.lib winspool.lib comdlg32.lib $(optlibs)
- X
- X# For applications that use the C-Runtime libraries
- Xconlibs = libc.lib $(baselibs)
- Xconlibsmt = libcmt.lib $(baselibs)
- Xconlibsdll = crtdll.lib $(baselibs)
- Xguilibs = libc.lib $(winlibs)
- Xguilibsmt = libcmt.lib $(winlibs)
- Xguilibsdll = crtdll.lib $(winlibs)
- X
- X# For POSIX applications
- Xpsxlibs = libcpsx.lib psxdll.lib psxrtl.lib $(baselibs)
- END_OF_FILE
- if test 10322 -ne `wc -c <'sys/winnt/nhincl.mak'`; then
- echo shar: \"'sys/winnt/nhincl.mak'\" unpacked with wrong size!
- fi
- # end of 'sys/winnt/nhincl.mak'
- echo shar: End of archive 33 \(of 33\).
- cp /dev/null ark33isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 33 archives.
- echo "Now execute ./patchit.sh"
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-