http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/a9485aeb/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/debugger/static/style.css ---------------------------------------------------------------------- diff --git a/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/debugger/static/style.css b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/debugger/static/style.css new file mode 100644 index 0000000..a105947 --- /dev/null +++ b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/debugger/static/style.css @@ -0,0 +1,516 @@ +// http://stackoverflow.com/questions/71074/how-to-remove-firefoxs-dotted-outline-on-buttons-as-well-as-links/3844452#3844452 +:focus { + outline: none; +} +::-moz-focus-inner { + border: 0; +} + +@keyframes pulsate { + from { opacity: 1; } + to { opacity: 0.25; } +} + +#part-header { + background: #444444; + color: #ffffff; + font: 24pt monospace; + border-bottom: 2px solid #cccccc; + padding: 20px 0px 20px 10px; +} + +/* http://css-tricks.com/snippets/css/a-guide-to-flexbox/ */ +#part-middle { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: space-between; + align-items: stretch; + align-content: stretch; + + min-height: 800px; + + border-top: 1px solid #ffffff; + padding: 8px; + margin-top: 2px; +} +#left-area { + flex: 0 0 11em; + margin-right: 20px; + margin-bottom: 10px; +} +#center-area { + flex: 1 1 0; + margin-bottom: 10px; +} +#right-area { + flex: 0 0 40em; + margin-left: 20px; + margin-bottom: 10px; +} + +#part-footer { + clear: both; + border-top: 2px solid #bbbbbb; + background: #eeeeee; + color: #555555; + text-align: center; + padding-top: 12px; + padding-bottom: 12px; + line-height: 1.5; +} + +#exec-status { + margin-top: 25px; + margin-bottom: 25px; +} +#exec-state { + display: inline-block; + vertical-align: middle; +} +#exec-other { + display: inline-block; + vertical-align: middle; + font-size: 125%; +} +#current-state { + background: #228822; + color: #ffffff; + font: 16pt; + padding: 6pt; + border: 5px solid #228822; + border-radius: 10px; + font-size: 200%; + font-weight: bold; + margin-right: 10px; +} +#current-state.notrunning { + background: #882222; + border: 5px solid #882222; + border-radius: 10px; + animation: pulsate 0.7s cubic-bezier(0.75, 0, 0.75, 1) infinite alternate; +} +#exec-other:hover { + text-decoration: underline; + color: #9999ff; +} + +#left-area button { + display: inline-block; + width: 100%; + min-width: 8em; + background: #226622; + color: #ffffff; + font: 16pt sans-serif; + font-weight: bold; + text-decoration: none; + margin: 10px 0 0 0; + padding: 0.4em; + border: 2px solid #000000; + border-radius: 4px; +} +#left-area button a { + color: #ffffff; + text-decoration: none; +} +#left-area button:hover { + background: #55aa55; +} +#left-area button:disabled { + background: #555555; + color: #888888; +} +#left-area button:disabled a { + background: #555555; + color: #888888; +} + +#pause-button.pending { + background: #5555ff; + animation: pulsate 0.2s cubic-bezier(0.75, 0, 0.75, 1) infinite alternate; +} + +#attach-button { +} +#attach-button.enabled { + animation: pulsate 0.7s cubic-bezier(0.75, 0, 0.75, 1) infinite alternate; +} + +.duktape-exec-line { + outline: 2px solid red; + background: #550000; +} +.duktape-break-line { + outline: 2px solid white; +} + +#output { + font: 9pt monospace; + color: #000000; + border: 2px solid #cccccc; + border-radius: 5px; + padding: 3px; + height: 30ex; + overflow: scroll; + overflow-x: auto; + overflow-y: scroll; + white-space: pre; +} +#output .alert { + color: #ff0000; +} +/* Default color (should be overridden by level) */ +#output .log { + color: #00ff00; +} +/* Trace */ +#output .loglevel0 { + color: #cccccc; +} +/* Debug */ +#output .loglevel1 { + color: #cccccc; +} +/* Info */ +#output .loglevel2 { + color: #888888; + font-weight: bold; +} +/* Warn */ +#output .loglevel3 { + color: #ff4444; + font-weight: bold; +} +/* Error */ +#output .loglevel4 { + color: #ff0000; + font-weight: bold; +} +/* Fatal */ +#output .loglevel5 { + background: #000000; + color: #ff0000; + font-weight: bold; +} +#output .debugger-info { + color: #880000; + font-weight: bold; + font-style: italic; +} +#output .debugger-debug { + color: #888888; + font-weight: bold; + font-style: italic; +} + +#callstack { + font: 9pt monospace; + color: #000000; + margin-top: 10px; + border: 2px solid #cccccc; + border-radius: 5px; + padding: 3px; + height: 14ex; + overflow: scroll; + overflow-x: auto; + overflow-y: scroll; + white-space: pre; +} +#callstack div:nth-child(2n) { + background: #eeeeee; +} +#callstack .func { +} +#callstack .rest { + float: right; + color: #6666ff; +} +#callstack .rest:hover { + text-decoration: underline; + color: #9999ff; +} + +#locals { + font: 9pt monospace; + color: #000000; + margin-top: 10px; + border: 2px solid #cccccc; + border-radius: 5px; + padding: 10px; + height: 30ex; + overflow: scroll; + overflow-x: auto; + overflow-y: scroll; + white-space: pre; +} +#locals div:nth-child(2n) { + background: #eeeeee; +} +#locals .key { +} +#locals .value { + float: right; + color: #888888; +} + +#breakpoints { + color: #000000; + margin-top: 10px; + border: 2px solid #cccccc; + border-radius: 5px; + padding: 3px; + height: 15ex; + overflow: scroll; + overflow-x: auto; + overflow-y: scroll; + white-space: pre; +} +#breakpoints div { + margin: 2px 0 2px 0; +} +#breakpoints div:nth-child(2n) { + background: #eeeeee; +} +#breakpoints a { + font: 9pt monospace; + color: #6666ff; +} +#breakpoints a:hover { + text-decoration: underline; + color: #9999ff; +} +.breakpoint-line { + clear: both; + padding-top: 2px; + padding-bottom: 2px; +} +#add-breakpoint-file { + font: 10pt monospace; + width: 10em; + padding: 5px; +} +#add-breakpoint-line { + font: 10pt monospace; + width: 3em; + margin-left: 3px; + padding: 5px; +} +#delete-all-breakpoints-button { + float: right; + font: 10pt sans-serif; + padding: 5px; + border: 1px solid #888888; + background: #ddffdd; + color: #000000; +} +#delete-all-breakpoints-button:hover { + background: #f8fff8; +} +#delete-all-breakpoints-button:disabled { + background: #dddddd; + color: #444444; +} +#add-breakpoint-button { + font: 10pt sans-serif; + margin-left: 10px; + padding: 5px; + border: 1px solid #888888; + background: #ddffdd; + color: #000000; +} +#add-breakpoint-button:hover { + background: #f8fff8; +} +#add-breakpoint-button:disabled { + background: #dddddd; + color: #444444; +} +#breakpoint-hint { + color: #aaaaaa; + font-style: italic; + margin-left: 10px; +} +.delete-breakpoint-button { + float: right; + display: inline; + font: 9pt sans-serif; + padding: 3px; + border: none; + background: none; + color: #6666ff; +} +.delete-breakpoint-button { + font: 9pt sans-serif; +} +.delete-breakpoint-button:hover { + text-decoration: underline; + color: #9999ff; +} +.delete-breakpoint-button:disabled { + color: #888888; +} + +#about-dialog p { + margin: 10px 0 10px 0; +} + +#bytecode-dialog p { + margin: 10px 0 10px 0; +} +#bytecode-dialog pre { + font: 10pt monospace; + color: #000000; +} +#bytecode-dialog div.highlight { + background: #888888; + color: #ffffff; +} + +#eval { + color: #000000; + margin-top: 10px; + border: 2px solid #cccccc; + border-radius: 5px; + padding: 3px; + height: 30ex; + overflow: scroll; + overflow-x: auto; + overflow-y: scroll; + white-space: pre; +} +#eval-input { + display: inline; + font: 10pt monospace; + width: 20em; + padding: 5px; +} +#eval-button { + display: inline; + margin-left: 10px; + padding: 5px; + border: 1px solid #888888; + font: 10pt sans-serif; + background: #ddffdd; + color: #000000; +} +#eval-button { +} +#eval-button:hover { + background: #f8fff8; +} +#eval-button:disabled { + background: #dddddd; + color: #444444; +} +#eval-button.pending { + background: #5555ff; + animation: pulsate 0.2s cubic-bezier(0.75, 0, 0.75, 1) infinite alternate; +} +#eval-watch { + margin-left: 20px; + vertical-align: middle; +} +#eval-output { + font: 10pt monospace; + white-space: pre; + padding: 5px; + border: 1px solid #888888; + min-height: 4ex; + margin-top: 5px; +} + +#varname-input { + font: 10pt monospace; + width: 10em; + padding: 5px; +} +#varvalue-input { + margin-left: 10px; + font: 10pt monospace; + width: 20em; + padding: 5px; +} +#getvar-button, +#putvar-button { + display: inline; + float: right; + margin-left: 10px; + padding: 5px; + border: 1px solid #888888; + font: 10pt sans-serif; + background: #ddffdd; + color: #000000; +} +#getvar-button:hover, +#putvar-button:hover { + background: #f8fff8; +} +#getvar-button:disabled, +#putvar-button:disabled { + background: #dddddd; + color: #444444; +} +#var-output { + font: 10pt monospace; + white-space: pre; + padding: 5px; + border: 1px solid #888888; + min-height: 4ex; + margin-top: 5px; +} + +#source-pre { + margin-top: 10px; + border: 2px solid #cccccc; + border-radius: 5px; + height: 400px; + overflow: scroll; + overflow-x: auto; + overflow-y: scroll; +} +#source-pre.running { + background: #eeeeee; + color: #888888; +} +#source-pre.running #source-code { + background: #eeeeee; + color: #888888; +} +#source-filename { + font-size: 125%; + color: #888888; +} +code.sourcecode { + counter-reset: source-line; +} +code.sourcecode div { + font: 10pt monospace; + padding: 2px 5px 2px 5px; + white-space: pre; + border-bottom: 1px solid #eeeeee; +} +code.sourcecode div:before { + display: inline-block; + content: counter(source-line); + counter-increment: source-line; + width: 4em; + color: #888888; + text-align: right; + margin-right: 20px; +} +code.sourcecode div.breakpoint:before { + margin-right: 0px; + border-right: 20px solid #ff0000; +} +code.sourcecode div.highlight { + background: #aaaaaa; + color: #000000; +} +code.sourcecode div.execution { + background: #000000; + color: #ffffff; +} + +#source-select { + margin-top: 5px; +}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/a9485aeb/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/debugger/static/webui.js ---------------------------------------------------------------------- diff --git a/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/debugger/static/webui.js b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/debugger/static/webui.js new file mode 100644 index 0000000..d400c6c --- /dev/null +++ b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/debugger/static/webui.js @@ -0,0 +1,785 @@ +/* + * Duktape debugger web client + * + * Talks to the NodeJS server using socket.io. + * + * http://unixpapa.com/js/key.html + */ + +// Update interval for custom source highlighting. +var SOURCE_UPDATE_INTERVAL = 350; + +// Source view +var activeFileName = null; // file that we want to be loaded in source view +var activeLine = null; // scroll to line once file has been loaded +var activeHighlight = null; // line that we want to highlight (if any) +var loadedFileName = null; // currently loaded (shown) file +var loadedLineCount = 0; // currently loaded file line count +var loadedFileExecuting = false; // true if currFileName (loosely) matches loadedFileName +var loadedLinePending = null; // if set, scroll loaded file to requested line +var highlightLine = null; // highlight line +var sourceEditedLines = []; // line numbers which have been modified + // (added classes etc, tracked for removing) +var sourceUpdateInterval = null; // timer for updating source view +var sourceFetchXhr = null; // current AJAX request for fetching a source file (if any) +var forceButtonUpdate = false; // hack to reset button states +var bytecodeDialogOpen = false; // bytecode dialog active +var bytecodeIdxHighlight = null; // index of currently highlighted line (or null) +var bytecodeIdxInstr = 0; // index to first line of bytecode instructions + +// Execution state +var prevState = null; // previous execution state ('paused', 'running', etc) +var prevAttached = null; // previous debugger attached state (true, false, null) +var currFileName = null; // current filename being executed +var currFuncName = null; // current function name being executed +var currLine = 0; // current line being executed +var currPc = 0; // current bytecode PC being executed +var currState = 0; // current execution state ('paused', 'running', 'detached', etc) +var currAttached = false; // current debugger attached state (true or false) +var currLocals = []; // current local variables +var currCallstack = []; // current callstack (from top to bottom) +var currBreakpoints = []; // current breakpoints +var startedRunning = 0; // timestamp when last started running (if running) + // (used to grey out the source file if running for long enough) + +/* + * Helpers + */ + +function formatBytes(x) { + if (x < 1024) { + return String(x) + ' bytes'; + } else if (x < 1024 * 1024) { + return (x / 1024).toPrecision(3) + ' kB'; + } else { + return (x / (1024 * 1024)).toPrecision(3) + ' MB'; + } +} + +/* + * Source view periodic update handling + */ + +function doSourceUpdate() { + var elem; + + // Remove previously added custom classes + sourceEditedLines.forEach(function (linenum) { + elem = $('#source-code div')[linenum - 1]; + if (elem) { + elem.classList.remove('breakpoint'); + elem.classList.remove('execution'); + elem.classList.remove('highlight'); + } + }); + sourceEditedLines.length = 0; + + // If we're executing the file shown, highlight current line + if (loadedFileExecuting) { + elem = $('#source-code div')[currLine - 1]; + if (elem) { + sourceEditedLines.push(currLine); + elem.classList.add('execution'); + } + } + + // Add breakpoints + currBreakpoints.forEach(function (bp) { + if (bp.fileName === loadedFileName) { + elem = $('#source-code div')[bp.lineNumber - 1]; + if (elem) { + sourceEditedLines.push(bp.lineNumber); + elem.classList.add('breakpoint'); + } + } + }); + + if (highlightLine !== null) { + elem = $('#source-code div')[highlightLine - 1]; + if (elem) { + sourceEditedLines.push(highlightLine); + elem.classList.add('highlight'); + } + } + + // Bytecode dialog highlight + if (loadedFileExecuting && bytecodeDialogOpen && bytecodeIdxHighlight !== bytecodeIdxInstr + currPc) { + if (typeof bytecodeIdxHighlight === 'number') { + $('#bytecode-preformatted div')[bytecodeIdxHighlight].classList.remove('highlight'); + } + bytecodeIdxHighlight = bytecodeIdxInstr + currPc; + $('#bytecode-preformatted div')[bytecodeIdxHighlight].classList.add('highlight'); + } + + // If no-one requested us to scroll to a specific line, finish. + if (loadedLinePending == null) { + return; + } + + var reqLine = loadedLinePending; + loadedLinePending = null; + + // Scroll to requested line. This is not very clean, so a better solution + // should be found: + // https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollIntoView + // http://erraticdev.blogspot.fi/2011/02/jquery-scroll-into-view-plugin-with.html + // http://flesler.blogspot.fi/2007/10/jqueryscrollto.html + var tmpLine = Math.max(reqLine - 5, 0); + elem = $('#source-code div')[tmpLine]; + if (elem) { + elem.scrollIntoView(); + } +} + +// Source is updated periodically. Other code can also call doSourceUpdate() +// directly if an immediate update is needed. +sourceUpdateInterval = setInterval(doSourceUpdate, SOURCE_UPDATE_INTERVAL); + +/* + * UI update handling when exec-status update arrives + */ + +function doUiUpdate() { + var now = Date.now(); + + // Note: loadedFileName can be either from target or from server, but they + // must match exactly. We could do a loose match here, but exact matches + // are needed for proper breakpoint handling anyway. + loadedFileExecuting = (loadedFileName === currFileName); + + // If we just started running, store a timestamp so we can grey out the + // source view only if we execute long enough (i.e. we're not just + // stepping). + if (currState !== prevState && currState === 'running') { + startedRunning = now; + } + + // If we just became paused, check for eval watch + if (currState !== prevState && currState === 'paused') { + if ($('#eval-watch').is(':checked')) { + submitEval(); // don't clear eval input + } + } + + // Update current execution state + if (currFileName === '' && currLine === 0) { + $('#current-fileline').text(''); + } else { + $('#current-fileline').text(String(currFileName) + ':' + String(currLine)); + } + if (currFuncName === '' && currPc === 0) { + $('#current-funcpc').text(''); + } else { + $('#current-funcpc').text(String(currFuncName) + '() pc ' + String(currPc)); + } + $('#current-state').text(String(currState)); + + // Update buttons + if (currState !== prevState || currAttached !== prevAttached || forceButtonUpdate) { + $('#stepinto-button').prop('disabled', !currAttached || currState !== 'paused'); + $('#stepover-button').prop('disabled', !currAttached || currState !== 'paused'); + $('#stepout-button').prop('disabled', !currAttached || currState !== 'paused'); + $('#resume-button').prop('disabled', !currAttached || currState !== 'paused'); + $('#pause-button').prop('disabled', !currAttached || currState !== 'running'); + $('#attach-button').prop('disabled', currAttached); + if (currAttached) { + $('#attach-button').removeClass('enabled'); + } else { + $('#attach-button').addClass('enabled'); + } + $('#detach-button').prop('disabled', !currAttached); + $('#eval-button').prop('disabled', !currAttached); + $('#add-breakpoint-button').prop('disabled', !currAttached); + $('#delete-all-breakpoints-button').prop('disabled', !currAttached); + $('.delete-breakpoint-button').prop('disabled', !currAttached); + $('#putvar-button').prop('disabled', !currAttached); + $('#getvar-button').prop('disabled', !currAttached); + $('#heap-dump-download-button').prop('disabled', !currAttached); + } + if (currState !== 'running' || forceButtonUpdate) { + // Remove pending highlight once we're no longer running. + $('#pause-button').removeClass('pending'); + $('#eval-button').removeClass('pending'); + } + forceButtonUpdate = false; + + // Make source window grey when running for a longer time, use a small + // delay to avoid flashing grey when stepping. + if (currState === 'running' && now - startedRunning >= 500) { + $('#source-pre').removeClass('notrunning'); + $('#current-state').removeClass('notrunning'); + } else { + $('#source-pre').addClass('notrunning'); + $('#current-state').addClass('notrunning'); + } + + // Force source view to match currFileName only when running or when + // just became paused (from running or detached). + var fetchSource = false; + if (typeof currFileName === 'string') { + if (currState === 'running' || + (prevState !== 'paused' && currState === 'paused') || + (currAttached !== prevAttached)) { + if (activeFileName !== currFileName) { + fetchSource = true; + activeFileName = currFileName; + activeLine = currLine; + activeHighlight = null; + requestSourceRefetch(); + } + } + } + + // Force line update (scrollTop) only when running or just became paused. + // Otherwise let user browse and scroll source files freely. + if (!fetchSource) { + if ((prevState !== 'paused' && currState === 'paused') || + currState === 'running') { + loadedLinePending = currLine || 0; + } + } +} + +/* + * Init socket.io and add handlers + */ + +var socket = io(); // returns a Manager + +setInterval(function () { + socket.emit('keepalive', { + userAgent: (navigator || {}).userAgent + }); +}, 30000); + +socket.on('connect', function () { + $('#socketio-info').text('connected'); + currState = 'connected'; + + fetchSourceList(); +}); +socket.on('disconnect', function () { + $('#socketio-info').text('not connected'); + currState = 'disconnected'; +}); +socket.on('reconnecting', function () { + $('#socketio-info').text('reconnecting'); + currState = 'reconnecting'; +}); +socket.on('error', function (err) { + $('#socketio-info').text(err); +}); + +socket.on('replaced', function () { + // XXX: how to minimize the chance we'll further communciate with the + // server or reconnect to it? socket.reconnection()? + + // We'd like to window.close() here but can't (not allowed from scripts). + // Alert is the next best thing. + alert('Debugger connection replaced by a new one, do you have multiple tabs open? If so, please close this tab.'); +}); + +socket.on('keepalive', function (msg) { + // Not really interesting in the UI + // $('#server-info').text(new Date() + ': ' + JSON.stringify(msg)); +}); + +socket.on('basic-info', function (msg) { + $('#duk-version').text(String(msg.duk_version)); + $('#duk-git-describe').text(String(msg.duk_git_describe)); + $('#target-info').text(String(msg.target_info)); + $('#endianness').text(String(msg.endianness)); +}); + +socket.on('exec-status', function (msg) { + // Not 100% reliable if callstack has several functions of the same name + if (bytecodeDialogOpen && (currFileName != msg.fileName || currFuncName != msg.funcName)) { + socket.emit('get-bytecode', {}); + } + + currFileName = msg.fileName; + currFuncName = msg.funcName; + currLine = msg.line; + currPc = msg.pc; + currState = msg.state; + currAttached = msg.attached; + + // Duktape now restricts execution status updates quite effectively so + // there's no need to rate limit UI updates now. + + doUiUpdate(); + + prevState = currState; + prevAttached = currAttached; +}); + +// Update the "console" output based on lines sent by the server. The server +// rate limits these updates to keep the browser load under control. Even +// better would be for the client to pull this (and other stuff) on its own. +socket.on('output-lines', function (msg) { + var elem = $('#output'); + var i, n, ent; + + elem.empty(); + for (i = 0, n = msg.length; i < n; i++) { + ent = msg[i]; + if (ent.type === 'print') { + elem.append($('<div></div>').text(ent.message)); + } else if (ent.type === 'alert') { + elem.append($('<div class="alert"></div>').text(ent.message)); + } else if (ent.type === 'log') { + elem.append($('<div class="log loglevel' + ent.level + '"></div>').text(ent.message)); + } else if (ent.type === 'debugger-info') { + elem.append($('<div class="debugger-info"><div>').text(ent.message)); + } else if (ent.type === 'debugger-debug') { + elem.append($('<div class="debugger-debug"><div>').text(ent.message)); + } else { + elem.append($('<div></div>').text(ent.message)); + } + } + + // http://stackoverflow.com/questions/14918787/jquery-scroll-to-bottom-of-div-even-after-it-updates + // Stop queued animations so that we always scroll quickly to bottom + $('#output').stop(true); + $('#output').animate({ scrollTop: $('#output')[0].scrollHeight}, 1000); +}); + +socket.on('callstack', function (msg) { + var elem = $('#callstack'); + var s1, s2, div; + + currCallstack = msg.callstack; + + elem.empty(); + msg.callstack.forEach(function (e) { + s1 = $('<a class="rest"></a>').text(e.fileName + ':' + e.lineNumber + ' (pc ' + e.pc + ')'); // float + s1.on('click', function () { + activeFileName = e.fileName; + activeLine = e.lineNumber || 1; + activeHighlight = activeLine; + requestSourceRefetch(); + }); + s2 = $('<span class="func"></span>').text(e.funcName + '()'); + div = $('<div></div>'); + div.append(s1); + div.append(s2); + elem.append(div); + }); +}); + +socket.on('locals', function (msg) { + var elem = $('#locals'); + var s1, s2, div; + var i, n, e; + + currLocals = msg.locals; + + elem.empty(); + for (i = 0, n = msg.locals.length; i < n; i++) { + e = msg.locals[i]; + s1 = $('<span class="value"></span>').text(e.value); // float + s2 = $('<span class="key"></span>').text(e.key); + div = $('<div></div>'); + div.append(s1); + div.append(s2); + elem.append(div); + } +}); + +socket.on('debug-stats', function (msg) { + $('#debug-rx-bytes').text(formatBytes(msg.rxBytes)); + $('#debug-rx-dvalues').text(msg.rxDvalues); + $('#debug-rx-messages').text(msg.rxMessages); + $('#debug-rx-kbrate').text((msg.rxBytesPerSec / 1024).toFixed(2)); + $('#debug-tx-bytes').text(formatBytes(msg.txBytes)); + $('#debug-tx-dvalues').text(msg.txDvalues); + $('#debug-tx-messages').text(msg.txMessages); + $('#debug-tx-kbrate').text((msg.txBytesPerSec / 1024).toFixed(2)); +}); + +socket.on('breakpoints', function (msg) { + var elem = $('#breakpoints'); + var div; + var sub; + + currBreakpoints = msg.breakpoints; + + elem.empty(); + + // First line is special + div = $('<div></div>'); + sub = $('<button id="delete-all-breakpoints-button"></button>').text('Delete all breakpoints'); + sub.on('click', function () { + socket.emit('delete-all-breakpoints'); + }); + div.append(sub); + sub = $('<input id="add-breakpoint-file"></input>').val('file.js'); + div.append(sub); + sub = $('<span></span>').text(':'); + div.append(sub); + sub = $('<input id="add-breakpoint-line"></input>').val('123'); + div.append(sub); + sub = $('<button id="add-breakpoint-button"></button>').text('Add breakpoint'); + sub.on('click', function () { + socket.emit('add-breakpoint', { + fileName: $('#add-breakpoint-file').val(), + lineNumber: Number($('#add-breakpoint-line').val()) + }); + }); + div.append(sub); + sub = $('<span id="breakpoint-hint"></span>').text('or dblclick source'); + div.append(sub); + elem.append(div); + + // Active breakpoints follow + msg.breakpoints.forEach(function (bp) { + var div; + var sub; + + div = $('<div class="breakpoint-line"></div>'); + sub = $('<button class="delete-breakpoint-button"></button>').text('Delete'); + sub.on('click', function () { + socket.emit('delete-breakpoint', { + fileName: bp.fileName, + lineNumber: bp.lineNumber + }); + }); + div.append(sub); + sub = $('<a></a>').text((bp.fileName || '?') + ':' + (bp.lineNumber || 0)); + sub.on('click', function () { + activeFileName = bp.fileName || ''; + activeLine = bp.lineNumber || 1; + activeHighlight = activeLine; + requestSourceRefetch(); + }); + div.append(sub); + elem.append(div); + }); + + forceButtonUpdate = true; + doUiUpdate(); +}); + +socket.on('eval-result', function (msg) { + $('#eval-output').text((msg.error ? 'ERROR: ' : '') + msg.result); + + // Remove eval button "pulsating" glow when we get a result + $('#eval-button').removeClass('pending'); +}); + +socket.on('getvar-result', function (msg) { + $('#var-output').text(msg.found ? msg.result : 'NOTFOUND'); +}); + +socket.on('bytecode', function (msg) { + var elem, div; + var div; + + elem = $('#bytecode-preformatted'); + elem.empty(); + + msg.preformatted.split('\n').forEach(function (line, idx) { + div = $('<div></div>'); + div.text(line); + elem.append(div); + }); + + bytecodeIdxHighlight = null; + bytecodeIdxInstr = msg.idxPreformattedInstructions; +}); + +$('#stepinto-button').click(function () { + socket.emit('stepinto', {}); +}); + +$('#stepover-button').click(function () { + socket.emit('stepover', {}); +}); + +$('#stepout-button').click(function () { + socket.emit('stepout', {}); +}); + +$('#pause-button').click(function () { + socket.emit('pause', {}); + + // Pause may take seconds to complete so indicate it is pending. + $('#pause-button').addClass('pending'); +}); + +$('#resume-button').click(function () { + socket.emit('resume', {}); +}); + +$('#attach-button').click(function () { + socket.emit('attach', {}); +}); + +$('#detach-button').click(function () { + socket.emit('detach', {}); +}); + +$('#about-button').click(function () { + $('#about-dialog').dialog('open'); +}); + +$('#show-bytecode-button').click(function () { + bytecodeDialogOpen = true; + $('#bytecode-dialog').dialog('open'); + + elem = $('#bytecode-preformatted'); + elem.empty().text('Loading bytecode...'); + + socket.emit('get-bytecode', {}); +}); + +function submitEval() { + socket.emit('eval', { input: $('#eval-input').val() }); + + // Eval may take seconds to complete so indicate it is pending. + $('#eval-button').addClass('pending'); +} + +$('#eval-button').click(function () { + submitEval(); + $('#eval-input').val(''); +}); + +$('#getvar-button').click(function () { + socket.emit('getvar', { varname: $('#varname-input').val() }); +}); + +$('#putvar-button').click(function () { + // The variable value is parsed as JSON right now, but it'd be better to + // also be able to parse buffer values etc. + var val = JSON.parse($('#varvalue-input').val()); + socket.emit('putvar', { varname: $('#varname-input').val(), varvalue: val }); +}); + +$('#source-code').dblclick(function (event) { + var target = event.target; + var elems = $('#source-code div'); + var i, n; + var line = 0; + + // XXX: any faster way; elems doesn't have e.g. indexOf() + for (i = 0, n = elems.length; i < n; i++) { + if (target === elems[i]) { + line = i + 1; + } + } + + socket.emit('toggle-breakpoint', { + fileName: loadedFileName, + lineNumber: line + }); +}); + +function setSourceText(data) { + var elem, div; + + elem = $('#source-code'); + elem.empty(); + data.split('\n').forEach(function (line) { + div = $('<div></div>'); + div.text(line); + elem.append(div); + }); + + sourceEditedLines = []; +} + +function setSourceSelect(fileName) { + var elem; + var i, n, t; + + if (fileName == null) { + $('#source-select').val('__none__'); + return; + } + + elem = $('#source-select option'); + for (i = 0, n = elem.length; i < n; i++) { + // Exact match is required. + t = $(elem[i]).val(); + if (t === fileName) { + $('#source-select').val(t); + return; + } + } +} + +/* + * AJAX request handling to fetch source files + */ + +function requestSourceRefetch() { + // If previous update is pending, abort and start a new one. + if (sourceFetchXhr) { + sourceFetchXhr.abort(); + sourceFetchXhr = null; + } + + // Make copies of the requested file/line so that we have the proper + // values in case they've changed. + var fileName = activeFileName; + var lineNumber = activeLine; + + // AJAX request for the source. + sourceFetchXhr = $.ajax({ + type: 'POST', + url: '/source', + data: JSON.stringify({ fileName: fileName }), + contentType: 'application/json', + success: function (data, status, jqxhr) { + var elem; + + sourceFetchXhr = null; + + loadedFileName = fileName; + loadedLineCount = data.split('\n').length; // XXX: ignore issue with last empty line for now + loadedFileExecuting = (loadedFileName === currFileName); + setSourceText(data); + setSourceSelect(fileName); + loadedLinePending = activeLine || 1; + highlightLine = activeHighlight; // may be null + activeLine = null; + activeHighlight = null; + doSourceUpdate(); + + // XXX: hacky transition, make source change visible + $('#source-pre').fadeTo('fast', 0.25, function () { + $('#source-pre').fadeTo('fast', 1.0); + }); + }, + error: function (jqxhr, status, err) { + // Not worth alerting about because source fetch errors happen + // all the time, e.g. for dynamically evaluated code. + + sourceFetchXhr = null; + + // XXX: prevent retry of no-such-file by negative caching? + loadedFileName = fileName; + loadedLineCount = 1; + loadedFileExecuting = false; + setSourceText('// Cannot load source file: ' + fileName); + setSourceSelect(null); + loadedLinePending = 1; + activeLine = null; + activeHighlight = null; + doSourceUpdate(); + + // XXX: error transition here + $('#source-pre').fadeTo('fast', 0.25, function () { + $('#source-pre').fadeTo('fast', 1.0); + }); + }, + dataType: 'text' + }); +} + +/* + * AJAX request for fetching the source list + */ + +function fetchSourceList() { + $.ajax({ + type: 'POST', + url: '/sourceList', + data: JSON.stringify({}), + contentType: 'application/json', + success: function (data, status, jqxhr) { + var elem = $('#source-select'); + + data = JSON.parse(data); + + elem.empty(); + var opt = $('<option></option>').attr({ 'value': '__none__' }).text('No source file selected'); + elem.append(opt); + data.forEach(function (ent) { + var opt = $('<option></option>').attr({ 'value': ent }).text(ent); + elem.append(opt); + }); + elem.change(function () { + activeFileName = elem.val(); + activeLine = 1; + requestSourceRefetch(); + }); + }, + error: function (jqxhr, status, err) { + // This is worth alerting about as the UI is somewhat unusable + // if we don't get a source list. + + alert('Failed to load source list: ' + err); + }, + dataType: 'text' + }); +} + +/* + * Initialization + */ + +$(document).ready(function () { + var showAbout = true; + + // About dialog, shown automatically on first startup. + $('#about-dialog').dialog({ + autoOpen: false, + hide: 'fade', // puff + show: 'fade', // slide, puff + width: 500, + height: 300 + }); + + // Bytecode dialog + $('#bytecode-dialog').dialog({ + autoOpen: false, + hide: 'fade', // puff + show: 'fade', // slide, puff + width: 700, + height: 600, + close: function () { + bytecodeDialogOpen = false; + bytecodeIdxHighlight = null; + bytecodeIdxInstr = 0; + } + }); + + // http://diveintohtml5.info/storage.html + if (typeof localStorage !== 'undefined') { + if (localStorage.getItem('about-shown')) { + showAbout = false; + } else { + localStorage.setItem('about-shown', 'yes'); + } + } + if (showAbout) { + $('#about-dialog').dialog('open'); + } + + // onclick handler for exec status text + function loadCurrFunc() { + activeFileName = currFileName; + activeLine = currLine; + requestSourceRefetch(); + } + $('#exec-other').on('click', loadCurrFunc); + + // Enter handling for eval input + // https://forum.jquery.com/topic/bind-html-input-to-enter-key-keypress + $('#eval-input').keypress(function (event) { + if (event.keyCode == 13) { + submitEval(); + $('#eval-input').val(''); + } + }); + + // Eval watch handling + $('#eval-watch').change(function () { + // nop + }); + + forceButtonUpdate = true; + doUiUpdate(); +}); http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/a9485aeb/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/duk_build_meta.json ---------------------------------------------------------------------- diff --git a/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/duk_build_meta.json b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/duk_build_meta.json new file mode 100644 index 0000000..c2e80bb --- /dev/null +++ b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/duk_build_meta.json @@ -0,0 +1,1349 @@ +{ + "builtin_strings": [ + "Undefined", + "Null", + "Arguments", + "Object", + "Function", + "Array", + "String", + "Boolean", + "Number", + "Date", + "RegExp", + "Error", + "Math", + "JSON", + "", + "ArrayBuffer", + "DataView", + "Int8Array", + "Uint8Array", + "Uint8ClampedArray", + "Int16Array", + "Uint16Array", + "Int32Array", + "Uint32Array", + "Float32Array", + "Float64Array", + "global", + "ObjEnv", + "DecEnv", + "Buffer", + "Pointer", + "Thread", + "eval", + "defineProperty", + "value", + "writable", + "configurable", + "enumerable", + "join", + "toLocaleString", + "valueOf", + "toUTCString", + "toISOString", + "toGMTString", + "source", + "ignoreCase", + "multiline", + "lastIndex", + "(?:)", + "index", + "prototype", + "constructor", + "message", + "boolean", + "number", + "string", + "object", + "undefined", + "NaN", + "Infinity", + "-Infinity", + "-0", + ",", + " ", + "\n ", + "[...]", + "Invalid Date", + "arguments", + "callee", + "caller", + "has", + "get", + "deleteProperty", + "enumerate", + "ownKeys", + "setPrototypeOf", + "__proto__", + "require", + "id", + "exports", + "filename", + "toString", + "toJSON", + "type", + "data", + "length", + "byteLength", + "byteOffset", + "BYTES_PER_ELEMENT", + "set", + "stack", + "pc", + "lineNumber", + "\u00ffTracedata", + "name", + "fileName", + "buffer", + "pointer", + "\u00ffValue", + "\u00ffNext", + "\u00ffBytecode", + "\u00ffFormals", + "\u00ffVarmap", + "\u00ffLexenv", + "\u00ffVarenv", + "\u00ffSource", + "\u00ffPc2line", + "\u00ffArgs", + "\u00ffMap", + "\u00ffFinalizer", + "\u00ffHandler", + "\u00ffCallee", + "\u00ffThread", + "\u00ffRegbase", + "\u00ffTarget", + "\u00ffThis", + "compile", + "input", + "errCreate", + "errThrow", + "modSearch", + "modLoaded", + "env", + "hex", + "base64", + "jx", + "jc", + "resume", + "fmt", + "raw", + "trace", + "debug", + "info", + "warn", + "error", + "fatal", + "n", + "l", + "clog", + "toLogString", + "{\"_undef\":true}", + "{\"_nan\":true}", + "{\"_inf\":true}", + "{\"_ninf\":true}", + "{\"_func\":true}", + "{_func:true}", + "break", + "case", + "catch", + "continue", + "debugger", + "default", + "delete", + "do", + "else", + "finally", + "for", + "function", + "if", + "in", + "instanceof", + "new", + "return", + "switch", + "this", + "throw", + "try", + "typeof", + "var", + "const", + "void", + "while", + "with", + "class", + "enum", + "export", + "extends", + "import", + "super", + "null", + "true", + "false", + "implements", + "interface", + "let", + "package", + "private", + "protected", + "public", + "static", + "yield" + ], + "builtin_strings_base64": [ + "VW5kZWZpbmVk", + "TnVsbA==", + "QXJndW1lbnRz", + "T2JqZWN0", + "RnVuY3Rpb24=", + "QXJyYXk=", + "U3RyaW5n", + "Qm9vbGVhbg==", + "TnVtYmVy", + "RGF0ZQ==", + "UmVnRXhw", + "RXJyb3I=", + "TWF0aA==", + "SlNPTg==", + "", + "QXJyYXlCdWZmZXI=", + "RGF0YVZpZXc=", + "SW50OEFycmF5", + "VWludDhBcnJheQ==", + "VWludDhDbGFtcGVkQXJyYXk=", + "SW50MTZBcnJheQ==", + "VWludDE2QXJyYXk=", + "SW50MzJBcnJheQ==", + "VWludDMyQXJyYXk=", + "RmxvYXQzMkFycmF5", + "RmxvYXQ2NEFycmF5", + "Z2xvYmFs", + "T2JqRW52", + "RGVjRW52", + "QnVmZmVy", + "UG9pbnRlcg==", + "VGhyZWFk", + "ZXZhbA==", + "ZGVmaW5lUHJvcGVydHk=", + "dmFsdWU=", + "d3JpdGFibGU=", + "Y29uZmlndXJhYmxl", + "ZW51bWVyYWJsZQ==", + "am9pbg==", + "dG9Mb2NhbGVTdHJpbmc=", + "dmFsdWVPZg==", + "dG9VVENTdHJpbmc=", + "dG9JU09TdHJpbmc=", + "dG9HTVRTdHJpbmc=", + "c291cmNl", + "aWdub3JlQ2FzZQ==", + "bXVsdGlsaW5l", + "bGFzdEluZGV4", + "KD86KQ==", + "aW5kZXg=", + "cHJvdG90eXBl", + "Y29uc3RydWN0b3I=", + "bWVzc2FnZQ==", + "Ym9vbGVhbg==", + "bnVtYmVy", + "c3RyaW5n", + "b2JqZWN0", + "dW5kZWZpbmVk", + "TmFO", + "SW5maW5pdHk=", + "LUluZmluaXR5", + "LTA=", + "LA==", + "IA==", + "CiAgICA=", + "Wy4uLl0=", + "SW52YWxpZCBEYXRl", + "YXJndW1lbnRz", + "Y2FsbGVl", + "Y2FsbGVy", + "aGFz", + "Z2V0", + "ZGVsZXRlUHJvcGVydHk=", + "ZW51bWVyYXRl", + "b3duS2V5cw==", + "c2V0UHJvdG90eXBlT2Y=", + "X19wcm90b19f", + "cmVxdWlyZQ==", + "aWQ=", + "ZXhwb3J0cw==", + "ZmlsZW5hbWU=", + "dG9TdHJpbmc=", + "dG9KU09O", + "dHlwZQ==", + "ZGF0YQ==", + "bGVuZ3Ro", + "Ynl0ZUxlbmd0aA==", + "Ynl0ZU9mZnNldA==", + "QllURVNfUEVSX0VMRU1FTlQ=", + "c2V0", + "c3RhY2s=", + "cGM=", + "bGluZU51bWJlcg==", + "/1RyYWNlZGF0YQ==", + "bmFtZQ==", + "ZmlsZU5hbWU=", + "YnVmZmVy", + "cG9pbnRlcg==", + "/1ZhbHVl", + "/05leHQ=", + "/0J5dGVjb2Rl", + "/0Zvcm1hbHM=", + "/1Zhcm1hcA==", + "/0xleGVudg==", + "/1ZhcmVudg==", + "/1NvdXJjZQ==", + "/1BjMmxpbmU=", + "/0FyZ3M=", + "/01hcA==", + "/0ZpbmFsaXplcg==", + "/0hhbmRsZXI=", + "/0NhbGxlZQ==", + "/1RocmVhZA==", + "/1JlZ2Jhc2U=", + "/1RhcmdldA==", + "/1RoaXM=", + "Y29tcGlsZQ==", + "aW5wdXQ=", + "ZXJyQ3JlYXRl", + "ZXJyVGhyb3c=", + "bW9kU2VhcmNo", + "bW9kTG9hZGVk", + "ZW52", + "aGV4", + "YmFzZTY0", + "ang=", + "amM=", + "cmVzdW1l", + "Zm10", + "cmF3", + "dHJhY2U=", + "ZGVidWc=", + "aW5mbw==", + "d2Fybg==", + "ZXJyb3I=", + "ZmF0YWw=", + "bg==", + "bA==", + "Y2xvZw==", + "dG9Mb2dTdHJpbmc=", + "eyJfdW5kZWYiOnRydWV9", + "eyJfbmFuIjp0cnVlfQ==", + "eyJfaW5mIjp0cnVlfQ==", + "eyJfbmluZiI6dHJ1ZX0=", + "eyJfZnVuYyI6dHJ1ZX0=", + "e19mdW5jOnRydWV9", + "YnJlYWs=", + "Y2FzZQ==", + "Y2F0Y2g=", + "Y29udGludWU=", + "ZGVidWdnZXI=", + "ZGVmYXVsdA==", + "ZGVsZXRl", + "ZG8=", + "ZWxzZQ==", + "ZmluYWxseQ==", + "Zm9y", + "ZnVuY3Rpb24=", + "aWY=", + "aW4=", + "aW5zdGFuY2VvZg==", + "bmV3", + "cmV0dXJu", + "c3dpdGNo", + "dGhpcw==", + "dGhyb3c=", + "dHJ5", + "dHlwZW9m", + "dmFy", + "Y29uc3Q=", + "dm9pZA==", + "d2hpbGU=", + "d2l0aA==", + "Y2xhc3M=", + "ZW51bQ==", + "ZXhwb3J0", + "ZXh0ZW5kcw==", + "aW1wb3J0", + "c3VwZXI=", + "bnVsbA==", + "dHJ1ZQ==", + "ZmFsc2U=", + "aW1wbGVtZW50cw==", + "aW50ZXJmYWNl", + "bGV0", + "cGFja2FnZQ==", + "cHJpdmF0ZQ==", + "cHJvdGVjdGVk", + "cHVibGlj", + "c3RhdGlj", + "eWllbGQ=" + ], + "builtin_strings_info": [ + { + "base64": "VW5kZWZpbmVk", + "define": "DUK_STRIDX_UC_UNDEFINED", + "plain": "Undefined" + }, + { + "base64": "TnVsbA==", + "define": "DUK_STRIDX_UC_NULL", + "plain": "Null" + }, + { + "base64": "QXJndW1lbnRz", + "define": "DUK_STRIDX_UC_ARGUMENTS", + "plain": "Arguments" + }, + { + "base64": "T2JqZWN0", + "define": "DUK_STRIDX_UC_OBJECT", + "plain": "Object" + }, + { + "base64": "RnVuY3Rpb24=", + "define": "DUK_STRIDX_UC_FUNCTION", + "plain": "Function" + }, + { + "base64": "QXJyYXk=", + "define": "DUK_STRIDX_ARRAY", + "plain": "Array" + }, + { + "base64": "U3RyaW5n", + "define": "DUK_STRIDX_UC_STRING", + "plain": "String" + }, + { + "base64": "Qm9vbGVhbg==", + "define": "DUK_STRIDX_UC_BOOLEAN", + "plain": "Boolean" + }, + { + "base64": "TnVtYmVy", + "define": "DUK_STRIDX_UC_NUMBER", + "plain": "Number" + }, + { + "base64": "RGF0ZQ==", + "define": "DUK_STRIDX_DATE", + "plain": "Date" + }, + { + "base64": "UmVnRXhw", + "define": "DUK_STRIDX_REG_EXP", + "plain": "RegExp" + }, + { + "base64": "RXJyb3I=", + "define": "DUK_STRIDX_UC_ERROR", + "plain": "Error" + }, + { + "base64": "TWF0aA==", + "define": "DUK_STRIDX_MATH", + "plain": "Math" + }, + { + "base64": "SlNPTg==", + "define": "DUK_STRIDX_JSON", + "plain": "JSON" + }, + { + "base64": "", + "define": "DUK_STRIDX_EMPTY_STRING", + "plain": "" + }, + { + "base64": "QXJyYXlCdWZmZXI=", + "define": "DUK_STRIDX_ARRAY_BUFFER", + "plain": "ArrayBuffer" + }, + { + "base64": "RGF0YVZpZXc=", + "define": "DUK_STRIDX_DATA_VIEW", + "plain": "DataView" + }, + { + "base64": "SW50OEFycmF5", + "define": "DUK_STRIDX_INT8_ARRAY", + "plain": "Int8Array" + }, + { + "base64": "VWludDhBcnJheQ==", + "define": "DUK_STRIDX_UINT8_ARRAY", + "plain": "Uint8Array" + }, + { + "base64": "VWludDhDbGFtcGVkQXJyYXk=", + "define": "DUK_STRIDX_UINT8_CLAMPED_ARRAY", + "plain": "Uint8ClampedArray" + }, + { + "base64": "SW50MTZBcnJheQ==", + "define": "DUK_STRIDX_INT16_ARRAY", + "plain": "Int16Array" + }, + { + "base64": "VWludDE2QXJyYXk=", + "define": "DUK_STRIDX_UINT16_ARRAY", + "plain": "Uint16Array" + }, + { + "base64": "SW50MzJBcnJheQ==", + "define": "DUK_STRIDX_INT32_ARRAY", + "plain": "Int32Array" + }, + { + "base64": "VWludDMyQXJyYXk=", + "define": "DUK_STRIDX_UINT32_ARRAY", + "plain": "Uint32Array" + }, + { + "base64": "RmxvYXQzMkFycmF5", + "define": "DUK_STRIDX_FLOAT32_ARRAY", + "plain": "Float32Array" + }, + { + "base64": "RmxvYXQ2NEFycmF5", + "define": "DUK_STRIDX_FLOAT64_ARRAY", + "plain": "Float64Array" + }, + { + "base64": "Z2xvYmFs", + "define": "DUK_STRIDX_GLOBAL", + "plain": "global" + }, + { + "base64": "T2JqRW52", + "define": "DUK_STRIDX_OBJ_ENV", + "plain": "ObjEnv" + }, + { + "base64": "RGVjRW52", + "define": "DUK_STRIDX_DEC_ENV", + "plain": "DecEnv" + }, + { + "base64": "QnVmZmVy", + "define": "DUK_STRIDX_UC_BUFFER", + "plain": "Buffer" + }, + { + "base64": "UG9pbnRlcg==", + "define": "DUK_STRIDX_UC_POINTER", + "plain": "Pointer" + }, + { + "base64": "VGhyZWFk", + "define": "DUK_STRIDX_UC_THREAD", + "plain": "Thread" + }, + { + "base64": "ZXZhbA==", + "define": "DUK_STRIDX_EVAL", + "plain": "eval" + }, + { + "base64": "ZGVmaW5lUHJvcGVydHk=", + "define": "DUK_STRIDX_DEFINE_PROPERTY", + "plain": "defineProperty" + }, + { + "base64": "dmFsdWU=", + "define": "DUK_STRIDX_VALUE", + "plain": "value" + }, + { + "base64": "d3JpdGFibGU=", + "define": "DUK_STRIDX_WRITABLE", + "plain": "writable" + }, + { + "base64": "Y29uZmlndXJhYmxl", + "define": "DUK_STRIDX_CONFIGURABLE", + "plain": "configurable" + }, + { + "base64": "ZW51bWVyYWJsZQ==", + "define": "DUK_STRIDX_ENUMERABLE", + "plain": "enumerable" + }, + { + "base64": "am9pbg==", + "define": "DUK_STRIDX_JOIN", + "plain": "join" + }, + { + "base64": "dG9Mb2NhbGVTdHJpbmc=", + "define": "DUK_STRIDX_TO_LOCALE_STRING", + "plain": "toLocaleString" + }, + { + "base64": "dmFsdWVPZg==", + "define": "DUK_STRIDX_VALUE_OF", + "plain": "valueOf" + }, + { + "base64": "dG9VVENTdHJpbmc=", + "define": "DUK_STRIDX_TO_UTC_STRING", + "plain": "toUTCString" + }, + { + "base64": "dG9JU09TdHJpbmc=", + "define": "DUK_STRIDX_TO_ISO_STRING", + "plain": "toISOString" + }, + { + "base64": "dG9HTVRTdHJpbmc=", + "define": "DUK_STRIDX_TO_GMT_STRING", + "plain": "toGMTString" + }, + { + "base64": "c291cmNl", + "define": "DUK_STRIDX_SOURCE", + "plain": "source" + }, + { + "base64": "aWdub3JlQ2FzZQ==", + "define": "DUK_STRIDX_IGNORE_CASE", + "plain": "ignoreCase" + }, + { + "base64": "bXVsdGlsaW5l", + "define": "DUK_STRIDX_MULTILINE", + "plain": "multiline" + }, + { + "base64": "bGFzdEluZGV4", + "define": "DUK_STRIDX_LAST_INDEX", + "plain": "lastIndex" + }, + { + "base64": "KD86KQ==", + "define": "DUK_STRIDX_ESCAPED_EMPTY_REGEXP", + "plain": "(?:)" + }, + { + "base64": "aW5kZXg=", + "define": "DUK_STRIDX_INDEX", + "plain": "index" + }, + { + "base64": "cHJvdG90eXBl", + "define": "DUK_STRIDX_PROTOTYPE", + "plain": "prototype" + }, + { + "base64": "Y29uc3RydWN0b3I=", + "define": "DUK_STRIDX_CONSTRUCTOR", + "plain": "constructor" + }, + { + "base64": "bWVzc2FnZQ==", + "define": "DUK_STRIDX_MESSAGE", + "plain": "message" + }, + { + "base64": "Ym9vbGVhbg==", + "define": "DUK_STRIDX_LC_BOOLEAN", + "plain": "boolean" + }, + { + "base64": "bnVtYmVy", + "define": "DUK_STRIDX_LC_NUMBER", + "plain": "number" + }, + { + "base64": "c3RyaW5n", + "define": "DUK_STRIDX_LC_STRING", + "plain": "string" + }, + { + "base64": "b2JqZWN0", + "define": "DUK_STRIDX_LC_OBJECT", + "plain": "object" + }, + { + "base64": "dW5kZWZpbmVk", + "define": "DUK_STRIDX_LC_UNDEFINED", + "plain": "undefined" + }, + { + "base64": "TmFO", + "define": "DUK_STRIDX_NAN", + "plain": "NaN" + }, + { + "base64": "SW5maW5pdHk=", + "define": "DUK_STRIDX_INFINITY", + "plain": "Infinity" + }, + { + "base64": "LUluZmluaXR5", + "define": "DUK_STRIDX_MINUS_INFINITY", + "plain": "-Infinity" + }, + { + "base64": "LTA=", + "define": "DUK_STRIDX_MINUS_ZERO", + "plain": "-0" + }, + { + "base64": "LA==", + "define": "DUK_STRIDX_COMMA", + "plain": "," + }, + { + "base64": "IA==", + "define": "DUK_STRIDX_SPACE", + "plain": " " + }, + { + "base64": "CiAgICA=", + "define": "DUK_STRIDX_NEWLINE_4SPACE", + "plain": "\n " + }, + { + "base64": "Wy4uLl0=", + "define": "DUK_STRIDX_BRACKETED_ELLIPSIS", + "plain": "[...]" + }, + { + "base64": "SW52YWxpZCBEYXRl", + "define": "DUK_STRIDX_INVALID_DATE", + "plain": "Invalid Date" + }, + { + "base64": "YXJndW1lbnRz", + "define": "DUK_STRIDX_LC_ARGUMENTS", + "plain": "arguments" + }, + { + "base64": "Y2FsbGVl", + "define": "DUK_STRIDX_CALLEE", + "plain": "callee" + }, + { + "base64": "Y2FsbGVy", + "define": "DUK_STRIDX_CALLER", + "plain": "caller" + }, + { + "base64": "aGFz", + "define": "DUK_STRIDX_HAS", + "plain": "has" + }, + { + "base64": "Z2V0", + "define": "DUK_STRIDX_GET", + "plain": "get" + }, + { + "base64": "ZGVsZXRlUHJvcGVydHk=", + "define": "DUK_STRIDX_DELETE_PROPERTY", + "plain": "deleteProperty" + }, + { + "base64": "ZW51bWVyYXRl", + "define": "DUK_STRIDX_ENUMERATE", + "plain": "enumerate" + }, + { + "base64": "b3duS2V5cw==", + "define": "DUK_STRIDX_OWN_KEYS", + "plain": "ownKeys" + }, + { + "base64": "c2V0UHJvdG90eXBlT2Y=", + "define": "DUK_STRIDX_SET_PROTOTYPE_OF", + "plain": "setPrototypeOf" + }, + { + "base64": "X19wcm90b19f", + "define": "DUK_STRIDX___PROTO__", + "plain": "__proto__" + }, + { + "base64": "cmVxdWlyZQ==", + "define": "DUK_STRIDX_REQUIRE", + "plain": "require" + }, + { + "base64": "aWQ=", + "define": "DUK_STRIDX_ID", + "plain": "id" + }, + { + "base64": "ZXhwb3J0cw==", + "define": "DUK_STRIDX_EXPORTS", + "plain": "exports" + }, + { + "base64": "ZmlsZW5hbWU=", + "define": "DUK_STRIDX_FILENAME", + "plain": "filename" + }, + { + "base64": "dG9TdHJpbmc=", + "define": "DUK_STRIDX_TO_STRING", + "plain": "toString" + }, + { + "base64": "dG9KU09O", + "define": "DUK_STRIDX_TO_JSON", + "plain": "toJSON" + }, + { + "base64": "dHlwZQ==", + "define": "DUK_STRIDX_TYPE", + "plain": "type" + }, + { + "base64": "ZGF0YQ==", + "define": "DUK_STRIDX_DATA", + "plain": "data" + }, + { + "base64": "bGVuZ3Ro", + "define": "DUK_STRIDX_LENGTH", + "plain": "length" + }, + { + "base64": "Ynl0ZUxlbmd0aA==", + "define": "DUK_STRIDX_BYTE_LENGTH", + "plain": "byteLength" + }, + { + "base64": "Ynl0ZU9mZnNldA==", + "define": "DUK_STRIDX_BYTE_OFFSET", + "plain": "byteOffset" + }, + { + "base64": "QllURVNfUEVSX0VMRU1FTlQ=", + "define": "DUK_STRIDX_BYTES_PER_ELEMENT", + "plain": "BYTES_PER_ELEMENT" + }, + { + "base64": "c2V0", + "define": "DUK_STRIDX_SET", + "plain": "set" + }, + { + "base64": "c3RhY2s=", + "define": "DUK_STRIDX_STACK", + "plain": "stack" + }, + { + "base64": "cGM=", + "define": "DUK_STRIDX_PC", + "plain": "pc" + }, + { + "base64": "bGluZU51bWJlcg==", + "define": "DUK_STRIDX_LINE_NUMBER", + "plain": "lineNumber" + }, + { + "base64": "/1RyYWNlZGF0YQ==", + "define": "DUK_STRIDX_INT_TRACEDATA", + "plain": "\u00ffTracedata" + }, + { + "base64": "bmFtZQ==", + "define": "DUK_STRIDX_NAME", + "plain": "name" + }, + { + "base64": "ZmlsZU5hbWU=", + "define": "DUK_STRIDX_FILE_NAME", + "plain": "fileName" + }, + { + "base64": "YnVmZmVy", + "define": "DUK_STRIDX_LC_BUFFER", + "plain": "buffer" + }, + { + "base64": "cG9pbnRlcg==", + "define": "DUK_STRIDX_LC_POINTER", + "plain": "pointer" + }, + { + "base64": "/1ZhbHVl", + "define": "DUK_STRIDX_INT_VALUE", + "plain": "\u00ffValue" + }, + { + "base64": "/05leHQ=", + "define": "DUK_STRIDX_INT_NEXT", + "plain": "\u00ffNext" + }, + { + "base64": "/0J5dGVjb2Rl", + "define": "DUK_STRIDX_INT_BYTECODE", + "plain": "\u00ffBytecode" + }, + { + "base64": "/0Zvcm1hbHM=", + "define": "DUK_STRIDX_INT_FORMALS", + "plain": "\u00ffFormals" + }, + { + "base64": "/1Zhcm1hcA==", + "define": "DUK_STRIDX_INT_VARMAP", + "plain": "\u00ffVarmap" + }, + { + "base64": "/0xleGVudg==", + "define": "DUK_STRIDX_INT_LEXENV", + "plain": "\u00ffLexenv" + }, + { + "base64": "/1ZhcmVudg==", + "define": "DUK_STRIDX_INT_VARENV", + "plain": "\u00ffVarenv" + }, + { + "base64": "/1NvdXJjZQ==", + "define": "DUK_STRIDX_INT_SOURCE", + "plain": "\u00ffSource" + }, + { + "base64": "/1BjMmxpbmU=", + "define": "DUK_STRIDX_INT_PC2LINE", + "plain": "\u00ffPc2line" + }, + { + "base64": "/0FyZ3M=", + "define": "DUK_STRIDX_INT_ARGS", + "plain": "\u00ffArgs" + }, + { + "base64": "/01hcA==", + "define": "DUK_STRIDX_INT_MAP", + "plain": "\u00ffMap" + }, + { + "base64": "/0ZpbmFsaXplcg==", + "define": "DUK_STRIDX_INT_FINALIZER", + "plain": "\u00ffFinalizer" + }, + { + "base64": "/0hhbmRsZXI=", + "define": "DUK_STRIDX_INT_HANDLER", + "plain": "\u00ffHandler" + }, + { + "base64": "/0NhbGxlZQ==", + "define": "DUK_STRIDX_INT_CALLEE", + "plain": "\u00ffCallee" + }, + { + "base64": "/1RocmVhZA==", + "define": "DUK_STRIDX_INT_THREAD", + "plain": "\u00ffThread" + }, + { + "base64": "/1JlZ2Jhc2U=", + "define": "DUK_STRIDX_INT_REGBASE", + "plain": "\u00ffRegbase" + }, + { + "base64": "/1RhcmdldA==", + "define": "DUK_STRIDX_INT_TARGET", + "plain": "\u00ffTarget" + }, + { + "base64": "/1RoaXM=", + "define": "DUK_STRIDX_INT_THIS", + "plain": "\u00ffThis" + }, + { + "base64": "Y29tcGlsZQ==", + "define": "DUK_STRIDX_COMPILE", + "plain": "compile" + }, + { + "base64": "aW5wdXQ=", + "define": "DUK_STRIDX_INPUT", + "plain": "input" + }, + { + "base64": "ZXJyQ3JlYXRl", + "define": "DUK_STRIDX_ERR_CREATE", + "plain": "errCreate" + }, + { + "base64": "ZXJyVGhyb3c=", + "define": "DUK_STRIDX_ERR_THROW", + "plain": "errThrow" + }, + { + "base64": "bW9kU2VhcmNo", + "define": "DUK_STRIDX_MOD_SEARCH", + "plain": "modSearch" + }, + { + "base64": "bW9kTG9hZGVk", + "define": "DUK_STRIDX_MOD_LOADED", + "plain": "modLoaded" + }, + { + "base64": "ZW52", + "define": "DUK_STRIDX_ENV", + "plain": "env" + }, + { + "base64": "aGV4", + "define": "DUK_STRIDX_HEX", + "plain": "hex" + }, + { + "base64": "YmFzZTY0", + "define": "DUK_STRIDX_BASE64", + "plain": "base64" + }, + { + "base64": "ang=", + "define": "DUK_STRIDX_JX", + "plain": "jx" + }, + { + "base64": "amM=", + "define": "DUK_STRIDX_JC", + "plain": "jc" + }, + { + "base64": "cmVzdW1l", + "define": "DUK_STRIDX_RESUME", + "plain": "resume" + }, + { + "base64": "Zm10", + "define": "DUK_STRIDX_FMT", + "plain": "fmt" + }, + { + "base64": "cmF3", + "define": "DUK_STRIDX_RAW", + "plain": "raw" + }, + { + "base64": "dHJhY2U=", + "define": "DUK_STRIDX_LC_TRACE", + "plain": "trace" + }, + { + "base64": "ZGVidWc=", + "define": "DUK_STRIDX_LC_DEBUG", + "plain": "debug" + }, + { + "base64": "aW5mbw==", + "define": "DUK_STRIDX_LC_INFO", + "plain": "info" + }, + { + "base64": "d2Fybg==", + "define": "DUK_STRIDX_LC_WARN", + "plain": "warn" + }, + { + "base64": "ZXJyb3I=", + "define": "DUK_STRIDX_LC_ERROR", + "plain": "error" + }, + { + "base64": "ZmF0YWw=", + "define": "DUK_STRIDX_LC_FATAL", + "plain": "fatal" + }, + { + "base64": "bg==", + "define": "DUK_STRIDX_LC_N", + "plain": "n" + }, + { + "base64": "bA==", + "define": "DUK_STRIDX_LC_L", + "plain": "l" + }, + { + "base64": "Y2xvZw==", + "define": "DUK_STRIDX_CLOG", + "plain": "clog" + }, + { + "base64": "dG9Mb2dTdHJpbmc=", + "define": "DUK_STRIDX_TO_LOG_STRING", + "plain": "toLogString" + }, + { + "base64": "eyJfdW5kZWYiOnRydWV9", + "define": "DUK_STRIDX_JSON_EXT_UNDEFINED", + "plain": "{\"_undef\":true}" + }, + { + "base64": "eyJfbmFuIjp0cnVlfQ==", + "define": "DUK_STRIDX_JSON_EXT_NAN", + "plain": "{\"_nan\":true}" + }, + { + "base64": "eyJfaW5mIjp0cnVlfQ==", + "define": "DUK_STRIDX_JSON_EXT_POSINF", + "plain": "{\"_inf\":true}" + }, + { + "base64": "eyJfbmluZiI6dHJ1ZX0=", + "define": "DUK_STRIDX_JSON_EXT_NEGINF", + "plain": "{\"_ninf\":true}" + }, + { + "base64": "eyJfZnVuYyI6dHJ1ZX0=", + "define": "DUK_STRIDX_JSON_EXT_FUNCTION1", + "plain": "{\"_func\":true}" + }, + { + "base64": "e19mdW5jOnRydWV9", + "define": "DUK_STRIDX_JSON_EXT_FUNCTION2", + "plain": "{_func:true}" + }, + { + "base64": "YnJlYWs=", + "define": "DUK_STRIDX_BREAK", + "plain": "break" + }, + { + "base64": "Y2FzZQ==", + "define": "DUK_STRIDX_CASE", + "plain": "case" + }, + { + "base64": "Y2F0Y2g=", + "define": "DUK_STRIDX_CATCH", + "plain": "catch" + }, + { + "base64": "Y29udGludWU=", + "define": "DUK_STRIDX_CONTINUE", + "plain": "continue" + }, + { + "base64": "ZGVidWdnZXI=", + "define": "DUK_STRIDX_DEBUGGER", + "plain": "debugger" + }, + { + "base64": "ZGVmYXVsdA==", + "define": "DUK_STRIDX_DEFAULT", + "plain": "default" + }, + { + "base64": "ZGVsZXRl", + "define": "DUK_STRIDX_DELETE", + "plain": "delete" + }, + { + "base64": "ZG8=", + "define": "DUK_STRIDX_DO", + "plain": "do" + }, + { + "base64": "ZWxzZQ==", + "define": "DUK_STRIDX_ELSE", + "plain": "else" + }, + { + "base64": "ZmluYWxseQ==", + "define": "DUK_STRIDX_FINALLY", + "plain": "finally" + }, + { + "base64": "Zm9y", + "define": "DUK_STRIDX_FOR", + "plain": "for" + }, + { + "base64": "ZnVuY3Rpb24=", + "define": "DUK_STRIDX_LC_FUNCTION", + "plain": "function" + }, + { + "base64": "aWY=", + "define": "DUK_STRIDX_IF", + "plain": "if" + }, + { + "base64": "aW4=", + "define": "DUK_STRIDX_IN", + "plain": "in" + }, + { + "base64": "aW5zdGFuY2VvZg==", + "define": "DUK_STRIDX_INSTANCEOF", + "plain": "instanceof" + }, + { + "base64": "bmV3", + "define": "DUK_STRIDX_NEW", + "plain": "new" + }, + { + "base64": "cmV0dXJu", + "define": "DUK_STRIDX_RETURN", + "plain": "return" + }, + { + "base64": "c3dpdGNo", + "define": "DUK_STRIDX_SWITCH", + "plain": "switch" + }, + { + "base64": "dGhpcw==", + "define": "DUK_STRIDX_THIS", + "plain": "this" + }, + { + "base64": "dGhyb3c=", + "define": "DUK_STRIDX_THROW", + "plain": "throw" + }, + { + "base64": "dHJ5", + "define": "DUK_STRIDX_TRY", + "plain": "try" + }, + { + "base64": "dHlwZW9m", + "define": "DUK_STRIDX_TYPEOF", + "plain": "typeof" + }, + { + "base64": "dmFy", + "define": "DUK_STRIDX_VAR", + "plain": "var" + }, + { + "base64": "Y29uc3Q=", + "define": "DUK_STRIDX_CONST", + "plain": "const" + }, + { + "base64": "dm9pZA==", + "define": "DUK_STRIDX_VOID", + "plain": "void" + }, + { + "base64": "d2hpbGU=", + "define": "DUK_STRIDX_WHILE", + "plain": "while" + }, + { + "base64": "d2l0aA==", + "define": "DUK_STRIDX_WITH", + "plain": "with" + }, + { + "base64": "Y2xhc3M=", + "define": "DUK_STRIDX_CLASS", + "plain": "class" + }, + { + "base64": "ZW51bQ==", + "define": "DUK_STRIDX_ENUM", + "plain": "enum" + }, + { + "base64": "ZXhwb3J0", + "define": "DUK_STRIDX_EXPORT", + "plain": "export" + }, + { + "base64": "ZXh0ZW5kcw==", + "define": "DUK_STRIDX_EXTENDS", + "plain": "extends" + }, + { + "base64": "aW1wb3J0", + "define": "DUK_STRIDX_IMPORT", + "plain": "import" + }, + { + "base64": "c3VwZXI=", + "define": "DUK_STRIDX_SUPER", + "plain": "super" + }, + { + "base64": "bnVsbA==", + "define": "DUK_STRIDX_LC_NULL", + "plain": "null" + }, + { + "base64": "dHJ1ZQ==", + "define": "DUK_STRIDX_TRUE", + "plain": "true" + }, + { + "base64": "ZmFsc2U=", + "define": "DUK_STRIDX_FALSE", + "plain": "false" + }, + { + "base64": "aW1wbGVtZW50cw==", + "define": "DUK_STRIDX_IMPLEMENTS", + "plain": "implements" + }, + { + "base64": "aW50ZXJmYWNl", + "define": "DUK_STRIDX_INTERFACE", + "plain": "interface" + }, + { + "base64": "bGV0", + "define": "DUK_STRIDX_LET", + "plain": "let" + }, + { + "base64": "cGFja2FnZQ==", + "define": "DUK_STRIDX_PACKAGE", + "plain": "package" + }, + { + "base64": "cHJpdmF0ZQ==", + "define": "DUK_STRIDX_PRIVATE", + "plain": "private" + }, + { + "base64": "cHJvdGVjdGVk", + "define": "DUK_STRIDX_PROTECTED", + "plain": "protected" + }, + { + "base64": "cHVibGlj", + "define": "DUK_STRIDX_PUBLIC", + "plain": "public" + }, + { + "base64": "c3RhdGlj", + "define": "DUK_STRIDX_STATIC", + "plain": "static" + }, + { + "base64": "eWllbGQ=", + "define": "DUK_STRIDX_YIELD", + "plain": "yield" + } + ], + "comment": "Metadata for Duktape build", + "duk_version": 10502, + "duk_version_string": "1.5.2", + "git_describe": "v1.5.2" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/a9485aeb/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/README.rst ---------------------------------------------------------------------- diff --git a/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/README.rst b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/README.rst new file mode 100644 index 0000000..f254432 --- /dev/null +++ b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/README.rst @@ -0,0 +1,10 @@ +================ +Duktape examples +================ + +Examples for using Duktape. These support user documentation and are +intended as informative illustrations only. + +Examples are unmaintained and are not production quality code. Bugs are +not not necessarily fixed, unless the bug makes the example misleading +as documentation. http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/a9485aeb/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/README.rst ---------------------------------------------------------------------- diff --git a/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/README.rst b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/README.rst new file mode 100644 index 0000000..ed63a13 --- /dev/null +++ b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/README.rst @@ -0,0 +1,10 @@ +===================== +Hybrid pool allocator +===================== + +Example allocator that tries to satisfy memory allocations for small sizes +from a set of fixed pools, but always falls back to malloc/realloc/free if +a larger size is requested or the pools have been exhausted. + +This may be useful to reduce memory churn when the platform allocator does +not handle allocations for a lot of small memory areas efficiently. http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/a9485aeb/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/duk_alloc_hybrid.c ---------------------------------------------------------------------- diff --git a/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/duk_alloc_hybrid.c b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/duk_alloc_hybrid.c new file mode 100644 index 0000000..9235b85 --- /dev/null +++ b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/duk_alloc_hybrid.c @@ -0,0 +1,293 @@ +/* + * Example memory allocator with pool allocation for small sizes and + * fallback into malloc/realloc/free for larger sizes or when the pools + * are exhausted. + * + * Useful to reduce memory churn or work around a platform allocator + * that doesn't handle a lot of small allocations efficiently. + */ + +#include "duktape.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdint.h> + +/* Define to enable some debug printfs. */ +/* #define DUK_ALLOC_HYBRID_DEBUG */ + +typedef struct { + size_t size; + int count; +} pool_size_spec; + +static pool_size_spec pool_sizes[] = { + { 32, 1024 }, + { 48, 2048 }, + { 64, 2048 }, + { 128, 2048 }, + { 256, 512 }, + { 1024, 64 }, + { 2048, 32 } +}; + +#define NUM_POOLS (sizeof(pool_sizes) / sizeof(pool_size_spec)) + +/* This must fit into the smallest pool entry. */ +struct pool_free_entry; +typedef struct pool_free_entry pool_free_entry; +struct pool_free_entry { + pool_free_entry *next; +}; + +typedef struct { + pool_free_entry *free; + char *alloc_start; + char *alloc_end; + size_t size; + int count; +} pool_header; + +typedef struct { + pool_header headers[NUM_POOLS]; + size_t pool_max_size; + char *alloc_start; + char *alloc_end; +} pool_state; + +#define ADDR_IN_STATE_ALLOC(st,p) \ + ((char *) (p) >= (st)->alloc_start && (char *) (p) < (st)->alloc_end) +#define ADDR_IN_HEADER_ALLOC(hdr,p) \ + ((char *) (p) >= (hdr)->alloc_start && (char *) (p) < (hdr)->alloc_end) + +#ifdef DUK_ALLOC_HYBRID_DEBUG +static void dump_pool_state(pool_state *st) { + pool_free_entry *free; + int free_len; + int i; + + printf("=== Pool state: st=%p\n", (void *) st); + for (i = 0; i < (int) NUM_POOLS; i++) { + pool_header *hdr = st->headers + i; + + for (free = hdr->free, free_len = 0; free != NULL; free = free->next) { + free_len++; + } + + printf("[%d]: size %ld, count %ld, used %ld, free list len %ld\n", + i, (long) hdr->size, (long) hdr->count, + (long) (hdr->count - free_len), + (long) free_len); + } +} +#else +static void dump_pool_state(pool_state *st) { + (void) st; +} +#endif + +void *duk_alloc_hybrid_init(void) { + pool_state *st; + size_t total_size, max_size; + int i, j; + char *p; + + st = (pool_state *) malloc(sizeof(pool_state)); + if (!st) { + return NULL; + } + memset((void *) st, 0, sizeof(pool_state)); + st->alloc_start = NULL; + st->alloc_end = NULL; + + for (i = 0, total_size = 0, max_size = 0; i < (int) NUM_POOLS; i++) { +#ifdef DUK_ALLOC_HYBRID_DEBUG + printf("Pool %d: size %ld, count %ld\n", i, (long) pool_sizes[i].size, (long) pool_sizes[i].count); +#endif + total_size += pool_sizes[i].size * pool_sizes[i].count; + if (pool_sizes[i].size > max_size) { + max_size = pool_sizes[i].size; + } + } +#ifdef DUK_ALLOC_HYBRID_DEBUG + printf("Total size %ld, max pool size %ld\n", (long) total_size, (long) max_size); +#endif + + st->alloc_start = (char *) malloc(total_size); + if (!st->alloc_start) { + free(st); + return NULL; + } + st->alloc_end = st->alloc_start + total_size; + st->pool_max_size = max_size; + memset((void *) st->alloc_start, 0, total_size); + + for (i = 0, p = st->alloc_start; i < (int) NUM_POOLS; i++) { + pool_header *hdr = st->headers + i; + + hdr->alloc_start = p; + hdr->alloc_end = p + pool_sizes[i].size * pool_sizes[i].count; + hdr->free = (pool_free_entry *) (void *) p; + hdr->size = pool_sizes[i].size; + hdr->count = pool_sizes[i].count; + + for (j = 0; j < pool_sizes[i].count; j++) { + pool_free_entry *ent = (pool_free_entry *) (void *) p; + if (j == pool_sizes[i].count - 1) { + ent->next = (pool_free_entry *) NULL; + } else { + ent->next = (pool_free_entry *) (void *) (p + pool_sizes[i].size); + } + p += pool_sizes[i].size; + } + } + + dump_pool_state(st); + + /* Use 'st' as udata. */ + return (void *) st; +} + +void *duk_alloc_hybrid(void *udata, duk_size_t size) { + pool_state *st = (pool_state *) udata; + int i; + void *new_ptr; + +#if 0 + dump_pool_state(st); +#endif + + if (size == 0) { + return NULL; + } + if (size > st->pool_max_size) { +#ifdef DUK_ALLOC_HYBRID_DEBUG + printf("alloc fallback: %ld\n", (long) size); +#endif + return malloc(size); + } + + for (i = 0; i < (int) NUM_POOLS; i++) { + pool_header *hdr = st->headers + i; + if (hdr->size < size) { + continue; + } + + if (hdr->free) { +#if 0 + printf("alloc from pool: %ld -> pool size %ld\n", (long) size, (long) hdr->size); +#endif + new_ptr = (void *) hdr->free; + hdr->free = hdr->free->next; + return new_ptr; + } else { +#ifdef DUK_ALLOC_HYBRID_DEBUG + printf("alloc out of pool entries: %ld -> pool size %ld\n", (long) size, (long) hdr->size); +#endif + break; + } + } + +#ifdef DUK_ALLOC_HYBRID_DEBUG + printf("alloc fallback (out of pool): %ld\n", (long) size); +#endif + return malloc(size); +} + +void *duk_realloc_hybrid(void *udata, void *ptr, duk_size_t size) { + pool_state *st = (pool_state *) udata; + void *new_ptr; + int i; + +#if 0 + dump_pool_state(st); +#endif + + if (ADDR_IN_STATE_ALLOC(st, ptr)) { + /* 'ptr' cannot be NULL. */ + for (i = 0; i < (int) NUM_POOLS; i++) { + pool_header *hdr = st->headers + i; + if (ADDR_IN_HEADER_ALLOC(hdr, ptr)) { + if (size <= hdr->size) { + /* Still fits, no shrink support. */ +#if 0 + printf("realloc original from pool: still fits, size %ld, pool size %ld\n", + (long) size, (long) hdr->size); +#endif + return ptr; + } + + new_ptr = duk_alloc_hybrid(udata, size); + if (!new_ptr) { +#ifdef DUK_ALLOC_HYBRID_DEBUG + printf("realloc original from pool: needed larger size, failed to alloc\n"); +#endif + return NULL; + } + memcpy(new_ptr, ptr, hdr->size); + + ((pool_free_entry *) ptr)->next = hdr->free; + hdr->free = (pool_free_entry *) ptr; +#if 0 + printf("realloc original from pool: size %ld, pool size %ld\n", (long) size, (long) hdr->size); +#endif + return new_ptr; + } + } +#ifdef DUK_ALLOC_HYBRID_DEBUG + printf("NEVER HERE\n"); +#endif + return NULL; + } else if (ptr != NULL) { + if (size == 0) { + free(ptr); + return NULL; + } else { +#ifdef DUK_ALLOC_HYBRID_DEBUG + printf("realloc fallback: size %ld\n", (long) size); +#endif + return realloc(ptr, size); + } + } else { +#if 0 + printf("realloc NULL ptr, call alloc: %ld\n", (long) size); +#endif + return duk_alloc_hybrid(udata, size); + } +} + +void duk_free_hybrid(void *udata, void *ptr) { + pool_state *st = (pool_state *) udata; + int i; + +#if 0 + dump_pool_state(st); +#endif + + if (!ADDR_IN_STATE_ALLOC(st, ptr)) { + if (ptr == NULL) { + return; + } +#if 0 + printf("free out of pool: %p\n", (void *) ptr); +#endif + free(ptr); + return; + } + + for (i = 0; i < (int) NUM_POOLS; i++) { + pool_header *hdr = st->headers + i; + if (ADDR_IN_HEADER_ALLOC(hdr, ptr)) { + ((pool_free_entry *) ptr)->next = hdr->free; + hdr->free = (pool_free_entry *) ptr; +#if 0 + printf("free from pool: %p\n", ptr); +#endif + return; + } + } + +#ifdef DUK_ALLOC_HYBRID_DEBUG + printf("NEVER HERE\n"); +#endif +} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/a9485aeb/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/duk_alloc_hybrid.h ---------------------------------------------------------------------- diff --git a/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/duk_alloc_hybrid.h b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/duk_alloc_hybrid.h new file mode 100644 index 0000000..0d631d1 --- /dev/null +++ b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-hybrid/duk_alloc_hybrid.h @@ -0,0 +1,11 @@ +#ifndef DUK_ALLOC_HYBRID_H_INCLUDED +#define DUK_ALLOC_HYBRID_H_INCLUDED + +#include "duktape.h" + +void *duk_alloc_hybrid_init(void); +void *duk_alloc_hybrid(void *udata, duk_size_t size); +void *duk_realloc_hybrid(void *udata, void *ptr, duk_size_t size); +void duk_free_hybrid(void *udata, void *ptr); + +#endif /* DUK_ALLOC_HYBRID_H_INCLUDED */ http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/a9485aeb/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/README.rst ---------------------------------------------------------------------- diff --git a/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/README.rst b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/README.rst new file mode 100644 index 0000000..97c1a32 --- /dev/null +++ b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/README.rst @@ -0,0 +1,7 @@ +====================== +Allocator with logging +====================== + +Example allocator that writes all memory alloc/realloc/free calls into a +log file so that memory usage can replayed later. This is useful to e.g. +optimize pool sizes. http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/a9485aeb/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/duk_alloc_logging.c ---------------------------------------------------------------------- diff --git a/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/duk_alloc_logging.c b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/duk_alloc_logging.c new file mode 100644 index 0000000..a89babf --- /dev/null +++ b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/duk_alloc_logging.c @@ -0,0 +1,138 @@ +/* + * Example memory allocator with machine parseable logging. + * + * Also sizes for reallocs and frees are logged so that the memory + * behavior can be essentially replayed to accurately determine e.g. + * optimal pool sizes for a pooled allocator. + * + * Allocation structure: + * + * [ alloc_hdr | user area ] + * + * ^ ^ + * | `--- pointer returned to Duktape + * `--- underlying malloc ptr + */ + +#include "duktape.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdint.h> + +#define ALLOC_LOG_FILE "/tmp/duk-alloc-log.txt" + +typedef struct { + /* The double value in the union is there to ensure alignment is + * good for IEEE doubles too. In many 32-bit environments 4 bytes + * would be sufficiently aligned and the double value is unnecessary. + */ + union { + size_t sz; + double d; + } u; +} alloc_hdr; + +static FILE *log_file = NULL; + +static void write_log(const char *fmt, ...) { + va_list ap; + + if (!log_file) { + log_file = fopen(ALLOC_LOG_FILE, "wb"); + if (!log_file) { + return; + } + } + + va_start(ap, fmt); + vfprintf(log_file, fmt, ap); + va_end(ap); +} + +void *duk_alloc_logging(void *udata, duk_size_t size) { + alloc_hdr *hdr; + void *ret; + + (void) udata; /* Suppress warning. */ + + if (size == 0) { + write_log("A NULL %ld\n", (long) size); + return NULL; + } + + hdr = (alloc_hdr *) malloc(size + sizeof(alloc_hdr)); + if (!hdr) { + write_log("A FAIL %ld\n", (long) size); + return NULL; + } + hdr->u.sz = size; + ret = (void *) (hdr + 1); + write_log("A %p %ld\n", ret, (long) size); + return ret; +} + +void *duk_realloc_logging(void *udata, void *ptr, duk_size_t size) { + alloc_hdr *hdr; + size_t old_size; + void *t; + void *ret; + + (void) udata; /* Suppress warning. */ + + /* Handle the ptr-NULL vs. size-zero cases explicitly to minimize + * platform assumptions. You can get away with much less in specific + * well-behaving environments. + */ + + if (ptr) { + hdr = (alloc_hdr *) (void *) ((unsigned char *) ptr - sizeof(alloc_hdr)); + old_size = hdr->u.sz; + + if (size == 0) { + write_log("R %p %ld NULL 0\n", ptr, (long) old_size); + free((void *) hdr); + return NULL; + } else { + t = realloc((void *) hdr, size + sizeof(alloc_hdr)); + if (!t) { + write_log("R %p %ld FAIL %ld\n", ptr, (long) old_size, (long) size); + return NULL; + } + hdr = (alloc_hdr *) t; + hdr->u.sz = size; + ret = (void *) (hdr + 1); + write_log("R %p %ld %p %ld\n", ptr, (long) old_size, ret, (long) size); + return ret; + } + } else { + if (size == 0) { + write_log("R NULL 0 NULL 0\n"); + return NULL; + } else { + hdr = (alloc_hdr *) malloc(size + sizeof(alloc_hdr)); + if (!hdr) { + write_log("R NULL 0 FAIL %ld\n", (long) size); + return NULL; + } + hdr->u.sz = size; + ret = (void *) (hdr + 1); + write_log("R NULL 0 %p %ld\n", ret, (long) size); + return ret; + } + } +} + +void duk_free_logging(void *udata, void *ptr) { + alloc_hdr *hdr; + + (void) udata; /* Suppress warning. */ + + if (!ptr) { + write_log("F NULL 0\n"); + return; + } + hdr = (alloc_hdr *) (void *) ((unsigned char *) ptr - sizeof(alloc_hdr)); + write_log("F %p %ld\n", ptr, (long) hdr->u.sz); + free((void *) hdr); +} http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/a9485aeb/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/duk_alloc_logging.h ---------------------------------------------------------------------- diff --git a/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/duk_alloc_logging.h b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/duk_alloc_logging.h new file mode 100644 index 0000000..6700353 --- /dev/null +++ b/thirdparty/civetweb-1.9.1/src/third_party/duktape-1.5.2/examples/alloc-logging/duk_alloc_logging.h @@ -0,0 +1,10 @@ +#ifndef DUK_ALLOC_LOGGING_H_INCLUDED +#define DUK_ALLOC_LOGGING_H_INCLUDED + +#include "duktape.h" + +void *duk_alloc_logging(void *udata, duk_size_t size); +void *duk_realloc_logging(void *udata, void *ptr, duk_size_t size); +void duk_free_logging(void *udata, void *ptr); + +#endif /* DUK_ALLOC_LOGGING_H_INCLUDED */
