Commit b665c71b authored by rdubner's avatar rdubner

Release 3.4

Complete rewrite of the cobcd script.  This incorporates Simon Sobisch's suggestion of using the
cobc -### option to create templates for execution of the various cobcd steps.  The result is greater,
perhaps even complete, flexibility in passing parameters to cobcd.  For instance, the COBOL source
file can now have any name at all (no spaces or quotes, lest chaos reign), likewise a -o executable
target can be specified as well.
parent 4124e514
This diff is collapsed.
......@@ -99,7 +99,7 @@ CreateSymc(PARAMETERS &params,
compiling .sym.c
*/
string fname = params.c_filename.GetFname();
string fname = params.sourcename;
stringstream ss_tab;
stringstream ss;
......@@ -119,6 +119,12 @@ CreateSymc(PARAMETERS &params,
string s = ss.str();
ss.str("");
for(size_t i=0; i<fname.size(); i++) {
if( fname[i] EQ '.' ) {
fname[i] = '_' ;
}
}
ss << "char VARIABLE_STRING_" << Upper(fname) << "[]=" << endl;
const int SEGMENT_LENGTH = 78;
......
......@@ -203,9 +203,9 @@ static void
Usage()
{
cerr << "cobst: Cobol Symbol Table generator version: " << VERSION << endl;
cerr << "cobst [-v] [-q] [-n] FileName.CBL\n";
cerr << "Reads various other files with the same FileName root;\n";
cerr << "Generates FileName.tab containing the symbol table data\n";
cerr << "cobst [-v] [-q] [-n] root CobolSourceFilename\n";
cerr << "Reads various other files with the same root;\n";
cerr << "Generates root.sym.c containing the symbol table data\n";
cerr << "-q suppresses the one-line version announcement\n";
cerr << "-v generates the one-line version announcement and exits\n";
cerr << "-n suppresses the insertion of cobcb.py into SOURCE.sym.c\n";
......@@ -236,7 +236,7 @@ OpenOrFail(std::ofstream &ofs,const std::string &fname,std::ios_base::openmode m
void
PARAMETERS::GetParameters(int argc, char *argv[])
{
if(argc < 2) {
if(argc < 3) {
Usage();
exit(1);
}
......@@ -244,7 +244,7 @@ PARAMETERS::GetParameters(int argc, char *argv[])
quiet = false;
insert_python = true;
string input_parameter;
string root;
int c;
while ((c = getopt (argc, argv, "qvn")) != -1) {
switch (c) {
......@@ -268,13 +268,20 @@ PARAMETERS::GetParameters(int argc, char *argv[])
break;
}
}
input_parameter = argv[optind];
if( optind >= argc ) {
Usage();
exit(1);
}
basename = argv[optind++];
if( optind >= argc ) {
Usage();
exit(1);
}
sourcename = argv[optind++];
c_filename.Decode(input_parameter);
basename = c_filename.GetFname();
c_filename.Decode(c_filename.Stem() + ".c");
cbl_lst_filename.Decode(c_filename.Stem() + ".cbl.lst");
symc_filename.Decode(c_filename.Stem() + ".sym.c");
c_filename.Decode(basename + ".c");
cbl_lst_filename.Decode(basename + ".cbl.lst");
symc_filename.Decode(basename + ".sym.c");
//OpenOrFail(retval.cbl,retval.cbl_filename.WholePath());
OpenOrFail(c_file,c_filename.WholePath());
......
......@@ -110,6 +110,7 @@ class PARAMETERS
{
public:
std::string basename;
std::string sourcename;
FILENAME cbl_lst_filename; // GnucCOBOL-generated stylized source code,
// // with parsed STORAGE sections
......
......@@ -7,7 +7,7 @@ SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
::## Don't mess with it! #
::###########################################################################
::
set VERSION=[Version 3.3]
set VERSION=[Version 3.4]
::
::
set argC=0
......
......@@ -4,4 +4,4 @@
// On the Unix side, there is scripting trickery to propogate this version
// code into cobcd.py and the names of packages when they are created.
#define VERSION "3.3"
#define VERSION "3.4"
#######################################################################
# Copyright (c) 2019-2020 Symas Corporation
# Copyright (c) 2019-2020 COBOLworx
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
......@@ -11,7 +11,7 @@
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of the Symas Corporation nor the names of its
# * Neither the name of the COBOLworx nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
......@@ -2713,8 +2713,9 @@ class TabFileInformation() :
self.current_trapped_file = file_and_line[0]
# Find the address of the VARIABLE_STRING for this file
name_root = self.current_trapped_file.split('.')
string_name = "VARIABLE_STRING_" + name_root[0].upper();
name_root = self.current_trapped_file
name_root = name_root.replace('.','_')
string_name = "VARIABLE_STRING_" + name_root.upper()
the_address = GetAddressOf(string_name)
# And pick up that string, byte by laborious byte:
......@@ -3159,7 +3160,7 @@ if 'gdb' in sys.modules :
## The text "Version x.x" has to appear in square brackets. #
## Don't mess with it! #
###########################################################################
print('registering CPrint (Usage is "print <COBOL identifier>") [Version 3.3]')
print('registering CPrint (Usage is "print <COBOL identifier>") [Version 3.4]')
self.Worker = CPrintWorker()
self.TabFile = TabFileInformation();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment