Commit bb3ea92b54e016afaf5ea31ebd8a321d329bf2a4
Committed by
Stéphane Raimbault
1 parent
208a337e
Fixed style issues.
Showing
2 changed files
with
16 additions
and
21 deletions
src/win32/README.win32
| ... | ... | @@ -12,6 +12,8 @@ See ../../README.md |
| 12 | 12 | |
| 13 | 13 | config.h and ../modbus-version.h are generated using configure.js. |
| 14 | 14 | Run |
| 15 | - cscript configurs.js | |
| 16 | -to generate these files. | |
| 15 | + cscript configure.js | |
| 16 | +or | |
| 17 | + wscript configure.js | |
| 18 | +or double click configure.js to generate these files. | |
| 17 | 19 | ... | ... |
src/win32/configure.js
| ... | ... | @@ -27,8 +27,7 @@ var error = 0; |
| 27 | 27 | |
| 28 | 28 | /* Helper function, transforms the option variable into the 'Enabled' |
| 29 | 29 | or 'Disabled' string. */ |
| 30 | -function boolToStr(opt) | |
| 31 | -{ | |
| 30 | +function boolToStr(opt) { | |
| 32 | 31 | if (opt == false) |
| 33 | 32 | return "no"; |
| 34 | 33 | else if (opt == true) |
| ... | ... | @@ -39,8 +38,7 @@ function boolToStr(opt) |
| 39 | 38 | |
| 40 | 39 | /* Helper function, transforms the argument string into a boolean |
| 41 | 40 | value. */ |
| 42 | -function strToBool(opt) | |
| 43 | -{ | |
| 41 | +function strToBool(opt) { | |
| 44 | 42 | if (opt == 0 || opt == "no") |
| 45 | 43 | return false; |
| 46 | 44 | else if (opt == 1 || opt == "yes") |
| ... | ... | @@ -50,8 +48,7 @@ function strToBool(opt) |
| 50 | 48 | } |
| 51 | 49 | |
| 52 | 50 | /* Displays the details about how to use this script. */ |
| 53 | -function usage() | |
| 54 | -{ | |
| 51 | +function usage() { | |
| 55 | 52 | var txt; |
| 56 | 53 | txt = "Usage:\n"; |
| 57 | 54 | txt += " cscript " + WScript.ScriptName + " <options>\n"; |
| ... | ... | @@ -59,26 +56,25 @@ function usage() |
| 59 | 56 | txt += "Options can be specified in the form <option>=<value>, where the value is\n"; |
| 60 | 57 | txt += "either 'yes' or 'no', if not stated otherwise.\n\n"; |
| 61 | 58 | txt += "\nModbus library configure options, default value given in parentheses:\n\n"; |
| 62 | - txt += " test-run: Run configure without creating files (" + (testRun? "yes" : "no") + ")\n"; | |
| 59 | + txt += " dry-run: Run configure without creating files (" + (testRun? "yes" : "no") + ")\n"; | |
| 63 | 60 | txt += "\nWin32 build options, default value given in parentheses:\n\n"; |
| 64 | - txt += " compiler: Compiler to be used [msvc|mingw|bcb] (" + compiler + ")\n"; | |
| 61 | + txt += " compiler: Compiler to be used [msvc|mingw] (" + compiler + ")\n"; | |
| 65 | 62 | WScript.Echo(txt); |
| 66 | 63 | } |
| 67 | 64 | |
| 68 | 65 | /* read the version from the configuration file */ |
| 69 | -function readVersion() | |
| 70 | -{ | |
| 66 | +function readVersion() { | |
| 71 | 67 | var fso, cf, ln, s; |
| 72 | 68 | fso = new ActiveXObject("Scripting.FileSystemObject"); |
| 73 | 69 | cf = fso.OpenTextFile(configFile, 1); |
| 74 | 70 | while (cf.AtEndOfStream != true) { |
| 75 | 71 | ln = cf.ReadLine(); |
| 76 | 72 | s = new String(ln); |
| 77 | - if (s.search(/^m4_define\(\[libmodbus_version_major/) != -1) { | |
| 73 | + if (s.search(/^m4_define\(\[libmodbus_version_major/) != -1) { | |
| 78 | 74 | verMajor = s.substr(s.indexOf(",") + 3, 1) |
| 79 | - } else if(s.search(/^m4_define\(\[libmodbus_version_minor/) != -1) { | |
| 75 | + } else if (s.search(/^m4_define\(\[libmodbus_version_minor/) != -1) { | |
| 80 | 76 | verMinor = s.substr(s.indexOf(",") + 3, 1) |
| 81 | - } else if(s.search(/^m4_define\(\[libmodbus_version_micro/) != -1) { | |
| 77 | + } else if (s.search(/^m4_define\(\[libmodbus_version_micro/) != -1) { | |
| 82 | 78 | verMicro = s.substr(s.indexOf(",") + 3, 1) |
| 83 | 79 | } |
| 84 | 80 | } |
| ... | ... | @@ -86,8 +82,7 @@ function readVersion() |
| 86 | 82 | } |
| 87 | 83 | |
| 88 | 84 | /* create the versioned file */ |
| 89 | -function createVersionedFile(newfile, unversioned) | |
| 90 | -{ | |
| 85 | +function createVersionedFile(newfile, unversioned) { | |
| 91 | 86 | var fso, ofi, of, ln, s; |
| 92 | 87 | fso = new ActiveXObject("Scripting.FileSystemObject"); |
| 93 | 88 | ofi = fso.OpenTextFile(unversioned, 1); |
| ... | ... | @@ -97,7 +92,7 @@ function createVersionedFile(newfile, unversioned) |
| 97 | 92 | while (ofi.AtEndOfStream != true) { |
| 98 | 93 | ln = ofi.ReadLine(); |
| 99 | 94 | s = new String(ln); |
| 100 | - if (!testRun && s.search(/\@LIBMODBUS_VERSION_MAJOR\@/) != -1) { | |
| 95 | + if (!testRun && s.search(/\@LIBMODBUS_VERSION_MAJOR\@/) != -1) { | |
| 101 | 96 | of.WriteLine(s.replace(/\@LIBMODBUS_VERSION_MAJOR\@/, verMajor)); |
| 102 | 97 | } else if (!testRun && s.search(/\@LIBMODBUS_VERSION_MINOR\@/) != -1) { |
| 103 | 98 | of.WriteLine(s.replace(/\@LIBMODBUS_VERSION_MINOR\@/, verMinor)); |
| ... | ... | @@ -126,8 +121,6 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) { |
| 126 | 121 | var arg, opt; |
| 127 | 122 | arg = WScript.Arguments(i); |
| 128 | 123 | opt = arg.substring(0, arg.indexOf("=")); |
| 129 | - if (opt.length == 0) | |
| 130 | - opt = arg.substring(0, arg.indexOf(":")); | |
| 131 | 124 | if (opt.length > 0) { |
| 132 | 125 | if (opt == "dry-run") |
| 133 | 126 | testRun = strToBool(arg.substring(opt.length + 1, arg.length)); |
| ... | ... | @@ -184,7 +177,7 @@ if (error != 0) { |
| 184 | 177 | } |
| 185 | 178 | |
| 186 | 179 | // Display the final configuration. |
| 187 | -var txtOut = "\nLIBMODBUS configuration completed\n"; | |
| 180 | +var txtOut = "\nLibmodbus configuration completed\n"; | |
| 188 | 181 | WScript.Echo(txtOut); |
| 189 | 182 | |
| 190 | 183 | ... | ... |