public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jerry DeLisle <jvdelisle@charter.net>
To: gfortran <fortran@gcc.gnu.org>
Subject: Re: [patch, libgfortran] PR48552/48925 Invalid spaces in complex/code cleanup
Date: Tue, 21 Jun 2016 19:33:00 -0000	[thread overview]
Message-ID: <47383743-d720-e83d-1c8a-7755a13e47ab@charter.net> (raw)
In-Reply-To: <fbca2d40-cc90-7d65-f44c-6c95ba292c31@charter.net>

Ping

On 06/18/2016 12:23 PM, Jerry DeLisle wrote:
> Greetings all,
> 
> This is a major rework of floating point write routines. Most of the existing
> critical code is retained. Much of the code is reorganized.
> 
> The problem with complex is that it is writing two floats with formatting.
> Previously write_block, which does the actual output, was buried at the bottom
> of all the functions. We do not know how wide the significant result is until
> that point. These means we had no way to calculate how many blanks to transmit
> first to right justify until we already sent the digits.
> 
> This patch modifies this by 1) moving the buffer creations up to the higher
> routines, 2) formatting a string, 3) getting the final lengths, and 4)
> calculating the leading blanks needed. Once this is determined, the complex
> value can sent out correctly.
> 
> Several helper functions are created. The most significant is probably
> write_float_string. It takes a simple string from all the other lower level
> routines, and uses write_block. All the previous kind=4 character internal  unit
> code spread throughout the previous output_float routines is now done with about
> 5 lines of code.
> 
> Regression tested on x86_64. Test cases modified for the new format of default
> complex.
> (changelog for test cases will be done of course)
> 
> OK for trunk?
> 
> Regards,
> 
> Jerry
> 
> 2016-06-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
> 
> 	PR libgfortran/48852
> 	* io/write.c: Cleaned up whitespace.
> 	(write_d, write_e, write_f, write_es, write_en): Use new helper function
> 	write_float_0. (write_float_0): New helper function.
> 	(get_precision, select_buffer, select_string, write_float_string): New
> 	helper functions used in remaining float writing functions. Helper function
> 	write_float_string now contains code for writing to kind=4 character
> 	internal units.
> 	(write_real): Modified to establish working buffers at this level and to
> 	use new helper functions.
> 	(write_real_g0): Likewise modified.
> 	(write_complex): Likewise modified. Gets both float strings before
> 	output so that final lengths can be determined which allows right
> 	justifying the complex number with no intervening spaces.
> 	* io/write_float.def (build_float_string): Renamed from previously
> 	output_float, modified to use buffers passed in from higher functions,
> 	builds a null terminated string of the floating point value. Character
> 	kind=4 code eliminated.
> 	(write_infnan): Likewise modified to use incoming buffers and eliminate
> 	kind=4 related code.
> 	(OUTPUT_FLOAT_FMT_G): Deleted. Functionality moved into FORMAT_FLOAT.
> 	(FORMAT_FLOAT): Renamed macro from WRITE_FLOAT. Use build_float_string.
> 	(get_float_string): Renamed from write_float, uses FORMAT_FLOAT macro.
> 	Buffer allocation removed, now at higher level.
> 

  reply	other threads:[~2016-06-21 19:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-18 19:24 Jerry DeLisle
2016-06-21 19:33 ` Jerry DeLisle [this message]
2016-06-23  6:31   ` Janne Blomqvist
2016-06-23 16:00     ` Jerry DeLisle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47383743-d720-e83d-1c8a-7755a13e47ab@charter.net \
    --to=jvdelisle@charter.net \
    --cc=fortran@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).