subst fixes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@255 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 1999-10-26 23:33:30 +00:00
parent 2f65de9f7d
commit 0bdf849ecd
10 changed files with 62 additions and 38 deletions

View File

@ -1,3 +1,36 @@
1999-10-27 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/filetools.C (CleanupPath): subst fix
* src/insets/insetbib.C (delDatabase): subst fix, this looks
_really_ weird.
* src/support/filetools.C (PutEnvPath): subst fix, how come nobody
complained about this one?
* src/insets/insetinclude.C (Latex): subst fix
* src/insets/insetbib.C (getKeys): subst fix
* src/LyXSendto.C (SendtoApplyCB): subst fix
* src/lyx_main.C (init): subst fix
* src/layout.C (Read): subst fix
* src/lyx_sendfax_main.C (button_send): subst fix
* src/buffer.C (RoffAsciiTable): subst fix
* src/lyx_cb.C (MenuFax): subst fix
(PrintApplyCB): subst fix
1999-10-26 Lars Gullik Bjønnes <larsbj@lyx.org>
* development/lyx.spec.in (%build): add CFLAGS also.
* src/screen.C (drawFrame): removed another warning.
1999-10-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* renamed WHATSNEW to NEWS (usual GNU style), CHANGES to
@ -9,12 +42,6 @@
unbreakable if we are in freespacing mode (LyX-Code), but not in
latex mode.
1999-10-26 Lars Gullik Bjønnes <larsbj@lyx.org>
* development/lyx.spec.in (%build): add CFLAGS also.
* src/screen.C (drawFrame): removed another warning.
1999-10-25 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/BackStack.h: fixed initialization order in constructor

View File

@ -82,7 +82,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
ftypeext, true));
if (!contains(command, "$$FName"))
command = "( " + command + " ) <$$FName";
subst(command, "$$FName",fname);
command = subst(command, "$$FName",fname);
command += " &"; // execute in background
// push directorypath, if necessary
string path = OnlyPath(buffer->getFileName());

View File

@ -3539,7 +3539,7 @@ void Buffer::RoffAsciiTable(FILE *file, LyXParagraph *par)
par->table->RoffEndOfCell(fp, cell);
fclose(fp);
string cmd = lyxrc->ascii_roff_command + " >" + fname2;
subst(cmd, "$$FName",fname1);
cmd = subst(cmd, "$$FName", fname1);
Systemcalls one(Systemcalls::System, cmd);
if (!(lyxerr.debugging(Debug::ROFF))) {
remove(fname1.c_str());

View File

@ -408,8 +408,10 @@ string InsetBibtex::getKeys()
// At end of each line check if line begins with '@'
if ( c == '\n') {
if (prefixIs(linebuf, "@") ) {
subst(linebuf, '{','(');
linebuf=split(linebuf, tmp,'(');
linebuf = subst(linebuf,
'{', '(');
linebuf = split(linebuf,
tmp, '(');
tmp = lowercase(tmp);
if (!prefixIs(tmp, "@string") && !prefixIs(tmp, "@preamble") ) {
linebuf = split(linebuf, tmp,',');
@ -470,9 +472,10 @@ bool InsetBibtex::delDatabase(string const &db)
string bd = db;
int n = tokenPos(contents, ',', bd);
if (n > 0) {
// Weird code, would someone care to explain this?(Lgb)
string tmp(",");
tmp += bd;
subst(contents, tmp.c_str(), ",");
contents = subst(contents, tmp.c_str(), ",");
} else if (n==0)
contents = split(contents, bd, ',');
else

View File

@ -352,9 +352,9 @@ int InsetInclude::Latex(string &file, signed char /*fragile*/)
writefile = ChangeExtension(getFileName(), ".tex", false);
if (!master->tmppath.empty()
&& !master->niceFile) {
subst(incfile, '/','@');
incfile = subst(incfile, '/','@');
#ifdef __EMX__
subst(incfile, ':', '$');
incfile = subst(incfile, ':', '$');
#endif
writefile = AddName(master->tmppath, incfile);
} else

View File

@ -523,8 +523,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXLayoutList * list)
case LT_LABELSEP: /* label separator */
if (lexrc.next()) {
labelsep = lexrc.GetString();
subst(labelsep, 'x', ' ');
labelsep = subst(lexrc.GetString(), 'x', ' ');
}
break;
@ -882,10 +881,9 @@ int LyXTextClass::Read (string const &filename, LyXLayoutList *list)
case LT_STYLE:
if (lexrc.next()) {
string name = lexrc.GetString();
bool is_new = false;
subst(name, '_',' ');
string name = subst(lexrc.GetString(), '_', ' ');
tmpl = l->GetLayout(name);
if (!tmpl) {
is_new = true;

View File

@ -757,8 +757,7 @@ void MenuFax(Buffer *buffer)
}
Path p(path);
if (!lyxrc->fax_program.empty()) {
string help2 = lyxrc->fax_program;
subst(help2, "$$FName",ps);
string help2 = subst(lyxrc->fax_program, "$$FName", ps);
help2 += " &";
Systemcalls one(Systemcalls::System, help2);
} else
@ -3286,11 +3285,9 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long)
// Changes by Stephan Witt (stephan.witt@beusen.de), 19-Jan-99
// User may give a page (range) list
// User may print multiple (unsorted) copies
string pages = fl_get_input(fd_form_print->input_pages);
subst(pages, ';',',');
subst(pages, '+',',');
pages = strip (pages) ;
pages = frontStrip (pages) ;
string pages = subst(fl_get_input(fd_form_print->input_pages), ';',',');
pages = subst(pages, '+',',');
pages = frontStrip(strip(pages)) ;
while (!pages.empty()) { // a page range was given
string piece ;
pages = split (pages, piece, ',') ;

View File

@ -158,8 +158,8 @@ void LyX::init(int */*argc*/, char **argv)
// Determine path of binary
//
string fullbinpath, binpath = argv[0];
subst(binpath, '\\', '/');
string fullbinpath;
string binpath = subst(argv[0], '\\', '/');
string binname = OnlyFilename(argv[0]);
// Sorry for system specific code. (SMiyata)
if (suffixIs(binname, ".exe")) binname.erase(binname.length()-4, string::npos);

View File

@ -115,12 +115,12 @@ bool button_send(string const &fname, string const &sendcmd)
cmd = sendcmd + " >";
cmd += logfile + " 2>";
cmd += logfile;
subst(cmd, "$$Host",host);
subst(cmd, "$$Comment",comment);
subst(cmd, "$$Enterprise",enterprise);
subst(cmd, "$$Name",name);
subst(cmd, "$$Phone",phone);
subst(cmd, "$$FName",fname);
cmd = subst(cmd, "$$Host", host);
cmd = subst(cmd, "$$Comment", comment);
cmd = subst(cmd, "$$Enterprise", enterprise);
cmd = subst(cmd, "$$Name", name);
cmd = subst(cmd, "$$Phone", phone);
cmd = subst(cmd, "$$FName", fname);
lyxerr << "CMD: " << cmd << endl;
Systemcalls one(Systemcalls::System, cmd);
show_logfile(logfile,false);

View File

@ -79,7 +79,7 @@ string SpaceLess(string const & file)
string temp = AddName(path, name);
// Replace spaces with underscores, also in directory
// No!!! I checked it that it is not necessary.
// temp.subst(' ','_');
// temp = subst(temp, ' ', '_');
return temp;
}
@ -331,8 +331,8 @@ bool PutEnvPath(string const & envstr)
string pathlist = envstr;
#warning Verify that this is correct.
#ifdef __EMX__
pathlist.subst(':', ';');
pathlist.subst('/', '\\');
pathlist = subst(pathlist, ':', ';');
pathlist = subst(pathlist, '/', '\\');
#endif
return PutEnv(pathlist);
}
@ -690,9 +690,8 @@ string NormalizePath(string const & path)
string CleanupPath(string const & path)
{
#ifdef __EMX__ /* SMiyata: This should fix searchpath bug. */
string temppath(path);
subst(tmppath, '\\', '/');
subst(tmppath, "//", "/");
string temppath = subst(path, '\\', '/');
temppath = subst(temppath, "//", "/");
return lowercase(temppath);
#else // On unix, nothing to do
return path;