To: vim_dev@googlegroups.com Subject: Patch 8.0.1656 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1656 Problem: No option to have xxd produce upper case variable names. Solution: Add the -C argument. (Matt Panaro closes #2772) Files: src/xxd/xxd.c *** ../vim-8.0.1655/src/xxd/xxd.c 2018-02-24 18:30:51.173639406 +0100 --- src/xxd/xxd.c 2018-04-03 12:13:21.949306422 +0200 *************** *** 215,220 **** --- 215,222 ---- #define HEX_BITS 3 /* not hex a dump, but bits: 01111001 */ #define HEX_LITTLEENDIAN 4 + #define CONDITIONAL_CAPITALIZE(c) (capitalize ? toupper((int)c) : c) + static char *pname; static void *************** *** 225,230 **** --- 227,233 ---- fprintf(stderr, "Options:\n"); fprintf(stderr, " -a toggle autoskip: A single '*' replaces nul-lines. Default off.\n"); fprintf(stderr, " -b binary digit dump (incompatible with -ps,-i,-r). Default hex.\n"); + fprintf(stderr, " -C capitalize variable names in C include file style (-i).\n"); fprintf(stderr, " -c cols format octets per line. Default 16 (-i: 12, -ps: 30).\n"); fprintf(stderr, " -E show characters in EBCDIC. Default ASCII.\n"); fprintf(stderr, " -e little-endian dump (incompatible with -ps,-i,-r).\n"); *************** *** 459,465 **** { FILE *fp, *fpo; int c, e, p = 0, relseek = 1, negseek = 0, revert = 0; ! int cols = 0, nonzero = 0, autoskip = 0, hextype = HEX_NORMAL; int ebcdic = 0; int octspergrp = -1; /* number of octets grouped in output */ int grplen; /* total chars per octet group */ --- 462,468 ---- { FILE *fp, *fpo; int c, e, p = 0, relseek = 1, negseek = 0, revert = 0; ! int cols = 0, nonzero = 0, autoskip = 0, hextype = HEX_NORMAL, capitalize = 0; int ebcdic = 0; int octspergrp = -1; /* number of octets grouped in output */ int grplen; /* total chars per octet group */ *************** *** 495,500 **** --- 498,504 ---- else if (!STRNCMP(pp, "-u", 2)) hexx = hexxa + 16; else if (!STRNCMP(pp, "-p", 2)) hextype = HEX_POSTSCRIPT; else if (!STRNCMP(pp, "-i", 2)) hextype = HEX_CINCLUDE; + else if (!STRNCMP(pp, "-C", 2)) capitalize = 1; else if (!STRNCMP(pp, "-r", 2)) revert++; else if (!STRNCMP(pp, "-E", 2)) ebcdic++; else if (!STRNCMP(pp, "-v", 2)) *************** *** 722,728 **** if (fprintf(fpo, "unsigned char %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) die(3); for (e = 0; (c = argv[1][e]) != 0; e++) ! if (putc(isalnum(c) ? c : '_', fpo) == EOF) die(3); if (fputs("[] = {\n", fpo) == EOF) die(3); --- 726,732 ---- if (fprintf(fpo, "unsigned char %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) die(3); for (e = 0; (c = argv[1][e]) != 0; e++) ! if (putc(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo) == EOF) die(3); if (fputs("[] = {\n", fpo) == EOF) die(3); *************** *** 750,758 **** if (fprintf(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) die(3); for (e = 0; (c = argv[1][e]) != 0; e++) ! if (putc(isalnum(c) ? c : '_', fpo) == EOF) die(3); ! if (fprintf(fpo, "_len = %d;\n", p) < 0) die(3); } --- 754,762 ---- if (fprintf(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) die(3); for (e = 0; (c = argv[1][e]) != 0; e++) ! if (putc(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo) == EOF) die(3); ! if (fprintf(fpo, "_%s = %d;\n", capitalize ? "LEN" : "len", p) < 0) die(3); } *** ../vim-8.0.1655/src/version.c 2018-03-29 18:29:47.297127408 +0200 --- src/version.c 2018-04-03 12:16:52.224327009 +0200 *************** *** 764,765 **** --- 764,767 ---- { /* Add new patch number below this line */ + /**/ + 1656, /**/ -- From "know your smileys": :-& Eating spaghetti /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///