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> 1999-10-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* renamed WHATSNEW to NEWS (usual GNU style), CHANGES to * 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 unbreakable if we are in freespacing mode (LyX-Code), but not in
latex mode. 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> 1999-10-25 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/BackStack.h: fixed initialization order in constructor * src/BackStack.h: fixed initialization order in constructor

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -158,8 +158,8 @@ void LyX::init(int */*argc*/, char **argv)
// Determine path of binary // Determine path of binary
// //
string fullbinpath, binpath = argv[0]; string fullbinpath;
subst(binpath, '\\', '/'); string binpath = subst(argv[0], '\\', '/');
string binname = OnlyFilename(argv[0]); string binname = OnlyFilename(argv[0]);
// Sorry for system specific code. (SMiyata) // Sorry for system specific code. (SMiyata)
if (suffixIs(binname, ".exe")) binname.erase(binname.length()-4, string::npos); 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 = sendcmd + " >";
cmd += logfile + " 2>"; cmd += logfile + " 2>";
cmd += logfile; cmd += logfile;
subst(cmd, "$$Host",host); cmd = subst(cmd, "$$Host", host);
subst(cmd, "$$Comment",comment); cmd = subst(cmd, "$$Comment", comment);
subst(cmd, "$$Enterprise",enterprise); cmd = subst(cmd, "$$Enterprise", enterprise);
subst(cmd, "$$Name",name); cmd = subst(cmd, "$$Name", name);
subst(cmd, "$$Phone",phone); cmd = subst(cmd, "$$Phone", phone);
subst(cmd, "$$FName",fname); cmd = subst(cmd, "$$FName", fname);
lyxerr << "CMD: " << cmd << endl; lyxerr << "CMD: " << cmd << endl;
Systemcalls one(Systemcalls::System, cmd); Systemcalls one(Systemcalls::System, cmd);
show_logfile(logfile,false); show_logfile(logfile,false);

View File

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