Better ANSI C compatibility and portability - part 1:
authorcarl <cecodere@yahoo.ca>
Mon, 18 Feb 2019 16:33:54 +0000 (00:33 +0800)
committercarl <cecodere@yahoo.ca>
Mon, 18 Feb 2019 16:54:23 +0000 (00:54 +0800)
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h (TMPDIR is no longer hard coded)

13 files changed:
modules/src/em_mes/CMakeLists.txt [new file with mode: 0644]
modules/src/em_mes/C_ms_com.c
modules/src/em_mes/C_ms_ego.c
modules/src/em_mes/C_ms_emx.c
modules/src/em_mes/C_ms_err.c
modules/src/em_mes/C_ms_flt.c
modules/src/em_mes/C_ms_gto.c
modules/src/em_mes/C_ms_opt.c
modules/src/em_mes/C_ms_par.c
modules/src/em_mes/C_ms_reg.c
modules/src/em_mes/C_ms_src.c
modules/src/em_mes/C_ms_stb.c
modules/src/em_mes/C_ms_std.c

diff --git a/modules/src/em_mes/CMakeLists.txt b/modules/src/em_mes/CMakeLists.txt
new file mode 100644 (file)
index 0000000..075cf93
--- /dev/null
@@ -0,0 +1,37 @@
+cmake_minimum_required (VERSION 3.0)
+project(em_mes)
+
+
+set(SRC_C
+ C_ms_com.c
+ C_ms_ego.c
+ C_ms_emx.c
+ C_ms_err.c
+ C_ms_flt.c
+ C_ms_gto.c
+ C_ms_opt.c
+ C_ms_par.c
+ C_ms_reg.c
+ C_ms_src.c
+ C_ms_stb.c
+ C_ms_std.c
+)
+
+set(INCLUDE_DIRS
+ .
+)
+
+
+add_library(${PROJECT_NAME} ${SRC_C})
+target_compile_definitions(${PROJECT_NAME} PUBLIC NORCSID=1)
+target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS})
+
+target_link_libraries(${PROJECT_NAME} emheaders emh emk em_data)
+
+install(TARGETS ${PROJECT_NAME} 
+        RUNTIME DESTINATION bin
+        LIBRARY DESTINATION lib
+        ARCHIVE DESTINATION lib
+        PUBLIC_HEADER DESTINATION include
+)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/em_mes.3 DESTINATION man OPTIONAL)
index b6d2210..328ba3f 100644 (file)
@@ -6,12 +6,10 @@
  
 #include <stdlib.h>
 #include <string.h>
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_com(str)
-       char *str;
+void C_ms_com(char* str)
 {
        C_mes_begin(ms_com);
        C_scon(str, (arith) (strlen(str) + 1));
index 1c9c5f7..0dcb273 100644 (file)
@@ -3,13 +3,10 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_ego(hint, offs, siz, regno)
-       int hint, regno;
-       arith offs, siz;
+void C_ms_ego(int hint, arith offs, arith siz, int regno)
 {
        C_mes_begin(ms_ego);
        C_cst((arith)hint);
index e95dadd..e4c908f 100644 (file)
@@ -3,12 +3,10 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_emx(wsiz, psiz)
-       arith wsiz, psiz;
+void C_ms_emx(arith wsiz, arith psiz)
 {
        C_mes_begin(ms_emx);
        C_cst(wsiz);
index df48801..f6dfa82 100644 (file)
@@ -3,11 +3,10 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_err()
+void C_ms_err(void)
 {
        C_mes_begin(ms_err);
        C_mes_end();
index 557cbbb..1f092ed 100644 (file)
@@ -3,11 +3,10 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_flt()
+void C_ms_flt(void)
 {
        C_mes_begin(ms_flt);
        C_mes_end();
index 29bbd1e..c6ba4c1 100644 (file)
@@ -3,11 +3,10 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_gto()
+void C_ms_gto(void)
 {
        C_mes_begin(ms_gto);
        C_mes_end();
index 386d268..a80e9c8 100644 (file)
@@ -3,11 +3,10 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_opt()
+void C_ms_opt(void)
 {
        C_mes_begin(ms_opt);
        C_mes_end();
index 7d7c39f..adb7c2f 100644 (file)
@@ -3,12 +3,10 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_par(nparams)
-       arith nparams;
+void C_ms_par(arith nparams)
 {
        C_mes_begin(ms_par);
        C_cst(nparams);
index c63063c..7b19343 100644 (file)
@@ -3,13 +3,10 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_reg(offs, siz, class, prior)
-       arith offs, siz;
-       int class, prior;
+void C_ms_reg(arith offs, arith siz, int class, int prior)
 {
        C_mes_begin(ms_reg);
        C_cst(offs);
index 5831681..d4556f6 100644 (file)
@@ -6,13 +6,10 @@
  
 #include <stdlib.h>
 #include <string.h>
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_src(nlines, filnam)
-       int nlines;
-       char *filnam;
+void C_ms_src(int nlines, char* filnam)
 {
        C_mes_begin(ms_src);
        C_cst((arith)nlines);
index 430dea3..600b747 100644 (file)
@@ -6,14 +6,10 @@
  
 #include <stdlib.h>
 #include <string.h>
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_stb_cst(s, e1, e2, e3)
-       char    *s;
-       int     e1, e2;
-       arith   e3;
+void C_ms_stb_cst(char* s, int e1, int e2, arith e3)
 {
        C_mes_begin(ms_stb);
        if (s) C_scon(s, (arith) (strlen(s)+1));
index 0399fa8..afc8151 100644 (file)
@@ -6,14 +6,10 @@
  
 #include <stdlib.h>
 #include <string.h>
-#include <em.h>
-#include <em_mes.h>
+#include "em.h"
+#include "em_mes.h"
 
-void
-C_ms_std(s, e1, l)
-       char *s;
-       int e1;
-       int l;
+void C_ms_std(char* s, int e1, int l)
 {
        C_mes_begin(ms_std);
        if (s) C_scon(s, (arith) (strlen(s)+1));