From 18754344eb42e60ed4b1a08e5dc71fb9270e3ae2 Mon Sep 17 00:00:00 2001 From: borg323 <4010067-borg323@users.noreply.gitlab.com> Date: Tue, 9 Jul 2019 02:03:53 +0300 Subject: [PATCH] reduce diff to windows frotz --- src/common/buffer.c | 33 +++++++++++++++------------------ src/common/object.c | 3 +-- src/common/process.c | 3 +-- src/common/quetzal.c | 4 ---- src/common/random.c | 2 +- src/common/text.c | 19 ++++++++++--------- 6 files changed, 28 insertions(+), 36 deletions(-) diff --git a/src/common/buffer.c b/src/common/buffer.c index 12508d8..a9895ff 100644 --- a/src/common/buffer.c +++ b/src/common/buffer.c @@ -30,6 +30,20 @@ static int bufpos = 0; static zchar prev_c = 0; +/* + * init_buffer + * + * Initialize buffer variables. + * + */ + +void init_buffer(void) +{ + memset(buffer, 0, sizeof (zchar) * TEXT_BUFFER_SIZE); + bufpos = 0; + prev_c = 0; +} + /* * flush_buffer * @@ -52,12 +66,7 @@ void flush_buffer (void) buffer[bufpos] = 0; - - locked = TRUE; - - stream_word (buffer); - - locked = FALSE; + locked = TRUE; stream_word (buffer); locked = FALSE; /* Reset the buffer */ @@ -129,15 +138,3 @@ void new_line (void) }/* new_line */ -/* - * init_buffer - * - * Initialize buffer variables. - * - */ -void init_buffer(void) -{ - memset(buffer, 0, sizeof (zchar) * TEXT_BUFFER_SIZE); - bufpos = 0; - prev_c = 0; -} diff --git a/src/common/object.c b/src/common/object.c index 296f654..d2dc7e6 100644 --- a/src/common/object.c +++ b/src/common/object.c @@ -41,10 +41,9 @@ * Calculate the address of an object. * */ + static zword object_address (zword obj) { -/* zchar obj_num[10]; */ - /* Check object number */ if (obj > ((h_version <= V3) ? 255 : MAX_OBJECT)) { diff --git a/src/common/process.c b/src/common/process.c index 9187b0b..86e3929 100644 --- a/src/common/process.c +++ b/src/common/process.c @@ -180,8 +180,7 @@ void (*ext_opcodes[0x1d]) (void) = { void init_process (void) { finished = 0; -} /* init_process */ - +} /* * load_operand diff --git a/src/common/quetzal.c b/src/common/quetzal.c index 53707ed..b50cb3f 100644 --- a/src/common/quetzal.c +++ b/src/common/quetzal.c @@ -47,10 +47,6 @@ #define get_c fgetc #define put_c fputc -/* - * externs - */ - typedef unsigned long zlong; /* diff --git a/src/common/random.c b/src/common/random.c index 541a32d..0c5d16f 100644 --- a/src/common/random.c +++ b/src/common/random.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "frotz.h" diff --git a/src/common/text.c b/src/common/text.c index 920a6c2..7cbc610 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -243,13 +243,15 @@ static void load_string (zword addr, zword length) * Encode the Unicode text in the global "decoded" string then write * the result to the global "encoded" array. (This is used to look up * words in the dictionary.) Up to V3 the vocabulary resolution is - * two, since V4 it is three words. Because each word contains three - * Z-characters, that makes six or nine Z-characters respectively. - * Longer words are chopped to the proper size, shorter words are are - * padded out with 5's. For word completion we pad with 0s and 31s, - * the minimum and maximum Z-characters. + * two, since V4 it is three words. + * Because each word contains three Z-characters, that makes six or + * nine Z-characters respectively. Longer words are chopped to the + * proper size, shorter words are are padded out with 5's. For word + * completion we pad with 0s and 31s, the minimum and maximum + * Z-characters. * */ + static void encode_text (int padding) { static zchar again[] = { 'a', 'g', 'a', 'i', 'n', 0 }; @@ -325,9 +327,8 @@ static void encode_text (int padding) }/* encode_text */ - /* - * z_check_unicode, test if a unicode character can be read and printed. + * z_check_unicode, test if a unicode character can be printed (bit 0) and read (bit 1). * * zargs[0] = Unicode * @@ -433,7 +434,7 @@ static void decode_text (enum string_type st, zword addr) byte_addr = (long) addr << 2; else if (h_version <= V7) byte_addr = ((long) addr << 2) + ((long) h_strings_offset << 3); - else /* h_version == V8 */ + else /* (h_version == V8) */ byte_addr = (long) addr << 3; if (byte_addr >= story_size) @@ -545,8 +546,8 @@ static void decode_text (enum string_type st, zword addr) *ptr = 0; }/* decode_text */ -#undef outchar +#undef outchar /* * z_new_line, print a new line. -- 2.34.1