Ok..

I'm managed to add LOGAPPEND command to open log file for append (not to
truncate it). Here are changes. The only english manual is updated. (net
french)
From f8ce650968df3599937f8187fca89fead20c967b Mon Sep 17 00:00:00 2001
From: slavko <sla...@emc2.(none)>
Date: Thu, 2 Dec 2010 10:47:01 +0100
Subject: [PATCH] Added command LOGAPPEND to append to log file

---
 docs/src/gcode/main.lyx            |   10 ++++++++++
 src/emc/nml_intf/canon.hh          |    1 +
 src/emc/rs274ngc/gcodemodule.cc    |    1 +
 src/emc/rs274ngc/interp_convert.cc |    6 ++++++
 src/emc/sai/saicanon.cc            |    2 ++
 src/emc/task/emccanon.cc           |    7 +++++++
 6 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/docs/src/gcode/main.lyx b/docs/src/gcode/main.lyx
index e01364d..d80c24d 100644
--- a/docs/src/gcode/main.lyx
+++ b/docs/src/gcode/main.lyx
@@ -9860,6 +9860,16 @@ Opens the named log file.
 \end_layout
 
 \begin_layout Subsection
+(LOGAPPEND,filename)
+\end_layout
+
+\begin_layout Standard
+Opens the named log file.
+ If the file already exists, the data is appended.
+\end_layout
+
+
+\begin_layout Subsection
 (LOGCLOSE)
 \end_layout
 
diff --git a/src/emc/nml_intf/canon.hh b/src/emc/nml_intf/canon.hh
index 2ef95b1..a162735 100644
--- a/src/emc/nml_intf/canon.hh
+++ b/src/emc/nml_intf/canon.hh
@@ -597,6 +597,7 @@ extern void MESSAGE(char *s);
 
 extern void LOG(char *s);
 extern void LOGOPEN(char *s);
+extern void LOGAPPEND(char *s);
 extern void LOGCLOSE();
 
 extern void MIST_OFF();
diff --git a/src/emc/rs274ngc/gcodemodule.cc b/src/emc/rs274ngc/gcodemodule.cc
index 025ea6f..1628b29 100644
--- a/src/emc/rs274ngc/gcodemodule.cc
+++ b/src/emc/rs274ngc/gcodemodule.cc
@@ -352,6 +352,7 @@ void MESSAGE(char *comment) {
 
 void LOG(char *s) {}
 void LOGOPEN(char *f) {}
+void LOGAPPEND(char *f) {}
 void LOGCLOSE() {}
 
 void COMMENT(const char *comment) {
diff --git a/src/emc/rs274ngc/interp_convert.cc b/src/emc/rs274ngc/interp_convert.cc
index 25ca17f..12c2c6d 100644
--- a/src/emc/rs274ngc/interp_convert.cc
+++ b/src/emc/rs274ngc/interp_convert.cc
@@ -1356,6 +1356,7 @@ int Interp::convert_comment(char *comment)       //!< string with comment
   char PRINT_STR[] = "print,";
   char LOG_STR[] = "log,";
   char LOGOPEN_STR[] = "logopen,";
+  char LOGAPPEND_STR[] = "logappend,";
   char LOGCLOSE_STR[] = "logclose";
   int m, n, start;
 
@@ -1402,6 +1403,11 @@ int Interp::convert_comment(char *comment)       //!< string with comment
       LOGOPEN(comment + start + strlen(LOGOPEN_STR));
       return INTERP_OK;
   }
+  else if (startswith(lc, LOGAPPEND_STR))
+  {
+      LOGAPPEND(comment + start + strlen(LOGAPPEND_STR));
+      return INTERP_OK;
+  }
   else if (streq(lc, LOGCLOSE_STR))
   {
       LOGCLOSE();
diff --git a/src/emc/sai/saicanon.cc b/src/emc/sai/saicanon.cc
index 4887850..96977ab 100644
--- a/src/emc/sai/saicanon.cc
+++ b/src/emc/sai/saicanon.cc
@@ -696,6 +696,8 @@ void LOG(char *s)
 {PRINT1("LOG(\"%s\")\n", s);}
 void LOGOPEN(char *s)
 {PRINT1("LOGOPEN(\"%s\")\n", s);}
+void LOGAPPEND(char *s)
+{PRINT1("LOGAPPEND(\"%s\")\n", s);}
 void LOGCLOSE()
 {PRINT0("LOGCLOSE()\n");}
 
diff --git a/src/emc/task/emccanon.cc b/src/emc/task/emccanon.cc
index 6538911..1384511 100644
--- a/src/emc/task/emccanon.cc
+++ b/src/emc/task/emccanon.cc
@@ -2122,6 +2122,13 @@ void LOGOPEN(char *name) {
     fprintf(stderr, "LOGOPEN(%s) -> %p\n", name, logfile);
 }
 
+void LOGAPPEND(char *name) {
+    if(logfile) fclose(logfile);
+    logfile = fopen(name, "at");
+    fprintf(stderr, "LOGAPPEND(%s) -> %p\n", name, logfile);
+}
+
+
 void LOGCLOSE() {
     if(logfile) fclose(logfile);
     logfile = NULL;
-- 
1.5.4.3

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to