Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Fortran Programming Language

pretty output using Fortran


I want my fortran output to be able to show colors, and bold/normal
characters.

The only way I can think of is to throw in HTTP meta-characters in the
output and view the output with a browser.

Are there other ways and are there procedural languages that can do
this more directly ?

Thanks for any inputs.

> Are there other ways and are there procedural languages that can do
> this more directly ?

It depends on the system you are on. There are a few portable I/O
frameworks to do that, that you might want to consider. I know and have
used Curses (especially its popular open source implementation NCurses).
These can be used straightforwardly from C, but have bindings for other
languages (although I have never seen it used from Fortran code).

--
FX

analys@hotmail.com wrote:
> I want my fortran output to be able to show colors, and bold/normal
> characters.
> The only way I can think of is to throw in HTTP meta-characters in the
> output and view the output with a browser.

Writing HTML works pretty well.  I have done it.  It is
especially convenient when you want to e-mail the results
to someone, as you can be pretty sure they have access to
a browser.

The more traditional way would be to use escape
sequences such as those for the VT240 terminal, also known
as ANSI escape sequences.

http://en.wikipedia.org/wiki/ANSI_escape_code

In the case of DOS/Windows these require the ANSI.SYS driver,
which may or may not be the default on your system.
The above web page seems to indicate it is included
in the usual Linux terminal window drivers.

-- glen

analys@hotmail.com wrote:
> I want my fortran output to be able to show colors, and bold/normal
> characters.

> The only way I can think of is to throw in HTTP meta-characters in the
> output and view the output with a browser.

That would likely be the most widely portable with least amount of
effort if no interactivity is required.  What are the portability
requirements?

> Are there other ways and are there procedural languages that can do
> this more directly ?

> Thanks for any inputs.

--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library:  http://www.fortranlib.com

Support the Original G95 Project:  http://www.g95.org
-OR-
Support the GNU GFortran Project:  http://gcc.gnu.org/fortran/index.html

If you want to do the impossible, don't hire an expert because he knows
it can't be done.

-- Henry Ford

On May 13, 12:43 pm, glen herrmannsfeldt <g@ugcs.caltech.edu>
wrote:

On Windows XP in a command window (and probably 2000) ANSI.SYS only
works for DOS (16 bit) programs and only if a reference to it is
included in CONFIG.NT (not CONFIG.SYS).

Other shells such as those running under Cygwin or MinGW/MSYS *might*
support ANSI escape sequences.

-- elliot

On May 13, 4:31 pm, Gary Scott <garylsc@sbcglobal.net> wrote:

> analys@hotmail.com wrote:
> > I want my fortran output to be able to show colors, and bold/normal
> > characters.

> > The only way I can think of is to throw in HTTP meta-characters in the
> > output and view the output with a browser.

> That would likely be the most widely portable with least amount of
> effort if no interactivity is required.  What are the portability
> requirements?

At this point its running on Windows XP.  Its only prototype code
right now - if it goes anywhere it would need to run on XP and Vista
as far as I can see.  No interactivity is required on the  output
side.  There is interaction on the input side - I am handling it with
excel (Fortran reads a CSV file).

Thanks to all for their inputs.

On Sun, 13 May 2007 08:43:40 -0800, glen herrmannsfeldt <g@ugcs.caltech.edu>
 wrote in <ydadnQXnK80CrNrbnZ2dnUVZ_rWnn@comcast.com>:

        I quite often write PostScript(R) code from within Fortran programmes,
usually for visualisation but there's no reason it couldn't be pretty-printing
instead.  The benefit to writing HTML would lie in not having to format
tables, etc, yourself.

--
Ivan Reid, School of Engineering & Design, _____________  CMS Collaboration,
Brunel University.    Ivan.Reid@[brunel.ac.uk|cern.ch]    Room 40-1-B12, CERN
GSX600F, RG250WD         "You Porsche. Me pass!"   DoD #484     JKLO#003, 005
WP7# 3000   LC Unit #2368 (tinlc)   UKMC#00009   BOTAFOT#16    UKRMMA#7 (Hon)
        KotPT -- "for stupidity above and beyond the call of duty".

On May 13, 11:48 pm, analys@hotmail.com wrote:

> I want my fortran output to be able to show colors, and bold/normal
> characters.

> The only way I can think of is to throw in HTTP meta-characters in the
> output and view the output with a browser.

> Are there other ways and are there procedural languages that can do
> this more directly ?

> Thanks for any inputs.

There are severall free TUI (and commercial GUI) interfaces available,
but most work in a single font in (usually) only 256 colours.
These are the best for programming use, as usually a single line of
Fortran code causes a complete line of text to be output in any colour
or read back edited. The only draw back is, as I said, the use of a
single font and font size.
But scrolling and all the typical tools are included.

I HAVE often used Fortran to generate (from a descriptive language of
what you want to do)  form-type unlimited length screens for data
capture, which can have very many text sizes and styles and just any
colour possible.

Another method for excellent report writing, is to write RTF files
which can be read with any WORD or wordpad version, which also cana
have any font sizes and colours.

>> > I want my fortran output to be able to show colors, and bold/normal
>> > characters.
> At this point its running on Windows XP.  Its only prototype code
> right now - if it goes anywhere it would need to run on XP and Vista
> as far as I can see.  No interactivity is required on the  output
> side.  There is interaction on the input side - I am handling it with
> excel (Fortran reads a CSV file).

Under Windows XP you can use Silverfrost Fortran FTN95. The libraries (or
supplied functions)
that come with this enable you to:

(a) write your output to a "DOS box", selecting colour and other formatting
attributes. This is a
hang-over from the DOS-extended version of Salford FTN77, but everything
works. 16 colours
only, but bold, underline etc available.
(b) write your output to a Windows printer, encoding html, which the printer
driver interprets into
pretty output including colours etc. - you didn't say if you wanted your
output on the screen or printer.
FTN95 can "open" a printer for "html output".
(c) write text to a graphics area, in which case you have very fine control
over fonts and colours, and
with a minimum of extra work, can get this form of output into hard copy too
However, you have to
wrestle with paper sizes, dots per inch and all the usual dross.

Alternatively, consider:

(d) use a printer with a complete command language (i.e. not a "windows GDI
printer"), and put the
requisite ESCape codes in the output - this will be similar to the use of
ANSI ESCape codes recommended
by others for the screen (this should work with anybody's Fortran).

If you don't mind storing your output in a file, to open in another
application, i.e. a browser, then you
can write raw html . Such output could also have inserted pictures - FTN95
can very
easily create graphics in BMP, JPG and other formats. All you need to do is
create the graphics image,
and put the requisite href in your html.

You will find difficulty with mixing different fonts and font sizes,
especially if they are proportionally-spaced,
as this requires a knowledge of the size of every character. If you want
absolute control over positioning,
consider making every page of your output a "vector graphic". Then you have
several choices: PostScript,
already recommended, or use HP GL (Hewlett Packard Graphics Language) or SVG
(Scaleable Vector
Graphics). All three of these can be imported into various graphics
programs - certainly corelDRAW imports
all three. Again, these can be generated by anybody's Fortran.

EB

On May 13, 8:06 pm, analys@hotmail.com wrote:

Consider Excel on the output side too.

A few years ago I took a short course on that program. I thought of it
as a spreadsheet until the instructor described it as "a tool for the
presentation of business information."

If you can read a CSV file, you can write one as well.

-- e-mail: epc8 at juno dot com

On May 15, 7:04 am, e p chandler <e@juno.com> wrote:

very interesting.  You are saying that the output can be a CSV file
and all the prettification can be done via excel.

The output looks like

Serial Number J

 Number1 number2 number3 number4
Text Number1 Number2 Number2
number1 number 2 number3 number4

repeat above a few times

closing number1 number2 number3 number4

Serial Number J+1

and life goes on.

I want Serial nunbers to be in one color

When text has cetain values it should have a certain color

when numbers are in a certain relationship then it should be colored
and so on.

I assume that an excel macro can be written that will do al this.
(list of things to do: - learn excel :-)).

On May 14, 3:26 pm, "Edward N Bromhead"

Thanks for the info.  I'd like pretty output both on the screen and
hardcopy.  At this point  producing output that can be prettified by
Excel looks like a very interesting option.

For what you describe, I'd say writing HTML or RTF is going to be the
simplest and clearest. In my experience, both have similar capabilities
in the sort of areas you mention. HTML is slightly simpler (RTF is a
little more fussy about having header information, and tends not to
display at all if there's something odd in the file, while HTML will do
its best) and also probably more portable, since just about everyone has
a browser these days but I'm not sure about the automatic availability
of something which reads RTF on non-Windows systems.

If everyone who will need to see your results files will also be running
the program, and therefore is bound to have Excel, then that's another
good alternative which would also allow users to play with your results,
graph them etc. But it's going to be harder work for you than writing
html, and will mean you can't send your results to a third party who
doesn't have Excel. I wouldn't recommend it as a general solution, but
it might be perfect for your specific needs.

A GUI sounds like overkill, just to get a couple of colour and font changes.

Catherine.
--
Catherine Rees Lay

Polyhedron Software Ltd. Registered Office: Linden House,
93 High St, Standlake, Witney, OX29 7RH, United Kingdom.
Registered in England No.2541693. Vat Reg No. GB 537 3214 57

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc