Dec 132017
 
Various C source code that will handle word-wrap.
File WRAP.ZIP from The Programmer’s Corner in
Category C Source Code
Various C source code that will handle word-wrap.
File Name File Size Zip Size Zip Type
BUILD.BAT 384 119 deflated
READ.ME 1664 768 deflated
ROLL.ASM 3840 1491 deflated
ROLLWRAP.ASM 7040 1922 deflated
SCROLL.ASM 1536 714 deflated
SHIFT.ASM 3072 1260 deflated
WRAP.ASM 3456 1321 deflated
WRAP.H 640 266 deflated
WRAP.LIB 3072 1368 deflated
WRAPPER.C 2048 790 deflated

Download File WRAP.ZIP Here

Contents of the READ.ME file


This file includes five routines that may come in handy when working with
text-mode screens. They are all written in assembly language.

The following is included in the file wrap.h

/* directions for rollwrap */
#define LEFT_UP2
#define LEFT_DOWN3
#define RIGHT_UP0
#define RIGHT_DOWN1

typedef struct {
int x1, y1, x2, y2;
char attr;
} shiftwin;

void shift (shiftwin *win, int num); /* horizontal shift */
void scroll (shiftwin *win, int num); /* vertical scroll */
void roll (shiftwin *win, int num); /* vertical wrap */
void wrap (shiftwin *win, int num); /* horizontal wrap */
void rollwrap (shiftwin *win, int num, int dir); /* diagonal wrap */
/* end of wrap.h */

shift, scroll, roll, and wrap treat the parameter num as a signed integer.
rollwrap treates the parameter as unsigned. The parameter dir tells rollwrap
which directions to wrap the window.

I didn't include a shiftscroll() routine because this can easily be
accomplished by a shift followed immediately by a scroll (or vice-versa).

getscr contains internal routines called by shift, roll, wrap, and rollwrap.
These routines shouldn't be called by the application program.

The coordinates x1, y1, x2, and y2 are 1-relative, like the BGI text mode
coordinates.

These routines have been tested with Turbo C versions 1.0 and 1.5, but should
work equally well with Microsoft C.

Questions, comments, suggestions should be addressed to:
Jim Mischel
20 Stewart St.
Durango, CO 81301
(303)259-5189
CIS: 73717,1355


 December 13, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)