Build with CMake

Signed-off-by: Masanori Ogino <mogino@acm.org>
This commit is contained in:
Masanori Ogino 2023-11-27 11:46:25 +09:00
commit 1ac4c38aee
5 changed files with 205 additions and 0 deletions

136
CMakeLists.txt Normal file
View file

@ -0,0 +1,136 @@
cmake_minimum_required(VERSION 3.5)
project(sj3
VERSION 2.0.99
LANGUAGES C
)
add_library(sj3lib
sj3lib/level1.c
sj3lib/sj.c
sj3lib/string.c
)
target_include_directories(sj3lib
PRIVATE include
)
add_library(sj3rkcv
sj3rkcv/rk_conv.c
sj3rkcv/sj3_rkcv.c
sj3rkcv/wc16_str.c
)
target_include_directories(sj3rkcv
PRIVATE include sj3h
)
add_library(kanakan
kanakan/adddic.c
kanakan/addelcmn.c
kanakan/alloc.c
kanakan/charsize.c
kanakan/chrtbl.c
kanakan/cl2knj.c
kanakan/clstudy.c
kanakan/cmpstr.c
kanakan/conjunc.c
kanakan/connect.c
kanakan/cvtclknj.c
kanakan/cvtdict.c
kanakan/cvtkanji.c
kanakan/deldic.c
kanakan/depend.c
kanakan/dict.c
kanakan/functbl.c
kanakan/fuzoku.c
kanakan/fzkyomi.c
kanakan/getkanji.c
kanakan/getrank.c
kanakan/global.c
kanakan/hzstrlen.c
kanakan/init.c
kanakan/istrcmp.c
kanakan/memcpy.c
kanakan/memory.c
kanakan/memset.c
kanakan/mk2claus.c
kanakan/mkbunset.c
kanakan/mkjiritu.c
kanakan/mkkouho.c
kanakan/mknumber.c
kanakan/mvmemd.c
kanakan/mvmemi.c
kanakan/peepdic.c
kanakan/ph2knj.c
kanakan/ph_khtbl.c
kanakan/priority.c
kanakan/prtytbl.c
kanakan/s2ctbl.c
kanakan/selclrec.c
kanakan/selsuuji.c
kanakan/setconj.c
kanakan/setjrec.c
kanakan/setkouho.c
kanakan/setubi.c
kanakan/sj2code.c
kanakan/skiphblk.c
kanakan/skipkstr.c
kanakan/srchdict.c
kanakan/srchhead.c
kanakan/srchidx.c
kanakan/srchnum.c
kanakan/sstrcmp.c
kanakan/sstrlen.c
kanakan/sstrncmp.c
kanakan/stbtbl.c
kanakan/stttbl.c
kanakan/study.c
kanakan/suujitbl.c
kanakan/terminat.c
kanakan/termtbl.c
kanakan/wakachi.c
)
target_include_directories(kanakan
PRIVATE include
)
add_executable(sj3stat
sj3stat/sj3stat.c
)
target_include_directories(sj3stat
PRIVATE include sj3lib
)
target_link_libraries(sj3stat
sj3lib
)
add_executable(sj3serv
server/comuni.c
server/error.c
server/execute.c
server/main.c
server/setup.c
server/time_stamp.c
server/version.c
)
target_include_directories(sj3serv
PRIVATE include sj3lib
)
target_link_libraries(sj3serv
sj3lib kanakan
)
add_executable(sj3dic
sj3dic/codecnv.c
sj3dic/dictdisp.c
sj3dic/dictmake.c
sj3dic/hinsi.c
sj3dic/sj3dic.c
sj3dic/sj3err.c
sj3dic/sjrc.c
)
target_include_directories(sj3dic
PRIVATE include sj3lib
)
target_link_libraries(sj3dic
sj3lib
)

65
include/Paths.h Normal file
View file

@ -0,0 +1,65 @@
/*
* Copyright (c) 1997 Sony Corporation
* Copyright (c) 1996 Hidekazu Kuroki <hidekazu at cs.titech.ac.jp>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of Sony Corporation
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* from Sony Corporation.
*
*/
/*
* $SonyRCSfile: Paths.h.in,v $
* $SonyRevision: 1.1 $
* $SonyDate: 1997/01/23 11:20:55 $
*/
/*
* Change ErrotOutFile variable.
* Because suppress a error when sj3serv start up, change to "/dev/stderr".
* This error is "Cannot Open "/dev/console".".
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/10
*
* Change ErrotOutFile variable.
* This default value is "/dev/null" in document.
* Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/11
*/
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
#define ErrorOutFile "/dev/console"
#else
/* #define ErrorOutFile "/dev/stderr" */ /* for test */
#define ErrorOutFile "/dev/null"
#endif
#define SocketName "/tmp/sj3sock"
#define LockFile "/tmp/SJ3SERV.EXIST"
#define MainDictionary "sj3main.dic"
#define UserDictionary "private.dic"
#define StudyFile "study.dat"
#define RunCmdFile "/usr/local/lib/sj3/serverrc"
#define DictRootDir "/usr/local/lib/sj3/dict"
#define DEFRKFILE "/usr/local/lib/sj3/sjrk"
#define DEFRCFILE "/usr/local/lib/sj3/sjrc"
#define DEFKEYFILE "/usr/local/lib/sj3/cvtkey."

View file

@ -40,6 +40,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h> #include <stdio.h>
#include <sys/select.h>
#include "sj_const.h" #include "sj_const.h"
#include "sj_dict.h" #include "sj_dict.h"
#include "sj_struct.h" #include "sj_struct.h"

View file

@ -50,7 +50,9 @@ u_char *put_ndata(u_char *p, int n);
void get_buf(void); void get_buf(void);
int get_byte(void); int get_byte(void);
int get_word(void); int get_word(void);
#ifndef NO_GET_INT
int get_int(void); int get_int(void);
#endif
int get_nstring(u_char *p, int n); int get_nstring(u_char *p, int n);
u_char *get_ndata(u_char *p, int n); u_char *get_ndata(u_char *p, int n);

View file

@ -58,6 +58,7 @@
#include "Struct.h" #include "Struct.h"
#include "sj_global.h" #include "sj_global.h"
#include "kanakan.h" #include "kanakan.h"
#define NO_GET_INT
#include "server.h" #include "server.h"
typedef struct strlist { typedef struct strlist {