Skip to content

Commit b8d40d8

Browse files
author
tina227
committed
リファクタリングによる修正
1 parent 2e938e3 commit b8d40d8

17 files changed

Lines changed: 3356 additions & 1819 deletions

File tree

bin/Makefile.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
7979
PROGRAMS = $(bin_PROGRAMS)
8080
am_cobcrun_OBJECTS = cobcrun-cobcrun.$(OBJEXT)
8181
cobcrun_OBJECTS = $(am_cobcrun_OBJECTS)
82-
cobcrun_DEPENDENCIES = $(top_builddir)/libcob/libcob.la
82+
cobcrun_DEPENDENCIES = $(top_builddir)/libcob/libcob.la \
83+
$(top_builddir)/lib/libsupport.a
8384
binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
8485
SCRIPTS = $(bin_SCRIPTS)
8586
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
@@ -236,7 +237,7 @@ bin_SCRIPTS = cob-config
236237
cobcrun_SOURCES = cobcrun.c
237238
AM_LDFLAGS = $(COB_EXPORT_DYN)
238239
cobcrun_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)
239-
cobcrun_LDADD = $(top_builddir)/libcob/libcob.la
240+
cobcrun_LDADD = $(top_builddir)/libcob/libcob.la $(top_builddir)/lib/libsupport.a
240241
all: all-am
241242

242243
.SUFFIXES:

cobc/cobc.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -406,25 +406,25 @@ cb_text_list_add (struct cb_text_list *list, const char *text)
406406
#ifdef _WIN32
407407
#define strndup(x,y) _strndup(x,y)
408408
char *
409-
_strndup(char *src, int size)
409+
_strndup (char *src, int size)
410410
{
411411
char *dup;
412412
int srclen;
413413

414414
if (src == NULL) {
415415
return NULL;
416416
}
417-
srclen = strlen(src);
417+
srclen = strlen (src);
418418
if (size > srclen) {
419419
size = srclen;
420420
}
421-
dup = malloc(size + 1);
421+
dup = malloc (size + 1);
422422
if (dup == NULL) {
423423
return NULL;
424424
}
425425

426-
memset(dup, 0, size + 1);
427-
memcpy(dup, src, size);
426+
memset (dup, 0, size + 1);
427+
memcpy (dup, src, size);
428428
return dup;
429429
}
430430
#endif
@@ -817,7 +817,7 @@ cobc_sig_handler (int sig)
817817
static void
818818
cobc_print_version (void)
819819
{
820-
puts ("opensource COBOL 1.3.2J");
820+
puts ("opensource COBOL 1.4J");
821821
puts ("OSS Consortium's patched version of OpenCOBOL1.1(Feb.06 2009)");
822822
#ifdef I18N_UTF8
823823
puts ("[unicode/utf-8 support]");
@@ -2267,13 +2267,13 @@ main (int argc, char *argv[])
22672267
putenv (p);
22682268
} else {
22692269
#ifdef _WIN32
2270-
char *tmpdir = cobc_malloc(COB_SMALL_BUFF * sizeof(char));
2271-
if ((GetTempPathA(COB_SMALL_BUFF, tmpdir)) == 0) {
2272-
strcpy(tmpdir, "c:\\oscobol\\tmp");
2270+
char *tmpdir = cobc_malloc (COB_SMALL_BUFF * sizeof(char));
2271+
if ((GetTempPathA (COB_SMALL_BUFF, tmpdir)) == 0) {
2272+
strcpy (tmpdir, "c:\\oscobol\\tmp");
22732273
}
22742274
cob_tmpdir = tmpdir;
2275-
sprintf(buff, "TMPDIR=%s", cob_tmpdir);
2276-
putenv(buff);
2275+
sprintf (buff, "TMPDIR=%s", cob_tmpdir);
2276+
putenv (buff);
22772277
#else
22782278
cob_tmpdir = "/tmp";
22792279
putenv ((char *)"TMPDIR=/tmp");

cobc/codegen.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ output_initialize_one (struct cb_initialize *p, cb_tree x)
18161816
value = CB_VALUE (f->values);
18171817

18181818
/* NATIONAL also needs no editing but mbchar conversion. */
1819-
if(CB_TREE_CATEGORY (x) == CB_CATEGORY_NATIONAL){
1819+
if (CB_TREE_CATEGORY (x) == CB_CATEGORY_NATIONAL) {
18201820
output_prefix ();
18211821
output ("cob_move(");
18221822
output_param (value, 1);
@@ -1825,7 +1825,7 @@ output_initialize_one (struct cb_initialize *p, cb_tree x)
18251825
output (");\n");
18261826
return;
18271827
}
1828-
if(CB_TREE_CATEGORY (x) == CB_CATEGORY_NATIONAL_EDITED){
1828+
if (CB_TREE_CATEGORY (x) == CB_CATEGORY_NATIONAL_EDITED) {
18291829
tmpx = cb_build_reference (f->name);
18301830
CB_REFERENCE (tmpx)->value = cb_ref (tmpx);
18311831
CB_TREE_CATEGORY (tmpx);
@@ -3032,8 +3032,8 @@ output_sort_proc (struct cb_sort_proc *p)
30323032
}
30333033
label_cache = l;
30343034
output_line ("frame_ptr->return_address = %d;", l->call_num);
3035-
output_prefix();
3036-
output("if (unlikely(*(int*)(");
3035+
output_prefix ();
3036+
output ("if (unlikely(*(int*)(");
30373037
output_param (p->sort_return, 0);
30383038
output (") != 0))\n");
30393039
output_prefix ();

cobc/pplex.c

Lines changed: 1218 additions & 1187 deletions
Large diffs are not rendered by default.

configure

Lines changed: 144 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ SHELL=${CONFIG_SHELL-/bin/sh}
422422

423423
# Identity of this package.
424424
PACKAGE_NAME='OpenCOBOL'
425-
PACKAGE_TARNAME='opensource-cobol-1.3.2J'
425+
PACKAGE_TARNAME='opensource-cobol-1.4J'
426426
PACKAGE_VERSION='1.1'
427427
PACKAGE_STRING='OpenCOBOL 1.1'
428428
PACKAGE_BUGREPORT='open-cobol-list@lists.sourceforge.net'
@@ -1858,7 +1858,7 @@ fi
18581858

18591859

18601860
# Define the identity of the package.
1861-
PACKAGE='opensource-cobol-1.3.2J'
1861+
PACKAGE='opensource-cobol-1.4J'
18621862
VERSION='1.1'
18631863

18641864

@@ -24797,7 +24797,7 @@ _ACEOF
2479724797

2479824798
MYOLDLIBS="$LIBS"
2479924799
export MYOCLIBS
24800-
for MYOCLIBS in db db-4.5 db-4.4 db-4.3 db-4.2 db-4.1
24800+
for MYOCLIBS in db db4 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1
2480124801
do
2480224802
LIBS="$MYOLDLIBS -l$MYOCLIBS"
2480324803
if test "$cross_compiling" = yes; then
@@ -25863,6 +25863,147 @@ if test $ac_cv_lib_db_4_dbopen = yes; then
2586325863
USE_DB="yes" LIBCOB_LIBS="$LIBCOB_LIBS -ldb-4"
2586425864
fi
2586525865

25866+
fi
25867+
25868+
fi
25869+
25870+
if test "$USE_DB" != "yes"
25871+
then
25872+
echo "$as_me:$LINENO: checking for __db_open in -ldb4" >&5
25873+
echo $ECHO_N "checking for __db_open in -ldb4... $ECHO_C" >&6
25874+
if test "${ac_cv_lib_db4___db_open+set}" = set; then
25875+
echo $ECHO_N "(cached) $ECHO_C" >&6
25876+
else
25877+
ac_check_lib_save_LIBS=$LIBS
25878+
LIBS="-ldb4 $LIBS"
25879+
cat >conftest.$ac_ext <<_ACEOF
25880+
/* confdefs.h. */
25881+
_ACEOF
25882+
cat confdefs.h >>conftest.$ac_ext
25883+
cat >>conftest.$ac_ext <<_ACEOF
25884+
/* end confdefs.h. */
25885+
25886+
/* Override any gcc2 internal prototype to avoid an error. */
25887+
#ifdef __cplusplus
25888+
extern "C"
25889+
#endif
25890+
/* We use char because int might match the return type of a gcc2
25891+
builtin and then its argument prototype would still apply. */
25892+
char __db_open ();
25893+
int
25894+
main ()
25895+
{
25896+
__db_open ();
25897+
;
25898+
return 0;
25899+
}
25900+
_ACEOF
25901+
rm -f conftest.$ac_objext conftest$ac_exeext
25902+
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
25903+
(eval $ac_link) 2>conftest.er1
25904+
ac_status=$?
25905+
grep -v '^ *+' conftest.er1 >conftest.err
25906+
rm -f conftest.er1
25907+
cat conftest.err >&5
25908+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
25909+
(exit $ac_status); } &&
25910+
{ ac_try='test -z "$ac_c_werror_flag"
25911+
|| test ! -s conftest.err'
25912+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
25913+
(eval $ac_try) 2>&5
25914+
ac_status=$?
25915+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
25916+
(exit $ac_status); }; } &&
25917+
{ ac_try='test -s conftest$ac_exeext'
25918+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
25919+
(eval $ac_try) 2>&5
25920+
ac_status=$?
25921+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
25922+
(exit $ac_status); }; }; then
25923+
ac_cv_lib_db4___db_open=yes
25924+
else
25925+
echo "$as_me: failed program was:" >&5
25926+
sed 's/^/| /' conftest.$ac_ext >&5
25927+
25928+
ac_cv_lib_db4___db_open=no
25929+
fi
25930+
rm -f conftest.err conftest.$ac_objext \
25931+
conftest$ac_exeext conftest.$ac_ext
25932+
LIBS=$ac_check_lib_save_LIBS
25933+
fi
25934+
echo "$as_me:$LINENO: result: $ac_cv_lib_db4___db_open" >&5
25935+
echo "${ECHO_T}$ac_cv_lib_db4___db_open" >&6
25936+
if test $ac_cv_lib_db4___db_open = yes; then
25937+
USE_DB="yes" LIBCOB_LIBS="$LIBCOB_LIBS -ldb4"
25938+
else
25939+
echo "$as_me:$LINENO: checking for dbopen in -ldb4" >&5
25940+
echo $ECHO_N "checking for dbopen in -ldb4... $ECHO_C" >&6
25941+
if test "${ac_cv_lib_db4_dbopen+set}" = set; then
25942+
echo $ECHO_N "(cached) $ECHO_C" >&6
25943+
else
25944+
ac_check_lib_save_LIBS=$LIBS
25945+
LIBS="-ldb4 $LIBS"
25946+
cat >conftest.$ac_ext <<_ACEOF
25947+
/* confdefs.h. */
25948+
_ACEOF
25949+
cat confdefs.h >>conftest.$ac_ext
25950+
cat >>conftest.$ac_ext <<_ACEOF
25951+
/* end confdefs.h. */
25952+
25953+
/* Override any gcc2 internal prototype to avoid an error. */
25954+
#ifdef __cplusplus
25955+
extern "C"
25956+
#endif
25957+
/* We use char because int might match the return type of a gcc2
25958+
builtin and then its argument prototype would still apply. */
25959+
char dbopen ();
25960+
int
25961+
main ()
25962+
{
25963+
dbopen ();
25964+
;
25965+
return 0;
25966+
}
25967+
_ACEOF
25968+
rm -f conftest.$ac_objext conftest$ac_exeext
25969+
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
25970+
(eval $ac_link) 2>conftest.er1
25971+
ac_status=$?
25972+
grep -v '^ *+' conftest.er1 >conftest.err
25973+
rm -f conftest.er1
25974+
cat conftest.err >&5
25975+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
25976+
(exit $ac_status); } &&
25977+
{ ac_try='test -z "$ac_c_werror_flag"
25978+
|| test ! -s conftest.err'
25979+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
25980+
(eval $ac_try) 2>&5
25981+
ac_status=$?
25982+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
25983+
(exit $ac_status); }; } &&
25984+
{ ac_try='test -s conftest$ac_exeext'
25985+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
25986+
(eval $ac_try) 2>&5
25987+
ac_status=$?
25988+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
25989+
(exit $ac_status); }; }; then
25990+
ac_cv_lib_db4_dbopen=yes
25991+
else
25992+
echo "$as_me: failed program was:" >&5
25993+
sed 's/^/| /' conftest.$ac_ext >&5
25994+
25995+
ac_cv_lib_db4_dbopen=no
25996+
fi
25997+
rm -f conftest.err conftest.$ac_objext \
25998+
conftest$ac_exeext conftest.$ac_ext
25999+
LIBS=$ac_check_lib_save_LIBS
26000+
fi
26001+
echo "$as_me:$LINENO: result: $ac_cv_lib_db4_dbopen" >&5
26002+
echo "${ECHO_T}$ac_cv_lib_db4_dbopen" >&6
26003+
if test $ac_cv_lib_db4_dbopen = yes; then
26004+
USE_DB="yes" LIBCOB_LIBS="$LIBCOB_LIBS -ldb4"
26005+
fi
26006+
2586626007
fi
2586726008

2586826009
fi

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
AC_PREREQ(2.59)
2525

26-
AC_INIT([OpenCOBOL],[1.1],[open-cobol-list@lists.sourceforge.net],[opensource-cobol-1.3.2J])
26+
AC_INIT([OpenCOBOL],[1.1],[open-cobol-list@lists.sourceforge.net],[opensource-cobol-1.4J])
2727
AC_CONFIG_SRCDIR([libcob.h])
2828
AC_CONFIG_HEADERS([config.h])
2929
AC_CONFIG_TESTDIR([tests])

libcob/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ sort_compare (const void *data1, const void *data2)
732732
f2.data = (unsigned char *)data2 + sort_keys[i].offset;
733733
if (COB_FIELD_IS_NUMERIC(&f1)) {
734734
cmp = cob_numeric_cmp (&f1, &f2);
735-
}else if (COB_FIELD_IS_NATIONAL(&f1)) {
735+
} else if (COB_FIELD_IS_NATIONAL(&f1)) {
736736
cmp = national_cmps (f1.data, f2.data, f1.size, sort_collate);
737737
} else {
738738
cmp = alnum_cmps (f1.data, f2.data, f1.size, sort_collate);

0 commit comments

Comments
 (0)