>On Tue, 5 Oct 1999 10:06:26 +0200 (METDST), Asger K. Alstrup Nielsen
>wrote:
>
>>Notice that TTH is a C-inlined-in-Lex application, so you need Flex
OK, for the release I 'solved' it with a tth.cmd script, which simply
writes a notice to install a converter, so that the user has the
choice. No errors are generated. The created foo.html contains this
notice (and no html code).
Apart from that I applied my last patch sent to the list (after very
small modifications).
I'll include the following small diff in the bin dist, unless it
becomes available from lyx.org (put it into development/OS2 or just
apply it?). Maybe Shigeru can have a short look if he sees any
particular problems. If inline rendering in figinset.C sometime will
employ an external toolkit, we get completely rid of fork() for OS/2,
so that the only remaining (theoretical?) source for problems
disappears completely. I may later create a version for the new branch
(with better comments). Note that it should compile on unix without
problems, too.
Greets,
Arnd
PS: Just in case somebody doesn't know: Even with the restrictions of
the old kernel engine LyX is simply outstanding, real fun and well
deserves the energy put into it!
______snip_____
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/FileInfo.C
lyx-1.0.x/src/FileInfo.C
--- lyx-1.0.4/src/FileInfo.C Tue Feb 16 04:54:00 1999
+++ lyx-1.0.x/src/FileInfo.C Tue Oct 5 16:43:08 1999
@@ -341,7 +341,11 @@ bool FileInfo::isOK() const
bool FileInfo::isLink() const
{
+#ifdef S_ISLNK
return S_ISLNK(buf->st_mode);
+#else
+ return false;
+#endif
}
@@ -365,7 +369,11 @@ bool FileInfo::isChar() const
bool FileInfo::isBlock() const
{
+#ifdef S_ISBLK
return S_ISBLK(buf->st_mode);
+#else
+ return false;
+#endif
}
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/filetools.C
lyx-1.0.x/src/filetools.C
--- lyx-1.0.4/src/filetools.C Tue Aug 31 04:45:08 1999
+++ lyx-1.0.x/src/filetools.C Tue Oct 5 14:10:12 1999
@@ -79,11 +79,17 @@ LString SpaceLess(LString const & file)
LString name = OnlyFilename(file);
LString path = OnlyPath(file);
- for (int i=0; i<name.length(); i++) {
- name[i] &= 0x7f;
- if (!isalnum(name[i]) && name[i] != '.')
+ for (int i = 0; i < name.length(); i++) {
+
+ // cut off bits>7, because some ctype.h implementations of
'isalnum'
+ // are broken with certain non-7-bit characters! (AHanses)
+ name[i] &= 0x7f;
+ if (!isalnum(name[i]) && name[i] != '.' && name[i] !=
'-'
+ && name[i] != '+' && name[i] != '=' && name[i] !=
'_')
+
name[i] = '_';
}
+
LString temp = AddName(path, name);
// Replace spaces with underscores, also in directory
// No!!! I checked it that it is not necessary.
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/html lyx-1.0.x/src/html
--- lyx-1.0.4/src/html Thu Jan 1 00:00:00 1970
+++ lyx-1.0.x/src/html Tue Oct 5 18:13:44 1999
@@ -0,0 +1 @@
+'install LaTeX- converter and modify .lyx/lyxrc in your home
directory!"
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/lyxfunc.C
lyx-1.0.x/src/lyxfunc.C
--- lyx-1.0.4/src/lyxfunc.C Tue Jun 15 04:54:22 1999
+++ lyx-1.0.x/src/lyxfunc.C Tue Oct 5 16:05:52 1999
@@ -58,6 +58,8 @@
#include "trans_mgr.h"
#include "ImportLaTeX.h"
#include "ImportNoweb.h"
+#include "syscall.h"
+#include "syscontr.h"
// $Id: lyxfunc.C,v 1.7 1998/10/13 22:40:55 asger Exp
$
@@ -734,6 +736,27 @@ LString LyXFunc::Dispatch(int ac,
else if (extyp == "custom") {
MenuSendto();
break;
+ }
+ // HTML
+ else if (extyp == "html") {
+ // First, create LaTeX file
+ MenuMakeLaTeX(owner->currentBuffer());
+
+ // And now, run tth
+ LString file =
owner->currentBuffer()->getFileName();
+ file = ChangeExtension(file, ".tex", false);
+ LString result = ChangeExtension(file,
".html", false);
+ LString tmp = lyxrc->tth_command + " < " +
file
+ + " > " + result ;
+ Systemcalls one;
+ int res = one.Startscript(Systemcalls::System,
tmp);
+ if (res == 0) {
+ setMessage(LString(
+ N_("Document exported as HTML to
file: ")) + result);
+ } else {
+ setErrorMessage(LString(
+ N_("An unexpected error occured
while converting document to HTML in file:")) + result);
+ }
}
else {
setErrorMessage(LString(N_("Unknown export
type: "))
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/lyxrc.C
lyx-1.0.x/src/lyxrc.C
--- lyx-1.0.4/src/lyxrc.C Thu Aug 19 02:41:08 1999
+++ lyx-1.0.x/src/lyxrc.C Tue Oct 5 17:59:10 1999
@@ -126,6 +126,7 @@ enum _LyXRCTags {
RC_EXIT_CONFIRMATION,
RC_DISPLAY_SHORTCUTS,
RC_RELYX_COMMAND,
+ RC_TTH_COMMAND,
RC_LAST
};
@@ -204,6 +205,7 @@ static keyword_item lyxrcTags[] = {
{ "\\spell_command", RC_SPELL_COMMAND },
{ "\\tempdir_path", RC_TEMPDIRPATH },
{ "\\template_path", RC_TEMPLATEPATH },
+ { "\\tth_command", RC_TTH_COMMAND },
{ "\\use_alt_language", RC_USE_ALT_LANG },
{ "\\use_escape_chars", RC_USE_ESC_CHARS },
{ "\\use_input_encoding", RC_USE_INP_ENC },
@@ -260,6 +262,7 @@ LyXRC::LyXRC()
default_papersize = PAPER_USLETTER;
custom_export_format = "ps";
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
+ tth_command = "tth -t";
fontenc = "default";
dpi = 75;
// Because a screen typically is wider than a piece of paper:
@@ -566,6 +569,11 @@ int LyXRC::Read(LString const &filename)
case RC_CHKTEX_COMMAND:
if (lexrc.next())
chktex_command = lexrc.GetString();
+ break;
+
+ case RC_TTH_COMMAND:
+ if (lexrc.next())
+ tth_command = lexrc.GetString();
break;
case RC_SCREEN_DPI:
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/lyxrc.h
lyx-1.0.x/src/lyxrc.h
--- lyx-1.0.4/src/lyxrc.h Thu Aug 19 02:41:08 1999
+++ lyx-1.0.x/src/lyxrc.h Tue Oct 5 16:05:52 1999
@@ -98,6 +98,8 @@ public:
LYX_PAPER_SIZE default_papersize;
/// command to run chktex incl. options
LString chktex_command;
+ /// command to run tth incl. options
+ LString tth_command;
///
LString sgml_extra_options;
///
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/menus.C
lyx-1.0.x/src/menus.C
--- lyx-1.0.4/src/menus.C Tue Aug 31 04:45:10 1999
+++ lyx-1.0.x/src/menus.C Tue Oct 5 16:05:52 1999
@@ -427,7 +427,8 @@ void Menus::ShowFileMenu(FL_OBJECT *ob,
"|as DVI...%x41"
"|as PostScript...%x42"
"|as Ascii Text...%x43"
- "|Custom...%x44"));
+ "|as HTML...%x44"
+ "|Custom...%x45"));
else if(LinuxDoc)
SubFileExport=fl_defpup(FL_ObjWin(ob),
_("Export%t"
@@ -447,7 +448,10 @@ void Menus::ShowFileMenu(FL_OBJECT *ob,
fl_setpup_shortcut(SubFileExport, 41, scex(_("FEX|Dd#d#D")));
fl_setpup_shortcut(SubFileExport, 42, scex(_("FEX|Pp#p#P")));
fl_setpup_shortcut(SubFileExport, 43, scex(_("FEX|Tt#t#T")));
- fl_setpup_shortcut(SubFileExport, 44, scex(_("FEX|mM#m#M")));
+ if (!LinuxDoc && !DocBook) {
+ fl_setpup_shortcut(SubFileExport, 44,
scex(_("FEX|Hh#h#H")));
+ fl_setpup_shortcut(SubFileExport, 45,
scex(_("FEX|mM#m#M")));
+ }
int FileMenu = fl_defpup(FL_ObjWin(ob),
_("New..."
@@ -596,7 +600,9 @@ void Menus::ShowFileMenu(FL_OBJECT *ob,
break;
case 43: tmpfunc->Dispatch(LFUN_EXPORT, "ascii");
break;
- case 44: tmpfunc->Dispatch(LFUN_EXPORT, "custom");
+ case 44: tmpfunc->Dispatch(LFUN_EXPORT, "html");
+ break;
+ case 45: tmpfunc->Dispatch(LFUN_EXPORT, "custom");
break;
case 17: tmpfunc->Dispatch(LFUN_QUIT); break;
// Lastfiles:
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/os2_defines.h
lyx-1.0.x/src/os2_defines.h
--- lyx-1.0.4/src/os2_defines.h Mon May 3 04:49:34 1999
+++ lyx-1.0.x/src/os2_defines.h Tue Oct 5 16:44:38 1999
@@ -20,8 +20,10 @@
/* #include <assert.h> */
/* #include <malloc.h> */
#define lstat stat
+/* should remain undefined (AHanses)
#define S_ISLNK(x) false
#define S_ISBLK(x) false
+*/
#define readlink(s,t,l) (strcpy(t,s),strlen(t))
/*#define mkfifo(p,m) (0) *//* LyXserver is temporary disabled. */
#define getcwd _getcwd2
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/paragraph.C
lyx-1.0.x/src/paragraph.C
--- lyx-1.0.4/src/paragraph.C Wed Sep 29 09:58:06 1999
+++ lyx-1.0.x/src/paragraph.C Tue Oct 5 16:16:58 1999
@@ -2605,12 +2605,12 @@ void LyXParagraph::SimpleDocBookOneTable
lyxerr.debug(LString("SimpleDocbookOneTablePar... ") +
(long)this, Error::LATEX);
int column, tmp;
- bool return_value = false;
+// bool return_value = false; /* unsed (AHanses) */
int current_cell_number = -1;
LyXFont font1,font2;
char c;
Inset *inset;
- int main_body, j;
+ int main_body /* , j unsed (AHanses) */;
LString emph="emphasis";
bool emph_flag=false;
int char_line_count=0;
@@ -2770,11 +2770,11 @@ void LyXParagraph::DocBookContTableRows(
lyxerr.debug(LString("DocBookContTableRows... ") +
(long)this, Error::LATEX);
- int tmp, cell, lastpos;
+ int /* tmp, (unused; AHanses */ cell, lastpos;
LyXFont font1,font2;
char c;
Inset *inset;
- int main_body, j;
+ int main_body /*. j,(unused; AHanses */ ;
LString emph="emphasis";
bool emph_flag=false;
int char_line_count=0;
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/syscall.C
lyx-1.0.x/src/syscall.C
--- lyx-1.0.4/src/syscall.C Tue Nov 10 09:44:48 1998
+++ lyx-1.0.x/src/syscall.C Tue Oct 5 17:09:48 1999
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <process.h>
#include "syscall.h"
#include "syscontr.h"
@@ -54,15 +55,17 @@ int Systemcalls::Startscript()
Callback();
break;
case Wait:
- pid = Fork();
+ pid = Fork(P_WAIT);
if (pid>0) { // Fork succesful. Wait for child
+#ifndef __EMX__
waitForChild();
+#endif
Callback();
} else
retval = 1;
break;
case DontWait:
- pid=Fork();
+ pid=Fork(P_NOWAIT);
if (pid>0) {
// Now integrate into Controller
SystemcallsSingletoncontroller::Startcontroller
starter;
@@ -81,9 +84,10 @@ int Systemcalls::Startscript()
// Wait for child process to finish. Returns returncode from child.
+#ifndef __EMX__
void Systemcalls::waitForChild()
{
- // We'll pretend that the child returns 1 on all
errorconditions.
+ // We'll pretend that the child returns -1 on all
errorconditions.
retval = 1;
int status;
bool wait = true;
@@ -111,14 +115,16 @@ void Systemcalls::waitForChild()
}
}
}
-
+#endif
// generate child in background
-pid_t Systemcalls::Fork()
+pid_t Systemcalls::Fork(int spawnFlag)
{
+#ifndef __EMX__
pid_t cpid=fork();
if (cpid == 0) { // child
+#endif
LString childcommand(command); // copy
LString rest = command.split(childcommand, ' ');
const int MAX_ARGV = 255;
@@ -138,14 +144,20 @@ pid_t Systemcalls::Fork()
} while (Abbruch);
argv[index] = NULL;
// replace by command. Expand using
PATH-environment-var.
+#ifndef __EMX__
execvp(syscmd, argv);
// If something goes wrong, we end up here:
perror("LyX: execvp failed");
- } else if (cpid < 0) { // error
+ } else {
+#else // spawn child in another process; fork() is not portable
+ pid_t cpid = spawnvp(spawnFlag, syscmd, argv);
+#endif
+ if (cpid < 0) // error
perror("LyX: Could not fork");
- } else { // parent
+#ifndef __EMX__
+ } else // parent
+#endif
return cpid;
- }
return 0;
}
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/syscall.h
lyx-1.0.x/src/syscall.h
--- lyx-1.0.4/src/syscall.h Mon Oct 26 15:19:36 1998
+++ lyx-1.0.x/src/syscall.h Tue Oct 5 17:03:34 1999
@@ -2,12 +2,29 @@
#include <sys/types.h>
#include <LString.h>
+/** AHanses: Eliminate unneeded parameter for Unix: 'fork(void)'
+ This can be safely commented out.
+ (Please note: This macro implementation is fully type-safe;
+ the code pre-processor sorts out which OS-specific function
+ interface will be used and passes it to the compiler. The
+ C++-parser of the compiler then sees strictly typed C++-methods)
+
+ #ifndef FORK_SPAWN
+ #define Fork(f) Fork()#endif
+ */
+
#ifdef __GNUG__
#pragma interface
#endif
-/*@Doc:
+/// Class to controll system-calls according to OS-specific interface
+/**@Doc:
+ Class, which controlls a system-call according to the specific
interface of
+ your operating system. Hides OS-dependant hacks by providing a common
+ interface for calling. Should become part of a LyX-tools support
library:
+ OS-dependant hacks should be completely opaque to the rest of LyX
(AHanses).
+
Instance starts and represents childprocesses.
You should use this class if you need to start an external program
in LyX.
You can start a child in the background and have a callback function
@@ -28,7 +45,7 @@ public:
///
Systemcalls();
- /** Geberate instance and start childprocess
+ /** Generate instance and start childprocess
The string "what" contains a commandline with arguments
separated
by spaces.
When the requested program finishes, the callback-function
is
@@ -71,9 +88,17 @@ private:
///
int Startscript();
- ///
- pid_t Fork();
+
+ /// Spawn child according to the interface of your OS
(AHanses)
+ pid_t Fork(int spawnFlag);
/// Wait for child process to finish. Updates returncode from
child.
+#ifndef __EMX__
+ /**
+ Waitforchild not necessary with spawnvp() of emx.
+ Note (concerning OS/2 specifics): Emx interface implementation
of
+ spawnvp(P_WAIT, ...) returns returncode from child (AHanses).
+ */
void waitForChild();
+#endif
};
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/tth.cmd
lyx-1.0.x/src/tth.cmd
--- lyx-1.0.4/src/tth.cmd Thu Jan 1 00:00:00 1970
+++ lyx-1.0.x/src/tth.cmd Tue Oct 5 18:13:54 1999
@@ -0,0 +1,3 @@
+@echo off
+
+echo "install LaTeX->html converter and modify .lyx/lyxrc in your home
directory!"
\ No newline at end of file
diff -p -N -r -u -X excl.tmp lyx-1.0.4/src/version.h
lyx-1.0.x/src/version.h
--- lyx-1.0.4/src/version.h Wed Sep 29 12:11:30 1999
+++ lyx-1.0.x/src/version.h Tue Oct 5 14:32:00 1999
@@ -1,3 +1,3 @@
/* Version and release date definition */
-#define LYX_VERSION "1.0.4"
+#define LYX_VERSION "'1.0.4.1 for OS/2'"
#define LYX_RELEASE "Wed, Sep 29, 1999"