bug-oleo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Different file formats


From: Pete Wyckoff
Subject: Re: Different file formats
Date: Thu, 10 May 2001 09:28:10 -0400
User-agent: Mutt/1.3.16i-nntp2

address@hidden said:
> I've been trying to load and save different file formats, but with no
> success.  In the process, I think I may have found an error in the code in
> the io-utils.c file.  But first let me detail what I think I know so far.
> 
> 1.  The first question is of course: what are the possible formats?  In
> io-utils.c at the entry  file_formats[] , there is the following list: oleo,
> sylk, sc, list, csv, dbf, panic, and sylk-noa0.

I see, in io-term.c near the strcmp "file ":  oleo, sylk,
sylk-noa0, sc, panic, list.

> 2.  It seems that oleo determines the format to use to load a file by the
> extension (if there is one) on the file, otherwise it is loaded using some
> default format.  I say this based on the following: I created a test file,
> saved it with no extension, and was able to reload it OK.  I then renamed
> it with a  .ol  extension, and when I reloaded it the original contents
> were not displayed.  I then renamed it with a  .oleo  extension, and when I
> reloaded it, the original contents were displayed.

There is the "-F" option on the command line:  "-F oleo", or the
set-option in your personal init file, or the figured-out-name
from the file on the command line.  The last source of this
information (in the list) wins.  If none of those supply it, the
default is oleo.

The figured-out-name is a function of the extension, defined as
the bit beyond the last "." in the name, like you noticed.  The
mapping from extension to type is in read_file_generic_2 in
io-utils.c:

    oleo -> oleo
    sylk, slk, sylk-noa0 -> sylk
    sc -> sc
    panic -> panic
    list, csv -> list
    dbf -> xbase

(I don't know how well the xbase is supported, given you can't
set-option xbase.  Also not sure how much use panic gets; it just
dumps the entire data section of the executing oleo process.)

> 3.  Next: setting and changing file formats.  (This is where I'm lost.)
> Viewing the options by doing  ^h o  shows the following entry:  File
> format: oleo.  So apparently one should be able to change this, presumably
> by doing M-x set-option, then entering the name of the option to set, and
> then entering the value to set it to, e.g., csv.  
> 
> So here's the question:  what is the name of the option to set?  I tried a
> number of different possibilities (like file-format, file_format,
> etc. etc.) with no luck.

M-x set-option file oleo

This is in the documentation under Other Options
(doc/options.texi), but rather poorly described.  I have a
feeling that the USE_DLD bit is no longer there.

> 4.  In trying to figure out the name of the option, I went hunting through
> io-utils.c and found what I think may be an error in the code.  Throughout
> the file there are entries spelled  stricmp  which, I'm guessing, does a
> string comparison.  But in one place, and one place only, in the entire
> file, there is an entry spelled  strcmp  and it occurs at the entry
> file_get_pattern .  Now if file_get_pattern is supposed to figure out the
> file format and strcmp isn't doing what its should be doing, wouldn't this
> mess up the use of non-default file formats?

Agreed.  I changed it to stricmp.  It was only called by the file
format callback widget in the Motif interface.  And things would
have worked if users restricted themselves to lower case, but to
be consistent with the rest of the usages of file formats,
case-ignored it is.

> I hope all this is useful, if not by way to fixing some code, then perhaps
> by way of helping with some documentation.

Always!  If you would like to do the documentation on any of
this, that would be a great help.  Type it into the appropriate
.texi file in doc/, then send a patch.

                -- Pete



reply via email to

[Prev in Thread] Current Thread [Next in Thread]