Skip to content

Commit

Permalink
2011-07-10
Browse files Browse the repository at this point in the history
    * crc_symtable.py:
    When generating C code for the C89 or ANSI standard, don't include <stdint.h>.
    This closes issue 3338930
    * crc_symtable.py:
    If no output file name is given while generating a C file, then pycrc will
    #include a hypothetical pycrc.h file instead of a stdout.h file.
    Also, added a comment on that line to make debugging easier.
    Closes issue 3325109.
    * crc_symtable.py:
    Removed unused variable "this_option_optind" in the generated option parser.
  • Loading branch information
tpircher-zz committed Nov 1, 2011
1 parent 4186531 commit cd7fcca
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
19 changes: 19 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#
# Version 0.7.8, 2011-07-10
#

2011-07-10 Thomas Pircher <tehpeh@gmx.net>

* crc_symtable.py:
When generating C code for the C89 or ANSI standard, don't include <stdint.h>.
This closes issue 3338930

* crc_symtable.py:
If no output file name is given while generating a C file, then pycrc will
#include a hypothetical pycrc.h file instead of a stdout.h file.
Also, added a comment on that line to make debugging easier.
Closes issue 3325109.

* crc_symtable.py:
Removed unused variable "this_option_optind" in the generated option parser.

#
# Version 0.7.7, 2011-02-11
#
Expand Down
2 changes: 1 addition & 1 deletion crc_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Options(object):

# Program details
ProgramName = "pycrc"
Version = "0.7.7"
Version = "0.7.8"
VersionStr = "%s v%s" % (ProgramName, Version)
WebAddress = "http://www.tty1.net/pycrc/"

Expand Down
14 changes: 7 additions & 7 deletions crc_symtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ def __init__(self, opt):
self.table["program_version"] = self.opt.VersionStr
self.table["program_url"] = self.opt.WebAddress
if self.opt.OutputFile == None:
self.table["filename"] = "stdout"
self.table["filename"] = "pycrc_stdout"
else:
self.table["filename"] = self.opt.OutputFile

if self.opt.OutputFile == None:
self.table["header_filename"] = "stdout.h"
self.table["header_filename"] = "pycrc_stdout.h"
elif self.opt.OutputFile[-2:] == ".c":
self.table["header_filename"] = self.opt.OutputFile[0:-1] + "h"
else:
Expand Down Expand Up @@ -261,8 +261,10 @@ def __getTerminal(self, id):
$if ($include_file != Undefined) {:
#include $include_file
:}
#include <stdint.h>
#include <stdlib.h>
$if ($c_std != C89) {:
#include <stdint.h>
:}
$if ($undefined_parameters == True and $c_std != C89) {:
#include <stdbool.h>
:}
Expand Down Expand Up @@ -522,7 +524,7 @@ def __getTerminal(self, id):
$if ($include_file != Undefined) {:
#include $include_file
:}
#include "$header_filename"
#include "$header_filename" /* include the header file generated with pycrc */
#include <stdint.h>
#include <stdlib.h>
$if ($undefined_parameters == True or $crc_algorithm == "bit-by-bit" or $crc_algorithm == "bit-by-bit-fast") {:
Expand Down Expand Up @@ -997,7 +999,6 @@ def __getTerminal(self, id):
static int get_config(int argc, char *argv[]$if ($undefined_parameters == True) {:, $cfg_t *cfg:})
{
int c;
int this_option_optind;
int option_index;
static struct option long_options[] = {
$if ($crc_width == Undefined) {:
Expand Down Expand Up @@ -1027,7 +1028,6 @@ def __getTerminal(self, id):
};
while (1) {
this_option_optind = optind ? optind : 1;
option_index = 0;
c = getopt_long (argc, argv, "w:p:n:i:u:o:s:vt", long_options, &option_index);
Expand Down Expand Up @@ -1165,7 +1165,7 @@ def __pretty_hdrprotection(self):
else:
tr_str += '_'
if self.opt.OutputFile == None:
out_str = "stdout"
out_str = "pycrc_stdout"
else:
out_str = self.opt.OutputFile
out_str = os.path.basename(out_str)
Expand Down
2 changes: 0 additions & 2 deletions test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ crc_t xtoi(const char *str)
int get_config(int argc, char *argv[], crc_cfg_t *cfg)
{
int c;
int this_option_optind;
int option_index;
static struct option long_options[] = {
{"width", 1, 0, 'w'},
Expand All @@ -103,7 +102,6 @@ int get_config(int argc, char *argv[], crc_cfg_t *cfg)
};

while (1) {
this_option_optind = optind ? optind : 1;
option_index = 0;

c = getopt_long (argc, argv, "w:p:ni:uo:v", long_options, &option_index);
Expand Down

0 comments on commit cd7fcca

Please sign in to comment.