Better ANSI C compatibility and portability - part 1:

+ 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)
This commit is contained in:
carl 2019-02-19 00:33:54 +08:00
parent a4650360a3
commit 7c7379c46f
13 changed files with 73 additions and 63 deletions

View file

@ -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)

View 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));

View 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);

View 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);

View 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();

View 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();

View 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();

View 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();

View 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);

View 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);

View 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);

View 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));

View 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));