answer
stringlengths
15
1.25M
#include <stdlib.h> #include <unistd.h> #include <string.h> #ifdef _WIN32 #include <io.h> #include <fcntl.h> #define pipe(fds) _pipe(fds, 4096, _O_BINARY) #endif #include "libsigrok.h" #include "libsigrok-internal.h" /* Message logging helpers with driver-specific prefix string. */ #define DRIVER_LOG_DOMAIN "demo: " #define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args) #define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args) #define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args) #define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args) #define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args) #define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args) /* TODO: Number of probes should be configurable. */ #define NUM_PROBES 8 #define DEMONAME "Demo device" /* The size of chunks to send through the session bus. */ /* TODO: Should be configurable. */ #define BUFSIZE 4096 /* Supported patterns which we can generate */ enum { /** * Pattern which spells "sigrok" using '0's (with '1's as "background") * when displayed using the 'bits' output format. */ PATTERN_SIGROK, /** Pattern which consists of (pseudo-)random values on all probes. */ PATTERN_RANDOM, /** * Pattern which consists of incrementing numbers. * TODO: Better description. */ PATTERN_INC, /** Pattern where all probes have a low logic state. */ PATTERN_ALL_LOW, /** Pattern where all probes have a high logic state. */ PATTERN_ALL_HIGH, }; /* Private, per-device-instance driver context. */ struct dev_context { int pipe_fds[2]; GIOChannel *channels[2]; uint8_t sample_generator; uint64_t samples_counter; void *session_dev_id; int64_t starttime; }; static const int hwcaps[] = { <API key>, SR_CONF_DEMO_DEV, SR_CONF_SAMPLERATE, <API key>, <API key>, SR_CONF_LIMIT_MSEC, SR_CONF_CONTINUOUS, }; static const struct sr_samplerates samplerates = { .low = SR_HZ(1), .high = SR_GHZ(1), .step = SR_HZ(1), .list = NULL, }; static const char *pattern_strings[] = { "sigrok", "random", "incremental", "all-low", "all-high", NULL, }; /* We name the probes 0-7 on our demo driver. */ static const char *probe_names[NUM_PROBES + 1] = { "0", "1", "2", "3", "4", "5", "6", "7", NULL, }; static uint8_t pattern_sigrok[] = { 0x4c, 0x92, 0x92, 0x92, 0x64, 0x00, 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x82, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x82, 0x82, 0x92, 0x74, 0x00, 0x00, 0x00, 0xfe, 0x12, 0x12, 0x32, 0xcc, 0x00, 0x00, 0x00, 0x7c, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0xfe, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; /* Private, per-device-instance driver context. */ /* TODO: struct context as with the other drivers. */ /* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */ SR_PRIV struct sr_dev_driver demo_driver_info; static struct sr_dev_driver *di = &demo_driver_info; static uint64_t cur_samplerate = SR_KHZ(200); static uint64_t limit_samples = 0; static uint64_t limit_msec = 0; static int default_pattern = PATTERN_SIGROK; static int <API key>(struct sr_dev_inst *sdi, void *cb_data); static int clear_instances(void) { /* Nothing needed so far. */ return SR_OK; } static int hw_init(struct sr_context *sr_ctx) { return std_hw_init(sr_ctx, di, DRIVER_LOG_DOMAIN); } static GSList *hw_scan(GSList *options) { struct sr_dev_inst *sdi; struct sr_probe *probe; struct drv_context *drvc; GSList *devices; int i; (void)options; drvc = di->priv; devices = NULL; sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL); if (!sdi) { sr_err("%s: sr_dev_inst_new failed", __func__); return 0; } sdi->driver = di; for (i = 0; probe_names[i]; i++) { if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, probe_names[i]))) return NULL; sdi->probes = g_slist_append(sdi->probes, probe); } devices = g_slist_append(devices, sdi); drvc->instances = g_slist_append(drvc->instances, sdi); return devices; } static GSList *hw_dev_list(void) { struct drv_context *drvc; drvc = di->priv; return drvc->instances; } static int hw_dev_open(struct sr_dev_inst *sdi) { (void)sdi; /* Nothing needed so far. */ return SR_OK; } static int hw_dev_close(struct sr_dev_inst *sdi) { (void)sdi; /* Nothing needed so far. */ return SR_OK; } static int hw_cleanup(void) { /* Nothing needed so far. */ return SR_OK; } static int config_get(int id, const void **data, const struct sr_dev_inst *sdi) { (void)sdi; switch (id) { case SR_CONF_SAMPLERATE: *data = &cur_samplerate; break; default: return SR_ERR_ARG; } return SR_OK; } static int config_set(int id, const void *value, const struct sr_dev_inst *sdi) { int ret; const char *stropt; (void)sdi; if (id == SR_CONF_SAMPLERATE) { cur_samplerate = *(const uint64_t *)value; sr_dbg("%s: setting samplerate to %" PRIu64, __func__, cur_samplerate); ret = SR_OK; } else if (id == <API key>) { limit_msec = 0; limit_samples = *(const uint64_t *)value; sr_dbg("%s: setting limit_samples to %" PRIu64, __func__, limit_samples); ret = SR_OK; } else if (id == SR_CONF_LIMIT_MSEC) { limit_msec = *(const uint64_t *)value; limit_samples = 0; sr_dbg("%s: setting limit_msec to %" PRIu64, __func__, limit_msec); ret = SR_OK; } else if (id == <API key>) { stropt = value; ret = SR_OK; if (!strcmp(stropt, "sigrok")) { default_pattern = PATTERN_SIGROK; } else if (!strcmp(stropt, "random")) { default_pattern = PATTERN_RANDOM; } else if (!strcmp(stropt, "incremental")) { default_pattern = PATTERN_INC; } else if (!strcmp(stropt, "all-low")) { default_pattern = PATTERN_ALL_LOW; } else if (!strcmp(stropt, "all-high")) { default_pattern = PATTERN_ALL_HIGH; } else { ret = SR_ERR; } sr_dbg("%s: setting pattern to %d", __func__, default_pattern); } else { ret = SR_ERR; } return ret; } static int config_list(int key, const void **data, const struct sr_dev_inst *sdi) { (void)sdi; switch (key) { case <API key>: *data = hwcaps; break; case SR_CONF_SAMPLERATE: *data = &samplerates; break; case <API key>: *data = &pattern_strings; break; default: return SR_ERR_ARG; } return SR_OK; } static void samples_generator(uint8_t *buf, uint64_t size, struct dev_context *devc) { static uint64_t p = 0; uint64_t i; /* TODO: Needed? */ memset(buf, 0, size); switch (devc->sample_generator) { case PATTERN_SIGROK: /* sigrok pattern */ for (i = 0; i < size; i++) { *(buf + i) = ~(pattern_sigrok[p] >> 1); if (++p == 64) p = 0; } break; case PATTERN_RANDOM: /* Random */ for (i = 0; i < size; i++) *(buf + i) = (uint8_t)(rand() & 0xff); break; case PATTERN_INC: /* Simple increment */ for (i = 0; i < size; i++) *(buf + i) = i; break; case PATTERN_ALL_LOW: /* All probes are low */ memset(buf, 0x00, size); break; case PATTERN_ALL_HIGH: /* All probes are high */ memset(buf, 0xff, size); break; default: sr_err("Unknown pattern: %d.", devc->sample_generator); break; } } /* Callback handling data */ static int receive_data(int fd, int revents, void *cb_data) { struct dev_context *devc = cb_data; struct sr_datafeed_packet packet; struct sr_datafeed_logic logic; uint8_t buf[BUFSIZE]; static uint64_t samples_to_send, expected_samplenum, sending_now; int64_t time, elapsed; (void)fd; (void)revents; /* How many "virtual" samples should we have collected by now? */ time = <API key>(); elapsed = time - devc->starttime; expected_samplenum = elapsed * cur_samplerate / 1000000; /* Of those, how many do we still have to send? */ samples_to_send = expected_samplenum - devc->samples_counter; if (limit_samples) { samples_to_send = MIN(samples_to_send, limit_samples - devc->samples_counter); } while (samples_to_send > 0) { sending_now = MIN(samples_to_send, sizeof(buf)); samples_to_send -= sending_now; samples_generator(buf, sending_now, devc); packet.type = SR_DF_LOGIC; packet.payload = &logic; logic.length = sending_now; logic.unitsize = 1; logic.data = buf; sr_session_send(devc->session_dev_id, &packet); devc->samples_counter += sending_now; } if (limit_samples && devc->samples_counter >= limit_samples) { sr_info("Requested number of samples reached."); <API key>(NULL, cb_data); return TRUE; } return TRUE; } static int <API key>(const struct sr_dev_inst *sdi, void *cb_data) { struct sr_datafeed_packet *packet; struct sr_datafeed_header *header; struct dev_context *devc; (void)sdi; sr_dbg("Starting acquisition."); /* TODO: 'devc' is never g_free()'d? */ if (!(devc = g_try_malloc(sizeof(struct dev_context)))) { sr_err("%s: devc malloc failed", __func__); return SR_ERR_MALLOC; } devc->sample_generator = default_pattern; devc->session_dev_id = cb_data; devc->samples_counter = 0; /* * Setting two channels connected by a pipe is a remnant from when the * demo driver generated data in a thread, and collected and sent the * data in the main program loop. * They are kept here because it provides a convenient way of setting * up a timeout-based polling mechanism. */ if (pipe(devc->pipe_fds)) { /* TODO: Better error message. */ sr_err("%s: pipe() failed", __func__); return SR_ERR; } devc->channels[0] = <API key>(devc->pipe_fds[0]); devc->channels[1] = <API key>(devc->pipe_fds[1]); <API key>(devc->channels[0], G_IO_FLAG_NONBLOCK, NULL); /* Set channel encoding to binary (default is UTF-8). */ <API key>(devc->channels[0], NULL, NULL); <API key>(devc->channels[1], NULL, NULL); /* Make channels to unbuffered. */ <API key>(devc->channels[0], FALSE); <API key>(devc->channels[1], FALSE); <API key>(devc->channels[0], G_IO_IN | G_IO_ERR, 40, receive_data, devc); if (!(packet = g_try_malloc(sizeof(struct sr_datafeed_packet)))) { sr_err("%s: packet malloc failed", __func__); return SR_ERR_MALLOC; } if (!(header = g_try_malloc(sizeof(struct sr_datafeed_header)))) { sr_err("%s: header malloc failed", __func__); return SR_ERR_MALLOC; } packet->type = SR_DF_HEADER; packet->payload = header; header->feed_version = 1; gettimeofday(&header->starttime, NULL); sr_session_send(devc->session_dev_id, packet); /* We use this timestamp to decide how many more samples to send. */ devc->starttime = <API key>(); g_free(header); g_free(packet); return SR_OK; } static int <API key>(struct sr_dev_inst *sdi, void *cb_data) { struct dev_context *devc; struct sr_datafeed_packet packet; (void)sdi; devc = cb_data; sr_dbg("Stopping aquisition."); <API key>(devc->channels[0]); <API key>(devc->channels[0], FALSE, NULL); /* Send last packet. */ packet.type = SR_DF_END; sr_session_send(devc->session_dev_id, &packet); return SR_OK; } SR_PRIV struct sr_dev_driver demo_driver_info = { .name = "demo", .longname = "Demo driver and pattern generator", .api_version = 1, .init = hw_init, .cleanup = hw_cleanup, .scan = hw_scan, .dev_list = hw_dev_list, .dev_clear = clear_instances, .config_get = config_get, .config_set = config_set, .config_list = config_list, .dev_open = hw_dev_open, .dev_close = hw_dev_close, .<API key> = <API key>, .<API key> = <API key>, .priv = NULL, };
const Scatter = { /** * renders a graphic * @param: ctx - canvas object * @param: data - object those need to be displayed * @param: point0 - top left point of a chart * @param: point1 - right bottom point of a chart * @param: sIndex - index of drawing chart * @param: map - map object */ $render_scatter:function(ctx, data, point0, point1, sIndex, map){ if(!this._settings.xValue) return; var config = this._settings; var lines = !(config.disableLines || typeof config.disableLines == "undefined"); /*max in min values*/ var limitsY = this._getLimits(); var limitsX = this._getLimits("h","xValue"); /*render scale*/ if(!sIndex){ if(!this.canvases["x"]) this.canvases["x"] = this._createCanvas("axis_x"); if(!this.canvases["y"]) this.canvases["y"] = this._createCanvas("axis_y"); this._drawYAxis(this.canvases["y"].getCanvas(),data,point0,point1,limitsY.min,limitsY.max); this._drawHXAxis(this.canvases["x"].getCanvas(),data,point0,point1,limitsX.min,limitsX.max); } limitsY = {min:config.yAxis.start,max:config.yAxis.end}; limitsX = {min:config.xAxis.start,max:config.xAxis.end}; var params = this._getScatterParams(ctx,data,point0,point1,limitsX,limitsY); this._mapStart = point0; var items = []; for(let i=0;i<data.length;i++){ var x = this.<API key>(params, point1, point0, limitsX, data[i], "X"); var y = this.<API key>(params, point0, point1, limitsY, data[i], "Y"); if(isNaN(x) || isNaN(y)) continue; items.push({ x:x, y:y, index:i }); } var x1, y1, x2, y2, di; for(let i=0; i<items.length; i++){ di = items[i].index; if (lines){ var color = config.line.color.call(this,data[di]); //line start position x1 = items[i].x; y1 = items[i].y; if(i == items.length-1){ //connecting last and first items if (config.shape && items.length>2){ this._drawLine(ctx,x2,y2,items[0].x,items[0].y,color,config.line.width); //render shape on top of the line if(!config.disableItems) this._drawScatterItem(ctx,map, items[0],data[0],sIndex); if(config.fill) this._fillScatterChart(ctx, items, data); } } else { // line between two points x2 = items[i+1].x; y2 = items[i+1].y; this._drawLine(ctx,x1,y1,x2,y2,color,config.line.width); } } //item if(!config.disableItems && items[i]){ this._drawScatterItem(ctx,map, items[i],data[di],sIndex); } } }, _fillScatterChart:function(ctx,points,data){ var pos0,pos1; ctx.globalAlpha= this._settings.alpha.call(this,{}); ctx.beginPath(); for(var i=0;i < points.length;i++){ ctx.fillStyle = this._settings.fill.call(this,data[i]); pos0 = points[i]; pos1 = (points[i+1]|| points[0]); if(!i){ ctx.moveTo(pos0.x,pos0.y); } ctx.lineTo(pos1.x,pos1.y); } ctx.fill(); ctx.globalAlpha=1; }, _getScatterParams:function(ctx, data, point0, point1,limitsX,limitsY){ var params = {}; /*available space*/ params.totalHeight = point1.y-point0.y; /*available width*/ params.totalWidth = point1.x-point0.x; /*unit calculation (y_position = value*unit)*/ this._calcScatterUnit(params,limitsX.min,limitsX.max,params.totalWidth,"X"); this._calcScatterUnit(params,limitsY.min,limitsY.max,params.totalHeight,"Y"); return params; }, _drawScatterItem:function(ctx,map,item,obj,sIndex){ this._drawItem(ctx,item.x,item.y,obj,this._settings.label.call(this,obj),sIndex,map); }, <API key>:function(params, point0, point1, limits, obj, axis){ /*the real value of an object*/ var value = this._settings[axis=="X"?"xValue":"value"].call(this,obj); /*a relative value*/ var valueFactor = params["valueFactor"+axis]; var v = (parseFloat(value||0) - limits.min)*valueFactor; /*a vertical coordinate*/ var unit = params["unit"+axis]; var pos = point1[axis.toLowerCase()] - (axis=="X"?(-1):1)*Math.floor(unit*v); /*the limit of the minimum value is the minimum visible value*/ if(v<0) pos = point1[axis.toLowerCase()]; /*the limit of the maximum value*/ if(value > limits.max) pos = point0[axis.toLowerCase()]; /*the limit of the minimum value*/ if(value < limits.min) pos = point1[axis.toLowerCase()]; return pos; }, _calcScatterUnit:function(p,min,max,size,axis){ var relativeValues = this._getRelativeValue(min,max); axis = (axis||""); p["relValue"+axis] = relativeValues[0]; p["valueFactor"+axis] = relativeValues[1]; p["unit"+axis] = (p["relValue"+axis]?size/p["relValue"+axis]:10); } }; export default Scatter;
<!DOCTYPE HTML PUBLIC "- <!--NewPage <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_06) on Fri Jun 27 05:04:04 GMT 2008 --> <TITLE> Recorder.<API key> (Apache Ant API) </TITLE> <META NAME="date" CONTENT="2008-06-27"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Recorder.<API key> (Apache Ant API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <A NAME="navbar_top"></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/apache/tools/ant/taskdefs/Recorder.ActionChoices.html" title="class in org.apache.tools.ant.taskdefs"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../org/apache/tools/ant/taskdefs/RecorderEntry.html" title="class in org.apache.tools.ant.taskdefs"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/apache/tools/ant/taskdefs/Recorder.<API key>.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Recorder.<API key>.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#<API key>.apache.tools.ant.types.LogLevel">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#<API key>.apache.tools.ant.types.LogLevel">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;METHOD</FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <HR> <H2> <FONT SIZE="-1"> org.apache.tools.ant.taskdefs</FONT> <BR> Class Recorder.<API key></H2> <PRE> java.lang.Object <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html" title="class in org.apache.tools.ant.types">org.apache.tools.ant.types.EnumeratedAttribute</A> <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../../org/apache/tools/ant/types/LogLevel.html" title="class in org.apache.tools.ant.types">org.apache.tools.ant.types.LogLevel</A> <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.tools.ant.taskdefs.Recorder.<API key></B> </PRE> <DL> <DT><B>Enclosing class:</B><DD><A HREF="../../../../../org/apache/tools/ant/taskdefs/Recorder.html" title="class in org.apache.tools.ant.taskdefs">Recorder</A></DD> </DL> <HR> <DL> <DT><PRE>public static class <B>Recorder.<API key></B><DT>extends <A HREF="../../../../../org/apache/tools/ant/types/LogLevel.html" title="class in org.apache.tools.ant.types">LogLevel</A></DL> </PRE> <P> A list of possible values for the <code>setLoglevel()</code> method. Possible values include: error, warn, info, verbose, debug. <P> <P> <HR> <P> <A NAME="field_summary"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Field Summary</B></FONT></TH> </TR> </TABLE> &nbsp;<A NAME="<API key>.apache.tools.ant.types.LogLevel"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="<API key>"> <TH ALIGN="left"><B>Fields inherited from class org.apache.tools.ant.types.<A HREF="../../../../../org/apache/tools/ant/types/LogLevel.html" title="class in org.apache.tools.ant.types">LogLevel</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../../org/apache/tools/ant/types/LogLevel.html#DEBUG">DEBUG</A>, <A HREF="../../../../../org/apache/tools/ant/types/LogLevel.html#ERR">ERR</A>, <A HREF="../../../../../org/apache/tools/ant/types/LogLevel.html#INFO">INFO</A>, <A HREF="../../../../../org/apache/tools/ant/types/LogLevel.html#VERBOSE">VERBOSE</A>, <A HREF="../../../../../org/apache/tools/ant/types/LogLevel.html#WARN">WARN</A></CODE></TD> </TR> </TABLE> &nbsp;<A NAME="<API key>.apache.tools.ant.types.EnumeratedAttribute"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="<API key>"> <TH ALIGN="left"><B>Fields inherited from class org.apache.tools.ant.types.<A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html" title="class in org.apache.tools.ant.types">EnumeratedAttribute</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#value">value</A></CODE></TD> </TR> </TABLE> &nbsp; <A NAME="constructor_summary"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../org/apache/tools/ant/taskdefs/Recorder.<API key>.html#Recorder.<API key>()">Recorder.<API key></A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <A NAME="method_summary"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> </TABLE> &nbsp;<A NAME="<API key>.apache.tools.ant.types.LogLevel"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="<API key>"> <TH ALIGN="left"><B>Methods inherited from class org.apache.tools.ant.types.<A HREF="../../../../../org/apache/tools/ant/types/LogLevel.html" title="class in org.apache.tools.ant.types">LogLevel</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../../org/apache/tools/ant/types/LogLevel.html#getLevel()">getLevel</A>, <A HREF="../../../../../org/apache/tools/ant/types/LogLevel.html#getValues()">getValues</A></CODE></TD> </TR> </TABLE> &nbsp;<A NAME="<API key>.apache.tools.ant.types.EnumeratedAttribute"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="<API key>"> <TH ALIGN="left"><B>Methods inherited from class org.apache.tools.ant.types.<A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html" title="class in org.apache.tools.ant.types">EnumeratedAttribute</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#containsValue(java.lang.String)">containsValue</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#getIndex()">getIndex</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#getInstance(java.lang.Class, java.lang.String)">getInstance</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#getValue()">getValue</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#indexOfValue(java.lang.String)">indexOfValue</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#setValue(java.lang.String)">setValue</A>, <A HREF="../../../../../org/apache/tools/ant/types/EnumeratedAttribute.html#toString()">toString</A></CODE></TD> </TR> </TABLE> &nbsp;<A NAME="<API key>.lang.Object"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="<API key>"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <A NAME="constructor_detail"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="Recorder.<API key>()"></A><H3> Recorder.<API key></H3> <PRE> public <B>Recorder.<API key></B>()</PRE> <DL> </DL> <HR> <A NAME="navbar_bottom"></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="<API key>"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/apache/tools/ant/taskdefs/Recorder.ActionChoices.html" title="class in org.apache.tools.ant.taskdefs"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../org/apache/tools/ant/taskdefs/RecorderEntry.html" title="class in org.apache.tools.ant.taskdefs"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/apache/tools/ant/taskdefs/Recorder.<API key>.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Recorder.<API key>.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#<API key>.apache.tools.ant.types.LogLevel">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#<API key>.apache.tools.ant.types.LogLevel">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;METHOD</FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <HR> </BODY> </HTML>
// graph-tool -- a general graph modification and manipulation thingy // This program is free software; you can redistribute it and/or // as published by the Free Software Foundation; either version 3 // This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #include "<API key>.hh" #include "graph_filtering.hh" #include "graph.hh" #include "graph_selectors.hh" #include "graph_properties.hh" #include <boost/mpl/push_back.hpp> #include <boost/python.hpp> #include "graph_community.hh" using namespace std; using namespace boost; using namespace graph_tool; void community_structure(GraphInterface& g, double gamma, string corr_name, size_t n_iter, double Tmin, double Tmax, size_t Nspins, rng_t& rng, bool verbose, string history_file, boost::any weight, boost::any property) { typedef property_map_types::apply<boost::mpl::vector<int32_t,int64_t>, GraphInterface::vertex_index_map_t, boost::mpl::bool_<false> >::type <API key>; if (!belongs<<API key>>()(property)) throw ValueException("vertex property is not of integer type int32_t " "or int64_t"); typedef <API key><double,GraphInterface::edge_t> weight_map_t; typedef ConstantPropertyMap<double,GraphInterface::edge_t> no_weight_map_t; typedef boost::mpl::vector<weight_map_t,no_weight_map_t> weight_properties; if (weight.empty()) weight = no_weight_map_t(1.0); else weight = weight_map_t(weight, <API key>()); comm_corr_t corr; if (corr_name == "erdos") corr = ERDOS_REYNI; else if (corr_name == "uncorrelated") corr = UNCORRELATED; else if (corr_name == "correlated") corr = CORRELATED; else throw ValueException("invalid correlation type: " + corr_name); run_action<graph_tool::detail::never_directed>() (g, std::bind(<API key>(corr, g.get_vertex_index()), placeholders::_1, placeholders::_2, placeholders::_3, gamma, n_iter, make_pair(Tmin, Tmax), Nspins, std::ref(rng), make_pair(verbose,history_file)), weight_properties(), <API key>()) (weight, property); } double modularity(GraphInterface& g, boost::any weight, boost::any property) { double modularity = 0; typedef ConstantPropertyMap<int32_t,GraphInterface::edge_t> weight_map_t; typedef boost::mpl::push_back<<API key>, weight_map_t>::type edge_props_t; if(weight.empty()) weight = weight_map_t(1); run_action<graph_tool::detail::never_directed>() (g, std::bind(get_modularity(), placeholders::_1, placeholders::_2, placeholders::_3, std::ref(modularity)), edge_props_t(), <API key>()) (weight, property); return modularity; } using namespace boost::python; extern void community_network(GraphInterface& gi, GraphInterface& cgi, boost::any community_property, boost::any <API key>, boost::any vertex_count, boost::any edge_count, boost::any vweight, boost::any eweight, bool self_loops, bool parallel_edges); void <API key>(GraphInterface& gi, GraphInterface& cgi, boost::any community_property, boost::any <API key>, boost::any vweight, boost::python::list avprops); void <API key>(GraphInterface& gi, GraphInterface& cgi, boost::any community_property, boost::any <API key>, boost::any eweight, boost::python::list aeprops, bool self_loops); extern void export_blockmodel(); extern void <API key>(); extern void <API key>(); BOOST_PYTHON_MODULE(<API key>) { def("community_structure", &community_structure); def("modularity", &modularity); def("community_network", &community_network); def("<API key>", &<API key>); def("<API key>", &<API key>); export_blockmodel(); <API key>(); <API key>(); }
package de.dumischbaenger.ws; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlList; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "<API key>", propOrder = { "daysOfWeek", "firstDayOfWeek" }) public class <API key> extends <API key> { @XmlList @XmlElement(name = "DaysOfWeek", required = true) @XmlSchemaType(name = "anySimpleType") protected List<DayOfWeekType> daysOfWeek; @XmlElement(name = "FirstDayOfWeek") @XmlSchemaType(name = "string") protected DayOfWeekType firstDayOfWeek; /** * Gets the value of the daysOfWeek property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the daysOfWeek property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDaysOfWeek().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DayOfWeekType } * * */ public List<DayOfWeekType> getDaysOfWeek() { if (daysOfWeek == null) { daysOfWeek = new ArrayList<DayOfWeekType>(); } return this.daysOfWeek; } /** * Ruft den Wert der <API key> ab. * * @return * possible object is * {@link DayOfWeekType } * */ public DayOfWeekType getFirstDayOfWeek() { return firstDayOfWeek; } /** * Legt den Wert der <API key> fest. * * @param value * allowed object is * {@link DayOfWeekType } * */ public void setFirstDayOfWeek(DayOfWeekType value) { this.firstDayOfWeek = value; } }
#ifndef MSG_POST_OFFICE_H #define MSG_POST_OFFICE_H #include <msg_postbox.h> #include <msg_thread.h> #include <msg_heap.h> #include <msg_util.h> #include <msgh.h> #include <limits.h> #include <stdatomic.h> #define POST_OFFICE_MAGIC 0x0000046702796924U #define <API key> 0 #define <API key> 1 #define <API key> 2 struct post_office_mem { uint64_t magic; size_t size; void *addr; }; struct post_office { struct post_office_mem mem; char name[NAME_MAX]; /* post office name */ struct msg_heap *heap; /* message heap */ uint64_t index_mask; /* bitmask to lock up address index */ uint32_t addresses; /* number of available addresses */ uint32_t rank; /* used to extract the pid sequence number */ uint32_t alloc_tmo; <API key> postboxes[2]; /* in use [0] and peak value [1] */ <API key> index; /* latest used address index */ <API key> bid; pthread_mutex_t lock_attach; pthread_mutex_t lock_hunt; pthread_mutex_t lock_alias; pthread_mutex_t lock_tmo; pthread_mutex_t lock_snoop; struct msg_queue attach; struct msg_queue hunt; struct msg_queue alias; struct msg_queue tmo; struct msg_queue snoop; struct postbox_address postbox_map[1]; /* postbox address map */ }; #define <API key>(snoop, event) \ MSG_BIT_OP(MSG_BIT_CHECK, snoop, event) #define <API key> 0 #define <API key> 1 struct post_office_snoop { uint64_t pid; uint8_t event; } __attribute__((packed)); typedef int (postbox_func)(const union postbox_info *, void *); struct post_office *post_office_get(void); int post_office_create(const char *domain, uint32_t size, uint32_t addresses); int post_office_delete(const char *name); int post_office_open(const char *name); int post_office_close(struct post_office *post_office); int post_office_connect(const char *domain); struct postbox_address *<API key>(union postbox *postbox, uint64_t ppid, uint64_t bid); struct postbox_address *post_office_lock(uint64_t pid); union postbox *<API key>(struct postbox_address *address); void post_office_send(struct msgh *msgh, uint64_t addressee, const char *file, int line); void <API key>(struct postbox_address *address); void <API key>(postbox_func *func, void *user); void post_office_exit(void (*exit_func)(struct msg_heap *heap, struct postbox_address *), uint64_t bid); void <API key>(uint64_t pid); void <API key>(struct postbox_address *address, uint32_t tmo); void <API key>(struct postbox_address *address, uint32_t tmo); void <API key>(uint64_t pid, uint32_t tmo); uint64_t post_office_new_bid(void); uint64_t post_office_get_pid(const char *name, uint64_t bid); uint8_t <API key>(struct postbox_address *address, uint64_t pid); struct msgh *<API key>(uint64_t reference, uint64_t pid); void <API key>(uint64_t type, uint64_t pid); #endif
<?php $valorTotal = 0; $valorTotal += 100; $valorTotal += 25; echo $valorTotal;
<?php require_once(ROOT_DIR . 'Domain/Access/ResourceRepository.php'); class TestResourceDto extends ResourceDto { public function __construct($id = 1, $name = 'testresourcedto', $canAccess = true, $scheduleId = 1, $minLength = null, $resourceTypeId = null, $adminGroupId = null, $<API key> = null, $statusId = 1, $requiresApproval = false, $isCheckInEnabled = false, $isAutoReleased = false, $autoReleaseMinutes = null, $color = null) { parent::__construct($id, $name, $canAccess, $scheduleId, ($minLength == null ? TimeInterval::None() : $minLength), $resourceTypeId, $adminGroupId, $<API key>, $statusId, $requiresApproval, $isCheckInEnabled, $isAutoReleased, $autoReleaseMinutes, $color); } }
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_112-release) on Mon Nov 28 15:49:25 MST 2016 --> <title>R.mipmap</title> <meta name="date" content="2016-11-28"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><! try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="R.mipmap"; } } catch(err) { } </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="topNav"><a name="navbar.top"> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../com/example/ehsueh/appygolucky/package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../com/example/ehsueh/appygolucky/R.menu.html" title="class in com.example.ehsueh.appygolucky"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../com/example/ehsueh/appygolucky/R.raw.html" title="class in com.example.ehsueh.appygolucky"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?com/example/ehsueh/appygolucky/R.mipmap.html" target="_top">Frames</a></li> <li><a href="R.mipmap.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#methods.inherited.from.class.java.lang.Object">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li>Method</li> </ul> </div> <a name="skip.navbar.top"> </a></div> <div class="header"> <div class="subTitle">com.example.ehsueh.appygolucky</div> <h2 title="Class R.mipmap" class="title">Class R.mipmap</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>com.example.ehsueh.appygolucky.R.mipmap</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>Enclosing class:</dt> <dd><a href="../../../../com/example/ehsueh/appygolucky/R.html" title="class in com.example.ehsueh.appygolucky">R</a></dd> </dl> <hr> <br> <pre>public static final class <span class="typeNameLabel">R.mipmap</span> extends java.lang.Object</pre> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="field.summary"> </a> <h3>Field Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> <caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>static int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/example/ehsueh/appygolucky/R.mipmap.html#ic_launcher">ic_launcher</a></span></code>&nbsp;</td> </tr> </table> </li> </ul> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../com/example/ehsueh/appygolucky/R.mipmap.html#mipmap--">mipmap</a></span>()</code>&nbsp;</td> </tr> </table> </li> </ul> <ul class="blockList"> <li class="blockList"><a name="method.summary"> </a> <h3>Method Summary</h3> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="field.detail"> </a> <h3>Field Detail</h3> <a name="ic_launcher"> </a> <ul class="blockListLast"> <li class="blockList"> <h4>ic_launcher</h4> <pre>public static final&nbsp;int ic_launcher</pre> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../constant-values.html#com.example.ehsueh.appygolucky.R.mipmap.ic_launcher">Constant Field Values</a></dd> </dl> </li> </ul> </li> </ul> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> </a> <h3>Constructor Detail</h3> <a name="mipmap </a> <ul class="blockListLast"> <li class="blockList"> <h4>mipmap</h4> <pre>public&nbsp;mipmap()</pre> </li> </ul> </li> </ul> </li> </ul> </div> </div> <div class="bottomNav"><a name="navbar.bottom"> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../com/example/ehsueh/appygolucky/package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../com/example/ehsueh/appygolucky/R.menu.html" title="class in com.example.ehsueh.appygolucky"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../com/example/ehsueh/appygolucky/R.raw.html" title="class in com.example.ehsueh.appygolucky"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?com/example/ehsueh/appygolucky/R.mipmap.html" target="_top">Frames</a></li> <li><a href="R.mipmap.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#methods.inherited.from.class.java.lang.Object">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li>Method</li> </ul> </div> <a name="skip.navbar.bottom"> </a></div> </body> </html>
Joomla 3.3.3 = <API key> Joomla 3.6.4 = <API key> Joomla 3.2.1 = <API key> Joomla 3.7.3 = <API key>
#include <oa_common.h> #include <ASICamera2.h> #include <openastro/camera.h> #include <openastro/util.h> #include "unimplemented.h" #include "oacamprivate.h" #include "ZWASI.h" #include "ZWASI2oacam.h" #include "ZWASI2private.h" static const char *cameraNames[ ZWO_NUM_CAMERAS ] = { "ZWO ASI030MC", "ZWO ASI031MC", "ZWO ASI031MM", "ZWO ASI034MC", "ZWO ASI035MC", "ZWO ASI035MM", "ZWO ASI071MC-Cool", "ZWO ASI071MC Pro", "ZWO ASI094MC-Cool", "ZWO ASI094MC Pro", "ZWO ASI120MC", "ZWO ASI120MC-S", "ZWO ASI120MC-SC", "ZWO ASI120MM", "ZWO ASI120MM Mini", "ZWO ASI120MM-S", "ZWO ASI120MM-SC", "ZWO ASI128MC-Cool", "ZWO ASI128MC Pro", "ZWO ASI130MM", "ZWO ASI136MC", "ZWO ASI174MC", "ZWO ASI174MC-Cool", "ZWO ASI174MM", "ZWO ASI174MM-Cool", "ZWO ASI174MM Mini", "ZWO ASI178MC", "ZWO ASI178MC-Cool", "ZWO ASI178MC-Pro", "ZWO ASI178MM", "ZWO ASI178MM-Cool", "ZWO ASI178MM-Pro", "ZWO ASI183MC", "ZWO ASI183MC-Cool", "ZWO ASI183MC Pro", "ZWO ASI183MM", "ZWO ASI183MM Pro", "ZWO ASI185MC", "ZWO ASI185MC-Cool", "ZWO ASI224MC", "ZWO ASI224MC-Cool", "ZWO ASI226MC", "ZWO ASI2400MC Pro", "ZWO ASI2400MM Pro", "ZWO ASI252MC", "ZWO ASI252MM", "ZWO ASI290MC", "ZWO ASI290MC-Cool", "ZWO ASI290MM", "ZWO ASI290MM-Cool", "ZWO ASI290MM Mini", "ZWO ASI294MC", "ZWO ASI294MC-Cool", "ZWO ASI294MC Pro", "ZWO ASI385MC", "ZWO ASI385MC-Cool", "ZWO ASI1600GT", "ZWO ASI1600MC", "ZWO ASI1600MC-Cool", "ZWO ASI1600MC Pro", "ZWO ASI1600MM", "ZWO ASI1600MM-Cool", "ZWO ASI1600MM Pro" }; /** * Cycle through the cameras reported by the ASI library */ int oaZWASI2GetCameras ( CAMERA_LIST* deviceList, unsigned long featureFlags, int flags ) { unsigned int numFound = 0, i; int ret; const char* currName; oaCameraDevice* dev; DEVICE_INFO* _private; ASI_CAMERA_INFO camInfo; unsigned int typesFound[ ZWO_NUM_CAMERAS + 1 ]; int j, cameraType, found; if (( ret = <API key>()) != OA_ERR_NONE ) { return ret; } if (( numFound = <API key>()) < 1 ) { return 0; } for ( i = 0; i <= ZWO_NUM_CAMERAS; i++ ) { typesFound[i] = 0; } for ( i = 0; i < numFound; i++ ) { <API key> ( &camInfo, i ); currName = camInfo.Name; found = 0; for ( j = 0; !found && j < ZWO_NUM_CAMERAS; j++ ) { if ( !strcmp ( currName, cameraNames[j] )) { found = 1; cameraType = j; } } if ( !found ) { oaLogWarning ( OA_LOG_CAMERA, "%s: Unrecognised camera '%s'", __func__, currName ); cameraType = ZWOCAM_UNKNOWN; } // +1 is so ZWOCAM_UNKNOWN becomes entry 0 typesFound[ cameraType+1 ]++; if (!( dev = malloc ( sizeof ( oaCameraDevice )))) { oaLogError ( OA_LOG_CAMERA, "%s: malloc of camera device memory failed", __func__ ); return -OA_ERR_MEM_ALLOC; } if (!( _private = malloc ( sizeof ( DEVICE_INFO )))) { oaLogError ( OA_LOG_CAMERA, "%s: malloc of camera private memory failed", __func__ ); ( void ) free (( void* ) dev ); return -OA_ERR_MEM_ALLOC; } oaLogDebug ( OA_LOG_CAMERA, "%s: allocated @ %p for camera device", __func__, dev ); <API key> ( dev ); dev->interface = OA_CAM_IF_ZWASI2; if ( typesFound[ cameraType+1 ] == 1 ) { ( void ) strncpy ( dev->deviceName, currName, OA_MAX_NAME_LEN ); } else { snprintf ( dev->deviceName, OA_MAX_NAME_LEN, "%s #%d", currName, typesFound[ cameraType+1 ] ); } _private->devType = cameraType; _private->devIndex = i; dev->_private = _private; dev->initCamera = oaZWASI2InitCamera; if (( ret = <API key> ( deviceList )) < 0 ) { ( void ) free (( void* ) dev ); ( void ) free (( void* ) _private ); return ret; } deviceList->cameraList[ deviceList->numCameras++ ] = dev; } return numFound; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http: <html xmlns="http: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>tests &mdash; WindMultipliers v1.0 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var <API key> = { URL_ROOT: '../', VERSION: '1.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="top" title="WindMultipliers v1.0 documentation" href="../index.html" /> <link rel="prev" title="utilities" href="utilities.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="utilities.html" title="utilities" accesskey="P">previous</a> |</li> <li><a href="../index.html">WindMultipliers v1.0 documentation</a> &raquo;</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="tests"> <h1>tests<a class="headerlink" href=" <div class="section" id="module-__init__"> <span id="init-py"></span><h2>__init__.py<a class="headerlink" href=" </div> <div class="section" id="module-test_combine"> <span id="test-combine-py"></span><h2>test_combine.py<a class="headerlink" href=" <p>Title: test_combine.py Author: Tina Yang, <a class="reference external" href="mailto:tina&#46;yang&#37;&#52;&#48;ga&#46;gov&#46;au">tina<span>&#46;</span>yang<span>&#64;</span>ga<span>&#46;</span>gov<span>&#46;</span>au</a> CreationDate: 2014-06-02 Description: Unit testing module for combine function in shield_mult.py Version: $Rev$ $Id$</p> </div> <div class="section" id="<API key>"> <span id="test-tc2mz-orig-py"></span><h2>test_tc2mz_orig.py<a class="headerlink" href=" <p>Title: test_tc2mz_orig.py Author: Tina Yang, <a class="reference external" href="mailto:tina&#46;yang&#37;&#52;&#48;ga&#46;gov&#46;au">tina<span>&#46;</span>yang<span>&#64;</span>ga<span>&#46;</span>gov<span>&#46;</span>au</a> CreationDate: 2014-06-02 Description: Unit testing module for tc2mz_orig function in terrain_mult.py Version: $Rev$ $Id$</p> </div> </div> <div class="section" id="test-topographic"> <h1>test_topographic<a class="headerlink" href=" <p>contains scenario testing to verify output and and enhancements from AS1170.2 standard</p> <div class="section" id="<API key>.<API key>"> <span id="<API key>"></span><h2><API key>.py<a class="headerlink" href=" <p>Author: Tina Yang, <a class="reference external" href="mailto:tina&#46;yang&#37;&#52;&#48;ga&#46;gov&#46;au">tina<span>&#46;</span>yang<span>&#64;</span>ga<span>&#46;</span>gov<span>&#46;</span>au</a> CreationDate: 2014-05-01 Description: Engineered data used to test topographic multiplier computation Version: $Rev$ $Id$</p> </div> <div class="section" id="<API key>.test_findpeaks"> <span id="test-findpeaks-py"></span><h2>test_findpeaks.py<a class="headerlink" href=" <p>Title: test_findpeaks.py Author: Tina Yang, <a class="reference external" href="mailto:tina&#46;yang&#37;&#52;&#48;ga&#46;gov&#46;au">tina<span>&#46;</span>yang<span>&#64;</span>ga<span>&#46;</span>gov<span>&#46;</span>au</a> CreationDate: 2014-05-01 Description: Unit testing module for findpeaks function in findpeaks.py Version: $Rev$ $Id$</p> </div> <div class="section" id="<API key>.testmultipliercalc"> <span id="<API key>"></span><h2>testmultipliercalc.py<a class="headerlink" href=" <p>Title: testmultipliercalc.py Author: Tina Yang, <a class="reference external" href="mailto:tina&#46;yang&#37;&#52;&#48;ga&#46;gov&#46;au">tina<span>&#46;</span>yang<span>&#64;</span>ga<span>&#46;</span>gov<span>&#46;</span>au</a> CreationDate: 2014-05-01 Description: Unit testing module for multiplier_cal function in</p> <blockquote> <div>multiplier_calc.py</div></blockquote> <p>Version: $Rev$ $Id$</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="<API key>"> <h3><a href="../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">tests</a><ul> <li><a class="reference internal" href="#module-__init__">__init__.py</a></li> <li><a class="reference internal" href="#module-test_combine">test_combine.py</a></li> <li><a class="reference internal" href="#<API key>">test_tc2mz_orig.py</a></li> </ul> </li> <li><a class="reference internal" href="#test-topographic">test_topographic</a><ul> <li><a class="reference internal" href="#<API key>.<API key>"><API key>.py</a></li> <li><a class="reference internal" href="#<API key>.test_findpeaks">test_findpeaks.py</a></li> <li><a class="reference internal" href="#<API key>.testmultipliercalc">testmultipliercalc.py</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="utilities.html" title="previous chapter">utilities</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/docs/tests.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="utilities.html" title="utilities" >previous</a> |</li> <li><a href="../index.html">WindMultipliers v1.0 documentation</a> &raquo;</li> </ul> </div> <div class="footer"> &copy; Copyright 2014, Geoscience Australia. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7. </div> </body> </html>
package net.sf.jasperreports.engine.fill; /** * @author Teodor Danciu (teodord@users.sourceforge.net) */ public interface TextFormat { public String getValueClassName(); public String getPattern(); public String <API key>(); public String getLocaleCode(); public String getTimeZoneId(); }
package shadowmage.ancient_warfare.client.render.vehicle; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import shadowmage.ancient_warfare.client.model.<API key>; import shadowmage.ancient_warfare.client.render.RenderVehicleBase; import shadowmage.ancient_warfare.common.vehicles.VehicleBase; import shadowmage.ancient_warfare.common.vehicles.helpers.<API key>; public class <API key> extends RenderVehicleBase { <API key> model = new <API key>(); @Override public void renderVehicle(VehicleBase vehicle, double x, double y, double z, float yaw, float tick) { GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(2.5f, 2.5f, 2.5f); <API key> var = vehicle.firingVarsHelper; model.setArmRotations(var.getVar1() + tick*var.getVar2(), var.getVar3()+tick*var.getVar4()); model.render(vehicle, 0, 0, 0, 0, 0, 0.0625f); GL11.glDisable(GL12.GL_RESCALE_NORMAL); } @Override public void renderVehicleFlag() { model.renderFlag(); } }
// contact: rrguadagno@gmail.com // This file is part of French-Roast // French-Roast is free software: you can redistribute it and/or modify // (at your option) any later version. // French-Roast is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #include "SignalTimerWindow.h" #include "MonitorUtil.h" void frenchroast::monitor::SignalTimerWindow::add_signal(const std::string& tag, long totalElapsed, int elapsed) { if(_sigmap[tag] == 0) { _sigmap[tag] = ++_row; } std::string countStr = " [" + format_millis(totalElapsed) + "]"; mvwaddstr(_wptr,_sigmap[tag], 0, (tag + countStr ).c_str()); _current_map[_sigmap[tag]] = tag + countStr; wrefresh(_wptr); } void frenchroast::monitor::SignalTimerWindow::redraw() { draw_title(); refresh(); for(auto& item : _sigmap) { mvwaddstr(stdscr, item.second, 0, _current_map[item.second].c_str()); } wrefresh(_wptr); refresh(); }
#!/usr/bin/python # FileName: memory_cfg.py # File Description: # st71xx platform memory config script # Modify History: # Version Date Author Description # 1.0 2008-12-16 wuzhengbing Create # 1.1 2008-12-24 wuzhengbing increase AVMEM_SYS and driver partition size # 1.2 2008-12-30 wuzhengbing for mmp linux environment # 1.3 2008-01-04 wangte double video decoder avmem size if PIP mode # 1.4 2009-01-04 wuzhengbing memory in LMI_VID can be cached,correct some spell error # 1.5 2009-01-21 wuzhengbing reduced AVMEM size for SD video decoding, # increase os_partition size & PVR support # 1.6 2009-06-12 wuzhengbing increase avmem_sys for HD-DEI # increase driver_partition&ncache_partition for PVR # 1.7 2009-06-17 wuzhengbing set OFFSET_FOR_AV_FW to 5M for st7105 # subtract audio used avmem when PIP mode # 1.8 2010-03-22 wuzhengbing add compatibility for ST5197 # 1.9 2010-07-22 wuzhengbing st40R4.4.0 for st7105 # 2.0 2010-07-27 hanshaoyang add compatibility for ST5289 # DO NOT modify this file if you don't know the result. import ConfigParser, os, sys, re, logging #const M = 1024*1024 K = 1024 VERSION = '2.0' DONOT_MODIFY_NOTICE = 'automatically created by memory_cfg.py, do not modify manually!' class Partition: base = 0 size = 0 name = '' def __init__(self, name): self.name = name #<API key> for st7100/7109 <API key> = { #hd_disp hd_mpeg2 hd_h264 avmem_sys avmem_vid (0, 0, 0): (20*M, 0), (0, 1, 0): (25*M, 0), (0, 0, 1): (50*M, 0), (0, 1, 1): (50*M, 0), (1, 0, 0): (22*M, 0), (1, 1, 0): (34*M, 0), (1, 0, 1): (60*M, 0), (1, 1, 1): (60*M, 0) } #<API key> for st7111 & st7105 <API key> = { #hd_disp hd_mpeg2 hd_h264 avmem_sys avmem_vid (0, 0, 0): (20*M, 0), (0, 1, 0): (25*M, 0), (0, 0, 1): (50*M, 0), (0, 1, 1): (50*M, 0), (1, 0, 0): (22*M, 0), (1, 1, 0): (34*M, 0), (1, 0, 1): (60*M, 0), (1, 1, 1): (60*M, 0) } #<API key> for st5197 <API key> = { #hd_disp hd_mpeg2 hd_h264 avmem_sys avmem_vid (0, 0, 0): (6*M, 0) } #platform dependent definition #include 7100/7109/7101/5201/5203/5202 #only for 29 bits address mode st7100_spec = { 'PHYS_RAM_BASE': 0x04000000, 'OFFSET_FOR_AV_FW': 0x400000, 'LMI_VID_BASE':0xb0000000, 'BOARD_MEM_MAP_NAME': 'st71xx_memory_map', 'BOARD_MEM_LIB_NAME': 'mb411', '<API key>': <API key> } st7109_spec = { 'PHYS_RAM_BASE': 0x04000000, 'OFFSET_FOR_AV_FW': 0x400000, 'LMI_VID_BASE':0xb0000000, 'BOARD_MEM_MAP_NAME': 'st71xx_memory_map', 'BOARD_MEM_LIB_NAME': 'mb411stb7109', '<API key>': <API key> } st7111_spec = { 'PHYS_RAM_BASE': 0x0C000000, 'OFFSET_FOR_AV_FW': 0x800000, 'LMI_VID_BASE':0, 'BOARD_MEM_MAP_NAME': 'st71xx_memory_map', 'BOARD_MEM_LIB_NAME': 'mb618', '<API key>': <API key> } st7105_spec = { 'PHYS_RAM_BASE': 0x0C000000, 'OFFSET_FOR_AV_FW': 0x600000, 'LMI_VID_BASE':0, 'BOARD_MEM_MAP_NAME': 'st71xx_memory_map', 'BOARD_MEM_LIB_NAME': 'mb680sti7105', '<API key>': <API key> } st5197_spec = { 'PHYS_RAM_BASE': 0x0C000000, 'OFFSET_FOR_AV_FW': 0x000000, 'LMI_VID_BASE':0, 'BOARD_MEM_MAP_NAME': 'st71xx_memory_map', 'BOARD_MEM_LIB_NAME': 'mb704', '<API key>': <API key> } st5206_spec = { 'PHYS_RAM_BASE': 0x0C000000, 'OFFSET_FOR_AV_FW': 0x500000, 'LMI_VID_BASE':0, 'BOARD_MEM_MAP_NAME': 'st71xx_memory_map', 'BOARD_MEM_LIB_NAME': 'hdk5289stx5206', '<API key>': <API key> } platform_spec = None validate_mode = False # min size of System heap&stack <API key> = 2*M #memory config from input cfg_in = { #hardware config 'DDR_BUS_NUMBER':1, 'DDR0_TOTAL_SIZE':0x08000000, 'DDR1_TOTAL_SIZE':0x00000000, #function options 'HD_DISPLAY_SUPPORT':False, 'HD_DECODER_SUPPORT':True, 'HD_H264_SUPPORT':True, 'PVR_SUPPORT':False, 'PIP_SUPPORT':False, 'OSD_BITS_PERPIEXL':32, #user defined size '<API key>':0, 'USER_OSD_AVMEM_SIZE':0x400000 } #memory partition define for output cfg_out = { 'LMI_SYS_BASE':0, 'LMI_SYS_SIZE':0, 'LMI_VID_BASE':0, 'LMI_VID_SIZE':0, 'APP_START_ADDR': 0, 'STACK_ADDR': 0, '<API key>': 0, '<API key>': 0, '<API key>': 0, 'OS_PARTITIOAN_SIZE': 0, '<API key>':0, '<API key>': 0, '<API key>':0, '<API key>': 0, '<API key>': 0, 'AVMEM_USER_SIZE': 0, '<API key>':0, 'AVMEM_SYS_SIZE':0, '<API key>':0, 'AVMEM_VID_SIZE':0 } #args passed into this script script_args = { 'CFG_FILENAME':None, 'CFG_SECTION':None, 'MAP_FILENAME':None } #for address translate def phys_to_cached(addr): return long(addr)|0x80000000 def phys_to_uncached(addr): return long(addr)|0xA0000000 # workaround for ConfigParser reading HEX def cfg_get_int(cfg, section, option): int_raw = cfg.get(section, option) int_s = str(int_raw).strip().lower() if int_s[0] == '0' and len(int_s) > 1 and int_s[1] == 'x': int_s = int_s.replace('0x', '') return int(int_s, 16) else: return int(int_raw) def read_config(): logging.debug('read config file...') cfg_filename = script_args['CFG_FILENAME'] cfg_section = script_args['CFG_SECTION'] logging.info('read [%s] from %s' % (cfg_section, cfg_filename)) # read memory config config = ConfigParser.ConfigParser() config.read(cfg_filename) for k, v in cfg_in.iteritems(): cfg_in[k] = cfg_get_int(config, cfg_section, k) # do memory partition def do_memory_partition(): # TODO params check # display buffer size bytes_per_pixel = cfg_in['OSD_BITS_PERPIEXL']/8 if bytes_per_pixel <= 0 or bytes_per_pixel > 4: raise Exception('bad value of OSD_BITS_PERPIEXL') osd_size = 720*576*bytes_per_pixel if cfg_in['HD_DISPLAY_SUPPORT']: osd_size += 1920*1080*bytes_per_pixel elif os.getenv('DVD_BACKEND') != '5197': osd_size += 720*576*bytes_per_pixel logging.debug('osd_size = %dK' % (osd_size/K)) mem_key = (cfg_in['HD_DISPLAY_SUPPORT'], cfg_in['HD_DECODER_SUPPORT'], cfg_in['HD_H264_SUPPORT']) #get <API key> for special platform <API key> = platform_spec['<API key>'] # decode size decode_size_lmi_sys = long(<API key>[mem_key][0]) decode_size_lmi_vid = long(<API key>[mem_key][1]) logging.debug('decode_size_lmi_sys = %dM' % (decode_size_lmi_sys/0x100000)) logging.debug('decode_size_lmi_vid = %dM' % (decode_size_lmi_vid/0x100000)) if cfg_in['PIP_SUPPORT']: decode_size_lmi_sys = decode_size_lmi_sys*2 - 2*M #subtract audio used avmem (about 2M) ## LMI_SYS ## | VIDEO FIRMWARE | ## | AUDIO FIRMWARE | ## | 0x1000 | ## | APP SPACE | ## | code_data_bss | ## | System Heap&Stack | ## | os_partition | ## | driver_partition | ## | ncache_partition | ## | avmem_user | ## | avmem_sys | ## LMI_VID ## | avmem_vid | ## | user_heap | ## | (system partition) | os_partition = Partition('os_partition') driver_partition = Partition('driver_partition') ncache_partition = Partition('ncache_partition') avmem_user = Partition('avmem_user') avmem_sys = Partition('avmem_sys') avmem_vid = Partition('avmem_vid') user_heap = Partition('user_heap') avmem_sys.size = decode_size_lmi_sys + osd_size avmem_vid.size = decode_size_lmi_vid avmem_user.size = cfg_in['USER_OSD_AVMEM_SIZE'] <API key> = (cfg_in['<API key>'] != 0) # compute memory size of partitions first if not <API key>: # system_heap (code_data_bss_end ~ stack) as user_heap_partition user_heap.size = 0 else: user_heap.size = cfg_in['DDR1_TOTAL_SIZE'] - avmem_vid.size backend = os.getenv('DVD_BACKEND') if backend == '5197': #special case for st5197 os_partition.size = 2.5*M driver_partition.size = 2*M elif backend == '7111' or backend == '7105': #default driver_partition size for basic case (st7111&st7105) os_partition.size = 4*M driver_partition.size = 3*M elif backend == '5206': #default driver_partition size for basic case (st5206) os_partition.size = 4*M driver_partition.size = 5*M elif backend == '7100' or backend == '7109': #default driver_partition size for basic case (st7100&st7109) os_partition.size = 2*M driver_partition.size = 2*M else: error_msg = 'unknown DVD backend! need conform!' logging.error(error_msg) raise Exception, error_msg if cfg_in['PIP_SUPPORT']: driver_partition.size += 3*M if cfg_in['PVR_SUPPORT']: driver_partition.size += 8*M if cfg_in['PVR_SUPPORT']: ncache_partition.size = 0x800000 # Pvr need more ? else: ncache_partition.size = 0x80000 start_addr_phys = platform_spec['PHYS_RAM_BASE'] + platform_spec['OFFSET_FOR_AV_FW'] + 0x1000 #creat memory map of LMI_SYS <API key> = [os_partition, driver_partition, ncache_partition, avmem_user, avmem_sys] <API key> = 0 partitions_count = len(<API key>) for i in range(partitions_count): <API key> += <API key>[i].size <API key>[0].base = platform_spec['PHYS_RAM_BASE'] + cfg_in['DDR0_TOTAL_SIZE'] - <API key> for i in range(1, partitions_count): <API key>[i].base = <API key>[i - 1].base + <API key>[i - 1].size # trace address info for i in range(0, partitions_count): logging.info('%-18s base(physical) = 0x%08x size = 0x%08x' % (<API key>[i].name, <API key>[i].base, <API key>[i].size)) stack_addr_phys = <API key>[0].base - 4 #creat memory map of LMI_VID assert avmem_vid.size <= cfg_in['DDR1_TOTAL_SIZE'] avmem_vid.base = platform_spec['LMI_VID_BASE'] if <API key>: user_heap.base = avmem_vid.base + avmem_vid.size user_heap.size = cfg_in['DDR1_TOTAL_SIZE'] - avmem_vid.size else: # all of LMI_VID as avmem_vid avmem_vid.size = cfg_in['DDR1_TOTAL_SIZE'] #validate if stack_addr_phys - start_addr_phys < <API key>: logging.error('start_addr_phys = 0x%08x' % start_addr_phys) logging.error('stack_addr_phys = 0x%08x' % stack_addr_phys) raise Exception('App Memory Space is too low') #map file should be already create by LD if validate_mode: actual_start_addr, actual_end_addr = <API key>() sys_heap_stack_size = phys_to_cached(stack_addr_phys) - actual_end_addr logging.info('code_data_bss start = 0x%08x'% actual_start_addr) logging.info('code_data_bss end = 0x%08x'% actual_end_addr) logging.info('code_data_bss size = 0x%08x'% (actual_end_addr - actual_start_addr)) logging.info('stack_ptr = 0x%08x'% phys_to_cached(stack_addr_phys)) logging.info('sys_heap_stack_size = 0x%08x'% sys_heap_stack_size) if sys_heap_stack_size < <API key>: raise Exception('sys_heap_stack_size is too low') cfg_out['LMI_SYS_BASE'] = phys_to_uncached(platform_spec['PHYS_RAM_BASE']) cfg_out['LMI_SYS_SIZE'] = cfg_in['DDR0_TOTAL_SIZE'] cfg_out['LMI_VID_BASE'] = platform_spec['LMI_VID_BASE'] cfg_out['LMI_VID_SIZE'] = cfg_in['DDR1_TOTAL_SIZE'] cfg_out['APP_START_ADDR'] = phys_to_cached(start_addr_phys) cfg_out['STACK_ADDR'] = phys_to_cached(stack_addr_phys) if <API key>: # memory in LMI_VID can be cacnhed from recent test from maocongwu cfg_out['<API key>'] = phys_to_cached(user_heap.base) else: cfg_out['<API key>'] = 0 cfg_out['<API key>'] = user_heap.size cfg_out['<API key>'] = phys_to_cached(os_partition.base) cfg_out['OS_PARTITIOAN_SIZE'] = os_partition.size cfg_out['<API key>'] = phys_to_cached(driver_partition.base) cfg_out['<API key>'] = driver_partition.size cfg_out['<API key>'] = phys_to_cached(ncache_partition.base) cfg_out['<API key>'] = ncache_partition.size cfg_out['<API key>'] = phys_to_uncached(avmem_user.base) cfg_out['AVMEM_USER_SIZE'] = avmem_user.size cfg_out['<API key>'] = phys_to_uncached(avmem_sys.base) cfg_out['AVMEM_SYS_SIZE'] = avmem_sys.size cfg_out['<API key>'] = avmem_vid.base cfg_out['AVMEM_VID_SIZE'] = avmem_vid.size # format cfg_out to output def gen_cfg_h_file(): logging.debug('generate head file...') out_filename = os.path.join(os.getenv('DVD_APPS'), 'memory_cfg.h') logging.info('creating %s ...' % out_filename) h_file = open(out_filename, 'w+') h_file.write('\n' % DONOT_MODIFY_NOTICE) h_file.write('#ifndef __MEMORY_CONFIG_H\n') h_file.write('#define __MEMORY_CONFIG_H\n\n') # sort dictionary items by name for output kv = [] for k, v in cfg_in.iteritems(): kv.append((k ,v)) for k, v in sorted(kv): h_file.write('#define %s 0x%x\n'% (k, v)) h_file.write('\n') kv = [] for k, v in cfg_out.iteritems(): kv.append((k ,v)) for k, v in sorted(kv): h_file.write('#define %s 0x%x\n'% (k, v)) h_file.write('\n#endif /* __MEMORY_CONFIG_H */ \n\n') h_file.write('\n/* End of File */\n') h_file.close() def gen_board_mem_file(): logging.debug('generate borad mem file...') #board_mem_filename = '' if os.getenv('MMCP_HOME') != None: out_filename = os.path.join(os.getenv('DVD_APPS'), 'board_' + os.getenv('DVD_BACKEND') + '.mem') else: out_filename = os.path.join(os.getenv('DVD_APPS'), 'board.mem') logging.info('creating %s ...' % out_filename) board_mem = open(out_filename, 'w+') board_mem.write('# %s\n\n' % DONOT_MODIFY_NOTICE) board_mem.write('*%s:\n'% platform_spec['BOARD_MEM_MAP_NAME']) board_mem.write('--defsym _start=0x%x --defsym _stack=0x%x\n\n'% (cfg_out['APP_START_ADDR'], cfg_out['STACK_ADDR'])) board_mem.write('*board_link:\n') board_mem.write('%%{mboard=%s:%%(%s)}\n\n'% (platform_spec['BOARD_MEM_MAP_NAME'], platform_spec['BOARD_MEM_MAP_NAME'])) board_mem.write('*lib_os21bsp_base:\n') board_mem.write('%%{mboard=%s:%s}\n'% (platform_spec['BOARD_MEM_MAP_NAME'], platform_spec['BOARD_MEM_LIB_NAME'])) board_mem.close() def <API key>(): out_filename = os.path.join(os.getenv('DVD_CONFIG'), 'platform', os.getenv('DVD_BACKEND'), 'sys_mem_size.cmd') logging.info('creating %s ...' % out_filename) sys_mem_size_cmd = open(out_filename, 'w+') sys_mem_size_cmd.write('define stb%<API key>\n'% os.getenv('DVD_BACKEND')) sys_mem_size_cmd.write('set $LMI_SYS_MEM_SIZE = 0x%x\n'%cfg_out['LMI_SYS_SIZE']) sys_mem_size_cmd.write('set $LMI_VID_MEM_SIZE = 0x%x\n'% cfg_out['LMI_VID_SIZE']) sys_mem_size_cmd.write('end\n\n') sys_mem_size_cmd.close() def <API key>(): out_filename = os.path.join(os.getenv('DVD_CONFIG'), 'platform', os.getenv('DVD_BACKEND'), 'targetpack', 'sys_mem_size.py') logging.info('creating %s ...' % out_filename) sys_mem_size_py = open(out_filename, 'w+') sys_mem_size_py.write('# %s\n' % DONOT_MODIFY_NOTICE) sys_mem_size_py.write('LMI_SYS_MEM_SIZE = 0x%x\n'%cfg_out['LMI_SYS_SIZE']) sys_mem_size_py.write('LMI_VID_MEM_SIZE = 0x%x\n'% cfg_out['LMI_VID_SIZE']) sys_mem_size_py.close() #return (start, end) pair def <API key>(): map_filename = os.path.join(script_args['MAP_FILENAME']) logging.debug('read map file %s' % map_filename) map_file = open(map_filename, 'r') text = map_file.read() map_file.close() m = re.search(r' {16}0x(?P<addr>\w+) {16}start', text) start = int(m.group('addr'), 16) m = re.search(r' {16}0x(?P<addr>\w+) {16}_end = \.', text) end = int(m.group('addr'), 16) return (start, end) def toolset_check(): logging.info('ST40 toolset checking...') st40versions = re.findall("ST40R(\d\.\d\.\d)", os.getenv('PATH'), re.IGNORECASE) #remove duplicate elements st40versions = list(set(st40versions)) if len(st40versions) > 1: msg = ('different version of ST40(%s) toolset in PATH, environment setting maybe error!' % st40versions) logging.error(msg) raise Exception, msg if os.getenv('DVD_BACKEND') == '7105': #convert version string to tuple of int version_num = st40versions[0].split('.') version_num = (int(version_num[0]), int(version_num[1]), int(version_num[2])) #st40 for st7105 should be greater than ST40R4.4.0 if version_num < (4, 4, 0): raise Exception, 'ST40 for st7105 should be equal or greater than ST40R4.4.0' logging.info('ST40R%s is OK' % st40versions[0]) generators = { '7100': {'PLATFORM_SPEC':st7100_spec, 'GEN_STEPS':[read_config,do_memory_partition,gen_cfg_h_file,gen_board_mem_file,<API key>], 'VALIDATE_STEPS':[read_config,do_memory_partition]}, '7109': {'PLATFORM_SPEC':st7109_spec, 'GEN_STEPS':[read_config,do_memory_partition,gen_cfg_h_file,gen_board_mem_file,<API key>], 'VALIDATE_STEPS':[read_config,do_memory_partition]}, '7111': {'PLATFORM_SPEC':st7111_spec, 'GEN_STEPS':[read_config,do_memory_partition,gen_cfg_h_file,gen_board_mem_file,<API key>], 'VALIDATE_STEPS':[read_config,do_memory_partition]}, '7105': {'PLATFORM_SPEC':st7105_spec, 'GEN_STEPS':[read_config,do_memory_partition,gen_cfg_h_file,gen_board_mem_file,<API key>], 'VALIDATE_STEPS':[read_config,do_memory_partition]}, '5197': {'PLATFORM_SPEC':st5197_spec, 'GEN_STEPS':[read_config,do_memory_partition,gen_cfg_h_file,gen_board_mem_file,<API key>], 'VALIDATE_STEPS':[read_config,do_memory_partition]}, '5206': {'PLATFORM_SPEC':st5206_spec, 'GEN_STEPS':[read_config,do_memory_partition,gen_cfg_h_file,gen_board_mem_file,<API key>], 'VALIDATE_STEPS':[read_config,do_memory_partition]}, } gen = generators[os.getenv('DVD_BACKEND')] platform_spec = gen['PLATFORM_SPEC'] #setup logging logging.basicConfig(level=logging.DEBUG, format="[MEMORY_CFG] %(message)s") #usage: python memory_cfg.py CFG_FILENAME CFG_SECTION [MAP_FILENAME] argc = len(sys.argv) if argc < 3 or argc > 4: raise Exception('argment number error') else: script_args['CFG_FILENAME'] = sys.argv[1] script_args['CFG_SECTION'] = sys.argv[2] if argc == 4: script_args['MAP_FILENAME'] = sys.argv[3] # do steps logging.info('version: %s' % VERSION) toolset_check() if script_args['MAP_FILENAME'] == None: logging.info('generate memory config files...') validate_mode = False steps = gen['GEN_STEPS'] else: logging.info('validate memory config...') validate_mode = True steps = gen['VALIDATE_STEPS'] for step in steps: step() logging.info('exit memory_cfg.py...')
<!DOCTYPE html PUBLIC "- <html xmlns="http: <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.11"/> <title>atlas: /home/ran/atlas_project/<API key>/sources/io/interactive_lietype.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="e8dynkintransparent.gif"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">atlas &#160;<span id="projectnumber">0.6</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>File&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="<API key>"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="<API key>.html"><API key></a></li><li class="navelem"><a class="el" href="<API key>.html">sources</a></li><li class="navelem"><a class="el" href="<API key>.html">io</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#namespaces">Namespaces</a> &#124; <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">interactive_lietype.h File Reference</div> </div> </div><!--header <div class="contents"> <div class="textblock"><code>#include &lt;map&gt;</code><br /> <code>#include &lt;string&gt;</code><br /> <code>#include &quot;<a class="el" href="Atlas_8h_source.html">../Atlas.h</a>&quot;</code><br /> <code>#include &quot;<a class="el" href="lietype_8h_source.html">lietype.h</a>&quot;</code><br /> </div><div class="textblock"><div class="dynheader"> Include dependency graph for interactive_lietype.h:</div> <div class="dyncontent"> <div class="center"><img src="<API key>.png" border="0" usemap="#_2home_2ran_2atlas__project_2latest__branch__07182016_2sources_2io_2interactive__lietype_8h" alt=""/></div> <!-- MAP 0 --> </div> </div><div class="textblock"><div class="dynheader"> This graph shows which files directly or indirectly include this file:</div> <div class="dyncontent"> <div class="center"><img src="<API key>.png" border="0" usemap="#_2home_2ran_2atlas__project_2latest__branch__07182016_2sources_2io_2interactive__lietype_8hdep" alt=""/></div> <!-- MAP 1 --> </div> </div> <p><a href="<API key>.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a> Namespaces</h2></td></tr> <tr class="memitem:namespaceatlas"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceatlas.html">atlas</a></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html">atlas::interactive_lietype</a></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">atlas::interactive_lietype::checkInnerClass</a> (input::InputBuffer &amp;buf, const LieType &amp;lt, bool <a class="el" href="ctangle_8c.html#<API key>">output</a>)</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">atlas::interactive_lietype::checkLieType</a> (input::InputBuffer &amp;buf)</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">atlas::interactive_lietype::checkSimpleLieType</a> (input::InputBuffer &amp;buf)</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">atlas::interactive_lietype::checkTotalRank</a> (input::InputBuffer &amp;buf)</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">std::ostream &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">atlas::interactive_lietype::printRankMessage</a> (std::ostream &amp;strm, lietype::TypeLetter x)</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">atlas::interactive_lietype::readInnerClass</a> (InnerClassType &amp;ict, input::InputBuffer &amp;buf, const LieType &amp;lt)</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">atlas::interactive_lietype::readLieType</a> (LieType &amp;lt, input::InputBuffer &amp;buf)</td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by & <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> </body> </html>
/** Abel HZO 2016 CSS for form contact and table. */ * { font-family: verdana; } form { width: 300px; margin: auto; } input[type="text"], input[type="email"], textarea { display: block; width: 100%; padding: 6px; border: 1px solid rgba(0, 0, 0, .5); margin: 0 auto 20px auto; border-radius: 5px; } input[type="submit"] { padding: 6px; margin: auto; display: block; width: 80px; background: rgba(0, 250, 10, .3); border: 2px solid rgba(0, 250, 10, 1); font-weight: bold; cursor: pointer; transition: all .5s; } input[type="submit"]:hover { background: rgba(0, 250, 100, 1); } .table { display: table; table-layout: fixed; width: 80%; margin: 20px auto; } .table > div { display: table-row; } .table > div:nth-child(odd) { background: rgba(0, 200, 10, .1); } .table > div:nth-child(even) { background: rgba(10, 100, 100, .1); } .table > div > div { display: table-cell; vertical-align: middle; padding: 8px; } input.ng-invalid.ng-dirty, textarea.ng-invalid.ng-dirty { border: 2px solid rgba(255, 0, 0, 1); } span { position: relative; top: -18px; width: 100%; background: rgba(255, 0, 0, .2); padding: 5px; border-radius: 5px; display: block; border: 1px solid red; } .foot { width: 80%; margin: auto; text-align: center; }
<?php // security - hide paths if (!defined('ADODB_DIR')) die(); class ADODB_sybase extends ADOConnection { var $databaseType = "sybase"; var $dataProvider = 'sybase'; var $replaceQuote = "''"; // string to use to replace quotes var $fmtDate = "'Y-m-d'"; var $fmtTimeStamp = "'Y-m-d H:i:s'"; var $hasInsertID = true; var $hasAffectedRows = true; var $metaTablesSQL="select name from sysobjects where type='U' or type='V'"; var $metaColumnsSQL = "SELECT c.column_name, c.column_type, c.width FROM syscolumn c, systable t WHERE t.table_name='%s' AND c.table_id=t.table_id AND t.table_type='BASE'"; /* "select c.name,t.name,c.length from syscolumns c join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where o.name='%s'"; */ var $concat_operator = '+'; var $arrayClass = '<API key>'; var $sysDate = 'GetDate()'; var $leftOuter = '*='; var $rightOuter = '=*'; function ADODB_sybase() { } // might require begintrans -- committrans function _insertid() { return $this->GetOne('select @@identity'); } // might require begintrans -- committrans function _affectedrows() { return $this->GetOne('select @@rowcount'); } function BeginTrans() { if ($this->transOff) return true; $this->transCnt += 1; $this->Execute('BEGIN TRAN'); return true; } function CommitTrans($ok=true) { if ($this->transOff) return true; if (!$ok) return $this->RollbackTrans(); $this->transCnt -= 1; $this->Execute('COMMIT TRAN'); return true; } function RollbackTrans() { if ($this->transOff) return true; $this->transCnt -= 1; $this->Execute('ROLLBACK TRAN'); return true; } // http://www.isug.com/Sybase_FAQ/ASE/section6.1.html#6.1.4 function RowLock($tables,$where,$col='top 1 null as ignore') { if (!$this->_hastrans) $this->BeginTrans(); $tables = str_replace(',',' HOLDLOCK,',$tables); return $this->GetOne("select $col from $tables HOLDLOCK where $where"); } function SelectDB($dbName) { $this->database = $dbName; $this->databaseName = $dbName; # obsolete, retained for compat with older adodb versions if ($this->_connectionID) { return @sybase_select_db($dbName); } else return false; } /* Returns: the last error message from previous database operation Note: This function is NOT available for Microsoft SQL Server. */ function ErrorMsg() { if ($this->_logsql) return $this->_errorMsg; if (function_exists('<API key>')) $this->_errorMsg = <API key>(); else $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : 'SYBASE error messages not supported on this platform'; return $this->_errorMsg; } // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { if (!function_exists('sybase_connect')) return null; if ($this->charSet) { $this->_connectionID = sybase_connect($argHostname,$argUsername,$argPassword, $this->charSet); } else { $this->_connectionID = sybase_connect($argHostname,$argUsername,$argPassword); } $this->_connectionID = sybase_connect($argHostname,$argUsername,$argPassword); if ($this->_connectionID === false) return false; if ($argDatabasename) return $this->SelectDB($argDatabasename); return true; } // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { if (!function_exists('sybase_connect')) return null; if ($this->charSet) { $this->_connectionID = sybase_pconnect($argHostname,$argUsername,$argPassword, $this->charSet); } else { $this->_connectionID = sybase_pconnect($argHostname,$argUsername,$argPassword); } if ($this->_connectionID === false) return false; if ($argDatabasename) return $this->SelectDB($argDatabasename); return true; } // returns query ID if successful, otherwise false function _query($sql,$inputarr=false) { global $ADODB_COUNTRECS; if ($ADODB_COUNTRECS == false && ADODB_PHPVER >= 0x4300) return <API key>($sql,$this->_connectionID); else return sybase_query($sql,$this->_connectionID); } // See http://www.isug.com/Sybase_FAQ/ASE/section6.2.html#6.2.12 function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) { if ($secs2cache > 0) {// we do not cache rowcount, so we have to load entire recordset $rs = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache); return $rs; } $nrows = (integer) $nrows; $offset = (integer) $offset; $cnt = ($nrows >= 0) ? $nrows : 999999999; if ($offset > 0 && $cnt) $cnt += $offset; $this->Execute("set rowcount $cnt"); $rs = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,0); $this->Execute("set rowcount 0"); return $rs; } // returns true or false function _close() { return @sybase_close($this->_connectionID); } static function UnixDate($v) { return <API key>::UnixDate($v); } static function UnixTimeStamp($v) { return <API key>::UnixTimeStamp($v); } # Added 2003-10-05 by Chris Phillipson # to convert similar Microsoft SQL*Server (mssql) API into Sybase compatible version // Format date column in sql string given an input format that understands Y M D function SQLDate($fmt, $col=false) { if (!$col) $col = $this->sysTimeStamp; $s = ''; $len = strlen($fmt); for ($i=0; $i < $len; $i++) { if ($s) $s .= '+'; $ch = $fmt[$i]; switch($ch) { case 'Y': case 'y': $s .= "datename(yy,$col)"; break; case 'M': $s .= "convert(char(3),$col,0)"; break; case 'm': $s .= "str_replace(str(month($col),2),' ','0')"; break; case 'Q': case 'q': $s .= "datename(qq,$col)"; break; case 'D': case 'd': $s .= "str_replace(str(datepart(dd,$col),2),' ','0')"; break; case 'h': $s .= "substring(convert(char(14),$col,0),13,2)"; break; case 'H': $s .= "str_replace(str(datepart(hh,$col),2),' ','0')"; break; case 'i': $s .= "str_replace(str(datepart(mi,$col),2),' ','0')"; break; case 's': $s .= "str_replace(str(datepart(ss,$col),2),' ','0')"; break; case 'a': case 'A': $s .= "substring(convert(char(19),$col,0),18,2)"; break; default: if ($ch == '\\') { $i++; $ch = substr($fmt,$i,1); } $s .= $this->qstr($ch); break; } } return $s; } # Added 2003-10-07 by Chris Phillipson # to convert similar Microsoft SQL*Server (mssql) API into Sybase compatible version function MetaPrimaryKeys($table) { $sql = "SELECT c.column_name " . "FROM syscolumn c, systable t " . "WHERE t.table_name='$table' AND c.table_id=t.table_id " . "AND t.table_type='BASE' " . "AND c.pkey = 'Y' " . "ORDER BY c.column_id"; $a = $this->GetCol($sql); if ($a && sizeof($a)>0) return $a; return false; } } global $ADODB_sybase_mths; $ADODB_sybase_mths = array( 'JAN'=>1,'FEB'=>2,'MAR'=>3,'APR'=>4,'MAY'=>5,'JUN'=>6, 'JUL'=>7,'AUG'=>8,'SEP'=>9,'OCT'=>10,'NOV'=>11,'DEC'=>12); class ADORecordset_sybase extends ADORecordSet { var $databaseType = "sybase"; var $canSeek = true; // _mths works only in non-localised system var $_mths = array('JAN'=>1,'FEB'=>2,'MAR'=>3,'APR'=>4,'MAY'=>5,'JUN'=>6,'JUL'=>7,'AUG'=>8,'SEP'=>9,'OCT'=>10,'NOV'=>11,'DEC'=>12); function ADORecordset_sybase($id,$mode=false) { if ($mode === false) { global $ADODB_FETCH_MODE; $mode = $ADODB_FETCH_MODE; } if (!$mode) $this->fetchMode = ADODB_FETCH_ASSOC; else $this->fetchMode = $mode; $this->ADORecordSet($id,$mode); } /* Returns: an object containing field information. Get column information in the Recordset object. fetchField() can be used in order to obtain information about fields in a certain query result. If the field offset isn't specified, the next field that wasn't yet retrieved by fetchField() is retrieved. */ function FetchField($fieldOffset = -1) { if ($fieldOffset != -1) { $o = @sybase_fetch_field($this->_queryID, $fieldOffset); } else if ($fieldOffset == -1) { /* The $fieldOffset argument is not provided thus its -1 */ $o = @sybase_fetch_field($this->_queryID); } // older versions of PHP did not support type, only numeric if ($o && !isset($o->type)) $o->type = ($o->numeric) ? 'float' : 'varchar'; return $o; } function _initrs() { global $ADODB_COUNTRECS; $this->_numOfRows = ($ADODB_COUNTRECS)? @sybase_num_rows($this->_queryID):-1; $this->_numOfFields = @sybase_num_fields($this->_queryID); } function _seek($row) { return @sybase_data_seek($this->_queryID, $row); } function _fetch($ignore_fields=false) { if ($this->fetchMode == ADODB_FETCH_NUM) { $this->fields = @sybase_fetch_row($this->_queryID); } else if ($this->fetchMode == ADODB_FETCH_ASSOC) { $this->fields = @sybase_fetch_row($this->_queryID); if (is_array($this->fields)) { $this->fields = $this->GetRowAssoc(ADODB_ASSOC_CASE); return true; } return false; } else { $this->fields = @sybase_fetch_array($this->_queryID); } if ( is_array($this->fields)) { return true; } return false; } /* close() only needs to be called if you are worried about using too much memory while your script is running. All associated result memory for the specified result identifier will automatically be freed. */ function _close() { return @sybase_free_result($this->_queryID); } // sybase/mssql uses a default date like Dec 30 2000 12:00AM static function UnixDate($v) { return <API key>::UnixDate($v); } static function UnixTimeStamp($v) { return <API key>::UnixTimeStamp($v); } } class <API key> extends ADORecordSet_array { function <API key>($id=-1) { $this->ADORecordSet_array($id); } // sybase/mssql uses a default date like Dec 30 2000 12:00AM static function UnixDate($v) { global $ADODB_sybase_mths; //Dec 30 2000 12:00AM if (!preg_match( "/([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4})/" ,$v, $rr)) return parent::UnixDate($v); if ($rr[3] <= <API key>) return 0; $themth = substr(strtoupper($rr[1]),0,3); $themth = $ADODB_sybase_mths[$themth]; if ($themth <= 0) return false; // h-m-s-MM-DD-YY return adodb_mktime(0,0,0,$themth,$rr[2],$rr[3]); } static function UnixTimeStamp($v) { global $ADODB_sybase_mths; //11.02.2001 Toni Tunkkari toni.tunkkari@finebyte.com //Changed [0-9] to [0-9 ] in day conversion if (!preg_match( "/([A-Za-z]{3})[-/\. ]([0-9 ]{1,2})[-/\. ]([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})/" ,$v, $rr)) return parent::UnixTimeStamp($v); if ($rr[3] <= <API key>) return 0; $themth = substr(strtoupper($rr[1]),0,3); $themth = $ADODB_sybase_mths[$themth]; if ($themth <= 0) return false; switch (strtoupper($rr[6])) { case 'P': if ($rr[4]<12) $rr[4] += 12; break; case 'A': if ($rr[4]==12) $rr[4] = 0; break; default: break; } // h-m-s-MM-DD-YY return adodb_mktime($rr[4],$rr[5],0,$themth,$rr[2],$rr[3]); } } ?>
<?php class Awf_Acl { /** * Hier worden de roles (rollen) opgeslagen * * @var array */ protected $roles = array(); /** * Opslag van de resources * * @var array */ protected $resources = array(); /** * Snelmethod om een role of resource toe te voegen * * @param Awf_Acl_Role|Awf_Acl_Resource $instance * @return Awf_Acl instance van zichzelf voor chaining */ public function add($instance){ if(is_string($instance)){ return $this->addResource($instance); }elseif($instance instanceof Awf_Acl_Role){ return $this->addRole($instance); } throw new Exception('This is not a valid instance to add to Awf_Acl!'); } /** * Voeg een role toe * * @param Awf_Acl_Role $role Instantie van een role * @return Awf_Acl instance van zichzelf voor chaining */ public function addRole(Awf_Acl_Role $role){ $this->roles[(string)$role] = $role; return $this; } /** * Voeg een resource toe * * @param Awf_Acl_Resource $resource instantie van een resource * @return Awf_Acl instance van zichzelf voor chaining */ public function addResource( $resource){ if (!in_array((string)$resource, $this->resources)) $this->resources[] = (string)$resource; return $this; } /** * Haal een role uit de $this->roles array * * @param string $role * @return Awf_Acl_Role */ protected function getRole($role){ if($role instanceof Awf_Acl_Role){ return $role; } if(isset($this->roles[(string)$role])){ $role = $this->roles[(string)$role]; if($role instanceof Awf_Acl_Role){ return $role; } } throw new Exception('This role ('.$role.') does not exists!'); } // returns the list of Role names defined in this ACL class. public function getRolenames(){ return array_keys($this->roles); } /** * Alle rechten die de $extend heeft, worden ook aan de $role gegeven * * @param string $role * @param string $extendRole De rechten die moeten worden overgenomen * @return Awf_Acl om chaining mogelijk te maken */ public function extend($role,$extendRole){ $role = $this->getRole($role); $extendRole = $this->getRole($extendRole); $role->setExtend($extendRole); return $this; } /** * Voegt een resource toe aan de 'rules' lijst * Voegt de bits samen: 0100 + 1010 => 1110 * * @param string $role * @param string $resource * * @return Awf_Acl om chaining mogelijk te maken */ public function allow($role,$resource){ $role = $this->getRole($role); $role->setRule($resource); return $this; } /** * Haalt een resource weer uit de rules lijst. * Trekt de bits uit elkaar: 1101 - 1011 => 0100 * @todo Is hier geen beter oplossing voor dan deze loop ?? * * @param string $role * @param string $resource * @return Awf_Acl om chaining mogelijk te maken */ public function deny($role,$resource){ $role = $this->getRole($role); $role->setRule($resource, false); return $this; } /** * Checkt of een bepaalde role een bepaalde resource mag uitvoeren * * @param string $role De role naam * @param string $resource De resource naam * @return boolean True als het goegestaan is, anders false */ public function isAllowed($role,$resource){ $role = $this->getRole($role); return $role->isAllowed($resource); } public function hasResources(){ return count($this->resources) > 0; } } class Awf_Acl_Role { /** * Naam van de role * * @var string */ protected $name; protected $rules = array(); protected $extends = array(); /** * Maakt instantie aan met de naam * * @param string $name */ public function __construct($name){ $this->name = $name; } public function getRule(){ return $this->rules; } public function setRule($value, $add= true){ if (is_array($value)) { $this->rules = array_merge($this->rules, array_diff( $value, $this->rules)); // array_combine($this->rules, $value); } elseif ($add && !in_array($value, $this->rules )) { $this->rules[] = $value; } elseif (!$add && in_array($value, $this->rules )) { $key = array_search($value, $this->rules); unset($this->rules[$key]); } } public function setExtend($extendRole) { $this->extends[] = $extendRole; } /** * De naam van de Role * * @return string */ public function __toString(){ return (string)$this->name; } public function isAllowed($resource){ $return = (bool)in_array($resource, $this->getRule()); if (!$return) { foreach ($this->extends as $role) { $return = $role->isAllowed($resource); if ($return) break; } } return $return; } } ?>
package dualcraft.org.server.classic.cmd.impl; import dualcraft.org.server.classic.cmd.Command; import dualcraft.org.server.classic.cmd.CommandParameters; import dualcraft.org.server.classic.model.Player; /** * Official /deop command **NEEDS PERSISTENCE** * */ public class KickCommand extends Command { /** * The instance of this command. */ private static final KickCommand INSTANCE = new KickCommand(); /** * Gets the singleton instance of this command. * @return The singleton instance of this command. */ public static KickCommand getCommand() { return INSTANCE; } public String name() { return "kick"; } /** * Default private constructor. */ private KickCommand() { /* empty */ } public void execute(Player player, CommandParameters params) { // Player using command is OP? if (params.getArgumentCount() == 1) { for (Player other : player.getWorld().getPlayerList().getPlayers()) { if (other.getName().toLowerCase().equals(params.getStringArgument(0).toLowerCase())) { other.getSession().close(); player.getActionSender().sendChatMessage(other.getName() + " has been kicked"); return; } } // Player not found player.getActionSender().sendChatMessage(params.getStringArgument(0) + " was not found"); } else { player.getActionSender().sendChatMessage("Wrong number of arguments"); player.getActionSender().sendChatMessage("/kick <name>"); } } }
package gtp import ( "fmt" "os" "strconv" . "github.com/foozea/isana/board/size" . "github.com/foozea/isana/board/stone" . "github.com/foozea/isana/board/vertex" . "github.com/foozea/isana/control" . "github.com/foozea/isana/position/move" "github.com/foozea/isana/engine" "github.com/foozea/isana/protocol" ) func protocol_version(args protocol.Args) { fmt.Printf("= %v\n\n", PROTOCOL_VERSION) } func name(args protocol.Args) { fmt.Printf("= %v\n\n", engine.Engine.Name) } func version(args protocol.Args) { fmt.Printf("= %v\n\n", engine.Engine.Version) } func known_command(args protocol.Args) { fmt.Print("= ") if len(args) == 0 { fmt.Println("false\n") } else { fmt.Printf("%v\n\n", protocol.Dispatcher.HasHandler(args[0])) } } func list_commands(args protocol.Args) { fmt.Print("= ") for k, _ := range protocol.Dispatcher { fmt.Println(k) } fmt.Printf("\n") } func quit(args protocol.Args) { os.Exit(0) } func boardsize(args protocol.Args) { if len(args) == 0 { fmt.Println("? boardsize must be an integer\n") return } v, err := strconv.Atoi(args[0]) if err != nil { fmt.Println("? boardsize must be an integer\n") return } switch v { case 9: Observer.Size = B9x9 case 11: Observer.Size = B11x11 case 13: Observer.Size = B13x13 case 15: Observer.Size = B15x15 case 19: Observer.Size = B19x19 default: fmt.Println("? unacceptable size\n") return } clear_board(args) } func clear_board(args protocol.Args) { Observer.ClearHistory() fmt.Println("=\n") } func komi(args protocol.Args) { if len(args) == 0 { fmt.Println("? komi must be a float\n") return } v, err := strconv.ParseFloat(args[0], 64) if err != nil { fmt.Println("? komi must be a float\n") return } Observer.Komi = v engine.Engine.Komi = v fmt.Println("=\n") } func play(args protocol.Args) { if len(args) < 2 { fmt.Println("? invalid parameter(s)\n") return } stone := StringToStone(args[0]) if stone == Wall || stone == Empty { fmt.Println("? invalid parameter(s)\n") return } point := StringToVertex(args[1], Observer.Size) if point == Outbound { //pass Observer.Pass() fmt.Println("=\n") return } mv := CreateMove(stone, point) ok := Observer.MakeMove(mv) if !ok { fmt.Println("? illegal move\n") return } fmt.Println("=\n") } func genmove(args protocol.Args) { if len(args) == 0 { fmt.Println("? invalid parameter(s)\n") return } stone := StringToStone(args[0]) if stone == Wall { fmt.Println("? invalid parameter(s)\n") return } if stone == Empty { // resign fmt.Println("= RESIGN\n") return } pos := Observer.GetCurrentPosition() selected := engine.Engine.Answer(pos, stone, Observer.GetLastMove()) ret := Observer.MakeMove(&selected) if !ret { fmt.Printf("= PASS\n\n") return } fmt.Printf("= %v\n\n", selected.String()) } func showboard(args protocol.Args) { fmt.Println("=\n") pos := Observer.GetCurrentPosition() pos.Dump() fmt.Printf("Black (X) : %v stones\n", pos.BlackPrison) fmt.Printf("White (O) : %v stones\n\n", pos.WhitePrison) }
<?xml version="1.0" encoding="utf-8"?> <html> <head> <title>GLib.Socket.get_broadcast -- Vala Binding Reference</title> <link href="../style.css" rel="stylesheet" type="text/css"/><script src="../scripts.js" type="text/javascript"> </script> </head> <body> <div class="site_header">GLib.Socket.get_broadcast Reference Manual</div> <div class="site_body"> <div class="site_navigation"> <ul class="navi_main"> <li class="package_index"><a href="../index.html">Packages</a></li> </ul> <hr class="navi_hr"/> <ul class="navi_main"> <li class="package"><a href="index.htm">gio-2.0</a></li> </ul> <hr class="navi_hr"/> <ul class="navi_main"> <li class="namespace"><a href="GLib.html">GLib</a></li> </ul> <hr class="navi_hr"/> <ul class="navi_main"> <li class="class"><a href="GLib.Socket.html">Socket</a></li> </ul> <hr class="navi_hr"/> <ul class="navi_main"> <li class="property"><a href="GLib.Socket.blocking.html">blocking</a></li> <li class="property"><a href="GLib.Socket.broadcast.html">broadcast</a></li> <li class="property"><a href="GLib.Socket.family.html">family</a></li> <li class="property"><a href="GLib.Socket.fd.html">fd</a></li> <li class="property"><a href="GLib.Socket.keepalive.html">keepalive</a></li> <li class="property"><a href="GLib.Socket.listen_backlog.html">listen_backlog</a></li> <li class="property"><a href="GLib.Socket.local_address.html">local_address</a></li> <li class="property"><a href="GLib.Socket.multicast_loopback.html">multicast_loopback</a></li> <li class="property"><a href="GLib.Socket.multicast_ttl.html">multicast_ttl</a></li> <li class="property"><a href="GLib.Socket.protocol.html">protocol</a></li> <li class="property"><a href="GLib.Socket.remote_address.html">remote_address</a></li> <li class="property"><a href="GLib.Socket.timeout.html">timeout</a></li> <li class="property"><a href="GLib.Socket.ttl.html">ttl</a></li> <li class="property"><a href="GLib.Socket.type.html">type</a></li> <li class="creation_method"><a href="GLib.Socket.Socket.html">Socket</a></li> <li class="creation_method"><a href="GLib.Socket.Socket.from_fd.html">Socket.from_fd</a></li> <li class="method"><a href="GLib.Socket.accept.html">accept</a></li> <li class="method"><a href="GLib.Socket.bind.html">bind</a></li> <li class="method"><a href="GLib.Socket.<API key>.html"><API key></a></li> <li class="method"><a href="GLib.Socket.close.html">close</a></li> <li class="method"><a href="GLib.Socket.condition_check.html">condition_check</a></li> <li class="method"><a href="GLib.Socket.<API key>.html"><API key></a></li> <li class="method"><a href="GLib.Socket.condition_wait.html">condition_wait</a></li> <li class="method"><a href="GLib.Socket.connect.html">connect</a></li> <li class="method"><a href="GLib.Socket.create_source.html">create_source</a></li> <li class="method"><a href="GLib.Socket.get_available_bytes.html">get_available_bytes</a></li> <li class="method"><a href="GLib.Socket.get_blocking.html">get_blocking</a></li> <li class="method">get_broadcast</li> <li class="method"><a href="GLib.Socket.get_credentials.html">get_credentials</a></li> <li class="method"><a href="GLib.Socket.get_family.html">get_family</a></li> <li class="method"><a href="GLib.Socket.get_fd.html">get_fd</a></li> <li class="method"><a href="GLib.Socket.get_keepalive.html">get_keepalive</a></li> <li class="method"><a href="GLib.Socket.get_listen_backlog.html">get_listen_backlog</a></li> <li class="method"><a href="GLib.Socket.get_local_address.html">get_local_address</a></li> <li class="method"><a href="GLib.Socket.<API key>.html"><API key></a></li> <li class="method"><a href="GLib.Socket.get_multicast_ttl.html">get_multicast_ttl</a></li> <li class="method"><a href="GLib.Socket.get_protocol.html">get_protocol</a></li> <li class="method"><a href="GLib.Socket.get_remote_address.html">get_remote_address</a></li> <li class="method"><a href="GLib.Socket.get_socket_type.html">get_socket_type</a></li> <li class="method"><a href="GLib.Socket.get_timeout.html">get_timeout</a></li> <li class="method"><a href="GLib.Socket.get_ttl.html">get_ttl</a></li> <li class="method"><a href="GLib.Socket.is_closed.html">is_closed</a></li> <li class="method"><a href="GLib.Socket.is_connected.html">is_connected</a></li> <li class="method"><a href="GLib.Socket.<API key>.html"><API key></a></li> <li class="method"><a href="GLib.Socket.<API key>.html"><API key></a></li> <li class="method"><a href="GLib.Socket.listen.html">listen</a></li> <li class="method"><a href="GLib.Socket.receive.html">receive</a></li> <li class="method"><a href="GLib.Socket.receive_from.html">receive_from</a></li> <li class="method"><a href="GLib.Socket.receive_message.html">receive_message</a></li> <li class="method"><a href="GLib.Socket.<API key>.html"><API key></a></li> <li class="method"><a href="GLib.Socket.send.html">send</a></li> <li class="method"><a href="GLib.Socket.send_message.html">send_message</a></li> <li class="method"><a href="GLib.Socket.send_to.html">send_to</a></li> <li class="method"><a href="GLib.Socket.send_with_blocking.html">send_with_blocking</a></li> <li class="method"><a href="GLib.Socket.set_blocking.html">set_blocking</a></li> <li class="method"><a href="GLib.Socket.set_broadcast.html">set_broadcast</a></li> <li class="method"><a href="GLib.Socket.set_keepalive.html">set_keepalive</a></li> <li class="method"><a href="GLib.Socket.set_listen_backlog.html">set_listen_backlog</a></li> <li class="method"><a href="GLib.Socket.<API key>.html"><API key></a></li> <li class="method"><a href="GLib.Socket.set_multicast_ttl.html">set_multicast_ttl</a></li> <li class="method"><a href="GLib.Socket.set_timeout.html">set_timeout</a></li> <li class="method"><a href="GLib.Socket.set_ttl.html">set_ttl</a></li> <li class="method"><a href="GLib.Socket.shutdown.html">shutdown</a></li> <li class="method"><a href="GLib.Socket.speaks_ipv4.html">speaks_ipv4</a></li> </ul> </div> <div class="site_content"> <h1 class="main_title">get_broadcast</h1> <hr class="main_hr"/> <h2 class="main_title">Description:</h2> <div class="<API key>"><span class="main_keyword">public</span> <span class="main_basic_type"><a href="../glib-2.0/bool.html" class="struct">bool</a></span> <b><span css="method">get_broadcast</span></b> () </div> </div> </div><br/> <div class="site_footer">Generated by <a href="http: </div> </body> </html>
html { font-family: "Verdana", "Arial", sans-serif; } .floatLeft { float: left !important; } .floatRight { float: right !important; } .newRow { clear: both; } #formsWrapper, #formsWrapper * { margin: 0; /*padding: 0;*/ position: relative; font-size: 1em; float: left; } .formerita { color: #333; } .formerita input, .formerita select, .formerita textarea, .fakeInput { border: 1px solid #9BABB0; -<API key>: 4px; -moz-border-radius: 4px; border-radius: 4px; color: #666666; font-family: "Courier", "Courier New" !important; } .fakeInput { border: none; background: #ddd; } .formerita fieldset { float: left; border: 1px solid #9BABB0; border-top: 2em solid #9BABB0; -<API key>: 4px; -moz-border-radius: 4px; border-radius: 4px; padding-bottom: 10px !important; /*margin-bottom: 20px !important;*/ background: #fff; } .formerita fieldset legend { float: left; font-size: 1.2em !important; font-weight: bolder; margin-top: -1.8em !important; } .formerita fieldset p { float: left; margin: 0; } .formerita label, .fakeLabel { font-size: 0.95em !important; font-weight: bolder; } button, .aButton { background: #ddd; border: 2px solid #9BABB0; -<API key>: 4px; -moz-border-radius: 4px; border-radius: 4px; padding: 5px 10px !important; margin: 3px !important; float: left; } .btnsArea { /*text-align: center !important;*/ } /* BASIC SIZING CLASSES */ .fullWidth, .fullWidth * label /* <-- labels are ALWAYS 100% */ { width: 100%; } .fullWidth_with { width: 99%; } .halfWidth { width: 50%; } .halfWidth_with { width: 49%; } .thirdWidth { width: 33%; } .thirdWidth_with { width: 32.33%; } .quarterWidth { width: 25%; } .quarterWidth_with { width: 24%; } .fullWidth * .padding { padding: 5px 0.5% !important; } .formerita legend, .formerita * input, .formerita * textarea { /* width: 99%; padding: 1px 0.5% !important; */ width: 100%; } .formerita * select { width: 100.2%; } .radio label, .checkBox label, .radio input, .checkBox input { width: auto; margin-right: 10px !important; float: none !important; line-height: 1em; clear: both; } /* ### TMP DEBUG CODE */ /* jQuery UI patches */ .ui-tabs { float: left; } .ui-tabs .ui-tabs-nav li a { float: left !important; padding: 0.5em 1em !important; } .ui-tabs .ui-tabs-nav { padding: 0.2em 0.2em 0 !important; float: none !important; } .ui-tabs, .ui-tabs-panel { padding: 0.8em 0.6em !important; width: 98.3% !important; }
// <auto-generated> // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> namespace Geekbot.Core.Localization { <summary> A strongly-typed resource class, for looking up localized strings, etc. </summary> // This class was auto-generated by the <API key> // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.<API key>("System.Resources.Tools.<API key>", "4.0.0.0")] [global::System.Diagnostics.<API key>()] [global::System.Runtime.CompilerServices.<API key>()] public class Choose { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.<API key>("Microsoft.Performance", "CA1811:<API key>")] public Choose() { } <summary> Returns the cached ResourceManager instance used by this class. </summary> [global::System.ComponentModel.<API key>(global::System.ComponentModel.<API key>.Advanced)] public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Geekbot.Core.Localization.Choose", typeof(Choose).Assembly); resourceMan = temp; } return resourceMan; } } <summary> Overrides the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource class. </summary> [global::System.ComponentModel.<API key>(global::System.ComponentModel.<API key>.Advanced)] public static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } <summary> Looks up a localized string similar to I Choose **{0}**. </summary> public static string Choice { get { return ResourceManager.GetString("Choice", resourceCulture); } } } }
package game; abstract class C_100140_bj implements C_100308_lh { private long field_102965_d; static String field_102969_a; static int field_102966_e; static int field_102963_f; static int field_102967_b; static int[] field_102968_c; static C_100037_wb field_102964_g; private static final String[] field_102970_z; static final void func_102953_a(int arg0, C_100112_r arg1, int arg2, int arg3, int arg4, C_100037_wb[] arg5, int arg6, int arg7, C_100037_wb[] arg8, C_100037_wb[] arg9, int arg10, int arg11, int arg12, int arg13, int arg14) { // @000: aload_1 // @001: getfield int game.C_100112_r.field_101769_u // @004: aload_1 // @005: getfield int game.C_100112_r.field_101763_H // @008: iadd // @009: istore // @00B: aload_1 // @00C: getfield int game.C_100112_r.field_101769_u // @00F: istore // @011: iload // @013: sipush 13789 (0x35DD) // @016: if_icmpeq @02C // @019: bipush 94 (0x5E) // @01B: bipush 39 (0x27) // @01D: bipush 124 (0x7C) // @01F: bipush -67 (0xBD) // @021: bipush -59 (0xC5) // @023: bipush -66 (0xBE) // @025: invokestatic game.C_100140_bj.func_102962_a(int, int, int, int, int, int)void // @028: goto @02C // @02B: athrow // @02C: iconst_1 // @02D: aload_1 // @02E: iload_2 // @02F: aload // @031: iload // @033: aload // @035: iload // @037: aload // @039: iload // @03B: iload // @03D: iload // @03F: iload // @041: sipush 480 (0x01E0) // @044: iload // @046: iload_0 // @047: iload // @049: iload // @04B: iload_3 // @04C: aload_1 // @04D: iload // @04F: iload // @051: invokestatic game.C_100061_dh.func_101977_a(boolean, game.C_100112_r, int, game.C_100037_wb[], int, game.C_100037_wb[], int, game.C_100037_wb[], int, int, int, int, int, int, int, int, int, int, game.C_100112_r, int, int)void // @054: goto @148 // @057: astore // @059: aload // @05B: new java.lang.StringBuilder // @05E: dup // @05F: invokespecial java.lang.StringBuilder.<init>()void // @062: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @065: bipush 9 (0x09) // @067: aaload // @068: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @06B: iload_0 // @06C: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @06F: bipush 44 (0x2C) // @071: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @074: aload_1 // @075: ifnull @081 // @078: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @07B: iconst_3 // @07C: aaload // @07D: goto @086 // @080: athrow // @081: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @084: iconst_2 // @085: aaload // @086: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @089: bipush 44 (0x2C) // @08B: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @08E: iload_2 // @08F: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @092: bipush 44 (0x2C) // @094: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @097: iload_3 // @098: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @09B: bipush 44 (0x2C) // @09D: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @0A0: iload // @0A2: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @0A5: bipush 44 (0x2C) // @0A7: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @0AA: aload // @0AC: ifnull @0B8 // @0AF: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @0B2: iconst_3 // @0B3: aaload // @0B4: goto @0BD // @0B7: athrow // @0B8: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @0BB: iconst_2 // @0BC: aaload // @0BD: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @0C0: bipush 44 (0x2C) // @0C2: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @0C5: iload // @0C7: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @0CA: bipush 44 (0x2C) // @0CC: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @0CF: iload // @0D1: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @0D4: bipush 44 (0x2C) // @0D6: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @0D9: aload // @0DB: ifnull @0E7 // @0DE: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @0E1: iconst_3 // @0E2: aaload // @0E3: goto @0EC // @0E6: athrow // @0E7: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @0EA: iconst_2 // @0EB: aaload // @0EC: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @0EF: bipush 44 (0x2C) // @0F1: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @0F4: aload // @0F6: ifnull @102 // @0F9: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @0FC: iconst_3 // @0FD: aaload // @0FE: goto @107 // @101: athrow // @102: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @105: iconst_2 // @106: aaload // @107: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @10A: bipush 44 (0x2C) // @10C: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @10F: iload // @111: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @114: bipush 44 (0x2C) // @116: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @119: iload // @11B: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @11E: bipush 44 (0x2C) // @120: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @123: iload // @125: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @128: bipush 44 (0x2C) // @12A: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @12D: iload // @12F: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @132: bipush 44 (0x2C) // @134: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @137: iload // @139: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @13C: bipush 41 (0x29) // @13E: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @141: invokevirtual java.lang.StringBuilder.toString()java.lang.String // @144: invokestatic game.C_100181_cf.func_105695_a(java.lang.Throwable, java.lang.String)game.C_100170_cm // @147: athrow // @148: return } abstract C_100133_tk func_102955_b(boolean arg0); public final String func_102949_c(int arg0) { // @00: aload_0 // @01: bipush -90 (0xA6) // @03: invokevirtual game.C_100140_bj.func_102952_a(int)boolean // @06: ifne @0D // @09: goto @0F // @0C: athrow // @0D: aconst_null // @0E: areturn // @0F: iload_1 // @10: bipush -105 (0x97) // @12: if_icmple @22 // @15: aconst_null // @16: checkcast java.lang.String // @19: bipush 112 (0x70) // @1B: invokestatic game.C_100140_bj.func_102961_a(java.lang.String, int)void // @1E: goto @22 // @21: athrow // @22: ldc2_w 350 // @25: aload_0 // @26: getfield long game.C_100140_bj.field_102965_d // @29: ladd // @2A: ldc2_w -1 // @2D: lxor // @2E: bipush 85 (0x55) // @30: invokestatic game.C_100198_qn.func_105828_a(byte)long // @33: ldc2_w -1 // @36: lxor // @37: lcmp // @38: ifge @3D // @3B: aconst_null // @3C: areturn // @3D: aload_0 // @3E: sipush -29062 (0x8E7A) // @41: invokevirtual game.C_100140_bj.func_102957_d(int)java.lang.String // @44: areturn // @45: astore_2 // @46: aload_2 // @47: new java.lang.StringBuilder // @4A: dup // @4B: invokespecial java.lang.StringBuilder.<init>()void // @4E: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @51: bipush 7 (0x07) // @53: aaload // @54: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @57: iload_1 // @58: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @5B: bipush 41 (0x29) // @5D: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @60: invokevirtual java.lang.StringBuilder.toString()java.lang.String // @63: invokestatic game.C_100181_cf.func_105695_a(java.lang.Throwable, java.lang.String)game.C_100170_cm // @66: athrow } static final void func_102961_a(String arg0, int arg1) { // @00: iload_1 // @01: bipush 6 (0x06) // @03: if_icmpeq @17 // @06: bipush -87 (0xA9) // @08: bipush -10 (0xF6) // @0A: bipush 104 (0x68) // @0C: iconst_1 // @0D: bipush -104 (0x98) // @0F: bipush 88 (0x58) // @11: bipush -22 (0xEA) // @13: invokestatic game.C_100140_bj.func_102959_a(int, int, int, boolean, int, int, int)boolean // @16: pop // @17: goto @55 // @1A: astore_2 // @1B: aload_2 // @1C: new java.lang.StringBuilder // @1F: dup // @20: invokespecial java.lang.StringBuilder.<init>()void // @23: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @26: iconst_4 // @27: aaload // @28: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @2B: aload_0 // @2C: ifnull @38 // @2F: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @32: iconst_3 // @33: aaload // @34: goto @3D // @37: athrow // @38: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @3B: iconst_2 // @3C: aaload // @3D: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @40: bipush 44 (0x2C) // @42: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @45: iload_1 // @46: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @49: bipush 41 (0x29) // @4B: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @4E: invokevirtual java.lang.StringBuilder.toString()java.lang.String // @51: invokestatic game.C_100181_cf.func_105695_a(java.lang.Throwable, java.lang.String)game.C_100170_cm // @54: athrow // @55: return } public final void func_102951_b(int arg0) { // @00: bipush -98 (0x9E) // @02: bipush 48 (0x30) // @04: iload_1 // @05: isub // @06: bipush 36 (0x24) // @08: idiv // @09: irem // @0A: istore_2 // @0B: aload_0 // @0C: bipush -125 (0x83) // @0E: invokestatic game.C_100198_qn.func_105828_a(byte)long // @11: putfield long game.C_100140_bj.field_102965_d // @14: goto @39 // @17: astore_2 // @18: aload_2 // @19: new java.lang.StringBuilder // @1C: dup // @1D: invokespecial java.lang.StringBuilder.<init>()void // @20: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @23: bipush 10 (0x0A) // @25: aaload // @26: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @29: iload_1 // @2A: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @2D: bipush 41 (0x29) // @2F: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @32: invokevirtual java.lang.StringBuilder.toString()java.lang.String // @35: invokestatic game.C_100181_cf.func_105695_a(java.lang.Throwable, java.lang.String)game.C_100170_cm // @38: athrow // @39: return } static final void func_102960_a(boolean arg0) { // @000: getstatic int game.SteelSentinels.field_105275_O // @003: istore_2 // @004: getstatic int[] game.C_100046_vk.field_102765_ub // @007: iconst_1 // @008: iconst_5 // @009: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @00C: getstatic int[] game.C_100122_em.field_102077_Wb // @00F: iload_0 // @010: ifne @018 // @013: iconst_1 // @014: goto @019 // @017: athrow // @018: iconst_0 // @019: bipush 6 (0x06) // @01B: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @01E: getstatic int[] game.C_100061_dh.field_101979_dc // @021: iconst_1 // @022: bipush 8 (0x08) // @024: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @027: getstatic int[] game.C_100341_jd.field_102651_mb // @02A: iconst_1 // @02B: bipush 13 (0x0D) // @02D: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @030: getstatic int[] game.C_100239_oi.field_102305_J // @033: iconst_1 // @034: bipush 14 (0x0E) // @036: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @039: getstatic int[] game.C_100183_cd.field_103419_P // @03C: iconst_1 // @03D: bipush 20 (0x14) // @03F: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @042: aconst_null // @043: putstatic game.C_100302_ka game.C_100145_ta.field_100429_j // @046: getstatic int game.C_100212_qc.field_105976_b // @049: iconst_m1 // @04A: ixor // @04B: iconst_m1 // @04C: if_icmplt @069 // @04F: getstatic int[] game.C_100159_sn.field_105404_a // @052: iconst_1 // @053: bipush 6 (0x06) // @055: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @058: getstatic int[] game.C_100106_ef.field_104750_f // @05B: iconst_1 // @05C: bipush 8 (0x08) // @05E: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @061: iload_2 // @062: ifeq @07F // @065: goto @069 // @068: athrow // @069: getstatic int[] game.C_100122_em.field_102077_Wb // @06C: iconst_1 // @06D: bipush 6 (0x06) // @06F: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @072: getstatic int[] game.C_100061_dh.field_101979_dc // @075: iconst_1 // @076: bipush 8 (0x08) // @078: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @07B: goto @07F // @07E: athrow // @07F: getstatic int game.C_100212_qc.field_105976_b // @082: ifle @0A7 // @085: getstatic int[] game.C_100310_lj.field_100546_B // @088: iconst_1 // @089: iconst_0 // @08A: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @08D: getstatic int[] game.C_100333_ij.field_107345_d // @090: iload_0 // @091: ifne @09D // @094: goto @098 // @097: athrow // @098: iconst_1 // @099: goto @09E // @09C: athrow // @09D: iconst_0 // @09E: bipush 19 (0x13) // @0A0: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @0A3: iload_2 // @0A4: ifeq @0BD // @0A7: getstatic int[] game.C_100174_sb.field_105607_d // @0AA: iload_0 // @0AB: ifne @0B7 // @0AE: goto @0B2 // @0B1: athrow // @0B2: iconst_1 // @0B3: goto @0B8 // @0B6: athrow // @0B7: iconst_0 // @0B8: bipush 19 (0x13) // @0BA: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @0BD: bipush -50 (0xCE) // @0BF: invokestatic game.C_100100_i.func_102004_l(int)boolean // @0C2: ifne @0C9 // @0C5: goto @0D2 // @0C8: athrow // @0C9: getstatic java.lang.String[] game.C_100268_mk.field_106669_b // @0CC: bipush 34 (0x22) // @0CE: getstatic java.lang.String game.C_100242_oh.field_106345_b // @0D1: aastore // @0D2: iload_0 // @0D3: ifeq @0D7 // @0D6: return // @0D7: sipush -25065 (0x9E17) // @0DA: invokestatic game.C_100012_fh.func_100501_d(int)boolean // @0DD: ifeq @0E4 // @0E0: goto @116 // @0E3: athrow // @0E4: getstatic int[] game.C_100180_ce.field_104806_w // @0E7: iconst_1 // @0E8: iconst_1 // @0E9: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @0EC: getstatic int[] game.C_100015_wh.field_103788_o // @0EF: iconst_1 // @0F0: iconst_2 // @0F1: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @0F4: getstatic int[] game.C_100211_qd.field_102164_fc // @0F7: iload_0 // @0F8: ifne @100 // @0FB: iconst_1 // @0FC: goto @101 // @0FF: athrow // @100: iconst_0 // @101: iconst_3 // @102: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @105: getstatic int[] game.C_100226_ae.field_106150_b // @108: iload_0 // @109: ifne @111 // @10C: iconst_1 // @10D: goto @112 // @110: athrow // @111: iconst_0 // @112: iconst_4 // @113: invokestatic game.C_100102_w.func_104623_a(int[], boolean, int)void // @116: goto @13B // @119: astore_1 // @11A: aload_1 // @11B: new java.lang.StringBuilder // @11E: dup // @11F: invokespecial java.lang.StringBuilder.<init>()void // @122: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @125: bipush 8 (0x08) // @127: aaload // @128: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @12B: iload_0 // @12C: invokevirtual java.lang.StringBuilder.append(boolean)java.lang.StringBuilder // @12F: bipush 41 (0x29) // @131: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @134: invokevirtual java.lang.StringBuilder.toString()java.lang.String // @137: invokestatic game.C_100181_cf.func_105695_a(java.lang.Throwable, java.lang.String)game.C_100170_cm // @13A: athrow // @13B: return } public final C_100133_tk func_102950_a(byte arg0) { // @00: aload_0 // @01: bipush -86 (0xAA) // @03: invokevirtual game.C_100140_bj.func_102952_a(int)boolean // @06: ifne @0D // @09: goto @11 // @0C: athrow // @0D: getstatic game.C_100133_tk game.C_100034_gi.field_104034_l // @10: areturn // @11: aload_0 // @12: getfield long game.C_100140_bj.field_102965_d // @15: ldc2_w -350 // @18: lsub // @19: bipush -39 (0xD9) // @1B: invokestatic game.C_100198_qn.func_105828_a(byte)long // @1E: lcmp // @1F: ifgt @26 // @22: goto @2A // @25: athrow // @26: getstatic game.C_100133_tk game.C_100297_kf.field_101234_s // @29: areturn // @2A: iload_1 // @2B: bipush 77 (0x4D) // @2D: if_icmpeq @39 // @30: bipush -99 (0x9D) // @32: putstatic int game.C_100140_bj.field_102967_b // @35: goto @39 // @38: athrow // @39: aload_0 // @3A: iconst_0 // @3B: invokevirtual game.C_100140_bj.func_102955_b(boolean)game.C_100133_tk // @3E: areturn // @3F: astore_2 // @40: aload_2 // @41: new java.lang.StringBuilder // @44: dup // @45: invokespecial java.lang.StringBuilder.<init>()void // @48: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @4B: iconst_0 // @4C: aaload // @4D: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @50: iload_1 // @51: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @54: bipush 41 (0x29) // @56: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @59: invokevirtual java.lang.StringBuilder.toString()java.lang.String // @5C: invokestatic game.C_100181_cf.func_105695_a(java.lang.Throwable, java.lang.String)game.C_100170_cm // @5F: athrow } static final boolean func_102959_a(int arg0, int arg1, int arg2, boolean arg3, int arg4, int arg5, int arg6) { // @00: iload // @02: sipush -16671 (0xBEE1) // @05: if_icmpeq @0A // @08: iconst_0 // @09: ireturn // @0A: iload // @0C: sipush -16735 (0xBEA1) // @0F: ixor // @10: invokestatic game.C_100087_n.func_100688_e(int)boolean // @13: ifeq @5C // @16: bipush -67 (0xBD) // @18: iload_0 // @19: iload // @1B: iload_3 // @1C: invokestatic game.C_100207_qh.func_102865_a(int, int, int, boolean)void // @1F: aconst_null // @20: getstatic game.C_100022_hf game.C_100136_th.field_102623_R // @23: if_acmpeq @49 // @26: goto @2A // @29: athrow // @2A: getstatic game.C_100022_hf game.C_100136_th.field_102623_R // @2D: iload_3 // @2E: iload // @30: bipush -99 (0x9D) // @32: iload_0 // @33: iload_2 // @34: invokevirtual game.C_100022_hf.func_103876_a(boolean, int, byte, int, int)boolean // @37: ifne @42 // @3A: goto @3E // @3D: athrow // @3E: goto @49 // @41: athrow // @42: bipush 46 (0x2E) // @44: invokestatic game.C_100290_jm.func_106853_a(byte)void // @47: iconst_0 // @48: istore_3 // @49: iload_3 // @4A: iload_0 // @4B: iload // @4D: sipush 16752 (0x4170) // @50: ixor // @51: invokestatic game.C_100171_cn.func_105554_a(boolean, int, int)void // @54: iconst_m1 // @55: iload_3 // @56: iload_1 // @57: invokestatic game.C_100049_vf.func_104195_a(int, boolean, int)void // @5A: iconst_0 // @5B: istore_3 // @5C: iload_3 // @5D: ireturn // @5E: astore // @60: aload // @62: new java.lang.StringBuilder // @65: dup // @66: invokespecial java.lang.StringBuilder.<init>()void // @69: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @6C: iconst_5 // @6D: aaload // @6E: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @71: iload_0 // @72: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @75: bipush 44 (0x2C) // @77: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @7A: iload_1 // @7B: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @7E: bipush 44 (0x2C) // @80: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @83: iload_2 // @84: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @87: bipush 44 (0x2C) // @89: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @8C: iload_3 // @8D: invokevirtual java.lang.StringBuilder.append(boolean)java.lang.StringBuilder // @90: bipush 44 (0x2C) // @92: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @95: iload // @97: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @9A: bipush 44 (0x2C) // @9C: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @9F: iload // @A1: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @A4: bipush 44 (0x2C) // @A6: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @A9: iload // @AB: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @AE: bipush 41 (0x29) // @B0: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @B3: invokevirtual java.lang.StringBuilder.toString()java.lang.String // @B6: invokestatic game.C_100181_cf.func_105695_a(java.lang.Throwable, java.lang.String)game.C_100170_cm // @B9: athrow } abstract String func_102957_d(int arg0); static final void func_102962_a(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5) { // @000: getstatic int game.SteelSentinels.field_105275_O // @003: istore // @005: iconst_2 // @006: iload_3 // @007: iadd // @008: sipush 493 (0x01ED) // @00B: iload // @00D: iadd // @00E: iadd // @00F: bipush -8 (0xF8) // @011: isub // @012: istore // @014: getstatic game.C_100302_ka game.C_100170_cm.field_105544_o // @017: iconst_3 // @018: bipush -6 (0xFA) // @01A: getstatic game.C_100302_ka game.C_100265_mh.field_106621_l // @01D: getfield int game.C_100302_ka.field_101848_lb // @020: iadd // @021: iload // @023: sipush -7906 (0xE11E) // @026: ixor // @027: iconst_3 // @028: bipush -6 (0xFA) // @02A: iload // @02C: iadd // @02D: invokevirtual game.C_100302_ka.func_101825_a(int, int, int, int, int)void // @030: getstatic game.C_100302_ka game.C_100170_cm.field_105544_o // @033: getfield int game.C_100302_ka.field_101848_lb // @036: iconst_5 // @037: isub // @038: istore // @03A: getstatic game.C_100302_ka game.C_100019_wl.field_103844_b // @03D: iconst_5 // @03E: iload_0 // @03F: iconst_m1 // @040: iload // @042: iload_0 // @043: ineg // @044: iadd // @045: sipush 485 (0x01E5) // @048: iload_3 // @049: iadd // @04A: bipush -2 (0xFE) // @04C: isub // @04D: iload // @04F: iadd // @050: invokevirtual game.C_100302_ka.func_101825_a(int, int, int, int, int)void // @053: getstatic game.C_100302_ka game.C_100235_om.field_106296_j // @056: iload_3 // @057: iload_0 // @058: iconst_m1 // @059: iconst_0 // @05A: getstatic game.C_100302_ka game.C_100127_tl.field_104946_d // @05D: getfield int game.C_100302_ka.field_101886_Kb // @060: ineg // @061: getstatic game.C_100302_ka game.C_100019_wl.field_103844_b // @064: getfield int game.C_100302_ka.field_101886_Kb // @067: iload_3 // @068: ineg // @069: iadd // @06A: iadd // @06B: invokevirtual game.C_100302_ka.func_101825_a(int, int, int, int, int)void // @06E: iload // @070: iconst_2 // @071: iload_0 // @072: iadd // @073: isub // @074: istore // @076: getstatic game.C_100302_ka game.C_100127_tl.field_104946_d // @079: iload_3 // @07A: getstatic game.C_100302_ka game.C_100235_om.field_106296_j // @07D: getfield int game.C_100302_ka.field_101886_Kb // @080: ineg // @081: isub // @082: iload_0 // @083: iconst_m1 // @084: iconst_0 // @085: getstatic game.C_100302_ka game.C_100127_tl.field_104946_d // @088: getfield int game.C_100302_ka.field_101886_Kb // @08B: invokevirtual game.C_100302_ka.func_101825_a(int, int, int, int, int)void // @08E: getstatic game.C_100115_ej game.C_100081_ue.field_100670_q // @091: iconst_2 // @092: bipush -5 (0xFB) // @094: iload // @096: iadd // @097: iconst_5 // @098: iconst_0 // @099: iload_3 // @09A: sipush 485 (0x01E5) // @09D: iadd // @09E: iconst_2 // @09F: iload // @0A1: ineg // @0A2: isub // @0A3: iadd // @0A4: iconst_5 // @0A5: iload // @0A7: invokevirtual game.C_100115_ej.func_102030_a(int, int, int, int, int, int, int)void // @0AA: aconst_null // @0AB: getstatic game.C_100320_hh game.C_100047_vh.field_104150_d // @0AE: if_acmpeq @0D5 // @0B1: getstatic game.C_100320_hh game.C_100047_vh.field_104150_d // @0B4: getstatic game.C_100115_ej game.C_100081_ue.field_100670_q // @0B7: getfield int game.C_100115_ej.field_101848_lb // @0BA: getstatic game.C_100115_ej game.C_100081_ue.field_100670_q // @0BD: getfield int game.C_100115_ej.field_101880_Gb // @0C0: getstatic game.C_100115_ej game.C_100081_ue.field_100670_q // @0C3: getfield int game.C_100115_ej.field_101841_Pb // @0C6: getstatic game.C_100115_ej game.C_100081_ue.field_100670_q // @0C9: getfield int game.C_100115_ej.field_101886_Kb // @0CC: bipush 47 (0x2F) // @0CE: invokevirtual game.C_100320_hh.func_102524_a(int, int, int, int, byte)void // @0D1: goto @0D5 // @0D4: athrow // @0D5: iload // @0D7: ineg // @0D8: getstatic game.C_100302_ka game.C_100265_mh.field_106621_l // @0DB: getfield int game.C_100302_ka.field_101886_Kb // @0DE: iadd // @0DF: iload_3 // @0E0: ineg // @0E1: iadd // @0E2: istore // @0E4: iload // @0E6: iconst_2 // @0E7: idiv // @0E8: istore // @0EA: iload_3 // @0EB: iload // @0ED: iadd // @0EE: iload_2 // @0EF: ineg // @0F0: isub // @0F1: istore // @0F3: iload // @0F5: sipush 7905 (0x1EE1) // @0F8: if_icmpeq @108 // @0FB: aconst_null // @0FC: checkcast java.lang.String // @0FF: bipush 102 (0x66) // @101: invokestatic game.C_100140_bj.func_102961_a(java.lang.String, int)void // @104: goto @108 // @107: athrow // @108: iconst_0 // @109: istore // @10B: iconst_0 // @10C: istore // @10E: iload // @110: iconst_m1 // @111: ixor // @112: bipush -7 (0xF9) // @114: if_icmple @200 // @117: iload // @119: ifne @256 // @11C: iload // @11E: iconst_m1 // @11F: ixor // @120: bipush -6 (0xFA) // @122: if_icmple @13F // @125: goto @129 // @128: athrow // @129: getstatic game.C_100302_ka[] game.C_100152_bd.field_105211_i // @12C: iload // @12E: aaload // @12F: ifnonnull @13F // @132: goto @136 // @135: athrow // @136: iload // @138: ifeq @1F8 // @13B: goto @13F // @13E: athrow // @13F: iconst_3 // @140: bipush -6 (0xFA) // @142: getstatic game.C_100302_ka game.C_100265_mh.field_106621_l // @145: getfield int game.C_100302_ka.field_101848_lb // @148: iconst_2 // @149: iadd // @14A: iadd // @14B: iload // @14D: imul // @14E: getstatic int game.C_100211_qd.field_102149_xc // @151: iconst_1 // @152: iadd // @153: idiv // @154: iadd // @155: istore // @157: iinc #11 +1 // @15A: iload // @15C: ineg // @15D: bipush -2 (0xFE) // @15F: iadd // @160: bipush -6 (0xFA) // @162: getstatic game.C_100302_ka game.C_100265_mh.field_106621_l // @165: getfield int game.C_100302_ka.field_101848_lb // @168: iconst_2 // @169: iadd // @16A: iadd // @16B: iload // @16D: imul // @16E: iconst_1 // @16F: getstatic int game.C_100211_qd.field_102149_xc // @172: iadd // @173: idiv // @174: iconst_3 // @175: iadd // @176: iadd // @177: istore // @179: iconst_5 // @17A: iload // @17C: if_icmpgt @197 // @17F: getstatic game.C_100302_ka game.C_100031_gl.field_103963_g // @182: iload // @184: iload // @186: iconst_m1 // @187: iload // @189: iload // @18B: invokevirtual game.C_100302_ka.func_101825_a(int, int, int, int, int)void // @18E: iload // @190: ifeq @1F8 // @193: goto @197 // @196: athrow // @197: getstatic game.C_100302_ka[] game.C_100152_bd.field_105211_i // @19A: iload // @19C: aaload // @19D: iload // @19F: iload // @1A1: iconst_m1 // @1A2: iload // @1A4: iload // @1A6: invokevirtual game.C_100302_ka.func_101825_a(int, int, int, int, int)void // @1A9: getstatic game.C_100302_ka[] game.C_100338_jc.field_105374_h // @1AC: iload // @1AE: aaload // @1AF: iload_3 // @1B0: iload // @1B2: iconst_m1 // @1B3: iconst_0 // @1B4: iload // @1B6: iload_3 // @1B7: ineg // @1B8: iadd // @1B9: invokevirtual game.C_100302_ka.func_101825_a(int, int, int, int, int)void // @1BC: getstatic game.C_100302_ka[] game.C_100067_vd.field_104323_h // @1BF: iload // @1C1: aaload // @1C2: iload // @1C4: iload_1 // @1C5: ineg // @1C6: iload // @1C8: iadd // @1C9: iload_1 // @1CA: isub // @1CB: iload // @1CD: sipush -7906 (0xE11E) // @1D0: ixor // @1D1: iload_1 // @1D2: iload_2 // @1D3: invokevirtual game.C_100302_ka.func_101825_a(int, int, int, int, int)void // @1D6: getstatic game.C_100302_ka[] game.C_100288_jn.field_106845_a // @1D9: iload // @1DB: aaload // @1DC: iload // @1DE: iload_1 // @1DF: ineg // @1E0: iload_1 // @1E1: ineg // @1E2: iload // @1E4: iadd // @1E5: iadd // @1E6: iconst_m1 // @1E7: iload_1 // @1E8: iload // @1EA: ineg // @1EB: iload_3 // @1EC: ineg // @1ED: iadd // @1EE: iload // @1F0: iadd // @1F1: invokevirtual game.C_100302_ka.func_101825_a(int, int, int, int, int)void // @1F4: goto @1F8 // @1F7: athrow // @1F8: iinc #12 +1 // @1FB: iload // @1FD: ifeq @10E // @200: goto @256 // @203: astore // @205: aload // @207: new java.lang.StringBuilder // @20A: dup // @20B: invokespecial java.lang.StringBuilder.<init>()void // @20E: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @211: bipush 6 (0x06) // @213: aaload // @214: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @217: iload_0 // @218: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @21B: bipush 44 (0x2C) // @21D: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @220: iload_1 // @221: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @224: bipush 44 (0x2C) // @226: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @229: iload_2 // @22A: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @22D: bipush 44 (0x2C) // @22F: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @232: iload_3 // @233: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @236: bipush 44 (0x2C) // @238: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @23B: iload // @23D: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @240: bipush 44 (0x2C) // @242: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @245: iload // @247: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @24A: bipush 41 (0x29) // @24C: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @24F: invokevirtual java.lang.StringBuilder.toString()java.lang.String // @252: invokestatic game.C_100181_cf.func_105695_a(java.lang.Throwable, java.lang.String)game.C_100170_cm // @255: athrow // @256: return } public static void func_102958_e(int arg0) { // @00: aconst_null // @01: putstatic java.lang.String game.C_100140_bj.field_102969_a // @04: aconst_null // @05: putstatic int[] game.C_100140_bj.field_102968_c // @08: iload_0 // @09: sipush 485 (0x01E5) // @0C: if_icmpeq @1A // @0F: aconst_null // @10: checkcast game.C_100037_wb // @13: putstatic game.C_100037_wb game.C_100140_bj.field_102964_g // @16: goto @1A // @19: athrow // @1A: aconst_null // @1B: putstatic game.C_100037_wb game.C_100140_bj.field_102964_g // @1E: goto @42 // @21: astore_1 // @22: aload_1 // @23: new java.lang.StringBuilder // @26: dup // @27: invokespecial java.lang.StringBuilder.<init>()void // @2A: getstatic java.lang.String[] game.C_100140_bj.field_102970_z // @2D: iconst_1 // @2E: aaload // @2F: invokevirtual java.lang.StringBuilder.append(java.lang.String)java.lang.StringBuilder // @32: iload_0 // @33: invokevirtual java.lang.StringBuilder.append(int)java.lang.StringBuilder // @36: bipush 41 (0x29) // @38: invokevirtual java.lang.StringBuilder.append(char)java.lang.StringBuilder // @3B: invokevirtual java.lang.StringBuilder.toString()java.lang.String // @3E: invokestatic game.C_100181_cf.func_105695_a(java.lang.Throwable, java.lang.String)game.C_100170_cm // @41: athrow // @42: return } static { // @00: bipush 11 (0x0B) // @02: anewarray java.lang.String // @05: dup // @06: iconst_0 // @07: ldc "=\u001b\u007fX\u007f" // @09: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @0C: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @0F: aastore // @10: dup // @11: iconst_1 // @12: ldc "=\u001b\u007f^\u007f" // @14: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @17: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @1A: aastore // @1B: dup // @1C: iconst_2 // @1D: ldc "1\u0004=}" // @1F: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @22: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @25: aastore // @26: dup // @27: iconst_3 // @28: ldc "$_\u007f?*" // @2A: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @2D: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @30: aastore // @31: dup // @32: iconst_4 // @33: ldc "=\u001b\u007f_\u007f" // @35: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @38: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @3B: aastore // @3C: dup // @3D: iconst_5 // @3E: ldc "=\u001b\u007f\\\u007f" // @40: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @43: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @46: aastore // @47: dup // @48: bipush 6 (0x06) // @4A: ldc "=\u001b\u007fA\u007f" // @4C: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @4F: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @52: aastore // @53: dup // @54: bipush 7 (0x07) // @56: ldc "=\u001b\u007fZ\u007f" // @58: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @5B: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @5E: aastore // @5F: dup // @60: bipush 8 (0x08) // @62: ldc "=\u001b\u007f@\u007f" // @64: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @67: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @6A: aastore // @6B: dup // @6C: bipush 9 (0x09) // @6E: ldc "=\u001b\u007f]\u007f" // @70: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @73: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @76: aastore // @77: dup // @78: bipush 10 (0x0A) // @7A: ldc "=\u001b\u007f[\u007f" // @7C: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @7F: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @82: aastore // @83: putstatic java.lang.String[] game.C_100140_bj.field_102970_z // @86: ldc "\u000b\u00198bw0\u0001%x81Q2p91\u001e%15:Q2~:=\u0018?t3\u007f\u00068e?\u007f\u00059tw<\u0004#c21\u0005q6kzAo6w,\u0014%e>1\u0016\u007f" // @88: invokestatic game.C_100140_bj.func_102956_z(java.lang.String)char[] // @8B: invokestatic game.C_100140_bj.func_102954_z(char[])java.lang.String // @8E: putstatic java.lang.String game.C_100140_bj.field_102969_a // @91: iconst_5 // @92: newarray int[] // @94: putstatic int[] game.C_100140_bj.field_102968_c // @97: return } private static char[] func_102956_z(String arg0) { // @00: aload_0 // @01: invokevirtual java.lang.String.toCharArray()char[] // @04: dup // @05: arraylength // @06: iconst_2 // @07: if_icmpge @13 // @0A: dup // @0B: iconst_0 // @0C: dup2 // @0D: caload // @0E: bipush 87 (0x57) // @10: ixor // @11: i2c // @12: castore // @13: areturn } private static String func_102954_z(char[] arg0) { // @00: aload_0 // @01: dup // @02: arraylength // @03: swap // @04: iconst_0 // @05: istore_1 // @06: goto @4C // @09: dup // @0A: iload_1 // @0B: dup2 // @0C: caload // @0D: iload_1 // @0E: iconst_5 // @0F: irem // @10: tableswitch def: @44, for 0: @30, for 1: @35, for 2: @3A, for 3: @3F // @30: bipush 95 (0x5F) // @32: goto @46 // @35: bipush 113 (0x71) // @37: goto @46 // @3A: bipush 81 (0x51) // @3C: goto @46 // @3F: bipush 17 (0x11) // @41: goto @46 // @44: bipush 87 (0x57) // @46: ixor // @47: i2c // @48: castore // @49: iinc #1 +1 // @4C: swap // @4D: dup_x1 // @4E: iload_1 // @4F: if_icmpgt @09 // @52: new java.lang.String // @55: dup_x1 // @56: swap // @57: invokespecial java.lang.String.<init>(char[])void // @5A: invokevirtual java.lang.String.intern()java.lang.String // @5D: areturn } }
#include "sd_stm32f2_f4.h" #include "interfaces/bsp.h" #include "interfaces/arch_registers.h" #include "kernel/scheduler/scheduler.h" #include "interfaces/delays.h" #include "kernel/kernel.h" #include "board_settings.h" //For sdVoltage and SD_ONE_BIT_DATABUS definitions #include <cstdio> #include <cstring> #include <errno.h> //Note: enabling debugging might cause deadlock when using sleep() or reboot() //The bug won't be fixed because debugging is only useful for driver development \internal Debug macro, for normal conditions //#define DBG iprintf #define DBG(x,...) ; \internal Debug macro, for errors only //#define DBGERR iprintf #define DBGERR(x,...) ; /** * \internal * DMA2 Stream3 interrupt handler */ void __attribute__((naked)) <API key>() { saveContext(); asm volatile("bl <API key>"); restoreContext(); } /** * \internal * SDIO interrupt handler */ void __attribute__((naked)) SDIO_IRQHandler() { saveContext(); asm volatile("bl <API key>"); restoreContext(); } namespace miosix { static volatile bool transferError; ///< \internal DMA or SDIO transfer error static Thread *waiting; ///< \internal Thread waiting for transfer static unsigned int dmaFlags; ///< \internal DMA status flags static unsigned int sdioFlags; ///< \internal SDIO status flags /** * \internal * DMA2 Stream3 interrupt handler actual implementation */ void __attribute__((used)) DMA2stream3irqImpl() { dmaFlags=DMA2->LISR; if(dmaFlags & (DMA_LISR_TEIF3 | DMA_LISR_DMEIF3 | DMA_LISR_FEIF3)) transferError=true; DMA2->LIFCR=DMA_LIFCR_CTCIF3 | DMA_LIFCR_CTEIF3 | DMA_LIFCR_CDMEIF3 | DMA_LIFCR_CFEIF3; if(!waiting) return; waiting->IRQwakeup(); if(waiting->IRQgetPriority()>Thread::IRQgetCurrentThread()->IRQgetPriority()) Scheduler::IRQfindNextThread(); waiting=0; } /** * \internal * DMA2 Stream3 interrupt handler actual implementation */ void __attribute__((used)) SDIOirqImpl() { sdioFlags=SDIO->STA; if(sdioFlags & (SDIO_STA_STBITERR | SDIO_STA_RXOVERR | SDIO_STA_TXUNDERR | SDIO_STA_DTIMEOUT | SDIO_STA_DCRCFAIL)) transferError=true; SDIO->ICR=0x7ff;//Clear flags if(!waiting) return; waiting->IRQwakeup(); if(waiting->IRQgetPriority()>Thread::IRQgetCurrentThread()->IRQgetPriority()) Scheduler::IRQfindNextThread(); waiting=0; } /* * Operating voltage of device. It is sent to the SD card to check if it can * work at this voltage. Range *must* be within 28..36 * Example 33=3.3v */ //static const unsigned char sdVoltage=33; //Is defined in board_settings.h static const unsigned int sdVoltageMask=1<<(sdVoltage-13); //See OCR reg in SD spec /** * \internal * Possible state of the cardType variable. */ enum CardType { Invalid=0, ///<\internal Invalid card type MMC=1<<0, ///<\internal if(cardType==MMC) card is an MMC SDv1=1<<1, ///<\internal if(cardType==SDv1) card is an SDv1 SDv2=1<<2, ///<\internal if(cardType==SDv2) card is an SDv2 SDHC=1<<3 ///<\internal if(cardType==SDHC) card is an SDHC }; \internal Type of card. static CardType cardType=Invalid; //SD card GPIOs typedef Gpio<GPIOC_BASE,8> sdD0; typedef Gpio<GPIOC_BASE,9> sdD1; typedef Gpio<GPIOC_BASE,10> sdD2; typedef Gpio<GPIOC_BASE,11> sdD3; typedef Gpio<GPIOC_BASE,12> sdCLK; typedef Gpio<GPIOD_BASE,2> sdCMD; // Class BufferConverter /** * \internal * After fixing the FSMC bug in the stm32f1, ST decided to willingly introduce * another quirk in the stm32f4. They introduced a core coupled memory that is * not accessible by the DMA. While from an hardware perspective it may make * sense, it is a bad design decision when viewed from the software side. * This is because if application code allocates a buffer in the core coupled * memory and passes that to an fread() or fwrite() call, that buffer is * forwarded here, and this driver is DMA-based... Now, in an OS such as Miosix * that tries to shield the application developer from such quirks, it is * unacceptable to fail to work in such an use case, so this class exists to * try and work around this. * In essence, the first "bad buffer" that is passed to a readBlock() or * writeBlock() causes the allocation on the heap (which Miosix guarantees * is not allocated in the core coupled memory) of a 512 byte buffer which is * then never deallocated and always reused to deal with these bad buffers. * While this works, performance suffers for two reasons: first, when dealing * with those bad buffers, the filesystem code is no longer zero copy, and * second because multiple block read/writes between bad buffers and the SD * card are implemented as a sequence of single block read/writes. * If you're an application developer and care about speed, try to allocate * your buffers in the heap if you're coding for the STM32F4. */ class BufferConverter { public: /** * \internal * The buffer will be of this size only. */ static const int BUFFER_SIZE=512; /** * \internal * \return true if the pointer is not inside the CCM */ static bool isGoodBuffer(const void *x) { unsigned int ptr=reinterpret_cast<const unsigned int>(x); return (ptr<0x10000000) || (ptr>=(0x10000000+64*1024)); } /** * \internal * Convert from a constunsigned char* buffer of size BUFFER_SIZE to a * const unsigned int* word aligned buffer. * If the original buffer is already word aligned it only does a cast, * otherwise it copies the data on the original buffer to a word aligned * buffer. Useful if subseqent code will read from the buffer. * \param a buffer of size BUFFER_SIZE. Can be word aligned or not. * \return a word aligned buffer with the same data of the given buffer */ static const unsigned char *toWordAligned(const unsigned char *buffer); /** * \internal * Convert from an unsigned char* buffer of size BUFFER_SIZE to an * unsigned int* word aligned buffer. * If the original buffer is already word aligned it only does a cast, * otherwise it returns a new buffer which *does not* contain the data * on the original buffer. Useful if subseqent code will write to the * buffer. To move the written data to the original buffer, use * toOriginalBuffer() * \param a buffer of size BUFFER_SIZE. Can be word aligned or not. * \return a word aligned buffer with undefined content. */ static unsigned char *<API key>(unsigned char *buffer); /** * \internal * Convert the buffer got through <API key>() to the * original buffer. If the original buffer was word aligned, nothing * happens, otherwise a memcpy is done. * Note that this function does not work on buffers got through * toWordAligned(). */ static void toOriginalBuffer(); /** * \internal * Can be called to deallocate the buffer */ static void deallocateBuffer(); private: static unsigned char *originalBuffer; static unsigned char *wordAlignedBuffer; }; const unsigned char *BufferConverter::toWordAligned(const unsigned char *buffer) { originalBuffer=0; //Tell toOriginalBuffer() that there's nothing to do if(isGoodBuffer(buffer)) { return buffer; } else { if(wordAlignedBuffer==0) wordAlignedBuffer=new unsigned char[BUFFER_SIZE]; std::memcpy(wordAlignedBuffer,buffer,BUFFER_SIZE); return wordAlignedBuffer; } } unsigned char *BufferConverter::<API key>( unsigned char *buffer) { if(isGoodBuffer(buffer)) { originalBuffer=0; //Tell toOriginalBuffer() that there's nothing to do return buffer; } else { originalBuffer=buffer; //Save original pointer for toOriginalBuffer() if(wordAlignedBuffer==0) wordAlignedBuffer=new unsigned char[BUFFER_SIZE]; return wordAlignedBuffer; } } void BufferConverter::toOriginalBuffer() { if(originalBuffer==0) return; std::memcpy(originalBuffer,wordAlignedBuffer,BUFFER_SIZE); originalBuffer=0; } void BufferConverter::deallocateBuffer() { originalBuffer=0; //Invalidate also original buffer if(wordAlignedBuffer!=0) { delete[] wordAlignedBuffer; wordAlignedBuffer=0; } } unsigned char *BufferConverter::originalBuffer=0; unsigned char *BufferConverter::wordAlignedBuffer=0; // Class CmdResult /** * \internal * Contains the result of an SD/MMC command */ class CmdResult { public: /** * \internal * Possible outcomes of sending a command */ enum Error { Ok=0, /// No errors Timeout, /// Timeout while waiting command reply CRCFail, /// CRC check failed in command reply RespNotMatch,/// Response index does not match command index ACMDFail /// Sending CMD55 failed }; /** * \internal * Default constructor */ CmdResult(): cmd(0), error(Ok), response(0) {} /** * \internal * Constructor, set the response data * \param cmd command index of command that was sent * \param result result of command */ CmdResult(unsigned char cmd, Error error): cmd(cmd), error(error), response(SDIO->RESP1) {} /** * \internal * \return the 32 bit of the response. * May not be valid if getError()!=Ok or the command does not send a * response, such as CMD0 */ unsigned int getResponse() { return response; } /** * \internal * \return command index */ unsigned char getCmdIndex() { return cmd; } /** * \internal * \return the error flags of the response */ Error getError() { return error; } /** * \internal * Checks if errors occurred while sending the command. * \return true if no errors, false otherwise */ bool validateError(); /** * \internal * interprets this->getResponse() as an R1 response, and checks if there are * errors, or everything is ok * \return true on success, false on failure */ bool validateR1Response(); /** * \internal * Same as validateR1Response, but can be called with interrupts disabled. * \return true on success, false on failure */ bool <API key>(); /** * \internal * interprets this->getResponse() as an R6 response, and checks if there are * errors, or everything is ok * \return true on success, false on failure */ bool validateR6Response(); /** * \internal * \return the card state from an R1 or R6 resonse */ unsigned char getState(); private: unsigned char cmd; ///<\internal Command index that was sent Error error; ///<\internal possible error that occurred unsigned int response; ///<\internal 32bit response }; bool CmdResult::validateError() { switch(error) { case Ok: return true; case Timeout: DBGERR("CMD%d: Timeout\n",cmd); break; case CRCFail: DBGERR("CMD%d: CRC Fail\n",cmd); break; case RespNotMatch: DBGERR("CMD%d: Response does not match\n",cmd); break; case ACMDFail: DBGERR("CMD%d: ACMD Fail\n",cmd); break; } return false; } bool CmdResult::validateR1Response() { if(error!=Ok) return validateError(); //Note: this number is obtained with all the flags of R1 which are errors //(flagged as E in the SD specification), plus CARD_IS_LOCKED because //locked card are not supported by this software driver if((response & 0xfff98008)==0) return true; DBGERR("CMD%d: R1 response error(s):\n",cmd); if(response & (1<<31)) DBGERR("Out of range\n"); if(response & (1<<30)) DBGERR("ADDR error\n"); if(response & (1<<29)) DBGERR("BLOCKLEN error\n"); if(response & (1<<28)) DBGERR("ERASE SEQ error\n"); if(response & (1<<27)) DBGERR("ERASE param\n"); if(response & (1<<26)) DBGERR("WP violation\n"); if(response & (1<<25)) DBGERR("card locked\n"); if(response & (1<<24)) DBGERR("LOCK_UNLOCK failed\n"); if(response & (1<<23)) DBGERR("command CRC failed\n"); if(response & (1<<22)) DBGERR("illegal command\n"); if(response & (1<<21)) DBGERR("ECC fail\n"); if(response & (1<<20)) DBGERR("card controller error\n"); if(response & (1<<19)) DBGERR("unknown error\n"); if(response & (1<<16)) DBGERR("CSD overwrite\n"); if(response & (1<<15)) DBGERR("WP ERASE skip\n"); if(response & (1<<3)) DBGERR("AKE_SEQ error\n"); return false; } bool CmdResult::<API key>() { if(error!=Ok) return false; if(response & 0xfff98008) return false; return true; } bool CmdResult::validateR6Response() { if(error!=Ok) return validateError(); if((response & 0xe008)==0) return true; DBGERR("CMD%d: R6 response error(s):\n",cmd); if(response & (1<<15)) DBGERR("command CRC failed\n"); if(response & (1<<14)) DBGERR("illegal command\n"); if(response & (1<<13)) DBGERR("unknown error\n"); if(response & (1<<3)) DBGERR("AKE_SEQ error\n"); return false; } unsigned char CmdResult::getState() { unsigned char result=(response>>9) & 0xf; DBG("CMD%d: State: ",cmd); switch(result) { case 0: DBG("Idle\n"); break; case 1: DBG("Ready\n"); break; case 2: DBG("Ident\n"); break; case 3: DBG("Stby\n"); break; case 4: DBG("Tran\n"); break; case 5: DBG("Data\n"); break; case 6: DBG("Rcv\n"); break; case 7: DBG("Prg\n"); break; case 8: DBG("Dis\n"); break; case 9: DBG("Btst\n"); break; default: DBG("Unknown\n"); break; } return result; } // Class Command /** * \internal * This class allows sending commands to an SD or MMC */ class Command { public: /** * \internal * SD/MMC commands * - bit #7 is @ 1 if a command is an ACMDxx. send() will send the * sequence CMD55, CMDxx * - bit from #0 to #5 indicate command index (CMD0..CMD63) * - bit #6 is don't care */ enum CommandType { CMD0=0, //GO_IDLE_STATE CMD2=2, //ALL_SEND_CID CMD3=3, //SEND_RELATIVE_ADDR ACMD6=0x80 | 6, //SET_BUS_WIDTH CMD7=7, //<API key> ACMD41=0x80 | 41, //SEND_OP_COND (SD) CMD8=8, //SEND_IF_COND CMD9=9, //SEND_CSD CMD12=12, //STOP_TRANSMISSION CMD13=13, //SEND_STATUS CMD16=16, //SET_BLOCKLEN CMD17=17, //READ_SINGLE_BLOCK CMD18=18, //READ_MULTIPLE_BLOCK ACMD23=0x80 | 23, //<API key> (SD) CMD24=24, //WRITE_BLOCK CMD25=25, //<API key> CMD55=55 //APP_CMD }; /** * \internal * Send a command. * \param cmd command index (CMD0..CMD63) or ACMDxx command * \param arg the 32 bit argument to the command * \return a CmdResult object */ static CmdResult send(CommandType cmd, unsigned int arg); /** * \internal * Set the relative card address, obtained during initialization. * \param r the card's rca */ static void setRca(unsigned short r) { rca=r; } /** * \internal * \return the card's rca, as set by setRca */ static unsigned int getRca() { return static_cast<unsigned int>(rca); } private: static unsigned short rca;///<\internal Card's relative address }; CmdResult Command::send(CommandType cmd, unsigned int arg) { unsigned char cc=static_cast<unsigned char>(cmd); //Handle ACMDxx as CMD55, CMDxx if(cc & 0x80) { DBG("ACMD%d\n",cc & 0x3f); CmdResult r=send(CMD55,(static_cast<unsigned int>(rca))<<16); if(r.validateR1Response()==false) return CmdResult(cc & 0x3f,CmdResult::ACMDFail); //Bit 5 @ 1 = next command will be interpreted as ACMD if((r.getResponse() & (1<<5))==0) return CmdResult(cc & 0x3f,CmdResult::ACMDFail); } else DBG("CMD%d\n",cc & 0x3f); //Send command cc &= 0x3f; unsigned int command=SDIO_CMD_CPSMEN | static_cast<unsigned int>(cc); if(cc!=CMD0) command |= SDIO_CMD_WAITRESP_0; //CMD0 has no response if(cc==CMD2) command |= SDIO_CMD_WAITRESP_1; //CMD2 has long response if(cc==CMD9) command |= SDIO_CMD_WAITRESP_1; //CMD9 has long response SDIO->ARG=arg; SDIO->CMD=command; //CMD0 has no response, so wait until it is sent if(cc==CMD0) { for(int i=0;i<500;i++) { if(SDIO->STA & SDIO_STA_CMDSENT) { SDIO->ICR=0x7ff;//Clear flags return CmdResult(cc,CmdResult::Ok); } delayUs(1); } SDIO->ICR=0x7ff;//Clear flags return CmdResult(cc,CmdResult::Timeout); } //Command is not CMD0, so wait a reply for(int i=0;i<500;i++) { unsigned int status=SDIO->STA; if(status & SDIO_STA_CMDREND) { SDIO->ICR=0x7ff;//Clear flags if(SDIO->RESPCMD==cc) return CmdResult(cc,CmdResult::Ok); else return CmdResult(cc,CmdResult::RespNotMatch); } if(status & SDIO_STA_CCRCFAIL) { SDIO->ICR=SDIO_ICR_CCRCFAILC; return CmdResult(cc,CmdResult::CRCFail); } if(status & SDIO_STA_CTIMEOUT) break; delayUs(1); } SDIO->ICR=SDIO_ICR_CTIMEOUTC; return CmdResult(cc,CmdResult::Timeout); } unsigned short Command::rca=0; // Class ClockController /** * \internal * This class controls the clock speed of the SDIO peripheral. It originated * from a previous version of this driver, where the SDIO was used in polled * mode instead of DMA mode, but has been retained to improve the robustness * of the driver. */ class ClockController { public: /** * \internal. Set a low clock speed of 400KHz or less, used for * detecting SD/MMC cards. This function as a side effect enables 1bit bus * width, and disables clock powersave, since it is not allowed by SD spec. */ static void setLowSpeedClock() { <API key>=0; // No hardware flow control, SDIO_CK generated on rising edge, 1bit bus // width, no clock bypass, no powersave. // Set low clock speed 400KHz SDIO->CLKCR=CLOCK_400KHz | SDIO_CLKCR_CLKEN; SDIO->DTIMER=240000; //Timeout 600ms expressed in SD_CK cycles } /** * \internal * Automatically select the data speed. This routine selects the highest * sustainable data transfer speed. This is done by binary search until * the highest clock speed that causes no errors is found. * This function as a side effect enables 4bit bus width, and clock * powersave. */ static void calibrateClockSpeed(SDIODriver *sdio); /** * \internal * Since clock speed is set dynamically by binary search at runtime, a * corner case might be that of a clock speed which results in unreliable * data transfer, that sometimes succeeds, and sometimes fail. * For maximum robustness, this function is provided to reduce the clock * speed slightly in case a data transfer should fail after clock * calibration. To avoid inadvertently considering other kind of issues as * clock issues, this function can be called only <API key> * times after clock calibration, subsequent calls will fail. This will * avoid other issues causing an ever decreasing clock speed. * \return true on success, false on failure */ static bool reduceClockSpeed(); /** * \internal * Read and write operation do retry during normal use for robustness, but * during clock claibration they must not retry for speed reasons. This * member function returns 1 during clock claibration and MAX_RETRY during * normal use. */ static unsigned char getRetryCount() { return retries; } private: /** * Set SDIO clock speed * \param clkdiv speed is SDIOCLK/(clkdiv+2) */ static void setClockSpeed(unsigned int clkdiv); static const unsigned int SDIOCLK=48000000; //On stm32f2 SDIOCLK is always 48MHz static const unsigned int CLOCK_400KHz=118; //48MHz/(118+2)=400KHz static const unsigned int CLOCK_MAX=0; //48MHz/(0+2) =24MHz #ifdef SD_ONE_BIT_DATABUS \internal Clock enabled, bus width 1bit, clock powersave enabled. static const unsigned int CLKCR_FLAGS=SDIO_CLKCR_CLKEN | SDIO_CLKCR_PWRSAV; #else //SD_ONE_BIT_DATABUS \internal Clock enabled, bus width 4bit, clock powersave enabled. static const unsigned int CLKCR_FLAGS=SDIO_CLKCR_CLKEN | SDIO_CLKCR_WIDBUS_0 | SDIO_CLKCR_PWRSAV; #endif //SD_ONE_BIT_DATABUS \internal Maximum number of calls to IRQreduceClockSpeed() allowed static const unsigned char <API key>=1; \internal value returned by getRetryCount() while *not* calibrating clock. static const unsigned char MAX_RETRY=10; \internal Used to allow only one call to reduceClockSpeed() static unsigned char <API key>; \internal value returned by getRetryCount() static unsigned char retries; }; void ClockController::calibrateClockSpeed(SDIODriver *sdio) { //During calibration we call readBlock() which will call reduceClockSpeed() //so not to invalidate calibration clock reduction must not be available <API key>=0; retries=1; DBG("Automatic speed calibration\n"); unsigned int buffer[512/sizeof(unsigned int)]; unsigned int minFreq=CLOCK_400KHz; unsigned int maxFreq=CLOCK_MAX; unsigned int selected; while(minFreq-maxFreq>1) { selected=(minFreq+maxFreq)/2; DBG("Trying CLKCR=%d\n",selected); setClockSpeed(selected); if(sdio->readBlock(reinterpret_cast<unsigned char*>(buffer),512,0)==512) minFreq=selected; else maxFreq=selected; } //Last round of algorithm setClockSpeed(maxFreq); if(sdio->readBlock(reinterpret_cast<unsigned char*>(buffer),512,0)==512) { DBG("Optimal CLKCR=%d\n",maxFreq); } else { setClockSpeed(minFreq); DBG("Optimal CLKCR=%d\n",minFreq); } //Make clock reduction available <API key>=<API key>; retries=MAX_RETRY; } bool ClockController::reduceClockSpeed() { DBGERR("clock speed reduction requested\n"); //Ensure this function can be called only a few times if(<API key>==0) return false; <API key> unsigned int currentClkcr=SDIO->CLKCR & 0xff; if(currentClkcr==CLOCK_400KHz) return false; //No lower than this value //If the value of clockcr is low, increasing it by one is enough since //frequency changes a lot, otherwise increase by 2. if(currentClkcr<10) currentClkcr++; else currentClkcr+=2; setClockSpeed(currentClkcr); return true; } void ClockController::setClockSpeed(unsigned int clkdiv) { SDIO->CLKCR=clkdiv | CLKCR_FLAGS; //Timeout 600ms expressed in SD_CK cycles SDIO->DTIMER=(6*SDIOCLK)/((clkdiv+2)*10); } unsigned char ClockController::<API key>=false; unsigned char ClockController::retries=ClockController::MAX_RETRY; // Data send/receive functions /** * \internal * Wait until the card is ready for data transfer. * Can be called independently of the card being selected. * \return true on success, false on failure */ static bool waitForCardReady() { const int timeout=1500; //Timeout 1.5 second const int sleepTime=2; for(int i=0;i<timeout/sleepTime;i++) { CmdResult cr=Command::send(Command::CMD13,Command::getRca()<<16); if(cr.validateR1Response()==false) return false; //Bit 8 in R1 response means ready for data. if(cr.getResponse() & (1<<8)) return true; Thread::sleep(sleepTime); } DBGERR("Timeout waiting card ready\n"); return false; } /** * \internal * Prints the errors that may occur during a DMA transfer */ static void <API key>() { DBGERR("Block transfer error\n"); if(dmaFlags & DMA_LISR_TEIF3) DBGERR("* DMA Transfer error\n"); if(dmaFlags & DMA_LISR_DMEIF3) DBGERR("* DMA Direct mode error\n"); if(dmaFlags & DMA_LISR_FEIF3) DBGERR("* DMA Fifo error\n"); if(sdioFlags & SDIO_STA_STBITERR) DBGERR("* SDIO Start bit error\n"); if(sdioFlags & SDIO_STA_RXOVERR) DBGERR("* SDIO RX Overrun\n"); if(sdioFlags & SDIO_STA_TXUNDERR) DBGERR("* SDIO TX Underrun error\n"); if(sdioFlags & SDIO_STA_DCRCFAIL) DBGERR("* SDIO Data CRC fail\n"); if(sdioFlags & SDIO_STA_DTIMEOUT) DBGERR("* SDIO Data timeout\n"); } /** * \internal * Contains initial common code between multipleBlockRead and multipleBlockWrite * to clear interrupt and error flags, set the waiting thread and compute the * memory transfer size based on buffer alignment * \return the best DMA transfer size for a given buffer alignment */ static unsigned int <API key>(const unsigned char *buffer) { //Clear both SDIO and DMA interrupt flags SDIO->ICR=0x7ff; DMA2->LIFCR=DMA_LIFCR_CTCIF3 | DMA_LIFCR_CTEIF3 | DMA_LIFCR_CDMEIF3 | DMA_LIFCR_CFEIF3; transferError=false; dmaFlags=sdioFlags=0; waiting=Thread::getCurrentThread(); //Select DMA transfer size based on buffer alignment. Best performance //is achieved when the buffer is aligned on a 4 byte boundary switch(reinterpret_cast<unsigned int>(buffer) & 0x3) { case 0: return DMA_SxCR_MSIZE_1; //DMA reads 32bit at a time case 2: return DMA_SxCR_MSIZE_0; //DMA reads 16bit at a time default: return 0; //DMA reads 8bit at a time } } /** * \internal * Read a given number of contiguous 512 byte blocks from an SD/MMC card. * Card must be selected prior to calling this function. * \param buffer, a buffer whose size is 512*nblk bytes * \param nblk number of blocks to read. * \param lba logical block address of the first block to read. */ static bool multipleBlockRead(unsigned char *buffer, unsigned int nblk, unsigned int lba) { if(nblk==0) return true; while(nblk>32767) { if(multipleBlockRead(buffer,32767,lba)==false) return false; buffer+=32767*512; nblk-=32767; lba+=32767; } if(waitForCardReady()==false) return false; if(cardType!=SDHC) lba*=512; // Convert to byte address if not SDHC unsigned int memoryTransferSize=<API key>(buffer); //Data transfer is considered complete once the DMA transfer complete //interrupt occurs, that happens when the last data was written in the //buffer. Both SDIO and DMA error interrupts are active to catch errors SDIO->MASK=<API key> | //Interrupt on start bit error SDIO_MASK_RXOVERRIE | //Interrupt on rx underrun <API key> | //Interrupt on tx underrun <API key> | //Interrupt on data CRC fail <API key>; //Interrupt on data timeout DMA2_Stream3->PAR=reinterpret_cast<unsigned int>(&SDIO->FIFO); DMA2_Stream3->M0AR=reinterpret_cast<unsigned int>(buffer); //Note: DMA2_Stream3->NDTR is don't care in peripheral flow control mode DMA2_Stream3->FCR=DMA_SxFCR_FEIE | //Interrupt on fifo error DMA_SxFCR_DMDIS | //Fifo enabled DMA_SxFCR_FTH_0; //Take action if fifo half full DMA2_Stream3->CR=DMA_SxCR_CHSEL_2 | //Channel 4 (SDIO) DMA_SxCR_PBURST_0 | //4-beat bursts read from SDIO DMA_SxCR_PL_0 | //Medium priority DMA stream memoryTransferSize | //RAM data size depends on alignment DMA_SxCR_PSIZE_1 | //Read 32bit at a time from SDIO DMA_SxCR_MINC | //Increment RAM pointer 0 | //Peripheral to memory direction DMA_SxCR_PFCTRL | //Peripheral is flow controller DMA_SxCR_TCIE | //Interrupt on transfer complete DMA_SxCR_TEIE | //Interrupt on transfer error DMA_SxCR_DMEIE | //Interrupt on direct mode error DMA_SxCR_EN; //Start the DMA SDIO->DLEN=nblk*512; if(waiting==0) { DBGERR("Premature wakeup\n"); transferError=true; } CmdResult cr=Command::send(nblk>1 ? Command::CMD18 : Command::CMD17,lba); if(cr.validateR1Response()) { //Block size 512 bytes, block data xfer, from card to controller SDIO->DCTRL=(9<<4) | SDIO_DCTRL_DMAEN | SDIO_DCTRL_DTDIR | SDIO_DCTRL_DTEN; <API key> dLock; while(waiting) { Thread::IRQwait(); { <API key> eLock(dLock); Thread::yield(); } } } else transferError=true; DMA2_Stream3->CR=0; while(DMA2_Stream3->CR & DMA_SxCR_EN) ; //DMA may take time to stop SDIO->DCTRL=0; //Disable data path state machine SDIO->MASK=0; // CMD12 is sent to end CMD18 (multiple block read), or to abort an // unfinished read in case of errors if(nblk>1 || transferError) cr=Command::send(Command::CMD12,0); if(transferError || cr.validateR1Response()==false) { <API key>(); ClockController::reduceClockSpeed(); return false; } return true; } /** * \internal * Write a given number of contiguous 512 byte blocks to an SD/MMC card. * Card must be selected prior to calling this function. * \param buffer, a buffer whose size is 512*nblk bytes * \param nblk number of blocks to write. * \param lba logical block address of the first block to write. */ static bool multipleBlockWrite(const unsigned char *buffer, unsigned int nblk, unsigned int lba) { if(nblk==0) return true; while(nblk>32767) { if(multipleBlockWrite(buffer,32767,lba)==false) return false; buffer+=32767*512; nblk-=32767; lba+=32767; } if(waitForCardReady()==false) return false; if(cardType!=SDHC) lba*=512; // Convert to byte address if not SDHC if(nblk>1) { CmdResult cr=Command::send(Command::ACMD23,nblk); if(cr.validateR1Response()==false) return false; } unsigned int memoryTransferSize=<API key>(buffer); //Data transfer is considered complete once the SDIO transfer complete //interrupt occurs, that happens when the last data was written to the SDIO //Both SDIO and DMA error interrupts are active to catch errors SDIO->MASK=SDIO_MASK_DATAENDIE | //Interrupt on data end <API key> | //Interrupt on start bit error SDIO_MASK_RXOVERRIE | //Interrupt on rx underrun <API key> | //Interrupt on tx underrun <API key> | //Interrupt on data CRC fail <API key>; //Interrupt on data timeout DMA2_Stream3->PAR=reinterpret_cast<unsigned int>(&SDIO->FIFO); DMA2_Stream3->M0AR=reinterpret_cast<unsigned int>(buffer); //Note: DMA2_Stream3->NDTR is don't care in peripheral flow control mode //Quirk: not enabling DMA_SxFCR_FEIE because the SDIO seems to generate //a spurious fifo error. The code was tested and the transfer completes //successfully even in the presence of this fifo error DMA2_Stream3->FCR=DMA_SxFCR_DMDIS | //Fifo enabled DMA_SxFCR_FTH_1 | //Take action if fifo full DMA_SxFCR_FTH_0; DMA2_Stream3->CR=DMA_SxCR_CHSEL_2 | //Channel 4 (SDIO) DMA_SxCR_PBURST_0 | //4-beat bursts write to SDIO DMA_SxCR_PL_0 | //Medium priority DMA stream memoryTransferSize | //RAM data size depends on alignment DMA_SxCR_PSIZE_1 | //Write 32bit at a time to SDIO DMA_SxCR_MINC | //Increment RAM pointer DMA_SxCR_DIR_0 | //Memory to peripheral direction DMA_SxCR_PFCTRL | //Peripheral is flow controller DMA_SxCR_TEIE | //Interrupt on transfer error DMA_SxCR_DMEIE | //Interrupt on direct mode error DMA_SxCR_EN; //Start the DMA SDIO->DLEN=nblk*512; if(waiting==0) { DBGERR("Premature wakeup\n"); transferError=true; } CmdResult cr=Command::send(nblk>1 ? Command::CMD25 : Command::CMD24,lba); if(cr.validateR1Response()) { //Block size 512 bytes, block data xfer, from card to controller SDIO->DCTRL=(9<<4) | SDIO_DCTRL_DMAEN | SDIO_DCTRL_DTEN; <API key> dLock; while(waiting) { Thread::IRQwait(); { <API key> eLock(dLock); Thread::yield(); } } } else transferError=true; DMA2_Stream3->CR=0; while(DMA2_Stream3->CR & DMA_SxCR_EN) ; //DMA may take time to stop SDIO->DCTRL=0; //Disable data path state machine SDIO->MASK=0; // CMD12 is sent to end CMD25 (multiple block write), or to abort an // unfinished write in case of errors if(nblk>1 || transferError) cr=Command::send(Command::CMD12,0); if(transferError || cr.validateR1Response()==false) { <API key>(); ClockController::reduceClockSpeed(); return false; } return true; } // Class CardSelector /** * \internal * Simple RAII class for selecting an SD/MMC card an automatically deselect it * at the end of the scope. */ class CardSelector { public: /** * \internal * Constructor. Selects the card. * The result of the select operation is available through its succeded() * member function */ explicit CardSelector() { success=Command::send( Command::CMD7,Command::getRca()<<16).validateR1Response(); } /** * \internal * \return true if the card was selected, false on error */ bool succeded() { return success; } /** * \internal * Destructor, ensures that the card is deselected */ ~CardSelector() { Command::send(Command::CMD7,0); //Deselect card. This will timeout } private: bool success; }; // Initialization helper functions /** * \internal * Initialzes the SDIO peripheral in the STM32 */ static void initSDIOPeripheral() { { //Doing read-modify-write on RCC->APBENR2 and gpios, better be safe <API key> lock; RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN | RCC_AHB1ENR_GPIODEN | RCC_AHB1ENR_DMA2EN; RCC_SYNC(); RCC->APB2ENR |= RCC_APB2ENR_SDIOEN; RCC_SYNC(); sdD0::mode(Mode::ALTERNATE); sdD0::alternateFunction(12); #ifndef SD_ONE_BIT_DATABUS sdD1::mode(Mode::ALTERNATE); sdD1::alternateFunction(12); sdD2::mode(Mode::ALTERNATE); sdD2::alternateFunction(12); sdD3::mode(Mode::ALTERNATE); sdD3::alternateFunction(12); #endif //SD_ONE_BIT_DATABUS sdCLK::mode(Mode::ALTERNATE); sdCLK::alternateFunction(12); sdCMD::mode(Mode::ALTERNATE); sdCMD::alternateFunction(12); } NVIC_SetPriority(DMA2_Stream3_IRQn,15);//Low priority for DMA NVIC_EnableIRQ(DMA2_Stream3_IRQn); NVIC_SetPriority(SDIO_IRQn,15);//Low priority for SDIO NVIC_EnableIRQ(SDIO_IRQn); SDIO->POWER=0; //Power off state delayUs(1); SDIO->CLKCR=0; SDIO->CMD=0; SDIO->DCTRL=0; SDIO->ICR=0xc007ff; SDIO->POWER=<API key> | <API key>; //Power on state //This delay is particularly important: when setting the POWER register a //glitch on the CMD pin happens. This glitch has a fast fall time and a slow //rise time resembling an RC charge with a ~6us rise time. If the clock is //started too soon, the card sees a clock pulse while CMD is low, and //interprets it as a start bit. No, setting POWER to powerup does not //eliminate the glitch. delayUs(10); ClockController::setLowSpeedClock(); } /** * \internal * Detect if the card is an SDHC, SDv2, SDv1, MMC * \return Type of card: (1<<0)=MMC (1<<1)=SDv1 (1<<2)=SDv2 (1<<2)|(1<<3)=SDHC * or Invalid if card detect failed. */ static CardType detectCardType() { const int INIT_TIMEOUT=200; //200*10ms= 2 seconds CmdResult r=Command::send(Command::CMD8,0x1aa); if(r.validateError()) { //We have an SDv2 card connected if(r.getResponse()!=0x1aa) { DBGERR("CMD8 validation: voltage range fail\n"); return Invalid; } for(int i=0;i<INIT_TIMEOUT;i++) { //Bit 30 @ 1 = tell the card we like SDHCs r=Command::send(Command::ACMD41,(1<<30) | sdVoltageMask); //ACMD41 sends R3 as response, whose CRC is wrong. if(r.getError()!=CmdResult::Ok && r.getError()!=CmdResult::CRCFail) { r.validateError(); return Invalid; } if((r.getResponse() & (1<<31))==0) //Busy bit { Thread::sleep(10); continue; } if((r.getResponse() & sdVoltageMask)==0) { DBGERR("ACMD41 validation: voltage range fail\n"); return Invalid; } DBG("ACMD41 validation: looped %d times\n",i); if(r.getResponse() & (1<<30)) { DBG("SDHC\n"); return SDHC; } else { DBG("SDv2\n"); return SDv2; } } DBGERR("ACMD41 validation: looped until timeout\n"); return Invalid; } else { //We have an SDv1 or MMC r=Command::send(Command::ACMD41,sdVoltageMask); //ACMD41 sends R3 as response, whose CRC is wrong. if(r.getError()!=CmdResult::Ok && r.getError()!=CmdResult::CRCFail) { //MMC card DBG("MMC card\n"); return MMC; } else { //SDv1 card for(int i=0;i<INIT_TIMEOUT;i++) { //ACMD41 sends R3 as response, whose CRC is wrong. if(r.getError()!=CmdResult::Ok && r.getError()!=CmdResult::CRCFail) { r.validateError(); return Invalid; } if((r.getResponse() & (1<<31))==0) //Busy bit { Thread::sleep(10); //Send again command r=Command::send(Command::ACMD41,sdVoltageMask); continue; } if((r.getResponse() & sdVoltageMask)==0) { DBGERR("ACMD41 validation: voltage range fail\n"); return Invalid; } DBG("ACMD41 validation: looped %d times\nSDv1\n",i); return SDv1; } DBGERR("ACMD41 validation: looped until timeout\n"); return Invalid; } } } // class SDIODriver intrusive_ref_ptr<SDIODriver> SDIODriver::instance() { static FastMutex m; static intrusive_ref_ptr<SDIODriver> instance; Lock<FastMutex> l(m); if(!instance) instance=new SDIODriver(); return instance; } ssize_t SDIODriver::readBlock(void* buffer, size_t size, off_t where) { if(where % 512 || size % 512) return -EFAULT; unsigned int lba=where/512; unsigned int nSectors=size/512; Lock<FastMutex> l(mutex); DBG("SDIODriver::readBlock(): nSectors=%d\n",nSectors); bool goodBuffer=BufferConverter::isGoodBuffer(buffer); if(goodBuffer==false) DBG("Buffer inside CCM\n"); for(int i=0;i<ClockController::getRetryCount();i++) { CardSelector selector; if(selector.succeded()==false) continue; bool error=false; if(goodBuffer) { if(multipleBlockRead(reinterpret_cast<unsigned char*>(buffer), nSectors,lba)==false) error=true; } else { //Fallback code to work around CCM unsigned char *tempBuffer=reinterpret_cast<unsigned char*>(buffer); unsigned int tempLba=lba; for(unsigned int j=0;j<nSectors;j++) { unsigned char* b=BufferConverter::<API key>(tempBuffer); if(multipleBlockRead(b,1,tempLba)==false) { error=true; break; } BufferConverter::toOriginalBuffer(); tempBuffer+=512; tempLba++; } } if(error==false) { if(i>0) DBGERR("Read: required %d retries\n",i); return size; } } return -EBADF; } ssize_t SDIODriver::writeBlock(const void* buffer, size_t size, off_t where) { if(where % 512 || size % 512) return -EFAULT; unsigned int lba=where/512; unsigned int nSectors=size/512; Lock<FastMutex> l(mutex); DBG("SDIODriver::writeBlock(): nSectors=%d\n",nSectors); bool goodBuffer=BufferConverter::isGoodBuffer(buffer); if(goodBuffer==false) DBG("Buffer inside CCM\n"); for(int i=0;i<ClockController::getRetryCount();i++) { CardSelector selector; if(selector.succeded()==false) continue; bool error=false; if(goodBuffer) { if(multipleBlockWrite(reinterpret_cast<const unsigned char*>(buffer), nSectors,lba)==false) error=true; } else { //Fallback code to work around CCM const unsigned char *tempBuffer= reinterpret_cast<const unsigned char*>(buffer); unsigned int tempLba=lba; for(unsigned int j=0;j<nSectors;j++) { const unsigned char* b=BufferConverter::toWordAligned(tempBuffer); if(multipleBlockWrite(b,1,tempLba)==false) { error=true; break; } tempBuffer+=512; tempLba++; } } if(error==false) { if(i>0) DBGERR("Write: required %d retries\n",i); return size; } } return -EBADF; } int SDIODriver::ioctl(int cmd, void* arg) { DBG("SDIODriver::ioctl()\n"); if(cmd!=IOCTL_SYNC) return -ENOTTY; Lock<FastMutex> l(mutex); //Note: no need to select card, since status can be queried even with card //not selected. return waitForCardReady() ? 0 : -EFAULT; } SDIODriver::SDIODriver() : Device(Device::BLOCK) { initSDIOPeripheral(); // This is more important than it seems, since CMD55 requires the card's RCA // as argument. During initalization, after CMD0 the card has an RCA of zero // so without this line ACMD41 will fail and the card won't be initialized. Command::setRca(0); //Send card reset command CmdResult r=Command::send(Command::CMD0,0); if(r.validateError()==false) return; cardType=detectCardType(); if(cardType==Invalid) return; //Card detect failed if(cardType==MMC) return; //MMC cards currently unsupported // Now give an RCA to the card. In theory we should loop and enumerate all // the cards but this driver supports only one card. r=Command::send(Command::CMD2,0); //CMD2 sends R2 response, whose CMDINDEX field is wrong if(r.getError()!=CmdResult::Ok && r.getError()!=CmdResult::RespNotMatch) { r.validateError(); return; } r=Command::send(Command::CMD3,0); if(r.validateR6Response()==false) return; Command::setRca(r.getResponse()>>16); DBG("Got RCA=%u\n",Command::getRca()); if(Command::getRca()==0) { //RCA=0 can't be accepted, since it is used to deselect cards DBGERR("RCA=0 is invalid\n"); return; } //Lastly, try selecting the card and configure the latest bits { CardSelector selector; if(selector.succeded()==false) return; r=Command::send(Command::CMD13,Command::getRca()<<16);//Get status if(r.validateR1Response()==false) return; if(r.getState()!=4) //4=Tran state { DBGERR("CMD7 was not able to select card\n"); return; } #ifndef SD_ONE_BIT_DATABUS r=Command::send(Command::ACMD6,2); //Set 4 bit bus width if(r.validateR1Response()==false) return; #endif //SD_ONE_BIT_DATABUS if(cardType!=SDHC) { r=Command::send(Command::CMD16,512); //Set 512Byte block length if(r.validateR1Response()==false) return; } } // Now that card is initialized, perform self calibration of maximum // possible read/write speed. This as a side effect enables 4bit bus width. ClockController::calibrateClockSpeed(this); DBG("SDIO init: Success\n"); } } //namespace miosix
tween = require("lib/tween/tween") require("states/pauseState") -- Components require("components/positionComponent") require("components/playerNodeComponent") require("components/drawableComponent") require("components/<API key>") require("components/stringComponent") require("components/<API key>") require("components/animateComponent") require("components/ultiComponent") -- NodeStuffComponents require("components/node/cornerComponent") require("components/node/linkComponent") require("components/node/colorComponent") require("components/node/shapeComponent") require("components/node/powerUpComponent") require("components/wobbleComponent") -- ParticleComponents require("components/particle/particleComponent") require("components/particle/<API key>") -- Models require("models/nodeModel") require("models/playerModel") --Systems -- Logic require("systems/logic/<API key>") require("systems/logic/animatedMoveSystem") require("systems/logic/gameOverSystem") require("systems/logic/playerChangeSystem") require("systems/logic/animateSystem") require("systems/logic/<API key>") require("systems/logic/wobbleSystem") require("systems/logic/playerColorSystem") require("systems/logic/ultiUpdateSystem") -- Particles require("systems/particle/particleDrawSystem") require("systems/particle/<API key>") require("systems/particle/<API key>") -- Draw require("systems/draw/drawSystem") require("systems/draw/gridDrawSystem") require("systems/draw/stringDrawSystem") require("systems/draw/<API key>") require("systems/draw/<API key>") --Event require("systems/event/playerControlSystem") require("systems/event/shapeDestroySystem") require("systems/draw/squishyPlayerSystem") --Events require("events/playerMoved") require("events/shapeDestroyEvent") GameState = class("GameState", State) function GameState:__init(size, noob) self.size = size self.bloom = love.graphics.newShader [[ extern int samples = 6; extern float stepSize = 1.9; extern vec2 size; vec4 effect(vec4 color, Image tex, vec2 tc, vec2 sc) { vec4 source = texture2D(tex, tc); vec4 sum = vec4(0); int diff = (samples - 1) / 2; for (int x = -diff; x <= diff; x++) { for (int y = -diff; y <= diff; y++) { vec2 offset = vec2(x, y) * stepSize / size; sum += texture2D(tex, tc + offset); } } vec4 average = sum / (samples * samples); return vec4(average.rgb + source.rgb/2, average.a + source.a); } ]] self.noob = noob or false end function GameState:load() self.bloom:send("size", {love.graphics.getWidth(), love.graphics.getHeight()}) self.canvas = love.graphics.newCanvas() self.engine = Engine() self.eventmanager = EventManager() self.score = 0 self.actionBar = 100 self.slowmo = 0 self.activeSlowmo = false -- Shake Variablen self.nextShake = 1 self.translate = 10 self.shakeX = 0 self.shakeY = 0 self.shaketimer = 0 local matrix = {} local nodesOnScreen = self.size local screenWidth = love.graphics.getWidth() local screenHeight = love.graphics.getHeight() local verticalBorder = 30 self.nodeWidth = (screenHeight - (verticalBorder * 2)) / nodesOnScreen local gridXStart = (screenWidth - (self.nodeWidth * nodesOnScreen)) / 2 for x = 1, nodesOnScreen, 1 do matrix[x] = {} for y = 1, nodesOnScreen, 1 do matrix[x][y] = NodeModel(gridXStart + ((x-1) * self.nodeWidth), verticalBorder + ((y-1) * self.nodeWidth)) local random = love.math.random(0, 100) local entity = matrix[x][y] if random <= 10 then entity:add(ShapeComponent("circle")) entity:add(ColorComponent(56, 69, 255)) entity:add(DrawableComponent(resources.images.circle, 0, 0.2, 0.2, 0, 0)) elseif random <= 20 then entity:add(ShapeComponent("square")) entity:add(ColorComponent(255, 69, 56)) entity:add(DrawableComponent(resources.images.square, 0, 0.2, 0.2, 0, 0)) elseif random <= 30 then entity:add(ShapeComponent("triangle")) entity:add(ColorComponent(69, 255, 56)) entity:add(DrawableComponent(resources.images.triangle, 0, 0.2, 0.2, 0, 0)) elseif random <= 31 then local random2 = love.math.random(1,2) if random2 == 1 then entity:add(ColorComponent(255,255,0)) entity:add(DrawableComponent(resources.images.clock, 0, 0.5, 0.5, 0, 0)) entity:add(PowerUpComponent("SlowMotion")) elseif random2 == 2 then local random3 = love.math.random(1, 3) entity:add(PowerUpComponent("ShapeChange")) local shape if random3 == 1 then shape = "circle" entity:add(DrawableComponent(resources.images.changeCircle, 0, 0.2, 0.2, 0, 0)) elseif random3 == 2 then shape = "square" entity:add(DrawableComponent(resources.images.changeSquare, 0, 0.2, 0.2, 0, 0)) elseif random3 == 3 then shape = "triangle" entity:add(DrawableComponent(resources.images.changeTriangle, 0, 0.2, 0.2, 0, 0)) end entity:add(ShapeComponent(shape)) entity:add(ColorComponent(255, 255, 0)) end end end end for x, column in pairs(matrix) do for y, node in pairs(matrix[x]) do if matrix[x][y-1] then node:get("LinkComponent").up = matrix[x][y-1] end if matrix[x][y+1] then node:get("LinkComponent").down = matrix[x][y+1] end if matrix[x+1] then if matrix[x+1][y] then node:get("LinkComponent").right = matrix[x+1][y] end end if matrix[x-1] then if matrix[x-1][y] then node:get("LinkComponent").left = matrix[x-1][y] end end self.engine:addEntity(node) end end matrix[1][1]:add(CornerComponent("topleft")) matrix[nodesOnScreen][1]:add(CornerComponent("topright")) matrix[1][nodesOnScreen]:add(CornerComponent("bottomleft")) matrix[nodesOnScreen][nodesOnScreen]:add(CornerComponent("bottomright")) -- Player initialization matrix[nodesOnScreen/2][nodesOnScreen/2]:remove("ShapeComponent") matrix[nodesOnScreen/2][nodesOnScreen/2]:remove("DrawableComponent") self.engine:addEntity(PlayerModel(matrix[nodesOnScreen/2][nodesOnScreen/2],self.nodeWidth)) if not self.noob then -- score local scoreString = Entity() scoreString:add(PositionComponent(love.graphics.getWidth()*8/10, love.graphics.getHeight()*1/20)) scoreString:add(StringComponent(resources.fonts.CoolFont, {255, 255, 255, 255}, "Score: %i", {{self, "score"}})) self.engine:addEntity(scoreString) end -- Eventsystems local playercontrol = PlayerControlSystem() local levelgenerator = <API key>() local shapedestroy = ShapeDestroySystem() self.eventmanager:addListener("PlayerMoved", {levelgenerator, levelgenerator.fireEvent}) self.eventmanager:addListener("KeyPressed", {playercontrol, playercontrol.fireEvent}) self.eventmanager:addListener("ShapeDestroyEvent", {shapedestroy, shapedestroy.fireEvent}) self.engine:addSystem(shapedestroy) self.engine:addSystem(levelgenerator) local squishySystem = SquishyPlayerSystem() self.eventmanager:addListener("PlayerMoved", {squishySystem, squishySystem.playerMoved}) local playerChangeSystem = PlayerChangeSystem() self.eventmanager:addListener("PlayerMoved", {playerChangeSystem, playerChangeSystem.playerMoved}) -- logic systems self.engine:addSystem(<API key>(), "logic", 1) self.engine:addSystem(AnimatedMoveSystem(), "logic", 2) self.engine:addSystem(<API key>(), "logic", 3) self.engine:addSystem(AnimateSystem(), "logic", 4) self.engine:addSystem(playercontrol,"logic", 5) self.engine:addSystem(<API key>(), "logic", 6) self.engine:addSystem(WobbleSystem(), "logic", 7) self.engine:addSystem(PlayerColorSystem(), "logic", 8) self.engine:addSystem(UltiUpdateSystem(), "logic", 9) local gridDrawSystem = GridDrawSystem() self.engine:addSystem(gridDrawSystem, "logic", 10) if not self.noob then self.engine:addSystem(GameOverSystem(), "logic", 60) self.engine:addSystem(<API key>(), "draw", 3) end -- draw systems self.engine:addSystem(gridDrawSystem, "draw", 1) self.engine:addSystem(StringDrawSystem(), "draw", 2) self.engine:addSystem(ParticleDrawSystem(), "draw", 4) self.engine:addSystem(DrawSystem(), "draw", 5) self.engine:addSystem(<API key>(), "draw", 6) end function GameState:update(dt) self.score = self.score + dt*100 -- Camerashake if self.shaketimer > 0 then self.nextShake = self.nextShake - (dt*50) if self.nextShake < 0 then self.nextShake = 1 self.shakeX = math.random(-self.translate, self.translate) self.shakeY = math.random(-self.translate, self.translate) end self.shaketimer = self.shaketimer - dt end -- Slowmo stuff if self.slowmo > 0 then self.slowmo = self.slowmo - dt self.engine:update(dt/3) else self.engine:update(dt) end end function GameState:draw() love.graphics.setCanvas(self.canvas) love.graphics.clear() -- Screenshake if self.shaketimer > 0 then love.graphics.translate(self.shakeX, self.shakeY) end self.engine:draw() love.graphics.setCanvas() love.graphics.clear() love.graphics.setColor(1, 1, 1, 1) love.graphics.setShader(self.bloom) love.graphics.draw(self.canvas) love.graphics.setShader() end function GameState:keypressed(key, isrepeat) self.eventmanager:fireEvent(KeyPressed(key, isrepeat)) end
#include "common/platform.h" #include "master/<API key>.h" #include <cstdarg> #include <cstdint> #include "common/attributes.h" #include "common/event_loop.h" #include "master/changelog.h" #include "master/chunks.h" #include "master/filesystem.h" #include "master/filesystem_checksum.h" #include "master/<API key>.h" #include "master/filesystem_node.h" #include "master/filesystem_quota.h" #include "master/fs_context.h" #include "master/locks.h" #include "master/matocsserv.h" #include "master/matoclserv.h" #include "master/matomlserv.h" #include "master/<API key>.h" #include "master/task_manager.h" #include "protocol/matocl.h" std::array<uint32_t, FsStats::Size> gFsStatsArray = {{}}; static const char kAclXattrs[] = "system.richacl"; void fs_retrieve_stats(std::array<uint32_t, FsStats::Size> &output_stats) { output_stats = gFsStatsArray; gFsStatsArray.fill(0); } static const int <API key> = 1000; template <class T> bool decodeChar(const char *keys, const std::vector<T> values, char key, T &value) { const uint32_t count = strlen(keys); sassert(values.size() == count); for (uint32_t i = 0; i < count; i++) { if (key == keys[i]) { value = values[i]; return true; } } return false; } void fs_changelog(uint32_t ts, const char *format, ...) { #ifdef METARESTORE (void)ts; (void)format; #else const uint32_t kMaxTimestampSize = 20; const uint32_t kMaxEntrySize = kMaxLogLineSize - kMaxTimestampSize; static char entry[kMaxLogLineSize]; // First, put "<timestamp>|" in the buffer int tsLength = snprintf(entry, kMaxTimestampSize, "%" PRIu32 "|", ts); // Then append the entry to the buffer va_list ap; uint32_t entryLength; va_start(ap, format); entryLength = vsnprintf(entry + tsLength, kMaxEntrySize, format, ap); va_end(ap); if (entryLength >= kMaxEntrySize) { entry[tsLength + kMaxEntrySize - 1] = '\0'; entryLength = kMaxEntrySize; } else { entryLength++; } uint64_t version = gMetadata->metaversion++; changelog(version, entry); <API key>(version, (uint8_t *)entry, tsLength + entryLength); #endif } #ifndef METARESTORE uint8_t <API key>(uint32_t rootinode, uint8_t sesflags, uint32_t *dbuffsize) { if (rootinode != 0) { return <API key>; } (void)sesflags; *dbuffsize = <API key>(gMetadata->reserved); return LIZARDFS_STATUS_OK; } void <API key>(uint32_t rootinode, uint8_t sesflags, uint8_t *dbuff) { (void)rootinode; (void)sesflags; <API key>(gMetadata->reserved, dbuff); } void fs_readreserved(uint32_t off, uint32_t max_entries, std::vector<NamedInodeEntry> &entries) { <API key>(gMetadata->reserved, off, max_entries, entries); } uint8_t fs_readtrash_size(uint32_t rootinode, uint8_t sesflags, uint32_t *dbuffsize) { if (rootinode != 0) { return <API key>; } (void)sesflags; *dbuffsize = <API key>(gMetadata->trash); return LIZARDFS_STATUS_OK; } void fs_readtrash_data(uint32_t rootinode, uint8_t sesflags, uint8_t *dbuff) { (void)rootinode; (void)sesflags; <API key>(gMetadata->trash, dbuff); } void fs_readtrash(uint32_t off, uint32_t max_entries, std::vector<NamedInodeEntry> &entries) { <API key>(gMetadata->trash, off, max_entries, entries); } /* common procedure for trash and reserved files */ uint8_t fs_getdetachedattr(uint32_t rootinode, uint8_t sesflags, uint32_t inode, Attributes &attr, uint8_t dtype) { FSNode *p; attr.fill(0); if (rootinode != 0) { return <API key>; } (void)sesflags; if (!DTYPE_ISVALID(dtype)) { return <API key>; } p = fsnodes_id_to_node(inode); if (!p) { return <API key>; } if (p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } if (dtype == DTYPE_TRASH && p->type == FSNode::kReserved) { return <API key>; } if (dtype == DTYPE_RESERVED && p->type == FSNode::kTrash) { return <API key>; } fsnodes_fill_attr(p, NULL, p->uid, p->gid, p->uid, p->gid, sesflags, attr); return LIZARDFS_STATUS_OK; } uint8_t fs_gettrashpath(uint32_t rootinode, uint8_t sesflags, uint32_t inode, std::string &path) { FSNode *p; if (rootinode != 0) { return <API key>; } (void)sesflags; p = fsnodes_id_to_node(inode); if (!p) { return <API key>; } if (p->type != FSNode::kTrash) { return <API key>; } path = (std::string)gMetadata->trash.at(TrashPathKey(p)); return LIZARDFS_STATUS_OK; } #endif uint8_t fs_settrashpath(const FsContext &context, uint32_t inode, const std::string &path) { ChecksumUpdater cu(context.ts()); FSNode *p; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kOnlyMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } else if (p->type != FSNode::kTrash) { return <API key>; } else if (path.length() == 0) { return <API key>; } for (uint32_t i = 0; i < path.length(); i++) { if (path[i] == 0) { return <API key>; } } gMetadata->trash[TrashPathKey(p)] = HString(path); if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "SETPATH(%" PRIu32 ",%s)", p->id, fsnodes_escape_name(path).c_str()); } else { gMetadata->metaversion++; } return LIZARDFS_STATUS_OK; } uint8_t fs_undel(const FsContext &context, uint32_t inode) { ChecksumUpdater cu(context.ts()); FSNode *p; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kOnlyMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } else if (p->type != FSNode::kTrash) { return <API key>; } status = fsnodes_undel(context.ts(), static_cast<FSNodeFile*>(p)); if (context.isPersonalityMaster()) { if (status == LIZARDFS_STATUS_OK) { fs_changelog(context.ts(), "UNDEL(%" PRIu32 ")", p->id); } } else { gMetadata->metaversion++; } return status; } uint8_t fs_purge(const FsContext &context, uint32_t inode) { ChecksumUpdater cu(context.ts()); FSNode *p; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kOnlyMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } else if (p->type != FSNode::kTrash) { return <API key>; } uint32_t purged_inode = p->id; // This should be equal to inode, because p is not a directory fsnodes_purge(context.ts(), p); if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "PURGE(%" PRIu32 ")", purged_inode); } else { gMetadata->metaversion++; } return LIZARDFS_STATUS_OK; } #ifndef METARESTORE void fs_info(uint64_t *totalspace, uint64_t *availspace, uint64_t *trspace, uint32_t *trnodes, uint64_t *respace, uint32_t *renodes, uint32_t *inodes, uint32_t *dnodes, uint32_t *fnodes) { matocsserv_getspace(totalspace, availspace); *trspace = gMetadata->trashspace; *trnodes = gMetadata->trashnodes; *respace = gMetadata->reservedspace; *renodes = gMetadata->reservednodes; *inodes = gMetadata->nodes; *dnodes = gMetadata->dirnodes; *fnodes = gMetadata->filenodes; } uint8_t fs_getrootinode(uint32_t *rootinode, const uint8_t *path) { HString hname; uint32_t nleng; const uint8_t *name; FSNodeDirectory *parent; name = path; parent = gMetadata->root; for (;;) { while (*name == '/') { name++; } if (*name == '\0') { *rootinode = parent->id; return LIZARDFS_STATUS_OK; } nleng = 0; while (name[nleng] && name[nleng] != '/') { nleng++; } hname = HString((const char*)name, nleng); if (fsnodes_namecheck(hname) < 0) { return <API key>; } FSNode *child = fsnodes_lookup(parent, hname); if (!child) { return <API key>; } if (child->type != FSNode::kDirectory) { return <API key>; } parent = static_cast<FSNodeDirectory*>(child); name += nleng; } } void fs_statfs(const FsContext &context, uint64_t *totalspace, uint64_t *availspace, uint64_t *trspace, uint64_t *respace, uint32_t *inodes) { FSNode *rn; statsrecord sr; if (context.rootinode() == SPECIAL_INODE_ROOT) { *trspace = gMetadata->trashspace; *respace = gMetadata->reservedspace; rn = gMetadata->root; } else { *trspace = 0; *respace = 0; rn = fsnodes_id_to_node(context.rootinode()); } if (!rn || rn->type != FSNode::kDirectory) { *totalspace = 0; *availspace = 0; *inodes = 0; } else { matocsserv_getspace(totalspace, availspace); <API key>(rn, *totalspace, *availspace); fsnodes_get_stats(rn, &sr); *inodes = sr.inodes; if (sr.realsize + *availspace < *totalspace) { *totalspace = sr.realsize + *availspace; } } ++gFsStatsArray[FsStats::Statfs]; } #endif /* #ifndef METARESTORE */ uint8_t fs_apply_checksum(const std::string &version, uint64_t checksum) { std::string versionString = <API key>(LIZARDFS_VERSHEX); uint64_t computedChecksum = fs_checksum(ChecksumMode::kGetCurrent); gMetadata->metaversion++; if (!<API key> && (version == versionString)) { if (checksum != computedChecksum) { return <API key>; } } return LIZARDFS_STATUS_OK; } uint8_t fs_apply_access(uint32_t ts, uint32_t inode) { FSNode *p; p = fsnodes_id_to_node(inode); if (!p) { return <API key>; } p->atime = ts; <API key>(p); gMetadata->metaversion++; return LIZARDFS_STATUS_OK; } #ifndef METARESTORE uint8_t fs_access(const FsContext &context, uint32_t inode, int modemask) { FSNode *p; uint8_t status = verify_session(context, (modemask & MODE_MASK_W) ? OperationMode::kReadWrite : OperationMode::kReadOnly, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } return <API key>(context, ExpectedNodeType::kAny, modemask, inode, &p); } uint8_t fs_lookup(const FsContext &context, uint32_t parent, const HString &name, uint32_t *inode, Attributes &attr) { FSNode *wd; FSNodeDirectory *rn; *inode = 0; attr.fill(0); uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_X, parent, &wd, &rn); if (status != LIZARDFS_STATUS_OK) { return status; } if (!name.empty() && name[0] == '.') { if (name.length() == 1) { // self if (wd->id == context.rootinode()) { *inode = SPECIAL_INODE_ROOT; } else { *inode = wd->id; } fsnodes_fill_attr(wd, wd, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); ++gFsStatsArray[FsStats::Lookup]; return LIZARDFS_STATUS_OK; } if (name.length() == 2 && name[1] == '.') { // parent if (wd->id == context.rootinode()) { *inode = SPECIAL_INODE_ROOT; fsnodes_fill_attr(wd, wd, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); } else { if (!wd->parent.empty()) { if (wd->parent[0] == context.rootinode()) { *inode = SPECIAL_INODE_ROOT; } else { *inode = wd->parent[0]; } FSNode *pp = fsnodes_id_to_node(wd->parent[0]); fsnodes_fill_attr(pp, wd, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); } else { *inode = SPECIAL_INODE_ROOT; // rn->id; fsnodes_fill_attr(rn, wd, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); } } ++gFsStatsArray[FsStats::Lookup]; return LIZARDFS_STATUS_OK; } } if (fsnodes_namecheck(name) < 0) { return <API key>; } FSNode *child = fsnodes_lookup(static_cast<FSNodeDirectory*>(wd), name); if (!child) { return <API key>; } *inode = child->id; fsnodes_fill_attr(child, wd, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); ++gFsStatsArray[FsStats::Lookup]; return LIZARDFS_STATUS_OK; } uint8_t <API key>(const FsContext &context, uint32_t parent, const std::string &path, uint32_t *found_inode, Attributes &attr) { uint8_t status; uint32_t tmp_inode = context.rootinode(); auto current_it = path.begin(); while (current_it != path.end()) { auto delim_it = std::find(current_it, path.end(), '/'); if (current_it != delim_it) { HString hstr(current_it, delim_it); status = fs_lookup(context, parent, hstr, &tmp_inode, attr); if (status != LIZARDFS_STATUS_OK) { return status; } parent = tmp_inode; } if (delim_it == path.end()) { break; } current_it = std::next(delim_it); } *found_inode = tmp_inode; if (tmp_inode == context.rootinode()) { return fs_getattr(context, SPECIAL_INODE_ROOT, attr); } return LIZARDFS_STATUS_OK; } uint8_t fs_getattr(const FsContext &context, uint32_t inode, Attributes &attr) { FSNode *p; attr.fill(0); uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } fsnodes_fill_attr(p, NULL, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); ++gFsStatsArray[FsStats::Getattr]; return LIZARDFS_STATUS_OK; } uint8_t fs_try_setlength(const FsContext &context, uint32_t inode, uint8_t opened, uint64_t length, bool <API key>, uint32_t lockId, Attributes &attr, uint64_t *chunkid) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); FSNode *p; attr.fill(0); uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFile, opened == 0 ? MODE_MASK_W : MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } FSNodeFile *node_file = static_cast<FSNodeFile*>(p); if (length & MFSCHUNKMASK) { uint32_t indx = (length >> MFSCHUNKBITS); if (indx < node_file->chunks.size()) { uint64_t ochunkid = node_file->chunks[indx]; if (ochunkid > 0) { uint8_t status; uint64_t nchunkid; // We deny truncating parity only if truncating down <API key> = <API key> && (length < node_file->length); status = <API key>( ochunkid, lockId, (length & MFSCHUNKMASK), p->goal, <API key>, <API key>(p, {{QuotaResource::kSize, 1}}), &nchunkid); if (status != LIZARDFS_STATUS_OK) { return status; } node_file->chunks[indx] = nchunkid; *chunkid = nchunkid; fs_changelog(ts, "TRUNC(%" PRIu32 ",%" PRIu32 ",%" PRIu32 "):%" PRIu64, p->id, indx, lockId, nchunkid); <API key>(p); return <API key>; } } } fsnodes_fill_attr(p, NULL, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); ++gFsStatsArray[FsStats::Setattr]; return LIZARDFS_STATUS_OK; } #endif uint8_t fs_apply_trunc(uint32_t ts, uint32_t inode, uint32_t indx, uint64_t chunkid, uint32_t lockid) { uint64_t ochunkid, nchunkid; uint8_t status; FSNodeFile *p = fsnodes_id_to_node<FSNodeFile>(inode); if (!p) { return <API key>; } if (p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } if (indx > MAX_INDEX) { return <API key>; } if (indx >= p->chunks.size()) { return <API key>; } ochunkid = p->chunks[indx]; if (ochunkid == 0) { return <API key>; } status = <API key>(ts, ochunkid, lockid, p->goal, true, &nchunkid); if (status != LIZARDFS_STATUS_OK) { return status; } if (chunkid != nchunkid) { return <API key>; } p->chunks[indx] = nchunkid; gMetadata->metaversion++; <API key>(p); return LIZARDFS_STATUS_OK; } uint8_t fs_set_nextchunkid(const FsContext &context, uint64_t nextChunkId) { ChecksumUpdater cu(context.ts()); uint8_t status = <API key>(nextChunkId); if (context.isPersonalityMaster()) { if (status == LIZARDFS_STATUS_OK) { fs_changelog(context.ts(), "NEXTCHUNKID(%" PRIu64 ")", nextChunkId); } } else { gMetadata->metaversion++; } return status; } #ifndef METARESTORE uint8_t fs_end_setlength(uint64_t chunkid) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); fs_changelog(ts, "UNLOCK(%" PRIu64 ")", chunkid); return chunk_unlock(chunkid); } #endif uint8_t fs_apply_unlock(uint64_t chunkid) { gMetadata->metaversion++; return chunk_unlock(chunkid); } #ifndef METARESTORE uint8_t fs_do_setlength(const FsContext &context, uint32_t inode, uint64_t length, Attributes &attr) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); FSNode *p = NULL; attr.fill(0); uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFile, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } fsnodes_setlength(static_cast<FSNodeFile*>(p), length); fs_changelog(ts, "LENGTH(%" PRIu32 ",%" PRIu64 ")", inode, static_cast<FSNodeFile*>(p)->length); p->mtime = ts; <API key>(p, ts); <API key>(p); fsnodes_fill_attr(p, NULL, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); ++gFsStatsArray[FsStats::Setattr]; return LIZARDFS_STATUS_OK; } uint8_t fs_setattr(const FsContext &context, uint32_t inode, uint8_t setmask, uint16_t attrmode, uint32_t attruid, uint32_t attrgid, uint32_t attratime, uint32_t attrmtime, SugidClearMode sugidclearmode, Attributes &attr) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); FSNode *p = NULL; attr.fill(0); auto status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } if (context.uid() != 0 && (context.sesflags() & SESFLAG_MAPALL) && (setmask & (SET_UID_FLAG | SET_GID_FLAG))) { return <API key>; } if ((p->mode & (EATTR_NOOWNER << 12)) == 0 && context.uid() != 0 && context.uid() != p->uid) { if (setmask & (SET_MODE_FLAG | SET_UID_FLAG | SET_GID_FLAG)) { return <API key>; } if ((setmask & SET_ATIME_FLAG) && !(setmask & SET_ATIME_NOW_FLAG)) { return <API key>; } if ((setmask & SET_MTIME_FLAG) && !(setmask & SET_MTIME_NOW_FLAG)) { return <API key>; } if ((setmask & (SET_ATIME_NOW_FLAG | SET_MTIME_NOW_FLAG)) && !fsnodes_access(context, p, MODE_MASK_W)) { return <API key>; } } if (context.uid() != 0 && context.uid() != attruid && (setmask & SET_UID_FLAG)) { return <API key>; } if ((context.sesflags() & SESFLAG_IGNOREGID) == 0) { if (context.uid() != 0 && (setmask & SET_GID_FLAG) && !context.hasGroup(attrgid)) { return <API key>; } } // first ignore sugid clears done by kernel if ((setmask & (SET_UID_FLAG | SET_GID_FLAG)) && (setmask & SET_MODE_FLAG)) { // chown+chmod = chown with sugid clears attrmode |= (p->mode & 06000); } // then do it yourself if ((p->mode & 06000) && (setmask & (SET_UID_FLAG | SET_GID_FLAG))) { // this is "chown" operation and suid or sgid bit is set switch (sugidclearmode) { case SugidClearMode::kAlways: p->mode &= 0171777; // safest approach - always delete both suid and sgid attrmode &= 01777; break; case SugidClearMode::kOsx: if (context.uid() != 0) { // OSX+Solaris - every change done by unprivileged user // should clear suid and sgid p->mode &= 0171777; attrmode &= 01777; } break; case SugidClearMode::kBsd: if (context.uid() != 0 && (setmask & SET_GID_FLAG) && p->gid != attrgid) { // *BSD - like in kOsx but only when something is // actually changed p->mode &= 0171777; attrmode &= 01777; } break; case SugidClearMode::kExt: if (p->type != FSNode::kDirectory) { if (p->mode & 010) { // when group exec is set - clear both bits p->mode &= 0171777; attrmode &= 01777; } else { // when group exec is not set - clear suid only p->mode &= 0173777; attrmode &= 03777; } } break; case SugidClearMode::kXfs: if (p->type != FSNode::kDirectory) { // similar to EXT3, but unprivileged users // also clear suid/sgid bits on // directories if (p->mode & 010) { p->mode &= 0171777; attrmode &= 01777; } else { p->mode &= 0173777; attrmode &= 03777; } } else if (context.uid() != 0) { p->mode &= 0171777; attrmode &= 01777; } break; case SugidClearMode::kNever: break; } } if (setmask & SET_MODE_FLAG) { p->mode = (attrmode & 07777) | (p->mode & 0xF000); gMetadata->acl_storage.setMode(p->id, p->mode, p->type == FSNode::kDirectory); } if (setmask & (SET_UID_FLAG | SET_GID_FLAG)) { <API key>(p, ((setmask & SET_UID_FLAG) ? attruid : p->uid), ((setmask & SET_GID_FLAG) ? attrgid : p->gid)); } if (setmask & SET_ATIME_NOW_FLAG) { p->atime = ts; } else if (setmask & SET_ATIME_FLAG) { p->atime = attratime; } if (setmask & SET_MTIME_NOW_FLAG) { p->mtime = ts; } else if (setmask & SET_MTIME_FLAG) { p->mtime = attrmtime; } fs_changelog(ts, "ATTR(%" PRIu32 ",%d,%" PRIu32 ",%" PRIu32 ",%" PRIu32 ",%" PRIu32 ")", p->id, p->mode & 07777, p->uid, p->gid, p->atime, p->mtime); <API key>(p, ts); fsnodes_fill_attr(p, NULL, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); <API key>(p); ++gFsStatsArray[FsStats::Setattr]; return LIZARDFS_STATUS_OK; } #endif uint8_t fs_apply_attr(uint32_t ts, uint32_t inode, uint32_t mode, uint32_t uid, uint32_t gid, uint32_t atime, uint32_t mtime) { FSNode *p = fsnodes_id_to_node(inode); if (!p) { return <API key>; } if (mode > 07777) { return <API key>; } p->mode = mode | (p->mode & 0xF000); gMetadata->acl_storage.setMode(p->id, p->mode, p->type == FSNode::kDirectory); if (p->uid != uid || p->gid != gid) { <API key>(p, uid, gid); } p->atime = atime; p->mtime = mtime; <API key>(p, ts); <API key>(p); gMetadata->metaversion++; return LIZARDFS_STATUS_OK; } uint8_t fs_apply_length(uint32_t ts, uint32_t inode, uint64_t length) { FSNode *p = fsnodes_id_to_node(inode); if (!p) { return <API key>; } if (p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } fsnodes_setlength(static_cast<FSNodeFile*>(p), length); p->mtime = ts; <API key>(p, ts); <API key>(p); gMetadata->metaversion++; return LIZARDFS_STATUS_OK; } #ifndef METARESTORE Update atime of the given node and generate a changelog entry. Doesn't do anything if NO_ATIME=1 is set in the config file. static inline void fs_update_atime(FSNode *p, uint32_t ts) { if (!gAtimeDisabled && p->atime != ts) { p->atime = ts; <API key>(p); fs_changelog(ts, "ACCESS(%" PRIu32 ")", p->id); } } uint8_t fs_readlink(const FsContext &context, uint32_t inode, std::string &path) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); FSNode *p = NULL; uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } if (p->type != FSNode::kSymlink) { return <API key>; } path = (std::string)static_cast<FSNodeSymlink*>(p)->path; fs_update_atime(p, ts); ++gFsStatsArray[FsStats::Readlink]; return LIZARDFS_STATUS_OK; } #endif uint8_t fs_symlink(const FsContext &context, uint32_t parent, const HString &name, const std::string &path, uint32_t *inode, Attributes *attr) { ChecksumUpdater cu(context.ts()); FSNode *wd; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_W, parent, &wd); if (status != LIZARDFS_STATUS_OK) { return status; } if (path.length() == 0) { return <API key>; } for (uint32_t i = 0; i < path.length(); i++) { if (path[i] == 0) { return <API key>; } } if (fsnodes_namecheck(name) < 0) { return <API key>; } if (fsnodes_nameisused(static_cast<FSNodeDirectory*>(wd), name)) { return <API key>; } if (context.isPersonalityMaster() && (<API key>(context.uid(), context.gid(), {{QuotaResource::kInodes, 1}}) || <API key>(wd, {{QuotaResource::kInodes, 1}}))) { return <API key>; } FSNodeSymlink *p = static_cast<FSNodeSymlink *>(fsnodes_create_node( context.ts(), static_cast<FSNodeDirectory *>(wd), name, FSNode::kSymlink, 0777, 0, context.uid(), context.gid(), 0, AclInheritance::kDontInheritAcl, *inode)); p->path = HString(path); p->path_length = path.length(); <API key>(p); statsrecord sr; memset(&sr, 0, sizeof(statsrecord)); sr.length = path.length(); fsnodes_add_stats(static_cast<FSNodeDirectory *>(wd), &sr); if (attr != NULL) { fsnodes_fill_attr(context, p, wd, *attr); } if (context.isPersonalityMaster()) { assert(*inode == 0); *inode = p->id; fs_changelog(context.ts(), "SYMLINK(%" PRIu32 ",%s,%s,%" PRIu32 ",%" PRIu32 "):%" PRIu32, wd->id, fsnodes_escape_name(name).c_str(), fsnodes_escape_name(path).c_str(), context.uid(), context.gid(), p->id); } else { if (*inode != p->id) { return <API key>; } gMetadata->metaversion++; } #ifndef METARESTORE ++gFsStatsArray[FsStats::Symlink]; #endif /* #ifndef METARESTORE */ return LIZARDFS_STATUS_OK; } #ifndef METARESTORE uint8_t fs_mknod(const FsContext &context, uint32_t parent, const HString &name, uint8_t type, uint16_t mode, uint16_t umask, uint32_t rdev, uint32_t *inode, Attributes &attr) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); FSNode *wd, *p; *inode = 0; attr.fill(0); uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } if (type != FSNode::kFile && type != FSNode::kSocket && type != FSNode::kFifo && type != FSNode::kBlockDev && type != FSNode::kCharDev) { return <API key>; } status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_W, parent, &wd); if (status != LIZARDFS_STATUS_OK) { return status; } if (fsnodes_namecheck(name) < 0) { return <API key>; } if (fsnodes_nameisused(static_cast<FSNodeDirectory*>(wd), name)) { return <API key>; } if (<API key>(context.uid(), context.gid(), {{QuotaResource::kInodes, 1}}) || <API key>(wd, {{QuotaResource::kInodes, 1}})) { return <API key>; } p = fsnodes_create_node(ts, static_cast<FSNodeDirectory*>(wd), name, type, mode, umask, context.uid(), context.gid(), 0, AclInheritance::kInheritAcl); if (type == FSNode::kBlockDev || type == FSNode::kCharDev) { static_cast<FSNodeDevice*>(p)->rdev = rdev; } *inode = p->id; fsnodes_fill_attr(p, wd, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); fs_changelog(ts, "CREATE(%" PRIu32 ",%s,%c,%d,%" PRIu32 ",%" PRIu32 ",%" PRIu32 "):%" PRIu32, wd->id, fsnodes_escape_name(name).c_str(), type, p->mode & 07777, context.uid(), context.gid(), rdev, p->id); ++gFsStatsArray[FsStats::Mknod]; <API key>(p); return LIZARDFS_STATUS_OK; } uint8_t fs_mkdir(const FsContext &context, uint32_t parent, const HString &name, uint16_t mode, uint16_t umask, uint8_t copysgid, uint32_t *inode, Attributes &attr) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); FSNode *wd, *p; *inode = 0; attr.fill(0); uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_W, parent, &wd); if (status != LIZARDFS_STATUS_OK) { return status; } if (fsnodes_namecheck(name) < 0) { return <API key>; } if (fsnodes_nameisused(static_cast<FSNodeDirectory*>(wd), name)) { return <API key>; } if (<API key>(context.uid(), context.gid(), {{QuotaResource::kInodes, 1}}) || <API key>(wd, {{QuotaResource::kInodes, 1}})) { return <API key>; } p = fsnodes_create_node(ts, static_cast<FSNodeDirectory *>(wd), name, FSNode::kDirectory, mode, umask, context.uid(), context.gid(), copysgid, AclInheritance::kInheritAcl); *inode = p->id; fsnodes_fill_attr(p, wd, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); fs_changelog(ts, "CREATE(%" PRIu32 ",%s,%c,%d,%" PRIu32 ",%" PRIu32 ",%" PRIu32 "):%" PRIu32, wd->id, fsnodes_escape_name(name).c_str(), FSNode::kDirectory, p->mode & 07777, context.uid(), context.gid(), 0, p->id); ++gFsStatsArray[FsStats::Mkdir]; return LIZARDFS_STATUS_OK; } #endif uint8_t fs_apply_create(uint32_t ts, uint32_t parent, const HString &name, uint8_t type, uint32_t mode, uint32_t uid, uint32_t gid, uint32_t rdev, uint32_t inode) { FSNode *wd, *p; if (type != FSNode::kFile && type != FSNode::kSocket && type != FSNode::kFifo && type != FSNode::kBlockDev && type != FSNode::kCharDev && type != FSNode::kDirectory) { return <API key>; } wd = fsnodes_id_to_node(parent); if (!wd) { return <API key>; } if (wd->type != FSNode::kDirectory) { return <API key>; } if (fsnodes_nameisused(static_cast<FSNodeDirectory*>(wd), name)) { return <API key>; } // we pass requested inode number here p = fsnodes_create_node(ts, static_cast<FSNodeDirectory*>(wd), name, type, mode, 0, uid, gid, 0, AclInheritance::kInheritAcl, inode); if (type == FSNode::kBlockDev || type == FSNode::kCharDev) { static_cast<FSNodeDevice*>(p)->rdev = rdev; <API key>(p); } if (inode != p->id) { // if inode!=p->id then requested inode number was already acquired return <API key>; } gMetadata->metaversion++; return LIZARDFS_STATUS_OK; } #ifndef METARESTORE uint8_t fs_unlink(const FsContext &context, uint32_t parent, const HString &name) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); FSNode *wd; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_W, parent, &wd); if (status != LIZARDFS_STATUS_OK) { return status; } if (fsnodes_namecheck(name) < 0) { return <API key>; } FSNode *child = fsnodes_lookup(static_cast<FSNodeDirectory*>(wd), name); if (!child) { return <API key>; } if (!<API key>(wd, child, context.uid())) { return <API key>; } if (child->type == FSNode::kDirectory) { return <API key>; } fs_changelog(ts, "UNLINK(%" PRIu32 ",%s):%" PRIu32, wd->id, fsnodes_escape_name(name).c_str(), child->id); fsnodes_unlink(ts, static_cast<FSNodeDirectory*>(wd), name, child); ++gFsStatsArray[FsStats::Unlink]; return LIZARDFS_STATUS_OK; } uint8_t fs_recursive_remove(const FsContext &context, uint32_t parent, const HString &name, const std::function<void(int)> &callback, uint32_t job_id) { ChecksumUpdater cu(context.ts()); FSNode *wd_tmp; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_W, parent, &wd_tmp); if (status != LIZARDFS_STATUS_OK) { return status; } FSNode *child = fsnodes_lookup(static_cast<FSNodeDirectory*>(wd_tmp), name); if (!child) { return <API key>; } auto shared_context = std::make_shared<FsContext>(context); auto task = new RemoveTask({name}, wd_tmp->id, shared_context); std::string node_name; fsnodes_getpath(static_cast<FSNodeDirectory*>(wd_tmp), child, node_name); return gMetadata->task_manager.submitTask(job_id, context.ts(), <API key>, task, RemoveTask::generateDescription(node_name), callback); } uint8_t fs_rmdir(const FsContext &context, uint32_t parent, const HString &name) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); FSNode *wd; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_W, parent, &wd); if (status != LIZARDFS_STATUS_OK) { return status; } if (fsnodes_namecheck(name) < 0) { return <API key>; } FSNode *child = fsnodes_lookup(static_cast<FSNodeDirectory*>(wd), name); if (!child) { return <API key>; } if (!<API key>(wd, child, context.uid())) { return <API key>; } if (child->type != FSNode::kDirectory) { return <API key>; } if (!static_cast<FSNodeDirectory*>(child)->entries.empty()) { return <API key>; } fs_changelog(ts, "UNLINK(%" PRIu32 ",%s):%" PRIu32, wd->id, fsnodes_escape_name(name).c_str(), child->id); fsnodes_unlink(ts, static_cast<FSNodeDirectory*>(wd), name, child); ++gFsStatsArray[FsStats::Rmdir]; return LIZARDFS_STATUS_OK; } #endif uint8_t fs_apply_unlink(uint32_t ts, uint32_t parent, const HString &name, uint32_t inode) { FSNode *wd; wd = fsnodes_id_to_node(parent); if (!wd) { return <API key>; } if (wd->type != FSNode::kDirectory) { return <API key>; } FSNode *child = fsnodes_lookup(static_cast<FSNodeDirectory*>(wd), name); if (!child) { return <API key>; } if (child->id != inode) { return <API key>; } if (child->type == FSNode::kDirectory && !static_cast<FSNodeDirectory*>(child)->entries.empty()) { return <API key>; } fsnodes_unlink(ts, static_cast<FSNodeDirectory*>(wd), name, child); gMetadata->metaversion++; return LIZARDFS_STATUS_OK; } uint8_t fs_rename(const FsContext &context, uint32_t parent_src, const HString &name_src, uint32_t parent_dst, const HString &name_dst, uint32_t *inode, Attributes *attr) { ChecksumUpdater cu(context.ts()); FSNode *swd; FSNode *dwd; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_W, parent_dst, &dwd); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_W, parent_src, &swd); if (status != LIZARDFS_STATUS_OK) { return status; } if (fsnodes_namecheck(name_src) < 0) { return <API key>; } FSNode *se_child = fsnodes_lookup(static_cast<FSNodeDirectory*>(swd), name_src); if (!se_child) { return <API key>; } if (context.canCheckPermissions() && !<API key>(swd, se_child, context.uid())) { return <API key>; } if ((context.personality() != metadataserver::Personality::kMaster) && (se_child->id != *inode)) { return <API key>; } else { *inode = se_child->id; } std::array<int64_t, 2> quota_delta = {{1, 1}}; if (se_child->type == FSNode::kDirectory) { if (fsnodes_isancestor(static_cast<FSNodeDirectory*>(se_child), dwd)) { return <API key>; } const statsrecord &stats = static_cast<FSNodeDirectory*>(se_child)->stats; quota_delta = {{(int64_t)stats.inodes, (int64_t)stats.size}}; } else if (se_child->type == FSNode::kFile) { quota_delta[(int)QuotaResource::kSize] = fsnodes_get_size(se_child); } if (fsnodes_namecheck(name_dst) < 0) { return <API key>; } FSNode *de_child = fsnodes_lookup(static_cast<FSNodeDirectory*>(dwd), name_dst); if (de_child == se_child) { return LIZARDFS_STATUS_OK; } if (de_child) { if (de_child->type == FSNode::kDirectory && !static_cast<FSNodeDirectory*>(de_child)->entries.empty()) { return <API key>; } if (context.canCheckPermissions() && !<API key>(dwd, de_child, context.uid())) { return <API key>; } if (de_child->type == TYPE_DIRECTORY) { const statsrecord &stats = static_cast<FSNodeDirectory*>(de_child)->stats; quota_delta[(int)QuotaResource::kInodes] -= stats.inodes; quota_delta[(int)QuotaResource::kSize] -= stats.size; } else if (de_child->type == TYPE_FILE) { quota_delta[(int)QuotaResource::kInodes] -= 1; quota_delta[(int)QuotaResource::kSize] -= fsnodes_get_size(static_cast<FSNodeFile*>(de_child)); } else { quota_delta[(int)QuotaResource::kInodes] -= 1; quota_delta[(int)QuotaResource::kSize] -= 1; } } if (<API key>( static_cast<FSNodeDirectory *>(dwd), static_cast<FSNodeDirectory *>(swd), {{QuotaResource::kInodes, quota_delta[(int)QuotaResource::kInodes]}, {QuotaResource::kSize, quota_delta[(int)QuotaResource::kSize]}})) { return <API key>; } if (de_child) { fsnodes_unlink(context.ts(), static_cast<FSNodeDirectory*>(dwd), name_dst, de_child); } fsnodes_remove_edge(context.ts(), static_cast<FSNodeDirectory*>(swd), name_src, se_child); fsnodes_link(context.ts(), static_cast<FSNodeDirectory*>(dwd), se_child, name_dst); if (attr) { fsnodes_fill_attr(context, se_child, dwd, *attr); } if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "MOVE(%" PRIu32 ",%s,%" PRIu32 ",%s):%" PRIu32, swd->id, fsnodes_escape_name(name_src).c_str(), dwd->id, fsnodes_escape_name(name_dst).c_str(), se_child->id); } else { gMetadata->metaversion++; } #ifndef METARESTORE ++gFsStatsArray[FsStats::Rename]; #endif return LIZARDFS_STATUS_OK; } uint8_t fs_link(const FsContext &context, uint32_t inode_src, uint32_t parent_dst, const HString &name_dst, uint32_t *inode, Attributes *attr) { ChecksumUpdater cu(context.ts()); FSNode *sp; FSNode *dwd; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_W, parent_dst, &dwd); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kNotDirectory, MODE_MASK_EMPTY, inode_src, &sp); if (status != LIZARDFS_STATUS_OK) { return status; } if (sp->type == FSNode::kTrash || sp->type == FSNode::kReserved) { return <API key>; } if (fsnodes_namecheck(name_dst) < 0) { return <API key>; } if (fsnodes_nameisused(static_cast<FSNodeDirectory*>(dwd), name_dst)) { return <API key>; } fsnodes_link(context.ts(), static_cast<FSNodeDirectory*>(dwd), sp, name_dst); if (inode) { *inode = inode_src; } if (attr) { fsnodes_fill_attr(context, sp, dwd, *attr); } if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "LINK(%" PRIu32 ",%" PRIu32 ",%s)", sp->id, dwd->id, fsnodes_escape_name(name_dst).c_str()); } else { gMetadata->metaversion++; } #ifndef METARESTORE ++gFsStatsArray[FsStats::Link]; #endif return LIZARDFS_STATUS_OK; } uint8_t fs_append(const FsContext &context, uint32_t inode, uint32_t inode_src) { ChecksumUpdater cu(context.ts()); FSNode *p, *sp; if (inode == inode_src) { return <API key>; } uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFile, MODE_MASK_W, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFile, MODE_MASK_R, inode_src, &sp); if (status != LIZARDFS_STATUS_OK) { return status; } if (context.isPersonalityMaster() && <API key>(p, {{QuotaResource::kSize, 1}})) { return <API key>; } status = <API key>(context.ts(), static_cast<FSNodeFile*>(p), static_cast<FSNodeFile*>(sp)); if (status != LIZARDFS_STATUS_OK) { return status; } if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "APPEND(%" PRIu32 ",%" PRIu32 ")", p->id, sp->id); } else { gMetadata->metaversion++; } return status; } static int <API key>(const FsContext &context, uint32_t inode, uint16_t op) { FSNode *dummy; uint8_t modemask = MODE_MASK_EMPTY; if (op == lzfs_locks::kExclusive) { modemask = MODE_MASK_W; } else if (op == lzfs_locks::kShared) { modemask = MODE_MASK_R; } return <API key>(context, ExpectedNodeType::kAny, modemask, inode, &dummy); } int fs_posixlock_probe(const FsContext &context, uint32_t inode, uint64_t start, uint64_t end, uint64_t owner, uint32_t sessionid, uint32_t reqid, uint32_t msgid, uint16_t op, lzfs_locks::FlockWrapper &info) { uint8_t status; if (op != lzfs_locks::kShared && op != lzfs_locks::kExclusive && op != lzfs_locks::kUnlock) { return <API key>; } if ((status = <API key>(context, inode, op)) != LIZARDFS_STATUS_OK) { return status; } FileLocks &locks = gMetadata->posix_locks; const FileLocks::Lock *collision; collision = locks.findCollision(inode, static_cast<FileLocks::Lock::Type>(op), start, end, FileLocks::Owner{owner, sessionid, reqid, msgid}); if (collision == nullptr) { info.l_type = lzfs_locks::kUnlock; return LIZARDFS_STATUS_OK; } else { info.l_type = static_cast<int>(collision->type); info.l_start = collision->start; info.l_len = std::min<uint64_t>(collision->end - collision->start, std::numeric_limits<int64_t>::max()); return <API key>; } } int fs_lock_op(const FsContext &context, FileLocks &locks, uint32_t inode, uint64_t start, uint64_t end, uint64_t owner, uint32_t sessionid, uint32_t reqid, uint32_t msgid, uint16_t op, bool nonblocking, std::vector<FileLocks::Owner> &applied) { uint8_t status; if ((status = <API key>(context, inode, op)) != LIZARDFS_STATUS_OK) { return status; } FileLocks::LockQueue queue; bool success = false; switch (op) { case lzfs_locks::kShared: success = locks.sharedLock(inode, start, end, FileLocks::Owner{owner, sessionid, reqid, msgid}, nonblocking); break; case lzfs_locks::kExclusive: success = locks.exclusiveLock(inode, start, end, FileLocks::Owner{owner, sessionid, reqid, msgid}, nonblocking); break; case lzfs_locks::kRelease: locks.removePending(inode, [sessionid,owner](const FileLocks::Lock &lock) { const FileLocks::Lock::Owner &lock_owner = lock.owner(); return lock_owner.sessionid == sessionid && lock_owner.owner == owner; }); start = 0; end = std::numeric_limits<uint64_t>::max(); /* fallthrough */ case lzfs_locks::kUnlock: success = locks.unlock(inode, start, end, FileLocks::Owner{owner, sessionid, reqid, msgid}); break; default: return <API key>; } status = success ? LIZARDFS_STATUS_OK : <API key>; // If lock is exclusive, no further action is required // For shared locks it is required to gather candidates for lock. // The case when it is needed is when the owner had exclusive lock applied to a file range // and he issued shared lock for this same range. This converts exclusive lock // to shared lock. In the result we may need to apply other shared pending locks // for this range. if (op == lzfs_locks::kExclusive) { return status; } locks.gatherCandidates(inode, start, end, queue); for (auto &candidate : queue) { if (locks.apply(inode, candidate)) { applied.insert(applied.end(), candidate.owners.begin(), candidate.owners.end()); } } return status; } int fs_flock_op(const FsContext &context, uint32_t inode, uint64_t owner, uint32_t sessionid, uint32_t reqid, uint32_t msgid, uint16_t op, bool nonblocking, std::vector<FileLocks::Owner> &applied) { ChecksumUpdater cu(context.ts()); int ret = fs_lock_op(context, gMetadata->flock_locks, inode, 0, 1, owner, sessionid, reqid, msgid, op, nonblocking, applied); if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "FLCK(%" PRIu8 ",%" PRIu32 ",0,1,%" PRIu64 ",%" PRIu32 ",%" PRIu16 ")", (uint8_t)lzfs_locks::Type::kFlock, inode, owner, sessionid, op); } else { gMetadata->metaversion++; } return ret; } int fs_posixlock_op(const FsContext &context, uint32_t inode, uint64_t start, uint64_t end, uint64_t owner, uint32_t sessionid, uint32_t reqid, uint32_t msgid, uint16_t op, bool nonblocking, std::vector<FileLocks::Owner> &applied) { ChecksumUpdater cu(context.ts()); int ret = fs_lock_op(context, gMetadata->posix_locks, inode, start, end, owner, sessionid, reqid, msgid, op, nonblocking, applied); if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "FLCK(%" PRIu8 ",%" PRIu32 ",%" PRIu64 ",%" PRIu64 ",%" PRIu64 ",%" PRIu32 ",%" PRIu16 ")", (uint8_t)lzfs_locks::Type::kPosix, inode, start, end, owner, sessionid, op); } else { gMetadata->metaversion++; } return ret; } int <API key>(const FsContext &context, uint8_t type, uint32_t inode, uint32_t sessionid, std::vector<FileLocks::Owner> &applied) { if (type != (uint8_t)lzfs_locks::Type::kFlock && type != (uint8_t)lzfs_locks::Type::kPosix) { return <API key>; } ChecksumUpdater cu(context.ts()); FileLocks *locks = type == (uint8_t)lzfs_locks::Type::kFlock ? &gMetadata->flock_locks : &gMetadata->posix_locks; locks->removePending(inode, [sessionid](const FileLocks::Lock &lock) { return lock.owner().sessionid == sessionid; }); std::pair<uint64_t, uint64_t> range = locks->unlock(inode, [sessionid](const FileLocks::Lock::Owner &owner) { return owner.sessionid == sessionid; }); if (range.first < range.second) { FileLocks::LockQueue queue; locks->gatherCandidates(inode, range.first, range.second, queue); for (auto &candidate : queue) { applied.insert(applied.end(), candidate.owners.begin(), candidate.owners.end()); } } if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "CLRLCK(%" PRIu8 ",%" PRIu32 ",%" PRIu32 ")", type, inode, sessionid); } else { gMetadata->metaversion++; } return LIZARDFS_STATUS_OK; } int fs_locks_list_all(const FsContext &context, uint8_t type, bool pending, uint64_t start, uint64_t max, std::vector<lzfs_locks::Info> &result) { (void)context; FileLocks *locks; if (type == (uint8_t)lzfs_locks::Type::kFlock) { locks = &gMetadata->flock_locks; } else if (type == (uint8_t)lzfs_locks::Type::kPosix) { locks = &gMetadata->posix_locks; } else { return <API key>; } if (pending) { locks->copyPendingToVector(start, max, result); } else { locks->copyActiveToVector(start, max, result); } return LIZARDFS_STATUS_OK; } int fs_locks_list_inode(const FsContext &context, uint8_t type, bool pending, uint32_t inode, uint64_t start, uint64_t max, std::vector<lzfs_locks::Info> &result) { (void)context; FileLocks *locks; if (type == (uint8_t)lzfs_locks::Type::kFlock) { locks = &gMetadata->flock_locks; } else if (type == (uint8_t)lzfs_locks::Type::kPosix) { locks = &gMetadata->posix_locks; } else { return <API key>; } if (pending) { locks->copyPendingToVector(inode, start, max, result); } else { locks->copyActiveToVector(inode, start, max, result); } return LIZARDFS_STATUS_OK; } static void <API key>(FileLocks &locks, uint32_t inode, uint64_t start, uint64_t end, std::vector<FileLocks::Owner> &applied) { FileLocks::LockQueue queue; locks.gatherCandidates(inode, start, end, queue); for (auto &candidate : queue) { if (locks.apply(inode, candidate)) { applied.insert(applied.end(), candidate.owners.begin(), candidate.owners.end()); } } } int <API key>(const FsContext &context, uint8_t type, uint32_t inode, std::vector<FileLocks::Owner> &applied) { ChecksumUpdater cu(context.ts()); if (type == (uint8_t)lzfs_locks::Type::kFlock) { gMetadata->flock_locks.unlock(inode); <API key>(gMetadata->flock_locks, inode, 0, 1, applied); } else if (type == (uint8_t)lzfs_locks::Type::kPosix) { gMetadata->posix_locks.unlock(inode); <API key>(gMetadata->posix_locks, inode, 0, std::numeric_limits<uint64_t>::max(), applied); } else { return <API key>; } if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "FLCKINODE(%" PRIu8 ",%" PRIu32 ")", type, inode); } else { gMetadata->metaversion++; } return LIZARDFS_STATUS_OK; } int <API key>(const FsContext &context, uint8_t type, uint64_t ownerid, uint32_t sessionid, uint32_t inode, uint64_t reqid) { ChecksumUpdater cu(context.ts()); FileLocks *locks; if (type == (uint8_t)lzfs_locks::Type::kFlock) { locks = &gMetadata->flock_locks; } else if (type == (uint8_t)lzfs_locks::Type::kPosix) { locks = &gMetadata->posix_locks; } else { return <API key>; } locks->removePending(inode, [ownerid, sessionid, reqid](const LockRange &range) { const LockRange::Owner &owner = range.owner(); if (owner.owner == ownerid && owner.sessionid == sessionid && owner.reqid == reqid) { return true; } return false; } ); if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "RMPLOCK(%" PRIu8 ",%" PRIu64",%" PRIu32 ",%" PRIu32 ",%" PRIu64")", type, ownerid, sessionid, inode, reqid); } else { gMetadata->metaversion++; } return LIZARDFS_STATUS_OK; } #ifndef METARESTORE uint8_t fs_readdir_size(const FsContext &context, uint32_t inode, uint8_t flags, void **dnode, uint32_t *dbuffsize) { FSNode *p; *dnode = NULL; *dbuffsize = 0; uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_R, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } *dnode = p; *dbuffsize = fsnodes_getdirsize(static_cast<FSNodeDirectory*>(p), flags & <API key>); return LIZARDFS_STATUS_OK; } void fs_readdir_data(const FsContext &context, uint8_t flags, void *dnode, uint8_t *dbuff) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); FSNode *p = (FSNode *)dnode; fs_update_atime(p, ts); fsnodes_getdirdata(context.rootinode(), context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), static_cast<FSNodeDirectory*>(p), dbuff, flags & <API key>); ++gFsStatsArray[FsStats::Readdir]; } template <typename <API key>> uint8_t fs_readdir(const FsContext &context, uint32_t inode, uint64_t first_entry, uint64_t number_of_entries, std::vector<<API key>> &dir_entries) { uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } FSNode *dir; status = <API key>(context, ExpectedNodeType::kDirectory, MODE_MASK_R, inode, &dir); if (status != LIZARDFS_STATUS_OK) { return status; } uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); fs_update_atime(dir, ts); using legacy::fsnodes_getdir; fsnodes_getdir(context.rootinode(), context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), static_cast<FSNodeDirectory*>(dir), first_entry, number_of_entries, dir_entries); ++gFsStatsArray[FsStats::Readdir]; return LIZARDFS_STATUS_OK; } template uint8_t fs_readdir<legacy::DirectoryEntry>(const FsContext &context, uint32_t inode, uint64_t first_entry, uint64_t number_of_entries, std::vector<legacy::DirectoryEntry> &dir_entries); template uint8_t fs_readdir<DirectoryEntry>(const FsContext &context, uint32_t inode, uint64_t first_entry, uint64_t number_of_entries, std::vector<DirectoryEntry> &dir_entries); uint8_t fs_checkfile(const FsContext &context, uint32_t inode, uint32_t chunkcount[CHUNK_MATRIX_SIZE]) { FSNode *p; uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFile, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } fsnodes_checkfile(static_cast<FSNodeFile*>(p), chunkcount); return LIZARDFS_STATUS_OK; } uint8_t fs_opencheck(const FsContext &context, uint32_t inode, uint8_t flags, Attributes &attr) { FSNode *p; uint8_t status = verify_session(context, (flags & WANT_WRITE) ? OperationMode::kReadWrite : OperationMode::kReadOnly, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFile, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } #ifndef METARESTORE if (<API key>(p) && (flags & WANT_WRITE)) { lzfs_pretty_syslog(LOG_INFO, "Access denied: node %d has tape goal", inode); return <API key>; } #endif if ((flags & AFTER_CREATE) == 0) { uint8_t modemask = 0; if (flags & WANT_READ) { modemask |= MODE_MASK_R; } if (flags & WANT_WRITE) { modemask |= MODE_MASK_W; } if (!fsnodes_access(context, p, modemask)) { return <API key>; } } fsnodes_fill_attr(p, NULL, context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(), attr); ++gFsStatsArray[FsStats::Open]; return LIZARDFS_STATUS_OK; } #endif uint8_t fs_acquire(const FsContext &context, uint32_t inode, uint32_t sessionid) { ChecksumUpdater cu(context.ts()); #ifndef METARESTORE if (context.isPersonalityShadow()) { <API key>(sessionid, inode); } #endif /* #ifndef METARESTORE */ FSNodeFile *p = fsnodes_id_to_node<FSNodeFile>(inode); if (!p) { return <API key>; } if (p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } if (std::find(p->sessionid.begin(), p->sessionid.end(), sessionid) != p->sessionid.end()) { return <API key>; } p->sessionid.push_back(sessionid); <API key>(p); if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "ACQUIRE(%" PRIu32 ",%" PRIu32 ")", inode, sessionid); } else { gMetadata->metaversion++; } return LIZARDFS_STATUS_OK; } uint8_t fs_release(const FsContext &context, uint32_t inode, uint32_t sessionid) { ChecksumUpdater cu(context.ts()); FSNodeFile *p = fsnodes_id_to_node<FSNodeFile>(inode); if (!p) { return <API key>; } if (p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } auto it = std::find(p->sessionid.begin(), p->sessionid.end(), sessionid); if (it != p->sessionid.end()) { p->sessionid.erase(it); if (p->type == FSNode::kReserved && p->sessionid.empty()) { fsnodes_purge(context.ts(), p); } else { <API key>(p); } #ifndef METARESTORE if (context.isPersonalityShadow()) { <API key>(sessionid, inode); } #endif /* #ifndef METARESTORE */ if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "RELEASE(%" PRIu32 ",%" PRIu32 ")", inode, sessionid); } else { gMetadata->metaversion++; } return LIZARDFS_STATUS_OK; } #ifndef METARESTORE lzfs_pretty_syslog(LOG_WARNING, "release: session not found"); #endif return <API key>; } #ifndef METARESTORE uint32_t fs_newsessionid(void) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); fs_changelog(ts, "SESSION():%" PRIu32, gMetadata->nextsessionid); return gMetadata->nextsessionid++; } #endif uint8_t fs_apply_session(uint32_t sessionid) { if (sessionid != gMetadata->nextsessionid) { return <API key>; } gMetadata->metaversion++; gMetadata->nextsessionid++; return LIZARDFS_STATUS_OK; } #ifndef METARESTORE uint8_t <API key>(FSNodeFile *p, uint32_t chunkIndex) { uint64_t chunkId = (chunkIndex < p->chunks.size() ? p->chunks[chunkIndex] : 0); if (chunkId != 0 && <API key>(chunkId)) { uint32_t notchanged, erased, repaired; FsContext context = FsContext::<API key>(0, SPECIAL_INODE_ROOT, 0, 0, 0, 0, 0); fs_repair(context, p->id, 0, &notchanged, &erased, &repaired); lzfs_pretty_syslog(LOG_NOTICE, "auto repair inode %" PRIu32 ", chunk %016" PRIX64 ": " "not changed: %" PRIu32 ", erased: %" PRIu32 ", repaired: %" PRIu32, p->id, chunkId, notchanged, erased, repaired); lzfs_silent_syslog(LOG_DEBUG, "master.fs.file_auto_repaired: %u %u", p->id, repaired); } return LIZARDFS_STATUS_OK; } uint8_t fs_readchunk(uint32_t inode, uint32_t indx, uint64_t *chunkid, uint64_t *length) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); FSNodeFile *p; *chunkid = 0; *length = 0; p = fsnodes_id_to_node<FSNodeFile>(inode); if (!p) { return <API key>; } if (p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } if (indx > MAX_INDEX) { return <API key>; } #ifndef METARESTORE if (<API key>) { <API key>(p, indx); } #endif if (indx < p->chunks.size()) { *chunkid = p->chunks[indx]; } *length = p->length; fs_update_atime(p, ts); ++gFsStatsArray[FsStats::Read]; return LIZARDFS_STATUS_OK; } #endif uint8_t fs_writechunk(const FsContext &context, uint32_t inode, uint32_t indx, bool usedummylockid, /* inout */ uint32_t *lockid, uint64_t *chunkid, uint8_t *opflag, uint64_t *length, uint32_t min_server_version) { ChecksumUpdater cu(context.ts()); uint64_t ochunkid, nchunkid; FSNode *node; FSNodeFile *p; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFile, MODE_MASK_EMPTY, inode, &node); p = static_cast<FSNodeFile*>(node); if (status != LIZARDFS_STATUS_OK) { return status; } if (indx > MAX_INDEX) { return <API key>; } #ifndef METARESTORE if (<API key> && context.isPersonalityMaster()) { <API key>(p, indx); } #endif const bool quota_exceeded = <API key>(p, {{QuotaResource::kSize, 1}}); statsrecord psr; fsnodes_get_stats(p, &psr); /* resize chunks structure */ if (indx >= p->chunks.size()) { if (context.isPersonalityMaster() && quota_exceeded) { return <API key>; } uint32_t new_size; if (indx < 8) { new_size = indx + 1; } else if (indx < 64) { new_size = (indx & 0xFFFFFFF8) + 8; } else { new_size = (indx & 0xFFFFFFC0) + 64; } assert(new_size > indx); p->chunks.resize(new_size, 0); } ochunkid = p->chunks[indx]; if (context.isPersonalityMaster()) { #ifndef METARESTORE status = chunk_multi_modify(ochunkid, lockid, p->goal, usedummylockid, quota_exceeded, opflag, &nchunkid, min_server_version); #else (void)usedummylockid; (void)min_server_version; // This will NEVER happen (metarestore doesn't call this in master context) mabort("bad code path: fs_writechunk"); #endif } else { bool increaseVersion = (*opflag != 0); status = <API key>(context.ts(), ochunkid, *lockid, p->goal, increaseVersion, &nchunkid); } if (status != LIZARDFS_STATUS_OK) { <API key>(p); return status; } if (context.isPersonalityShadow() && nchunkid != *chunkid) { <API key>(p); return <API key>; } p->chunks[indx] = nchunkid; *chunkid = nchunkid; statsrecord nsr; fsnodes_get_stats(p, &nsr); for (const auto &parent_inode : p->parent) { FSNodeDirectory *parent = <API key><FSNodeDirectory>(parent_inode); <API key>(parent, &nsr, &psr); } <API key>(p, {{QuotaResource::kSize, nsr.size - psr.size}}); if (length) { *length = p->length; } if (context.isPersonalityMaster()) { fs_changelog(context.ts(), "WRITE(%" PRIu32 ",%" PRIu32 ",%" PRIu8 ",%" PRIu32 "):%" PRIu64, inode, indx, *opflag, *lockid, nchunkid); } else { gMetadata->metaversion++; } p->mtime = context.ts(); <API key>(p, context.ts()); <API key>(p); #ifndef METARESTORE ++gFsStatsArray[FsStats::Write]; #endif return LIZARDFS_STATUS_OK; } #ifndef METARESTORE uint8_t fs_writeend(uint32_t inode, uint64_t length, uint64_t chunkid, uint32_t lockid) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); uint8_t status = chunk_can_unlock(chunkid, lockid); if (status != LIZARDFS_STATUS_OK) { return status; } if (length > 0) { FSNodeFile *p = fsnodes_id_to_node<FSNodeFile>(inode); if (!p) { return <API key>; } if (p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } if (length > p->length) { fsnodes_setlength(p, length); p->mtime = ts; <API key>(p, ts); <API key>(p); fs_changelog(ts, "LENGTH(%" PRIu32 ",%" PRIu64 ")", inode, length); } } fs_changelog(ts, "UNLOCK(%" PRIu64 ")", chunkid); return chunk_unlock(chunkid); } void fs_incversion(uint64_t chunkid) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); fs_changelog(ts, "INCVERSION(%" PRIu64 ")", chunkid); } #endif uint8_t fs_apply_incversion(uint64_t chunkid) { gMetadata->metaversion++; return <API key>(chunkid); } #ifndef METARESTORE uint8_t fs_repair(const FsContext &context, uint32_t inode, uint8_t correct_only, uint32_t *notchanged, uint32_t *erased, uint32_t *repaired) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); uint32_t nversion, indx; statsrecord psr, nsr; FSNode *p; *notchanged = 0; *erased = 0; *repaired = 0; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFile, MODE_MASK_W, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } FSNodeFile *node_file = static_cast<FSNodeFile*>(p); fsnodes_get_stats(p, &psr); for (indx = 0; indx < node_file->chunks.size(); indx++) { if (chunk_repair(p->goal, node_file->chunks[indx], &nversion, correct_only)) { fs_changelog(ts, "REPAIR(%" PRIu32 ",%" PRIu32 "):%" PRIu32, inode, indx, nversion); p->mtime = ts; <API key>(p, ts); if (nversion > 0) { (*repaired)++; } else { node_file->chunks[indx] = 0; (*erased)++; } } else { (*notchanged)++; } } fsnodes_get_stats(p, &nsr); for (const auto &parent_inode : p->parent) { FSNodeDirectory *parent = <API key><FSNodeDirectory>(parent_inode); <API key>(parent, &nsr, &psr); } <API key>(p, {{QuotaResource::kSize, nsr.size - psr.size}}); <API key>(p); return LIZARDFS_STATUS_OK; } #endif /* #ifndef METARESTORE */ uint8_t fs_apply_repair(uint32_t ts, uint32_t inode, uint32_t indx, uint32_t nversion) { FSNodeFile *p; uint8_t status; statsrecord psr, nsr; p = fsnodes_id_to_node<FSNodeFile>(inode); if (!p) { return <API key>; } if (p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } if (indx > MAX_INDEX) { return <API key>; } if (indx >= p->chunks.size()) { return <API key>; } if (p->chunks[indx] == 0) { return <API key>; } fsnodes_get_stats(p, &psr); if (nversion == 0) { status = chunk_delete_file(p->chunks[indx], p->goal); p->chunks[indx] = 0; } else { status = chunk_set_version(p->chunks[indx], nversion); } fsnodes_get_stats(p, &nsr); for (const auto &parent_inode : p->parent) { FSNodeDirectory *parent = <API key><FSNodeDirectory>(parent_inode); <API key>(parent, &nsr, &psr); } <API key>(p, {{QuotaResource::kSize, nsr.size - psr.size}}); gMetadata->metaversion++; p->mtime = ts; <API key>(p, ts); <API key>(p); return status; } #ifndef METARESTORE uint8_t fs_getgoal(const FsContext &context, uint32_t inode, uint8_t gmode, GoalStatistics &fgtab, GoalStatistics &dgtab) { FSNode *p; if (!GMODE_ISVALID(gmode)) { return <API key>; } uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFileOrDirectory, 0, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } <API key>(p, gmode, fgtab, dgtab); return LIZARDFS_STATUS_OK; } uint8_t <API key>(const FsContext &context, uint32_t inode, uint8_t gmode, TrashtimeMap &fileTrashtimes, TrashtimeMap &dirTrashtimes) { FSNode *p; if (!GMODE_ISVALID(gmode)) { return <API key>; } uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFileOrDirectory, 0, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } <API key>(p, gmode, fileTrashtimes, dirTrashtimes); return LIZARDFS_STATUS_OK; } void <API key>(TrashtimeMap &fileTrashtimes,TrashtimeMap &dirTrashtimes,uint8_t *buff) { for (auto i : fileTrashtimes) { put32bit(&buff, i.first); put32bit(&buff, i.second); } for (auto i : dirTrashtimes) { put32bit(&buff, i.first); put32bit(&buff, i.second); } } uint8_t fs_geteattr(const FsContext &context, uint32_t inode, uint8_t gmode, uint32_t feattrtab[16], uint32_t deattrtab[16]) { FSNode *p; memset(feattrtab, 0, 16 * sizeof(uint32_t)); memset(deattrtab, 0, 16 * sizeof(uint32_t)); if (!GMODE_ISVALID(gmode)) { return <API key>; } uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, 0, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } <API key>(p, gmode, feattrtab, deattrtab); return LIZARDFS_STATUS_OK; } #endif uint8_t fs_setgoal(const FsContext &context, uint32_t inode, uint8_t goal, uint8_t smode, std::shared_ptr<SetGoalTask::StatsArray> setgoal_stats, const std::function<void(int)> &callback) { ChecksumUpdater cu(context.ts()); if (!SMODE_ISVALID(smode) || !GoalId::isValid(goal) || (smode & (SMODE_INCREASE | SMODE_DECREASE))) { return <API key>; } uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } FSNode *p; status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } if (p->type != FSNode::kDirectory && p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } sassert(context.hasUidGidData()); (*setgoal_stats)[SetGoalTask::kChanged] = 0; // - Number of inodes with changed goal (*setgoal_stats)[SetGoalTask::kNotChanged] = 0; // - Number of inodes with not changed goal (*setgoal_stats)[SetGoalTask::kNotPermitted] = 0; auto task = new SetGoalTask({p->id}, context.uid(), goal, smode, setgoal_stats); std::string node_name; FSNodeDirectory *parent = <API key>(p); fsnodes_getpath(parent, p, node_name); std::string goal_name; #ifndef METARESTORE goal_name = gGoalDefinitions[goal].getName(); #else goal_name = "goal id: " + std::to_string(goal); #endif return gMetadata->task_manager.submitTask(context.ts(), <API key>, task, SetGoalTask::generateDescription(node_name, goal_name), callback); } //This function is only used by Shadow uint8_t fs_apply_setgoal(const FsContext &context, uint32_t inode, uint8_t goal, uint8_t smode, uint32_t master_result) { assert(context.isPersonalityShadow()); ChecksumUpdater cu(context.ts()); if (!SMODE_ISVALID(smode) || !GoalId::isValid(goal) || (smode & (SMODE_INCREASE | SMODE_DECREASE))) { return <API key>; } uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } FSNode *p; status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } if (p->type != FSNode::kDirectory && p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } sassert(context.hasUidGidData()); SetGoalTask task(context.uid(), goal, smode); uint32_t my_result = task.setGoal(p, context.ts()); gMetadata->metaversion++; if (master_result != my_result) { return <API key>; } return LIZARDFS_STATUS_OK; } uint8_t <API key>(const FsContext &context, uint32_t inode, uint8_t goal, uint8_t smode, uint32_t *sinodes, uint32_t *ncinodes, uint32_t *nsinodes) { ChecksumUpdater cu(context.ts()); if (!SMODE_ISVALID(smode) || !GoalId::isValid(goal) || (smode & (SMODE_INCREASE | SMODE_DECREASE))) { return <API key>; } uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kAny); if (status != 0) { return status; } FSNode *p; status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } if (p->type != FSNode::kDirectory && p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } sassert(context.hasUidGidData()); uint32_t si = 0; uint32_t nci = 0; uint32_t nsi = 0; <API key>(p, context.ts(), context.uid(), goal, smode, &si, &nci, &nsi); if (context.isPersonalityMaster()) { if ((smode & SMODE_RMASK) == 0 && nsi > 0 && si == 0 && nci == 0) { return <API key>; } *sinodes = si; *ncinodes = nci; *nsinodes = nsi; fs_changelog(context.ts(), "SETGOAL(%" PRIu32 ",%" PRIu32 ",%" PRIu8 ",%" PRIu8 "):%" PRIu32 ",%" PRIu32 ",%" PRIu32, p->id, context.uid(), goal, smode, si, nci, nsi); } else { gMetadata->metaversion++; if ((*sinodes != si) || (*ncinodes != nci) || (*nsinodes != nsi)) { return <API key>; } } return LIZARDFS_STATUS_OK; } uint8_t fs_settrashtime(const FsContext &context, uint32_t inode, uint32_t trashtime, uint8_t smode, std::shared_ptr<SetTrashtimeTask::StatsArray> settrashtime_stats, const std::function<void(int)> &callback) { ChecksumUpdater cu(context.ts()); if (!SMODE_ISVALID(smode)) { return <API key>; } uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } FSNode *p; status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } if (p->type != FSNode::kDirectory && p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } sassert(context.hasUidGidData()); (*settrashtime_stats)[SetTrashtimeTask::kChanged] = 0; // - Number of inodes with changed trashtime (*settrashtime_stats)[SetTrashtimeTask::kNotChanged] = 0; // - Number of inodes with not changed trashtime (*settrashtime_stats)[SetTrashtimeTask::kNotPermitted] = 0; auto task = new SetTrashtimeTask({p->id}, context.uid(), trashtime, smode, settrashtime_stats); std::string node_name; FSNodeDirectory *parent = <API key>(p); fsnodes_getpath(parent, p, node_name); return gMetadata->task_manager.submitTask(context.ts(), <API key>, task, SetTrashtimeTask::generateDescription(node_name, trashtime), callback); } uint8_t <API key>(const FsContext &context, uint32_t inode, uint32_t trashtime, uint8_t smode, uint32_t master_result) { assert(context.isPersonalityShadow()); ChecksumUpdater cu(context.ts()); if (!SMODE_ISVALID(smode)) { return <API key>; } uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } FSNode *p; status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } if (p->type != FSNode::kDirectory && p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } sassert(context.hasUidGidData()); SetTrashtimeTask task(context.uid(), trashtime, smode); uint32_t my_result = task.setTrashtime(p, context.ts()); gMetadata->metaversion++; if (master_result != my_result) { return <API key>; } return LIZARDFS_STATUS_OK; } uint8_t <API key>(const FsContext &context, uint32_t inode, uint32_t trashtime, uint8_t smode, uint32_t *sinodes, uint32_t *ncinodes, uint32_t *nsinodes) { ChecksumUpdater cu(context.ts()); if (!SMODE_ISVALID(smode)) { return <API key>; } uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kAny); if (status != 0) { return status; } FSNode *p; status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } if (p->type != FSNode::kDirectory && p->type != FSNode::kFile && p->type != FSNode::kTrash && p->type != FSNode::kReserved) { return <API key>; } uint32_t si = 0; uint32_t nci = 0; uint32_t nsi = 0; sassert(context.hasUidGidData()); <API key>(p, context.ts(), context.uid(), trashtime, smode, &si, &nci, &nsi); if (context.isPersonalityMaster()) { if ((smode & SMODE_RMASK) == 0 && nsi > 0 && si == 0 && nci == 0) { return <API key>; } *sinodes = si; *ncinodes = nci; *nsinodes = nsi; fs_changelog(context.ts(), "SETTRASHTIME(%" PRIu32 ",%" PRIu32 ",%" PRIu32 ",%" PRIu8 "):%" PRIu32 ",%" PRIu32 ",%" PRIu32, p->id, context.uid(), trashtime, smode, si, nci, nsi); } else { gMetadata->metaversion++; if ((*sinodes != si) || (*ncinodes != nci) || (*nsinodes != nsi)) { return <API key>; } } return LIZARDFS_STATUS_OK; } uint8_t fs_seteattr(const FsContext &context, uint32_t inode, uint8_t eattr, uint8_t smode, uint32_t *sinodes, uint32_t *ncinodes, uint32_t *nsinodes) { ChecksumUpdater cu(context.ts()); if (!SMODE_ISVALID(smode) || (eattr & (~(EATTR_NOOWNER | EATTR_NOACACHE | EATTR_NOECACHE | EATTR_NODATACACHE)))) { return <API key>; } uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } FSNode *p; status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } uint32_t si = 0; uint32_t nci = 0; uint32_t nsi = 0; sassert(context.hasUidGidData()); <API key>(p, context.ts(), context.uid(), eattr, smode, &si, &nci, &nsi); if (context.isPersonalityMaster()) { if ((smode & SMODE_RMASK) == 0 && nsi > 0 && si == 0 && nci == 0) { return <API key>; } *sinodes = si; *ncinodes = nci; *nsinodes = nsi; fs_changelog(context.ts(), "SETEATTR(%" PRIu32 ",%" PRIu32 ",%" PRIu8 ",%" PRIu8 "):%" PRIu32 ",%" PRIu32 ",%" PRIu32, p->id, context.uid(), eattr, smode, si, nci, nsi); } else { gMetadata->metaversion++; if ((*sinodes != si) || (*ncinodes != nci) || (*nsinodes != nsi)) { return <API key>; } } return LIZARDFS_STATUS_OK; } #ifndef METARESTORE uint8_t fs_listxattr_leng(const FsContext &context, uint32_t inode, uint8_t opened, void **xanode, uint32_t *xasize) { FSNode *p; uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, opened == 0 ? MODE_MASK_R : MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } *xasize = sizeof(kAclXattrs); return xattr_listattr_leng(p->id, xanode, xasize); } void fs_listxattr_data(void *xanode, uint8_t *xabuff) { memcpy(xabuff, kAclXattrs, sizeof(kAclXattrs)); xattr_listattr_data(xanode, xabuff + sizeof(kAclXattrs)); } uint8_t fs_setxattr(const FsContext &context, uint32_t inode, uint8_t opened, uint8_t anleng, const uint8_t *attrname, uint32_t avleng, const uint8_t *attrvalue, uint8_t mode) { uint32_t ts = eventloop_time(); ChecksumUpdater cu(ts); FSNode *p; uint8_t status; status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, opened == 0 ? MODE_MASK_W : MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } if (xattr_namecheck(anleng, attrname) < 0) { return <API key>; } if (mode > XATTR_SMODE_REMOVE) { return <API key>; } status = xattr_setattr(p->id, anleng, attrname, avleng, attrvalue, mode); if (status != LIZARDFS_STATUS_OK) { return status; } <API key>(p, ts); <API key>(p); fs_changelog(ts, "SETXATTR(%" PRIu32 ",%s,%s,%" PRIu8 ")", p->id, fsnodes_escape_name(std::string((const char*)attrname, anleng)).c_str(), fsnodes_escape_name(std::string((const char*)attrvalue, avleng)).c_str(), mode); return LIZARDFS_STATUS_OK; } uint8_t fs_getxattr(const FsContext &context, uint32_t inode, uint8_t opened, uint8_t anleng, const uint8_t *attrname, uint32_t *avleng, uint8_t **attrvalue) { FSNode *p; uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, opened == 0 ? MODE_MASK_R : MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } if (xattr_namecheck(anleng, attrname) < 0) { return <API key>; } return xattr_getattr(p->id, anleng, attrname, avleng, attrvalue); } #endif /* #ifndef METARESTORE */ uint8_t fs_apply_setxattr(uint32_t ts, uint32_t inode, uint32_t anleng, const uint8_t *attrname, uint32_t avleng, const uint8_t *attrvalue, uint32_t mode) { FSNode *p; uint8_t status; if (anleng == 0 || anleng > MFS_XATTR_NAME_MAX || avleng > MFS_XATTR_SIZE_MAX || mode > XATTR_SMODE_REMOVE) { return <API key>; } p = fsnodes_id_to_node(inode); if (!p) { return <API key>; } status = xattr_setattr(inode, anleng, attrname, avleng, attrvalue, mode); if (status != LIZARDFS_STATUS_OK) { return status; } <API key>(p, ts); gMetadata->metaversion++; <API key>(p); return status; } uint8_t fs_deleteacl(const FsContext &context, uint32_t inode, AclType type) { ChecksumUpdater cu(context.ts()); FSNode *p; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } status = fsnodes_deleteacl(p, type, context.ts()); if (context.isPersonalityMaster()) { if (status == LIZARDFS_STATUS_OK) { static char acl_type[3] = {'a', 'd', 'r'}; static_assert((int)AclType::kAccess == 0, "fix acl_type table"); static_assert((int)AclType::kDefault == 1, "fix acl_type table"); static_assert((int)AclType::kRichACL == 2, "fix acl_type table"); fs_changelog(context.ts(), "DELETEACL(%" PRIu32 ",%c)", p->id, acl_type[std::min(3, (int)type)]); } } else { gMetadata->metaversion++; } return status; } #ifndef METARESTORE uint8_t fs_setacl(const FsContext &context, uint32_t inode, const RichACL &acl) { ChecksumUpdater cu(context.ts()); FSNode *p; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } std::string acl_string = acl.toString(); status = fsnodes_setacl(p, acl, context.ts()); if (context.isPersonalityMaster()) { if (status == LIZARDFS_STATUS_OK) { fs_changelog(context.ts(), "SETRICHACL(%" PRIu32 ",%s)", p->id, acl_string.c_str()); } } else { gMetadata->metaversion++; } return status; } uint8_t fs_setacl(const FsContext &context, uint32_t inode, AclType type, const AccessControlList &acl) { ChecksumUpdater cu(context.ts()); FSNode *p; uint8_t status = verify_session(context, OperationMode::kReadWrite, SessionType::kNotMeta); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } std::string acl_string = acl.toString(); status = fsnodes_setacl(p, type, acl, context.ts()); if (context.isPersonalityMaster()) { if (status == LIZARDFS_STATUS_OK) { fs_changelog(context.ts(), "SETACL(%" PRIu32 ",%c,%s)", p->id, (type == AclType::kAccess ? 'a' : 'd'), acl_string.c_str()); } } else { gMetadata->metaversion++; } return status; return <API key>; } uint8_t fs_getacl(const FsContext &context, uint32_t inode, RichACL &acl) { FSNode *p; uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kAny, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } return fsnodes_getacl(p, acl); } #endif /* #ifndef METARESTORE */ uint8_t fs_apply_setacl(uint32_t ts, uint32_t inode, char aclType, const char *aclString) { AccessControlList acl; try { acl = AccessControlList::fromString(aclString); } catch (Exception &) { return <API key>; } FSNode *p = fsnodes_id_to_node(inode); if (!p) { return <API key>; } AclType aclTypeEnum; if (!decodeChar("da", {AclType::kDefault, AclType::kAccess}, aclType, aclTypeEnum)) { return <API key>; } uint8_t status = fsnodes_setacl(p, aclTypeEnum, std::move(acl), ts); if (status == LIZARDFS_STATUS_OK) { gMetadata->metaversion++; } return status; } uint8_t fs_apply_setrichacl(uint32_t ts, uint32_t inode, const std::string &acl_string) { RichACL acl; try { acl = RichACL::fromString(acl_string); } catch (Exception &) { return <API key>; } FSNode *p = fsnodes_id_to_node(inode); if (!p) { return <API key>; } uint8_t status = fsnodes_setacl(p, std::move(acl), ts); if (status == LIZARDFS_STATUS_OK) { gMetadata->metaversion++; } return status; } #ifndef METARESTORE uint32_t fs_getdirpath_size(uint32_t inode) { FSNode *node; node = fsnodes_id_to_node(inode); if (node) { if (node->type != FSNode::kDirectory) { return 15; // "(not directory)" } else { FSNodeDirectory *parent = nullptr; if (!node->parent.empty()) { parent = <API key><FSNodeDirectory>(node->parent[0]); } return 1 + <API key>(parent, node); } } else { return 11; // "(not found)" } return 0; // unreachable } void fs_getdirpath_data(uint32_t inode, uint8_t *buff, uint32_t size) { FSNode *node; node = fsnodes_id_to_node(inode); if (node) { if (node->type != FSNode::kDirectory) { if (size >= 15) { memcpy(buff, "(not directory)", 15); return; } } else { if (size > 0) { FSNodeDirectory *parent = nullptr; if (!node->parent.empty()) { parent = <API key><FSNodeDirectory>(node->parent[0]); } buff[0] = '/'; <API key>(parent, node, buff + 1, size - 1); return; } } } else { if (size >= 11) { memcpy(buff, "(not found)", 11); return; } } } uint8_t fs_get_dir_stats(const FsContext &context, uint32_t inode, uint32_t *inodes, uint32_t *dirs, uint32_t *files, uint32_t *chunks, uint64_t *length, uint64_t *size, uint64_t *rsize) { FSNode *p; statsrecord sr; uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFileOrDirectory, MODE_MASK_EMPTY, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } fsnodes_get_stats(p, &sr); *inodes = sr.inodes; *dirs = sr.dirs; *files = sr.files; *chunks = sr.chunks; *length = sr.length; *size = sr.size; *rsize = sr.realsize; // syslog(LOG_NOTICE,"using fast stats"); return LIZARDFS_STATUS_OK; } uint8_t fs_get_chunkid(const FsContext &context, uint32_t inode, uint32_t index, uint64_t *chunkid) { FSNode *p; uint8_t status = <API key>(context, ExpectedNodeType::kFile, MODE_MASK_EMPTY, inode, &p); FSNodeFile *node_file = static_cast<FSNodeFile*>(p); if (status != LIZARDFS_STATUS_OK) { return status; } if (index > MAX_INDEX) { return <API key>; } if (index < node_file->chunks.size()) { *chunkid = node_file->chunks[index]; } else { *chunkid = 0; } return LIZARDFS_STATUS_OK; } #endif uint8_t fs_add_tape_copy(const TapeKey &tapeKey, TapeserverId tapeserver) { FSNode *node = fsnodes_id_to_node(tapeKey.inode); if (node == NULL) { return <API key>; } if (node->type != FSNode::kTrash && node->type != FSNode::kReserved && node->type != FSNode::kFile) { return <API key>; } if (node->mtime != tapeKey.mtime || static_cast<FSNodeFile*>(node)->length != tapeKey.fileLength) { return <API key>; } // Try to reuse an existing copy from this tapeserver auto &tapeCopies = gMetadata->tapeCopies[node->id]; for (auto &tapeCopy : tapeCopies) { if (tapeCopy.server == tapeserver) { tapeCopy.state = TapeCopyState::kOk; return LIZARDFS_STATUS_OK; } } tapeCopies.emplace_back(TapeCopyState::kOk, tapeserver); return LIZARDFS_STATUS_OK; } #ifndef METARESTORE uint8_t <API key>(uint32_t inode, std::vector<<API key>> &locations) { sassert(locations.empty()); std::vector<TapeserverId> <API key>; FSNode *node = fsnodes_id_to_node(inode); if (node == NULL) { return <API key>; } auto it = gMetadata->tapeCopies.find(node->id); if (it == gMetadata->tapeCopies.end()) { return LIZARDFS_STATUS_OK; } for (auto &tapeCopy : it->second) { TapeserverListEntry tapeserverInfo; if (<API key>(tapeCopy.server, tapeserverInfo) == LIZARDFS_STATUS_OK) { locations.emplace_back(tapeserverInfo, tapeCopy.state); } else { <API key>.push_back(tapeCopy.server); } } /* Lazy cleaning up of disconnected tapeservers */ for (auto &tapeserverId : <API key>) { std::remove_if(it->second.begin(), it->second.end(), [tapeserverId](const TapeCopy &copy) { return copy.server == tapeserverId; }); } return LIZARDFS_STATUS_OK; } #endif void <API key>() { FSNode *f; for (uint32_t i = 0; i < NODEHASHSIZE; i++) { for (f = gMetadata->nodehash[i]; f; f = f->next) { if (f->type == FSNode::kFile || f->type == FSNode::kTrash || f->type == FSNode::kReserved) { for (const auto &chunkid : static_cast<FSNodeFile*>(f)->chunks) { if (chunkid > 0) { chunk_add_file(chunkid, f->goal); } } } } } } uint64_t fs_getversion() { if (!gMetadata) { throw NoMetadataException(); } return gMetadata->metaversion; } #ifndef METARESTORE const std::map<int, Goal> &<API key>() { return gGoalDefinitions; } const Goal &<API key>(uint8_t goalId) { return gGoalDefinitions[goalId]; } std::vector<JobInfo> <API key>() { return gMetadata->task_manager.getCurrentJobsInfo(); } uint8_t fs_cancel_job(uint32_t job_id) { if (gMetadata->task_manager.cancelJob(job_id)) { return LIZARDFS_STATUS_OK; } else { return <API key>; } } uint32_t fs_reserve_job_id() { return gMetadata->task_manager.reserveJobId(); } uint8_t fs_getchunksinfo(const FsContext& context, uint32_t current_ip, uint32_t inode, uint32_t chunk_index, uint32_t chunk_count, std::vector<<API key>> &chunks) { static constexpr int <API key> = 100; FSNode *p; uint8_t status = verify_session(context, OperationMode::kReadOnly, SessionType::kAny); if (status != LIZARDFS_STATUS_OK) { return status; } status = <API key>(context, ExpectedNodeType::kFile, MODE_MASK_R, inode, &p); if (status != LIZARDFS_STATUS_OK) { return status; } if (chunk_index > MAX_INDEX) { return <API key>; } FSNodeFile *file_node = static_cast<FSNodeFile *>(p); std::vector<<API key>> chunk_parts; if (chunk_count == 0) { chunk_count = file_node->chunks.size(); } chunks.clear(); while(chunk_index < file_node->chunks.size() && chunk_count > 0) { uint64_t chunk_id = file_node->chunks[chunk_index]; uint32_t chunk_version; chunk_parts.clear(); chunk_version = 0; if (chunk_id > 0) { status = <API key>(chunk_id, current_ip, chunk_version, <API key>, chunk_parts); if (status != LIZARDFS_STATUS_OK) { return status; } } chunks.emplace_back(std::move(chunk_id), std::move(chunk_version), std::move(chunk_parts)); chunk_index++; chunk_count } return LIZARDFS_STATUS_OK; } #endif
package com.example.dinabenayad_cherif.finalproject; /** * Utility class to perform a fast fourier transform without allocating any * extra memory. * * @author Mike Mandel (mim@ee.columbia.edu) */ //I removed some unused variables to get rid of warnings //Xiaochao public class FFT { int n, m; // Lookup tables. Only need to recompute when size of FFT changes. double[] cos; double[] sin; double[] window; public FFT(int n) { this.n = n; this.m = (int) (Math.log(n) / Math.log(2)); // Make sure n is a power of 2 if (n != (1 << m)) throw new RuntimeException("FFT length must be power of 2"); // precompute tables cos = new double[n / 2]; sin = new double[n / 2]; // for(int i=0; i<n/4; i++) { // cos[i] = Math.cos(-2*Math.PI*i/n); // sin[n/4-i] = cos[i]; // cos[n/2-i] = -cos[i]; // sin[n/4+i] = cos[i]; // cos[n/2+i] = -cos[i]; // sin[n*3/4-i] = -cos[i]; // cos[n-i] = cos[i]; // sin[n*3/4+i] = -cos[i]; for (int i = 0; i < n / 2; i++) { cos[i] = Math.cos(-2 * Math.PI * i / n); sin[i] = Math.sin(-2 * Math.PI * i / n); } makeWindow(); } protected void makeWindow() { // Make a blackman window: // w(n)=0.42-0.5cos{(2*PI*n)/(N-1)}+0.08cos{(4*PI*n)/(N-1)}; window = new double[n]; for (int i = 0; i < window.length; i++) window[i] = 0.42 - 0.5 * Math.cos(2 * Math.PI * i / (n - 1)) + 0.08 * Math.cos(4 * Math.PI * i / (n - 1)); } public double[] getWindow() { return window; } public void fft(double[] x, double[] y) { int i, j, k, n1, n2, a; double c, s, t1, t2; // Bit-reverse j = 0; n2 = n / 2; for (i = 1; i < n - 1; i++) { n1 = n2; while (j >= n1) { j = j - n1; n1 = n1 / 2; } j = j + n1; if (i < j) { t1 = x[i]; x[i] = x[j]; x[j] = t1; t1 = y[i]; y[i] = y[j]; y[j] = t1; } } // FFT n1 = 0; n2 = 1; for (i = 0; i < m; i++) { n1 = n2; n2 = n2 + n2; a = 0; for (j = 0; j < n1; j++) { c = cos[a]; s = sin[a]; a += 1 << (m - i - 1); for (k = j; k < n; k = k + n2) { t1 = c * x[k + n1] - s * y[k + n1]; t2 = s * x[k + n1] + c * y[k + n1]; x[k + n1] = x[k] - t1; y[k + n1] = y[k] - t2; x[k] = x[k] + t1; y[k] = y[k] + t2; } } } } // Test the FFT to make sure it's working public static void main(String[] args) { int N = 8; FFT fft = new FFT(N); double[] re = new double[N]; double[] im = new double[N]; // Impulse re[0] = 1; im[0] = 0; for (int i = 1; i < N; i++) re[i] = im[i] = 0; beforeAfter(fft, re, im); // Nyquist for (int i = 0; i < N; i++) { re[i] = Math.pow(-1, i); im[i] = 0; } beforeAfter(fft, re, im); // Single sin for (int i = 0; i < N; i++) { re[i] = Math.cos(2 * Math.PI * i / N); im[i] = 0; } beforeAfter(fft, re, im); // Ramp for (int i = 0; i < N; i++) { re[i] = i; im[i] = 0; } beforeAfter(fft, re, im); long time = System.currentTimeMillis(); double iter = 30000; for (int i = 0; i < iter; i++) fft.fft(re, im); time = System.currentTimeMillis() - time; System.out.println("Averaged " + (time / iter) + "ms per iteration"); } public static void beforeAfter(FFT fft, double[] re, double[] im) { System.out.println("Before: "); printReIm(re, im); fft.fft(re, im); System.out.println("After: "); printReIm(re, im); } public static void printReIm(double[] re, double[] im) { System.out.print("Re: ["); for (int i = 0; i < re.length; i++) System.out.print(((int) (re[i] * 1000) / 1000.0) + " "); System.out.print("]\nIm: ["); for (int i = 0; i < im.length; i++) System.out.print(((int) (im[i] * 1000) / 1000.0) + " "); System.out.println("]"); } }
// NScD Oak Ridge National Laboratory, European Spallation Source // & Institut Laue - Langevin #ifndef <API key> #define <API key> #include <cxxtest/TestSuite.h> #include "MantidAlgorithms/CalculateSlits.h" using namespace Mantid::Algorithms; namespace { double roundFour(double i) { return floor(i * 10000 + 0.5) / 10000; } } // namespace class CalculateSlitsTest : public CxxTest::TestSuite { public: void testSensibleArgs() { CalculateSlits alg; alg.initialize(); alg.setProperty("Slit1Slit2", 1940.5); alg.setProperty("Slit2SA", 364.); alg.setProperty("Angle", 0.7); alg.setProperty("Footprint", 50.); alg.setProperty("Resolution", 0.03); <API key>(alg.execute()); TS_ASSERT(alg.isExecuted()); // truncate the output values to 4 decimal places to eliminate // insignificant error const double slit1 = roundFour(alg.getProperty("Slit1")); TS_ASSERT_EQUALS(slit1, 1.0784); const double slit2 = roundFour(alg.getProperty("Slit2")); TS_ASSERT_EQUALS(slit2, 0.3440); } void <API key>() { CalculateSlits alg; alg.initialize(); alg.setProperty("Slit1Slit2", 1940.5); alg.setProperty("Slit2SA", 364.); alg.setProperty("Angle", -0.7); alg.setProperty("Footprint", 50.); alg.setProperty("Resolution", 0.03); <API key>(alg.execute()); TS_ASSERT(alg.isExecuted()); // truncate the output values to 4 decimal places to eliminate // insignificant error const double slit1 = roundFour(alg.getProperty("Slit1")); TS_ASSERT_EQUALS(slit1, -1.0784); const double slit2 = roundFour(alg.getProperty("Slit2")); TS_ASSERT_EQUALS(slit2, -0.3440); } void testWithZeroAngle() { CalculateSlits alg; alg.initialize(); alg.setProperty("Slit1Slit2", 1940.5); alg.setProperty("Slit2SA", 364.); alg.setProperty("Angle", 0.); alg.setProperty("Footprint", 50.); alg.setProperty("Resolution", 0.03); <API key>(alg.execute()); TS_ASSERT(alg.isExecuted()); const double slit1 = alg.getProperty("Slit1"); TS_ASSERT_EQUALS(slit1, 0.0); const double slit2 = alg.getProperty("Slit2"); TS_ASSERT_EQUALS(slit2, 0.0); } void testWithNanAndInf() { const double nan = std::numeric_limits<double>::quiet_NaN(); const double inf = std::numeric_limits<double>::infinity(); const double ninf = -inf; CalculateSlits alg; alg.initialize(); alg.setProperty("Slit1Slit2", nan); alg.setProperty("Slit2SA", nan); alg.setProperty("Angle", inf); alg.setProperty("Footprint", inf); alg.setProperty("Resolution", ninf); <API key>(alg.execute()); TS_ASSERT(alg.isExecuted()); const double slit1 = alg.getProperty("Slit1"); TS_ASSERT(std::isnan(slit1)); const double slit2 = alg.getProperty("Slit2"); TS_ASSERT(std::isnan(slit2)); } void testWithNoArgs() { CalculateSlits alg; alg.initialize(); <API key>(alg.execute()); TS_ASSERT(alg.isExecuted()); const double slit1 = alg.getProperty("Slit1"); TS_ASSERT(std::isnan(slit1)); const double slit2 = alg.getProperty("Slit2"); TS_ASSERT(std::isnan(slit2)); } }; #endif /*<API key>*/
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "local_paths.h" //a bit hacked, but it works: #include <textcat.c> //Reason: Datatypes required for <API key> are declared in .c file int text_is_english(void *tc, const char *text, size_t text_size) { if (tc == NULL) { fprintf(stderr, "textcat handle is NULL\n"); return 0; } char *result = textcat_Classify(tc, text, text_size /*> 5000 ? 5000 : dnm->size_plaintext*/ ); if (strncmp(result, "[english]", strlen("[english]"))) { //isn't primarily english return 0; } //otherwise return 1; } void *<API key>() /* the code from the textcat library, slightly adapted, to avoid external config files. */ { textcat_t *h; char line[1024]; char *config = "\n\nenglish.lm\t\t\tenglish\n\ afrikaans.lm\t\t\tafrikaans\n\ albanian.lm\t\t\talbanian\n\ amharic-utf.lm\t\tamharic-utf\n\ arabic-iso8859_6.lm\t\tarabic-iso8859_6\n\ arabic-windows1256.lm\tarabic-windows1256\n\ armenian.lm\t\t\tarmenian\n\ basque.lm\t\t\tbasque\n\ belarus-windows1251.lm\<API key>\n\ bosnian.lm\t\t\tbosnian\n\ breton.lm\t\t\tbreton\n\ bulgarian-iso8859_5.lm\<API key>\n\ catalan.lm\t\t\tcatalan\n\ chinese-big5.lm\t\tchinese-big5\n\ chinese-gb2312.lm\t\tchinese-gb2312\n\ croatian-ascii.lm\t\tcroatian-ascii\n\ czech-iso8859_2.lm\t\tczech-iso8859_2\n\ danish.lm\t\t\tdanish\n\ drents.lm\t\t\tdrents # Dutch dialect\n\ dutch.lm\t\t\tdutch\n\ esperanto.lm\t\t\tesperanto\n\ estonian.lm\t\t\testonian\n\ finnish.lm\t\t\tfinnish\n\ french.lm\t\t\tfrench\n\ frisian.lm\t\t\tfrisian\n\ georgian.lm\t\t\tgeorgian\n\ german.lm\t\t\tgerman\n\ greek-iso8859-7.lm\t\tgreek-iso8859-7\n\ hebrew-iso8859_8.lm\t\thebrew-iso8859_8\n\ hindi.lm\t\t\thindi\n\ hungarian.lm\t\t\thungarian\n\ icelandic.lm\t\t\ticelandic\n\ indonesian.lm\t\tindonesian\n\ irish.lm\t\t\tirish\n\ italian.lm\t\t\titalian\n\ japanese-euc_jp.lm\t\tjapanese-euc_jp\n\ japanese-shift_jis.lm\tjapanese-shift_jis\n\ korean.lm\t\t\tkorean\n\ latin.lm\t\t\tlatin\n\ latvian.lm\t\t\tlatvian\n\ lithuanian.lm\t\tlithuanian\n\ malay.lm\t\t\tmalay\n\ manx.lm\t\t\tmanx\n\ marathi.lm\t\t\tmarathi\n\ middle_frisian.lm\t\tmiddle_frisian\n\ mingo.lm\t\t\tmingo\n\ nepali.lm\t\t\tnepali\n\ norwegian.lm\t\t\tnorwegian\n\ persian.lm\t\t\tpersian\n\ polish.lm\t\t\tpolish\n\ portuguese.lm\t\tportuguese\n\ quechua.lm\t\t\tquechua\n\ romanian.lm\t\t\tromanian\n\ rumantsch.lm\t\t\trumantsch\n\ russian-iso8859_5.lm\t\trussian-iso8859_5\n\ russian-koi8_r.lm\t\trussian-koi8_r\n\ russian-windows1251.lm\<API key>\n\ sanskrit.lm\t\t\tsanskrit\n\ scots.lm\t\t\tscots\n\ scots_gaelic.lm\t\tscots_gaelic\n\ serbian-ascii.lm\t\tserbian-ascii\n\ slovak-ascii.lm\t\tslovak-ascii\n\ slovak-windows1250.lm\tslovak-windows1250\n\ slovenian-ascii.lm\t\tslovenian-ascii\n\ slovenian-iso8859_2.lm\<API key>\n\ spanish.lm\t\t\tspanish\n\ swahili.lm\t\t\tswahili\n\ swedish.lm\t\t\tswedish\n\ tagalog.lm\t\t\ttagalog\n\ tamil.lm\t\t\ttamil\n\ thai.lm\t\t\tthai\n\ turkish.lm\t\t\tturkish\n\ ukrainian-koi8_r.lm\t\tukrainian-koi8_r\n\ vietnamese.lm\t\tvietnamese\n\ welsh.lm\t\t\twelsh\n\ yiddish-utf.lm\t\tyiddish-utf\n\n"; FILE *fp = fmemopen(config, strlen(config), "r"); h = (textcat_t *)wg_malloc(sizeof(textcat_t)); h->size = 0; h->maxsize = 16; h->fprint = (void **)wg_malloc( sizeof(void*) * h->maxsize ); while ( wg_getline( line, 1024, fp ) ) { char *p; char *segment[4]; int res; /*** Skip comments ***/ #ifdef HAVE_STRCHR if (( p = strchr(line,' #else if (( p = index(line,' #endif *p = '\0'; } if ((res = wg_split( segment, line, line, 4)) < 2 ) { continue; } /*** Ensure enough space ***/ if ( h->size == h->maxsize ) { h->maxsize *= 2; h->fprint = (void *)wg_realloc( h->fprint, sizeof(void*) * h->maxsize ); } /*** Load data ***/ if ((h->fprint[ h->size ] = fp_Init( segment[1] ))==NULL) { goto ERROR; } char *newpath; size_t tmp; FILE *tmpstream = open_memstream(&newpath, &tmp); fprintf(tmpstream, "%s%s", <API key>, segment[0]); fclose(tmpstream); if ( fp_Read( h->fprint[h->size], newpath, 400 ) == 0 ) { free(newpath); textcat_Done(h); goto ERROR; } free(newpath); h->size++; } fclose(fp); return h; ERROR: fclose(fp); return NULL; }
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import logging import argparse #import subprocess import json import pywemo import urllib.request import urllib.error import urllib.parse import socketserver from datetime import datetime __version__ = '0.93' logging.basicConfig(level=logging.DEBUG, format='%(asctime)-15s - %(name)s: %(message)s') logger = logging.getLogger('wemo_server') logger.info('Program starting version %s', __version__) reqlog = logging.getLogger("urllib3.connectionpool") reqlog.disabled = True NOOP = lambda *x: None #level = logging.DEBUG # if getattr(args, 'debug', False): # level = logging.DEBUG # logging.basicConfig(level=level) # callbackUrl=${1} if len(sys.argv) > 1: callbackUrl = sys.argv[1] else: callbackUrl = "http://localhost?payload=" #logger.debug('callback Url %s', callbackUrl) # listen PORT=${2} if len(sys.argv) > 2: PORT = int(sys.argv[2]) HOST, PORT = "localhost", int(sys.argv[2]) else: PORT = 5000 HOST, PORT = "localhost", 5000 # loglevel=${3} if len(sys.argv) > 3: loglevel = sys.argv[3] else: loglevel = "info" logger.debug('loglevel %s', loglevel) #time_start = time() #print('Server started at ', strftime("%a, %d %b %Y %H:%M:%S +0000", localtime(time_start)), 'listening on port ', PORT) #logger.info('Server started at %s listening on port %s',strftime("%a, %d %b %Y %H:%M:%S +0000", localtime(time_start)), PORT) def _status(state): return 1 if state == 1 else 0 def _standby(state): return 1 if state == 8 else 0 def <API key>(params): """Parse the Insight parameters.""" #global logger ( state, # 0 if off, 1 if on, 8 if on but load is off lastchange, onfor, # seconds ontoday, # seconds ontotal, # seconds timeperiod, # pylint: disable=unused-variable wifipower, currentmw, todaymw, totalmw ) = params.split('|') state = int(state) return {'status': _status(state), 'standby': _standby(state), 'lastchange': datetime.fromtimestamp(int(lastchange)), 'onfor': int(onfor), 'ontoday': int(ontoday), 'ontotal': int(ontotal), 'wifiPower': int(wifipower), 'todaymw': int(float(todaymw)), 'totalmw': int(float(totalmw)), 'currentpower': int(float(currentmw))} def event(self, _type, value): global logger #logger.info('event argument = %s',locals().keys()) try: logger.info('event for device %s with type = %s value %s', self.serialnumber, _type, value) #logger.info("$$$$$$ $$ device = %s", type(self)) if _type == 'BinaryState': params = {} serialnumber = self.serialnumber if self.model_name == "Insight": params = dict(self.insight_params) params['status'] = _status(int(params['state'])) params['standby'] = _standby(int(params['state'])) del params['state'] else: params["status"] = self.get_state() params["logicalAddress"] = serialnumber payload = json.dumps(params, sort_keys=True, default=str) logger.debug("json dumps payload = %s", payload) urllib.request.urlopen( callbackUrl + urllib.parse.quote(payload)).read() except: logger.warning( 'bug in event for device with type = %s value %s', _type, value) devices = pywemo.discover_devices() <API key> = pywemo.<API key>() <API key>.start() for device in devices: ''' state = device.get_state(True) logger.info('state = %s', str(state)) serialnumber = device.serialnumber logger.info("serialnumber = %s", serialnumber) params = {} if device.model_name == "Insight": params = dict(device.insight_params) params['status'] = _status(int(params['state'])) params['standby'] = _standby(int(params['state'])) del params['state'] else: params["status"] = device.get_state() params["logicalAddress"] = serialnumber payload = json.dumps(params, sort_keys=True, default=str) logger.debug("json dumps payload = %s", payload) urllib.request.urlopen(callbackUrl + urllib.parse.quote(payload)).read() ''' <API key>.register(device) <API key>.on(device, 'BinaryState', event) #<API key>.on(device, 'EnergyPerUnitCost', event) class apiRequestHandler(socketserver.BaseRequestHandler): def __init__(self, request, client_address, server): # initialization. self.logger = logging.getLogger('apiRequestHandler') #self.logger.debug('__init__') socketserver.BaseRequestHandler.__init__( self, request, client_address, server) def start_response(self, code, contentType, data): self.logger.debug( 'start_response() code = %s payload = %s', code, data) code = "HTTP/1.1 " + code + '\r\n' self.request.send(code.encode()) response_headers = { 'Content-Type': contentType + '; encoding=utf8', 'Content-Length': len(data), 'Connection': 'close', } <API key> = ''.join('%s: %s\n' % ( k, v) for k, v in response_headers.items()) self.request.send(<API key>.encode()) self.request.send(b'\n') return self.request.send(data.encode()) def handle(self): #self.logger.debug('start handle()') global devices data = str(self.request.recv(1024), "utf-8").split('\n')[0] lst = data.split() stringcount = len(lst) #self.logger.debug('split len->"%s"', stringcount) if stringcount > 1: data = urllib.parse.unquote(urllib.parse.unquote(lst[1])) else: data = urllib.parse.unquote(urllib.parse.unquote(lst[1])) self.logger.debug('recv()->"%s"', data) cmd = 'unkown' data = data.split("?") #self.logger.debug('after split data -> %s', data) cmd = data[0] #self.logger.debug('cmd -> %s', cmd) cmd = cmd.split("/")[1] #self.logger.debug('cmd -> %s', cmd) arg = '' if len(data) > 1: arg = data[1] #self.logger.debug('arg ->%s', arg) key = '' value = '' key2 = '' value2 = '' if arg: options = arg.split('&') key = options[0].rpartition('=')[0] value = urllib.parse.unquote(options[0].rpartition('=')[2]) if len(options) == 2: key2 = options[1].rpartition('=')[0] value2 = urllib.parse.unquote(options[1].rpartition('=')[2]) #print('DEBUG = cmd=', cmd, ' arg ', arg, ' key ', key, ' value ', value, ' key2 ', key2, ' value2 ', value2) #self.logger.debug('cmd ->%s arg=%s key=%s value=%s key2=%s value2=%s', # cmd, arg, key, value, key2, value2) if not cmd: content_type = "text/html" self.start_response( '200 OK', content_type, '<h1>Welcome. Try a command ex : scan, stop, start.</h1>') return if cmd == 'scan': devices = pywemo.discover_devices() payload = '[' separator = '' for device in devices: params = {} params['name'] = device.name logger.info("name = %s", params['name']) params['host'] = device.host logger.info("host = %s", params['host']) params['serialNumber'] = device.serialnumber logger.info("serialnumber = %s", params['serialNumber']) params['modelName'] = device.model_name logger.info("modelName = %s", params['modelName']) params['model'] = device.model logger.info("model = %s", params['model']) state = device.get_state(True) logger.info('state = %s', str(state)) payload += separator payload += json.dumps(params, sort_keys=True, default=str) separator = ',' payload += ']' self.logger.debug(' scan data ->%s', payload) content_type = "text/javascript" self.start_response('200 OK', content_type, payload) return if cmd == 'toggle': # key = address value = serialnumber for device in devices: if device.serialnumber == value: device.toggle() params = {} serialnumber = device.serialnumber if device.model_name == "Insight": params = dict(device.insight_params) params['status'] = _status(int(params['state'])) params['standby'] = _standby(int(params['state'])) del params['state'] else: params["status"] = device.get_state() params["logicalAddress"] = serialnumber payload = json.dumps(params, sort_keys=True, default=str) content_type = "text/javascript" self.start_response('200 OK', content_type, payload) return payload = '{"status": 0, "standby": 0}' content_type = "text/javascript" self.start_response('200 OK', content_type, payload) return if cmd == 'on': # key = address value = serialnumber for device in devices: if device.serialnumber == value: device.on() params = {} serialnumber = device.serialnumber if device.model_name == "Insight": params = dict(device.insight_params) params['status'] = _status(int(params['state'])) params['standby'] = _standby(int(params['state'])) del params['state'] else: params["status"] = device.get_state() params["logicalAddress"] = serialnumber payload = json.dumps(params, sort_keys=True, default=str) content_type = "text/javascript" self.start_response('200 OK', content_type, payload) return payload = '{"status": 0, "standby": 0}' content_type = "text/javascript" self.start_response('200 OK', content_type, payload) return if cmd == 'off': # key = address value = serialnumber for device in devices: if device.serialnumber == value: device.off() params = {} serialnumber = device.serialnumber if device.model_name == "Insight": params = dict(device.insight_params) params['status'] = _status(int(params['state'])) params['standby'] = _standby(int(params['state'])) del params['state'] else: params["status"] = device.get_state() params["logicalAddress"] = serialnumber payload = json.dumps(params, sort_keys=True, default=str) content_type = "text/javascript" self.start_response('200 OK', content_type, payload) return payload = '{"status": 0, "standby": 0}' content_type = "text/javascript" self.start_response('200 OK', content_type, payload) return if cmd == 'refresh': for device in devices: if device.serialnumber == value: device.update_binary_state() params = {} serialnumber = device.serialnumber if device.model_name == "Insight": device.<API key>() params = dict(device.insight_params) params['status'] = _status(int(params['state'])) params['standby'] = _standby(int(params['state'])) del params['state'] else: params["status"] = device.get_state(True) params["logicalAddress"] = serialnumber payload = json.dumps(params, sort_keys=True, default=str) content_type = "text/javascript" self.start_response('200 OK', content_type, payload) return payload = '{"status": 0, "standby": 0}' content_type = "text/javascript" self.start_response('200 OK', content_type, payload) return if cmd.startswith('stop') or cmd == 'stop': print('stop server requested') server.server_close() os._exit(1) if cmd == 'ping': content_type = "text/html" self.start_response('200 OK', content_type, "ping") return self.logger.debug('cmd %s not yet implemented', cmd) payload = '{"error": cmd not implemented}' content_type = "text/javascript" self.start_response('404 Not Found', content_type, payload) return class apiServer(socketserver.TCPServer): def __init__(self, server_address, handler_class=apiRequestHandler): self.logger = logging.getLogger('apiServer') #self.logger.debug('__init__') socketserver.TCPServer.allow_reuse_address = True socketserver.TCPServer.__init__(self, server_address, handler_class) def server_activate(self): self.logger.debug('server_activate') return socketserver.TCPServer.server_activate(self) def serve_forever(self, poll_interval=0.5): self.logger.debug('waiting for request from api') self.logger.info('Handling api requests, press <Ctrl-C> to quit') return socketserver.TCPServer.serve_forever(self, poll_interval) def handle_request(self): # self.logger.debug('handle_request') return socketserver.TCPServer.handle_request(self) def verify_request(self, request, client_address): #self.logger.debug('verify_request(%s, %s)', request, client_address) return socketserver.TCPServer.verify_request( self, request, client_address, ) def process_request(self, request, client_address): self.logger.debug('process_request(%s, %s)', request, client_address) return socketserver.TCPServer.process_request( self, request, client_address, ) def server_close(self): self.logger.debug('server_close') return socketserver.TCPServer.server_close(self) def finish_request(self, request, client_address): #self.logger.debug('finish_request(%s, %s)', request, client_address) return socketserver.TCPServer.finish_request( self, request, client_address, ) def close_request(self, request_address): #self.logger.debug('close_request(%s)', request_address) return socketserver.TCPServer.close_request( self, request_address, ) def shutdown(self): self.logger.debug('shutdown()') try: address = (HOST, PORT) server = apiServer(address, apiRequestHandler) ip, port = server.server_address logger.info('Listen on %s:%s', ip, port) server.serve_forever() logger.info('Server ended') except (KeyboardInterrupt, SystemExit): logger.info('Server ended via ctrl+C') os._exit(0)
package cis501.submission; import cis501.*; import org.junit.Before; import org.junit.Test; import java.util.LinkedList; import java.util.List; import static org.junit.Assert.assertEquals; public class <API key> { // TODO: replace the path of trace file here private static final String TRACE_FILE = "//home//luis//Documents//CIS501//tracefiles//<API key>.trace.gz"; private IBranchTargetBuffer btb; private IDirectionPredictor bimodal; private IDirectionPredictor gshare; private IDirectionPredictor tournament; private IInorderPipeline pipe; private static Insn makeBr(long pc, Direction dir, /*long fallthruPC*/ long targetPC) { return new Insn(1, 2, 3, pc, 4, dir, targetPC, null, null, 0, 0, "<synthetic>"); } // BTB tests @Before public void setUp() throws Exception { // Runs before each test...() method btb = new BranchTargetBuffer(3/*index bits*/); bimodal = new DirPredBimodal(3/*index bits*/); gshare = new DirPredGshare(3/*index bits*/, 1/*history bits*/); // create a tournament predictor that behaves like bimodal IDirectionPredictor always = new DirPredAlwaysTaken(); IDirectionPredictor never = new DirPredNeverTaken(); //tournament = new DirPredTournament(3/*index bits*/, never, always); tournament = new DirPredTournament(3/*index bits*/, bimodal, gshare); // pipeline uses never predictor pipe = new InorderPipeline(0, new BranchPredictor(never, btb)); } @Test public void testBtbInitialState() { assertEquals(0, btb.predict(0)); } @Test public void <API key>() { assertEquals(0, btb.predict(-1)); } @Test public void testBtbNewTarget() { btb.train(0, 42); assertEquals(42, btb.predict(0)); } // Bimodal tests @Test public void testBtbAlias() { btb.train(0, 42); assertEquals(42, btb.predict(0)); long alias0 = (long) Math.pow(2, 3); btb.train(alias0, 100); assertEquals(0, btb.predict(0)); // tag doesn't match assertEquals(100, btb.predict(alias0)); // tag matches } @Test public void <API key>() { assertEquals(Direction.NotTaken, bimodal.predict(0)); } @Test public void <API key>() { assertEquals(Direction.NotTaken, bimodal.predict(-1)); } @Test public void testBimodalTaken() { bimodal.train(0, Direction.Taken); assertEquals(Direction.NotTaken, bimodal.predict(0)); bimodal.train(0, Direction.Taken); assertEquals(Direction.Taken, bimodal.predict(0)); } // Gshare tests @Test public void <API key>() { for (int i = 0; i < 10; i++) { bimodal.train(0, Direction.Taken); } bimodal.train(0, Direction.NotTaken); bimodal.train(0, Direction.NotTaken); assertEquals(Direction.NotTaken, bimodal.predict(0)); } @Test public void <API key>() { assertEquals(Direction.NotTaken, gshare.predict(0)); } // Tournament predictor tests @Test public void testGshareTaken() { // initially, history is 0 gshare.train(0, Direction.Taken); // 0 ^ 0 == 0 // history is 1 assertEquals(Direction.NotTaken, gshare.predict(1)); // 1 ^ 1 == 0 gshare.train(1, Direction.Taken); // 1 ^ 1 == 0 // history is 1 assertEquals(Direction.Taken, gshare.predict(1)); // 1 ^ 1 == 0 } @Test public void <API key>() { assertEquals(Direction.NotTaken, tournament.predict(0)); } @Test public void testTournTaken() { tournament.train(0, Direction.Taken); assertEquals(Direction.NotTaken, tournament.predict(0)); tournament.train(0, Direction.Taken); assertEquals(Direction.Taken, tournament.predict(0)); } // Pipeline tests @Test public void <API key>() { for (int i = 0; i < 10; i++) { tournament.train(0, Direction.Taken); } tournament.train(0, Direction.NotTaken); tournament.train(0, Direction.NotTaken); assertEquals(Direction.NotTaken, tournament.predict(0)); } @Test public void testPipeCorrectPred() { List<Insn> insns = new LinkedList<>(); insns.add(makeBr(0, Direction.NotTaken, 40)); insns.add(makeBr(4, Direction.NotTaken, 40)); pipe.run(insns); assertEquals(2, pipe.getInsns()); // 123456789 // fdxmw | // fdxmw| assertEquals(7, pipe.getCycles()); } @Test public void <API key>() { List<Insn> insns = new LinkedList<>(); insns.add(makeBr(0, Direction.Taken, 40)); // mispredicted insns.add(makeBr(40, Direction.NotTaken, 60)); pipe.run(insns); assertEquals(2, pipe.getInsns()); // 123456789 // fdxmw | // ..fdxmw| assertEquals(7 + 2, pipe.getCycles()); } @Test public void <API key>() { List<Insn> insns = new LinkedList<>(); insns.add(makeBr(0, Direction.Taken, 40)); // mispredicted insns.add(makeBr(40, Direction.Taken, 60)); // mispredicted insns.add(makeBr(60, Direction.NotTaken, 80)); pipe.run(insns); assertEquals(3, pipe.getInsns()); // 123456789abcd // fdxmw | // ..fdxmw | // ..fdxmw| assertEquals(8 + (2 * 2), pipe.getCycles()); } // Trace tests: actual IPCs for <API key>.trace.gz with the always/never-taken // predictors and zero additional memory latency. @Test public void <API key>() { final IDirectionPredictor always = new DirPredAlwaysTaken(); final IBranchTargetBuffer bigBtb = new BranchTargetBuffer(10); InsnIterator uiter = new InsnIterator(TRACE_FILE, -1); IInorderPipeline pl = new InorderPipeline(0, new BranchPredictor(always, bigBtb)); pl.run(uiter); assertEquals(0.96, pl.getInsns() / (double) pl.getCycles(), 0.01); } @Test public void testNeverTakenTrace() { final IDirectionPredictor never = new DirPredNeverTaken(); final IBranchTargetBuffer bigBtb = new BranchTargetBuffer(10); InsnIterator uiter = new InsnIterator(TRACE_FILE, -1); IInorderPipeline pl = new InorderPipeline(0, new BranchPredictor(never, bigBtb)); pl.run(uiter); assertEquals(0.81, pl.getInsns() / (double) pl.getCycles(), 0.01); } @Test public void housetest() { final IDirectionPredictor gsh = new DirPredGshare(5/*index bits*/, 5); final IDirectionPredictor bm = new DirPredBimodal(5); final IDirectionPredictor nev = new DirPredNeverTaken(); final IBranchTargetBuffer ericbtb = new BranchTargetBuffer(5); InsnIterator uiter = new InsnIterator(TRACE_FILE,5000); IInorderPipeline eric = new InorderPipeline(1, new BranchPredictor(nev, ericbtb)); eric.run(uiter); assertEquals(7562, eric.getCycles()); } // add more tests here! @Test public void CustomTest1() { for (int i=4;i<=18;i++) { System.out.println("N= "+i); final IDirectionPredictor never = new DirPredNeverTaken(); final IDirectionPredictor bimodal = new DirPredBimodal(i-2); final IDirectionPredictor gshare = new DirPredGshare(i-1, i-1); final IDirectionPredictor tourn = new DirPredTournament(i-2, gshare, bimodal); final IBranchTargetBuffer bigBtb = new BranchTargetBuffer(i); InsnIterator uiter = new InsnIterator(TRACE_FILE, -1); IInorderPipeline pl = new InorderPipeline(1, new BranchPredictor(bimodal, bigBtb)); pl.run(uiter); // System.out.println("IPC= "+ (pltourn.getInsns() / (double) pltourn.getCycles())); } //assertEquals(0.96, pltourn.getInsns() / (double) pltourn.getCycles(), 0.01); } }
# -*- coding: utf-8 -*- # diffoscope: in-depth comparison of files, archives, and directories # diffoscope is free software: you can redistribute it and/or modify # (at your option) any later version. # diffoscope is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the import os.path import shutil import pytest from diffoscope.comparators import specialize from diffoscope.comparators.binary import FilesystemFile, NonExistingFile from diffoscope.comparators.debian import DotChangesFile, DotDscFile from diffoscope.config import Config from diffoscope.presenters.text import output_text <API key> = os.path.join(os.path.dirname(__file__), '../data/test1.changes') <API key> = os.path.join(os.path.dirname(__file__), '../data/test2.changes') TEST_DEB_FILE1_PATH = os.path.join(os.path.dirname(__file__), '../data/test1.deb') TEST_DEB_FILE2_PATH = os.path.join(os.path.dirname(__file__), '../data/test2.deb') @pytest.fixture def dot_changes1(tmpdir): tmpdir.mkdir('a') dot_changes_path = str(tmpdir.join('a/test_1.changes')) shutil.copy(<API key>, dot_changes_path) shutil.copy(TEST_DEB_FILE1_PATH, str(tmpdir.join('a/test_1_all.deb'))) return specialize(FilesystemFile(dot_changes_path)) @pytest.fixture def dot_changes2(tmpdir): tmpdir.mkdir('b') dot_changes_path = str(tmpdir.join('b/test_1.changes')) shutil.copy(<API key>, dot_changes_path) shutil.copy(TEST_DEB_FILE2_PATH, str(tmpdir.join('b/test_1_all.deb'))) return specialize(FilesystemFile(dot_changes_path)) def <API key>(dot_changes1): assert isinstance(dot_changes1, DotChangesFile) def <API key>(tmpdir): tmpdir.mkdir('a') dot_changes_path = str(tmpdir.join('a/test_1.changes')) shutil.copy(<API key>, dot_changes_path) # we don't copy the referenced .deb identified = specialize(FilesystemFile(dot_changes_path)) assert not isinstance(identified, DotChangesFile) def <API key>(dot_changes1): difference = dot_changes1.compare(dot_changes1) assert difference is None @pytest.fixture def <API key>(dot_changes1, dot_changes2): difference = dot_changes1.compare(dot_changes2) output_text(difference, print_func=print) return difference.details def <API key>(<API key>): assert <API key>[0] expected_diff = open(os.path.join(os.path.dirname(__file__), '../data/<API key>')).read() assert <API key>[0].unified_diff == expected_diff def <API key>(<API key>): assert <API key>[2].source1 == 'test_1_all.deb' def <API key>(monkeypatch, dot_changes1): monkeypatch.setattr(Config.general, 'new_file', True) difference = dot_changes1.compare(NonExistingFile('/nonexisting', dot_changes1)) output_text(difference, print_func=print) assert difference.source2 == '/nonexisting' assert difference.details[-1].source2 == '/dev/null' <API key> = os.path.join(os.path.dirname(__file__), '../data/test1.dsc') <API key> = os.path.join(os.path.dirname(__file__), '../data/test2.dsc') TEST_DEB_SRC1_PATH = os.path.join(os.path.dirname(__file__), '../data/test1.debsrc.tar.gz') TEST_DEB_SRC2_PATH = os.path.join(os.path.dirname(__file__), '../data/test2.debsrc.tar.gz') @pytest.fixture def dot_dsc1(tmpdir): tmpdir.mkdir('a') dot_dsc_path = str(tmpdir.join('a/test_1.dsc')) shutil.copy(<API key>, dot_dsc_path) shutil.copy(TEST_DEB_SRC1_PATH, str(tmpdir.join('a/test_1.tar.gz'))) return specialize(FilesystemFile(dot_dsc_path)) @pytest.fixture def dot_dsc2(tmpdir): tmpdir.mkdir('b') dot_dsc_path = str(tmpdir.join('b/test_1.dsc')) shutil.copy(<API key>, dot_dsc_path) shutil.copy(TEST_DEB_SRC2_PATH, str(tmpdir.join('b/test_1.tar.gz'))) return specialize(FilesystemFile(dot_dsc_path)) def <API key>(dot_dsc1): assert isinstance(dot_dsc1, DotDscFile) def <API key>(tmpdir, dot_dsc2): tmpdir.mkdir('a') dot_dsc_path = str(tmpdir.join('a/test_1.dsc')) shutil.copy(<API key>, dot_dsc_path) # we don't copy the referenced .tar.gz identified = specialize(FilesystemFile(dot_dsc_path)) assert not isinstance(identified, DotDscFile) def <API key>(dot_dsc1): difference = dot_dsc1.compare(dot_dsc1) assert difference is None @pytest.fixture def dot_dsc_differences(dot_dsc1, dot_dsc2): difference = dot_dsc1.compare(dot_dsc2) output_text(difference, print_func=print) return difference.details def <API key>(dot_dsc_differences): assert dot_dsc_differences[1].source1 == 'test_1.tar.gz' def <API key>(monkeypatch, dot_dsc1): monkeypatch.setattr(Config.general, 'new_file', True) difference = dot_dsc1.compare(NonExistingFile('/nonexisting', dot_dsc1)) output_text(difference, print_func=print) assert difference.source2 == '/nonexisting' assert difference.details[-1].source2 == '/dev/null'
package de.rallye.exceptions.mappers; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import javax.ws.rs.<API key>; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; @Provider public class <API key> implements ExceptionMapper<<API key>> { private static final Logger logger = LogManager.getLogger(<API key>.class); @Override public Response toResponse(<API key> exception) { logger.info("Mapping exception"); logger.info(exception.getResponse()); exception.printStackTrace(); return exception.getResponse(); } }
<?php //Include the passwords and shit in this file include("../model/php/variables.php"); // TODO: Need to verifiy that the user input is correct before passing it to the included file if(isset($_GET['page']) && $_GET['page'] == "article"){ // Done ! :D $article_id = (int)$_GET['article']; include("../model/php/show_blog_post.php"); $article_description = resumee_of_article(get_blog_post($global_password,$global_username,$global_databasename,$article_id)); include("../model/php/header.php"); include("../model/php/navigation.php"); print_blog_post(get_blog_post($global_password,$global_username,$global_databasename,$article_id)); include("../model/php/footer.php"); } elseif(isset($_GET['page']) && $_GET['page'] == "auteur"){ // Done ! :D $auteur = $_GET['profil']; include("../model/php/header.php"); include("../model/php/navigation.php"); include("../model/php/profil_page.php"); // Author include("../model/php/footer.php"); } elseif(isset($_GET['page']) && $_GET['page'] == "search"){ // Done ! :D include("../model/php/header.php"); include("../model/php/navigation.php"); include("../model/php/search.php"); // Search include("../model/php/footer.php"); } elseif(isset($_GET['page']) && $_GET['page'] == "admin"){ // Done ! :D include("../model/php/header.php"); include("../model/php/navigation.php"); include("../model/php/admin.php"); // Admin include("../model/php/footer.php"); } else{ if(isset($_GET['page']) && is_int($_GET['page'])){ $current_page = (int)$_GET['page']; }else{ $current_page = 1; } include("../model/php/<API key>.php"); include("../model/php/header.php"); include("../model/php/navigation.php"); get_blog_posts($global_password,$global_username,$global_databasename,$current_page); include("../model/php/footer.php"); } ?>
package org.thoughtcrime.securesms; import android.content.Context; import android.os.AsyncTask; import android.os.Handler; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import org.thoughtcrime.securesms.crypto.MasterSecret; import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.MmsDatabase; import org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch; import org.thoughtcrime.securesms.database.documents.NetworkFailure; import org.thoughtcrime.securesms.database.model.MessageRecord; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.sms.MessageSender; import org.thoughtcrime.securesms.util.RecipientViewUtil; /** * A simple view to show the recipients of a message * * @author Jake McGinty */ public class <API key> extends RelativeLayout implements Recipient.<API key> { private final static String TAG = <API key>.class.getSimpleName(); private Recipient recipient; private TextView fromView; private TextView errorDescription; private Button conflictButton; private Button resendButton; private ImageView contactPhotoImage; private final Handler handler = new Handler(); public <API key>(Context context) { super(context); } public <API key>(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onFinishInflate() { this.fromView = (TextView) findViewById(R.id.from); this.errorDescription = (TextView) findViewById(R.id.error_description); this.contactPhotoImage = (ImageView) findViewById(R.id.contact_photo_image); this.conflictButton = (Button) findViewById(R.id.conflict_button); this.resendButton = (Button) findViewById(R.id.resend_button); } public void set(final MasterSecret masterSecret, final MessageRecord record, final Recipient recipient, final boolean isPushGroup) { this.recipient = recipient; recipient.addListener(this); fromView.setText(RecipientViewUtil.formatFrom(getContext(), recipient)); RecipientViewUtil.setContactPhoto(getContext(), contactPhotoImage, recipient, false); setIssueIndicators(masterSecret, record, isPushGroup); } private void setIssueIndicators(final MasterSecret masterSecret, final MessageRecord record, final boolean isPushGroup) { final NetworkFailure networkFailure = getNetworkFailure(record); final IdentityKeyMismatch keyMismatch = networkFailure == null ? getKeyMismatch(record) : null; String errorText = ""; if (keyMismatch != null) { resendButton.setVisibility(View.GONE); conflictButton.setVisibility(View.VISIBLE); errorText = getContext().getString(R.string.<API key>); conflictButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new <API key>(getContext(), masterSecret, record, keyMismatch).show(); } }); } else if (networkFailure != null || (!isPushGroup && record.isFailed())) { resendButton.setVisibility(View.VISIBLE); conflictButton.setVisibility(View.GONE); errorText = getContext().getString(R.string.<API key>); resendButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new ResendAsyncTask(masterSecret, record, networkFailure).execute(); } }); } else { resendButton.setVisibility(View.GONE); conflictButton.setVisibility(View.GONE); } errorDescription.setText(errorText); errorDescription.setVisibility(TextUtils.isEmpty(errorText) ? View.GONE : View.VISIBLE); } private NetworkFailure getNetworkFailure(final MessageRecord record) { if (record.hasNetworkFailures()) { for (final NetworkFailure failure : record.getNetworkFailures()) { if (failure.getRecipientId() == recipient.getRecipientId()) { return failure; } } } return null; } private IdentityKeyMismatch getKeyMismatch(final MessageRecord record) { if (record.<API key>()) { for (final IdentityKeyMismatch mismatch : record.<API key>()) { if (mismatch.getRecipientId() == recipient.getRecipientId()) { return mismatch; } } } return null; } public void unbind() { if (this.recipient != null) this.recipient.removeListener(this); } @Override public void onModified(final Recipient recipient) { handler.post(new Runnable() { @Override public void run() { fromView.setText(RecipientViewUtil.formatFrom(getContext(), recipient)); RecipientViewUtil.setContactPhoto(getContext(), contactPhotoImage, recipient, false); } }); } private class ResendAsyncTask extends AsyncTask<Void,Void,Void> { private final MasterSecret masterSecret; private final MessageRecord record; private final NetworkFailure failure; public ResendAsyncTask(MasterSecret masterSecret, MessageRecord record, NetworkFailure failure) { this.masterSecret = masterSecret; this.record = record; this.failure = failure; } @Override protected Void doInBackground(Void... params) { MmsDatabase mmsDatabase = DatabaseFactory.getMmsDatabase(getContext()); mmsDatabase.removeFailure(record.getId(), failure); if (record.getRecipients().isGroupRecipient()) { MessageSender.resendGroupMessage(getContext(), masterSecret, record, failure.getRecipientId()); } else { MessageSender.resend(getContext(), masterSecret, record); } return null; } } }
#include <wx/wx.h> #include <wx/filename.h> #include <ngpcore/p3dsplineio.h> #include <p3dappprefs.h> #include <p3dwxcurvectrl.h> enum { <API key> = wxID_HIGHEST + 1, P3D_ID_EXPORT , P3D_ID_IMPORT }; unsigned int P3DCurveCtrl::BestWidth = <API key>; unsigned int P3DCurveCtrl::BestHeight = <API key>; class P3DCurveCtrlDialog : public wxDialog { public : P3DCurveCtrlDialog (); P3DCurveCtrlDialog (wxWindow *Parent, const <API key> &Curve, wxWindowID Id = wxID_ANY, const wxString &Caption = wxT("Curve editor"), const wxPoint &Pos = wxDefaultPosition, const wxSize &Size = wxDefaultSize, long Style = wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU); bool Create (wxWindow *Parent, const <API key> &Curve, wxWindowID Id = wxID_ANY, const wxString &Caption = wxT("Curve editor"), const wxPoint &Pos = wxDefaultPosition, const wxSize &Size = wxDefaultSize, long Style = wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU); const <API key> &GetCurve () const; void SetDefaultCurve (const <API key> &Curve); void <API key> (wxCommandEvent &Event); void <API key> (wxCommandEvent &Event); private : void CreateControls (const <API key> &Curve); P3DCurveCtrl *CurveCtrl; DECLARE_CLASS(P3DCurveCtrlDialog) DECLARE_EVENT_TABLE() }; BEGIN_EVENT_TABLE(P3DCurveCtrlDialog,wxDialog) EVT_BUTTON(P3D_ID_EXPORT,P3DCurveCtrlDialog::<API key>) EVT_BUTTON(P3D_ID_IMPORT,P3DCurveCtrlDialog::<API key>) END_EVENT_TABLE() IMPLEMENT_CLASS(P3DCurveCtrlDialog,wxDialog) P3DCurveCtrlDialog::P3DCurveCtrlDialog () { } P3DCurveCtrlDialog::P3DCurveCtrlDialog (wxWindow *Parent, const <API key> &Curve, wxWindowID Id, const wxString &Caption, const wxPoint &Pos, const wxSize &Size, long Style) { Create(Parent,Curve,Id,Caption,Pos,Size,Style); } bool P3DCurveCtrlDialog::Create (wxWindow *Parent, const <API key> &Curve, wxWindowID Id, const wxString &Caption, const wxPoint &Pos, const wxSize &Size, long Style) { if (!wxDialog::Create(Parent,Id,Caption,Pos,Size,Style)) { return(false); } CreateControls(Curve); return(true); } void P3DCurveCtrlDialog::CreateControls (const <API key> &Curve) { wxBoxSizer *TopSizer = new wxBoxSizer(wxVERTICAL); #if wxCHECK_VERSION(2,6,0) CurveCtrl = new P3DCurveCtrl(this,wxID_ANY,Curve,wxDefaultPosition,wxSize(320,160),<API key>); CurveCtrl->SetMinSize(wxSize(320,160)); #else CurveCtrl = new P3DCurveCtrl(this,wxID_ANY,Curve,wxDefaultPosition,wxSize(320,160)); #endif CurveCtrl->EnableEditDialog(false); TopSizer->Add(CurveCtrl,1,wxGROW | wxALL,5); wxBoxSizer *ButtonSizer = new wxBoxSizer(wxHORIZONTAL); ButtonSizer->Add(new wxButton(this,P3D_ID_IMPORT,wxT("Import...")),0,wxALL,5); ButtonSizer->Add(new wxButton(this,P3D_ID_EXPORT,wxT("Export...")),0,wxALL,5); ButtonSizer->Add(new wxButton(this,wxID_OK,wxT("Ok")),0,wxALL,5); ButtonSizer->Add(new wxButton(this,wxID_CANCEL,wxT("Cancel")),0,wxALL,5); ((wxButton*)FindWindow(wxID_OK))->SetDefault(); TopSizer->Add(ButtonSizer,0,wxALIGN_RIGHT | wxALL,5); SetSizer(TopSizer); TopSizer->Fit(this); TopSizer->SetSizeHints(this); } const <API key> &P3DCurveCtrlDialog::GetCurve () const { return(CurveCtrl->GetCurve()); } void P3DCurveCtrlDialog::SetDefaultCurve (const <API key> &Curve) { CurveCtrl->SetDefaultCurve(Curve); } void P3DCurveCtrlDialog::<API key> (wxCommandEvent &Event) { wxString FileNameStr; FileNameStr = ::wxFileSelector(wxT("File name"),wxT(""),wxT(""),wxT(".ngc"),wxT("*.ngc"),wxFD_SAVE | <API key>); if (!FileNameStr.empty()) { wxFileName FileName(FileNameStr); if (!FileName.HasExt()) { FileName.SetExt(wxT("ngc")); } try { <API key> TargetStream; TargetStream.Open(FileName.GetFullPath().mb_str()); <API key>(&TargetStream,&CurveCtrl->GetCurve()); TargetStream.Close(); } catch (P3DException &Exception) { ::wxMessageBox(wxString(Exception.GetMessage(),wxConvUTF8), wxT("Error"),wxOK | wxICON_ERROR); } } } void P3DCurveCtrlDialog::<API key>(wxCommandEvent &Event) { wxString FileName; FileName = ::wxFileSelector(wxT("File name"),wxT(""),wxT(""),wxT(".ngc"),wxT("*.ngc"),wxFD_OPEN | <API key>); if (!FileName.empty()) { try { <API key> Spline; <API key> SourceStream; SourceStream.Open(FileName.mb_str()); <API key>(&Spline,&SourceStream); SourceStream.Close(); CurveCtrl->SetCurve(Spline); } catch (P3DException &Exception) { ::wxMessageBox(wxString(Exception.GetMessage(),wxConvUTF8), wxT("Error"),wxOK | wxICON_ERROR); } } } BEGIN_EVENT_TABLE(P3DCurveCtrl,wxWindow) EVT_PAINT(P3DCurveCtrl::OnPaint) EVT_LEFT_DOWN(P3DCurveCtrl::OnLeftDown) EVT_LEFT_DCLICK(P3DCurveCtrl::OnLeftDblClick) EVT_LEFT_UP(P3DCurveCtrl::OnLeftUp) EVT_MOTION(P3DCurveCtrl::OnMouseMove) EVT_RIGHT_DOWN(P3DCurveCtrl::OnRightDown) EVT_LEAVE_WINDOW(P3DCurveCtrl::OnLeaveWindow) <API key>(P3DCurveCtrl::onEraseBackground) EVT_MENU(<API key>,P3DCurveCtrl::OnResetToDefault) END_EVENT_TABLE() <API key>(P3DCurveCtrl,wxControl) P3DCurveCtrl::P3DCurveCtrl () { Init(); } P3DCurveCtrl::P3DCurveCtrl (wxWindow *parent, wxWindowID id, const <API key> &curve, const wxPoint &pos, const wxSize &size, long style, const wxValidator &validator, const wxString &name) { Init(); Create(parent,id,curve,pos,size,style,validator,name); } bool P3DCurveCtrl::Create (wxWindow *parent, wxWindowID id, const <API key> &curve, const wxPoint &pos, const wxSize &size, long style, const wxValidator &validator, const wxString &name) { #if defined(__WXGTK__) { if (!wxControl::Create(parent,id,pos,size,style | wxSUNKEN_BORDER,validator,name)) { return(false); } } #elif defined(__WXMSW__) { if (!wxControl::Create(parent,id,pos,size,style | wxSTATIC_BORDER,validator,name)) { return(false); } } #else { if (!wxControl::Create(parent,id,pos,size,style,validator,name)) { return(false); } } #endif SetBackgroundColour(wxSystemSettings::GetColour(<API key>)); if (size == wxDefaultSize) { SetSize(DoGetBestSize()); } /* SetBestFittingSize(size); */ this->curve = curve; return(true); } void P3DCurveCtrl::SetCurve (const <API key> &Curve) { this->curve = Curve; Refresh(); } void P3DCurveCtrl::SetDefaultCurve (const <API key> &Curve) { HaveDefaultCurve = true; DefaultCurve.CopyFrom(Curve); } void P3DCurveCtrl::Init () { cp_to_move = -1; HaveDefaultCurve = false; DialogEnabled = true; } wxSize P3DCurveCtrl::DoGetBestSize () const { return(wxSize(BestWidth,BestHeight)); } void P3DCurveCtrl::OnLeftDown (wxMouseEvent &event) { CalcTransform(GetClientSize()); mx = event.GetX(); my = event.GetY(); cp_to_move = GetCPByMousePos(mx,my); } void P3DCurveCtrl::OnLeftDblClick (wxMouseEvent &event) { if (DialogEnabled) { P3DCurveCtrlDialog Dialog(GetParent(),curve); if (HaveDefaultCurve) { Dialog.SetDefaultCurve(DefaultCurve); } Dialog.Centre(); if (Dialog.ShowModal() == wxID_OK) { curve = Dialog.GetCurve(); Refresh(); SendChangedEvent(); } } } void P3DCurveCtrl::OnRightDown (wxMouseEvent &event) { CalcTransform(GetClientSize()); mx = event.GetX(); my = event.GetY(); cp_to_move = GetCPByMousePos(mx,my); if ((cp_to_move != -1) && (cp_to_move != 0) && (cp_to_move != (curve.GetCPCount() - 1))) { curve.DelCP(cp_to_move); cp_to_move = -1; Refresh(); SendChangedEvent(); } else { if (HaveDefaultCurve) { wxMenu PopupMenu; PopupMenu.Append(<API key>,wxT("Reset to default")); this->PopupMenu(&PopupMenu,event.GetPosition()); } } } void P3DCurveCtrl::OnLeftUp (wxMouseEvent &event) { cp_to_move = -1; } void P3DCurveCtrl::OnLeaveWindow (wxMouseEvent &event) { cp_to_move = -1; } void P3DCurveCtrl::OnMouseMove (wxMouseEvent &event) { float cp_x; float cp_y; int dx,dy; CalcTransform(GetClientSize()); if (cp_to_move != -1) { dx = event.GetX() - mx; dy = event.GetY() - my; mx += dx; my += dy; if (cp_to_move == 0) { cp_x = 0.0f; } else if (cp_to_move == (curve.GetCPCount() - 1)) { cp_x = 1.0f; } else { cp_x = RegionToCurveX(mx); } cp_y = RegionToCurveY(my); if (cp_y < 0.0f) { cp_y = 0.0f; } else if (cp_y > 1.0f) { cp_y = 1.0f; } curve.UpdateCP(cp_x,cp_y,cp_to_move); Refresh(); SendChangedEvent(); } else { if (event.LeftIsDown()) { cp_x = RegionToCurveX(mx); cp_y = RegionToCurveY(my); if ((cp_x < 0.0f) || (cp_x > 1.0f) || (cp_y < 0.0f) || (cp_y > 1.0f)) { return; } int cy = CurveToRegionY(curve.GetValue(cp_x)); dy = cy - my; if ((dy > -3) && (dy < 3)) { curve.AddCP(cp_x,cp_y); dx = event.GetX() - mx; dy = event.GetY() - my; mx += dx; my += dy; cp_to_move = GetCPByMousePos(mx,my); Refresh(); SendChangedEvent(); } } } } int P3DCurveCtrl::GetCPByMousePos (int x, int y) const { float cp_x; float cp_y; int dx; int dy; for (unsigned int i = 0; i < curve.GetCPCount(); i++) { cp_x = curve.GetCPX(i); cp_y = curve.GetCPY(i); dx = x - CurveToRegionX(cp_x); dy = y - CurveToRegionY(cp_y); if ((dx > -3) && (dx < 3) && (dy > -3) && (dy < 3)) { return(i); } } return(-1); } #define <API key> (5) void P3DCurveCtrl::OnPaint (wxPaintEvent &event) { wxPaintDC dc(this); int reg_width,reg_height; float xr; float x0,y0,x1,y1; wxSize client_size = dc.GetSize(); CalcTransform(client_size); reg_width = client_size.GetX() - <API key> * 2; reg_height = client_size.GetY() - <API key> * 2; dc.SetPen(*(wxThePenList->FindOrCreatePen(wxSystemSettings::GetColour(<API key>),1,wxSOLID))); dc.SetBrush(*(wxTheBrushList->FindOrCreateBrush(wxSystemSettings::GetColour(<API key>),wxSOLID))); dc.DrawRectangle(0,0,client_size.GetX(),<API key>); dc.DrawRectangle(0,client_size.GetY() - <API key>,client_size.GetX(),<API key>); dc.DrawRectangle(0,<API key>,<API key>,reg_height); dc.DrawRectangle(client_size.GetX() - <API key>,<API key>,<API key>,reg_height); /* clear region */ dc.SetPen(*wxBLACK_PEN); dc.SetBrush(*wxBLACK_BRUSH); dc.DrawRectangle(<API key>, <API key>, reg_width, reg_height); /* draw curve */ dc.SetPen(*wxWHITE_PEN); y0 = curve.GetValue(0.0f); y0 = CurveToRegionY(y0); for (unsigned int x = 1; x <= reg_width; x++) { y1 = curve.GetValue((float)x / reg_width); y1 = CurveToRegionY(y1); dc.DrawLine(x - 1 + <API key>,(int)y0,x + <API key>,(int)y1); y0 = y1; } dc.SetPen(*wxRED_PEN); dc.SetBrush(*wxRED_BRUSH); /* draw CP's */ for (unsigned int i = 0; i < curve.GetCPCount(); i++) { x0 = curve.GetCPX(i); y0 = curve.GetCPY(i); dc.DrawCircle(CurveToRegionX(x0),CurveToRegionY(y0),3); } } void P3DCurveCtrl::onEraseBackground (wxEraseEvent &event) { } void P3DCurveCtrl::OnResetToDefault (wxCommandEvent &event) { if (HaveDefaultCurve) { curve.CopyFrom(DefaultCurve); Refresh(); SendChangedEvent(); } } /* from curve to window */ void P3DCurveCtrl::CalcTransform (const wxSize &client_size) { int reg_width,reg_height; reg_width = client_size.GetX() - <API key> * 2; reg_height = client_size.GetY() - <API key> * 2; ta_x = (float)reg_width; tb_x = <API key>; ta_y = -((float)reg_height); tb_y = (float)(reg_height + <API key> - 1); } float P3DCurveCtrl::RegionToCurveX (int x) const { return(((float)x - tb_x) / ta_x); } float P3DCurveCtrl::RegionToCurveY (int y) const { return(((float)y - tb_y) / ta_y); } int P3DCurveCtrl::CurveToRegionX (float x) const { return((int)(x * ta_x + tb_x)); } int P3DCurveCtrl::CurveToRegionY (float y) const { return((int)(y * ta_y + tb_y)); } void P3DCurveCtrl::SendChangedEvent (void) { P3DCurveCtrlEvent event(<API key>,GetId(),&curve); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); } DEFINE_EVENT_TYPE(<API key>) <API key>(P3DCurveCtrlEvent,wxCommandEvent)
#include "arcPolyPatch.H" #include "<API key>.H" namespace Foam { <API key>(arcPolyPatch, 0); <API key>(polyPatch, arcPolyPatch, word); <API key>(polyPatch, arcPolyPatch, dictionary); } // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * // Foam::arcPolyPatch::arcPolyPatch ( const word& name, const label size, const label start, const label index, const polyBoundaryMesh& bm, const word& patchType ) : polyPatch(name, size, start, index, bm, patchType), dict_(), name(), u_Range(0, 0), v_Range(0,0), dyCode(dict_) {} Foam::arcPolyPatch::arcPolyPatch ( const word& name, const dictionary& dict, const label index, const polyBoundaryMesh& bm, const word& patchType ) : polyPatch(name, dict, index, bm, patchType), dict_(dict), name(dict.lookup("name")), u_Range(dict.lookup("u_Range")), v_Range(dict.lookup("v_Range")), dyCode(dict) {} Foam::arcPolyPatch::arcPolyPatch ( const arcPolyPatch& pp, const polyBoundaryMesh& bm ) : polyPatch(pp, bm), dict_(pp.dict()), name(), u_Range(0, 0), v_Range(0,0), dyCode(dict_) {} Foam::arcPolyPatch::arcPolyPatch ( const arcPolyPatch& pp, const polyBoundaryMesh& bm, const label index, const label newSize, const label newStart ) : polyPatch(pp, bm, index, newSize, newStart), dict_(pp.dict()), name(), u_Range(0, 0), v_Range(0,0), dyCode(dict_) { dict_.add("nFaces", newSize, true); dict_.add("startFace", newStart, true); } Foam::arcPolyPatch::arcPolyPatch ( const arcPolyPatch& pp, const polyBoundaryMesh& bm, const label index, const labelUList& mapAddressing, const label newStart ) : polyPatch(pp, bm, index, mapAddressing, newStart), dict_(pp.dict()), name(), u_Range(0, 0), v_Range(0,0), dyCode(dict_) { dict_.add("nFaces", mapAddressing.size(), true); dict_.add("startFace", newStart, true); } void Foam::arcPolyPatch::write(Ostream& os) const { dict_.write(os,false); }
using System.Text; using DSharpPlus.Entities; using DSharpPlus.Interactivity; using TheGodfather.Modules.Games.Extensions; namespace TheGodfather.Modules.Games.Common; public sealed class TicTacToeGame : BaseBoardGame { public TicTacToeGame(<API key> interactivity, DiscordChannel channel, DiscordUser p1, DiscordUser p2, TimeSpan? movetime = null) : base(interactivity, channel, p1, p2, 3, 3, movetime) { } protected override async Task AdvanceAsync(LocalizationService lcs) { int field = 0; bool player1plays = this.move % 2 == 0; InteractivityResult<DiscordMessage> mctx = await this.Interactivity.WaitForMessageAsync( xm => { if (xm.Channel.Id != this.Channel.Id) return false; if (player1plays && xm.Author.Id != this.player1.Id) return false; if (!player1plays && xm.Author.Id != this.player2.Id) return false; if (!int.TryParse(xm.Content, out field)) return false; return field is > 0 and < 10; }, this.moveTime ); if (mctx.TimedOut) { this.IsTimeoutReached = true; this.Winner = player1plays ? this.player2 : this.player1; return; } if (this.TryPlayMove(player1plays ? 1 : 2, (field - 1) / this.SizeX, (field - 1) % this.SizeY)) { this.move++; if (!this.deleteErrored) try { await mctx.Result.DeleteAsync(); } catch { await this.Channel.InformFailureAsync(lcs.GetString(this.Channel.GuildId, TranslationKey.cmd_err_game_perms)); this.deleteErrored = true; } } else { await this.Channel.InformFailureAsync(lcs.GetString(this.Channel.GuildId, TranslationKey.cmd_err_game_move(field))); } } protected override bool IsGameOver() { for (int i = 0; i < this.SizeX; i++) { if (this.board[i, 0] != 0 && this.board[i, 0] == this.board[i, 1] && this.board[i, 1] == this.board[i, 2]) return true; if (this.board[0, i] != 0 && this.board[0, i] == this.board[1, i] && this.board[1, i] == this.board[2, i]) return true; } if (this.board[0, 0] != 0 && this.board[0, 0] == this.board[1, 1] && this.board[1, 1] == this.board[2, 2]) return true; if (this.board[0, 2] != 0 && this.board[0, 2] == this.board[1, 1] && this.board[1, 1] == this.board[2, 0]) return true; return false; } protected override Task<DiscordMessage> UpdateBoardAsync(LocalizationService lcs) { var sb = new StringBuilder(); for (int i = 0; i < this.SizeX; i++) { for (int j = 0; j < this.SizeY; j++) switch (this.board[i, j]) { case 0: sb.Append(Emojis.BoardSquare); break; case 1: sb.Append(Emojis.X); break; case 2: sb.Append(Emojis.O); break; } sb.AppendLine(); } sb.AppendLine() .Append(lcs.GetString(this.Channel.GuildId, TranslationKey.str_game_move)) .AppendLine(this.move % 2 == 0 ? this.player1.Mention : this.player2.Mention); return this.msgHandle.ModifyOrResendAsync(this.Channel, new DiscordEmbedBuilder { Description = sb.ToString() }.Build()); } }
CodeInject ======= [![Build status](https: CodeInject - Code Inject and Runtime Intelligence CInject (or CodeInject) allows code injection into any managed assembly without disassembling and recompiling it. It eases the inevitable task of injecting any code in single or multiple methods in one or many assemblies to intercept code for almost any purpose. When using CInject, you do not require any knowledge of the target application. You can create your own injectors very easily and inject them in any target assembly/executable. An example is provided with this application. If you have an existing code which has no logging or no diagnostics, inject it with CInject and execute it as usual to generate log files. **Helps you analyze any code and ease your reverse engineering exercise.** Provides **runtime intelligence** such as - Values of arguments to the called function - Object life time of a method / variables called within the method - Allows customization of logging or diagnostics - Allows extension of injectors to tailor your own solution as the need be - Measure the method execution time to check performance Build your own **plugins** using CInject information * CInject supports building your own plugins * The plugin receives information from the application such as * Target assembly & method * Injector assembly & method * Processing details, results with timestamp * Exceptions and errors * Customized Plugin menu in CInject application ## FAQ **Can I use it in my organization?** Yes, you can use it. **I have some doubts, how can I ask?** Please use the 'Issues' tab **Do I get to know the value of arguments at runtime?** Yes, that's the actual beauty of CInject. It lets you know the value of arguments to a function at runtime. **Can I inject static methods?** Yes. In the current release, you can call create a class that implements ICInject interface and call static methods. In later release, provision for calling static methods directly will be added as well. **What version of .NET is this built on? Can I use it with other versions?** CInject is built on .NET 4.0 runtime. To use it with other versions, rebuild the Injectors, or create your own using .NET 2.0, 3.0, 3.5. **How do I distribute my plugin?** You have many alternatives to distribute the plugin - Host the source code on CodePlex and link it with this project - Provide the source code, and get it hosted on this webpage & www.ganshani.com website - Host the source code on GitHub, or other repository websites and provide us the link for promotion purposes **How about code injection at compile time?** If you are looking at dynamic injection based on the code you have written in an assembly, it would be worth while trying [dI.Hook](https://github.com/punitganshani/dI.Hook) You can define the injections (or called hooks) in configuration file and invoke them wherever required.
package org.fhcrc.matsen.startree; import cern.jet.math.Functions; import dr.evolution.alignment.Alignment; import net.sf.samtools.SAMFileHeader; import net.sf.samtools.SAMRecord; import net.sf.samtools.SAMSequenceRecord; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; public class <API key> { private final byte[] reference = "ACCGTACTA".getBytes(); private final String referenceName = "Ref1"; private final String queryName = "QSEQ1"; private SAMFileHeader header; @Before public void setUp() throws Exception { header = new SAMFileHeader(); header.addSequence(new SAMSequenceRecord(referenceName, reference.length)); } @Test public void <API key>() throws Exception { SAMRecord record = new SAMRecord(this.header); record.setReadBases("TCCGTTAGTC".getBytes()); record.setReadName(queryName); record.setCigarString("1S3M1I4M1S"); record.setReferenceIndex(0); record.setReferenceName(this.referenceName); record.setAlignmentStart(2); assertEquals(referenceName, record.getReferenceName()); Alignment result = SAMBEASTUtils.alignmentOfRecord(record, this.reference); assertEquals(2, result.getTaxonCount()); assertEquals(new String(reference), result.<API key>(0)); assertEquals("-CCGTAGT-", result.<API key>(1)); assertEquals(referenceName, result.getTaxonId(0)); assertEquals(queryName, result.getTaxonId(1)); } }
<?php namespace Statusengine\Generators; use Statusengine\Exceptions\<API key>; use Statusengine\ValueObjects\<API key>; class ExternalCommandArgs { private $supportedCommands = [ '<API key>', '<API key>', '<API key>', '<API key>', '<API key>', '<API key>', '<API key>', '<API key>', '<API key>', '<API key>', '<API key>', 'DEL_HOST_DOWNTIME', 'DEL_SVC_DOWNTIME' ]; /** * @var <API key> */ private $<API key>; /** * ExternalCommandArgs constructor. * @param <API key> $<API key> */ public function __construct(<API key> $<API key>) { $this-><API key> = $<API key>; $this->isCommandSupported(); } /** * @return bool * @throws <API key> */ public function isCommandSupported() { if (!in_array($this-><API key>->getCommandName(), $this->supportedCommands)) { throw new <API key>(sprintf( 'External command %s is not supported', $this-><API key>->getCommandName() )); } return true; } /** * @return string|array */ public function getCommand() { switch ($this-><API key>->getCommandName()) { case '<API key>': return sprintf( '[%s] <API key>;%s;%s;%s', time(), $this-><API key>->getHostname(), $this-><API key>->getState(), $this-><API key>->getOutput() ); break; case '<API key>': return sprintf( '[%s] <API key>;%s;%s;%s;%s', time(), $this-><API key>->getHostname(), $this-><API key>-><API key>(), $this-><API key>->getState(), $this-><API key>->getOutput() ); break; case '<API key>': $options = 0; if ($this-><API key>->isBroadcast()) { $options = 1; } if ($this-><API key>->isForce()) { $options += 2; } return sprintf( '[%s] <API key>;%s;%s;%s;%s', time(), $this-><API key>->getHostname(), $options, $this-><API key>->getAuthorName(), $this-><API key>->getComment() ); break; case '<API key>': $options = 0; if ($this-><API key>->isBroadcast()) { $options = 1; } if ($this-><API key>->isForce()) { $options += 2; } return sprintf( '[%s] <API key>;%s;%s;%s;%s;%s', time(), $this-><API key>->getHostname(), $this-><API key>-><API key>(), $options, $this-><API key>->getAuthorName(), $this-><API key>->getComment() ); break; case '<API key>': $sticky = 0; if ($this-><API key>->isSticky()) { $sticky = 2; } return sprintf( '[%s] <API key>;%s;%s;%s;%s;%s;%s', time(), $this-><API key>->getHostname(), $sticky, 1, // notify 1, // persistent, $this-><API key>->getAuthorName(), $this-><API key>->getComment() ); break; case '<API key>': $sticky = 0; if ($this-><API key>->isSticky()) { $sticky = 2; } return sprintf( '[%s] <API key>;%s;%s;%s;%s;%s;%s;%s', time(), $this-><API key>->getHostname(), $this-><API key>-><API key>(), $sticky, 1, // notify 1, // persistent, $this-><API key>->getAuthorName(), $this-><API key>->getComment() ); break; case '<API key>': $commands = []; //<host_name>;<start_time>;<end_time>;<fixed>;<trigger_id>;<duration>;<author>;<comment> $commands[] = sprintf( '[%s] <API key>;%s;%s;%s;%s;%s;%s;%s;%s', time(), $this-><API key>->getHostname(), $this-><API key>->getStart(), $this-><API key>->getEnd(), 1, //Fixed 0, //trigger_id $this-><API key>->getDuration(), $this-><API key>->getAuthorName(), $this-><API key>->getComment() ); $commands[] = sprintf( '[%s] <API key>;%s;%s;%s;%s;%s;%s;%s;%s', time(), $this-><API key>->getHostname(), $this-><API key>->getStart(), $this-><API key>->getEnd(), 1, //Fixed 0, //trigger_id $this-><API key>->getDuration(), $this-><API key>->getAuthorName(), $this-><API key>->getComment() ); return $commands; break; case '<API key>': case '<API key>': case '<API key>': return sprintf( '[%s] %s;%s;%s;%s;%s;%s;%s;%s;%s', time(), $this-><API key>->getCommandName(), $this-><API key>->getHostname(), $this-><API key>->getStart(), $this-><API key>->getEnd(), 1, //Fixed 0, //trigger_id $this-><API key>->getDuration(), $this-><API key>->getAuthorName(), $this-><API key>->getComment() ); break; case '<API key>': return sprintf( '[%s] <API key>;%s;%s;%s;%s;%s;%s;%s;%s;%s', time(), $this-><API key>->getHostname(), $this-><API key>-><API key>(), $this-><API key>->getStart(), $this-><API key>->getEnd(), 1, //Fixed 0, //trigger_id $this-><API key>->getDuration(), $this-><API key>->getAuthorName(), $this-><API key>->getComment() ); break; case 'DEL_HOST_DOWNTIME': case 'DEL_SVC_DOWNTIME': return sprintf( '[%s] %s;%s', time(), $this-><API key>->getCommandName(), $this-><API key>->getDowntimeId() ); default: return ''; } } }
package tomoBay.model.services.reScanErrorsService; import java.util.List; import tomoBay.model.sql.queries.QueryInvoker; import tomoBay.model.sql.queries.QueryInvoker.QueryType; /** * This class encapsulates all the interactions that this class has with the database. * @author Jan P.C. Hanson * */ public class <API key> { /** * default ctor */ public <API key>() {super();} /** * returns a list of items from the database that contain errors in the 'notes' field of the * ebay_items table. * @return List<String[]> where each */ public List<String[]> <API key>() {return QueryInvoker.execute(QueryType.<API key>, new String[] {});} /** * updates the database with corrected information, as provided in the ItemSpecifics passed * in as an argument. * @param item the ItemSpecifics containing the corrected information */ public void <API key>(ItemSpecifics item) { String[] correctedInfo= { item.get("Brand"), item.get("<API key>"), "",//blank note indicates no error. item.getID() }; QueryInvoker.execute(QueryType.UPDATE_ITEM_ERROR,correctedInfo); } }
<html> <head> <title>Patient Form Query</title> </head> <body> <form action="/formWithName.php" method="get"> <p>Patient name:<br> <input type="text" name="name"></p> <p>Home town:<br> <input type="text" name="town"></p> <p>Resolution:<br> <select name="dpi"> <option value="300" default="default">300</option> <option value="200">200</option> <option value="150">150</option> <option value="100">100</option> </select></p> <p><button type="submit">Show me the patient's form</button></p> </form> </body>
using System.Collections.Generic; using Common.Testing; using FluentAssertions; using Game.Data; using Ploeh.AutoFixture; using Xunit.Extensions; namespace Testing.PlayerTests { public class AchievementListTest { [Theory, AutoNSubstituteData] public void <API key>(Fixture fixture, AchievementList achievements) { new List<AchievementTier> { AchievementTier.Bronze, AchievementTier.Gold, AchievementTier.Silver, AchievementTier.Silver, AchievementTier.Silver, AchievementTier.Gold }.ForEach(tier => achievements.Add(new Achievement {Tier = tier})); var groups = achievements.<API key>(); groups.Keys.Should().HaveCount(3); groups[AchievementTier.Gold].Should().Be(2); groups[AchievementTier.Silver].Should().Be(3); groups[AchievementTier.Bronze].Should().Be(1); } [Theory, AutoNSubstituteData] public void <API key>(Fixture fixture, AchievementList achievements) { achievements.AddMany(() => new Achievement { Tier = AchievementTier.Gold }, 257); var groups = achievements.<API key>(); groups.Keys.Should().HaveCount(1); groups[AchievementTier.Gold].Should().Be(255); } } }
using System; using System.Collections.Generic; using System.Text.RegularExpressions; using System.Windows.Forms; using ConEmu.WinForms; using GitCommands; using GitCommands.Logging; using GitCommands.Utils; using GitExtUtils; namespace GitUI.UserControls { <summary> An output control which inserts a fully-functional console emulator window. </summary> public class <API key> : <API key> { private int _nLastExitCode; private Panel _panel; private ConEmuControl _terminal; public <API key>() { InitializeComponent(); } private void InitializeComponent() { Controls.Add(_panel = new Panel { Dock = DockStyle.Fill, BorderStyle = BorderStyle.Fixed3D }); } public override int ExitCode => _nLastExitCode; public override bool <API key> => true; public static bool <API key> => EnvUtils.RunningOnWindows(); public override void <API key>(string text) { _terminal.RunningSession?.<API key>(text); } public override void KillProcess() { KillProcess(_terminal); } private static void KillProcess(ConEmuControl terminal) { terminal.RunningSession?.SendControlCAsync(); } public override void Reset() { ConEmuControl oldTerminal = _terminal; _terminal = new ConEmuControl { Dock = DockStyle.Fill, IsStatusbarVisible = false }; if (oldTerminal != null) { KillProcess(oldTerminal); _panel.Controls.Remove(oldTerminal); oldTerminal.Dispose(); } _panel.Controls.Add(_terminal); } protected override void Dispose(bool disposing) { if (disposing) { _terminal?.Dispose(); } base.Dispose(disposing); } public override void StartProcess(string command, string arguments, string workDir, Dictionary<string, string> envVariables) { ProcessOperation operation = CommandLog.LogProcessStart(command, arguments, workDir); try { var commandLine = new ArgumentBuilder { command.Quote(), arguments }.ToString(); var outputProcessor = new <API key>(commandLine.Length, FireDataReceived); var startInfo = new ConEmuStartInfo { <API key> = commandLine, <API key> = true, <API key> = <API key>.<API key>, <API key> = outputProcessor.<API key>, StartupDirectory = workDir }; foreach (var (name, value) in envVariables) { startInfo.SetEnv(name, value); } startInfo.<API key> = (_, args) => { _nLastExitCode = args.ExitCode; operation.LogProcessEnd(_nLastExitCode); outputProcessor.Flush(); FireProcessExited(); }; startInfo.<API key> = (sender, _) => { if (sender == _terminal.RunningSession) { FireTerminated(); } }; _terminal.Start(startInfo, ThreadHelper.JoinableTaskFactory, AppSettings.ConEmuStyle.ValueOrDefault, AppSettings.ConEmuFontSize.ValueOrDefault); } catch (Exception ex) { operation.LogProcessEnd(ex); throw; } } } public class <API key> { private readonly Action<TextEventArgs> _fireDataReceived; private int <API key>; private string _lineChunk; public <API key>(int <API key>, Action<TextEventArgs> fireDataReceived) { _fireDataReceived = fireDataReceived; <API key> = <API key>; <API key> += Environment.NewLine.Length; // for \n after the command line } private string <API key>(string outputChunk) { if (<API key> > 0) { if (<API key> >= outputChunk.Length) { <API key> -= outputChunk.Length; return null; } string rest = outputChunk.Substring(<API key>); <API key> = 0; return rest; } return outputChunk; } public void <API key>(object sender, <API key> args) { var text = args.GetText(GitModule.SystemEncoding); string filtered = <API key>(text); if (filtered != null) { SendAsLines(filtered); } } private void SendAsLines(string output) { if (_lineChunk != null) { output = _lineChunk + output; _lineChunk = null; } string[] outputLines = Regex.Split(output, @"(?<=[\n\r])"); int lineCount = outputLines.Length; if (string.IsNullOrEmpty(outputLines[lineCount - 1])) { lineCount } for (int i = 0; i < lineCount; i++) { string outputLine = outputLines[i]; bool isTheLastLine = i == lineCount - 1; if (isTheLastLine) { bool isLineCompleted = outputLine.Length > 0 && ((outputLine[outputLine.Length - 1] == '\n') || outputLine[outputLine.Length - 1] == '\r'); if (!isLineCompleted) { _lineChunk = outputLine; break; } } _fireDataReceived(new TextEventArgs(outputLine)); } } public void Flush() { if (_lineChunk != null) { _fireDataReceived(new TextEventArgs(_lineChunk)); _lineChunk = null; } } } }
package com.trickl.graph.planar; import com.trickl.graph.edges.DirectedEdge; import java.util.Set; /** * A planar graph that associates a face class instance to every logical * face. * @author tgee * @param <V> Vertex type * @param <E> Edge type * @param <F> Face type */ public interface PlanarFaceGraph <V, E, F> extends PlanarGraph<V, E> { public Set<F> faceSet(); public F getFace(V source, V target); public FaceFactory<V, F> getFaceFactory(); public DirectedEdge<V> getAdjacentEdge(F face); public boolean replaceFace(F oldFace, F newFace); }
# BlenderRenderFarm This is a forray into creating a blender render farm using a bit of Java and any spare computers that are on the same network. The goal of this project is to make setting up a blender render farm simple for simple projects. The network render option in Blender can be a bit complicated to get setup correctly and tends to be flaky at times. The .blend file must have almost everything configured and setup as this program does not allow for a lot of customization of the parameters passed to Blender. Config file has instructions on how to set things up.
package engineer.maxbarraclough.txtshuffle.gui; import engineer.maxbarraclough.txtshuffle.backend.TxtShuffle; import engineer.maxbarraclough.txtshuffle.backend.VectorConversions; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStream; import java.math.BigInteger; import java.nio.file.Files; /** * Not thread-safe, so be sure to only access from the GUI thread * @author mb */ public final class Model { public static final Model INSTANCE = new Model(); // // // TODO this should probably live in the controller instead private Model() { } private String[] encodedDataSet; public void setEncodedDataSet(final String[] ds) { this.encodedDataSet = ds; } public String[] getEncodedDataSet() { return this.encodedDataSet; } private String[] dataSet; public void setDataSet(final String[] ds) { this.dataSet = ds; } public String[] getDataSet() { return this.dataSet; } private byte[] messageBytes; public void setMessageBytes(final byte[] m) { this.messageBytes = m; } public byte[] getMessageBytes() { return this.messageBytes; } private File file; public void setFile(final File f) { this.file = f; } public File getFile() { return this.file; } // /** // * TODO make this no-allocate // * // * Side-effect: shuffles this.dataSet to encode the message // * (according to this.messageBytes) // * // * @throws engineer.maxbarraclough.txtshuffle.backend.TxtShuffle.<API key> // */ // private String[] doEncode() throws TxtShuffle.<API key> // // TODO move this logic to the backend package // final BigInteger bi = new BigInteger(this.messageBytes); // // TODO handle <API key> // final int[] compact = // VectorConversions.intToCompactVector( // this.dataSet.length, // // TODO can we make a no-allocate version of this method? // final int[] isvFromCompact = VectorConversions.compactToIsv(compact); // java.util.Arrays.sort(this.dataSet); // dataSet is now sorted // // TODO mutative version of this method, avoiding new array // final String[] ret = TxtShuffle.applyIsvToStringArr(this.dataSet, isvFromCompact); // that method is 'pure' // // dataSet is now ordered to encode our number // return ret; // // TODO make non-static and use the existing members // public void encodeIntoFile(final byte[] messageBytes, final String[] dataSet, final File outputFile) // throws TxtShuffle.<API key>, IOException // TODO proper exception handling // n.b. THIS METHOD IS UNTESTED AND MAY WELL BE BROKEN! // // do we really want to ignore the returned value???? // this.doEncode(); // already done // // this.dataSet is now scrambled to encode this.messageBytes // // TODO check the file doesn't already exist // try (FileWriter fw = new FileWriter(outputFile)) { // if (this.dataSet.length > 0) { // fw.write(dataSet[0]); // //final String lineSep = System.getProperty("line.separator"); // final String lineSep = System.lineSeparator(); // for (int i = 1; i != this.dataSet.length; ++i) { // fw.write(lineSep); // final String s = this.dataSet[i]; // fw.write(s); // } // no catch or finally, we just want the with-resource feature }
using System; using Server.Targeting; using Server.Network; namespace Server.Spells.Fifth { public class ParalyzeSpell : MagerySpell { private static SpellInfo m_Info = new SpellInfo( "Paralyze", "An Ex Por", 218, 9012, Reagent.Garlic, Reagent.MandrakeRoot, Reagent.SpidersSilk ); public override SpellCircle Circle { get { return SpellCircle.Fifth; } } public ParalyzeSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info ) { } public override void OnCast() { Caster.Target = new InternalTarget( this ); } public void Target( Mobile m ) { if ( !Caster.CanSee( m ) ) { Caster.<API key>( 500237 ); // Target can not be seen. } else if ( m.Frozen || m.Paralyzed ) { Caster.<API key>( 1061923 ); // The target is already frozen. } else if ( CheckHSequence( m ) ) { SpellHelper.Turn( Caster, m ); SpellHelper.CheckReflect( (int) this.Circle, Caster, ref m ); int secs = (int) ( ( GetDamageSkill( Caster ) / 10 ) - ( GetResistSkill( m ) / 10 ) ); if ( !m.Player ) secs *= 3; if ( secs < 0 ) secs = 0; double duration = secs; m.Paralyze( TimeSpan.FromSeconds( duration ) ); m.PlaySound( 0x204 ); m.FixedEffect( 0x376A, 6, 1 ); } FinishSequence(); } public class InternalTarget : Target { private ParalyzeSpell m_Owner; public InternalTarget( ParalyzeSpell owner ) : base( 12, false, TargetFlags.Harmful ) { m_Owner = owner; } protected override void OnTarget( Mobile from, object o ) { if ( o is Mobile ) m_Owner.Target( (Mobile) o ); } protected override void OnTargetFinish( Mobile from ) { m_Owner.FinishSequence(); } } } }
/* see the COPYING file in the top-level directory.*/ #include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> #include"ut.h" #ifdef HAVE_OPENMP #include <omp.h> #endif /* HAVE_OPENMP */ #ifdef HAVE_MUPARSER #include "muParser.h" #endif void ut_math_functions (char ***pfcts, int *pfctqty); int <API key> (char *string); int ut_math_eval (char *inexpr, int varqty, char **vars, double *vals, double *pres) { #ifdef HAVE_OPENMP if (omp_get_thread_num() != 0) { printf ("ut_math_eval should not be multithreaded.\n"); abort (); } #endif /* HAVE_OPENMP */ #ifdef HAVE_MUPARSER using namespace mu; int i, j, status; char **newvars = ut_alloc_1d_pchar (varqty); char *expr = ut_alloc_1d_char (strlen (inexpr) * 10); int *length = ut_alloc_1d_int (varqty); int id, *ids = ut_alloc_1d_int (varqty); expr = strcpy (expr, inexpr); if (strstr (expr, "[") || strstr (expr, "]") || strstr (expr, "{") || strstr (expr, "}")) abort (); // will be processing the variables from the longest to the shortest, // in case a short variable is contained in a larger variable, which // would cause erroneous substitution in expr for (i = 0; i < varqty; i++) length[i] = strlen (vars[i]); <API key> (length, varqty, ids); for (i = 0; i < varqty; i++) { id = ids[i]; // testing if it's all letters status = 0; for (j = 0; j < varqty; j++) if (!isalpha (vars[id][j])) { status = -1; break; } // if not, we need to replace it, as muparser won't take it if (!status) { ut_string_random (8, id, newvars + id); ut_string_fnrs (expr, vars[id], newvars[id], INT_MAX); } else ut_string_string (vars[id], newvars + id); } status = 0; try { Parser p; for (i = 0; i < varqty; i++) p.DefineVar (newvars[i], vals + i); // p.DefineFun("MySqr", MySqr); p.SetExpr (expr); *pres = p.Eval (); } catch (Parser::exception_type & e) { status = -1; } ut_free_2d_char (&newvars, varqty); ut_free_1d_char (&expr); ut_free_1d_int (&length); ut_free_1d_int (&ids); return status; #else (void) inexpr; (void) varqty; (void) vars; (void) vals; (void) pres; ut_print_message (2, 0, "compiled without muparser\n"); abort (); #endif /* HAVE_MUPARSER */ } int ut_math_evals (char *inexpr, int varqty, char **vars, double **vals, int evalqty, double *res) { #ifdef HAVE_MUPARSER using namespace mu; int i, j, status; char **newvars = ut_alloc_1d_pchar (varqty); char *expr = ut_alloc_1d_char (strlen (inexpr) * 10); int *length = ut_alloc_1d_int (varqty); int id, *ids = ut_alloc_1d_int (varqty); expr = strcpy (expr, inexpr); if (strstr (expr, "[") || strstr (expr, "]") || strstr (expr, "{") || strstr (expr, "}")) abort (); // will be processing the variables from the longest to the shortest, // in case a short variable is contained in a larger variable, which // would cause erroneous substitution in expr for (i = 0; i < varqty; i++) length[i] = strlen (vars[i]); <API key> (length, varqty, ids); for (i = 0; i < varqty; i++) { id = ids[i]; // testing if it's all letters status = 0; for (j = 0; j < varqty; j++) if (!isalpha (vars[id][j])) { status = -1; break; } // if not, we need to replace it, as muparser won't take it if (!status) { ut_string_random (8, id, newvars + id); ut_string_fnrs (expr, vars[id], newvars[id], INT_MAX); } else ut_string_string (vars[i], newvars + i); } status = 0; try { Parser p; for (i = 0; i < varqty; i++) p.DefineVar (newvars[i], vals[i]); // p.DefineFun("MySqr", MySqr); p.SetExpr (expr); p.Eval (res, evalqty); } catch (Parser::exception_type & e) { status = -1; } ut_free_2d_char (&newvars, varqty); ut_free_1d_char (&expr); ut_free_1d_int (&length); ut_free_1d_int (&ids); return status; #else (void) inexpr; (void) varqty; (void) vars; (void) vals; (void) evalqty; (void) res; ut_print_message (2, 0, "compiled without muparser\n"); abort (); #endif /* HAVE_MUPARSER */ } int ut_math_eval_int (char *expr, int varqty, char **vars, double *vals, int *pres) { int status; double res; status = ut_math_eval (expr, varqty, vars, vals, &res); if (!status) (*pres) = ut_num_d2ri (res); return status; } int ut_math_vars (char *expr, char ***pvars, int *pvarqty) { int i, j, stringqty, fctqty, var, found, bracket, length; char *tmp = NULL; char **strings = NULL; char **fcts = NULL; ut_math_functions (&fcts, &fctqty); ut_string_string (expr, &tmp); var = 0; bracket = 0; length = 0; for (i = 0; i < (int) strlen (tmp); i++) { // if not recording a variable if (var == 0) { // if character, start recording if (isalpha (tmp[i]) || tmp[i] == '_') { var = 1; length = 1; } // otherwise, erasing else tmp[i] = ' '; } // if in the process of recording a variable else { // is a character - continue recording if (isalpha (tmp[i]) || tmp[i] == '_') length++; // is a digit - continue recording else if (isdigit (tmp[i])) length++; // is an opening bracket - mark as such and continue recording else if (tmp[i] == '(') { char *tmp2 = ut_alloc_1d_char (length + 1); tmp2 = strncpy (tmp2, tmp + i - length, length); if (<API key> (tmp2)) { // erasing function and opening bracket for (j = i - length; j <= i; j++) tmp[j] = ' '; var = 0; tmp[i] = ' '; } else bracket++; ut_free_1d_char (&tmp2); } // is a closing bracket - testing else if (tmp[i] == ')') { // closes a bracket - recording if (bracket > 0) bracket // does not close a bracket - erasing else tmp[i] = ' '; } // is in a bracket - continue else if (bracket > 0) {} // erasing else { tmp[i] = ' '; var = 0; } } } <API key> (tmp, &strings, &stringqty); (*pvarqty) = 0; (*pvars) = NULL; for (i = 0; i < stringqty; i++) if (!<API key> (strings[i])) { found = 0; for (j = 0; j < *pvarqty; j++) if (!strcmp ((*pvars)[j], strings[i])) { found = 1; break; } if (found) continue; (*pvars) = <API key> (*pvars, ++(*pvarqty), strlen (strings[i]) + 1); strcpy ((*pvars)[*pvarqty - 1], strings[i]); } ut_free_1d_char (&tmp); ut_free_2d_char (&strings, stringqty); ut_free_2d_char (&fcts, fctqty); return 0; } void ut_math_functions (char ***pfcts, int *pfctqty) { int id = 0; (*pfctqty) = 25; (*pfcts) = ut_alloc_1d_pchar (*pfctqty); ut_string_string ("sin", (*pfcts) + id++); ut_string_string ("cos", (*pfcts) + id++); ut_string_string ("tan", (*pfcts) + id++); ut_string_string ("asin", (*pfcts) + id++); ut_string_string ("acos", (*pfcts) + id++); ut_string_string ("atan", (*pfcts) + id++); ut_string_string ("sinh", (*pfcts) + id++); ut_string_string ("cosh", (*pfcts) + id++); ut_string_string ("tanh", (*pfcts) + id++); ut_string_string ("asinh", (*pfcts) + id++); ut_string_string ("acosh", (*pfcts) + id++); ut_string_string ("atanh", (*pfcts) + id++); ut_string_string ("log2", (*pfcts) + id++); ut_string_string ("log10", (*pfcts) + id++); ut_string_string ("log", (*pfcts) + id++); ut_string_string ("ln", (*pfcts) + id++); ut_string_string ("exp", (*pfcts) + id++); ut_string_string ("sqrt", (*pfcts) + id++); ut_string_string ("sign", (*pfcts) + id++); ut_string_string ("rint", (*pfcts) + id++); ut_string_string ("abs", (*pfcts) + id++); ut_string_string ("min", (*pfcts) + id++); ut_string_string ("max", (*pfcts) + id++); ut_string_string ("sum", (*pfcts) + id++); ut_string_string ("avg", (*pfcts) + id++); return; } int <API key> (char *string) { int i, fctqty, status; char **fcts = NULL; ut_math_functions (&fcts, &fctqty); status = 0; for (i = 0; i < fctqty; i++) if (!strcmp (string, fcts[i])) { status = 1; break; } ut_free_2d_char (&fcts, fctqty); return status; } int <API key> (char *string) { if (strstr (string, "&&") || strstr (string, "||") || strstr (string, "<") || strstr (string, ">") || strstr (string, "=") || strstr (string, "?")) return 1; else return 0; }
<?php // Moodle is free software: you can redistribute it and/or modify // (at your option) any later version. // Moodle is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the require_once("$CFG->libdir/xmlize.php"); require_once($CFG->dirroot.'/lib/uploadlib.php'); // Development: turn on all debug messages and strict warnings. // define('DEBUG_WORDTABLE', E_ALL | E_STRICT);. define('DEBUG_WORDTABLE', DEBUG_NONE); // The wordtable plugin just extends XML import/export. require_once("$CFG->dirroot/question/format/xml/format.php"); // Include XSLT processor functions. require_once(__DIR__ . "/xslemulatexslt.inc"); class qformat_wordtable extends qformat_xml { /** @var string export template with Word-compatible CSS style definitions */ private $wordfiletemplate = 'wordfiletemplate.html'; /** @var string Stylesheet to export Moodle Question XML into XHTML */ private $<API key> = 'mqxml2wordpass1.xsl'; /** @var string Stylesheet to export XHTML into Word-compatible XHTML */ private $<API key> = 'mqxml2wordpass2.xsl'; /** @var string Stylesheet to import XHTML into Word-compatible XHTML */ private $<API key> = 'wordml2xhtmlpass1.xsl'; /** @var string Stylesheet to process XHTML during import */ private $<API key> = 'wordml2xhtmlpass2.xsl'; /** @var string Stylesheet to import XHTML into question XML */ private $<API key> = 'xhtml2mqxml.xsl'; /** @var string Stylesheet to clean up text inside Cloze questions */ /** * Define required MIME-Type * * @return string MIME-Type */ public function mime_type() { return 'application/vnd.<API key>.wordprocessingml.document'; } // IMPORT FUNCTIONS START HERE. /** * Perform required pre-processing, i.e. convert Word file into XML * * Extract the WordProcessingML XML files from the .docx file, and use a sequence of XSLT * steps to convert it into Moodle Question XML * * @return bool Success */ public function importpreprocess() { global $CFG, $USER, $COURSE, $OUTPUT; $realfilename = ""; $filename = ""; // Handle question imports in Lesson module by using mform, not the question/format.php qformat_default class. if (property_exists('qformat_default', 'realfilename')) { $realfilename = $this->realfilename; } else { global $mform; $realfilename = $mform->get_new_filename('questionfile'); } if (property_exists('qformat_default', 'filename')) { $filename = $this->filename; } else { global $mform; $filename = "{$CFG->tempdir}/questionimport/{$realfilename}"; } // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": Word file = $realfilename; path = '$filename'", DEBUG_WORDTABLE); $basefilename = basename($filename); $baserealfilename = basename($realfilename); // Give XSLT as much memory as possible, to enable larger Word files to be imported. raise_memory_limit(MEMORY_HUGE); // Check that the file is in Word 2010 format, not HTML, XML, or Word 2003. if ((substr($realfilename, -3, 3) == 'doc')) { echo $OUTPUT->notification(get_string('docnotsupported', 'qformat_wordtable', $baserealfilename)); return false; } else if ((substr($realfilename, -3, 3) == 'xml')) { echo $OUTPUT->notification(get_string('xmlnotsupported', 'qformat_wordtable', $baserealfilename)); return false; } else if ((stripos($realfilename, 'htm'))) { echo $OUTPUT->notification(get_string('htmlnotsupported', 'qformat_wordtable', $baserealfilename)); return false; } else if ((stripos(file_get_contents($filename, 0, null, 0, 100), 'html'))) { echo $OUTPUT->notification(get_string('htmldocnotsupported', 'qformat_wordtable', $baserealfilename)); return false; } // Stylesheet to convert WordML into initial XHTML format. $stylesheet = __DIR__ . "/" . $this-><API key>; // Check that XSLT is installed, and the XSLT stylesheet is present. if (!class_exists('XSLTProcessor') || !function_exists('xslt_create')) { echo $OUTPUT->notification(get_string('xsltunavailable', 'qformat_wordtable')); return false; } else if (!file_exists($stylesheet)) { // Stylesheet to transform WordML into XHTML doesn't exist. echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', $stylesheet)); return false; } // Set common parameters for all XSLT transformations. Note that the XSLT processor doesn't support $arguments. $parameters = array( 'course_id' => $COURSE->id, 'course_name' => $COURSE->fullname, 'author_name' => $USER->firstname . ' ' . $USER->lastname, 'moodle_country' => $USER->country, 'moodle_language' => current_language(), '<API key>' => (right_to_left()) ? 'rtl' : 'ltr', 'moodle_release' => $CFG->release, 'moodle_url' => $CFG->wwwroot . "/", 'moodle_username' => $USER->username, 'pluginname' => 'qformat_wordtable', 'debug_flag' => DEBUG_WORDTABLE ); // Pre-XSLT conversion preparation merge the document XML and image content from the .docx Word file. // Initialise an XML string to use as a wrapper around all the XML files. $xmldeclaration = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'; $wordmldata = $xmldeclaration . "\n<pass1Container>\n"; $imagestring = ""; // Open the Word 2010 Zip-formatted file and extract the WordProcessingML XML files. $zfh = zip_open($filename); if (is_resource($zfh)) { $zipentry = zip_read($zfh); while ($zipentry) { if (zip_entry_open($zfh, $zipentry, "r")) { $zefilename = zip_entry_name($zipentry); $zefilesize = zip_entry_filesize($zipentry); // Look for internal images. if (strpos($zefilename, "media")) { // @<API key> $imageformat = substr($zefilename, strrpos($zefilename, ".") + 1); $imagedata = zip_entry_read($zipentry, $zefilesize); $imagename = basename($zefilename); $imagesuffix = strtolower(substr(strrchr($zefilename, "."), 1)); // Suffixes gif, png, jpg and jpeg handled OK, but bmp and other non-Internet formats are not. $imagemimetype = "image/"; if ($imagesuffix == 'gif' or $imagesuffix == 'png') { $imagemimetype .= $imagesuffix; } if ($imagesuffix == 'jpg' or $imagesuffix == 'jpeg') { $imagemimetype .= "jpeg"; } if ($imagesuffix == 'wmf') { $imagemimetype .= "x-wmf"; } // Handle recognised Internet formats only. if ($imagemimetype != '') { $imagestring .= '<file filename="media/' . $imagename . '" mime-type="' . $imagemimetype . '">'; $imagestring .= base64_encode($imagedata) . "</file>\n"; } } else { // Look for required XML files. // Read and wrap XML files, remove the XML declaration, and add them to the XML string. $xmlfiledata = preg_replace('/<\?xml version="1.0" ([^>]*)>/', "", zip_entry_read($zipentry, $zefilesize)); switch ($zefilename) { case "word/document.xml": $wordmldata .= "<wordmlContainer>" . $xmlfiledata . "</wordmlContainer>\n"; break; case "docProps/core.xml": $wordmldata .= "<dublinCore>" . $xmlfiledata . "</dublinCore>\n"; break; case "docProps/custom.xml": $wordmldata .= "<customProps>" . $xmlfiledata . "</customProps>\n"; break; case "word/styles.xml": $wordmldata .= "<styleMap>" . $xmlfiledata . "</styleMap>\n"; break; case "word/_rels/document.xml.rels": $wordmldata .= "<documentLinks>" . $xmlfiledata . "</documentLinks>\n"; break; case "word/footnotes.xml": $wordmldata .= "<footnotesContainer>" . $xmlfiledata . "</footnotesContainer>\n"; break; case "word/_rels/footnotes.xml.rels" . $xmlfiledata . "</footnoteLinks>\n"; break; /* @<API key> case "word/_rels/settings.xml.rels": $wordmldata .= "<settingsLinks>" . $xmlfiledata . "</settingsLinks>\n"; break; default: debugging(__FUNCTION__ . ":" . __LINE__ . ": Ignore '$zefilename'", DEBUG_WORDTABLE); @<API key> */ } } } else { // Can't read the file from the Word .docx file. echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', $basefilename)); zip_close($zfh); return false; } // Get the next file in the Zip package. $zipentry = zip_read($zfh); } // End while loop. zip_close($zfh); } else { // Can't open the Word .docx file for reading. echo $OUTPUT->notification(get_string('cannotopentempfile', 'qformat_wordtable', $basefilename)); $this->debug_unlink($filename); return false; } // Add Base64 images section and close the merged XML file. $wordmldata .= "<imagesContainer>\n" . $imagestring . "</imagesContainer>\n" . "</pass1Container>"; // Pass 1 - convert WordML into linear XHTML. // Create a temporary file to store the merged WordML XML content to transform. if (!($tempwordmlfilename = tempnam($CFG->dataroot . '/temp/', "w2q-"))) { echo $OUTPUT->notification(get_string('cannotopentempfile', 'qformat_wordtable', basename($tempwordmlfilename))); return false; } // Write the WordML contents to be imported. if (($nbytes = file_put_contents($tempwordmlfilename, $wordmldata)) == 0) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', basename($tempwordmlfilename))); return false; } // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": Run Pass 1 with stylesheet '$stylesheet'", DEBUG_WORDTABLE); $xsltproc = xslt_create(); if (!($xsltoutput = xslt_process($xsltproc, $tempwordmlfilename, $stylesheet, null, null, $parameters))) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', $stylesheet)); $this->debug_unlink($tempwordmlfilename); return false; } $this->debug_unlink($tempwordmlfilename); $xhtmlfragment = str_replace("\n", "", substr($xsltoutput, 0, 200)); // Strip out superfluous namespace declarations on paragraph elements, which Moodle 2.7/2.8 on Windows seems to throw in. $xsltoutput = str_replace('<p xmlns="http: $xsltoutput = str_replace(' xmlns=""', '', $xsltoutput); // Write output of Pass 1 to a temporary file, for use in Pass 2. $tempxhtmlfilename = $CFG->dataroot . '/temp/' . basename($tempwordmlfilename, ".tmp") . ".if1"; if (($nbytes = file_put_contents($tempxhtmlfilename, $xsltoutput )) == 0) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', basename($tempxhtmlfilename))); return false; } // Pass 2 - tidy up linear XHTML a bit. // Prepare for Import Pass 2 XSLT transformation. $stylesheet = __DIR__ . "/" . $this-><API key>; // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": Run XSLT Pass 2 with stylesheet '$stylesheet'", DEBUG_WORDTABLE); if (!($xsltoutput = xslt_process($xsltproc, $tempxhtmlfilename, $stylesheet, null, null, $parameters))) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', $stylesheet)); $this->debug_unlink($tempxhtmlfilename); return false; } $this->debug_unlink($tempxhtmlfilename); $xhtmlfragment = str_replace("\n", "", substr($xsltoutput, 600, 500)); // Write the Pass 2 XHTML output to a temporary file. $tempxhtmlfilename = $CFG->dataroot . '/temp/' . basename($tempwordmlfilename, ".tmp") . ".if2"; $xhtmlfragment = "<pass3Container>\n" . $xsltoutput . $this->get_text_labels() . "\n</pass3Container>"; if (($nbytes = file_put_contents($tempxhtmlfilename, $xhtmlfragment)) == 0) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', basename($tempxhtmlfilename))); return false; } // Pass 3 - convert XHTML into Moodle Question XML. // Prepare for Import Pass 3 XSLT transformation. $stylesheet = __DIR__ . "/" . $this-><API key>; // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": Run Pass 3 with stylesheet '$stylesheet'", DEBUG_WORDTABLE); if (!($xsltoutput = xslt_process($xsltproc, $tempxhtmlfilename, $stylesheet, null, null, $parameters))) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', $stylesheet)); $this->debug_unlink($tempxhtmlfilename); return false; } $this->debug_unlink($tempxhtmlfilename); // Strip out most MathML element and attributes for compatibility with MathJax. $xsltoutput = str_replace('<mml:', '<', $xsltoutput); $xsltoutput = str_replace('</mml:', '</', $xsltoutput); $xsltoutput = str_replace(' mathvariant="normal"', '', $xsltoutput); $xsltoutput = str_replace(' xmlns:mml="http: $mmltextdirection = (right_to_left()) ? ' dir="rtl"' : ''; $xsltoutput = str_replace('<math>', "<math xmlns=\"http: $tempmqxmlfilename = $CFG->dataroot . '/temp/' . basename($tempwordmlfilename, ".tmp") . ".xml"; // Write the intermediate (Pass 1) XHTML contents to be transformed in Pass 2, including the HTML template too. if (($nbytes = file_put_contents($tempmqxmlfilename, $xsltoutput)) == 0) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', basename($tempmqxmlfilename))); return false; } // Keep the original Word file for debugging if developer debugging enabled. if (debugging(null, DEBUG_WORDTABLE)) { $copiedinputfile = $CFG->dataroot . '/temp/' . basename($tempwordmlfilename, ".tmp") . ".docx"; copy($filename, $copiedinputfile); } // Now over-write the original Word file with the XML file, so that default XML file handling will work. if (($fp = fopen($filename, "wb"))) { if (($nbytes = fwrite($fp, $xsltoutput)) == 0) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', $basefilename)); return false; } fclose($fp); } return true; } // End importpreprocess function. // EXPORT FUNCTIONS START HERE. /** * Use a .doc file extension when exporting, so that Word is used to open the file * @return string file extension */ public function <API key>() { return ".doc"; } /** * Convert the Moodle Question XML into Word-compatible XHTML format * just prior to the file being saved * * Use an XSLT script to do the job, as it is much easier to implement this, * and Moodle sites are guaranteed to have an XSLT processor available (I think). * * @param string $content Question XML text * @return string Word-compatible XHTML text */ public function presave_process( $content ) { // Override method to allow us convert to Word-compatible XHTML format. global $CFG, $USER, $COURSE; global $OUTPUT; // @<API key> debugging(__FUNCTION__ . '($content = "' . str_replace("\n", "", substr($content, 80, 500)) . ' ...")', DEBUG_WORDTABLE); // Stylesheet to convert Moodle Question XML into Word-compatible XHTML format. $stylesheet = __DIR__ . "/" . $this-><API key>; // XHTML template for Word file CSS styles formatting. $<API key> = __DIR__ . "/" . $this->wordfiletemplate; // Check that XSLT is installed, and the XSLT stylesheet and XHTML template are present. if (!class_exists('XSLTProcessor') || !function_exists('xslt_create')) { echo $OUTPUT->notification(get_string('xsltunavailable', 'qformat_wordtable')); return false; } else if (!file_exists($stylesheet)) { // Stylesheet to transform Moodle Question XML into Word doesn't exist. echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', $stylesheet)); return false; } // Check that there is some content to convert into Word. if (!strlen($content)) { echo $OUTPUT->notification(get_string('noquestions', 'qformat_wordtable')); return false; } // Create a temporary file to store the XML content to transform. if (!($tempxmlfilename = tempnam($CFG->dataroot . '/temp/', "q2w-"))) { echo $OUTPUT->notification(get_string('cannotopentempfile', 'qformat_wordtable', basename($tempxmlfilename))); return false; } // Maximise memory available so that very large question banks can be exported. raise_memory_limit(MEMORY_HUGE); $cleancontent = $this->clean_all_questions($content); // Write the XML contents to be transformed, and also include labels data, to avoid having to use document() inside XSLT. $xmloutput = "<container>\n<quiz>" . $cleancontent . "</quiz>\n" . $this->get_text_labels() . "\n</container>"; if (($nbytes = file_put_contents($tempxmlfilename, $xmloutput)) == 0) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', basename($tempxmlfilename))); return false; } // Set parameters for XSLT transformation. Note that we cannot use $arguments though. $parameters = array ( 'course_id' => $COURSE->id, 'course_name' => $COURSE->fullname, 'author_name' => $USER->firstname . ' ' . $USER->lastname, 'moodle_country' => $USER->country, 'moodle_language' => current_language(), '<API key>' => (right_to_left()) ? 'rtl' : 'ltr', 'moodle_release' => $CFG->release, 'moodle_url' => $CFG->wwwroot . "/", 'moodle_username' => $USER->username, 'debug_flag' => debugging('', DEBUG_WORDTABLE), '<API key>' => get_string('<API key>', 'qformat_wordtable', $this-><API key>) ); // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": Run Pass 1 with stylesheet '$stylesheet'", DEBUG_WORDTABLE); $xsltproc = xslt_create(); if (!($xsltoutput = xslt_process($xsltproc, $tempxmlfilename, $stylesheet, null, null, $parameters))) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', $stylesheet)); $this->debug_unlink($tempxmlfilename); return false; } $this->debug_unlink($tempxmlfilename); $xhtmlfragment = str_replace("\n", "", substr($xsltoutput, 0, 200)); $tempxhtmlfilename = $CFG->dataroot . '/temp/' . basename($tempxmlfilename, ".tmp") . ".xhtm"; // Write the intermediate (Pass 1) XHTML contents to be transformed in Pass 2, this time including the HTML template too. $xmloutput = "<container>\n" . $xsltoutput . "\n<htmltemplate>\n" . file_get_contents($<API key>) . "\n</htmltemplate>\n" . $this->get_text_labels() . "\n</container>"; if (($nbytes = file_put_contents($tempxhtmlfilename, $xmloutput)) == 0) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', basename($tempxhtmlfilename))); return false; } // Prepare for Pass 2 XSLT transformation. $stylesheet = __DIR__ . "/" . $this-><API key>; // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": Run Pass 2 with stylesheet '$stylesheet'", DEBUG_WORDTABLE); if (!($xsltoutput = xslt_process($xsltproc, $tempxhtmlfilename, $stylesheet, null, null, $parameters))) { echo $OUTPUT->notification(get_string('<API key>', 'qformat_wordtable', $stylesheet)); $this->debug_unlink($tempxhtmlfilename); return false; } $xhtmlfragment = str_replace("\n", "", substr($xsltoutput, 400, 100)); $this->debug_unlink($tempxhtmlfilename); // Strip out any redundant namespace attributes, which XSLT on Windows seems to add. $xsltoutput = str_replace(' xmlns=""', '', $xsltoutput); $xsltoutput = str_replace(' xmlns="http: // Unescape double minuses if they were substituted during CDATA content clean-up. $xsltoutput = str_replace("WordTableMinusMinus", "--", $xsltoutput); // Strip off the XML declaration, if present, since Word doesn't like it. if (strncasecmp($xsltoutput, "<?xml ", 5) == 0) { $content = substr($xsltoutput, strpos($xsltoutput, "\n")); } else { $content = $xsltoutput; } return $content; } // End presave_process function. /** * Delete temporary files if debugging disabled * * @param string $filename Filename to delete * @return void */ private function debug_unlink($filename) { if (!debugging(null, DEBUG_WORDTABLE)) { unlink($filename); } } /** * Get all the text strings needed to fill in the Word file labels in a language-dependent way * * A string containing XML data, populated from the language folders, is returned * * @return string */ private function get_text_labels() { global $CFG; // @<API key> debugging(__FUNCTION__ . "()", DEBUG_WORDTABLE); // Release-independent list of all strings required in the XSLT stylesheets for labels etc. $textstrings = array( 'grades' => array('item'), 'moodle' => array('categoryname', 'no', 'yes', 'feedback', 'format', 'formathtml', 'formatmarkdown', 'formatplain', 'formattext', 'grade', 'question', 'tags'), 'qformat_wordtable' => array('cloze_instructions', '<API key>', '<API key>', '<API key>', '<API key>', 'essay_instructions', '<API key>', '<API key>', '<API key>', '<API key>', '<API key>'), 'qtype_description' => array('pluginnamesummary'), 'qtype_essay' => array('allowattachments', 'graderinfo', 'formateditor', '<API key>', 'formatmonospaced', 'formatplain', 'pluginnamesummary', 'responsefieldlines', 'responseformat'), 'qtype_match' => array('<API key>'), 'qtype_multichoice' => array('answernumbering', 'choiceno', 'correctfeedback', 'incorrectfeedback', '<API key>', 'pluginnamesummary', 'shuffleanswers'), 'qtype_shortanswer' => array('casesensitive', 'filloutoneanswer'), 'qtype_truefalse' => array('false', 'true'), 'question' => array('category', 'clearwrongparts', 'defaultmark', 'generalfeedback', 'hintn', '<API key>', 'questioncategory', 'shownumpartscorrect', '<API key>'), 'quiz' => array('answer', 'answers', 'casesensitive', 'correct', 'correctanswers', 'defaultgrade', 'incorrect', 'shuffle') ); // Append Moodle release-specific text strings, to avoid PHP errors when absent strings are requested. if ($CFG->release < '2.0') { $textstrings['quiz'][] = 'choice'; $textstrings['quiz'][] = 'penaltyfactor'; } else if ($CFG->release >= '2.5') { // Add support for new Essay fields added in Moodle 2.5. $textstrings['qtype_essay'][] = 'responsetemplate'; $textstrings['qtype_essay'][] = '<API key>'; $textstrings['qtype_match'][] = '<API key>'; // Add support for new generic question fields added in Moodle 2.5. $textstrings['question'][] = 'addmorechoiceblanks'; $textstrings['question'][] = '<API key>'; $textstrings['question'][] = 'hintnoptions'; $textstrings['question'][] = '<API key>'; $textstrings['question'][] = '<API key>'; } if ($CFG->release >= '2.7') { // Add support for new Essay fields added in Moodle 2.7. $textstrings['qtype_essay'][] = 'attachmentsrequired'; $textstrings['qtype_essay'][] = 'responserequired'; $textstrings['qtype_essay'][] = 'responseisrequired'; $textstrings['qtype_essay'][] = 'responsenotrequired'; } // Add All-or-Nothing MCQ question type strings if present. if (is_object(question_bank::get_qtype('multichoiceset', false))) { $textstrings['<API key>'] = array('pluginnamesummary', '<API key>'); } // Add 'Select missing word' question type (not the Missing Word format), added to core in 2.9, downloadable before then. if (is_object(question_bank::get_qtype('gapselect', false))) { $textstrings['qtype_gapselect'] = array('pluginnamesummary', 'group', 'shuffle'); } // Add 'Drag and drop onto image' question type, added to core in 2.9, downloadable before then. if (is_object(question_bank::get_qtype('ddimageortext', false))) { $textstrings['qtype_ddimageortext'] = array('pluginnamesummary', 'bgimage', 'dropbackground', 'dropzoneheader', 'draggableitem', 'infinite', 'label', 'shuffleimages', 'xleft', 'ytop'); } // Add 'Drag and drop markers' question type, added to core in 2.9, downloadable before then. if (is_object(question_bank::get_qtype('ddmarker', false))) { $textstrings['qtype_ddmarker'] = array('pluginnamesummary', 'bgimage', 'clearwrongparts', 'coords', 'dropbackground', 'dropzoneheader', 'infinite', 'marker', 'noofdrags', 'shape_circle', 'shape_polygon', 'shape_rectangle', 'shape', 'showmisplaced', '<API key>'); } // Add 'Drag and drop into text' question type, added to core in 2.9, downloadable before then. if (is_object(question_bank::get_qtype('ddwtos', false))) { $textstrings['qtype_ddwtos'] = array('pluginnamesummary', 'infinite'); } $expout = "<moodlelabels>\n"; foreach ($textstrings as $typegroup => $grouparray) { foreach ($grouparray as $stringid) { $namestring = $typegroup . '_' . $stringid; $expout .= '<data name="' . $namestring . '"><value>' . get_string($stringid, $typegroup) . "</value></data>\n"; } } $expout .= "</moodlelabels>"; $expout = str_replace("<br>", "<br/>", $expout); return $expout; } /** * Clean HTML markup inside question text element content * * A string containing Moodle Question XML with clean HTML inside the text elements is returned. * * @param string $questionxmlstring Question XML text * @return string */ private function clean_all_questions($questionxmlstring) { // @<API key> $xhtmlfragment = str_replace("\n", "", substr($questionxmlstring, 0, 200)); // @<API key> debugging(__FUNCTION__ . "(questionxmlstring = $xhtmlfragment ...)", DEBUG_WORDTABLE); // Start assembling the cleaned output string, starting with empty. $cleanquestionxml = ""; // Split the string into questions in order to check the text fields for clean HTML. $foundquestions = preg_match_all('~(.*?)<question type="([^"]*)"[^>]*>(.*?)</question>~s', $questionxmlstring, $questionmatches, PREG_SET_ORDER); $numquestions = count($questionmatches); if ($foundquestions === false or $foundquestions == 0) { return $questionxmlstring; } // Split the questions into text strings to check the HTML. for ($i = 0; $i < $numquestions; $i++) { $qtype = $questionmatches[$i][2]; $questioncontent = $questionmatches[$i][3]; // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": Processing question " . $i", DEBUG_WORDTABLE); // Split the question into chunks at CDATA boundaries, using ungreedy (?) and matching across newlines (s modifier). $foundcdatasections = preg_match_all('~(.*?)<\!\[CDATA\[(.*?)\]\]>~s', $questioncontent, $cdatamatches, PREG_SET_ORDER); // @<API key> // Has the question been imported using WordTable? If so, assume it is clean and don't process it. // $<API key> = preg_match('~ImportFromWordTable~', $questioncontent); // if ($<API key> and $<API key> != 0) { // debugging(__FUNCTION__ . ":" . __LINE__ . ": Skip cleaning previously imported question " . $i + 1, DEBUG_WORDTABLE); // $cleanquestionxml .= $questionmatches[$i][0]; // @<API key> if ($foundcdatasections === false) { // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": Cannot decompose CDATA sections in " . $i + 1, DEBUG_WORDTABLE); $cleanquestionxml .= $questionmatches[$i][0]; } else if ($foundcdatasections != 0) { $numcdatasections = count($cdatamatches); // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": " . $numcdatasections . " CDATA sections found", DEBUG_WORDTABLE); // Found CDATA sections, so first add the question start tag and then process the body. $cleanquestionxml .= '<question type="' . $qtype . '">'; // Process content of each CDATA section to clean the HTML. for ($j = 0; $j < $numcdatasections; $j++) { $cleancdatacontent = $this->clean_html_text($cdatamatches[$j][2]); // Add all the text before the first CDATA start boundary, and the cleaned string, to the output string. $cleanquestionxml .= $cdatamatches[$j][1] . '<![CDATA[' . $cleancdatacontent . ']]>'; } // End CDATA section loop. // Add the text after the last CDATA section closing delimiter. $textafterlastcdata = substr($questionmatches[$i][0], strrpos($questionmatches[$i][0], "]]>") + 3); $cleanquestionxml .= $textafterlastcdata; } else { // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": No CDATA in Q." . $i + 1, DEBUG_WORDTABLE); $cleanquestionxml .= $questionmatches[$i][0]; } } // End question element loop. // @<API key> debugging(__FUNCTION__ . "() -> " . str_replace("\n", "", substr($cleanquestionxml, 0, 200)), DEBUG_WORDTABLE); return $cleanquestionxml; } /** * Clean HTML content * * A string containing clean XHTML is returned * * @param string $cdatastring XHTML from inside a CDATA_SECTION in a question text element * @return string */ private function clean_html_text($cdatastring) { // @<API key> debugging(__FUNCTION__ . "(cdatastring = \"" . substr($cdatastring, 0, 100) . "\")", DEBUG_WORDTABLE); // Escape double minuses, which cause XSLT processing to fail. $cdatastring = str_replace("--", "WordTableMinusMinus", $cdatastring); // Wrap the string in a HTML wrapper, load it into a new DOM document as HTML, but save as XML. $doc = new DOMDocument(); <API key>(true); $doc->loadHTML('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><html><body>' . $cdatastring . '</body></html>'); $doc-><API key>('html')->item(0)->setAttribute('xmlns', 'http: $xml = $doc->saveXML(); // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": xml: |" . substr(str_replace("\n", "", $xml), 250) . "|", DEBUG_WORDTABLE); $bodystart = stripos($xml, '<body>') + strlen('<body>'); $bodylength = strripos($xml, '</body>') - $bodystart; // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": bodystart = {$bodystart}, bodylength = {$bodylength}", DEBUG_WORDTABLE); if ($bodystart || $bodylength) { $cleanxhtml = substr($xml, $bodystart, $bodylength); // @<API key> debugging(__FUNCTION__ . ":" . __LINE__ . ": clean xhtml: |" . $cleanxhtml . "|", DEBUG_WORDTABLE); } else { // @<API key> debugging(__FUNCTION__ . "() -> Invalid XHTML, using original cdata string", DEBUG_WORDTABLE); $cleanxhtml = $cdatastring; } // Fix up filenames after @@PLUGINFILE@@ to replace URL-encoded characters with ordinary characters. $<API key> = preg_match_all('~(.*?)<img src="@@PLUGINFILE@@/([^"]*)(.*)~s', $cleanxhtml, $pluginfilematches, PREG_SET_ORDER); $nummatches = count($pluginfilematches); if ($<API key> and $<API key> != 0) { $urldecodedstring = ""; // Process the <API key> filename so that it matches the name in the file element. for ($i = 0; $i < $nummatches; $i++) { // Decode the filename and add the surrounding text. $decodedfilename = urldecode($pluginfilematches[$i][2]); $urldecodedstring .= $pluginfilematches[$i][1] . '<img src="@@PLUGINFILE@@/' . $decodedfilename . $pluginfilematches[$i][3]; } $cleanxhtml = $urldecodedstring; } // Strip soft hyphens (0xAD, or decimal 173). $cleanxhtml = preg_replace('/\xad/u', '', $cleanxhtml); // @<API key> debugging(__FUNCTION__ . "() -> |" . str_replace("\n", "", substr($cleanxhtml, 0, 100)) . " ...|", DEBUG_WORDTABLE); return $cleanxhtml; } }
#include "objcommon.h" #ifdef GCC #line __LINE__ "assoc" #endif /* new assoc object from two arrays (zip) */ assoc_t* assoc_new (const array_t* const a, const array_t* const b) { pfn(); assoc_t* assoc = alloc(assoc_t, 1); assoc->idx = -1; assoc->data = NULL; if ( a && b ) { size_t idx = size_t_min(array_length(a), array_length(b)); assoc->data = alloc(pair_t*, idx + 1); for (size_t i = 0; i < idx; i++) { object_t **car = array_get_ref(a, i, NULL), **cdr = array_get_ref(b, i, NULL); assoc_append_boa(assoc, *car, *cdr); } } report_ctor(assoc); return assoc; } #define <API key>(type) \ assoc_t* assoc_new_from_ ## type ## _lit (const type * const, const type * const, const size_t, const objtype_t, const objtype_t); \ assoc_t* assoc_new_from_ ## type ## _lit (const type * const ct_cars, const type * const ct_cdrs, const size_t len, const objtype_t car_to, const objtype_t cdr_to) {\ pfn(); assoc_t* out = assoc_new(NULL, NULL); \ for (size_t i = 0; i < len; i++) { \ object_t \ *a = object_new(car_to, &( ct_cars[i] )), \ *b = object_new(cdr_to, &( ct_cdrs[i] )); \ assoc_append_boa(out, a, b); \ <API key>(2, a, b); \ } return out; \ } int <API key> ## type /* makes a new assoc from a c array of pointer types */ assoc_t* assoc_new_fromcptr (const void * const * const ct_car, const void * const * const ct_cdr, const size_t len, const objtype_t car_conv_to, const objtype_t cdr_conv_to) { assoc_t* out = assoc_new(NULL, NULL); for (size_t i = 0; i < len; i++) { object_t *a = object_new(car_conv_to, ct_car[i]), *b = object_new(cdr_conv_to, ct_cdr[i]); assoc_append_boa(out, a, b); <API key>(2, a, b); } return out; } /* copies one assoc's data to a new one's; does not copy identity */ assoc_t* assoc_copy (const assoc_t* const asc) { pfn(); object_failnull(asc); array_t *a, *b; assoc_unzip(asc, &a, &b); assoc_t* c = assoc_new(a, b); array_destruct_args(2, a, b); return c; } void assoc_destruct (assoc_t* const assoc) { pfn(); object_failnull(assoc); report_dtor(assoc); if (NULL != assoc->data) { for (size_t i = 0; i < assoc_length(assoc); i++) { pair_destruct( *assoc_get_ref(assoc, i, NULL) ); } safefree(assoc->data); } safefree(assoc); } <API key>(assoc); /* assoc_unzip: write the cars and cdrs of each pair to the respective pointers if assoc is null / empty, then car and cdr will be null. */ void assoc_unzip (const assoc_t* a, array_t** car, array_t** cdr) { pfn(); object_failnull(a); if ( car && cdr ) { *car = array_new(NULL, 0), *cdr = array_copy(*car); for (size_t i = 0; i < assoc_length(a); i++) { pair_t** p = assoc_get_ref(a, i, NULL); array_append(*car, *pair_car_ref( *p ) ), array_append(*cdr, *pair_cdr_ref( *p ) ); } } } size_t assoc_length (const assoc_t* const a) { return signed2un(a->idx + 1); } define_isinbounds(assoc); /* mutable reference to a pair at an index in the assoc. returns null and sets ok to false on error. */ pair_t** assoc_get_ref (const assoc_t* const a, const size_t idx, bool* ok) { pfn(); object_failnull(a); if (ok) { *ok = true; } if (assoc_isempty(a) || un2signed(idx) > a->idx) { if (ok) { *ok = false; } object_error( ER_INDEXERROR, false, "get elt %zu from highest %zd%s", idx, a->idx, assoc_isempty(a) ? " (get from empty assoc)" : "" ); return NULL; } return &( a->data [idx] ); } /* copy a pair from an assoc, returning a new one with the same data */ pair_t* assoc_get_copy (const assoc_t* const a, const size_t idx, bool* ok) { pfn(); pair_t** p = assoc_get_ref(a, idx, ok); if (NULL == p || ( ! ok )) { return pair_new(NULL, NULL); } return pair_copy( *p ); } /* append a new pair with the given car and cdr to the assoc */ void assoc_append_boa (assoc_t* const a, const object_t* const car, const object_t* const cdr) { pfn(); pair_t* p = pair_new(car, cdr); assoc_append(a, p); pair_destruct(p); } /* append a pair object to assoc. */ void assoc_append (assoc_t* const a, const pair_t* const b) { pfn(); object_failnull(a); assoc_resize(a, assoc_length(a) + 1); (a->data) [a->idx] = pair_copy(b); } warn_unused bool assoc_insert (assoc_t* const a, const pair_t* const p, const size_t idx) { pfn(); object_failnull(a), object_failnull(p); const size_t len = assoc_length(a); if (idx > len) { object_error( ER_INDEXERROR, false, "insert to index %zu above highest %zu%s", idx, len, len ? "" : " (insert to empty assoc)" ); return false; } assoc_resize(a, len + 1); for (size_t i = usub(assoc_length(a), 1); i > idx; i // change pointer (?) (a->data) [i] = (a->data) [i - 1]; } (a->data) [idx] = pair_copy(p); return true; } warn_unused bool assoc_insert_boa (assoc_t* const a, const object_t* const car, const object_t* const cdr, const size_t idx) { pair_t* const p = pair_new(car, cdr); bool res = assoc_insert(a, p, idx); pair_destruct(p); return res; } void assoc_clear (assoc_t* const a) { pfn(); object_failnull(a); assoc_resize(a, 0); } /* resize an assoc to the new size. implemented with saferealloc(2), so if new_idx is smaller than a->idx, the pairs past will disappear and their destructors will be called. */ void assoc_resize (assoc_t* const a, const size_t new_len) { pfn(); object_failnull(a); if ( ! new_len ) { // points to a region of memory of size zero aligned to pair_t* (aka pointer) a->data = (typeof(a->data)) saferealloc(a->data, 0); a->idx = -1; return; } if (new_len < assoc_length(a)) { for (size_t i = new_len + 1; i < assoc_length(a); i++) { pair_destruct( *assoc_get_ref(a, i, NULL) ); } } a->data = (typeof(a->data)) saferealloc( a->data, sizeof (pair_t*) * new_len ); a->idx = un2signed(new_len) - 1; } warn_unused assoc_t* assoc_clearv2 (const assoc_t* const a) { pfn(); object_failnull(a); return assoc_resizev2(a, 0); } warn_unused assoc_t* assoc_resizev2 (const assoc_t* const a, const size_t new_len) { pfn(); object_failnull(a); assoc_t* out = assoc_new(NULL, NULL); const size_t len_a = assoc_length(a); if ( ! new_len ) { // points to a region of memory of size zero aligned to pair_t* (aka pointer) return out; } for (size_t i = 0; i < new_len; i++) { assoc_append(out, *assoc_get_ref(a, i, NULL)); } if (new_len < len_a) { return out; } for (size_t i = 0; i < len_a; i++) { assoc_append(out, *assoc_get_ref(a, i, NULL)); } if (assoc_length(out) < len_a) { const size_t diff = len_a - assoc_length(out); for (size_t i = 0; i < diff; i++) { pair_t* p = pair_new(NULL, NULL); assoc_append(out, p); pair_destruct(p); } } return out; } void assoc_resizev3 (assoc_t* const a, const size_t new_len) { pfn(); object_failnull(a); const size_t old_len = assoc_length(a); // nothing to be done if ( ! (old_len + new_len) ) { return; } // just shrink if ( ! new_len ) { for (size_t i = 0; i < old_len; i++) { pair_destruct( *assoc_get_ref(a, i, NULL)); } a->data = (typeof(a->data)) saferealloc(a->data, 0); a->idx = -1; return; } if ( (! old_len) && new_len) { for (size_t i = 0; i < new_len; i++) { assoc_append_boa(a, NULL, NULL); } return; } // otherwise both are > 0 if (new_len < old_len) { for (size_t i = old_len - 1; i > new_len + 1; i } } } /* concatenate two assoc_ts */ assoc_t* assoc_concat (const assoc_t* const a, const assoc_t* const b) { pfn(); object_failnull(a); object_failnull(b); if ( assoc_isempty(a) && assoc_isempty(b) ) { return assoc_new(NULL, NULL); } else if ( assoc_isempty(a) || assoc_isempty(b) ) { if ( assoc_isempty(a) ) { return assoc_copy(b); } return assoc_copy(a); } assoc_t* c = assoc_copy(a); for (size_t i = 0; i < assoc_length(b); i++) { assoc_append(c, *assoc_get_ref(b, i, NULL) ); } return c; } /* delete a pair from an assoc by index */ bool assoc_delete (assoc_t* const a, const size_t idx) { pfn(); object_failnull(a); const size_t olen = assoc_length(a), nlen = udifference(olen, 1); if ( assoc_isempty(a) || idx > olen ) { object_error( ER_INDEXERROR, false, "attempt to delete index %zu above highest %zd%s", idx, a->idx, olen ? "" : " (delete from empty assoc)" ); return false; } pair_destruct( *assoc_get_ref(a, idx, NULL)); // if idx and a->idx are equal (that is, if it's the last element) we can just resize if (idx != iter_highest_idx(a)) { for (size_t i = idx; i < nlen; i++) { // change pointer (?) (a->data) [i] = (a->data) [i + 1]; } } assoc_resize(a, assoc_length(a) - 1); return true; } /* get the string representation of an assoc object. round-trips. */ char* assoc_see (const assoc_t* const a) { pfn(); object_failnull(a); char *outbuf = alloc(char, 7), *bufptr = outbuf; str_append(bufptr, 4, "%s ", "a{"); if ( assoc_isempty(a) ) { str_append(bufptr, 2, "%s", "}"); return outbuf; } size_t total_len = safestrnlen(outbuf); for (size_t i = 0; i < assoc_length(a); i++) { // 'tis but a reference pair_t** thisp = assoc_get_ref(a, i, NULL); char* strthis = pair_see(*thisp); size_t tlen = safestrnlen(strthis) + 2; outbuf = (typeof(outbuf)) saferealloc(outbuf, total_len + tlen); bufptr = outbuf + total_len; str_append(bufptr, tlen, "%s ", strthis); total_len = safestrnlen(outbuf); safefree(strthis); } // for my own sanity total_len = safestrnlen(outbuf); outbuf = (typeof(outbuf)) saferealloc(outbuf, total_len + 3); bufptr = outbuf + total_len; str_append(bufptr, 3, "%s", "}"); return outbuf; } /* directly writes debug data about the assoc to stdout. */ void assoc_inspect (const assoc_t* const a) { pfn(); printf("assoc uid:%zu idx:%zd sz:%zu {\n", a->uid, a->idx, sizeof a); for (size_t i = 0; i < assoc_length(a); i++) { char* s = pair_see( *assoc_get_ref(a, i, NULL) ); printf("\t%zu:%s\n", i, s); safefree(s); } puts("}\n"); } bool assoc_equals (const assoc_t* const a, const assoc_t* const b) { pfn(); object_failnull(a), object_failnull(b); if (assoc_length(a) != assoc_length(b)) { return false; } for (size_t i = 0; i < signed2un(a->idx); i++) { bool same = pair_equals( *assoc_get_ref(a, i, NULL), *assoc_get_ref(b, i, NULL) ); if (! same) { return false; } } return true; } bool assoc_isempty (const assoc_t* const a) { pfn(); object_failnull(a); return -1 == a->idx || NULL == a->data; } ssize_t assoc_schreg_1st ( const assoc_t* const a, const object_t* const obj, object_t** (* reg_get_func) (pair_t* const p) ) { pfn(); object_failnull(obj); size_t len = assoc_length(a); for (size_t i = 0; i < len; i++) { if ( object_equals( obj, *reg_get_func( *assoc_get_ref(a, i, NULL) ) ) ) { return un2signed(i); } } return -1; }
## void init() {: #init } This is a virtual function. It is meant to be overloaded by derived classes if they need to initialize internal variables. The default constructor of derived objects should *never* be overloaded. * **function definition:** virtual void init() * **parameters:** NONE * **output:** (void) ## void store([QDataStream][QDataStream] &stream) {: #store } This is a virtual function. Serialize an object to a [QDataStream][QDataStream]. The default implementation serializes each property and its value to disk. * **function definition:** virtual void store(QDataStream &stream) const * **parameters:** Parameter | Type | Description | stream | [QDataStream][QDataStream] & | Stream to store serialized data * **output:** (void) ## void load([QDataStream][QDataStream] &stream) {: #load } This is a virtual function. Deserialize an item from a [QDataStream][QDataStream]. Elements can be deserialized in the same order in which they were serialized. The default implementation deserializes a value for each property and then calls [init](#init). * **function definition:** virtual void load(QDataStream &stream); * **parameters:** Parameter | Type | Description | stream | [QDataStream][QDataStream] & | Stream to deserialize data from * **output:** (void) ## void serialize([QDataStream][QDataStream] &stream) {: #serialize } This is a virtual function. Serialize an entire plugin to a [QDataStream][QDataStream]. This function is larger in scope then [store](#store). It stores the string describing the plugin and then calls [store](#store) to serialize its parameters. This has the benefit of being able to deserialize an entire plugin (or series of plugins) from a stored model file. * **function definition:** virtual void serialize(QDataStream &stream) const * **parameters:** Parameter | Type | Description | stream | [QDataStream][QDataStream] & | Stream to store serialized data * **output:** (void) ## [QStringList][QStringList] parameters() {: #parameters } Get a string describing the parameters of the object * **function definition:** QStringList parameters() const * **parameters:** NONE * **output:** ([QStringList][QStringList]) Returns a list of the parameters to a function * **example:** class ExampleTransform : public Transform { Q_OBJECT Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) BR_PROPERTY(int, property1, 1) BR_PROPERTY(float, property2, 2.5) BR_PROPERTY(QString, property3, "Value") }; BR_REGISTER(Transform, ExampleTransform) Factory<Transform>::make(".Example")->parameters(); // returns ["int property1 = 1", "float property2 = 2.5", "QString property3 = Value"] ## [QStringList][QStringList] prunedArguments(bool expanded = false) {: #prunedarguments } Get a string describing the user-specified parameters of the object. This means that parameters using their default value are not returned. * **function definition:** QStringList prunedArguments(bool expanded = false) const * **parameters:** Parameter | Type | Description | expanded | bool | (Optional) If true, expand all abbreviations or model files into their full description strings. Default is false. * **output:** ([QStringList][QStringList]) Returns a list of all of the user specified parameters of the object * **example:** class ExampleTransform : public Transform { Q_OBJECT Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) BR_PROPERTY(int, property1, 1) BR_PROPERTY(float, property2, 2.5) BR_PROPERTY(QString, property3, "Value") }; BR_REGISTER(Transform, ExampleTransform) Factory<Transform>::make(".Example")->prunedArguments(); // returns [] Factory<Transform>::make(".Example(property1=10)")->prunedArguments(); // returns ["property1=10"] Factory<Transform>::make(".Example(property1=10,property3=NewValue)")->prunedArguments(); // returns ["property1=10", "property3=NewValue"] ## [QString][QString] argument(int index, bool expanded) {: #argument } Get a string value of the argument at a provided index. An index of 0 returns the name of the object. * **function definition:** QString argument(int index, bool expanded) const * **parameters:** Parameter | Type | Description | index | int | Index of the parameter to look up expanded | bool | If true, expand all abbreviations or model files into their full description strings. * **output:** ([QString][QString]) Returns a string value for the lookup argument * **example:** class ExampleTransform : public Transform { Q_OBJECT Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) BR_PROPERTY(int, property1, 1) BR_PROPERTY(float, property2, 2.5) BR_PROPERTY(QString, property3, "Value") }; BR_REGISTER(Transform, ExampleTransform) Factory<Transform>::make(".Example")->argument(0, false); // returns "Example" Factory<Transform>::make(".Example")->argument(1, false); // returns "1" Factory<Transform>::make(".Example")->argument(2, false); // returns "2.5" ## [QString][QString] description(bool expanded = false) {: #description } This is a virtual function. Get a description of the object. The description includes the name and any user-defined parameters of the object. Parameters that retain their default value are not included. * **function definition:** virtual QString description(bool expanded = false) const * **parameters:** Parameter | Type | Description | expanded | bool | (Optional) If true, expand all abbreviations or model files into their full description strings. Default is false. * **output:** ([QString][QString]) Returns a string describing the object * **example:** class ExampleTransform : public Transform { Q_OBJECT Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) BR_PROPERTY(int, property1, 1) BR_PROPERTY(float, property2, 2.5) BR_PROPERTY(QString, property3, "Value") }; BR_REGISTER(Transform, ExampleTransform) Factory<Transform>::make(".Example")->description(); // returns "Example" qDebug() << Factory<Transform>::make(".Example(property3=NewValue)")->description(); // returns "Example(property3=NewValue)" ## void setProperty(const [QString][QString] &name, [QVariant][QVariant] value) {: #setproperty } Set a property with a provided name to a provided value. This function overloads [QObject][QObject]::setProperty so that it can handle OpenBR data types. If the provided name is not a property of the object nothing happens. If the provided name is a property but the provided value is not a valid type an error is thrown. * **function definition:** void setProperty(const QString &name, QVariant value) * **parameters:** Parameter | Type | Description | name | const [QString][QString] & | Name of the property to set value | [QVariant][QVariant] | Value to set the property to * **output:** (void) * **see:** [<API key>](#<API key>), [setExistingProperty](#setexistingproperty) * **example:** class ExampleTransform : public Transform { Q_OBJECT Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) Q_PROPERTY(QString property3 READ get_property3 WRITE set_property3 RESET reset_property3 STORED false) BR_PROPERTY(int, property1, 1) BR_PROPERTY(float, property2, 2.5) BR_PROPERTY(QString, property3, "Value") }; BR_REGISTER(Transform, ExampleTransform) QScopedPointer<Transform> transform(Factory<Transform>::make(".Example")); transform->parameters(); // returns ["int property1 = 1", "float property2 = 2.5", "QString property3 = Value"] transform->setProperty("property1", QVariant::fromValue<int>(10)); transform->parameters(); // returns ["int property1 = 10", "float property2 = 2.5", "QString property3 = Value"] transform->setProperty("property1", QVariant::fromValue<QString>("Value")); // ERROR: incorrect type ## bool <API key>(const [QString][QString] &name, [QVariant][QVariant] value) {: #<API key> } Set a property of the object or the object's children to a provided value. The recursion is only single level; the children of the the objects children will not be affected. Only the first property found is set. This means that if a parent and a child have the same property only the parent's property is set. * **function definition:** virtual bool <API key>(const QString &name, QVariant value) * **parameters:** Parameter | Type | Description | name | const [QString][QString] & | Name of the property to set value | [QVariant][QVariant] | Value to set the property to * **output:** (bool) Returns true if the property is set in either the object or its children * **see:** [setProperty](#setproperty), [setExistingProperty](#setexistingproperty), [getChildren](#getchildren-2) * **example:** class ChildTransform : public Transform { Q_OBJECT Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) BR_PROPERTY(int, property1, 2) BR_PROPERTY(int, property2, 2.5) }; BR_REGISTER(Transform, ChildTransform) class ParentTransform : public Transform { Q_OBJECT Q_PROPERTY(br::Transform *child READ get_child WRITE set_child RESET reset_child STORED false) Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) BR_PROPERTY(br::Transform*, child, Factory<Transform>::make(".Child")) BR_PROPERTY(int, property1, 1) }; QScopedPointer<Transform> parent(Factory<Transform>::make(".Parent")); parent->parameters(); // returns ["br::Transform* child = ", "int property1 = 1"] parent->getChildren<Transform>().first()->parameters(); // returns ["int property1 = 2", "float property2 = 2"] parent-><API key>("property1", QVariant::fromValue<int>(10)); parent->parameters(); // returns ["br::Transform* child = ", "int property1 = 10"] parent->getChildren<Transform>().first()->parameters(); // returns ["int property1 = 2", "float property2 = 2"] parent-><API key>("property2", QVariant::fromValue<float>(10.5)); parent->parameters(); // returns ["br::Transform* child = ", "int property1 = 10"] parent->getChildren<Transform>().first()->parameters(); // returns ["int property1 = 2", "float property2 = 10"] ## bool setExistingProperty(const [QString][QString] &name, [QVariant][QVariant] value) {: #setexistingproperty } Attempt to set a property to a provided value. If the provided value is not a valid type for the given property an error is thrown. * **function definition:** bool setExistingProperty(const QString &name, QVariant value) * **parameters:** Parameter | Type | Description | name | const [QString][QString] & | Name of the property to set value | [QVariant][QVariant] | Value to set the property to * **output:** (bool) Returns true if the provided property exists and can be set to the provided value, otherwise returns false * **example:** class ExampleTransform : public Transform { Q_OBJECT Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) BR_PROPERTY(int, property1, 2) BR_PROPERTY(int, property2, 2.5) }; BR_REGISTER(Transform, ExampleTransform) QScopedPointer<Transform> transform(Factory<Transform>::make(".Child")); transform->setExistingProperty("property1", QVariant::fromValue<int>(10)); // returns true transform->parameters(); // returns ["int property1 = 10", "float property2 = 2"] transform->setExistingProperty("property3", QVariant::fromValue<int>(10)); // returns false transform->setExistingProperty("property1", QVariant::fromValue<QString>("Hello")); // ERROR: incorrect type ## [QList][QList]&lt;[Object](object.md) \*&gt; getChildren() {: #getchildren-1 } This is a virtual function. Get all of the children of the object. The default implementation looks for children in the properties of the object. A derived object should overload this function if it needs to provide children from a different source. * **function definition:** virtual QList<Object *> getChildren() const <!-- no italics* --> * **parameters:** NONE * **output:** ([QList][QList]&lt;[Object](object.md) \*&gt;) Returns a list of all of the children of the object * **example:** class ChildTransform : public Transform { Q_OBJECT Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) BR_PROPERTY(int, property1, 2) BR_PROPERTY(int, property2, 2.5) }; BR_REGISTER(Transform, ChildTransform) class ParentTransform : public Transform { Q_OBJECT Q_PROPERTY(br::Transform *child READ get_child WRITE set_child RESET reset_child STORED false) Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) BR_PROPERTY(br::Transform *, child, Factory<Transform>::make(".Child")) BR_PROPERTY(int, property1, 1) }; BR_REGISTER(Transform, ParentTransform) QScopedPointer<Transform> transform(Factory<Transform>::make(".Parent")); transform->getChildren(); // returns [br::ChildTransform(0x7fc10bf01050, name = "Child")] transform->getChildren().first()->parameters(); // returns ["int property1 = 2", "float property2 = 2"] ## [QList][QList]&lt;T \*&gt; getChildren() {: #getchildren-2 } Provides a wrapper on [getChildren](#getchildren-1) as a convenience to allow the return type (<tt>T</tt>) to be specified. <tt>T</tt> must be a derived class of [Object](object.md). * **function definition:** template<typename T> QList<T *> getChildren() const * **parameters:** NONE * **output:** ([QList][QList]&lt;<tt>T</tt> \*&gt;) Returns a list of all of the children of the object, casted to type <tt>T</tt>. <tt>T</tt> must be a derived class of [Object](object.md) * **example:** class ChildTransform : public Transform { Q_OBJECT Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) Q_PROPERTY(float property2 READ get_property2 WRITE set_property2 RESET reset_property2 STORED false) BR_PROPERTY(int, property1, 2) BR_PROPERTY(int, property2, 2.5) }; BR_REGISTER(Transform, ChildTransform) class ParentTransform : public Transform { Q_OBJECT Q_PROPERTY(br::Transform *child READ get_child WRITE set_child RESET reset_child STORED false) Q_PROPERTY(int property1 READ get_property1 WRITE set_property1 RESET reset_property1 STORED false) BR_PROPERTY(br::Transform *, child, Factory<Transform>::make(".Child")) BR_PROPERTY(int, property1, 1) }; BR_REGISTER(Transform, ParentTransform) QScopedPointer<Transform> transform(Factory<Transform>::make(".Parent")); transform->getChildren<Transform>(); // returns [br::ChildTransform(0x7fc10bf01050, name = "Child")] transform->getChildren<Transform>().first()->parameters(); // returns ["int property1 = 2", "float property2 = 2"] <!-- Links --> [QDataStream]: http://doc.qt.io/qt-5/qdatastream.html "QDataStream" [QString]: http://doc.qt.io/qt-5/QString.html "QString" [QStringList]: http://doc.qt.io/qt-5/qstringlist.html "QStringList" [QVariant]: http://doc.qt.io/qt-5/qvariant.html "QVariant" [QObject]: http://doc.qt.io/qt-5/QObject.html "QObject" [QList]: http://doc.qt.io/qt-5/QList.html "QList"
package org.flowerplatform.codesync.as.adapter; import org.apache.flex.compiler.definitions.references.IReference; import org.flowerplatform.codesync.CodeSyncAlgorithm; import org.flowerplatform.codesync.adapter.file.<API key>; import org.flowerplatform.core.CoreConstants; /** * Mapped to {@link IReference}. * * @author Mariana Gheorghe */ public class <API key> extends <API key> { @Override public Object getMatchKey(Object element, CodeSyncAlgorithm codeSyncAlgorithm) { return getReference(element).getName(); } @Override public Object <API key>(Object element, Object feature, Object correspondingValue, CodeSyncAlgorithm codeSyncAlgorithm) { if (CoreConstants.NAME.equals(feature)) { return getReference(element).getName(); } return super.<API key>(element, feature, correspondingValue, codeSyncAlgorithm); } /** *@author Mariana Gheorghe **/ protected IReference getReference(Object element) { return (IReference) element; } @Override protected void updateUID(Object element, Object <API key>) { // TODO Auto-generated method stub } }
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # This file is part of qutebrowser. # qutebrowser is free software: you can redistribute it and/or modify # (at your option) any later version. # qutebrowser is distributed in the hope that it will be useful, # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the import pytest pytest.importorskip('PyQt5.QtWebKitWidgets') from qutebrowser.browser.webkit import webkitsettings def <API key>(qapp): webkitsettings._init_user_agent() parsed = webkitsettings.parsed_user_agent assert parsed.<API key> == 'Version' assert parsed.qt_key == 'Qt'
<?php $flash_url = url($<API key>, array( 'query' => array('url' => $captcha_url), 'external' => TRUE, )); $switch_verify = t('Switch to image verification.'); $instructions = t('Enter only the first letter of each word you hear. If you are having trouble listening in your browser, you can <a href="@captcha-url" id="<API key>" class="<API key>">download the audio</a> to listen on your device.', array( '@captcha-url' => $captcha_url, )); $unsupported = t('Your system does not support our audio playback verification. Please <a href="@captcha-url" id="<API key>" class="<API key>">download this verification</a> to listen on your device.', array( '@captcha-url' => $captcha_url, )); $refresh_alt = t('Refresh'); $<API key> = theme('image', nochommons_get_path('module', 'mollom') . '/images/refresh.png', $refresh_alt, NULL, NULL, FALSE); ?> <script type="text/javascript"> function embedFallbackPlayer() { var embedDiv = document.getElementById("<API key>"); var audioDiv = document.getElementById("<API key>"); var unsupportedDiv = document.getElementById("<API key>"); var movie = '<?php print $flash_url; ?>'; function embedComplete(e) { if (e.success) { e.ref.focus(); } else { jQuery(unsupportedDiv).show(); } } var flashvars = {}, params = { wmode: "opaque" }, attributes = { "class": "<API key> <API key> <API key>", }, playerWidth = 110, playerHeight = 50; if (typeof swfobject !== 'undefined') { swfobject.embedSWF(movie, embedDiv, playerWidth, playerHeight, "10.0", null, flashvars, params, attributes, embedComplete); } else { var embed = '<object id="<API key>" name="<API key>" '; embed += 'classid="clsid:<API key>" '; embed += 'type="application/x-shockwave-flash" '; embed += 'data="' + movie + '" ' for (var attr in attributes) { embed += attr + '="' + attributes[attr] + '" '; } embed += 'width="' + playerWidth + 'px" height="' + playerHeight + 'px">'; embed += '<param name="movie" value="' + movie + '" />'; for (var param in params) { embed += '<param name="' + param + '" value="' + params[param] + '" />'; } var flashVarsArray = []; for(var varname in flashvars) { flashVarsArray.append(varname + '=' + encodeURI(flashvars[varname])); } flashVarsString = flashVarsArray.join('&'); if (flashVarsString.length > 0) { embed += '<param name="flashVars" value="' + flashVarsString + '" />'; } embed += '<embed src="' + movie + '" width="' + playerWidth + '" height="' + playerHeight + '" '; for (var attr in attributes) { embed += attr + '="' + attributes[attr] + '" '; } for (var param in params) { embed += param + '="' + params[param] + '" '; } if (flashVarsString.length > 0) { embed += 'flashVars="' + flashVarsString + '"'; } embed += '/>'; embed += '</object>'; jQuery(embedDiv).replaceWith(embed); jQuery("#<API key>").focus(); } jQuery(audioDiv).hide(); } </script> <span class="<API key>"> <a href="javascript:void(0);" class="<API key> <API key>"><?php print $<API key>; ?></a> <span class="<API key> <API key>"> <span class="<API key>"><?php print $instructions; ?></span> <!--- HTML5 Audio playback --> <audio id="<API key>" controls tabindex="0"> <source src="<?php print $captcha_url; ?>" type="audio/mpeg" /> <!-- Displays if HTML5 audio is unsupported and JavaScript player embed is unsupported --> <p><?php print $unsupported; ?></p> </audio> <!-- Fallback for browsers not supporting HTML5 audio or not MP3 format --> <span id="<API key>"> <span id="<API key>"></span> <script> var audioTest = document.createElement('audio'); if (!audioTest.canPlayType || !audioTest.canPlayType('audio/mpeg')) { embedFallbackPlayer(); } </script> </span> <!-- Text to show when neither HTML5 audio or SWFs are supported --> <span id="<API key>" style="display:none"> <p><?php print $unsupported; ?></p> </span> <span class="<API key>"><a href="#" class="<API key> <API key> <API key>" id="<API key>"><?php print $switch_verify; ?></a></span> </span> </span>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http: <html xmlns="http: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>NREL MatDB Flat File Database Overview &mdash; nrelmat 1.0.0 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var <API key> = { URL_ROOT: './', VERSION: '1.0.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=<API key>"></script> <link rel="top" title="nrelmat 1.0.0 documentation" href="index.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li><a href="index.html">nrelmat 1.0.0 documentation</a> &raquo;</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="<API key>"> <h1>NREL MatDB Flat File Database Overview<a class="headerlink" href=" <p>The flat file database consists of a set of directory trees organized by <tt class="docutils literal"><span class="pre">wrapId</span></tt>. See the <a class="reference external" href="sqlDatabase.html">SQL database overview</a> for more information on the <tt class="docutils literal"><span class="pre">wrapId</span></tt>.</p> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="<API key>"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/flatDatabase.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li><a href="index.html">nrelmat 1.0.0 documentation</a> &raquo;</li> </ul> </div> <div class="footer"> &copy; Copyright 2013, S. Sullivan. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1. </div> </body> </html>
<?php /** * Module Header page * * @author Brian Peterson * * $Id: gpg_module_header.php,v 1.10 2004/01/09 18:27:15 brian Exp $ */ if (!defined ('SM_PATH')){ if (file_exists('./gpg_functions.php')){ define ('SM_PATH' , '../../'); } elseif (file_exists('../gpg_functions.php')){ define ('SM_PATH' , '../../../'); } elseif (file_exists('../plugins/gpg/gpg_functions.php')){ define ('SM_PATH' , '../'); } else echo "unable to define SM_PATH in gpg_module_header.php, exiting abnormally"; } require_once(SM_PATH.'plugins/gpg/gpg_options_header.php'); /* * Function for easily bailing out on malformed requests. * * @param strign $err Error String * @return void * */ function gpg_bail($err) { echo '<font color=red><b>' . _("There was a problem with your request.") . _("Please try again.") . '<p><pre>'; // print_r($err); echo '</pre><p></b></font>'; //exit(); } // call the main Squirrelmail page header function displayPageHeader($color, 'None'); /** * set the localization variables * Now tell gettext where the locale directory for your plugin is * this is in relation to the src/ directory */ bindtextdomain('gpg', SM_PATH . 'plugins/gpg/locale'); /* Switch to your plugin domain so your messages get translated */ textdomain('gpg'); if (! isset($err)) $err = array(); echo '<br>'; /** * $Log: gpg_module_header.php,v $ * Revision 1.10 2004/01/09 18:27:15 brian * changed SM_PATH defines to use quoted string for E_ALL * * Revision 1.9 2003/11/04 21:41:01 brian * change to use SM_PATH * * Revision 1.8 2003/11/01 22:00:43 brian * - standardized text across several pages * - localized remaining strings * - removed $msg strings and Makepage fn * */ ?>
#ifndef __VOICECOMMAND_H__ #define __VOICECOMMAND_H__ #include <stdio.h> #include <stdlib.h> #include <iostream> #include <fstream> #include <boost/regex.hpp> #include <vector> #include <string> #include <curl/curl.h> #include <termios.h> #include <unistd.h> #include <sstream> #define DATA_SIZE 200 #define DURATION_DEFAULT "3" #define <API key> "2" using namespace std; class VoiceCommand { private: CURL *hcurl; CURLcode cr; bool use_pass, init; vector<string> voice, commands; protected: string version; public: bool continuous; bool verify; bool edit; bool ignoreOthers; bool filler; bool quiet; bool differentHW; float thresh; //I'm storing the durations as strings because it makes the commands less messy and requires less overhead string duration; string command_duration; string recordHW; string keyword; string config_file; string response; char errorbuf[CURL_ERROR_SIZE]; string curlbuf; int debug; VoiceCommand(); ~VoiceCommand(); inline void ProcessMessage(char* message); void GetConfig(); void EditConfig(); void CheckConfig(); void CheckCmdLineParam(int argc, char* argv[]); void DisplayUsage(); void Setup(); int Search(const char* search); int Init(void); static int CurlWriter(char *data, size_t size, size_t nmemb, string *buffer); }; #endif
using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("p3_basico")] [assembly: AssemblyDescription("")] [assembly: <API key>("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("jona")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.0.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
package com.StaticVoidGames.spring.controller; import java.io.File; import javax.servlet.ServletContext; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.PathVariable; import com.StaticVoidGames.spring.controller.interfaces.<API key>; import com.StaticVoidGames.spring.util.OpenSourceLink; import com.StaticVoidGames.spring.util.PageDownUtils; /** * Controller handling the about pages. * The content of the about pages are markdown files that are parsed when an about page is visited. * Probably a silly way to do this, but it'll make it easier for people to modify them. */ @Component public class AboutController implements <API key>{ @Autowired ServletContext servletContext; @Override public String viewAboutIndex(ModelMap map) { return viewAboutPage(map, "index"); } @Override public String viewAboutPage(ModelMap map, @PathVariable(value="page") String page) { long start = System.currentTimeMillis(); map.addAttribute("page", page); map.addAttribute("openSourceLinks", new OpenSourceLink[]{ new OpenSourceLink("View this page's jsp code.", "https://github.com/KevinWorkman/StaticVoidGames/blob/master/StaticVoidGames/src/main/webapp/WEB-INF/jsp/about/viewAboutPage.jsp"), new OpenSourceLink("View this page's content.", "https://github.com/KevinWorkman/StaticVoidGames/tree/master/StaticVoidGames/src/main/webapp/WEB-INF/aboutContent/" + page + ".markdown"), new OpenSourceLink("View this page's server code.", "https://github.com/KevinWorkman/StaticVoidGames/blob/master/StaticVoidGames/src/main/java/com/StaticVoidGames/spring/controller/AboutController.java") } ); try{ File file = new File( servletContext.getRealPath("/WEB-INF/aboutContent/" + page + ".markdown") ); String markdown = FileUtils.readFileToString(file); String html = PageDownUtils.getSanitizedHtml(markdown); map.addAttribute("aboutContent", html); if("index".equals(page)){ //map.addAttribute("aboutTitle", "What is Static Void Games?"); map.addAttribute("aboutTitle", "Test <abc>123</abc> test"); } else if("contact".equals(page)){ map.addAttribute("aboutTitle", "Don't be a stranger!"); } else if("faq".equals(page)){ map.addAttribute("aboutTitle", "Frequently Asked Questions"); } else if("legal".equals(page)){ map.addAttribute("aboutTitle", "Your games are your games."); } else if("openSource".equals(page)){ map.addAttribute("aboutTitle", "Open Source"); } } catch(Exception e){ e.printStackTrace(); map.addAttribute("aboutText", "Could not find that about page."); } long elapsed = System.currentTimeMillis() - start; System.out.println("Elapsed: " + elapsed); return "about/viewAboutPage"; } }
package rancraftPenguins; import java.util.Iterator; import java.util.List; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; //import net.minecraft.block.BlockCloth; import net.minecraft.block.BlockColored; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.<API key>; import net.minecraft.entity.ai.<API key>; import net.minecraft.entity.ai.EntityAIBeg; import net.minecraft.entity.ai.EntityAIFollowOwner; import net.minecraft.entity.ai.<API key>; import net.minecraft.entity.ai.<API key>; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMate; import net.minecraft.entity.ai.<API key>; import net.minecraft.entity.ai.<API key>; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.<API key>; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.<API key>; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.pathfinding.PathEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public abstract class EntityPenguin extends net.minecraft.entity.passive.EntityTameable { protected boolean looksWithInterest; protected float field_25048_b; protected float field_25054_c; private float field_70926_e; private float field_70924_f; private boolean field_70928_h; /** true is the penguin is wet else false */ protected boolean isShaking; protected int GenericShearing = 1; //protected String texturePath = "/assets/rancraftpenguins/textures/models/"; /** * This time increases while penguin is shaking and emitting water particles. */ protected float <API key>; protected float <API key>; protected int timeDry = 0; // how long since the penguin has left the water public EntityPenguin(World par1World) { super(par1World); looksWithInterest = false; this.getNavigator().setAvoidsWater(true); // change this later? } /* protected void <API key>() // wolf version has no arguments { <API key>(0.3F,20.0F,8.0F); } */ // The above version without args isn't needed for penguins public void <API key>(float moveSpeed, float maxHealthTame, float maxHealthWild) { super.<API key>(); this.getEntityAttribute(<API key>.movementSpeed).setAttribute(moveSpeed); if (this.isTamed()) { this.getEntityAttribute(<API key>.maxHealth).setAttribute(maxHealthTame); } else { this.getEntityAttribute(<API key>.maxHealth).setAttribute(maxHealthWild); } } /** * Returns true if the newer Entity AI code should be run */ public boolean isAIEnabled() { return true; } /** * Returns true if penguins can be tamed with stuffID */ protected boolean isPenguinFood(int stuffID) { return (stuffID == net.minecraft.item.Item.fishRaw.itemID || stuffID == 23272 /* aquaculture mod raw fish fillet and whale steak */ || stuffID == 23273); } /* overrides the fn for EntityLiving */ public boolean <API key>() { return true; } /** * Checks if the parameter is an wheat item. * The one in EntityAnimal sometimes causes a crash because it tries to evaluate without checking for null first */ public boolean isWheat(ItemStack par1ItemStack) { if (par1ItemStack == null) { return false; } else { return (par1ItemStack.itemID == net.minecraft.item.Item.wheat.itemID); } } /** * Sets the active target the Task system uses for tracking */ public void setAttackTarget(EntityLivingBase <API key>) { super.setAttackTarget(<API key>); if (<API key> == null) { if (!this.isAngry()) { return; } this.setAngry(false); List list = this.worldObj.<API key>(this.getClass(), AxisAlignedBB.getAABBPool().getAABB(this.posX, this.posY, this.posZ, this.posX + 1.0D, this.posY + 1.0D, this.posZ + 1.0D).expand(16.0D, 10.0D, 16.0D)); Iterator iterator = list.iterator(); while (iterator.hasNext()) { EntityPenguin entitypenguin = (EntityPenguin)iterator.next(); if (this != entitypenguin) { entitypenguin.setAngry(false); } } } else { this.setAngry(true); } } /** * main AI tick function, replaces <API key> */ protected void updateAITick() { this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth())); } //abstract public int getMaxHealth(); protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(18, new Float(this.getHealth())); this.dataWatcher.addObject(19, new Byte((byte)0)); //this.dataWatcher.addObject(20, new Byte((byte)BlockColored.getBlockFromDye(1))); } /** * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to * prevent them from trampling crops */ protected boolean canTriggerWalking() { return false; } /** * returns the directory and filename as a String */ /*public String getTexture() { //return super.getTexture(); return super.func_110581_b(textureLocation).func_110552_b(); }*/ /** * Plays step sound at given x, y, z for the entity */ protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.wolf.step", 0.15F, 1.0F); } /** * Sets the size of this mob (useful for adjusting penguin's dimensions when it swims) */ protected void setSize2(float width, float height) { super.setSize(width, height); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("Angry", isAngry()); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); setAngry(par1NBTTagCompound.getBoolean("Angry")); } /** * Returns the sound this mob makes while it's alive. */ abstract protected String getLivingSound(); /** * Returns the sound this mob makes when it is hurt. */ abstract protected String getHurtSound(); /** * Returns the sound this mob makes on death. */ abstract protected String getDeathSound(); /** * Returns the volume for the sounds this mob makes. */ abstract protected float getSoundVolume(); /** * Returns the item ID for the item the mob drops on death. */ abstract protected int getDropItemId(); /** * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons * use this to react to sunlight and start to burn. */ public void onLivingUpdate() { super.onLivingUpdate(); if (!worldObj.isRemote && isShaking && !field_70928_h && !hasPath() && onGround) { field_70928_h = true; <API key> = 0.0F; <API key> = 0.0F; worldObj.setEntityState(this, (byte)8); } } /** * Called to update the entity's position/logic. */ public void onUpdate() { super.onUpdate(); this.field_70924_f = this.field_70926_e; if (this.func_70922_bv()) { this.field_70926_e += (1.0F - this.field_70926_e) * 0.4F; } else { this.field_70926_e += (0.0F - this.field_70926_e) * 0.4F; } if (this.func_70922_bv()) { this.<API key> = 10; } if (this.isWet()) { this.isShaking = true; this.field_70928_h = false; this.<API key> = 0.0F; this.<API key> = 0.0F; } else if ((this.isShaking || this.field_70928_h) && this.field_70928_h) { if (this.<API key> == 0.0F) { this.playSound("mob.wolf.shake", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); } this.<API key> = this.<API key>; this.<API key> += 0.05F; if (this.<API key> >= 2.0F) { this.isShaking = false; this.field_70928_h = false; this.<API key> = 0.0F; this.<API key> = 0.0F; } if (this.<API key> > 0.4F) { float f = (float)this.boundingBox.minY; int i = (int)(MathHelper.sin((this.<API key> - 0.4F) * (float)Math.PI) * 7.0F); for (int j = 0; j < i; ++j) { float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; this.worldObj.spawnParticle("splash", this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ); } } } } @SideOnly(Side.CLIENT) public boolean getPenguinShaking() { return this.isShaking; } @SideOnly(Side.CLIENT) /** * Used when calculating the amount of shading to apply while the penguin is shaking. */ public float <API key>(float par1) { return 0.75F + ((<API key> + (<API key> - <API key>) * par1) / 2.0F) * 0.25F; } @SideOnly(Side.CLIENT) public float getShakeAngle(float par1, float par2) { float f = (<API key> + (<API key> - <API key>) * par1 + par2) / 1.8F; if (f < 0.0F) { f = 0.0F; } else if (f > 1.0F) { f = 1.0F; } return MathHelper.sin(f * (float)Math.PI) * MathHelper.sin(f * (float)Math.PI * 11F) * 0.15F * (float)Math.PI; } @SideOnly(Side.CLIENT) public float getInterestedAngle(float par1) { return (this.field_70924_f + (this.field_70926_e - this.field_70924_f) * par1) * 0.15F * (float)Math.PI; } public float getEyeHeight() { return height * 0.8F; } /** * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently * use in wolves AND penguins. */ public int <API key>() { return this.isSitting() ? 20 : super.<API key>(); } /** * Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { Entity entity = par1DamageSource.getEntity(); aiSit.setSitting(false); if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1) / 2; } return super.attackEntityFrom(par1DamageSource, par2); } /** * Called when this class wants to know what to drop on shearing */ public Item droppedFeather() { Item dropped; dropped = Item.potato; return dropped; } /** * Called when a penguin gets sheared */ public boolean interactShearing(EntityPlayer par1EntityPlayer) { if (!worldObj.isRemote) { ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); //checks if there is something in the player's inventory to prevent crash //checks if it is supposed to run this shearing code or not if(var2 != null){ if (!isChild() && ((var2.itemID == Item.shears.itemID) || (var2.itemID == RanCraftPenguins.PenguinShears.itemID))) // can't shear chicks { // shear if(!isTamed()) { setAngry(true); setAttackTarget(par1EntityPlayer); } else { int <API key>; int angerChanceInverse; if (var2.itemID == RanCraftPenguins.PenguinShears.itemID){ angerChanceInverse = 5; // 20% chance penguin may go wild and attack <API key> = 3; // 33% chance shears won't get worn } else { // ordinary shears angerChanceInverse = 3; // 33% chance penguin may go wild and attack <API key> = 1; // 0% chance shears won't get worn } int i = rand.nextInt(angerChanceInverse); if(i == 0){ // 33% chance for normal; 20% chance for penguin shears aiSit.setSitting(false); // stand up setTamed(false); setAngry(true); setAttackTarget(par1EntityPlayer); } else { int k = rand.nextInt(3); // 0-2 drops if(k > 0){ this.worldObj.playSoundAtEntity(this, "mob.sheep.shear", 1.0F, 1.0F); } for(int j = 0; j < k; j++) { Item dropped; dropped = this.droppedFeather(); EntityItem entityitem = entityDropItem(new ItemStack(dropped), 1.0F); entityitem.motionY += rand.nextFloat() * 0.05F; entityitem.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; entityitem.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; } } int k = rand.nextInt(<API key>); if (k < 3){ var2.damageItem(1, par1EntityPlayer); // 2/3 of the time if variable is 3; always if variable is 1 } } } // holding fish or other penguin food else if (isPenguinFood(var2.itemID)) { // penguin is not tame (could be angry) so try to tame it if(!isTamed()) { if (!par1EntityPlayer.capabilities.isCreativeMode) { var2.stackSize } if (var2.stackSize <= 0) { par1EntityPlayer.inventory.<API key>(par1EntityPlayer.inventory.currentItem, null); } if (rand.nextInt(3) == 0) { setAngry(false); setTamed(true); setPathToEntity(null); setAttackTarget(null); this.aiSit.setSitting(true); setHealth(20.0F); setOwner(par1EntityPlayer.username); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte)7); } else { this.playTameEffect(false); worldObj.setEntityState(this, (byte)6); } return true; } else { // penguin is tame (and may be a child). so feed it if it's hungry ItemFood var3 = (ItemFood)Item.itemsList[var2.itemID]; if (this.dataWatcher.<API key>(18) < 20) { this.heal(var3.getHealAmount()); if (!par1EntityPlayer.capabilities.isCreativeMode) { var2.stackSize } return true; } } } } // sit toggle if (par1EntityPlayer.username.equalsIgnoreCase(getOwnerName()) && (var2 == null || (!isPenguinFood(var2.itemID) && !isWheat(var2) && (var2.itemID != Item.shears.itemID) && (var2.itemID != RanCraftPenguins.PenguinShears.itemID)))) { this.aiSit.setSitting(!this.isSitting()); isJumping = false; setPathToEntity(null); } } return false; //default value does nothing } /** * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ public boolean interact(EntityPlayer par1EntityPlayer) { boolean shearingValue = this.interactShearing(par1EntityPlayer); if (shearingValue) { return true; } return super.interact(par1EntityPlayer); } @SideOnly(Side.CLIENT) public void handleHealthUpdate(byte par1) { if (par1 == 8) { field_70928_h = true; <API key> = 0.0F; <API key> = 0.0F; } else { super.handleHealthUpdate(par1); } } /** * Will return how many at most can spawn in a chunk at once. */ abstract public int <API key>(); /** * gets this penguin's angry state */ public boolean isAngry() { return (dataWatcher.<API key>(16) & 2) != 0; } /** * sets this penguin's angry state to true if the boolean argument is true */ public void setAngry(boolean par1) { byte b0 = this.dataWatcher.<API key>(16); if (par1) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); } } /** * [This function is used when two same-species animals in 'love mode' breed to generate the new baby animal.] */ abstract public EntityAnimal spawnBabyAnimal(EntityAgeable par1EntityAgeable); public void func_48150_h(boolean par1) { looksWithInterest = par1; } public void func_70918_i(boolean par1) { if (par1) { this.dataWatcher.updateObject(19, Byte.valueOf((byte)1)); } else { this.dataWatcher.updateObject(19, Byte.valueOf((byte)0)); } } abstract public boolean canMateWith(EntityAnimal par1EntityAnimal); public boolean func_70922_bv() { return this.dataWatcher.<API key>(19) == 1; } /** * Determines if an entity can be despawned, used on idle far away entities */ protected boolean canDespawn() { return !this.isTamed() && this.ticksExisted > 2400; } public EntityAgeable createChild(EntityAgeable par1EntityAgeable) { return this.spawnBabyAnimal(par1EntityAgeable); } }
C+*********************************************************** comv-ch2.f Ch*********************************************************************** SUBROUTINE CheckFan() C*********************************************************************** C Purpose: CheckFan checks the characteristic of the fan C The polynomial curve must correspond with the linear fix outside C the pressure range Pmin..Pmax C@tno jcp 1996May23_11:16:36 C C Pass parameters: C C A summary of the contents of Dat(*): C Dat(1)=2 means this link is a fan C Dat(2)= Flag is needed for COMIN and not for COMIS C Dat(3)= highest power in the polynomial, n C Dat(4)= airdensity belonging to the fandata which gave these coefficients C Dat(5)= fanspeed belonging to the fandata which gave these coefficients C Dat(6)= Cm if the fan is off C Dat(7)= Expn if the fan is off C Dat(8)= Pmin range where the polynomial is valid C Dat(9)= Pmax ,, ,, C Dat(10)= slope for extrapolation C Dat(11)= intercept for extrapolation C Dat(12)= C0 polynomial coefficient C Dat(13)= C1...... C Dat(12+Dat(3))=Cn C@tno jcp 1997Jul03_14:40:22 C Dat(17)=C5 C Dat(18)=Number of data points say 4 here C Dat(19)=P1 C Dat(20)=Q1 C Dat(21)=P2 C Dat(22)=Q2 C Dat(23)=P3 C Dat(24)=Q3 C Dat(25)=P4 C Dat(26)=Q4 C Dat(27)=Filter coef pol1 C Dat(28)=Filter coef pol2 C Dat(29)=Filter coef pol3 C Dat(30)=Filter coef pol4 C Dat(31)=Filter coef pol5 C C C IO # Name unit description C ERROR routine Inerr is called Ch*********************************************************************** IMPLICIT NONE INCLUDE 'comv-inp.inc' INCLUDE 'comv-uni.inc' C@tno jcp 1997Jul03_23:12:11 added fma3 dp2 DOUBLE PRECISION Fma1,Fma2,fma3,Dp,Dp1,Dp2 C@tno jcp 1997Jul03_23:27:23 added slope and intercept REAL fratio,mp1,Pcor,Pmin,Pmax,Dfma,slope,intercept,RhoI C@tno jcp 1997Jul03_22:32:30 REAL C0 C@tno jcp 1997Jul03_23:32:14 more lstr and str added INTEGER I,lstr,lstr1,lstr2,lstr3,start character*40 Str,Str1,Str2,Str3 INTEGER LenStr logical p1,p2 C@tno jcp 1997Jul24_14:42:49 npoints added integer npoints,j real pres1,pres2 C@lbl bvs 1997Oct20 declare pos integer pos Fratio=1.0 Mp1=1.0 Pcor=1.0 do 200 i=1,NL start=pLiLDat(i) C@empa aw 2000jun30 only if linktype has been defined if (start.ne.0) THEN if (Ldat(start).eq.2) then c this is a fan C@tno jcp 1997Jul28_10:55:21 changed fan flag1 and 2 use coef, 3 use datapairs CC if (Ldat(start+1).eq.1) then if (Ldat(start+1).lt. 2.5) then c use coef p1=.false. p2=.false. C0=ldat(start+12-1) pmin=LDat(start+8-1) pmax=LDat(start+9-1) C@empa aw 2005apr27 get RhoI RhoI=Ldat(start+3) C@empa aw 1998jul07 Double precision CC Dp1=-(Pmin+1E-8) Dp1=-(DBLE(Pmin)+1d-8) C this is a pressure in the poly c write (cof,*) 'Pmin=',Pmin c write (cof,*) 'Dp1=',Dp1 CALL Fan (Fma1,DFma,Dp1,LDAT(start),Fratio,Mp1*PCor) c write (cof,*) 'fan',i,' pmin=',Dp1,'fma =',fma1 C@empa aw 1998jul07 Double precision CC Dp=-(Pmin-1E-8) Dp=-(DBLE(Pmin)-1d-8) c this is in the linear part c write (cof,*) 'Dp=',Dp CALL Fan (Fma3,DFma,Dp,LDAT(start),Fratio,Mp1*PCor) c write (cof,*) 'fan',i,' pmin=', Dp,'fma =',fma3 C@tno jcp 1997Jul03_22:33:30 CC if (ABS(Fma1-fma2).gt.2E-5) then if (ABS(Fma1-fma3).gt.ABS(2.0E-5*C0)) then Call RelDis(Pmin,4,Str,Lstr,0) Call RelDis((2.0E-5*C0),4,Str1,Lstr1,1) CALL INERR('Link='//LiNa(I)(1:lenstr(Lina(i)))// & ', type='//LiTyNa(i)(1:lenstr(LiTyNa(i)))// & '. Linear and Polynomial ' & 'part don''t match at Pmin '//Str(1:Lstr)//' Pa', & 'Deviation is more than '//Str1(1:Lstr1)//' kg/s'// & ' Pmin, Pmax, Slope and Intercept will be updated.' & ,.FALSE.,1) p1=.true. C@empa aw 2005apr28 this belongs to the above message therefore it should go to C@empa aw 2005apr28 CRT and CER instead of COF C@empa aw 2005apr28 print -dp as dp is negative but the input values for pmin are positive CC write (cof,*) 'At ',dp1,' Pa fma =',fma1 CC write (cof,*) 'At ', dp,' Pa fma =',fma3 write (CRT,*) 'At ',-dp1,' Pa fma =',fma1 write (CRT,*) 'At ', -dp,' Pa fma =',fma3 write (CER,*) 'At ',-dp1,' Pa fma =',fma1 write (CER,*) 'At ', -dp,' Pa fma =',fma3 end if C@lbl bvs 11Feb1997 testing smaller value C@empa aw 1998jul07 Double precision CC Dp1=-(Pmax-1E-5) CC Dp2=-(Pmax-1E-8) Dp2=-(DBLE(Pmax)-1d-8) C this is in the curve c write (cof,*) 'Pmax=',Pmax c write (cof,*) 'Dp1=',Dp1 c write (cof,*) 'Mp1=',Mp1 c write (cof,*) 'Pcor=',Pcor c write (cof,*) 'Ldat10=',Ldat(start+10-1) c write (cof,*) 'Ldat11=',Ldat(start+11-1) c write (cof,*) 'Ldat12=',Ldat(start+12-1) c write (cof,*) 'Ldat13=',Ldat(start+13-1) c write (cof,*) 'Ldat14=',Ldat(start+14-1) CALL Fan (Fma2,DFma,Dp2,LDAT(start),Fratio,Mp1*PCor) c write (cof,*) 'fan',i,' pmax=',Dp1,'fma =',fma2 C@lbl bvs 11Feb1997 testing smaller value C@empa aw 1998jul07 Double precision CC Dp=-(Pmax+1E-5) CC Dp=-(Pmax+1E-8) Dp=-(DBLE(Pmax)+1d-8) c this is in the linear part c write (cof,*) 'Dp=',Dp CALL Fan (Fma3,DFma,Dp,LDAT(start),Fratio,Mp1*PCor) c write (cof,*) 'fan',i,' pmax=', Dp,'fma =',fma3 C@tno jcp 1997Jul03_22:34:55 CC if (ABS(Fma3-fma2).gt.1E-5) then if (ABS(Fma3-fma2).gt.ABS(2.0E-5*C0)) then Call RelDis(Pmax,4,Str,Lstr,0) Call RelDis((2.0E-5*C0),4,Str1,Lstr1,1) CALL INERR('Link='//LiNa(I)(1:lenstr(Lina(i)))// & ', type='//LiTyNa(i)(1:lenstr(LiTyNa(i)))// & ' Linear and Polynomial ' & 'part don''t match at Pmax '//Str(1:Lstr)//' Pa', & 'Deviation is more than '//Str1(1:Lstr1)//' kg/s.'// & ' Pmin, Pmax, Slope and Intercept will be updated.' & ,.FALSE.,1) p2=.TRUE. C@empa aw 2005apr28 this belongs to the above message therefore it should go to C@empa aw 2005apr28 CRT and CER instead of COF C@empa aw 2005apr28 print -dp as dp is negative but the input values for pmax are positive CC write (cof,*) 'At ',dp2,' Pa fma =',fma2 CC write (cof,*) 'At ', dp,' Pa fma =',fma3 write (CRT,*) 'At ',-dp2,' Pa fma =',fma2 write (CRT,*) 'At ', -dp,' Pa fma =',fma3 write (CER,*) 'At ',-dp2,' Pa fma =',fma2 write (CER,*) 'At ', -dp,' Pa fma =',fma3 end if c write (cof,*) 'link',i,' is a fan' if (p1 .or. p2) then c pmin=dp1 C@ema aw 1998jul07 sign changed C ldat(start+8-1)=dp1 ldat(start+8-1)=-dp1 c pmax=dp2 C ldat(start+9-1)=dp2 ldat(start+9-1)=-dp2 if (dp1.ne.dp2) then C@empa aw 1998jul14 sign changed C slope=(fma2-fma1)/(dp2-dp1) slope=-(fma2-fma1)/(dp2-dp1) else end if if (dp1.eq.0) then intercept=fma1 else intercept=fma1-dp1*slope end if ldat(start+10-1)=slope ldat(start+11-1)=intercept C@empa aw 2005apr27 give the values in input units, then the user may copy paste them into CIF slope=slope*ABS(ifact(UnitP))/ & (ifact(UnitFva)*RhoI**ifact(UnitFvFlag)) intercept=intercept/ & (ifact(UnitFva)*RhoI**ifact(UnitFvFlag)) dp1=dp1/ABS(ifact(UnitP)) dp2=dp2/ABS(ifact(UnitP)) Call RelDis(REAL(-dp1),7,Str,Lstr,1) Call RelDis(REAL(-dp2),7,Str1,Lstr1,1) Call RelDis(slope,10,Str2,Lstr2,1) Call RelDis(intercept,10,Str3,Lstr3,1) CALL INERR('Link='//LiNa(I)(1:lenstr(Lina(i)))// & ', type='//LiTyNa(i)(1:lenstr(LiTyNa(i)))// & ' updated:', & ' pmin='//str(1:lstr)//' '//iunit(unitP)// & 'pmax='//str1(1:lstr1)//' '//iunit(unitP) & //'; slope = '//str2(1:lstr2)//' '// & iunit(unitFva)(1:lenstr(iunit(unitFva)))//'/'//iunit(unitP) & //'; intercept = '//str3(1:lstr3)//' '// & iunit(unitFva),.FALSE.,0) end if C@tno jcp 1997Jul24_14:43:06 else part for check of fan datapoints added else C@tno jcp 1997Jul28_10:56:56 c flag>=3 C use datapoints and thus the catmul interpolation C check if the pressure points are in rising order npoints=ldat(start+18-1) pres1=ldat(start+19-1) do 180 j=1,npoints pos=(j-1)*2+19 pres2=ldat(start+pos-1) if (pres2.lt.pres1) then Call RelDis(pres1,7,Str,Lstr,1) Call RelDis(pres2,7,Str2,Lstr2,1) Call Inerr('Fan data points: '//str(1:lstr)//',' & //str2(1:lstr2) & ,'Fan data points: Pressure must be in ascending order', & .false.,2) end if C@lbl bvs 1997Nov19 lastdp not used anymore CC lastdp=dp 180 continue end if C end if Ldat(start+1)=1 (use coef) end if C end if Ldat(start)=2 C@empa aw 2000jun30 C end if Linktype has been defined endif 200 continue RETURN END C end of routine CheckFan Ch*********************************************************************** INTEGER FUNCTION iCheckNet() C*********************************************************************** C Purpose: iCheckNet checks the zones in the ventilation network. C There must be a path (via links) to all zones. C There can't be two ore more isolated networks. C There must be at least one link to a known pressure (an external C or special pressure) C C Approach: C A matrix of zones is made which contains a 1 if a link exists and C a 0 if no link exists C C Two arrays are made: Zone(Nz), Look(Nz) C C iIsland is a number 1,2,3.. which is given to the zones. It indicates C a group of zones that is connected. C If all is OK all zones are on iIsland=1 and are connected. C If more iIslands are used we have indepentent networks. The input C must be corrected and a link must be made between the one or more C zones of independent islands. C C Starting at zone 1, all zones first get a zero assigned in Zone(*). C All reachable zones get the first island number if they are found C in &-NET-LINks. Zone(iZone)=iIsland. C If still more zones exist they will get the next island number and C so on. C Zones with Zone(*)=0 are not found in &-NET-LINk which is an error in C the input. C Zones with Zone(*)>1 are on an other island and must be linked to C island 1. This too is an error in the input. C C Finally is checked whether there is at least one link from a zone to C a known pressure. C C During the search, zones just reached for the first time are also C set in Look(iZone). A further search is made from those zones in C Look(*). C C Pass parameters: C C IO # Name unit description C return value: C 1= OK C 0= Not OK Ch*********************************************************************** IMPLICIT NONE INCLUDE 'comv-uni.inc' INCLUDE 'comv-inp.inc' INTEGER Zone(MaxZ),Look(MaxZ),LM(MaxZ,MaxZ) INTEGER i,j,OK,From,To,iZone,Lst,NotExt,Iisland, & Ilook,minimum C@empa aw 1999nov29 initialize iCheckNet iCheckNet=0 if (test.ge.1) then write(cof,*) '**********************************' write(cof,*) 'Checking the Links to all Zones *' write(cof,*) '**********************************' end if C zero all arrays do 1 i=1,NZ Zone(i)=-1 Look(i)=0 do 1 j=1,nz LM(i,j)=0 1 continue C Fill the matrix LM(Nz,Nz) DO 10 I=1,NL c Check if there is an external connection to a known pressure C Lstat is the link status: C Lstat From To C 0 zone zone C 1 ext zone C 2 spec zone C 3 zone ext C 4 ext ext C 5 spec ext C 6 zone spec C 7 ext spec C 8 spec spec Lst=Lstat(i) From=FromTo(1,i) To=FromTo(2,i) C@empa aw 1999nov29 If a zone ID was not found in routine FRTO, From or To is zero C@empa here. In order not to produce a Fortran error we go out of this C@empa routine here. A Comis error message is already written in FRTO. C@empa And we get an other error message, because iCheckNet is not 1. IF ((From.EQ.0).OR.(To.EQ.0)) GOTO 920 c check the type of link c c a non zero crack, window is always ok c a fan which is not a constant flowrate is ok c a flowcontroller, not a constant flowrate, is (probably) ok c a TD, not a constant flow rate, is ok OK=1 if (Lstat(i).eq.0) then if (from.ne.to) then LM(from,to)=OK LM(to,from)=OK end if end if if ((Lst.eq.1) .or. (Lst.eq.2)) then C Lstat=1 or 2 known pressure - zone LM(to,to)=1 end if if ((Lst.eq.3) .or. (Lst.eq.6)) then C Lstat=3 or 6 zone - known pressure LM(from,from)=1 end if 10 CONTINUE c write(*,*) LM(1,1),LM(1,2),LM(1,3),LM(1,4),LM(1,5),LM(1,6) c write(*,*) LM(2,1),LM(2,2),LM(2,3),LM(2,4),LM(2,5),LM(2,6) c write(*,*) LM(3,1),LM(3,2),LM(3,3),LM(3,4),LM(3,5),LM(3,6) c write(*,*) LM(4,1),LM(4,2),LM(4,3),LM(4,4),LM(4,5),LM(4,6) c write(*,*) LM(5,1),LM(5,2),LM(5,3),LM(5,4),LM(5,5),LM(5,6) c write(*,*) LM(6,1),LM(6,2),LM(6,3),LM(6,4),LM(6,5),LM(6,6) NotExt=0 iIsland=0 C 20 is the start of the main loop through the islands 20 Continue iIsland=iIsland+1 C write(*,*) ' Island ', Iisland iZone=0 ilook=0 if (Nz.eq.0) goto 905 C look for a zone that is still zero (not reached) 30 continue izone=izone+1 if (iZone.gt.Nz) GOTO 900 if (Zone(izone).ge.0) GOTO 30 C write(*,*) zone(1),zone(2),zone(3),zone(4),zone(5),zone(6) C write(*,*) ' izone ', izone,' Zone(*)=',zone(izone) C write(*,*) C pause 40 continue C Look for zoneslinked to iZone and fill the island number in those linked C zones: Zone(*)=iIsland where *=linked with iZone call connect(LM,Zone,Look,iZone,iLook,iIsland) C at return iLook contains the last zone reached from iZone if (iLook.gt.0) then C quickly take the just found zone with number iLook and look for its C connections izone=ilook Look(ilook)=0 C write(*,*) ' Ilook:izone ', izone,' Zone(*)=',zone(izone) goto 40 end if C See if there are other zonenumbers in Look to start a discovery to linked C zones Call NotZero(Look,iLook) if (iLook.gt.0) then C take this next zone with number iLook to look for its connections izone=ilook Look(ilook)=0 C write(*,*) ' Notzero:ilook ', izone,' Zone(*)=',zone(izone) goto 40 else C no more zones to look at, that have not been reached yet goto 900 end if C if we didn't reach all zones loop again 900 if (Minimum(Zone,Nz).eq.-1) GOTO 20 c Check if there is an external connection to a known pressure if (Nz.eq.0) goto 120 DO 110 I=1,Nz if (LM(i,i).eq.1) then GOTO 120 end if 110 CONTINUE C if we come here not a single OK link to a known pressure is found Write(COF,1001) ' NETWORK ERROR' if (Nz.gt.1) then Write(COF,1001) ' &-NET-ZONe contains',Nz,' zones.' else Write(COF,1001) ' &-NET-ZONe contains',Nz,' zone.' end if Write(COF,*) ' At least one of the zones should be ' & 'connected to a known pressure.' Write(COF,*) ' Two kinds of known pressures exist:' Write(COF,*) ' - external nodes. These have a negative' & ' number in &-NET-LINks' Write(COF,*) ' - special pressures. These have a form ' & 'like nn.nPa (nn.n=a REAL number)' Write(COF,*) ' You have to add such a link to the network.' C set this flag for use below NotExt=1 120 CONTINUE 905 CONTINUE C write(*,*)'iisland=',iisland,' NotExt=',NotExt if (iIsland.ne.1) then Write(COF,1001) ' NETWORK ERROR' Write(COF,1001) ' All zones should be connected, but here' & ' are',iIsland,'isolated groups of zones.' Write(COF,*)' You have to add links, or delete not-used ' & 'zones from &-NET-ZONes.' if (iIsland.gt.2) then Write(COF,1001) ' You have to add at least',iIsland-1, & 'links between those groups.' else Write(COF,1001) ' You have to add at least',iIsland-1, & 'link between those groups.' end if Write(COF,*)' Zones in group 0 are not in &-NET-LIN or ' & 'are connected only to' Write(COF,*)' known pressure(s).' Write(COF,*)' Here follow the zones and the group they ' & 'are in.' Write(COF,*) ' Zone Group Zone name:' do 910 i=1,Nz Write(COF,1000) i,Zone(i),ZoNa(i) 910 continue end if If (NotExt.gt.0) then C Network-error because there is no external (known pressure) in the network. C Set iIslands > 1 to signal an error in the network. iIsland=2 end if C write(*,*)'iisland=',iisland,' NotExt=',NotExt iCheckNet=iIsland 1000 FORMAT (1X,2(I5,1X),2X,A) 1001 FORMAT (1X,A,I3,1X,A) C@empa aw 1999nov29 CONTINUE 920 CONTINUE RETURN END SUBROUTINE Connect(LM,Zone,Look,iZone,iLook,iIsland) Ch*********************************************************************** C Connect is called from iCheckNet C Connect fills the array Zone(iZone) dependent on the linking given in LM C First Zone(izone)=0. C As soon as a new zone is reached for the first time (by a link indicated C in LM) it gets a 1 in Look(*). C If a connection to another zone has been found (iLook>0) then C Zone(izone)=iIsland. C The connections are indicated in the matrix LM(Nz,Nz) with 1. They C represent non-zero links. C C Pass parameters: C C IO # Name unit description C I LM (Nz,Nz) Link matrix contains a 1 for zones linked by a non C zero link C IO Zone (Nz) Array for Zones -1 at start, 0 if handled, 1 if on C island 1, n if on island n C O Look (Nz) all zones with Look(*)=1 have to be taken as next start C point for a further look to connected zones in the C network. These zones are just reached for the first C time C I iZone - Zone number from which a search has to be under taken. C O iLook - Last newly visited zone C I iIsland - All zones, within reach, get this number in Zone(*). C This is the number incremented outside this routine C every time all links of one island have been searched C and still some zones remain out of reach. C Ch*********************************************************************** IMPLICIT NONE INCLUDE 'comv-inp.inc' INTEGER LM(MaxZ,MaxZ),Zone(MaxZ),Look(MaxZ) INTEGER iZone,iLook,iIsland,i iLook=0 C set Zone(*) to 0 to signal that we have been here. A zone not linked in LM C stays 0 if (Zone(iZone).eq.-1) then Zone(iZone)=0 end if do 40 i=1,Nz if (i.ne.izone) then if (LM(Izone,i).gt.0) then C there is a connection from Zone(iZone) to Zone(i) c See if Zone(i) had not been reached yet if(Zone(i).lt.1) then C got one Zone(i)=iIsland C write(*,*)'LM(',izone,i,')>0 island=',iIsland Look(i)=1 iLook=i end if end if end if 40 continue C write(*,*)'in connect:ilook=',iLook if (iLook.gt.0) then Zone(iZone)=iIsland end if return end SUBROUTINE NotZero(Look,iLook) Ch*********************************************************************** C NotZero is called from iCheckNet C NotZero finds the array element in Look that is not zero Ch*********************************************************************** IMPLICIT NONE INCLUDE 'comv-inp.inc' INTEGER Look(MaxZ) INTEGER i,iLook iLook=0 do 40 i=1,Nz if (Look(I).gt.0) then iLook=i Goto 900 end if 40 continue 900 continue Return End INTEGER FUNCTION Minimum(Array,MaxEl) Ch*********************************************************************** C Minimum returns the lowest value in the INTEGER Array(1..Size) Ch*********************************************************************** IMPLICIT NONE INTEGER Array(*) INTEGER i,MaxEl,Mini mini=Array(1) do 40 i=1,MaxEl if (Array(I).lt.mini) then mini=Array(i) end if 40 continue Minimum=mini Return End C@NBI PGS 2000Jul20 - This subroutine was no longer used, so commented out CC SUBROUTINE CheckP1Q2(variable,P1,Q1,P2,Q2) CCCh*********************************************************************** CCC check P1..2 Q1..2 is called from F1..F4 CCC checks values for zero or negative or CCC Q1=Q2 or P1=P2 CCC P1,Q1 .. P2,Q2 is the part of the characteristic of a flow controller CCC where it acts as a fixed opening CCC CCCh*********************************************************************** CC CC IMPLICIT NONE CC include 'comv-inp.inc' CC REAL P1,P2,Q1,Q2 CC Character*(*) variable CC CC if (P1.eq.0) then CC P1=REALMin CC Call Inerr(variable,'P1=zero, and replaced by 1E-37', CC & .true.,1) CC end if CC CC if (Q1.eq.0) then CC Q1=REALMin CC Call Inerr(variable,'F1=zero, and replaced by 1E-37', CC & .true.,1) CC end if CC CC if (P2.eq.0) then CC P2=REALMin CC Call Inerr(variable,'P2=zero, and replaced by 1E-37', CC & .true.,1) CC end if CC CC if (Q2.eq.0) then CC Q2=REALMin CC Call Inerr(variable,'F2=zero, and replaced by 1E-37', CC & .true.,1) CC end if CC CC if (P2.eq.P1) then CC Call Inerr(variable,'P1=P2 They should be different', CC & .true.,2) CC end if CC CCc if (Q2.eq.Q1) then CCc Call Inerr(variable,'F1=F2 They should be different', CCc & .true.,2) CCc end if CC CC if (P1.lt.0) then CC P1=REALMin CC Call Inerr(variable,'P1=zero, and replaced by 1E-37', CC & .true.,2) CC end if CC CC if (Q1.lt.0) then CC Q1=REALMin CC Call Inerr(variable,'F1=zero, and replaced by 1E-37', CC & .true.,2) CC end if CC CC if (P2.lt.0) then CC P2=REALMin CC Call Inerr(variable,'P2=zero, and replaced by 1E-37', CC & .true.,2) CC end if CC CC if (Q2.lt.0) then CC Q2=REALMin CC Call Inerr(variable,'F2=zero, and replaced by 1E-37', CC & .true.,2) CC end if CCc write(*,*) p1,p2,q1,q2 CCc call ho('in checkp1q2','') CC CC Return CC CC End Ch*********************************************************************** SUBROUTINE CheckNames(MSG,Name,n) C*********************************************************************** C Purpose: CheckNames checks wether all usernames are unique C@empa aw 1999nov23 C IMPLICIT NONE CHARACTER*(*) MSG,Name(*) INTEGER i,j,n,LStr,LENSTR DO 10 i=1, n DO 20 j=i+1, n IF (Name(i).EQ.Name(j)) THEN Lstr=LENSTR(Name(i)) Call Inerr(MSG//Name(i)(1:LStr)//' is not unique!', & '',.false.,2) ENDIF 20 CONTINUE 10 CONTINUE RETURN END Ch*********************************************************************** SUBROUTINE CheSchNam(Name,key,line) C*********************************************************************** C@empa aw 2000jan20 C Checks the first character of schedule names against C the convention in the User's Guide C C IO Name description C C I Name Schedule name C I key Keyword number C I line line in CIF beeing processed c c Keyword Keyword Schedule number c number c 23='SCH-MAI' 1 not implemented c 24='SCH-LIN' 2 not implemented c 25='SCH-WIN' 3 c 26='SCH-FAN' 4 c 27='SCH-TEM' 5 c 28='SCH-HUM' 6 c 29='SCH-SIN' 7 c 30='SCH-SOU' 8 c 31='SCH-OCC' 9 C*********************************************************************** IMPLICIT NONE INCLUDE 'comv-inp.inc' CHARACTER Name*10, line*80,SchNam*10,FirstCh*1 INTEGER key,p,p2,p3,lenstr SchNam='WFTHSQO' p=key-24 p2=(key-1)*10+1 p3=p2+lenstr(Keys(p2:p2+9)) FirstCh=Name(2:2) call upperc(FirstCh) if (FirstCh.ne.SchNam(p:p))then call inerr('&-'//Keys(p2:p3)//': Names of'// & ' schedules must begin with *'// SchNam(p:p)//' !', & 'Error in line: '//line,.false.,2) endif RETURN END
//#include "mcp_io.h" #include "display.h" #include "timerTask.h" #include "ledGrid.h" #define OFF false #define ON true #define DEF_BLINK_TIME 500 #define SW_ONOFF_MIN_TIME 50 #define SNDBUFF_LEN 10 #define SNDCMD_TIME 100 #define writeSound(b) mcpWritePB(3, b) #define write4Lamps(a, b) mcpWrite(1, ( mux16[a]<<4) | ((b) & 0xf) ) #define <API key>(b) digitalWrite(D_RES_PIN, (b) ? LOW : HIGH) #define writeStrobes(b) mcpWritePA(2, (b & 0xff)) #define writeSolenoids(a) mcpWrite(0, a) #define RETURNS() mcpReadPB(2) #define SLAM_SW() (digitalRead(SLAM_PIN) == HIGH) #define getSwitch(n) ( ( returns_latch[(n)%8] & bitv[(n)&7)] ) > 0 ? 1 : 0 ) //PROGMEM const char *inpName[] = { "RETURNS" , "SLAM SWITCH" }; //PROGMEM const char *outpName[] = { "STROBES", "SOLENOIDS", "SOUND", "LAMPS", "DISPLAY" }; PROGMEM byte displayInitSeq[] = { CD_DIGIT_CNT | DISPLAY_COLS, CD_DUTY_CYCLE | 0x20, CD_NORMAL_MODE, CD_START_SCAN, 0 }; PROGMEM const uint16_t mux16[16] = // 16 bit mux outputs { 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000 }; PROGMEM const byte bitv[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; enum inputType { RETURNS, SLAM_SW }; enum outputType { STROBES, SOLENOIDS, SOUND, LAMPS, DISPL }; extern const byte D_LD1_PIN; extern const byte D_LD2_PIN; extern const byte D_RES_PIN; extern const byte SLAM_PIN; extern const byte special_lamp[]; extern const byte special_lamp_count; extern const uint16_t solMaxOnTime[]; // single solenoid state struct Solenoid { bool active = false; bool newState = false; bool delayedSwitch = false; //bool fuseCheckReq = false; //byte fuseNum; uint32_t setTime; // time when solenoid has activated uint16_t activePeriod = 0; uint16_t switchDelay = 0; }; Solenoid solen[10]; // (1..9) - 0 not used Solenoid lampSolen[16]; // special 'lamps' //byte sound; uint16_t solenoids; byte strobe; byte lastSwitchClosed; uint32_t <API key>[8]; byte lamps[12]; // lamp states nybbles (groups of 4 lamps) bool lampsUpdate[12]; // hardware lamp-group update-request flags (nybbles) byte returns_latch[8]; uint16_t staticRetCount[8]; byte sndCmdBuf[SNDBUFF_LEN]; byte sndBufIdx = 0; byte sndBufLen = 0; bool sndCmdOut = false; //extern const byte special_lamp[]; // special lamps //extern const byte special_lamp_count; //extern const uint16_t solMaxOnTime[]; void initAPI(); void setSolenoid(byte n, bool active); void setSolenoid(byte n, bool active, uint16_t actPeriod); void setSolenoidDelayed(byte n, bool active, uint16_t swDelay); void resetSolenoids(); void setLamp(byte n, bool state); void set4Lamps(byte set, byte states); bool readLamp(byte n); void resetLamps(); void renderLamps(); void setSound(byte snd); void checkSoundCmd(uint32_t t); void setStrobe(byte n); bool readMatrixSw(byte col, byte row); byte getNextReturns(uint32_t t); void checkSolenoids(uint32_t t); //void <API key>(uint16_t *solTimes); bool isSpecialLamp(byte lamp); // base I/O functions void writeDisplayCtrl(byte ctrl); extern void onEvent(byte n, bool s); // pinSpecific.h void initAPI() { int i; // machine setup writeSolenoids(0); writeSound(0xff); // reset sound output (active low) writeStrobes(0xff); // reset strobes output (active low) resetSolenoids(); resetLamps(); strobe = 0; //sound = 0; initDisplay(); } // sets a solenoid state, updating internal variables // note: // n = [1..9] standard solenoid // n = [10..15] no effect // n = [16..31] "lamp" solenoid 0..15 void setSolenoid(byte n, bool active) { Solenoid *sol; bool specialSol; if (n < 1 || n > 32) return; if (n > 9 && n < 16) return; if (n <= 9) { specialSol = false; sol = &(solen[n]); } else { specialSol = true; sol = &(lampSolen[n-16]); } sol->active = active; sol->newState = active; sol->setTime = millis(); if (!specialSol) { if (n >= 16 && n < 32) setLamp(n & 0xf, active); // lamps 0..15 } else { if (active) solenoids |= bit(n-1); else solenoids &= ~bit(n-1); writeSolenoids(solenoids); } sol->activePeriod = 0; sol->delayedSwitch = false; } // sets a solenoid state, defining active period. // actPeriod updates solenoid attribute also when active = false void setSolenoid(byte n, bool active, uint16_t actPeriod) { setSolenoid(n, active); solen[n].activePeriod = actPeriod; } // sets a solenoid state, defining switch delay: // solenoid state will switch after the specified delay. void setSolenoidDelayed(byte n, bool active, uint16_t swDelay) { Solenoid *sol = &(solen[n]); if (swDelay == 0) { setSolenoid(n, active); return; } sol->newState = active; sol->delayedSwitch = true; sol->setTime = millis(); sol->switchDelay = swDelay; } //void <API key>(byte n, uint16_t actPeriod) { // if (n < 1 || n > 32) return; // solen[n].activePeriod = actPeriod; // resets only normal solenoids (1..9) void resetSolenoids() { Solenoid *sol; for (byte n=1; n<=9; n++) { sol = &(solen[n]); sol->active = false; sol->newState = false; sol->activePeriod = 0; sol->delayedSwitch = false; } solenoids = 0; writeSolenoids(0); } // set a lamp on or off, with status memory void setLamp(byte n, bool state) { byte b, set; if (n > 47) return; set = n / 4; b = 1 << (n % 4); if (state) lamps[set] |= b; else lamps[set] &= (~b); lampsUpdate[set] = true; } void set4Lamps(byte set, byte states) { if (set > 11) return; states &= 0x0f; if (lamps[set] == states) return; lamps[set] = states; lampsUpdate[set] = true; } bool readLamp(byte n) { if (n > 47) return false; return ((lamps[n/4] & bit(n%4)) != 0); } // switch all lamps off void resetLamps() { for (int i=0; i<12; i += 2) { lamps[i] = 0; lampsUpdate[i] = true; } } // to call periodically for real lamps update void renderLamps() { byte i; for (i=0; i<12; i++) { if (lampsUpdate[i]) { write4Lamps(i, lamps[i]); lampsUpdate[i] = false; } } } /* // snd = 0..31 void setSound(byte snd) { sound = snd &= 0x1f; writeSound(~sound); // sound16 light #4 update if (snd & 0x10) lamps[0] |= 0x10; else lamps[0] &= 0xef; write4Lamps(1, (lamps[0] & 0xf0) >> 4); // immediate light #4 update } */ // snd = 0..31 void setSound(byte snd) { byte i; if (sndBufLen >= SNDBUFF_LEN) return; // return on full buffer i = (sndBufIdx + sndBufLen) % SNDBUFF_LEN; // cursor sndCmdBuf[i] = snd; sndBufLen++; } void checkSoundCmd(uint32_t t) { byte snd; if (sndCmdOut) { writeSound(0xff); sndCmdOut = false; } if (sndBufLen == 0) return; snd = sndCmdBuf[sndBufIdx]; if (++sndBufIdx >= SNDBUFF_LEN) sndBufIdx = 0; sndBufLen sndCmdOut = true; // sound16 light #4 update if (snd & 0x10) lamps[0] |= 0x10; else lamps[0] &= 0xef; write4Lamps(1, (lamps[0] & 0xf0) >> 4); // immediate light #4 update writeSound(~snd); } // set one of eight strobes bit to 0 (active low) // n = 0..7 void setStrobe(byte n) { //writeStrobes( ~(((byte)1) << (n & 0b00000111)) ); writeStrobes( ~bitv[n & 7] ); } bool readMatrixSw(byte col, byte row) { byte ret; if (col < 0 || col > 7) return false; if (row < 0 || row > 7) return false; setStrobe(col); ret = ~RETURNS(); returns_latch[col] = ret; return ((ret & bit(row)) != 0); } // 1. reads returns on current strobe line // 2. call special subroutine on any open/closed-switch event (with debounce effect) // 3. increments strobe line for next read byte getNextReturns(uint32_t t) { byte i, ret, diff, b, ss, sw; byte stbx8; ret = RETURNS(); diff = ret ^ returns_latch[strobe]; // return byte changed bits if (diff) { // changes detection stbx8 = strobe << 3; for (i=0; i<8; i++) { // for every bit... b = 1<<i; // bit balue ss = ret & b; // single return bit (switch state) if (diff & b) { // switch has changed ? sw = stbx8 | i; // strobe * 8 + return if (ss) { // switch has closed lastSwitchClosed = sw; <API key>[i] = t; onEvent(sw, true); returns_latch[strobe] = ret; } else { // switch has opened if (lastSwitchClosed == i && t - <API key>[i] >= SW_ONOFF_MIN_TIME) { // debounce condition onEvent(sw, false); returns_latch[strobe] = ret; } } } } //if (ledGridEnabled) setLedRow(strobe, ret); } if (++strobe > 7) strobe = 0; setStrobe(strobe); return ret; } // checks whether: // - delay activation time elapsed (when delayedSwitch = true) // - maximum active time elapsed for safe switch-off void checkSolenoids(uint32_t t) { uint16_t maxTime; Solenoid sol; /* for (byte i=1; i<=32; i++) { if (i >= 10 && i < 16) continue; sol = solen[i]; if (sol.delayedSwitch) { // delayed switch if (t - sol.setTime >= sol.switchDelay) // delay elapsed setSolenoid(i, sol.newState); } if (sol.active) { // solenoid activated ? maxTime = 0; if (solMaxOnTime[i] > 0) maxTime = solMaxOnTime[i]; if (sol.activePeriod > 0 && sol.activePeriod < maxTime) maxTime = sol.activePeriod; if (maxTime > 0) { // limited active-period ? if (t - sol.setTime > maxTime) setSolenoid(i, false); } } } */ for (byte i=1; i<=32; i++) { if (i >= 10 && i < 16) continue; sol = solen[i]; if (sol.active) { // solenoid activated ? maxTime = solMaxOnTime[i]; if (sol.activePeriod > 0 && sol.activePeriod < maxTime) maxTime = sol.activePeriod; if (maxTime > 0) { // limited active-period ? if (t - sol.setTime > maxTime) { setSolenoid(i, false); continue; } } } if (sol.delayedSwitch) { // delayed switch if (t - sol.setTime >= sol.switchDelay) setSolenoid(i, sol.newState); } } } /* void checkSolenoids(uint32_t t) { uint16_t stdTime, maxTime; uint32_t dt; for (byte i=1; i<32; i++) { if (i >= 10 && i < 16) continue; if (solen[i].active) { // solenoid activated? stdTime = solen[i].activePeriod; maxTime = solMaxOnTime[i]; dt = t - solen[i].setTime; if ( (maxTime > 0 && dt > maxTime) || (stdTime > 0 && dt > stdTime) ) setSolenoid(i, false); } } } */ bool isSpecialLamp(byte lamp) { byte i; if (lamp > 47) return false; i = 0; while (i < special_lamp_count) if (lamp == special_lamp[i++]) return true; return false; } // bit 0: LD1 (active high) // bit 1: LD2 (active high) // bit 2: RESET (active low) void writeDisplayCtrl(byte ctrl) { digitalWrite(D_LD1_PIN, ((ctrl & 1) != 0) ? HIGH : LOW); digitalWrite(D_LD2_PIN, ((ctrl & 2) != 0) ? HIGH : LOW); digitalWrite(D_RES_PIN, ((ctrl & 4) != 0) ? HIGH : LOW); }
<?xml version="1.0" ?><!DOCTYPE TS><TS language="he" version="2.0"> <context> <name>ACLJobDelegate</name> <message> <location filename="../src/libtomahawk/jobview/AclJobItem.cpp" line="67"/> <source>Allow %1 to connect and stream from you?</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/jobview/AclJobItem.cpp" line="83"/> <source>Allow Streaming</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/jobview/AclJobItem.cpp" line="86"/> <source>Deny Access</source> <translation type="unfinished"/> </message> </context> <context> <name>ACLJobItem</name> <message> <location filename="../src/libtomahawk/jobview/AclJobItem.cpp" line="185"/> <source>Tomahawk needs you to decide whether %1 is allowed to connect.</source> <translation type="unfinished"/> </message> </context> <context> <name><API key></name> <message> <location filename="../src/libtomahawk/accounts/<API key>.cpp" line="42"/> <source>Add Account</source> <translation type="unfinished"/> </message> </context> <context> <name><API key></name> <message> <location filename="../src/libtomahawk/accounts/<API key>.cpp" line="103"/> <source>Online</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/<API key>.cpp" line="108"/> <source>Connecting...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/<API key>.cpp" line="113"/> <source>Offline</source> <translation type="unfinished"/> </message> </context> <context> <name>AccountListWidget</name> <message> <location filename="../src/tomahawk/widgets/AccountListWidget.cpp" line="64"/> <source>Connections</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/widgets/AccountListWidget.cpp" line="72"/> <location filename="../src/tomahawk/widgets/AccountListWidget.cpp" line="243"/> <source>Connect &amp;All</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/widgets/AccountListWidget.cpp" line="242"/> <source>Disconnect &amp;All</source> <translation type="unfinished"/> </message> </context> <context> <name>AccountWidget</name> <message> <location filename="../src/tomahawk/widgets/AccountWidget.cpp" line="131"/> <source>Invite</source> <translation type="unfinished"/> </message> </context> <context> <name>AccountsToolButton</name> <message> <location filename="../src/tomahawk/widgets/AccountsToolButton.cpp" line="90"/> <source>Configure Accounts</source> <translation type="unfinished"/> </message> </context> <context> <name>ActionCollection</name> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="65"/> <source>&amp;Listen Along</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="68"/> <source>Stop &amp;Listening Along</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="72"/> <source>&amp;Follow in Real-Time</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="77"/> <source>&amp;Listen Privately</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="82"/> <source>&amp;Load Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="83"/> <source>&amp;Load Station</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="84"/> <source>&amp;Rename Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="85"/> <source>&amp;Rename Station</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="86"/> <source>&amp;Copy Playlist Link</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="87"/> <source>&amp;Play</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="91"/> <source>&amp;Stop</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="92"/> <source>&amp;Previous Track</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="95"/> <source>&amp;Next Track</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="98"/> <source>&amp;Quit</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="112"/> <source>U&amp;pdate Collection</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="113"/> <source>Fully &amp;Rescan Collection</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="111"/> <source>Import Playlist...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="114"/> <source>Show Offline Friends</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="116"/> <source>&amp;Configure Tomahawk...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="119"/> <source>Minimize</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="121"/> <source>Zoom</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="123"/> <source>Enter Full Screen</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="126"/> <source>Hide Menu Bar</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="130"/> <source>Diagnostics...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="132"/> <source>About &amp;Tomahawk...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="134"/> <source>&amp;Legal Information...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="136"/> <source>&amp;View Logfile</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="139"/> <source>Check For Updates...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="143"/> <source>0.8</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="145"/> <source>Report a Bug</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="146"/> <source>Get Support</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="147"/> <source>Help Us Translate</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="157"/> <source>&amp;Controls</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="172"/> <source>&amp;Settings</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="179"/> <source>&amp;Help</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="188"/> <location filename="../src/libtomahawk/ActionCollection.cpp" line="258"/> <source>What&apos;s New in ...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="214"/> <source>&amp;Window</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ActionCollection.cpp" line="231"/> <source>Main Menu</source> <translation type="unfinished"/> </message> </context> <context> <name>AlbumInfoWidget</name> <message> <location filename="../src/libtomahawk/viewpages/AlbumViewPage.cpp" line="62"/> <source>Album Details</source> <translation type="unfinished"/> </message> </context> <context> <name>AlbumModel</name> <message> <location filename="../src/libtomahawk/playlist/AlbumModel.cpp" line="61"/> <location filename="../src/libtomahawk/playlist/AlbumModel.cpp" line="98"/> <source>All albums from %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/AlbumModel.cpp" line="100"/> <source>All albums</source> <translation type="unfinished"/> </message> </context> <context> <name>ArtistInfoWidget</name> <message> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.ui" line="50"/> <source>Top Albums</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.ui" line="110"/> <source>Top Hits</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.ui" line="76"/> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.ui" line="136"/> <source>Show More</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.ui" line="173"/> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.cpp" line="147"/> <source>Biography</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.ui" line="267"/> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.cpp" line="148"/> <source>Related Artists</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.cpp" line="94"/> <source>Sorry, we could not find any albums for this artist!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.cpp" line="73"/> <source>Sorry, we could not find any related artists!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.cpp" line="115"/> <source>Sorry, we could not find any top hits for this artist!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.cpp" line="146"/> <source>Music</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.cpp" line="185"/> <source>Songs</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/ArtistViewPage.cpp" line="201"/> <source>Albums</source> <translation type="unfinished"/> </message> </context> <context> <name>AudioControls</name> <message> <location filename="../src/tomahawk/AudioControls.cpp" line="109"/> <location filename="../src/tomahawk/AudioControls.cpp" line="341"/> <source>Shuffle</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/AudioControls.cpp" line="110"/> <location filename="../src/tomahawk/AudioControls.cpp" line="342"/> <source>Repeat</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/AudioControls.cpp" line="339"/> <source>Time Elapsed</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/AudioControls.cpp" line="340"/> <source>Time Remaining</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/AudioControls.cpp" line="345"/> <source>Playing from %1</source> <translation type="unfinished"/> </message> </context> <context> <name>AudioEngine</name> <message> <location filename="../src/libtomahawk/audio/AudioEngine.cpp" line="912"/> <source>Sorry, Tomahawk couldn&apos;t find the track &apos;%1&apos; by %2</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/audio/AudioEngine.cpp" line="936"/> <source>Sorry, Tomahawk couldn&apos;t find the artist &apos;%1&apos;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/audio/AudioEngine.cpp" line="962"/> <source>Sorry, Tomahawk couldn&apos;t find the album &apos;%1&apos; by %2</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/audio/AudioEngine.cpp" line="999"/> <source>Sorry, couldn&apos;t find any playable tracks</source> <translation type="unfinished"/> </message> </context> <context> <name>CaptionLabel</name> <message> <location filename="../src/libtomahawk/widgets/CaptionLabel.cpp" line="71"/> <source>Close</source> <translation type="unfinished"/> </message> </context> <context> <name>CategoryAddItem</name> <message> <location filename="../src/tomahawk/sourcetree/items/CategoryItems.cpp" line="65"/> <source>Create new Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/CategoryItems.cpp" line="68"/> <source>Create new Station</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/CategoryItems.cpp" line="186"/> <location filename="../src/tomahawk/sourcetree/items/CategoryItems.cpp" line="295"/> <source>New Station</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/CategoryItems.cpp" line="186"/> <location filename="../src/tomahawk/sourcetree/items/CategoryItems.cpp" line="295"/> <source>%1 Station</source> <translation type="unfinished"/> </message> </context> <context> <name>CategoryItem</name> <message> <location filename="../src/tomahawk/sourcetree/items/CategoryItems.cpp" line="391"/> <source>Playlists</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/CategoryItems.cpp" line="393"/> <source>Stations</source> <translation type="unfinished"/> </message> </context> <context> <name>ClearButton</name> <message> <location filename="../src/libtomahawk/widgets/searchlineedit/ClearButton.cpp" line="38"/> <source>Clear</source> <translation type="unfinished"/> </message> </context> <context> <name>CollectionItem</name> <message> <location filename="../src/tomahawk/sourcetree/items/CollectionItem.cpp" line="38"/> <source>Collection</source> <translation type="unfinished"/> </message> </context> <context> <name>CollectionViewPage</name> <message> <location filename="../src/libtomahawk/viewpages/CollectionViewPage.cpp" line="83"/> <source>Sorry, there are no albums in this collection!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/CollectionViewPage.cpp" line="95"/> <source>Artists</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/CollectionViewPage.cpp" line="96"/> <source>Albums</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/CollectionViewPage.cpp" line="97"/> <source>Songs</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/CollectionViewPage.cpp" line="125"/> <source>Download All</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/CollectionViewPage.cpp" line="430"/> <source>After you have scanned your music collection you will find your tracks right here.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/CollectionViewPage.cpp" line="433"/> <source>This collection is empty.</source> <translation type="unfinished"/> </message> </context> <context> <name>ColumnItemDelegate</name> <message> <location filename="../src/libtomahawk/playlist/ColumnItemDelegate.cpp" line="191"/> <source>Unknown</source> <translation type="unfinished"/> </message> </context> <context> <name>ColumnView</name> <message> <location filename="../src/libtomahawk/playlist/ColumnView.cpp" line="284"/> <source>Sorry, your filter &apos;%1&apos; did not match any results.</source> <translation type="unfinished"/> </message> </context> <context> <name><API key></name> <message> <location filename="../src/libtomahawk/playlist/<API key>.cpp" line="111"/> <source>Composer:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/<API key>.cpp" line="118"/> <source>Duration:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/<API key>.cpp" line="125"/> <source>Bitrate:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/<API key>.cpp" line="132"/> <source>Year:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/<API key>.cpp" line="139"/> <source>Age:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/<API key>.cpp" line="217"/> <source>%1 kbps</source> <translation type="unfinished"/> </message> </context> <context> <name>ContextView</name> <message> <location filename="../src/libtomahawk/playlist/ContextView.cpp" line="137"/> <source>Playlist Details</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/ContextView.cpp" line="244"/> <source>This playlist is currently empty.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/ContextView.cpp" line="246"/> <source>This playlist is currently empty. Add some tracks to it and enjoy the music!</source> <translation type="unfinished"/> </message> </context> <context> <name><API key></name> <message> <location filename="../src/libtomahawk/accounts/<API key>.cpp" line="39"/> <source>%1 Config</source> <comment>Window title for account config windows</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/<API key>.cpp" line="60"/> <source>About</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/<API key>.cpp" line="92"/> <source>Delete Account</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/<API key>.cpp" line="121"/> <source>Config Error</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/<API key>.cpp" line="177"/> <source>About this Account</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/<API key>.cpp" line="230"/> <source>Your config is invalid.</source> <translation type="unfinished"/> </message> </context> <context> <name>DiagnosticsDialog</name> <message> <location filename="../src/tomahawk/dialogs/DiagnosticsDialog.ui" line="20"/> <source>Tomahawk Diagnostics</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/DiagnosticsDialog.ui" line="42"/> <source>&amp;Copy to Clipboard</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/DiagnosticsDialog.ui" line="49"/> <source>Open &amp;Log-file</source> <translation type="unfinished"/> </message> </context> <context> <name>DownloadManager</name> <message> <location filename="../src/libtomahawk/DownloadManager.cpp" line="260"/> <source>Tomahawk finished downloading %1 by %2.</source> <translation type="unfinished"/> </message> </context> <context> <name>EchonestSteerer</name> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="63"/> <source>Steer this station:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="86"/> <source>Much less</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="87"/> <source>Less</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="88"/> <source>A bit less</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="89"/> <source>Keep at current</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="90"/> <source>A bit more</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="91"/> <source>More</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="92"/> <source>Much more</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="95"/> <source>Tempo</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="96"/> <source>Loudness</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="97"/> <source>Danceability</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="98"/> <source>Energy</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="99"/> <source>Song Hotttnesss</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="100"/> <source>Artist Hotttnesss</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="101"/> <source>Artist Familiarity</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="102"/> <source>By Description</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="110"/> <source>Enter a description</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="117"/> <source>Apply steering command</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="123"/> <source>Reset all steering commands</source> <translation type="unfinished"/> </message> </context> <context> <name>FilterHeader</name> <message> <location filename="../src/libtomahawk/widgets/FilterHeader.cpp" line="29"/> <source>Filter...</source> <translation type="unfinished"/> </message> </context> <context> <name>GlobalActionManager</name> <message> <location filename="../src/libtomahawk/GlobalActionManager.cpp" line="127"/> <source>Resolver installation from file %1 failed.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/GlobalActionManager.cpp" line="135"/> <source>Install plug-in</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/GlobalActionManager.cpp" line="136"/> <source>&lt;b&gt;%1&lt;/b&gt; %2&lt;br/&gt;by &lt;b&gt;%3&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;You are attempting to install a Tomahawk plug-in from an unknown source. Plug-ins from untrusted sources may put your data at risk.&lt;br/&gt;Do you want to install this plug-in?</source> <translation type="unfinished"/> </message> </context> <context> <name><API key></name> <message> <location filename="../src/accounts/hatchet/account/<API key>.ui" line="33"/> <source>Connect to your Hatchet account</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/hatchet/account/<API key>.ui" line="43"/> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;http://blog.hatchet.is&quot;&gt;Learn More&lt;/a&gt; and/or &lt;a href=&quot;http://hatchet.is/register&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Create Account&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/hatchet/account/<API key>.ui" line="78"/> <source>Enter One-time Password (OTP)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/hatchet/account/<API key>.ui" line="86"/> <source>Username</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/hatchet/account/<API key>.ui" line="93"/> <source>Hatchet username</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/hatchet/account/<API key>.ui" line="100"/> <source>Password:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/hatchet/account/<API key>.ui" line="113"/> <source>Hatchet password</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/hatchet/account/<API key>.ui" line="154"/> <source>Login</source> <translation type="unfinished"/> </message> </context> <context> <name>HeaderWidget</name> <message> <location filename="../src/libtomahawk/widgets/HeaderWidget.ui" line="73"/> <source>Refresh</source> <translation type="unfinished"/> </message> </context> <context> <name>HistoryWidget</name> <message> <location filename="../src/libtomahawk/widgets/HistoryWidget.cpp" line="46"/> <source>Recently Played Tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/widgets/HistoryWidget.cpp" line="49"/> <source>Your recently played tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/widgets/HistoryWidget.cpp" line="51"/> <source>%1&apos;s recently played tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/widgets/HistoryWidget.cpp" line="57"/> <source>Sorry, we could not find any recent plays!</source> <translation type="unfinished"/> </message> </context> <context> <name>HostDialog</name> <message> <location filename="../src/tomahawk/dialogs/HostDialog.ui" line="17"/> <source>Host Settings</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/HostDialog.ui" line="35"/> <source>Configure your external IP address or host name here. Make sure to manually forward the selected port to this host on your router.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/HostDialog.ui" line="53"/> <source>Static Host Name:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/HostDialog.ui" line="69"/> <source>Static Port:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/HostDialog.ui" line="106"/> <source>Automatically detect external IP address</source> <translation type="unfinished"/> </message> </context> <context> <name>InboxItem</name> <message> <location filename="../src/tomahawk/sourcetree/items/InboxItem.cpp" line="35"/> <source>Inbox</source> <translation type="unfinished"/> </message> </context> <context> <name>InboxJobItem</name> <message> <location filename="../src/libtomahawk/jobview/InboxJobItem.cpp" line="67"/> <source>Sent %1 by %2 to %3.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/jobview/InboxJobItem.cpp" line="72"/> <source>%1 sent you %2 by %3.</source> <translation type="unfinished"/> </message> </context> <context> <name>InboxPage</name> <message> <location filename="../src/libtomahawk/playlist/InboxView.cpp" line="84"/> <source>Inbox Details</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/InboxView.cpp" line="93"/> <source>Your friends have not shared any recommendations with you yet. Connect with them and share your musical gems!</source> <translation type="unfinished"/> </message> </context> <context> <name>IndexingJobItem</name> <message> <location filename="../src/libtomahawk/jobview/IndexingJobItem.cpp" line="33"/> <source>Indexing Music Library</source> <translation type="unfinished"/> </message> </context> <context> <name>LastFmConfig</name> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.ui" line="38"/> <source>Scrobble tracks to Last.fm</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.ui" line="47"/> <source>Username:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.ui" line="57"/> <source>Password:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.ui" line="73"/> <source>Test Login</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.ui" line="80"/> <source>Import Playback History</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.ui" line="87"/> <source>Synchronize Loved Tracks</source> <translation type="unfinished"/> </message> </context> <context> <name>LatchedStatusItem</name> <message> <location filename="../src/libtomahawk/jobview/LatchedStatusItem.cpp" line="33"/> <source>%1 is listening along with you!</source> <translation type="unfinished"/> </message> </context> <context> <name>LoadPlaylist</name> <message> <location filename="../src/tomahawk/dialogs/LoadPlaylistDialog.ui" line="14"/> <source>Load Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/LoadPlaylistDialog.ui" line="20"/> <source>Enter the URL of the hosted playlist (e.g. .xspf format) or click the button to select a local M3U of XSPF playlist to import.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/LoadPlaylistDialog.ui" line="35"/> <source>Playlist URL</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/LoadPlaylistDialog.ui" line="42"/> <source>Enter URL...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/LoadPlaylistDialog.ui" line="55"/> <source>...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/LoadPlaylistDialog.ui" line="64"/> <source>Automatically Update (upon changes to hosted playlist)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/LoadPlaylistDialog.ui" line="79"/> <source>To import a playlist from Spotify, Rdio, Beats, etc. - simply drag the link into Tomahawk.</source> <translation type="unfinished"/> </message> </context> <context> <name>LoadPlaylistDialog</name> <message> <location filename="../src/tomahawk/dialogs/LoadPlaylistDialog.cpp" line="56"/> <source>Load Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/LoadPlaylistDialog.cpp" line="56"/> <source>Playlists (*.xspf *.m3u *.jspf)</source> <translation type="unfinished"/> </message> </context> <context> <name>LovedTracksItem</name> <message> <location filename="../src/tomahawk/sourcetree/items/LovedTracksItem.cpp" line="58"/> <source>Top Loved Tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/LovedTracksItem.cpp" line="60"/> <source>Favorites</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/LovedTracksItem.cpp" line="86"/> <source>Sorry, we could not find any of your Favorites!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/LovedTracksItem.cpp" line="89"/> <source>The most loved tracks from all your friends</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/LovedTracksItem.cpp" line="95"/> <source>All of your loved tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/LovedTracksItem.cpp" line="97"/> <source>All of %1&apos;s loved tracks</source> <translation type="unfinished"/> </message> </context> <context> <name>MetadataEditor</name> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="30"/> <source>Tags</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="39"/> <source>Title:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="49"/> <source>Title...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="56"/> <source>Artist:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="66"/> <source>Artist...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="73"/> <source>Album:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="83"/> <source>Album...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="90"/> <source>Track Number:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="119"/> <source>Duration:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="129"/> <source>00.00</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="136"/> <source>Year:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="162"/> <source>Bitrate:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="183"/> <source>File</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="189"/> <source>File Name:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="199"/> <source>File Name...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="206"/> <source>File Size...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="212"/> <source>File size...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="219"/> <source>File Size:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="235"/> <source>Back</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.ui" line="245"/> <source>Forward</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.cpp" line="185"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.cpp" line="185"/> <source>Could not write tags to file: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/filemetadata/MetadataEditor.cpp" line="396"/> <source>Properties</source> <translation type="unfinished"/> </message> </context> <context> <name><API key></name> <message> <location filename="../src/viewpages/networkactivity/<API key>.ui" line="39"/> <source>Trending Tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/<API key>.ui" line="79"/> <source>Hot Playlists</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/<API key>.ui" line="113"/> <source>Trending Artists</source> <translation type="unfinished"/> </message> </context> <context> <name>PlayableModel</name> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="50"/> <source>Artist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="50"/> <source>Title</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="50"/> <source>Composer</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="50"/> <source>Album</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="50"/> <source>Track</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="50"/> <source>Duration</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="50"/> <source>Download</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="51"/> <source>Bitrate</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="51"/> <source>Age</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="51"/> <source>Year</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="51"/> <source>Size</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="51"/> <source>Origin</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="51"/> <source>Accuracy</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="896"/> <source>Perfect match</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="897"/> <source>Very good match</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="898"/> <source>Good match</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="899"/> <source>Vague match</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="900"/> <source>Bad match</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="901"/> <source>Very bad match</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="902"/> <source>Not available</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="903"/> <source>Searching...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="51"/> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="392"/> <source>Name</source> <translation type="unfinished"/> </message> </context> <context> <name><API key></name> <message> <location filename="../src/libtomahawk/playlist/<API key>.cpp" line="146"/> <location filename="../src/libtomahawk/playlist/<API key>.cpp" line="283"/> <source>Download %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/<API key>.cpp" line="294"/> <location filename="../src/libtomahawk/playlist/<API key>.cpp" line="309"/> <source>View in Finder</source> <translation type="unfinished"/> </message> </context> <context> <name>PlaylistModel</name> <message> <location filename="../src/libtomahawk/playlist/PlaylistModel.cpp" line="144"/> <source>A playlist you created %1.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlaylistModel.cpp" line="149"/> <location filename="../src/libtomahawk/playlist/PlaylistModel.cpp" line="156"/> <source>A playlist by %1, created %2.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlaylistModel.cpp" line="205"/> <source>All tracks by %1 on album %2</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/PlaylistModel.cpp" line="232"/> <source>All tracks by %1</source> <translation type="unfinished"/> </message> </context> <context> <name>ProxyDialog</name> <message> <location filename="../src/tomahawk/dialogs/ProxyDialog.ui" line="17"/> <source>Proxy Settings</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/ProxyDialog.ui" line="37"/> <source>Hostname of proxy server</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/ProxyDialog.ui" line="44"/> <source>Host</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/ProxyDialog.ui" line="51"/> <source>Port</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/ProxyDialog.ui" line="71"/> <source>Proxy login</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/ProxyDialog.ui" line="78"/> <source>User</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/ProxyDialog.ui" line="85"/> <source>Password</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/ProxyDialog.ui" line="95"/> <source>Proxy password</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/ProxyDialog.ui" line="102"/> <source>No Proxy Hosts: (Overrides system proxy)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/ProxyDialog.ui" line="110"/> <source>localhost *.example.com (space separated)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/ProxyDialog.ui" line="127"/> <source>Use proxy for DNS lookups?</source> <translation type="unfinished"/> </message> </context> <context> <name>QObject</name> <message numerus="yes"> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="262"/> <source>%n year(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="264"/> <source>%n year(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="270"/> <source>%n month(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="272"/> <source>%n month(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="278"/> <source>%n week(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="280"/> <source>%n week(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="286"/> <source>%n day(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="288"/> <source>%n day(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="294"/> <source>%n hour(s) ago</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="296"/> <source>%n hour(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="302"/> <source>%1 minutes ago</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="304"/> <source>%1 minutes</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/TomahawkUtils.cpp" line="308"/> <source>just now</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/Account.cpp" line="38"/> <source>Friend Finders</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/Account.cpp" line="40"/> <source>Music Finders</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/Account.cpp" line="43"/> <source>Status Updaters</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="550"/> <source>Songs </source> <comment>Beginning of a sentence summary</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="579"/> <source>No configured filters!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="593"/> <source> and </source> <comment>Inserted between items in a list of two</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="595"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="604"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="608"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="624"/> <source>, </source> <comment>Inserted between items in a list</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="597"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="606"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="622"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="629"/> <source>.</source> <comment>Inserted when ending a sentence summary</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="610"/> <source>, and </source> <comment>Inserted between the last two items in a list of more than two</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="621"/> <source>and </source> <comment>Inserted before the last item in a list</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="629"/> <source>and </source> <comment>Inserted before the sorting summary in a sentence summary</comment> <translation type="unfinished"/> </message> </context> <context> <name>QSQLiteResult</name> <message> <location filename="../src/libtomahawk/database/TomahawkSqlQuery.cpp" line="91"/> <source>No query</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/database/TomahawkSqlQuery.cpp" line="92"/> <source>Parameter count mismatch</source> <translation type="unfinished"/> </message> </context> <context> <name>QueueItem</name> <message> <location filename="../src/tomahawk/sourcetree/items/QueueItem.cpp" line="39"/> <source>Queue</source> <translation type="unfinished"/> </message> </context> <context> <name>QueueView</name> <message> <location filename="../src/libtomahawk/playlist/QueueView.ui" line="41"/> <source>Open Queue</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/QueueView.cpp" line="39"/> <source>Queue Details</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/QueueView.cpp" line="49"/> <source>Queue</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/QueueView.cpp" line="53"/> <source>The queue is currently empty. Drop something to enqueue it!</source> <translation type="unfinished"/> </message> </context> <context> <name><API key></name> <message> <location filename="../src/tomahawk/<API key>.cpp" line="111"/> <source>Not found: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/<API key>.cpp" line="114"/> <source>Failed to load: %1</source> <translation type="unfinished"/> </message> </context> <context> <name>ScannerStatusItem</name> <message> <location filename="../src/libtomahawk/jobview/ScannerStatusItem.cpp" line="55"/> <source>Scanning Collection</source> <translation type="unfinished"/> </message> </context> <context> <name><API key></name> <message> <location filename="../src/libtomahawk/widgets/<API key>.cpp" line="48"/> <source>Reload Collection</source> <translation type="unfinished"/> </message> </context> <context> <name>SearchLineEdit</name> <message> <location filename="../src/libtomahawk/widgets/searchlineedit/SearchLineEdit.cpp" line="58"/> <source>Search</source> <translation type="unfinished"/> </message> </context> <context> <name>SearchWidget</name> <message> <location filename="../src/libtomahawk/viewpages/SearchViewPage.h" line="54"/> <source>Search: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SearchViewPage.h" line="55"/> <source>Results for &apos;%1&apos;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SearchViewPage.ui" line="41"/> <location filename="../src/libtomahawk/viewpages/SearchViewPage.cpp" line="146"/> <source>Songs</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SearchViewPage.ui" line="67"/> <location filename="../src/libtomahawk/viewpages/SearchViewPage.ui" line="127"/> <location filename="../src/libtomahawk/viewpages/SearchViewPage.ui" line="187"/> <source>Show More</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SearchViewPage.ui" line="101"/> <location filename="../src/libtomahawk/viewpages/SearchViewPage.cpp" line="158"/> <source>Artists</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SearchViewPage.ui" line="161"/> <location filename="../src/libtomahawk/viewpages/SearchViewPage.cpp" line="188"/> <source>Albums</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SearchViewPage.cpp" line="65"/> <source>Sorry, we could not find any artists!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SearchViewPage.cpp" line="86"/> <source>Sorry, we could not find any albums!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SearchViewPage.cpp" line="108"/> <source>Sorry, we could not find any songs!</source> <translation type="unfinished"/> </message> </context> <context> <name>Servent</name> <message> <location filename="../src/libtomahawk/network/Servent.cpp" line="1003"/> <source>Automatically detecting external IP failed: Could not parse JSON response.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/network/Servent.cpp" line="1016"/> <source>Automatically detecting external IP failed: %1</source> <translation type="unfinished"/> </message> </context> <context> <name>SettingsDialog</name> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="265"/> <source>Collection</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="268"/> <source>Advanced</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="165"/> <source>All</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="138"/> <source>Install Plug-In...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="326"/> <source>Some changed settings will not take effect until Tomahawk is restarted</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="260"/> <source>Configure the accounts and services used by Tomahawk to search and retrieve music, find your friends and update your status.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="221"/> <source>MP3</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="222"/> <source>FLAC</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="223"/> <source>M4A</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="224"/> <source>MP4</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="260"/> <source>Plug-Ins</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="265"/> <source>Manage how Tomahawk finds music on your computer.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="268"/> <source>Configure Tomahawk&apos;s advanced settings, including network connectivity settings, browser interaction and more.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="273"/> <source>Downloads</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="273"/> <source>Configure Tomahawk&apos;s integrated download manager.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="443"/> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="457"/> <source>Open Directory</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="551"/> <source>Install resolver from file</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="553"/> <source>Tomahawk Resolvers (*.axe *.js);;All files (*)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="570"/> <source>Delete all Access Control entries?</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="571"/> <source>Do you really want to delete all Access Control entries? You will be asked for a decision again for each peer that you connect to.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/SettingsDialog.cpp" line="326"/> <source>Information</source> <translation type="unfinished"/> </message> </context> <context> <name>Settings_Accounts</name> <message> <location filename="../src/tomahawk/dialogs/Settings_Accounts.ui" line="57"/> <source>Filter by Capability:</source> <translation type="unfinished"/> </message> </context> <context> <name>Settings_Advanced</name> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="38"/> <source>Remote Peer Connection Method</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="44"/> <source>Active (your host needs to be directly reachable)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="51"/> <source>UPnP / Automatic Port Forwarding (recommended)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="69"/> <source>Manual Port Forwarding</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="82"/> <source>Host Settings...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="110"/> <source>SOCKS Proxy</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="116"/> <source>Use SOCKS Proxy</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="145"/> <source>Proxy Settings...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="171"/> <source>Other Settings</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="180"/> <source>Allow web browsers to interact with Tomahawk (recommended)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="193"/> <source>Allow other computers to interact with Tomahawk (not recommended yet)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="206"/> <source>Send Tomahawk Crash Reports</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="216"/> <source>Show Notifications on song change</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Advanced.ui" line="244"/> <source>Clear All Access Control Entries</source> <translation type="unfinished"/> </message> </context> <context> <name>Settings_Collection</name> <message> <location filename="../src/tomahawk/dialogs/Settings_Collection.ui" line="38"/> <source>Folders to scan for music:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Collection.ui" line="53"/> <source>Due to the unique way Tomahawk works, your music files must at least have Artist &amp; Title metadata/ID3 tags to be added to your Collection.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Collection.ui" line="76"/> <source>+</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Collection.ui" line="83"/> <source>-</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Collection.ui" line="109"/> <source>The Echo Nest supports keeping track of your catalog metadata and using it to craft personalized radios. Enabling this option will allow you (and all your friends) to create automatic playlists and stations based on your personal taste profile.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Collection.ui" line="115"/> <source>Upload Collection info to enable personalized &quot;User Radio&quot;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Collection.ui" line="128"/> <source>Watch for changes (automatically update Collection)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Collection.ui" line="137"/> <source>Time between scans (in seconds):</source> <translation type="unfinished"/> </message> </context> <context> <name>Settings_Downloads</name> <message> <location filename="../src/tomahawk/dialogs/Settings_Downloads.ui" line="26"/> <source>Some Plug-Ins enable you to purchase and/or download music directly in Tomahawk. Set your preferences for the download format and location:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Downloads.ui" line="49"/> <source>Folder to download music to:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Downloads.ui" line="68"/> <source>Browse...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/dialogs/Settings_Downloads.ui" line="79"/> <source>Preferred download format:</source> <translation type="unfinished"/> </message> </context> <context> <name>SlideSwitchButton</name> <message> <location filename="../src/tomahawk/widgets/SlideSwitchButton.cpp" line="46"/> <source>On</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/widgets/SlideSwitchButton.cpp" line="47"/> <source>Off</source> <translation type="unfinished"/> </message> </context> <context> <name>SocialWidget</name> <message> <location filename="../src/tomahawk/widgets/SocialWidget.ui" line="28"/> <source>Facebook</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/widgets/SocialWidget.ui" line="38"/> <source>Twitter</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/widgets/SocialWidget.cpp" line="71"/> <source>Tweet</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/widgets/SocialWidget.cpp" line="169"/> <source>Listening to &quot;%1&quot; by %2. %3</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/widgets/SocialWidget.cpp" line="171"/> <source>Listening to &quot;%1&quot; by %2 on &quot;%3&quot;. %4</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/widgets/SocialWidget.cpp" line="202"/> <source>%1 characters left</source> <translation type="unfinished"/> </message> </context> <context> <name>SourceDelegate</name> <message> <location filename="../src/tomahawk/sourcetree/SourceDelegate.cpp" line="232"/> <source>All available tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceDelegate.cpp" line="340"/> <source>Drop to send tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceDelegate.cpp" line="403"/> <location filename="../src/tomahawk/sourcetree/SourceDelegate.cpp" line="431"/> <source>Show</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceDelegate.cpp" line="405"/> <location filename="../src/tomahawk/sourcetree/SourceDelegate.cpp" line="433"/> <source>Hide</source> <translation type="unfinished"/> </message> </context> <context> <name>SourceInfoWidget</name> <message> <location filename="../src/libtomahawk/viewpages/SourceViewPage.ui" line="30"/> <source>Recent Albums</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SourceViewPage.ui" line="74"/> <source>Latest Additions</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SourceViewPage.ui" line="88"/> <source>Recently Played Tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SourceViewPage.cpp" line="70"/> <source>New Additions</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SourceViewPage.cpp" line="73"/> <source>My recent activity</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/SourceViewPage.cpp" line="77"/> <source>Recent activity from %1</source> <translation type="unfinished"/> </message> </context> <context> <name>SourceItem</name> <message> <location filename="../src/tomahawk/sourcetree/items/SourceItem.cpp" line="80"/> <location filename="../src/tomahawk/sourcetree/items/SourceItem.cpp" line="586"/> <source>Latest Additions</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/SourceItem.cpp" line="85"/> <source>History</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/SourceItem.cpp" line="149"/> <source>SuperCollection</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/SourceItem.cpp" line="589"/> <source>Latest additions to your collection</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/SourceItem.cpp" line="591"/> <source>Latest additions to %1&apos;s collection</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/SourceItem.cpp" line="595"/> <source>Sorry, we could not find any recent additions!</source> <translation type="unfinished"/> </message> </context> <context> <name>SourceTreeView</name> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="245"/> <source>&amp;Copy Link</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="253"/> <source>&amp;Delete %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="257"/> <source>Add to my Playlists</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="259"/> <source>Add to my Automatic Playlists</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="261"/> <source>Add to my Stations</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="249"/> <source>&amp;Export Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="403"/> <source>playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="407"/> <source>automatic playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="411"/> <source>station</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="440"/> <source>Would you like to delete the %1 &lt;b&gt;&quot;%2&quot;&lt;/b&gt;?</source> <comment>e.g. Would you like to delete the playlist named Foobar?</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="442"/> <source>Delete</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="547"/> <source>Save XSPF</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourceTreeView.cpp" line="548"/> <source>Playlists (*.xspf)</source> <translation type="unfinished"/> </message> </context> <context> <name>SourcesModel</name> <message> <location filename="../src/tomahawk/sourcetree/SourcesModel.cpp" line="96"/> <source>Group</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourcesModel.cpp" line="99"/> <source>Source</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourcesModel.cpp" line="102"/> <source>Collection</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourcesModel.cpp" line="105"/> <source>Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourcesModel.cpp" line="108"/> <source>Automatic Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourcesModel.cpp" line="111"/> <source>Station</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourcesModel.cpp" line="311"/> <source>Cloud Collections</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourcesModel.cpp" line="300"/> <source>Discover</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourcesModel.cpp" line="301"/> <source>Open Pages</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourcesModel.cpp" line="303"/> <source>Your Music</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/SourcesModel.cpp" line="312"/> <source>Friends</source> <translation type="unfinished"/> </message> </context> <context> <name>SpotifyConfig</name> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="69"/> <source>Configure your Spotify account</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="101"/> <source>Username or Facebook Email</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="129"/> <source>Log In</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="136"/> <source>Right click on any Tomahawk playlist to sync it to Spotify.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="153"/> <source>Select All</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="166"/> <source>Sync Starred tracks to Loved tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="179"/> <source>High Quality Streams</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="196"/> <source>Use this to force Spotify to never announce listening data to Social Networks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="199"/> <source>Always run in Private Mode</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="146"/> <source>Spotify playlists to keep in sync:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="189"/> <source>Delete Tomahawk playlist when removing synchronization</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="91"/> <source>Username:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.ui" line="108"/> <source>Password:</source> <translation type="unfinished"/> </message> </context> <context> <name><API key></name> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.cpp" line="351"/> <source>Delete associated Spotify playlist?</source> <translation type="unfinished"/> </message> </context> <context> <name>TemporaryPageItem</name> <message> <location filename="../src/tomahawk/sourcetree/items/TemporaryPageItem.cpp" line="54"/> <source>Copy Artist Link</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/TemporaryPageItem.cpp" line="61"/> <source>Copy Album Link</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/sourcetree/items/TemporaryPageItem.cpp" line="68"/> <source>Copy Track Link</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::AccountDelegate</name> <message> <location filename="../src/libtomahawk/accounts/AccountDelegate.cpp" line="199"/> <source>Add Account</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/AccountDelegate.cpp" line="249"/> <location filename="../src/libtomahawk/accounts/AccountDelegate.cpp" line="666"/> <source>Remove</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/AccountDelegate.cpp" line="363"/> <source>%1 downloads</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/AccountDelegate.cpp" line="567"/> <source>Online</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/AccountDelegate.cpp" line="572"/> <source>Connecting...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/AccountDelegate.cpp" line="577"/> <source>Offline</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::AccountModel</name> <message> <location filename="../src/libtomahawk/accounts/AccountModel.cpp" line="564"/> <source>Manual Install Required</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/AccountModel.cpp" line="567"/> <source>Unfortunately, automatic installation of this resolver is not available or disabled for your platform.&lt;br /&gt;&lt;br /&gt;Please use &quot;Install from file&quot; above, by fetching it from your distribution or compiling it yourself. Further instructions can be found here:&lt;br /&gt;&lt;br /&gt;http: <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::GoogleWrapper</name> <message> <location filename="../src/accounts/google/GoogleWrapper.cpp" line="91"/> <source>Configure this Google Account</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/google/GoogleWrapper.cpp" line="92"/> <source>Google Address:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/google/GoogleWrapper.cpp" line="93"/> <source>Enter your Google login to connect with your friends using Tomahawk!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/google/GoogleWrapper.cpp" line="94"/> <source>username@gmail.com</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/google/GoogleWrapper.cpp" line="101"/> <source>You may need to change your %1Google Account Settings%2 to login.</source> <comment>%1 is &lt;a href&gt;, %2 is &lt;/a&gt;</comment> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::<API key></name> <message> <location filename="../src/accounts/google/GoogleWrapper.h" line="44"/> <source>Login to directly connect to your Google Talk contacts that also use Tomahawk.</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::GoogleWrapperSip</name> <message> <location filename="../src/accounts/google/GoogleWrapper.cpp" line="61"/> <source>Enter Google Address</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/google/GoogleWrapper.cpp" line="69"/> <source>Add Friend</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/google/GoogleWrapper.cpp" line="70"/> <source>Enter Google Address:</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::<API key></name> <message> <location filename="../src/accounts/hatchet/account/<API key>.cpp" line="128"/> <source>Logged in as: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/hatchet/account/<API key>.cpp" line="134"/> <source>Log out</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/hatchet/account/<API key>.cpp" line="156"/> <source>Log in</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/hatchet/account/<API key>.cpp" line="181"/> <source>Continue</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::<API key></name> <message> <location filename="../src/accounts/hatchet/account/HatchetAccount.h" line="51"/> <source>Connect to Hatchet to capture your playback data, sync your playlists to Android and more.</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::<API key></name> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmAccount.h" line="52"/> <source>Scrobble your tracks to last.fm, and find freely downloadable tracks to play</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::LastFmConfig</name> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="99"/> <source>Testing...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="121"/> <source>Test Login</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="131"/> <source>Importing %1</source> <comment>e.g. Importing 2012/01/01</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="134"/> <source>Importing History...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="203"/> <source>History Incomplete. Resume</source> <extracomment>Text on a button that resumes import</extracomment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="208"/> <source>Playback History Imported</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="231"/> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="247"/> <source>Failed</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="236"/> <source>Success</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="253"/> <source>Could not contact server</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="267"/> <source>Synchronizing...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmConfig.cpp" line="431"/> <source>Synchronization Finished</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::<API key></name> <message> <location filename="../src/libtomahawk/accounts/ResolverAccount.cpp" line="119"/> <source>Resolver installation error: cannot open bundle.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/ResolverAccount.cpp" line="125"/> <source>Resolver installation error: incomplete bundle.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/ResolverAccount.cpp" line="163"/> <source>Resolver installation error: bad metadata in bundle.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/ResolverAccount.cpp" line="199"/> <source>Resolver installation error: platform mismatch.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/ResolverAccount.cpp" line="211"/> <source>Resolver installation error: Tomahawk %1 or newer is required.</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::SpotifyAccount</name> <message> <location filename="../src/libtomahawk/accounts/spotify/SpotifyAccount.cpp" line="520"/> <source>Sync with Spotify</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/SpotifyAccount.cpp" line="524"/> <source>Re-enable syncing with Spotify</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/SpotifyAccount.cpp" line="532"/> <source>Create local copy</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/SpotifyAccount.cpp" line="548"/> <source>Subscribe to playlist changes</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/SpotifyAccount.cpp" line="552"/> <source>Re-enable playlist subscription</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/SpotifyAccount.cpp" line="556"/> <source>Stop subscribing to changes</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/SpotifyAccount.cpp" line="576"/> <source>Enable Spotify collaborations</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/SpotifyAccount.cpp" line="578"/> <source>Disable Spotify collaborations</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/SpotifyAccount.cpp" line="534"/> <source>Stop syncing with Spotify</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::<API key></name> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.cpp" line="202"/> <source>Logging in...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.cpp" line="239"/> <source>Failed: %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.cpp" line="282"/> <source>Logged in as %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.cpp" line="284"/> <source>Log Out</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/spotify/<API key>.cpp" line="302"/> <location filename="../src/libtomahawk/accounts/spotify/<API key>.cpp" line="314"/> <source>Log In</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::<API key></name> <message> <location filename="../src/libtomahawk/accounts/spotify/SpotifyAccount.h" line="71"/> <source>Play music from and sync your playlists with Spotify Premium</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::<API key></name> <message> <location filename="../src/libtomahawk/accounts/configstorage/telepathy/<API key>.cpp" line="79"/> <source>the KDE instant messaging framework</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/configstorage/telepathy/<API key>.cpp" line="96"/> <source>KDE Instant Messaging Accounts</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::XmppAccountFactory</name> <message> <location filename="../src/accounts/xmpp/XmppAccount.h" line="53"/> <source>Login to connect to your Jabber/XMPP contacts that also use Tomahawk.</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::XmppConfigWidget</name> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.cpp" line="73"/> <source>Account provided by %1.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.cpp" line="157"/> <source>You forgot to enter your username!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.cpp" line="165"/> <source>Your Xmpp Id should look like an email address</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.cpp" line="171"/> <source> Example: username@jabber.org</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::ZeroconfAccount</name> <message> <location filename="../src/accounts/zeroconf/ZeroconfAccount.cpp" line="63"/> <location filename="../src/accounts/zeroconf/ZeroconfAccount.cpp" line="64"/> <source>Local Network</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Accounts::ZeroconfFactory</name> <message> <location filename="../src/accounts/zeroconf/ZeroconfAccount.h" line="45"/> <source>Local Network</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/zeroconf/ZeroconfAccount.h" line="46"/> <source>Automatically connect to Tomahawk users on the same local network.</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Collection</name> <message> <location filename="../src/libtomahawk/collection/Collection.cpp" line="87"/> <location filename="../src/libtomahawk/collection/Collection.cpp" line="101"/> <source>Collection</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::ContextMenu</name> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="125"/> <source>&amp;Play</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="128"/> <location filename="../src/libtomahawk/ContextMenu.cpp" line="270"/> <location filename="../src/libtomahawk/ContextMenu.cpp" line="321"/> <source>Add to &amp;Queue</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="141"/> <source>Add to &amp;Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="162"/> <source>Send to &amp;Friend</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="176"/> <source>Continue Playback after this &amp;Track</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="178"/> <source>Stop Playback after this &amp;Track</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="185"/> <location filename="../src/libtomahawk/ContextMenu.cpp" line="489"/> <source>&amp;Love</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="199"/> <source>View Similar Tracks to &quot;%1&quot;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="278"/> <location filename="../src/libtomahawk/ContextMenu.cpp" line="329"/> <source>&amp;Go to &quot;%1&quot;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="204"/> <location filename="../src/libtomahawk/ContextMenu.cpp" line="208"/> <location filename="../src/libtomahawk/ContextMenu.cpp" line="281"/> <source>Go to &quot;%1&quot;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="214"/> <source>&amp;Copy Track Link</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="234"/> <source>Mark as &amp;Listened</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="238"/> <source>&amp;Remove Items</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="238"/> <source>&amp;Remove Item</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="289"/> <source>Copy Album &amp;Link</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="337"/> <source>Copy Artist &amp;Link</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="484"/> <source>Un-&amp;Love</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ContextMenu.cpp" line="217"/> <source>Properties...</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::<API key></name> <message> <location filename="../src/libtomahawk/database/<API key>.cpp" line="119"/> <source>Unknown</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::DropJobNotifier</name> <message> <location filename="../src/libtomahawk/utils/DropJobNotifier.cpp" line="73"/> <source>playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/DropJobNotifier.cpp" line="76"/> <source>artist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/DropJobNotifier.cpp" line="79"/> <source>track</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/DropJobNotifier.cpp" line="82"/> <source>album</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/DropJobNotifier.cpp" line="105"/> <source>Fetching %1 from database</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/DropJobNotifier.cpp" line="109"/> <source>Parsing %1 %2</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::DynamicControlList</name> <message> <location filename="../src/libtomahawk/playlist/dynamic/widgets/DynamicControlList.cpp" line="84"/> <source>Save Settings</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::DynamicModel</name> <message> <location filename="../src/libtomahawk/playlist/dynamic/DynamicModel.cpp" line="173"/> <location filename="../src/libtomahawk/playlist/dynamic/DynamicModel.cpp" line="302"/> <source>Could not find a playable track. Please change the filters or try again.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/DynamicModel.cpp" line="231"/> <source>Failed to generate preview with the desired filters</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::DynamicSetupWidget</name> <message> <location filename="../src/libtomahawk/playlist/dynamic/widgets/DynamicSetupWidget.cpp" line="53"/> <source>Type:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/widgets/DynamicSetupWidget.cpp" line="67"/> <source>Generate</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::DynamicView</name> <message> <location filename="../src/libtomahawk/playlist/dynamic/DynamicView.cpp" line="146"/> <source>Add some filters above to seed this station!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/DynamicView.cpp" line="151"/> <source>Press Generate to get started!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/DynamicView.cpp" line="153"/> <source>Add some filters above, and press Generate to get started!</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::DynamicWidget</name> <message> <location filename="../src/libtomahawk/playlist/dynamic/widgets/DynamicWidget.cpp" line="479"/> <source>Station ran out of tracks! Try tweaking the filters for a new set of songs to play.</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::EchonestControl</name> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="165"/> <source>Similar To</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="166"/> <source>Limit To</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="170"/> <source>Artist name</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="193"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="266"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="289"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="376"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="397"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="468"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="491"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="516"/> <source>is</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="214"/> <source>from user</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="223"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="765"/> <source>No users with Echo Nest Catalogs enabled. Try enabling option in Collection settings</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="244"/> <source>similar to</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="246"/> <source>Enter any combination of song name and artist here...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="267"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="290"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="332"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="338"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="344"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="350"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="356"/> <source>Less</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="267"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="290"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="332"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="338"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="344"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="350"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="356"/> <source>More</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="313"/> <source>0 BPM</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="313"/> <source>500 BPM</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="319"/> <source>0 secs</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="319"/> <source>3600 secs</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="325"/> <source>-100 dB</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="325"/> <source>100 dB</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="362"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="369"/> <source>-180%1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="362"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="369"/> <source>180%1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="378"/> <source>Major</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="379"/> <source>Minor</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="399"/> <source>C</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="400"/> <source>C Sharp</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="401"/> <source>D</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="402"/> <source>E Flat</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="403"/> <source>E</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="404"/> <source>F</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="405"/> <source>F Sharp</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="406"/> <source>G</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="407"/> <source>A Flat</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="408"/> <source>A</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="409"/> <source>B Flat</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="410"/> <source>B</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="429"/> <source>Ascending</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="430"/> <source>Descending</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="433"/> <source>Tempo</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="434"/> <source>Duration</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="435"/> <source>Loudness</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="436"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="986"/> <source>Artist Familiarity</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="437"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="985"/> <source>Artist Hotttnesss</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="438"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="986"/> <source>Song Hotttnesss</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="439"/> <source>Latitude</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="440"/> <source>Longitude</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="441"/> <source>Mode</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="442"/> <source>Key</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="443"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="985"/> <source>Energy</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="444"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="984"/> <source>Danceability</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="492"/> <source>is not</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="495"/> <source>Studio</source> <comment>Song type: The song was recorded in a studio.</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="496"/> <source>Live</source> <comment>Song type: The song was a life performance.</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="497"/> <source>Acoustic</source> <comment>Song type</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="498"/> <source>Electric</source> <comment>Song type</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="499"/> <source>Christmas</source> <comment>Song type: A christmas song</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="519"/> <source>Focused</source> <comment>Distribution: Songs that are tightly clustered around the seeds</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="520"/> <source>Wandering</source> <comment>Distribution: Songs from a broader range of artists</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="536"/> <source>Classics</source> <comment>Genre preset: songs intended to introduce the genre to a novice listener</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="537"/> <source>Popular</source> <comment>Genre preset: most popular songs being played in the genre today</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="538"/> <source>Emerging</source> <comment>Genre preset: songs that are more popular than expected, but which are unfamiliar to most listeners</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="541"/> <source>Best</source> <comment>Genre preset: optimal collection of songs</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="542"/> <source>Mix</source> <comment>Genre preset: a varying collection of songs</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="569"/> <source>At Least</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="570"/> <source>At Most</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="953"/> <source>only by ~%1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="955"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="982"/> <source>similar to ~%1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="959"/> <source>with genre ~%1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="967"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="978"/> <source>from no one</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="971"/> <source>You</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="972"/> <source>from my radio</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="974"/> <source>from %1 radio</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="984"/> <source>Variety</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="987"/> <source>Adventurousness</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="993"/> <source>very low</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="995"/> <source>low</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="997"/> <source>moderate</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="999"/> <source>high</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1001"/> <source>very high</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1002"/> <source>with %1 %2</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1006"/> <source>about %1 BPM</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1010"/> <source>about %n minute(s) long</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1014"/> <source>about %1 dB</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1018"/> <source>at around %1%2 %3</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1025"/> <source>in %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1032"/> <source>in a %1 key</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1044"/> <source>sorted in %1 %2 order</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1051"/> <source>with a %1 mood</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1058"/> <source>in a %1 style</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1065"/> <source>where genre is %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1078"/> <source>where song type is %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1080"/> <source>where song type is not %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1088"/> <source>with a %1 distribution</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1100"/> <source>preset to %1 collection of %2 genre songs</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1102"/> <source>an optimal</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1104"/> <source>a mixed</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1108"/> <source>classic</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1113"/> <source>popular</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp" line="1115"/> <source>emerging</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::GroovesharkParser</name> <message> <location filename="../src/libtomahawk/utils/GroovesharkParser.cpp" line="239"/> <source>Error fetching Grooveshark information from the network!</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::InfoSystem::ChartsPlugin</name> <message> <location filename="../src/infoplugins/generic/charts/ChartsPlugin.cpp" line="578"/> <source>Artists</source> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/charts/ChartsPlugin.cpp" line="580"/> <source>Albums</source> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/charts/ChartsPlugin.cpp" line="582"/> <source>Tracks</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::InfoSystem::FdoNotifyPlugin</name> <message> <location filename="../src/infoplugins/linux/fdonotify/FdoNotifyPlugin.cpp" line="271"/> <source>on</source> <comment>'on' is followed by an album name</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/linux/fdonotify/FdoNotifyPlugin.cpp" line="274"/> <source>%1%4 %2%3.</source> <comment>%1 is a title, %2 is an artist and %3 is replaced by either the previous message or nothing, %4 is the preposition used to link track and artist ('by' in english)</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/linux/fdonotify/FdoNotifyPlugin.cpp" line="215"/> <location filename="../src/infoplugins/linux/fdonotify/FdoNotifyPlugin.cpp" line="278"/> <source>by</source> <comment>preposition to link track and artist</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/linux/fdonotify/FdoNotifyPlugin.cpp" line="130"/> <source>The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/linux/fdonotify/FdoNotifyPlugin.cpp" line="138"/> <source>Tomahawk is stopped.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/linux/fdonotify/FdoNotifyPlugin.cpp" line="211"/> <source>%1 sent you %2%4 %3.</source> <comment>%1 is a nickname, %2 is a title, %3 is an artist, %4 is the preposition used to link track and artist ('by' in english)</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/linux/fdonotify/FdoNotifyPlugin.cpp" line="222"/> <source>%1 sent you &quot;%2&quot; by %3.</source> <comment>%1 is a nickname, %2 is a title, %3 is an artist</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/linux/fdonotify/FdoNotifyPlugin.cpp" line="287"/> <source>on &quot;%1&quot;</source> <comment>%1 is an album name</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/linux/fdonotify/FdoNotifyPlugin.cpp" line="289"/> <source>&quot;%1&quot; by %2%3.</source> <comment>%1 is a title, %2 is an artist and %3 is replaced by either the previous message or nothing</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/linux/fdonotify/FdoNotifyPlugin.cpp" line="314"/> <source>Tomahawk - Now Playing</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::InfoSystem::LastFmInfoPlugin</name> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp" line="461"/> <source>Top Tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp" line="464"/> <source>Loved Tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp" line="467"/> <source>Hyped Tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp" line="473"/> <source>Top Artists</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp" line="476"/> <source>Hyped Artists</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::InfoSystem::NewReleasesPlugin</name> <message> <location filename="../src/infoplugins/generic/newreleases/NewReleasesPlugin.cpp" line="602"/> <source>Albums</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::InfoSystem::SnoreNotifyPlugin</name> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="87"/> <source>Notify User</source> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="88"/> <source>Now Playing</source> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="89"/> <source>Unresolved track</source> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="90"/> <source>Playback Stopped</source> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="91"/> <source>You received a Song recommendation</source> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="202"/> <source>on</source> <comment>'on' is followed by an album name</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="204"/> <source>%1%4 %2%3.</source> <comment>%1 is a title, %2 is an artist and %3 is replaced by either the previous message or nothing, %4 is the preposition used to link track and artist ('by' in english)</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="208"/> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="270"/> <source>by</source> <comment>preposition to link track and artist</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="217"/> <source>on &quot;%1&quot;</source> <comment>%1 is an album name</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="219"/> <source>&quot;%1&quot; by %2%3.</source> <comment>%1 is a title, %2 is an artist and %3 is replaced by either the previous message or nothing</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="266"/> <source>%1 sent you %2%4 %3.</source> <comment>%1 is a nickname, %2 is a title, %3 is an artist, %4 is the preposition used to link track and artist ('by' in english)</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/infoplugins/generic/snorenotify/SnoreNotifyPlugin.cpp" line="277"/> <source>%1 sent you &quot;%2&quot; by %3.</source> <comment>%1 is a nickname, %2 is a title, %3 is an artist</comment> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::ItunesParser</name> <message> <location filename="../src/libtomahawk/utils/ItunesParser.cpp" line="182"/> <source>Error fetching iTunes information from the network!</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::JSPFLoader</name> <message> <location filename="../src/libtomahawk/utils/JspfLoader.cpp" line="150"/> <source>New Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/JspfLoader.cpp" line="176"/> <source>Failed to save tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/JspfLoader.cpp" line="176"/> <source>Some tracks in the playlist do not contain an artist and a title. They will be ignored.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/JspfLoader.cpp" line="201"/> <source>XSPF Error</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/JspfLoader.cpp" line="201"/> <source>This is not a valid XSPF playlist.</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::JSResolver</name> <message> <location filename="../src/libtomahawk/resolvers/JSResolver.cpp" line="373"/> <source>Script Resolver Warning: API call %1 returned data synchronously.</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::LatchManager</name> <message> <location filename="../src/libtomahawk/LatchManager.cpp" line="96"/> <source>&amp;Catch Up</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/LatchManager.cpp" line="133"/> <location filename="../src/libtomahawk/LatchManager.cpp" line="166"/> <source>&amp;Listen Along</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::LocalCollection</name> <message> <location filename="../src/libtomahawk/database/LocalCollection.cpp" line="42"/> <source>Your Collection</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::RemoteCollection</name> <message> <location filename="../src/libtomahawk/network/RemoteCollection.cpp" line="36"/> <source>Collection of %1</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::ScriptCollection</name> <message> <location filename="../src/libtomahawk/resolvers/ScriptCollection.cpp" line="78"/> <source>%1 Collection</source> <comment>Name of a collection based on a script pluginsc, e.g. Subsonic Collection</comment> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::ScriptEngine</name> <message> <location filename="../src/libtomahawk/resolvers/ScriptEngine.cpp" line="94"/> <source>Resolver Error: %1:%2 %3</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/resolvers/ScriptEngine.cpp" line="112"/> <source>SSL Error</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/resolvers/ScriptEngine.cpp" line="113"/> <source>You have asked Tomahawk to connect securely to &lt;b&gt;%1&lt;/b&gt;, but we can&apos;t confirm that your connection is secure:&lt;br&gt;&lt;br&gt;&lt;b&gt;%2&lt;/b&gt;&lt;br&gt;&lt;br&gt;Do you want to trust this connection?</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/resolvers/ScriptEngine.cpp" line="120"/> <source>Trust certificate</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::ShortenedLinkParser</name> <message> <location filename="../src/libtomahawk/utils/ShortenedLinkParser.cpp" line="104"/> <source>Network error parsing shortened link!</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Source</name> <message> <location filename="../src/libtomahawk/Source.cpp" line="550"/> <source>Scanning (%L1 tracks)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/Source.cpp" line="535"/> <source>Checking</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/Source.cpp" line="540"/> <source>Syncing</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/Source.cpp" line="545"/> <source>Importing</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/Source.cpp" line="735"/> <source>Saving (%1%)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/Source.cpp" line="822"/> <source>Online</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/Source.cpp" line="826"/> <source>Offline</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::SpotifyParser</name> <message> <location filename="../src/libtomahawk/utils/SpotifyParser.cpp" line="280"/> <source>Error fetching Spotify information from the network!</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Track</name> <message> <location filename="../src/libtomahawk/Track.cpp" line="558"/> <source> and </source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/Track.cpp" line="566"/> <source>You</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/Track.cpp" line="568"/> <source>you</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/Track.cpp" line="581"/> <source>and</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location filename="../src/libtomahawk/Track.cpp" line="581"/> <source>%n other(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location filename="../src/libtomahawk/Track.cpp" line="584"/> <source>%n people</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location filename="../src/libtomahawk/Track.cpp" line="588"/> <source>loved this track</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/Track.cpp" line="590"/> <source>sent you this track %1</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Widgets::ChartsPage</name> <message> <location filename="../src/viewpages/charts/ChartsWidget.h" line="130"/> <source>Charts</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Widgets::Dashboard</name> <message> <location filename="../src/viewpages/dashboard/Dashboard.h" line="96"/> <source>Feed</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/dashboard/Dashboard.h" line="97"/> <source>An overview of your friends&apos; recent activity</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Widgets::DashboardWidget</name> <message> <location filename="../src/viewpages/dashboard/Dashboard.cpp" line="78"/> <source>Recently Played Tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/dashboard/Dashboard.cpp" line="72"/> <source>Feed</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Widgets::NetworkActivity</name> <message> <location filename="../src/viewpages/networkactivity/NetworkActivity.h" line="57"/> <source>Trending</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/NetworkActivity.h" line="58"/> <source>What&apos;s hot amongst your friends</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Widgets::<API key></name> <message> <location filename="../src/viewpages/networkactivity/<API key>.cpp" line="71"/> <source>Charts</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/<API key>.cpp" line="82"/> <source>Last Week</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/<API key>.cpp" line="88"/> <source>Loved Tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/<API key>.cpp" line="90"/> <source>Top Loved</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/<API key>.cpp" line="93"/> <source>Recently Loved</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/<API key>.cpp" line="108"/> <source>Sorry, we are still loading the charts.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/<API key>.cpp" line="131"/> <source>Sorry, we couldn&apos;t find any trending tracks.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/<API key>.cpp" line="79"/> <source>Last Month</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/<API key>.cpp" line="76"/> <source>Last Year</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/networkactivity/<API key>.cpp" line="73"/> <source>Overall</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Widgets::NewReleasesPage</name> <message> <location filename="../src/viewpages/newreleases/NewReleasesWidget.h" line="120"/> <source>New Releases</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::Widgets::WhatsNew_0_8</name> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNew_0_8.h" line="89"/> <source>What&apos;s new in 0.8?</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNew_0_8.h" line="90"/> <source>An overview of the changes and additions since 0.7.</source> <translation type="unfinished"/> </message> </context> <context> <name>Tomahawk::XspfUpdater</name> <message> <location filename="../src/libtomahawk/playlist/XspfUpdater.cpp" line="60"/> <source>Automatically update from XSPF</source> <translation type="unfinished"/> </message> </context> <context> <name>TomahawkApp</name> <message> <location filename="../src/tomahawk/TomahawkApp.cpp" line="525"/> <source>You</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkApp.cpp" line="613"/> <source>Tomahawk is updating the database. Please wait, this may take a minute!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkApp.cpp" line="620"/> <source>Tomahawk</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkApp.cpp" line="731"/> <source>Updating database </source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkApp.cpp" line="738"/> <source>Updating database %1</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkApp.cpp" line="788"/> <source>Automatically detecting external IP failed.</source> <translation type="unfinished"/> </message> </context> <context> <name>TomahawkSettings</name> <message> <location filename="../src/libtomahawk/TomahawkSettings.cpp" line="386"/> <source>Local Network</source> <translation type="unfinished"/> </message> </context> <context> <name>TomahawkTrayIcon</name> <message> <location filename="../src/tomahawk/TomahawkTrayIcon.cpp" line="181"/> <source>&amp;Stop Playback after current Track</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkTrayIcon.cpp" line="76"/> <location filename="../src/tomahawk/TomahawkTrayIcon.cpp" line="115"/> <source>Hide Tomahawk Window</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkTrayIcon.cpp" line="120"/> <source>Show Tomahawk Window</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkTrayIcon.cpp" line="201"/> <source>Currently not playing.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkTrayIcon.cpp" line="262"/> <source>Play</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkTrayIcon.cpp" line="290"/> <source>Pause</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkTrayIcon.cpp" line="320"/> <source>&amp;Love</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkTrayIcon.cpp" line="328"/> <source>Un-&amp;Love</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkTrayIcon.cpp" line="179"/> <source>&amp;Continue Playback after current Track</source> <translation type="unfinished"/> </message> </context> <context> <name>TomahawkWindow</name> <message> <location filename="../src/tomahawk/TomahawkWindow.ui" line="14"/> <source>Tomahawk</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="307"/> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="601"/> <source>Back</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="310"/> <source>Go back one page</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="317"/> <source>Forward</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="320"/> <source>Go forward one page</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="237"/> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1533"/> <source>Hide Menu Bar</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="237"/> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1527"/> <source>Show Menu Bar</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="360"/> <source>&amp;Main Menu</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="608"/> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="958"/> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="970"/> <source>Play</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="614"/> <source>Next</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="627"/> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1019"/> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1026"/> <source>Love</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1014"/> <source>Unlove</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1150"/> <source>Exit Full Screen</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1168"/> <source>Enter Full Screen</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1247"/> <source>This is not a valid XSPF playlist.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1251"/> <source>Some tracks in the playlist do not contain an artist and a title. They will be ignored.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1263"/> <source>Failed to load JSPF playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1270"/> <source>Sorry, there is a problem accessing your audio device or the desired track, current track will be skipped.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1279"/> <source>Station</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1281"/> <source>Create New Station</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1281"/> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1316"/> <source>Name:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1314"/> <source>Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1316"/> <source>Create New Playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="949"/> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1347"/> <source>Pause</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="337"/> <source>Search</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1369"/> <source>&amp;Play</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1401"/> <source>%1 by %2</source> <comment>track, artist name</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1402"/> <source>%1 - %2</source> <comment>current track, some window title</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1413"/> <source>&lt;h2&gt;&lt;b&gt;Tomahawk %1&lt;br/&gt;(%2)&lt;/h2&gt;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1417"/> <source>&lt;h2&gt;&lt;b&gt;Tomahawk %1&lt;/h2&gt;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1421"/> <source>Copyright 2010 - 2015</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1422"/> <source>Thanks to:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/TomahawkWindow.cpp" line="1429"/> <source>About Tomahawk</source> <translation type="unfinished"/> </message> </context> <context> <name>TrackDetailView</name> <message> <location filename="../src/libtomahawk/playlist/TrackDetailView.cpp" line="79"/> <source>Marked as Favorite</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/TrackDetailView.cpp" line="97"/> <source>Alternate Sources:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/TrackDetailView.cpp" line="175"/> <source>Unknown Release-Date</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/TrackDetailView.cpp" line="266"/> <source>on %1</source> <translation type="unfinished"/> </message> </context> <context> <name>TrackInfoWidget</name> <message> <location filename="../src/libtomahawk/viewpages/TrackViewPage.cpp" line="52"/> <source>Similar Tracks</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/TrackViewPage.cpp" line="53"/> <source>Sorry, but we could not find similar tracks for this song!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/viewpages/TrackViewPage.ui" line="60"/> <source>Top Hits</source> <translation type="unfinished"/> </message> </context> <context> <name>TrackView</name> <message> <location filename="../src/libtomahawk/playlist/TrackView.cpp" line="692"/> <source>Sorry, your filter &apos;%1&apos; did not match any results.</source> <translation type="unfinished"/> </message> </context> <context> <name>TransferStatusItem</name> <message> <location filename="../src/libtomahawk/jobview/TransferStatusItem.cpp" line="68"/> <source>from</source> <comment>streaming artist - track from friend</comment> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/jobview/TransferStatusItem.cpp" line="68"/> <source>to</source> <comment>streaming artist - track to friend</comment> <translation type="unfinished"/> </message> </context> <context> <name>Type selector</name> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="77"/> <source>Artist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="77"/> <source>Artist Description</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="78"/> <source>User Radio</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="78"/> <source>Song</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="79"/> <source>Genre</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="79"/> <source>Mood</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="80"/> <source>Style</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="80"/> <source>Adventurousness</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="81"/> <source>Variety</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="81"/> <source>Tempo</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="82"/> <source>Duration</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="82"/> <source>Loudness</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="83"/> <source>Danceability</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="83"/> <source>Energy</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="84"/> <source>Artist Familiarity</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="84"/> <source>Artist Hotttnesss</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="85"/> <source>Song Hotttnesss</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="85"/> <source>Longitude</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="86"/> <source>Latitude</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="86"/> <source>Mode</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="87"/> <source>Key</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="87"/> <source>Sorting</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="88"/> <source>Song Type</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="88"/> <source>Distribution</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp" line="89"/> <source>Genre Preset</source> <translation type="unfinished"/> </message> </context> <context> <name>ViewManager</name> <message> <location filename="../src/libtomahawk/ViewManager.cpp" line="83"/> <source>Inbox</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/ViewManager.cpp" line="84"/> <source>Listening suggestions from your friends</source> <translation type="unfinished"/> </message> </context> <context> <name>WhatsNewWidget_0_8</name> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="86"/> <source>WHAT&apos;S NEW</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="96"/> <source>If you are reading this it likely means you have already noticed the biggest change since our last release - a shiny new interface and design. New views, fonts, icons, header images and animations at every turn. Below you can find an overview of the functional changes and additions since 0.7 too:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="174"/> <source>Inbox</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="213"/> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Send tracks to your friends just by dragging it onto their avatar in the Tomahawk sidebar. Check out what your friends think you should listen to in your inbox.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="230"/> <source>Universal Link Support</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="253"/> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Love that your friends and influencers are posting music links but hate that they are links for music services you don&apos;t use? Just drag Rdio, Deezer, Beats or other music service URLs into your Tomahawk queue or playlists and have them automatically play from your preferred source.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="270"/> <source>Beats Music</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="296"/> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Beats Music (recently aquired by Apple) is now supported. This means that Beats Music subscribers can also benefit by resolving other music service links so they stream from their Beats Music account. Welcome aboard!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="313"/> <source>Google Music</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="336"/> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Google Music is another of our latest supported services - both for the music you&apos;ve uploaded to Google Music as well as their full streaming catalog for Google Play Music All Access subscribers. Not only is all of your Google Play Music a potential source for streaming - your entire online collection is browseable too.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="376"/> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tomahawk for Android is now in beta! The majority of the same resolvers are supported in the Android app - plus a couple of additional ones in Rdio &amp;amp; Deezer. &lt;a href=&quot;http://hatchet.is/register&quot;&gt;Create a Hatchet account&lt;/a&gt; to sync all of your playlists from your desktop to your mobile. Find current and future music influencers and follow them to discover and hear what they love. Just like on the desktop, Tomahawk on Android can open other music service links and play them from yours. Even when you are listening to other music apps, Tomahawk can capture all of that playback data and add it to your Hatchet profile.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="396"/> <source>Connectivity</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="419"/> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Tomahawk now supports IPv6 and multiple local IP addresses. This improves the discoverability and connection between Tomahawk users - particularly large local networks often found in work and university settings. The more friends, the more music, the more playlists and the more curation from those people whose musical tastes you value. Sit back and just Listen Along!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"/> </message> <message> <location filename="../src/viewpages/whatsnew_0_8/WhatsNewWidget_0_8.ui" line="353"/> <source>Android</source> <translation type="unfinished"/> </message> </context> <context> <name>XMPPBot</name> <message> <location filename="../src/tomahawk/xmppbot/XmppBot.cpp" line="315"/> <source> Terms for %1: </source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/xmppbot/XmppBot.cpp" line="317"/> <source>No terms found, sorry.</source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/xmppbot/XmppBot.cpp" line="350"/> <source> Hotttness for %1: %2 </source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/xmppbot/XmppBot.cpp" line="366"/> <source> Familiarity for %1: %2 </source> <translation type="unfinished"/> </message> <message> <location filename="../src/tomahawk/xmppbot/XmppBot.cpp" line="384"/> <source> Lyrics for &quot;%1&quot; by %2: %3 </source> <translation type="unfinished"/> </message> </context> <context> <name>XSPFLoader</name> <message> <location filename="../src/libtomahawk/utils/XspfLoader.cpp" line="48"/> <source>Failed to parse contents of XSPF playlist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/XspfLoader.cpp" line="50"/> <source>Some playlist entries were found without artist and track name, they will be omitted</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/XspfLoader.cpp" line="52"/> <source>Failed to fetch the desired playlist from the network, or the desired file does not exist</source> <translation type="unfinished"/> </message> <message> <location filename="../src/libtomahawk/utils/XspfLoader.cpp" line="239"/> <source>New Playlist</source> <translation type="unfinished"/> </message> </context> <context> <name>XmlConsole</name> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.ui" line="14"/> <source>Xml stream console</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.ui" line="33"/> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="60"/> <source>Filter</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.ui" line="43"/> <source>Save log</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="62"/> <source>Disabled</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="65"/> <source>By JID</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="68"/> <source>By namespace uri</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="71"/> <source>By all attributes</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="76"/> <source>Visible stanzas</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="79"/> <source>Information query</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="83"/> <source>Message</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="87"/> <source>Presence</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="91"/> <source>Custom</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="107"/> <source>Close</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="357"/> <source>Save XMPP log to file</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmlConsole.cpp" line="358"/> <source>OpenDocument Format (*.odf);;HTML file (*.html);;Plain text (*.txt)</source> <translation type="unfinished"/> </message> </context> <context> <name>XmppConfigWidget</name> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="20"/> <source>Xmpp Configuration</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="196"/> <source>Configure</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="211"/> <source>Login Information</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="58"/> <source>Configure this Jabber/XMPP account</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="104"/> <source>Enter your XMPP login to connect with your friends using Tomahawk!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="231"/> <source>XMPP ID:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="247"/> <source>e.g. user@jabber.org</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="260"/> <source>Password:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="288"/> <source>An account with this name already exists!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="310"/> <source>Advanced Xmpp Settings</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="330"/> <source>Server:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="353"/> <source>Port:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="399"/> <source>Lots of servers don&apos;t support this (e.g. GTalk, jabber.org)</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="402"/> <source>Display currently playing track</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/XmppConfigWidget.ui" line="409"/> <source>Enforce secure connection</source> <translation type="unfinished"/> </message> </context> <context> <name>XmppSipPlugin</name> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="380"/> <source>User Interaction</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="383"/> <source>Host is unknown</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="386"/> <source>Item not found</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="389"/> <source>Authorization Error</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="392"/> <source>Remote Stream Error</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="395"/> <source>Remote Connection failed</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="398"/> <source>Internal Server Error</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="401"/> <source>System shutdown</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="404"/> <source>Conflict</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="419"/> <source>Unknown</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="800"/> <source>Do you want to add &lt;b&gt;%1&lt;/b&gt; to your friend list?</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="407"/> <source>No Compression Support</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="189"/> <source>Enter Jabber ID</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="410"/> <source>No Encryption Support</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="413"/> <source>No Authorization Support</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="416"/> <source>No Supported Feature</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="487"/> <source>Add Friend</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="488"/> <source>Enter Xmpp ID:</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="640"/> <source>Add Friend...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="645"/> <source>XML Console...</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="691"/> <source>I&apos;m sorry -- I&apos;m just an automatic presence used by Tomahawk Player (http://gettomahawk.com). If you are getting this message, the person you are trying to reach is probably not signed on, so please try again later!</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/xmpp/sip/XmppSip.cpp" line="799"/> <source>Authorize User</source> <translation type="unfinished"/> </message> </context> <context> <name>ZeroconfConfig</name> <message> <location filename="../src/accounts/zeroconf/ConfigWidget.ui" line="55"/> <source>Local Network configuration</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/zeroconf/ConfigWidget.ui" line="77"/> <source>This plugin will automatically find other users running Tomahawk on your local network</source> <translation type="unfinished"/> </message> <message> <location filename="../src/accounts/zeroconf/ConfigWidget.ui" line="84"/> <source>Connect automatically when Tomahawk starts</source> <translation type="unfinished"/> </message> </context> </TS>
// This software is provided 'as-is', without any express or implied // arising from the use of this software. // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would // be appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // 3. This notice may not be removed or altered from any source // distribution. // It is fine to use C99 in this file because it will not be built with VS #define _GNU_SOURCE #include "internal.h" #include "backend_utils.h" #include <X11/Xresource.h> #include <stdlib.h> #include <string.h> #include <limits.h> #include <stdio.h> #include <locale.h> #include <fcntl.h> #include <unistd.h> // Return the atom ID only if it is listed in the specified array static Atom getAtomIfSupported(Atom* supportedAtoms, unsigned long atomCount, const char* atomName) { const Atom atom = XInternAtom(_glfw.x11.display, atomName, False); for (unsigned long i = 0; i < atomCount; i++) { if (supportedAtoms[i] == atom) return atom; } return None; } // Check whether the running window manager is EWMH-compliant static void detectEWMH(void) { // First we read the <API key> property on the root window Window* windowFromRoot = NULL; if (!<API key>(_glfw.x11.root, _glfw.x11.<API key>, XA_WINDOW, (unsigned char**) &windowFromRoot)) { return; } <API key>(); // If it exists, it should be the XID of a top-level window // Then we look for the same property on that window Window* windowFromChild = NULL; if (!<API key>(*windowFromRoot, _glfw.x11.<API key>, XA_WINDOW, (unsigned char**) &windowFromChild)) { XFree(windowFromRoot); return; } <API key>(); // If the property exists, it should contain the XID of the window if (*windowFromRoot != *windowFromChild) { XFree(windowFromRoot); XFree(windowFromChild); return; } XFree(windowFromRoot); XFree(windowFromChild); // We are now fairly sure that an EWMH-compliant WM is currently running // We can now start querying the WM about what features it supports by // looking in the _NET_SUPPORTED property on the root window // It should contain a list of supported EWMH protocol and state atoms Atom* supportedAtoms = NULL; const unsigned long atomCount = <API key>(_glfw.x11.root, _glfw.x11.NET_SUPPORTED, XA_ATOM, (unsigned char**) &supportedAtoms); if (!supportedAtoms) return; // See which of the atoms we support that are supported by the WM _glfw.x11.NET_WM_STATE = getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE"); _glfw.x11.NET_WM_STATE_ABOVE = getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_STATE_ABOVE"); _glfw.x11.<API key> = getAtomIfSupported(supportedAtoms, atomCount, "<API key>"); _glfw.x11.<API key> = getAtomIfSupported(supportedAtoms, atomCount, "<API key>"); _glfw.x11.<API key> = getAtomIfSupported(supportedAtoms, atomCount, "<API key>"); _glfw.x11.<API key> = getAtomIfSupported(supportedAtoms, atomCount, "<API key>"); _glfw.x11.<API key> = getAtomIfSupported(supportedAtoms, atomCount, "<API key>"); _glfw.x11.NET_WM_WINDOW_TYPE = getAtomIfSupported(supportedAtoms, atomCount, "_NET_WM_WINDOW_TYPE"); _glfw.x11.<API key> = getAtomIfSupported(supportedAtoms, atomCount, "<API key>"); _glfw.x11.NET_WORKAREA = getAtomIfSupported(supportedAtoms, atomCount, "_NET_WORKAREA"); _glfw.x11.NET_CURRENT_DESKTOP = getAtomIfSupported(supportedAtoms, atomCount, "<API key>"); _glfw.x11.NET_ACTIVE_WINDOW = getAtomIfSupported(supportedAtoms, atomCount, "_NET_ACTIVE_WINDOW"); _glfw.x11.NET_FRAME_EXTENTS = getAtomIfSupported(supportedAtoms, atomCount, "_NET_FRAME_EXTENTS"); _glfw.x11.<API key> = getAtomIfSupported(supportedAtoms, atomCount, "<API key>"); XFree(supportedAtoms); } // Look for and initialize supported X11 extensions static bool initExtensions(void) { _glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so.1"); if (_glfw.x11.vidmode.handle) { glfw_dlsym(_glfw.x11.vidmode.QueryExtension, _glfw.x11.vidmode.handle, "<API key>"); glfw_dlsym(_glfw.x11.vidmode.GetGammaRamp, _glfw.x11.vidmode.handle, "<API key>"); glfw_dlsym(_glfw.x11.vidmode.SetGammaRamp, _glfw.x11.vidmode.handle, "<API key>"); glfw_dlsym(_glfw.x11.vidmode.GetGammaRampSize, _glfw.x11.vidmode.handle, "<API key>"); _glfw.x11.vidmode.available = <API key>(_glfw.x11.display, &_glfw.x11.vidmode.eventBase, &_glfw.x11.vidmode.errorBase); } #if defined(__CYGWIN__) _glfw.x11.xi.handle = _glfw_dlopen("libXi-6.so"); #else _glfw.x11.xi.handle = _glfw_dlopen("libXi.so.6"); #endif if (_glfw.x11.xi.handle) { glfw_dlsym(_glfw.x11.xi.QueryVersion, _glfw.x11.xi.handle, "XIQueryVersion"); glfw_dlsym(_glfw.x11.xi.SelectEvents, _glfw.x11.xi.handle, "XISelectEvents"); if (XQueryExtension(_glfw.x11.display, "XInputExtension", &_glfw.x11.xi.majorOpcode, &_glfw.x11.xi.eventBase, &_glfw.x11.xi.errorBase)) { _glfw.x11.xi.major = 2; _glfw.x11.xi.minor = 0; if (XIQueryVersion(_glfw.x11.display, &_glfw.x11.xi.major, &_glfw.x11.xi.minor) == Success) { _glfw.x11.xi.available = true; } } } #if defined(__CYGWIN__) _glfw.x11.randr.handle = _glfw_dlopen("libXrandr-2.so"); #else _glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so.2"); #endif if (_glfw.x11.randr.handle) { glfw_dlsym(_glfw.x11.randr.AllocGamma, _glfw.x11.randr.handle, "XRRAllocGamma"); glfw_dlsym(_glfw.x11.randr.FreeGamma, _glfw.x11.randr.handle, "XRRFreeGamma"); glfw_dlsym(_glfw.x11.randr.FreeCrtcInfo, _glfw.x11.randr.handle, "XRRFreeCrtcInfo"); glfw_dlsym(_glfw.x11.randr.FreeGamma, _glfw.x11.randr.handle, "XRRFreeGamma"); glfw_dlsym(_glfw.x11.randr.FreeOutputInfo, _glfw.x11.randr.handle, "XRRFreeOutputInfo"); glfw_dlsym(_glfw.x11.randr.FreeScreenResources, _glfw.x11.randr.handle, "<API key>"); glfw_dlsym(_glfw.x11.randr.GetCrtcGamma, _glfw.x11.randr.handle, "XRRGetCrtcGamma"); glfw_dlsym(_glfw.x11.randr.GetCrtcGammaSize, _glfw.x11.randr.handle, "XRRGetCrtcGammaSize"); glfw_dlsym(_glfw.x11.randr.GetCrtcInfo, _glfw.x11.randr.handle, "XRRGetCrtcInfo"); glfw_dlsym(_glfw.x11.randr.GetOutputInfo, _glfw.x11.randr.handle, "XRRGetOutputInfo"); glfw_dlsym(_glfw.x11.randr.GetOutputPrimary, _glfw.x11.randr.handle, "XRRGetOutputPrimary"); glfw_dlsym(_glfw.x11.randr.<API key>, _glfw.x11.randr.handle, "<API key>"); glfw_dlsym(_glfw.x11.randr.QueryExtension, _glfw.x11.randr.handle, "XRRQueryExtension"); glfw_dlsym(_glfw.x11.randr.QueryVersion, _glfw.x11.randr.handle, "XRRQueryVersion"); glfw_dlsym(_glfw.x11.randr.SelectInput, _glfw.x11.randr.handle, "XRRSelectInput"); glfw_dlsym(_glfw.x11.randr.SetCrtcConfig, _glfw.x11.randr.handle, "XRRSetCrtcConfig"); glfw_dlsym(_glfw.x11.randr.SetCrtcGamma, _glfw.x11.randr.handle, "XRRSetCrtcGamma"); glfw_dlsym(_glfw.x11.randr.UpdateConfiguration, _glfw.x11.randr.handle, "<API key>"); if (XRRQueryExtension(_glfw.x11.display, &_glfw.x11.randr.eventBase, &_glfw.x11.randr.errorBase)) { if (XRRQueryVersion(_glfw.x11.display, &_glfw.x11.randr.major, &_glfw.x11.randr.minor)) { // The GLFW RandR path requires at least version 1.3 if (_glfw.x11.randr.major > 1 || _glfw.x11.randr.minor >= 3) _glfw.x11.randr.available = true; } else { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to query RandR version"); } } } if (_glfw.x11.randr.available) { XRRScreenResources* sr = <API key>(_glfw.x11.display, _glfw.x11.root); if (!sr->ncrtc || !XRRGetCrtcGammaSize(_glfw.x11.display, sr->crtcs[0])) { // This is likely an older Nvidia driver with broken gamma support // Flag it as useless and fall back to xf86vm gamma, if available _glfw.x11.randr.gammaBroken = true; } if (!sr->ncrtc) { // A system without CRTCs is likely a system with broken RandR // Disable the RandR monitor path and fall back to core functions _glfw.x11.randr.monitorBroken = true; } <API key>(sr); } if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken) { XRRSelectInput(_glfw.x11.display, _glfw.x11.root, <API key>); } #if defined(__CYGWIN__) _glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor-1.so"); #else _glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so.1"); #endif if (_glfw.x11.xcursor.handle) { glfw_dlsym(_glfw.x11.xcursor.ImageCreate, _glfw.x11.xcursor.handle, "XcursorImageCreate"); glfw_dlsym(_glfw.x11.xcursor.ImageDestroy, _glfw.x11.xcursor.handle, "XcursorImageDestroy"); glfw_dlsym(_glfw.x11.xcursor.ImageLoadCursor, _glfw.x11.xcursor.handle, "<API key>"); } #if defined(__CYGWIN__) _glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama-1.so"); #else _glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so.1"); #endif if (_glfw.x11.xinerama.handle) { glfw_dlsym(_glfw.x11.xinerama.IsActive, _glfw.x11.xinerama.handle, "XineramaIsActive"); glfw_dlsym(_glfw.x11.xinerama.QueryExtension, _glfw.x11.xinerama.handle, "<API key>"); glfw_dlsym(_glfw.x11.xinerama.QueryScreens, _glfw.x11.xinerama.handle, "<API key>"); if (<API key>(_glfw.x11.display, &_glfw.x11.xinerama.major, &_glfw.x11.xinerama.minor)) { if (XineramaIsActive(_glfw.x11.display)) _glfw.x11.xinerama.available = true; } } #if defined(__CYGWIN__) _glfw.x11.xrender.handle = _glfw_dlopen("libXrender-1.so"); #else _glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so.1"); #endif if (_glfw.x11.xrender.handle) { glfw_dlsym(_glfw.x11.xrender.QueryExtension, _glfw.x11.xrender.handle, "<API key>"); glfw_dlsym(_glfw.x11.xrender.QueryVersion, _glfw.x11.xrender.handle, "XRenderQueryVersion"); glfw_dlsym(_glfw.x11.xrender.FindVisualFormat, _glfw.x11.xrender.handle, "<API key>"); if (<API key>(_glfw.x11.display, &_glfw.x11.xrender.errorBase, &_glfw.x11.xrender.eventBase)) { if (XRenderQueryVersion(_glfw.x11.display, &_glfw.x11.xrender.major, &_glfw.x11.xrender.minor)) { _glfw.x11.xrender.available = true; } } } #if defined(__CYGWIN__) _glfw.x11.xshape.handle = _glfw_dlopen("libXext-6.so"); #else _glfw.x11.xshape.handle = _glfw_dlopen("libXext.so.6"); #endif if (_glfw.x11.xshape.handle) { glfw_dlsym(_glfw.x11.xshape.QueryExtension, _glfw.x11.xshape.handle, "<API key>"); glfw_dlsym(_glfw.x11.xshape.ShapeCombineRegion, _glfw.x11.xshape.handle, "XShapeCombineRegion"); glfw_dlsym(_glfw.x11.xshape.QueryVersion, _glfw.x11.xshape.handle, "XShapeQueryVersion"); if (<API key>(_glfw.x11.display, &_glfw.x11.xshape.errorBase, &_glfw.x11.xshape.eventBase)) { if (XShapeQueryVersion(_glfw.x11.display, &_glfw.x11.xshape.major, &_glfw.x11.xshape.minor)) { _glfw.x11.xshape.available = true; } } } _glfw.x11.xkb.major = 1; _glfw.x11.xkb.minor = 0; _glfw.x11.xkb.available = XkbQueryExtension(_glfw.x11.display, &_glfw.x11.xkb.majorOpcode, &_glfw.x11.xkb.eventBase, &_glfw.x11.xkb.errorBase, &_glfw.x11.xkb.major, &_glfw.x11.xkb.minor); if (!_glfw.x11.xkb.available) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to load Xkb extension"); return false; } Bool supported; if (<API key>(_glfw.x11.display, True, &supported)) { if (supported) _glfw.x11.xkb.detectable = true; } if (!<API key>()) return false; if (!<API key>(&_glfw.x11.xkb)) return false; if (!<API key>(&_glfw.x11.xkb)) return false; if (!<API key>(&_glfw.x11.xkb, NULL)) return false; // String format atoms _glfw.x11.NULL_ = XInternAtom(_glfw.x11.display, "NULL", False); _glfw.x11.UTF8_STRING = XInternAtom(_glfw.x11.display, "UTF8_STRING", False); _glfw.x11.ATOM_PAIR = XInternAtom(_glfw.x11.display, "ATOM_PAIR", False); // Custom selection property atom _glfw.x11.GLFW_SELECTION = XInternAtom(_glfw.x11.display, "GLFW_SELECTION", False); // ICCCM standard clipboard atoms _glfw.x11.TARGETS = XInternAtom(_glfw.x11.display, "TARGETS", False); _glfw.x11.MULTIPLE = XInternAtom(_glfw.x11.display, "MULTIPLE", False); _glfw.x11.PRIMARY = XInternAtom(_glfw.x11.display, "PRIMARY", False); _glfw.x11.INCR = XInternAtom(_glfw.x11.display, "INCR", False); _glfw.x11.CLIPBOARD = XInternAtom(_glfw.x11.display, "CLIPBOARD", False); // Clipboard manager atoms _glfw.x11.CLIPBOARD_MANAGER = XInternAtom(_glfw.x11.display, "CLIPBOARD_MANAGER", False); _glfw.x11.SAVE_TARGETS = XInternAtom(_glfw.x11.display, "SAVE_TARGETS", False); // Xdnd (drag and drop) atoms _glfw.x11.XdndAware = XInternAtom(_glfw.x11.display, "XdndAware", False); _glfw.x11.XdndEnter = XInternAtom(_glfw.x11.display, "XdndEnter", False); _glfw.x11.XdndPosition = XInternAtom(_glfw.x11.display, "XdndPosition", False); _glfw.x11.XdndStatus = XInternAtom(_glfw.x11.display, "XdndStatus", False); _glfw.x11.XdndActionCopy = XInternAtom(_glfw.x11.display, "XdndActionCopy", False); _glfw.x11.XdndDrop = XInternAtom(_glfw.x11.display, "XdndDrop", False); _glfw.x11.XdndFinished = XInternAtom(_glfw.x11.display, "XdndFinished", False); _glfw.x11.XdndSelection = XInternAtom(_glfw.x11.display, "XdndSelection", False); _glfw.x11.XdndTypeList = XInternAtom(_glfw.x11.display, "XdndTypeList", False); // ICCCM, EWMH and Motif window property atoms // These can be set safely even without WM support // The EWMH atoms that require WM support are handled in detectEWMH _glfw.x11.WM_PROTOCOLS = XInternAtom(_glfw.x11.display, "WM_PROTOCOLS", False); _glfw.x11.WM_STATE = XInternAtom(_glfw.x11.display, "WM_STATE", False); _glfw.x11.WM_DELETE_WINDOW = XInternAtom(_glfw.x11.display, "WM_DELETE_WINDOW", False); _glfw.x11.NET_SUPPORTED = XInternAtom(_glfw.x11.display, "_NET_SUPPORTED", False); _glfw.x11.<API key> = XInternAtom(_glfw.x11.display, "<API key>", False); _glfw.x11.NET_WM_ICON = XInternAtom(_glfw.x11.display, "_NET_WM_ICON", False); _glfw.x11.NET_WM_PING = XInternAtom(_glfw.x11.display, "_NET_WM_PING", False); _glfw.x11.NET_WM_PID = XInternAtom(_glfw.x11.display, "_NET_WM_PID", False); _glfw.x11.NET_WM_NAME = XInternAtom(_glfw.x11.display, "_NET_WM_NAME", False); _glfw.x11.NET_WM_ICON_NAME = XInternAtom(_glfw.x11.display, "_NET_WM_ICON_NAME", False); _glfw.x11.<API key> = XInternAtom(_glfw.x11.display, "<API key>", False); _glfw.x11.<API key> = XInternAtom(_glfw.x11.display, "<API key>", False); _glfw.x11.MOTIF_WM_HINTS = XInternAtom(_glfw.x11.display, "_MOTIF_WM_HINTS", False); // The compositing manager selection name contains the screen number { char name[32]; snprintf(name, sizeof(name), "_NET_WM_CM_S%u", _glfw.x11.screen); _glfw.x11.NET_WM_CM_Sx = XInternAtom(_glfw.x11.display, name, False); } // Detect whether an EWMH-conformant window manager is running detectEWMH(); return true; } // Retrieve system content scale via folklore heuristics void <API key>(float* xscale, float* yscale, bool bypass_cache) { // Start by assuming the default X11 DPI // NOTE: Some desktop environments (KDE) may remove the Xft.dpi field when it // would be set to 96, so assume that is the case if we cannot find it float xdpi = 96.f, ydpi = 96.f; // NOTE: Basing the scale on Xft.dpi where available should provide the most // consistent user experience (matches Qt, Gtk, etc), although not // always the most accurate one char* rms = NULL; char* owned_rms = NULL; if (bypass_cache) { <API key>(_glfw.x11.root, _glfw.x11.RESOURCE_MANAGER, XA_STRING, (unsigned char**) &owned_rms); rms = owned_rms; } else { rms = <API key>(_glfw.x11.display); } if (rms) { XrmDatabase db = <API key>(rms); if (db) { XrmValue value; char* type = NULL; if (XrmGetResource(db, "Xft.dpi", "Xft.Dpi", &type, &value)) { if (type && strcmp(type, "String") == 0) xdpi = ydpi = (float)atof(value.addr); } XrmDestroyDatabase(db); } XFree(owned_rms); } *xscale = xdpi / 96.f; *yscale = ydpi / 96.f; } // Create a blank cursor for hidden and disabled cursor modes static Cursor createHiddenCursor(void) { unsigned char pixels[16 * 16 * 4] = { 0 }; GLFWimage image = { 16, 16, pixels }; return <API key>(&image, 0, 0); } // Create a helper window for IPC static Window createHelperWindow(void) { <API key> wa; wa.event_mask = PropertyChangeMask; return XCreateWindow(_glfw.x11.display, _glfw.x11.root, 0, 0, 1, 1, 0, 0, InputOnly, DefaultVisual(_glfw.x11.display, _glfw.x11.screen), CWEventMask, &wa); } // X error handler static int errorHandler(Display *display, XErrorEvent* event) { if (_glfw.x11.display != display) return 0; _glfw.x11.errorCode = event->error_code; return 0; } /// GLFW internal API ////// // Sets the X error handler callback void <API key>(void) { _glfw.x11.errorCode = Success; XSetErrorHandler(errorHandler); } // Clears the X error handler callback void <API key>(void) { // Synchronize to make sure all commands are processed XSync(_glfw.x11.display, False); XSetErrorHandler(NULL); } // Reports the specified error, appending information about the last X error void _glfwInputErrorX11(int error, const char* message) { char buffer[_GLFW_MESSAGE_SIZE]; XGetErrorText(_glfw.x11.display, _glfw.x11.errorCode, buffer, sizeof(buffer)); _glfwInputError(error, "%s: %s", message, buffer); } // Creates a native cursor object from the specified image and hotspot Cursor <API key>(const GLFWimage* image, int xhot, int yhot) { int i; Cursor cursor; if (!_glfw.x11.xcursor.handle) return None; XcursorImage* native = XcursorImageCreate(image->width, image->height); if (native == NULL) return None; native->xhot = xhot; native->yhot = yhot; unsigned char* source = (unsigned char*) image->pixels; XcursorPixel* target = native->pixels; for (i = 0; i < image->width * image->height; i++, target++, source += 4) { unsigned int alpha = source[3]; *target = (alpha << 24) | ((unsigned char) ((source[0] * alpha) / 255) << 16) | ((unsigned char) ((source[1] * alpha) / 255) << 8) | ((unsigned char) ((source[2] * alpha) / 255) << 0); } cursor = <API key>(_glfw.x11.display, native); XcursorImageDestroy(native); return cursor; } /// GLFW platform API ////// int _glfwPlatformInit(void) { XInitThreads(); XrmInitialize(); _glfw.x11.display = XOpenDisplay(NULL); if (!_glfw.x11.display) { const char* display = getenv("DISPLAY"); if (display) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to open display %s", display); } else { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: The DISPLAY environment variable is missing"); } return false; } if (!initPollData(&_glfw.x11.eventLoopData, ConnectionNumber(_glfw.x11.display))) { _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to initialize event loop data"); } glfw_dbus_init(&_glfw.x11.dbus, &_glfw.x11.eventLoopData); _glfw.x11.screen = DefaultScreen(_glfw.x11.display); _glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen); _glfw.x11.context = XUniqueContext(); _glfw.x11.RESOURCE_MANAGER = XInternAtom(_glfw.x11.display, "RESOURCE_MANAGER", True); XSelectInput(_glfw.x11.display, _glfw.x11.root, PropertyChangeMask); <API key>(&_glfw.x11.contentScaleX, &_glfw.x11.contentScaleY, false); if (!initExtensions()) return false; _glfw.x11.helperWindowHandle = createHelperWindow(); _glfw.x11.hiddenCursorHandle = createHiddenCursor(); <API key>(); return true; } void <API key>(void) { removeAllTimers(&_glfw.x11.eventLoopData); if (_glfw.x11.helperWindowHandle) { if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD) == _glfw.x11.helperWindowHandle) { <API key>(); } XDestroyWindow(_glfw.x11.display, _glfw.x11.helperWindowHandle); _glfw.x11.helperWindowHandle = None; } if (_glfw.x11.hiddenCursorHandle) { XFreeCursor(_glfw.x11.display, _glfw.x11.hiddenCursorHandle); _glfw.x11.hiddenCursorHandle = (Cursor) 0; } glfw_xkb_release(&_glfw.x11.xkb); glfw_dbus_terminate(&_glfw.x11.dbus); free(_glfw.x11.<API key>); free(_glfw.x11.clipboardString); if (_glfw.x11.display) { XCloseDisplay(_glfw.x11.display); _glfw.x11.display = NULL; _glfw.x11.eventLoopData.fds[0].fd = -1; } if (_glfw.x11.xcursor.handle) { _glfw_dlclose(_glfw.x11.xcursor.handle); _glfw.x11.xcursor.handle = NULL; } if (_glfw.x11.randr.handle) { _glfw_dlclose(_glfw.x11.randr.handle); _glfw.x11.randr.handle = NULL; } if (_glfw.x11.xinerama.handle) { _glfw_dlclose(_glfw.x11.xinerama.handle); _glfw.x11.xinerama.handle = NULL; } if (_glfw.x11.xrender.handle) { _glfw_dlclose(_glfw.x11.xrender.handle); _glfw.x11.xrender.handle = NULL; } if (_glfw.x11.vidmode.handle) { _glfw_dlclose(_glfw.x11.vidmode.handle); _glfw.x11.vidmode.handle = NULL; } if (_glfw.x11.xi.handle) { _glfw_dlclose(_glfw.x11.xi.handle); _glfw.x11.xi.handle = NULL; } // NOTE: These need to be unloaded after XCloseDisplay, as they register // cleanup callbacks that get called by that function _glfwTerminateEGL(); _glfwTerminateGLX(); finalizePollData(&_glfw.x11.eventLoopData); } const char* <API key>(void) { return <API key> " X11 GLX EGL OSMesa" #if defined(_POSIX_TIMERS) && defined(<API key>) " clock_gettime" #else " gettimeofday" #endif #if defined(__linux__) " evdev" #endif #if defined(_GLFW_BUILD_DLL) " shared" #endif ; } #include "main_loop.h"
#include <stdint.h> /* define compiler specific symbols */ #if defined ( __CC_ARM ) #define __ASM __asm /*!< asm keyword for armcc */ #define __INLINE __inline /*!< inline keyword for armcc */ #elif defined ( __ICCARM__ ) #define __ASM __asm /*!< asm keyword for iarcc */ #define __INLINE inline /*!< inline keyword for iarcc. Only avaiable in High optimization mode! */ #define __nop __no_operation /*!< no operation intrinsic in iarcc */ #elif defined ( __GNUC__ ) #define __ASM asm /*!< asm keyword for gcc */ #define __INLINE inline /*!< inline keyword for gcc */ #endif #if defined ( __CC_ARM ) /** * @brief Return the Process Stack Pointer * * @param none * @return uint32_t ProcessStackPointer * * Return the actual process stack pointer */ __ASM uint32_t __get_PSP(void) { mrs r0, psp bx lr } /** * @brief Set the Process Stack Pointer * * @param uint32_t Process Stack Pointer * @return none * * Assign the value ProcessStackPointer to the MSP * (process stack pointer) Cortex processor register */ __ASM void __set_PSP(uint32_t topOfProcStack) { msr psp, r0 bx lr } /** * @brief Return the Main Stack Pointer * * @param none * @return uint32_t Main Stack Pointer * * Return the current value of the MSP (main stack pointer) * Cortex processor register */ __ASM uint32_t __get_MSP(void) { mrs r0, msp bx lr } /** * @brief Set the Main Stack Pointer * * @param uint32_t Main Stack Pointer * @return none * * Assign the value mainStackPointer to the MSP * (main stack pointer) Cortex processor register */ __ASM void __set_MSP(uint32_t mainStackPointer) { msr msp, r0 bx lr } /** * @brief Reverse byte order in unsigned short value * * @param uint16_t value to reverse * @return uint32_t reversed value * * Reverse byte order in unsigned short value */ __ASM uint32_t __REV16(uint16_t value) { rev16 r0, r0 bx lr } /** * @brief Reverse byte order in signed short value with sign extension to integer * * @param int16_t value to reverse * @return int32_t reversed value * * Reverse byte order in signed short value with sign extension to integer */ __ASM int32_t __REVSH(int16_t value) { revsh r0, r0 bx lr } #if (__ARMCC_VERSION < 400000) __ASM void __CLREX(void) { clrex } /** * @brief Return the Base Priority value * * @param none * @return uint32_t BasePriority * * Return the content of the base priority register */ __ASM uint32_t __get_BASEPRI(void) { mrs r0, basepri bx lr } /** * @brief Set the Base Priority value * * @param uint32_t BasePriority * @return none * * Set the base priority register */ __ASM void __set_BASEPRI(uint32_t basePri) { msr basepri, r0 bx lr } /** * @brief Return the Priority Mask value * * @param none * @return uint32_t PriMask * * Return the state of the priority mask bit from the priority mask * register */ __ASM uint32_t __get_PRIMASK(void) { mrs r0, primask bx lr } /** * @brief Set the Priority Mask value * * @param uint32_t PriMask * @return none * * Set the priority mask bit in the priority mask register */ __ASM void __set_PRIMASK(uint32_t priMask) { msr primask, r0 bx lr } /** * @brief Return the Fault Mask value * * @param none * @return uint32_t FaultMask * * Return the content of the fault mask register */ __ASM uint32_t __get_FAULTMASK(void) { mrs r0, faultmask bx lr } /** * @brief Set the Fault Mask value * * @param uint32_t faultMask value * @return none * * Set the fault mask register */ __ASM void __set_FAULTMASK(uint32_t faultMask) { msr faultmask, r0 bx lr } /** * @brief Return the Control Register value * * @param none * @return uint32_t Control value * * Return the content of the control register */ __ASM uint32_t __get_CONTROL(void) { mrs r0, control bx lr } /** * @brief Set the Control Register value * * @param uint32_t Control value * @return none * * Set the control register */ __ASM void __set_CONTROL(uint32_t control) { msr control, r0 bx lr } #endif /* __ARMCC_VERSION */ #elif (defined (__ICCARM__)) #pragma diag_suppress=Pe940 /** * @brief Return the Process Stack Pointer * * @param none * @return uint32_t ProcessStackPointer * * Return the actual process stack pointer */ uint32_t __get_PSP(void) { __ASM("mrs r0, psp"); __ASM("bx lr"); } /** * @brief Set the Process Stack Pointer * * @param uint32_t Process Stack Pointer * @return none * * Assign the value ProcessStackPointer to the MSP * (process stack pointer) Cortex processor register */ void __set_PSP(uint32_t topOfProcStack) { __ASM("msr psp, r0"); __ASM("bx lr"); } /** * @brief Return the Main Stack Pointer * * @param none * @return uint32_t Main Stack Pointer * * Return the current value of the MSP (main stack pointer) * Cortex processor register */ uint32_t __get_MSP(void) { __ASM("mrs r0, msp"); __ASM("bx lr"); } /** * @brief Set the Main Stack Pointer * * @param uint32_t Main Stack Pointer * @return none * * Assign the value mainStackPointer to the MSP * (main stack pointer) Cortex processor register */ void __set_MSP(uint32_t topOfMainStack) { __ASM("msr msp, r0"); __ASM("bx lr"); } /** * @brief Reverse byte order in unsigned short value * * @param uint16_t value to reverse * @return uint32_t reversed value * * Reverse byte order in unsigned short value */ uint32_t __REV16(uint16_t value) { __ASM("rev16 r0, r0"); __ASM("bx lr"); } /** * @brief Reverse bit order of value * * @param uint32_t value to reverse * @return uint32_t reversed value * * Reverse bit order of value */ uint32_t __RBIT(uint32_t value) { __ASM("rbit r0, r0"); __ASM("bx lr"); } /** * @brief LDR Exclusive * * @param uint8_t* address * @return uint8_t value of (*address) * * Exclusive LDR command */ uint8_t __LDREXB(uint8_t *addr) { __ASM("ldrexb r0, [r0]"); __ASM("bx lr"); } /** * @brief LDR Exclusive * * @param uint16_t* address * @return uint16_t value of (*address) * * Exclusive LDR command */ uint16_t __LDREXH(uint16_t *addr) { __ASM("ldrexh r0, [r0]"); __ASM("bx lr"); } /** * @brief LDR Exclusive * * @param uint32_t* address * @return uint32_t value of (*address) * * Exclusive LDR command */ uint32_t __LDREXW(uint32_t *addr) { __ASM("ldrex r0, [r0]"); __ASM("bx lr"); } /** * @brief STR Exclusive * * @param uint8_t *address * @param uint8_t value to store * @return uint32_t successful / failed * * Exclusive STR command */ uint32_t __STREXB(uint8_t value, uint8_t *addr) { __ASM("strexb r0, r0, [r1]"); __ASM("bx lr"); } /** * @brief STR Exclusive * * @param uint16_t *address * @param uint16_t value to store * @return uint32_t successful / failed * * Exclusive STR command */ uint32_t __STREXH(uint16_t value, uint16_t *addr) { __ASM("strexh r0, r0, [r1]"); __ASM("bx lr"); } /** * @brief STR Exclusive * * @param uint32_t *address * @param uint32_t value to store * @return uint32_t successful / failed * * Exclusive STR command */ uint32_t __STREXW(uint32_t value, uint32_t *addr) { __ASM("strex r0, r0, [r1]"); __ASM("bx lr"); } #pragma diag_default=Pe940 #elif (defined (__GNUC__)) /** * @brief Return the Process Stack Pointer * * @param none * @return uint32_t ProcessStackPointer * * Return the actual process stack pointer */ uint32_t __get_PSP(void) { uint32_t result=0; __ASM volatile ("MRS %0, psp" : "=r" (result) ); return(result); } /** * @brief Set the Process Stack Pointer * * @param uint32_t Process Stack Pointer * @return none * * Assign the value ProcessStackPointer to the MSP * (process stack pointer) Cortex processor register */ void __set_PSP(uint32_t topOfProcStack) { __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) ); } /** * @brief Return the Main Stack Pointer * * @param none * @return uint32_t Main Stack Pointer * * Return the current value of the MSP (main stack pointer) * Cortex processor register */ uint32_t __get_MSP(void) { uint32_t result=0; __ASM volatile ("MRS %0, msp" : "=r" (result) ); return(result); } /** * @brief Set the Main Stack Pointer * * @param uint32_t Main Stack Pointer * @return none * * Assign the value mainStackPointer to the MSP * (main stack pointer) Cortex processor register */ void __set_MSP(uint32_t topOfMainStack) { __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) ); } /** * @brief Return the Base Priority value * * @param none * @return uint32_t BasePriority * * Return the content of the base priority register */ uint32_t __get_BASEPRI(void) { uint32_t result=0; __ASM volatile ("MRS %0, basepri_max" : "=r" (result) ); return(result); } /** * @brief Set the Base Priority value * * @param uint32_t BasePriority * @return none * * Set the base priority register */ void __set_BASEPRI(uint32_t value) { __ASM volatile ("MSR basepri, %0" : : "r" (value) ); } /** * @brief Return the Priority Mask value * * @param none * @return uint32_t PriMask * * Return the state of the priority mask bit from the priority mask * register */ uint32_t __get_PRIMASK(void) { uint32_t result=0; __ASM volatile ("MRS %0, primask" : "=r" (result) ); return(result); } /** * @brief Set the Priority Mask value * * @param uint32_t PriMask * @return none * * Set the priority mask bit in the priority mask register */ void __set_PRIMASK(uint32_t priMask) { __ASM volatile ("MSR primask, %0" : : "r" (priMask) ); } /** * @brief Return the Fault Mask value * * @param none * @return uint32_t FaultMask * * Return the content of the fault mask register */ uint32_t __get_FAULTMASK(void) { uint32_t result=0; __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); return(result); } /** * @brief Set the Fault Mask value * * @param uint32_t faultMask value * @return none * * Set the fault mask register */ void __set_FAULTMASK(uint32_t faultMask) { __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) ); } /** * @brief Reverse byte order in integer value * * @param uint32_t value to reverse * @return uint32_t reversed value * * Reverse byte order in integer value */ uint32_t __REV(uint32_t value) { uint32_t result=0; __ASM volatile ("rev %0, %1" : "=r" (result) : "r" (value) ); return(result); } /** * @brief Reverse byte order in unsigned short value * * @param uint16_t value to reverse * @return uint32_t reversed value * * Reverse byte order in unsigned short value */ uint32_t __REV16(uint16_t value) { uint32_t result=0; __ASM volatile ("rev16 %0, %1" : "=r" (result) : "r" (value) ); return(result); } /** * @brief Reverse byte order in signed short value with sign extension to integer * * @param int32_t value to reverse * @return int32_t reversed value * * Reverse byte order in signed short value with sign extension to integer */ int32_t __REVSH(int16_t value) { uint32_t result=0; __ASM volatile ("revsh %0, %1" : "=r" (result) : "r" (value) ); return(result); } /** * @brief Reverse bit order of value * * @param uint32_t value to reverse * @return uint32_t reversed value * * Reverse bit order of value */ uint32_t __RBIT(uint32_t value) { uint32_t result=0; __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); return(result); } /** * @brief LDR Exclusive * * @param uint8_t* address * @return uint8_t value of (*address) * * Exclusive LDR command */ uint8_t __LDREXB(uint8_t *addr) { uint8_t result=0; __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) ); return(result); } /** * @brief LDR Exclusive * * @param uint16_t* address * @return uint16_t value of (*address) * * Exclusive LDR command */ uint16_t __LDREXH(uint16_t *addr) { uint16_t result=0; __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) ); return(result); } /** * @brief LDR Exclusive * * @param uint32_t* address * @return uint32_t value of (*address) * * Exclusive LDR command */ uint32_t __LDREXW(uint32_t *addr) { uint32_t result=0; __ASM volatile ("ldrex %0, [%1]" : "=r" (result) : "r" (addr) ); return(result); } /** * @brief STR Exclusive * * @param uint8_t *address * @param uint8_t value to store * @return uint32_t successful / failed * * Exclusive STR command */ uint32_t __STREXB(uint8_t value, uint8_t *addr) { // uint32_t result=0; register uint32_t result asm("r4") =0; __ASM volatile ("strexb %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) ); return(result); } /** * @brief STR Exclusive * * @param uint16_t *address * @param uint16_t value to store * @return uint32_t successful / failed * * Exclusive STR command */ uint32_t __STREXH(uint16_t value, uint16_t *addr) { // uint32_t result=0; register uint32_t result asm("r4") =0; __ASM volatile ("strexh %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) ); return(result); } /** * @brief STR Exclusive * * @param uint32_t *address * @param uint32_t value to store * @return uint32_t successful / failed * * Exclusive STR command */ uint32_t __STREXW(uint32_t value, uint32_t *addr) { uint32_t result=0; __ASM volatile ("strex %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) ); return(result); } /** * @brief Return the Control Register value * * @param none * @return uint32_t Control value * * Return the content of the control register */ uint32_t __get_CONTROL(void) { uint32_t result=0; __ASM volatile ("MRS %0, control" : "=r" (result) ); return(result); } /** * @brief Set the Control Register value * * @param uint32_t Control value * @return none * * Set the control register */ void __set_CONTROL(uint32_t control) { __ASM volatile ("MSR control, %0" : : "r" (control) ); } #endif
#include "<API key>.h" #include <cassert> #include "src/io/AnsiColors.h" #include "src/i18n/notr.h" <API key>::<API key> (const QSqlError &error, AbstractInterface::<API key> statement): SqlException (error), statement (statement) { } <API key> *<API key>::clone () const { return new <API key> (error, statement); } void <API key>::rethrow () const { throw <API key> (error, statement); } QString <API key>::toString () const { return makeString (qnotr ( "Transaction failed:\n" " Statement : %1\n") .arg (AbstractInterface::<API key> (statement)) ); } QString <API key>::colorizedString () const { AnsiColors c; return makeColorizedString (qnotr ( "%1Transaction failed%2:\n" " Statement : %3") .arg (c.red ()).arg (c.reset ()) .arg (AbstractInterface::<API key> (statement)) ); }
#include"hpmlogic.h" #include<arm_neon.h> HPM_IMP(hpmboolean, hpm_vec_eqfv, hpmvecf a, hpmvecf b){ return vceqs_f32(a, b); } HPM_IMP(hpmboolean, hpm_vec_neqfv, hpmvecf a, hpmvecf b){ return !vceqs_f32(a, b); } HPM_IMP(void, hpm_vec4_com_eqfv, const hpmvec4f* HPM_RESTRICT a, const hpmvec4f* HPM_RESTRICT b, hpmvec4f* HPM_RESTRICT res){ *res = <API key>(vceqq_f32(*a, *b)); } HPM_IMP(hpmboolean, hpm_vec4_eqfv, const hpmvec4f* HPM_RESTRICT a, const hpmvec4f* HPM_RESTRICT b){ hpmvec4i cmp = <API key>(vceqq_f32(*a, *b)); return (cmp[0] & cmp[1]) != 0; } HPM_IMP(void, hpm_vec4_com_neqfv, const hpmvec4f* HPM_RESTRICT a, const hpmvec4f* HPM_RESTRICT b, hpmvec4f* HPM_RESTRICT res){ *res = <API key>(vmvnq_u32(vceqq_f32(*a, *b))); } HPM_IMP(hpmboolean, hpm_vec4_neqfv, const hpmvec4f* HPM_RESTRICT a, const hpmvec4f* HPM_RESTRICT b){ return !HPM_CALLLOCALFUNC(hpm_vec4_eqfv)(a,b); } HPM_IMP(void, hpm_vec4_com_gfv, const hpmvec4f* HPM_RESTRICT a, const hpmvec4f* HPM_RESTRICT b, hpmvec4f* HPM_RESTRICT res){ *res = <API key>( vcgtq_f32(*a, *b) ); } HPM_IMP(void, hpm_vec4_com_lfv, const hpmvec4f* HPM_RESTRICT a, const hpmvec4f* HPM_RESTRICT b, hpmvec4f* HPM_RESTRICT res){
#!/usr/bin/env python import mirheo as mir ranks = (1, 1, 1) domain = (4, 4, 4) u = mir.Mirheo(ranks, domain, debug_level=3, log_filename='log', no_splash=True) u.<API key>("tasks.full", current=False) # sTEST: dump.graph.full # cd dump # rm -rf tasks.graphml # mir.run --runargs "-n 1" ./graph.full.py # cat tasks.full.graphml > tasks.out.txt
package org.worldgrower.creaturetype; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.worldgrower.Constants; import org.worldgrower.TestUtils; import org.worldgrower.WorldObject; import org.worldgrower.attribute.IdList; import org.worldgrower.condition.VampireUtils; import org.worldgrower.condition.<API key>; public class <API key> { @Test public void testIsUndead() { WorldObject performer = TestUtils.<API key>(0, Constants.GROUP, new IdList()); assertEquals(false, CreatureTypeUtils.isUndead(performer)); VampireUtils.vampirizePerson(performer, new <API key>()); assertEquals(true, CreatureTypeUtils.isUndead(performer)); } @Test public void testIsHumanoid() { assertEquals(true, CreatureTypeUtils.isHumanoid(TestUtils.<API key>(0, Constants.GROUP, new IdList()))); assertEquals(false, CreatureTypeUtils.isHumanoid(TestUtils.<API key>(2, Constants.CREATURE_TYPE, CreatureType.COW_CREATURE_TYPE))); assertEquals(false, CreatureTypeUtils.isHumanoid(TestUtils.<API key>(0, 0, 1, 1, Constants.ID, 2))); } }
console.log(solve(process.argv)); function solve (arguments) { return calcCylinderVol(arguments.slice(2)); } function calcCylinderVol (arguments) { var radius = +arguments[0], height = +arguments[1] ; return (radius * radius * Math.PI * height).toFixed(3); }
/** * Configuration_adv.h * * Advanced settings. * Only change these if you know exactly what you're doing. * Some of these settings can damage your printer if improperly set! * * Basic settings can be found in Configuration.h * */ #ifndef CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H #define <API key> 010100 // @section temperature #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T><API key> #endif #endif /** * Thermal Protection protects your printer from damage and fire if a * thermistor falls out or temperature sensors fail in any way. * * The issue: If a thermistor falls out or a temperature sensor fails, * Marlin can no longer sense the actual temperature. Since a disconnected * thermistor reads as a low temperature, the firmware will keep the heater on. * * The solution: Once the temperature reaches the target, start observing. * If the temperature stays too far below the target (hysteresis) for too long (period), * the firmware will halt the machine as a safety precaution. * * If you get false positives for "Thermal Runaway" increase <API key> and/or <API key> */ #if ENABLED(<API key>) #define <API key> 40 // Seconds #define <API key> 4 // Degrees Celsius /** * Whenever an M104 or M109 increases the target temperature the firmware will wait for the * WATCH_TEMP_PERIOD to expire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109, * but only if the current temperature is far enough below the target for a reliable test. * * If you get false positives for "Heating failed" increase WATCH_TEMP_PERIOD and/or decrease WATCH_TEMP_INCREASE * WATCH_TEMP_INCREASE should not be below 2. */ #define WATCH_TEMP_PERIOD 20 // Seconds #define WATCH_TEMP_INCREASE 2 // Degrees Celsius #endif /** * Thermal Protection parameters for the bed are just as above for hotends. */ #if ENABLED(<API key>) #define <API key> 20 // Seconds #define <API key> 2 // Degrees Celsius /** * Whenever an M140 or M190 increases the target temperature the firmware will wait for the * <API key> to expire, and if the temperature hasn't increased by <API key> * degrees, the machine is halted, requiring a hard reset. This test restarts with any M140/M190, * but only if the current temperature is far enough below the target for a reliable test. * * If you get too many "Heating failed" errors, increase <API key> and/or decrease * <API key>. (<API key> should not be below 2.) */ #define <API key> 60 // Seconds #define <API key> 2 // Degrees Celsius #endif #if ENABLED(PIDTEMP) // this adds an experimental additional term to the heating power, proportional to the extrusion speed. // if Kc is chosen well, the additional required power due to increased melting should be compensated. //#define <API key> #if ENABLED(<API key>) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) #define LPQ_MAX_LEN 50 #endif #endif /** * Automatic Temperature: * The hotend target temperature is calculated by all the buffered lines of gcode. * The maximum buffered steps/sec of the extruder motor is called "se". * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor> * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by * mintemp and maxtemp. Turn this off by executing M109 without F* * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode */ #define AUTOTEMP #if ENABLED(AUTOTEMP) #define AUTOTEMP_OLDWEIGHT 0.98 #endif // Show Temperature ADC value // Enable for M105 to include ADC values read from temperature sensors. //#define <API key> /** * High Temperature Thermistor Support * * Thermistors able to support high temperature tend to have a hard time getting * good readings at room and lower temperatures. This means <API key> * will probably be caught when the heating element first turns on during the * preheating process, which will trigger a min_temp_error as a safety measure * and force stop everything. * To circumvent this limitation, we allow for a preheat time (during which, * min_temp_error won't be triggered) and add a min_temp buffer to handle * aberrant readings. * * If you want to enable this feature for your hotend thermistor(s) * uncomment and set values > 0 in the constants below */ // The number of consecutive low temperature errors that can occur // before a min_temp_error is triggered. (Shouldn't be more than 10.) //#define <API key> 0 // The number of milliseconds a hotend will preheat before starting to check // the temperature. This value should NOT be set to the time it takes the // hot end to reach the target temperature, but the time it takes to reach // the minimum temperature your thermistor can read. The lower the better/safer. // This shouldn't need to be more than 30 seconds (30000) //#define <API key> 0 // @section extruder // Extruder runout prevention. // If the machine is idle and the temperature over MINTEMP // then extrude some filament every couple of SECONDS. //#define <API key> #if ENABLED(<API key>) #define <API key> 190 #define <API key> 30 #define <API key> 1500 // mm/m #define <API key> 5 #endif // @section temperature //These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements. //The measured temperature is defined as "actualTemp = (measuredTemp * <API key>) + <API key>" #define <API key> 0.0 #define <API key> 1.0 /** * Controller Fan * To cool down the stepper drivers and MOSFETs. * * The fan will turn on automatically whenever any stepper is enabled * and turn off after a set period after all steppers are turned off. */ //#define USE_CONTROLLER_FAN #if ENABLED(USE_CONTROLLER_FAN) //#define CONTROLLER_FAN_PIN FAN1_PIN // Set a custom pin for the controller fan #define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled #define CONTROLLERFAN_SPEED 255 // 255 == full speed #endif // When first starting the main fan, run it at full speed for the // given number of milliseconds. This gets the fan spinning reliably // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) //#define FAN_KICKSTART_TIME 100 // This defines the minimal speed for the main fan, run in PWM mode // to enable uncomment and set minimal PWM speed for reliable running (1-255) // if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM //#define FAN_MIN_PWM 50 // @section extruder /** * Extruder cooling fans * * Extruder auto fans automatically turn on when their extruders' * temperatures go above <API key>. * * Your board's pins file specifies the recommended pins. Override those here * or set to -1 to disable completely. * * Multiple extruders can be assigned to the same pin in which case * the fan will turn on when any selected extruder is above the threshold. */ #define E0_AUTO_FAN_PIN -1 #define E1_AUTO_FAN_PIN -1 #define E2_AUTO_FAN_PIN -1 #define E3_AUTO_FAN_PIN -1 #define E4_AUTO_FAN_PIN -1 #define <API key> 50 #define <API key> 255 // == full speed /** * Part-Cooling Fan Multiplexer * * This feature allows you to digitally multiplex the fan output. * The multiplexer is automatically switched at tool-change. * Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans. */ #define FANMUX0_PIN -1 #define FANMUX1_PIN -1 #define FANMUX2_PIN -1 /** * M355 Case Light on-off / brightness */ //#define CASE_LIGHT_ENABLE #if ENABLED(CASE_LIGHT_ENABLE) //#define CASE_LIGHT_PIN 4 // Override the default pin if needed #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW #define <API key> true // Set default power-up state on #define <API key> 105 // Set default power-up brightness (0-255, requires PWM pin) //#define <API key> // Add a Case Light option to the LCD main menu #endif // @section homing // If you want endstops to stay on (by default) even when not homing // enable this option. Override at any time with M120, M121. //#define <API key> // @section extras //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. // Dual X Steppers // Uncomment this option to drive two X axis motors. // The next unused E driver will be assigned to the second X stepper. //#define <API key> #if ENABLED(<API key>) // Set true if the two X motors need to rotate in opposite directions #define INVERT_X2_VS_X_DIR true #endif // Dual Y Steppers // Uncomment this option to drive two Y axis motors. // The next unused E driver will be assigned to the second Y stepper. //#define <API key> #if ENABLED(<API key>) // Set true if the two Y motors need to rotate in opposite directions #define INVERT_Y2_VS_Y_DIR true #endif // A single Z stepper driver is usually used to drive 2 stepper motors. // Uncomment this option to use a separate stepper driver for each Z axis motor. // The next unused E driver will be assigned to the second Z stepper. //#define <API key> #if ENABLED(<API key>) // Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper. // That way the machine is capable to align the bed during home, since both Z steppers are homed. // There is also an implementation of M666 (software endstops adjustment) to this feature. // After Z homing, this adjustment is applied to just one of the steppers in order to align the bed. // One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2. // If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive. // Play a little bit with small adjustments (0.5mm) and check the behaviour. // The M119 (endstops report) will start reporting the Z2 Endstop as well. //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) #define Z2_USE_ENDSTOP _XMAX_ #define <API key> 0 // Use M666 to determine/test this value #endif #endif // <API key> // Enable this for dual x-carriage printers. // A dual x-carriage design has the advantage that the inactive extruder can be parked which // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage // allowing faster printing speeds. Connect your X2 stepper to the first unused E plug. //#define DUAL_X_CARRIAGE #if ENABLED(DUAL_X_CARRIAGE) // Configuration for second X-carriage // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop; // the second x-carriage always homes to the maximum endstop. #define X2_MIN_POS 80 // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage #define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed #define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position // However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops // without modifying the firmware (through the "M218 T1 X???" command). // Remember: you should set the second extruder x-offset to 0 in your slicer. // There are a few selectable movement modes for dual x-carriages using M605 S<mode> // Mode 0 (<API key>): Full control. The slicer has full control over both x-carriages and can achieve optimal travel results // as long as it supports dual x-carriages. (M605 S0) // Mode 1 (DXC_AUTO_PARK_MODE) : Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so // that additional slicer support is not required. (M605 S1) // Mode 2 (<API key>) : Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all // actions of the first x-carriage. This allows the printer to print 2 arbitrary items at // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) // This is the default power-up mode which can be later using M605. #define <API key> <API key> // Default settings in "Auto-park Mode" #define <API key> 0.2 // the distance to raise Z axis when parking an extruder #define <API key> 1 // the distance to raise Z axis when unparking an extruder // Default x offset in duplication mode (typically set to half print bed width) #define <API key> 100 #endif // DUAL_X_CARRIAGE // Activate a solenoid on the active extruder with M380. Disable all with M381. // Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. //#define EXT_SOLENOID // @section homing //homing hits the endstop, then retracts by this distance, before it tries to slowly bump again: #define X_HOME_BUMP_MM 5 #define Y_HOME_BUMP_MM 5 #define Z_HOME_BUMP_MM 2 #define HOMING_BUMP_DIVISOR {2, 2, 4} // Re-Bump Speed Divisor (Divides the Homing Feedrate) //#define QUICK_HOME //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially. // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X // @section machine #define AXIS_RELATIVE_MODES {false, false, false, false} // Allow duplication mode with a basic dual-nozzle extruder //#define <API key> // By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. #define INVERT_X_STEP_PIN false #define INVERT_Y_STEP_PIN false #define INVERT_Z_STEP_PIN false #define INVERT_E_STEP_PIN false // Default stepper release if idle. Set to 0 to deactivate. // Steppers will shut down <API key> seconds after the last move when DISABLE_INACTIVE_? is true. // Time can be set by M18 and M84. #define <API key> 60 #define DISABLE_INACTIVE_X true #define DISABLE_INACTIVE_Y true #define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished. #define DISABLE_INACTIVE_E true #define <API key> 0.0 // minimum feedrate #define <API key> 0.0 //#define <API key> // Require rehoming after steppers are deactivated // @section lcd #if ENABLED(ULTIPANEL) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel #define <API key> // Comment to disable setting feedrate multiplier via encoder #endif // @section extras // minimum time in microseconds that a movement needs to take if the buffer is emptied. #define <API key> 20000 // If defined the movements slow down when the look ahead buffer is only half full #define SLOWDOWN // Frequency limit // See nophead's blog for more info // Not working O //#define XY_FREQUENCY_LIMIT 15 // Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end // of the buffer and all stops. This should not be much greater than zero and should only be changed // if unwanted behavior is observed on a user's machine when running at very slow speeds. #define <API key> 0.05 // (mm/sec) // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16] /** * @section stepper motor current * * Some boards have a means of setting the stepper motor current via firmware. * * The power on motor currents are set by: * PWM_MOTOR_CURRENT - used by MINIRAMBO & ULTIMAIN_2 * known compatible chips: A4982 * <API key> - used by BQ_ZUM_MEGA_3D, RAMBO & SCOOVO_X9H * known compatible chips: AD5206 * <API key> - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 * known compatible chips: MCP4728 * <API key> - used by 5DPRINT, AZTEEG_X3_PRO, MIGHTYBOARD_REVE * known compatible chips: MCP4451, MCP4018 * * Motor currents can also be set by M907 - M910 and by the LCD. * M907 - applies to all. * M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H * M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 */ //#define PWM_MOTOR_CURRENT { 1300, 1300, 1250 } // Values in milliamps //#define <API key> { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) //#define <API key> { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis // Uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro //#define DIGIPOT_I2C #define <API key> 4 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 // Actual motor currents in Amps, need as many here as <API key> #define <API key> { 1.7, 1.7, 1.7, 1.7 } // 5DPRINT #define <API key> // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly #define <API key> 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value #define <API key> 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again // @section lcd // Include a page of printer information in the LCD Main Menu //#define LCD_INFO_MENU // Scroll a longer status message into view //#define <API key> // On the Info Screen, display XY with one decimal place when possible //#define <API key> // The timeout (in ms) to return to the status screen from sub-menus //#define <API key> 15000 #if ENABLED(SDSUPPORT) // Some RAMPS and other boards don't detect when an SD card is inserted. You can work // around this by connecting a push button or single throw switch to the pin defined // as SD_DETECT_PIN in your board's pins definitions. // This setting should be disabled unless you are using a push button, pulling the pin to ground. // Note: This is always disabled for ULTIPANEL (except <API key>). //#define SD_DETECT_INVERTED #define <API key> true //if sd support and the file is finished: disable steppers? #define <API key> "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place. #define <API key> //reverse file order of sd card menu display. Its sorted practically after the file system block order. // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that. // using: //#define MENU_ADDAUTOSTART /** * Sort SD file listings in alphabetical order. * * With this option enabled, items on SD cards will be sorted * by name for easier navigation. * * By default... * * - Use the slowest -but safest- method for sorting. * - Folders are sorted to the top. * - The sort key is statically allocated. * - No added G-code (M34) support. * - 40 item sorting limit. (Items after the first 40 are unsorted.) * * SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the * compiler to calculate the worst-case usage and throw an error if the SRAM * limit is exceeded. * * - SDSORT_USES_RAM provides faster sorting via a static directory buffer. * - SDSORT_USES_STACK does the same, but uses a local stack-based buffer. * - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!) * - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!) */ //#define SDCARD_SORT_ALPHA // SD Card Sorting options #if ENABLED(SDCARD_SORT_ALPHA) #define SDSORT_LIMIT 40 // Maximum number of sorted items (10-256). Costs 27 bytes each. #define FOLDER_SORTING -1 // -1=above 0=none 1=below #define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code. #define SDSORT_USES_RAM false // Pre-allocate a static array for faster pre-sorting. #define SDSORT_USES_STACK false // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) #define SDSORT_CACHE_NAMES false // Keep sorted items in RAM longer for speedy performance. Most expensive option. #define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! #define SDSORT_CACHE_VFATS 2 // Maximum number of 13-byte VFAT entries to use for sorting. // Note: Only affects <API key> with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM. #endif // Show a progress bar on HD44780 LCDs for SD printing //#define LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR) // Amount of time (ms) to show the bar #define <API key> 2000 // Amount of time (ms) to show the status message #define <API key> 3000 // Amount of time (ms) to retain the status message (0=forever) #define PROGRESS_MSG_EXPIRE 0 // Enable this to show messages for MSG_TIME then hide them //#define PROGRESS_MSG_ONCE // Add a menu item to test the progress bar: //#define <API key> #endif // Add an 'M73' G-code to set the current percentage //#define <API key> // This allows hosts to request long names for files and folders with M33 //#define <API key> // Enable this option to scroll long filenames in the SD card menu //#define <API key> // This option allows you to abort SD printing when any endstop is triggered. // This feature must be enabled with "M540 S1" or from the LCD menu. // To have any effect, endstops must be enabled during SD printing. //#define <API key> #endif // SDSUPPORT /** * Additional options for Graphical Displays * * Use the optimizations here to improve printing performance, * which can be adversely affected by graphical display drawing, * especially when doing several short moves, and when printing * on DELTA and SCARA machines. * * Some of these options may result in the display lagging behind * controller events, as there is a trade-off between reliable * printing performance versus fast display updates. */ #if ENABLED(DOGLCD) // Enable to save many cycles by drawing a hollow frame on the Info Screen #define XYZ_HOLLOW_FRAME // Enable to save many cycles by drawing a hollow frame on Menu Screens #define MENU_HOLLOW_FRAME // A bigger font is available for edit items. Costs 3120 bytes of PROGMEM. // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. //#define USE_BIG_EDIT_FONT // A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM. // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. //#define USE_SMALL_INFOFONT // Enable this option and reduce the value to optimize screen updates. //#define DOGM_SPI_DELAY_US 5 #endif // DOGLCD // @section safety // The hardware watchdog should reset the microcontroller disabling all outputs, // in case the firmware gets stuck and doesn't do temperature regulation. #define USE_WATCHDOG #if ENABLED(USE_WATCHDOG) // If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on. // The "<API key>" goes around this by not using the hardware reset. // However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled. //#define <API key> #endif // @section lcd /** * Babystepping enables movement of the axes by tiny increments without changing * the current position values. This feature is used primarily to adjust the Z * axis in the first layer of a print in real-time. * * Warning: Does not respect endstops! */ //#define BABYSTEPPING #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way #define <API key> 100 // Babysteps are very small. Increase for faster motion. //#define <API key> // Enable to combine M851 and Babystepping //#define <API key> // Double-click on the Status Screen for Z Babystepping. #define <API key> 1250 // Maximum interval between clicks, in milliseconds. // Note: Extra time may be added to mitigate controller latency. //#define <API key> // Enable graphical overlay on Z-offset editor //#define <API key> // Reverses the direction of the CW/CCW indicators #endif // @section extruder /** * Implementation of linear pressure control * * Assumption: advance = k * (delta velocity) * K=0 means advance disabled. * See Marlin documentation for calibration instructions. */ //#define LIN_ADVANCE #if ENABLED(LIN_ADVANCE) #define LIN_ADVANCE_K 75 #define <API key> 0 // The calculated ratio (or 0) according to the formula W * H / ((D / 2) ^ 2 * PI) // Example: 0.4 * 0.2 / ((1.75 / 2) ^ 2 * PI) = 0.033260135 #endif // @section leveling #if ENABLED(DELTA) && !defined(<API key>) #define <API key> <API key> #elif IS_SCARA && !defined(<API key>) #define <API key> (SCARA_LINKAGE_1 + SCARA_LINKAGE_2) #endif // Default mesh area is an area with an inset margin on the print area. // Below are the macros that are used to define the borders for the mesh area, // made available here for specialized needs, ie dual extruder setup. #if ENABLED(MESH_BED_LEVELING) #if ENABLED(DELTA) // Probing points may be verified at compile time within the radius // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(<API key>),"bad probe point!") // so that may be added to SanityCheck.h in the future. #define MESH_MIN_X (X_CENTER - (<API key>) + MESH_INSET) #define MESH_MIN_Y (Y_CENTER - (<API key>) + MESH_INSET) #define MESH_MAX_X (X_CENTER + <API key> - (MESH_INSET)) #define MESH_MAX_Y (Y_CENTER + <API key> - (MESH_INSET)) #elif IS_SCARA #define MESH_MIN_X (X_CENTER - (<API key>) + MESH_INSET) #define MESH_MIN_Y (Y_CENTER - (<API key>) + MESH_INSET) #define MESH_MAX_X (X_CENTER + <API key> - (MESH_INSET)) #define MESH_MAX_Y (Y_CENTER + <API key> - (MESH_INSET)) #else // Boundaries for Cartesian probing based on set limits #if ENABLED(BED_CENTER_AT_0_0) #define MESH_MIN_X (max(MESH_INSET, 0) - (X_BED_SIZE) / 2) #define MESH_MIN_Y (max(MESH_INSET, 0) - (Y_BED_SIZE) / 2) #define MESH_MAX_X (min(X_BED_SIZE - (MESH_INSET), X_BED_SIZE) - (X_BED_SIZE) / 2) #define MESH_MAX_Y (min(Y_BED_SIZE - (MESH_INSET), Y_BED_SIZE) - (Y_BED_SIZE) / 2) #else #define MESH_MIN_X (max(X_MIN_POS + MESH_INSET, 0)) #define MESH_MIN_Y (max(Y_MIN_POS + MESH_INSET, 0)) #define MESH_MAX_X (min(X_MAX_POS - (MESH_INSET), X_BED_SIZE)) #define MESH_MAX_Y (min(Y_MAX_POS - (MESH_INSET), Y_BED_SIZE)) #endif #endif #elif ENABLED(<API key>) #if ENABLED(DELTA) // Probing points may be verified at compile time within the radius // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(<API key>),"bad probe point!") // so that may be added to SanityCheck.h in the future. #define UBL_MESH_MIN_X (X_CENTER - (<API key>) + UBL_MESH_INSET) #define UBL_MESH_MIN_Y (Y_CENTER - (<API key>) + UBL_MESH_INSET) #define UBL_MESH_MAX_X (X_CENTER + <API key> - (UBL_MESH_INSET)) #define UBL_MESH_MAX_Y (Y_CENTER + <API key> - (UBL_MESH_INSET)) #elif IS_SCARA #define UBL_MESH_MIN_X (X_CENTER - (<API key>) + UBL_MESH_INSET) #define UBL_MESH_MIN_Y (Y_CENTER - (<API key>) + UBL_MESH_INSET) #define UBL_MESH_MAX_X (X_CENTER + <API key> - (UBL_MESH_INSET)) #define UBL_MESH_MAX_Y (Y_CENTER + <API key> - (UBL_MESH_INSET)) #else // Boundaries for Cartesian probing based on set limits #if ENABLED(BED_CENTER_AT_0_0) #define UBL_MESH_MIN_X (max(UBL_MESH_INSET, 0) - (X_BED_SIZE) / 2) #define UBL_MESH_MIN_Y (max(UBL_MESH_INSET, 0) - (Y_BED_SIZE) / 2) #define UBL_MESH_MAX_X (min(X_BED_SIZE - (UBL_MESH_INSET), X_BED_SIZE) - (X_BED_SIZE) / 2) #define UBL_MESH_MAX_Y (min(Y_BED_SIZE - (UBL_MESH_INSET), Y_BED_SIZE) - (Y_BED_SIZE) / 2) #else #define UBL_MESH_MIN_X (max(X_MIN_POS + UBL_MESH_INSET, 0)) #define UBL_MESH_MIN_Y (max(Y_MIN_POS + UBL_MESH_INSET, 0)) #define UBL_MESH_MAX_X (min(X_MAX_POS - (UBL_MESH_INSET), X_BED_SIZE)) #define UBL_MESH_MAX_Y (min(Y_MAX_POS - (UBL_MESH_INSET), Y_BED_SIZE)) #endif #endif // If this is defined, the currently active mesh will be saved in the // current slot on M500. #define <API key> #endif // @section extras // G2/G3 Arc Support #define ARC_SUPPORT // Disable this feature to save ~3226 bytes #if ENABLED(ARC_SUPPORT) #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles //#define <API key> // Allow G2/G3 to operate in XY, ZX, or YZ planes #endif // Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. //#define <API key> // G38.2 and G38.3 Probe Target // Enable PROBE_DOUBLE_TOUCH if you want G38 to double touch //#define G38_PROBE_TARGET #if ENABLED(G38_PROBE_TARGET) #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) #endif // Moves (or segments) with fewer steps than this will be joined with the next move #define <API key> 6 // Set this if you find stepping unreliable, or if using a very fast CPU. #define <API key> 0 // @section temperature // Control heater 0 and heater 1 in parallel. //#define HEATERS_PARALLEL // @section hidden // The number of linear motions that can be in the plan at any give time. // THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering. #if ENABLED(SDSUPPORT) #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller #else #define BLOCK_BUFFER_SIZE 16 // maximize block buffer #endif // @section serial // The ASCII buffer for serial input #define MAX_CMD_SIZE 96 #define BUFSIZE 4 // Transmission to Host Buffer Size // To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. // To buffer a simple "ok" you need 4 bytes. // For ADVANCED_OK (M105) you need 32 bytes. // For debug-echo: 128 bytes for the optimal speed. // Other output doesn't need to be that speedy. // :[0, 2, 4, 8, 16, 32, 64, 128, 256] #define TX_BUFFER_SIZE 0 // Host Receive Buffer Size // Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough. // To use flow control, set this buffer size to at least 1024 bytes. // :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] //#define RX_BUFFER_SIZE 1024 #if RX_BUFFER_SIZE >= 1024 // Enable to have the controller send XON/XOFF control characters to // the host to signal the RX buffer is becoming full. //#define SERIAL_XON_XOFF #endif #if ENABLED(SDSUPPORT) // Enable this option to collect and display the maximum // RX queue usage after transferring a file to SD. //#define <API key> // Enable this option to collect and display the number // of dropped bytes after a file transfer to SD. //#define <API key> #endif // Enable an emergency-command parser to intercept certain commands as they // enter the serial receive buffer, so they cannot be blocked. // Currently handles M108, M112, M410 // Does not work on boards using AT90USB (USBCON) processors! //#define EMERGENCY_PARSER // Bad Serial-connections can miss a received command by sending an 'ok' // Therefore some clients abort after 30 seconds in a timeout. // Some other clients start sending commands while receiving a 'wait'. // This "wait" is only sent when the buffer is empty. 1 second is a good value here. //#define NO_TIMEOUTS 1000 // Milliseconds // Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. //#define ADVANCED_OK // @section extras /** * Firmware-based and LCD-controlled retract * * Add G10 / G11 commands for automatic firmware-based retract / recover. * Use M207 and M208 to define parameters for retract / recover. * * Use M209 to enable or disable auto-retract. * With auto-retract enabled, all G1 E moves within the set range * will be converted to firmware-based retract/recover moves. * * Be sure to turn off auto-retract during filament change. * * Note that M207 / M208 / M209 settings are saved to EEPROM. * */ //#define FWRETRACT // ONLY PARTIALLY TESTED #if ENABLED(FWRETRACT) #define MIN_AUTORETRACT 0.1 // When auto-retract is on, convert E moves of this length and over #define MAX_AUTORETRACT 10.0 // Upper limit for auto-retract conversion #define RETRACT_LENGTH 3 // Default retract length (positive mm) #define RETRACT_LENGTH_SWAP 13 // Default swap retract length (positive mm), for extruder change #define RETRACT_FEEDRATE 45 // Default feedrate for retracting (mm/s) #define RETRACT_ZLIFT 0 // Default retract Z-lift #define <API key> 0 // Default additional recover length (mm, added to retract length when recovering) #define <API key> 0 // Default additional swap recover length (mm, added to retract length when recovering from extruder change) #define <API key> 8 // Default feedrate for recovering from retraction (mm/s) #define <API key> 8 // Default feedrate for recovering from swap retraction (mm/s) #endif /** * Extra Fan Speed * Adds a secondary fan speed for each print-cooling fan. * 'M106 P<fan> T3-255' : Set a secondary speed for <fan> * 'M106 P<fan> T2' : Use the set secondary speed * 'M106 P<fan> T1' : Restore the previous fan speed */ //#define EXTRA_FAN_SPEED /** * Advanced Pause * Experimental feature for filament change support and for parking the nozzle when paused. * Adds the GCode M600 for initiating filament change. * If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle. * * Requires an LCD display. * This feature is required for the default <API key>. */ //#define <API key> #if ENABLED(<API key>) #define PAUSE_PARK_X_POS 3 // X position of hotend #define PAUSE_PARK_Y_POS 3 // Y position of hotend #define PAUSE_PARK_Z_ADD 10 // Z addition of hotend (lift) #define <API key> 100 // X and Y axes feedrate in mm/s (also used for delta printers Z axis) #define <API key> 5 // Z axis feedrate in mm/s (not used for delta printers) #define <API key> 60 // Initial retract feedrate in mm/s #define <API key> 2 // Initial retract in mm // It is a short retract used immediately after print interrupt before move to filament exchange position #define <API key> 10 // Unload filament feedrate in mm/s - filament unloading can be fast #define <API key> 100 // Unload filament length from hotend in mm // Longer length for bowden printers to unload filament from whole bowden tube, // shorter length for printers without bowden to unload filament from extruder only, // 0 to disable unloading for manual unloading #define <API key> 6 // Load filament feedrate in mm/s - filament loading into the bowden tube can be fast #define <API key> 0 // Load filament length over hotend in mm // Longer length for bowden printers to fast load filament into whole bowden tube over the hotend, // Short or zero length for printers without bowden where loading is not used #define <API key> 3 // Extrude filament feedrate in mm/s - must be slower than load feedrate #define <API key> 50 // Extrude filament length in mm after filament is loaded over the hotend, // 0 to disable for manual extrusion // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend, // or until outcoming filament color is not clear for filament color change #define <API key> 45 // Turn off nozzle if user doesn't change filament within this time limit in seconds #define <API key> 5 // Number of alert beeps before printer goes quiet #define <API key> // Enable to have stepper motors hold position during filament change // even if it takes longer than <API key>. //#define PARK_HEAD_ON_PAUSE // Go to filament change position on pause, return to print position on resume //#define <API key> // Ensure homing has been completed prior to parking for filament change #endif // @section tmc //#define HAVE_TMCDRIVER #if ENABLED(HAVE_TMCDRIVER) //#define X_IS_TMC //#define X2_IS_TMC //#define Y_IS_TMC //#define Y2_IS_TMC //#define Z_IS_TMC //#define Z2_IS_TMC //#define E0_IS_TMC //#define E1_IS_TMC //#define E2_IS_TMC //#define E3_IS_TMC //#define E4_IS_TMC #define X_MAX_CURRENT 1000 // in mA #define X_SENSE_RESISTOR 91 // in mOhms #define X_MICROSTEPS 16 // number of microsteps #define X2_MAX_CURRENT 1000 #define X2_SENSE_RESISTOR 91 #define X2_MICROSTEPS 16 #define Y_MAX_CURRENT 1000 #define Y_SENSE_RESISTOR 91 #define Y_MICROSTEPS 16 #define Y2_MAX_CURRENT 1000 #define Y2_SENSE_RESISTOR 91 #define Y2_MICROSTEPS 16 #define Z_MAX_CURRENT 1000 #define Z_SENSE_RESISTOR 91 #define Z_MICROSTEPS 16 #define Z2_MAX_CURRENT 1000 #define Z2_SENSE_RESISTOR 91 #define Z2_MICROSTEPS 16 #define E0_MAX_CURRENT 1000 #define E0_SENSE_RESISTOR 91 #define E0_MICROSTEPS 16 #define E1_MAX_CURRENT 1000 #define E1_SENSE_RESISTOR 91 #define E1_MICROSTEPS 16 #define E2_MAX_CURRENT 1000 #define E2_SENSE_RESISTOR 91 #define E2_MICROSTEPS 16 #define E3_MAX_CURRENT 1000 #define E3_SENSE_RESISTOR 91 #define E3_MICROSTEPS 16 #define E4_MAX_CURRENT 1000 #define E4_SENSE_RESISTOR 91 #define E4_MICROSTEPS 16 #endif // @section TMC2130 //#define HAVE_TMC2130 #if ENABLED(HAVE_TMC2130) // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY //#define X_IS_TMC2130 //#define X2_IS_TMC2130 //#define Y_IS_TMC2130 //#define Y2_IS_TMC2130 //#define Z_IS_TMC2130 //#define Z2_IS_TMC2130 //#define E0_IS_TMC2130 //#define E1_IS_TMC2130 //#define E2_IS_TMC2130 //#define E3_IS_TMC2130 //#define E4_IS_TMC2130 /** * Stepper driver settings */ #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE 1 // Interpolate X/Y/Z_MICROSTEPS to 256 #define X_CURRENT 1000 // rms current in mA. Multiply by 1.41 for peak current. #define X_MICROSTEPS 16 // 0..256 #define Y_CURRENT 1000 #define Y_MICROSTEPS 16 #define Z_CURRENT 1000 #define Z_MICROSTEPS 16 //#define X2_CURRENT 1000 //#define X2_MICROSTEPS 16 //#define Y2_CURRENT 1000 //#define Y2_MICROSTEPS 16 //#define Z2_CURRENT 1000 //#define Z2_MICROSTEPS 16 //#define E0_CURRENT 1000 //#define E0_MICROSTEPS 16 //#define E1_CURRENT 1000 //#define E1_MICROSTEPS 16 //#define E2_CURRENT 1000 //#define E2_MICROSTEPS 16 //#define E3_CURRENT 1000 //#define E3_MICROSTEPS 16 //#define E4_CURRENT 1000 //#define E4_MICROSTEPS 16 /** * Use Trinamic's ultra quiet stepping mode. * When disabled, Marlin will use spreadCycle stepping mode. */ #define STEALTHCHOP /** * Let Marlin automatically control stepper current. * This is still an experimental feature. * Increase current every 5s by CURRENT_STEP until stepper temperature prewarn gets triggered, * then decrease current by CURRENT_STEP until temperature prewarn is cleared. * Adjusting starts from X/Y/Z/E_CURRENT but will not increase over AUTO_ADJUST_MAX * Relevant g-codes: * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M906 S1 - Start adjusting current * M906 S0 - Stop adjusting current * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. */ //#define <API key> #if ENABLED(<API key>) #define CURRENT_STEP 50 #define AUTO_ADJUST_MAX 1300 // [mA], 1300mA_rms = 1840mA_peak #define <API key> #endif /** * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD. * This mode allows for faster movements at the expense of higher noise levels. * STEALTHCHOP needs to be enabled. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD #define X_HYBRID_THRESHOLD 100 // [mm/s] #define X2_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 100 #define Y2_HYBRID_THRESHOLD 100 #define Z_HYBRID_THRESHOLD 4 #define Z2_HYBRID_THRESHOLD 4 #define E0_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30 #define E3_HYBRID_THRESHOLD 30 #define E4_HYBRID_THRESHOLD 30 /** * Use stallGuard2 to sense an obstacle and trigger an endstop. * You need to place a wire from the driver's DIAG1 pin to the X/Y endstop pin. * If used along with STEALTHCHOP, the movement will be louder when homing. This is normal. * * X/<API key> is used for tuning the trigger sensitivity. * Higher values make the system LESS sensitive. * Lower value make the system MORE sensitive. * Too low values can lead to false positives, while too high values will collide the axis without triggering. * It is advised to set X/Y_HOME_BUMP_MM to 0. * M914 X/Y to live tune the setting */ //#define SENSORLESS_HOMING #if ENABLED(SENSORLESS_HOMING) #define <API key> 19 #define <API key> 19 #endif #define TMC2130_ADV() { } #endif // HAVE_TMC2130 // @section L6470 //#define HAVE_L6470DRIVER #if ENABLED(HAVE_L6470DRIVER) //#define X_IS_L6470 //#define X2_IS_L6470 //#define Y_IS_L6470 //#define Y2_IS_L6470 //#define Z_IS_L6470 //#define Z2_IS_L6470 //#define E0_IS_L6470 //#define E1_IS_L6470 //#define E2_IS_L6470 //#define E3_IS_L6470 //#define E4_IS_L6470 #define X_MICROSTEPS 16 // number of microsteps #define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be careful not to go too high #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall #define X2_MICROSTEPS 16 #define X2_K_VAL 50 #define X2_OVERCURRENT 2000 #define X2_STALLCURRENT 1500 #define Y_MICROSTEPS 16 #define Y_K_VAL 50 #define Y_OVERCURRENT 2000 #define Y_STALLCURRENT 1500 #define Y2_MICROSTEPS 16 #define Y2_K_VAL 50 #define Y2_OVERCURRENT 2000 #define Y2_STALLCURRENT 1500 #define Z_MICROSTEPS 16 #define Z_K_VAL 50 #define Z_OVERCURRENT 2000 #define Z_STALLCURRENT 1500 #define Z2_MICROSTEPS 16 #define Z2_K_VAL 50 #define Z2_OVERCURRENT 2000 #define Z2_STALLCURRENT 1500 #define E0_MICROSTEPS 16 #define E0_K_VAL 50 #define E0_OVERCURRENT 2000 #define E0_STALLCURRENT 1500 #define E1_MICROSTEPS 16 #define E1_K_VAL 50 #define E1_OVERCURRENT 2000 #define E1_STALLCURRENT 1500 #define E2_MICROSTEPS 16 #define E2_K_VAL 50 #define E2_OVERCURRENT 2000 #define E2_STALLCURRENT 1500 #define E3_MICROSTEPS 16 #define E3_K_VAL 50 #define E3_OVERCURRENT 2000 #define E3_STALLCURRENT 1500 #define E4_MICROSTEPS 16 #define E4_K_VAL 50 #define E4_OVERCURRENT 2000 #define E4_STALLCURRENT 1500 #endif /** * TWI/I2C BUS * * This feature is an EXPERIMENTAL feature so it shall not be used on production * machines. Enabling this will allow you to send and receive I2C data from slave * devices on the bus. * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) * ; It uses multiple M260 commands with one B<base 10> arg * M260 A99 ; Target slave address * M260 B77 ; M * M260 B97 ; a * M260 B114 ; r * M260 B108 ; l * M260 B105 ; i * M260 B110 ; n * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) * M261 A99 B5 * * ; Example #3 * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ // @section i2cbus //#define EXPERIMENTAL_I2CBUS #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave // @section extras //#define <API key> #if ENABLED(<API key>) #define <API key> false // set to "true" if the on/off function is reversed #define SPINDLE_LASER_PWM true // set to true if your controller supports setting the speed/power #define <API key> true // set to "true" if the speed/power goes up when you want it to go slower #define <API key> 5000 // delay in milliseconds to allow the spindle/laser to come up to speed/power #define <API key> 5000 // delay in milliseconds to allow the spindle to stop #define SPINDLE_DIR_CHANGE true // set to true if your spindle controller supports changing spindle direction #define SPINDLE_INVERT_DIR false #define <API key> true // set to true if Marlin should stop the spindle before changing rotation direction /** * The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power * * SPEED/POWER = PWM duty cycle * SPEED_POWER_SLOPE + <API key> * where PWM duty cycle varies from 0 to 255 * * set the following for your controller (ALL MUST BE SET) */ #define SPEED_POWER_SLOPE 118.4 #define <API key> 0 #define SPEED_POWER_MIN 5000 #define SPEED_POWER_MAX 30000 // SuperPID router controller 0 - 30,000 RPM //#define SPEED_POWER_SLOPE 0.3922 //#define <API key> 0 //#define SPEED_POWER_MIN 10 //#define SPEED_POWER_MAX 100 // 0-100% #endif /** * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins */ //#define PINS_DEBUGGING /** * Auto-report temperatures with M155 S<seconds> */ #define <API key> /** * Include capabilities in M115 output */ #define <API key> /** * Volumetric extrusion default state * Activate to make volumetric extrusion the default method, * with <API key> as the default diameter. * * M200 D0 to disable, M200 Dn to set a new diameter. */ //#define <API key> /** * Enable this option for a leaner build of Marlin that removes all * workspace offsets, simplifying coordinate transformations, leveling, etc. * * - M206 and M428 are disabled. * - G92 will revert to its behavior from Marlin 1.0. */ //#define <API key> /** * Set the number of proportional font spaces required to fill up a typical character space. * This can help to better align the output of commands like `G29 O` Mesh Output. * * For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0. * Otherwise, adjust according to your client and font. */ #define <API key> 1.0 /** * Spend 28 bytes of SRAM to optimize the GCode parser */ #define FASTER_GCODE_PARSER /** * User-defined menu items that execute custom GCode */ //#define CUSTOM_USER_MENUS #if ENABLED(CUSTOM_USER_MENUS) #define USER_SCRIPT_DONE "M117 User Script Done" #define <API key> //#define USER_SCRIPT_RETURN // Return to status screen after a script #define USER_DESC_1 "Home & UBL Info" #define USER_GCODE_1 "G28\nG29 W" #define USER_DESC_2 "Preheat for PLA" #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(<API key>) #define USER_DESC_3 "Preheat for ABS" #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(<API key>) #define USER_DESC_4 "Heat Bed/Home/Level" #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" //#define USER_DESC_5 "Home & Info" //#define USER_GCODE_5 "G28\nM503" #endif /** * Specify an action command to send to the host when the printer is killed. * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. * The host must be configured to handle the action command. */ //#define ACTION_ON_KILL "poweroff" //#define <API key> #if ENABLED(<API key>) #define I2CPE_ENCODER_CNT 1 // The number of encoders installed; max of 5 // encoders supported currently. #define I2CPE_ENC_1_ADDR I2CPE_PRESET_ADDR_X // I2C address of the encoder. 30-200. #define I2CPE_ENC_1_AXIS X_AXIS // Axis the encoder module is installed on. <X|Y|Z|E>_AXIS. #define I2CPE_ENC_1_TYPE <API key> // Type of encoder: <API key> -or- // <API key>. #define <API key> 2048 // 1024 for magnetic strips with 2mm poles; 2048 for // 1mm poles. For linear encoders this is ticks / mm, // for rotary encoders this is ticks / revolution. //#define <API key> (16 * 200) // Only needed for rotary encoders; number of stepper // steps per full revolution (motor steps/rev * microstepping) //#define I2CPE_ENC_1_INVERT // Invert the direction of axis travel. #define <API key> I2CPE_ECM_NONE // Type of error error correction. #define <API key> 0.10 // Threshold size for error (in mm) above which the // printer will attempt to correct the error; errors // smaller than this are ignored to minimize effects of // measurement noise / latency (filter). #define I2CPE_ENC_2_ADDR I2CPE_PRESET_ADDR_Y // Same as above, but for encoder 2. #define I2CPE_ENC_2_AXIS Y_AXIS #define I2CPE_ENC_2_TYPE <API key> #define <API key> 2048 //#define <API key> (16 * 200) //#define I2CPE_ENC_2_INVERT #define <API key> I2CPE_ECM_NONE #define <API key> 0.10 #define I2CPE_ENC_3_ADDR I2CPE_PRESET_ADDR_Z // Encoder 3. Add additional configuration options #define I2CPE_ENC_3_AXIS Z_AXIS // as above, or use defaults below. #define I2CPE_ENC_4_ADDR I2CPE_PRESET_ADDR_E // Encoder 4. #define I2CPE_ENC_4_AXIS E_AXIS #define I2CPE_ENC_5_ADDR 34 // Encoder 5. #define I2CPE_ENC_5_AXIS E_AXIS // Default settings for encoders which are enabled, but without settings configured above. #define I2CPE_DEF_TYPE <API key> #define <API key> 2048 #define I2CPE_DEF_TICKS_REV (16 * 200) #define I2CPE_DEF_EC_METHOD I2CPE_ECM_NONE #define I2CPE_DEF_EC_THRESH 0.1 //#define <API key> 100.0 // Threshold size for error (in mm) error on any given // axis after which the printer will abort. Comment out to // disable abort behaviour. #define I2CPE_TIME_TRUSTED 10000 // After an encoder fault, there must be no further fault // for this amount of time (in ms) before the encoder // is trusted again. /** * Position is checked every time a new command is executed from the buffer but during long moves, * this setting determines the minimum update time between checks. A value of 100 works well with * error rolling average when attempting to correct only for skips and not for vibration. */ #define <API key> 100 // Minimum time in miliseconds between encoder checks. // Use a rolling average to identify persistant errors that indicate skips, as opposed to vibration and noise. #define <API key> #endif // <API key> //#define MAX7219_DEBUG #if ENABLED(MAX7219_DEBUG) #define MAX7219_CLK_PIN 64 // 77 on Re-ARM // Configuration of the 3 pins to control the display #define MAX7219_DIN_PIN 57 // 78 on Re-ARM #define MAX7219_LOAD_PIN 44 // 79 on Re-ARM /** * Sample debug features * If you add more debug displays, be careful to avoid conflicts! */ #define <API key> // Blink corner LED of 8x8 matrix to show that the firmware is functioning #define <API key> 3 // Show the stepper queue head position on this and the next LED matrix row #define <API key> 5 // Show the stepper queue tail position on this and the next LED matrix row #define <API key> 0 // Show the current stepper queue depth on this and the next LED matrix row // If you experience stuttering, reboots, etc. this option can reveal how // tweaks made to the configuration are affecting the printer in real-time. #endif #endif // CONFIGURATION_ADV_H
#if !defined (<API key>) #define <API key> 1 #ifdef HAVE_LLVM #include <map> #include <vector> #include "Range.h" #include "jit-util.h" // Defines the type system used by jit and a singleton class, jit_typeinfo, to // manage the types. // FIXME: // Operations are defined and implemented in jit_typeinfo. Eventually they // should be moved elsewhere. (just like with octave_typeinfo) // jit_range is compatable with the llvm range structure struct jit_range { jit_range (const Range& from) : base (from.base ()), limit (from.limit ()), inc (from.inc ()), nelem (from.nelem ()) {} operator Range () const { return Range (base, limit, inc); } bool <API key> () const; double base; double limit; double inc; octave_idx_type nelem; }; std::ostream& operator<< (std::ostream& os, const jit_range& rng); // jit_array is compatable with the llvm array/matrix structures template <typename T, typename U> struct jit_array { jit_array () : array (0) {} jit_array (T& from) : array (new T (from)) { update (); } void update (void) { ref_count = array->jit_ref_count (); slice_data = array->jit_slice_data () - 1; slice_len = array->capacity (); dimensions = array->jit_dimensions (); } void update (T *aarray) { array = aarray; update (); } operator T () const { return *array; } int *ref_count; U *slice_data; octave_idx_type slice_len; octave_idx_type *dimensions; T *array; }; typedef jit_array<NDArray, double> jit_matrix; std::ostream& operator<< (std::ostream& os, const jit_matrix& mat); // calling convention namespace jit_convention { enum type { // internal to jit internal, // an external C call external, length }; } // Used to keep track of estimated (infered) types during JIT. This is a // hierarchical type system which includes both concrete and abstract types. // The types form a lattice. Currently we only allow for one parent type, but // eventually we may allow for multiple predecessors. class jit_type { public: typedef llvm::Value *(*convert_fn) (llvm::IRBuilderD&, llvm::Value *); jit_type (const std::string& aname, jit_type *aparent, llvm::Type *allvm_type, bool askip_paren, int aid); // a user readable type name const std::string& name (void) const { return mname; } // a unique id for the type int type_id (void) const { return mid; } // An abstract base type, may be null jit_type *parent (void) const { return mparent; } // convert to an llvm type llvm::Type *to_llvm (void) const { return llvm_type; } // how this type gets passed as a function argument llvm::Type *to_llvm_arg (void) const; size_t depth (void) const { return mdepth; } bool skip_paren (void) const { return mskip_paren; } // A function declared like: mytype foo (int arg0, int arg1); // Will be converted to: void foo (mytype *retval, int arg0, int arg1) // if mytype is sret. The caller is responsible for allocating space for // retval. (on the stack) bool sret (jit_convention::type cc) const { return msret[cc]; } void mark_sret (jit_convention::type cc) { msret[cc] = true; } // A function like: void foo (mytype arg0) // Will be converted to: void foo (mytype *arg0) // Basically just pass by reference. bool pointer_arg (jit_convention::type cc) const { return mpointer_arg[cc]; } void mark_pointer_arg (jit_convention::type cc) { mpointer_arg[cc] = true; } // Convert into an equivalent form before calling. For example, complex is // represented as two values llvm vector, but we need to pass it as a two // valued llvm structure to C functions. convert_fn pack (jit_convention::type cc) { return mpack[cc]; } void set_pack (jit_convention::type cc, convert_fn fn) { mpack[cc] = fn; } // The inverse operation of pack. convert_fn unpack (jit_convention::type cc) { return munpack[cc]; } void set_unpack (jit_convention::type cc, convert_fn fn) { munpack[cc] = fn; } // The resulting type after pack is called. llvm::Type *packed_type (jit_convention::type cc) { return mpacked_type[cc]; } void set_packed_type (jit_convention::type cc, llvm::Type *ty) { mpacked_type[cc] = ty; } private: std::string mname; jit_type *mparent; llvm::Type *llvm_type; int mid; size_t mdepth; bool mskip_paren; bool msret[jit_convention::length]; bool mpointer_arg[jit_convention::length]; convert_fn mpack[jit_convention::length]; convert_fn munpack[jit_convention::length]; llvm::Type *mpacked_type[jit_convention::length]; }; // seperate print function to allow easy printing if type is null std::ostream& jit_print (std::ostream& os, jit_type *atype); class jit_value; // An abstraction for calling llvm functions with jit_values. Deals with calling // convention details. class jit_function { friend std::ostream& operator<< (std::ostream& os, const jit_function& fn); public: // create a function in an invalid state jit_function (); jit_function (llvm::Module *amodule, jit_convention::type acall_conv, const llvm::Twine& aname, jit_type *aresult, const std::vector<jit_type *>& aargs); // Use an existing function, but change the argument types. The new argument // types must behave the same for the current calling convention. jit_function (const jit_function& fn, jit_type *aresult, const std::vector<jit_type *>& aargs); jit_function (const jit_function& fn); // erase the interal LLVM function (if it exists). Will become invalid. void erase (void); template <typename T> void add_mapping (llvm::ExecutionEngine *engine, T fn) { do_add_mapping (engine, reinterpret_cast<void *> (fn)); } bool valid (void) const { return llvm_function; } std::string name (void) const; llvm::BasicBlock *new_block (const std::string& aname = "body", llvm::BasicBlock *insert_before = 0); llvm::Value *call (llvm::IRBuilderD& builder, const std::vector<jit_value *>& in_args) const; llvm::Value *call (llvm::IRBuilderD& builder, const std::vector<llvm::Value *>& in_args = std::vector<llvm::Value *> ()) const; #define JIT_PARAM_ARGS llvm::IRBuilderD& builder, #define JIT_PARAMS builder, #define JIT_CALL(N) JIT_EXPAND (llvm::Value *, call, llvm::Value *, const, N) JIT_CALL (1) JIT_CALL (2) JIT_CALL (3) JIT_CALL (4) JIT_CALL (5) #undef JIT_CALL #define JIT_CALL(N) JIT_EXPAND (llvm::Value *, call, jit_value *, const, N) JIT_CALL (1); JIT_CALL (2); JIT_CALL (3); #undef JIT_CALL #undef JIT_PARAMS #undef JIT_PARAM_ARGS llvm::Value *argument (llvm::IRBuilderD& builder, size_t idx) const; void do_return (llvm::IRBuilderD& builder, llvm::Value *rval = 0, bool verify = true); llvm::Function *to_llvm (void) const { return llvm_function; } // If true, then the return value is passed as a pointer in the first argument bool sret (void) const { return mresult && mresult->sret (call_conv); } bool can_error (void) const { return mcan_error; } void mark_can_error (void) { mcan_error = true; } jit_type *result (void) const { return mresult; } jit_type *argument_type (size_t idx) const { assert (idx < args.size ()); return args[idx]; } const std::vector<jit_type *>& arguments (void) const { return args; } private: void do_add_mapping (llvm::ExecutionEngine *engine, void *fn); llvm::Module *module; llvm::Function *llvm_function; jit_type *mresult; std::vector<jit_type *> args; jit_convention::type call_conv; bool mcan_error; }; std::ostream& operator<< (std::ostream& os, const jit_function& fn); // Keeps track of information about how to implement operations (+, -, *, ect) // and their resulting types. class jit_operation { public: // type signature vector typedef std::vector<jit_type *> signature_vec; virtual ~jit_operation (void); void add_overload (const jit_function& func) { add_overload (func, func.arguments ()); } void add_overload (const jit_function& func, const signature_vec& args); const jit_function& overload (const signature_vec& types) const; jit_type *result (const signature_vec& types) const { const jit_function& temp = overload (types); return temp.result (); } #define JIT_PARAMS #define JIT_PARAM_ARGS #define JIT_OVERLOAD(N) \ JIT_EXPAND (const jit_function&, overload, jit_type *, const, N) \ JIT_EXPAND (jit_type *, result, jit_type *, const, N) JIT_OVERLOAD (1); JIT_OVERLOAD (2); JIT_OVERLOAD (3); #undef JIT_PARAMS #undef JIT_PARAM_ARGS const std::string& name (void) const { return mname; } void stash_name (const std::string& aname) { mname = aname; } protected: virtual jit_function *generate (const signature_vec& types) const; private: Array<octave_idx_type> to_idx (const signature_vec& types) const; const jit_function& do_generate (const signature_vec& types) const; struct signature_cmp { bool operator() (const signature_vec *lhs, const signature_vec *rhs); }; typedef std::map<const signature_vec *, jit_function *, signature_cmp> generated_map; mutable generated_map generated; std::vector<Array<jit_function> > overloads; std::string mname; }; class jit_index_operation : public jit_operation { public: jit_index_operation (void) : module (0), engine (0) {} void initialize (llvm::Module *amodule, llvm::ExecutionEngine *aengine) { module = amodule; engine = aengine; do_initialize (); } protected: virtual jit_function *generate (const signature_vec& types) const; virtual jit_function *generate_matrix (const signature_vec& types) const = 0; virtual void do_initialize (void) = 0; // helper functions // [start_idx, end_idx). llvm::Value *create_arg_array (llvm::IRBuilderD& builder, const jit_function &fn, size_t start_idx, size_t end_idx) const; llvm::Module *module; llvm::ExecutionEngine *engine; }; class jit_paren_subsref : public jit_index_operation { protected: virtual jit_function *generate_matrix (const signature_vec& types) const; virtual void do_initialize (void); private: jit_function paren_scalar; }; class jit_paren_subsasgn : public jit_index_operation { protected: jit_function *generate_matrix (const signature_vec& types) const; virtual void do_initialize (void); private: jit_function paren_scalar; }; // A singleton class which handles the construction of jit_types and // jit_operations. class jit_typeinfo { public: static void initialize (llvm::Module *m, llvm::ExecutionEngine *e); static jit_type *join (jit_type *lhs, jit_type *rhs) { return instance->do_join (lhs, rhs); } static jit_type *get_any (void) { return instance->any; } static jit_type *get_matrix (void) { return instance->matrix; } static jit_type *get_scalar (void) { return instance->scalar; } static llvm::Type *get_scalar_llvm (void) { return instance->scalar->to_llvm (); } static jit_type *get_scalar_ptr (void) { return instance->scalar_ptr; } static jit_type *get_any_ptr (void) { return instance->any_ptr; } static jit_type *get_range (void) { return instance->range; } static jit_type *get_string (void) { return instance->string; } static jit_type *get_bool (void) { return instance->boolean; } static jit_type *get_index (void) { return instance->index; } static llvm::Type *get_index_llvm (void) { return instance->index->to_llvm (); } static jit_type *get_complex (void) { return instance->complex; } // Get the jit_type of an octave_value static jit_type *type_of (const octave_value& ov) { return instance->do_type_of (ov); } static const jit_operation& binary_op (int op) { return instance->do_binary_op (op); } static const jit_operation& unary_op (int op) { return instance->do_unary_op (op); } static const jit_operation& grab (void) { return instance->grab_fn; } static const jit_function& get_grab (jit_type *type) { return instance->grab_fn.overload (type); } static const jit_operation& release (void) { return instance->release_fn; } static const jit_function& get_release (jit_type *type) { return instance->release_fn.overload (type); } static const jit_operation& destroy (void) { return instance->destroy_fn; } static const jit_operation& print_value (void) { return instance->print_fn; } static const jit_operation& for_init (void) { return instance->for_init_fn; } static const jit_operation& for_check (void) { return instance->for_check_fn; } static const jit_operation& for_index (void) { return instance->for_index_fn; } static const jit_operation& make_range (void) { return instance->make_range_fn; } static const jit_operation& paren_subsref (void) { return instance->paren_subsref_fn; } static const jit_operation& paren_subsasgn (void) { return instance->paren_subsasgn_fn; } static const jit_operation& logically_true (void) { return instance->logically_true_fn; } static const jit_operation& cast (jit_type *result) { return instance->do_cast (result); } static const jit_function& cast (jit_type *to, jit_type *from) { return instance->do_cast (to, from); } static llvm::Value *insert_error_check (llvm::IRBuilderD& bld) { return instance-><API key> (bld); } static llvm::Value *<API key> (llvm::IRBuilderD& bld) { return instance-><API key> (bld); } static const jit_operation& end (void) { return instance->end_fn; } static const jit_function& end (jit_value *value, jit_value *index, jit_value *count) { return instance->do_end (value, index, count); } static const jit_operation& create_undef (void) { return instance->create_undef_fn; } static llvm::Value *create_complex (llvm::Value *real, llvm::Value *imag) { return instance->complex_new (real, imag); } private: jit_typeinfo (llvm::Module *m, llvm::ExecutionEngine *e); // FIXME: Do these methods really need to be in jit_typeinfo? jit_type *do_join (jit_type *lhs, jit_type *rhs) { // empty case if (! lhs) return rhs; if (! rhs) return lhs; // check for a shared parent while (lhs != rhs) { if (lhs->depth () > rhs->depth ()) lhs = lhs->parent (); else if (lhs->depth () < rhs->depth ()) rhs = rhs->parent (); else { // we MUST have depth > 0 as any is the base type of everything do { lhs = lhs->parent (); rhs = rhs->parent (); } while (lhs != rhs); } } return lhs; } jit_type *do_difference (jit_type *lhs, jit_type *) { // FIXME: Maybe we can do something smarter? return lhs; } jit_type *do_type_of (const octave_value &ov) const; const jit_operation& do_binary_op (int op) const { assert (static_cast<size_t>(op) < binary_ops.size ()); return binary_ops[op]; } const jit_operation& do_unary_op (int op) const { assert (static_cast<size_t> (op) < unary_ops.size ()); return unary_ops[op]; } const jit_operation& do_cast (jit_type *to) { static jit_operation null_function; if (! to) return null_function; size_t id = to->type_id (); if (id >= casts.size ()) return null_function; return casts[id]; } const jit_function& do_cast (jit_type *to, jit_type *from) { return do_cast (to).overload (from); } const jit_function& do_end (jit_value *value, jit_value *index, jit_value *count); jit_type *new_type (const std::string& name, jit_type *parent, llvm::Type *llvm_type, bool skip_paren = false); void add_print (jit_type *ty, void *fptr); void add_binary_op (jit_type *ty, int op, int llvm_op); void add_binary_icmp (jit_type *ty, int op, int llvm_op); void add_binary_fcmp (jit_type *ty, int op, int llvm_op); // create a function with an external calling convention // forces the function pointer to be specified template <typename T> jit_function create_external (llvm::ExecutionEngine *ee, T fn, const llvm::Twine& name, jit_type *ret, const std::vector<jit_type *>& args = std::vector<jit_type *> ()) { jit_function retval = create_function (jit_convention::external, name, ret, args); retval.add_mapping (ee, fn); return retval; } #define JIT_PARAM_ARGS llvm::ExecutionEngine *ee, T fn, \ const llvm::Twine& name, jit_type *ret, #define JIT_PARAMS ee, fn, name, ret, #define CREATE_FUNCTION(N) JIT_EXPAND(template <typename T> jit_function, \ create_external, \ jit_type *, /* empty */, N) CREATE_FUNCTION(1); CREATE_FUNCTION(2); CREATE_FUNCTION(3); CREATE_FUNCTION(4); #undef JIT_PARAM_ARGS #undef JIT_PARAMS #undef CREATE_FUNCTION // use create_external or create_internal directly jit_function create_function (jit_convention::type cc, const llvm::Twine& name, jit_type *ret, const std::vector<jit_type *>& args = std::vector<jit_type *> ()); // create an internal calling convention (a function defined in llvm) jit_function create_internal (const llvm::Twine& name, jit_type *ret, const std::vector<jit_type *>& args = std::vector<jit_type *> ()) { return create_function (jit_convention::internal, name, ret, args); } #define JIT_PARAM_ARGS const llvm::Twine& name, jit_type *ret, #define JIT_PARAMS name, ret, #define CREATE_FUNCTION(N) JIT_EXPAND(jit_function, create_internal, \ jit_type *, /* empty */, N) CREATE_FUNCTION(1); CREATE_FUNCTION(2); CREATE_FUNCTION(3); CREATE_FUNCTION(4); #undef JIT_PARAM_ARGS #undef JIT_PARAMS #undef CREATE_FUNCTION jit_function create_identity (jit_type *type); llvm::Value *<API key> (llvm::IRBuilderD& bld); llvm::Value *<API key> (llvm::IRBuilderD& bld); void add_builtin (const std::string& name); void register_intrinsic (const std::string& name, size_t id, jit_type *result, jit_type *arg0) { std::vector<jit_type *> args (1, arg0); register_intrinsic (name, id, result, args); } void register_intrinsic (const std::string& name, size_t id, jit_type *result, const std::vector<jit_type *>& args); void register_generic (const std::string& name, jit_type *result, jit_type *arg0) { std::vector<jit_type *> args (1, arg0); register_generic (name, result, args); } void register_generic (const std::string& name, jit_type *result, const std::vector<jit_type *>& args); octave_builtin *find_builtin (const std::string& name); jit_function mirror_binary (const jit_function& fn); llvm::Function *wrap_complex (llvm::Function *wrap); static llvm::Value *pack_complex (llvm::IRBuilderD& bld, llvm::Value *cplx); static llvm::Value *unpack_complex (llvm::IRBuilderD& bld, llvm::Value *result); llvm::Value *complex_real (llvm::Value *cx); llvm::Value *complex_real (llvm::Value *cx, llvm::Value *real); llvm::Value *complex_imag (llvm::Value *cx); llvm::Value *complex_imag (llvm::Value *cx, llvm::Value *imag); llvm::Value *complex_new (llvm::Value *real, llvm::Value *imag); void create_int (size_t nbits); jit_type *intN (size_t nbits) const; static jit_typeinfo *instance; llvm::Module *module; llvm::ExecutionEngine *engine; int next_id; llvm::GlobalVariable *lerror_state; llvm::GlobalVariable *<API key>; llvm::Type *sig_atomic_type; std::vector<jit_type*> id_to_type; jit_type *any; jit_type *matrix; jit_type *scalar; jit_type *scalar_ptr; // a fake type for interfacing with C++ jit_type *any_ptr; // a fake type for interfacing with C++ jit_type *range; jit_type *string; jit_type *boolean; jit_type *index; jit_type *complex; jit_type *unknown_function; std::map<size_t, jit_type *> ints; std::map<std::string, jit_type *> builtins; llvm::StructType *complex_ret; std::vector<jit_operation> binary_ops; std::vector<jit_operation> unary_ops; jit_operation grab_fn; jit_operation release_fn; jit_operation destroy_fn; jit_operation print_fn; jit_operation for_init_fn; jit_operation for_check_fn; jit_operation for_index_fn; jit_operation logically_true_fn; jit_operation make_range_fn; jit_paren_subsref paren_subsref_fn; jit_paren_subsasgn paren_subsasgn_fn; jit_operation end1_fn; jit_operation end_fn; jit_operation create_undef_fn; jit_function any_call; // type id -> cast function TO that type std::vector<jit_operation> casts; // type id -> identity function std::vector<jit_function> identities; llvm::IRBuilderD& builder; }; #endif #endif
\hypertarget{struct_can_rx_msg}{}\section{Can\+Rx\+Msg Struct Reference} \label{struct_can_rx_msg}\index{Can\+Rx\+Msg@{Can\+Rx\+Msg}} C\+AN Rx message structure definition. {\ttfamily \#include $<$stm32f10x\+\_\+can.\+h$>$} \subsection*{Public Attributes} \begin{DoxyCompactItemize} \item uint32\+\_\+t \hyperlink{<API key>}{Std\+Id} \item uint32\+\_\+t \hyperlink{<API key>}{Ext\+Id} \item uint8\+\_\+t \hyperlink{<API key>}{I\+DE} \item uint8\+\_\+t \hyperlink{<API key>}{R\+TR} \item uint8\+\_\+t \hyperlink{<API key>}{D\+LC} \item uint8\+\_\+t \hyperlink{<API key>}{Data} \mbox{[}8\mbox{]} \item uint8\+\_\+t \hyperlink{<API key>}{F\+MI} \end{DoxyCompactItemize} \subsection{Detailed Description} C\+AN Rx message structure definition. Definition at line 179 of file stm32f10x\+\_\+can.\+h. \subsection{Member Data Documentation} \mbox{\Hypertarget{<API key>}\label{<API key>}} \index{Can\+Rx\+Msg@{Can\+Rx\+Msg}!Data@{Data}} \index{Data@{Data}!Can\+Rx\+Msg@{Can\+Rx\+Msg}} \subsubsection{\texorpdfstring{Data}{Data}} {\footnotesize\ttfamily uint8\+\_\+t Can\+Rx\+Msg\+::\+Data\mbox{[}8\mbox{]}} Contains the data to be received. It ranges from 0 to 0x\+FF. Definition at line 198 of file stm32f10x\+\_\+can.\+h. \mbox{\Hypertarget{<API key>}\label{<API key>}} \index{Can\+Rx\+Msg@{Can\+Rx\+Msg}!D\+LC@{D\+LC}} \index{D\+LC@{D\+LC}!Can\+Rx\+Msg@{Can\+Rx\+Msg}} \subsubsection{\texorpdfstring{D\+LC}{DLC}} {\footnotesize\ttfamily uint8\+\_\+t Can\+Rx\+Msg\+::\+D\+LC} Specifies the length of the frame that will be received. This parameter can be a value between 0 to 8 Definition at line 195 of file stm32f10x\+\_\+can.\+h. \mbox{\Hypertarget{<API key>}\label{<API key>}} \index{Can\+Rx\+Msg@{Can\+Rx\+Msg}!Ext\+Id@{Ext\+Id}} \index{Ext\+Id@{Ext\+Id}!Can\+Rx\+Msg@{Can\+Rx\+Msg}} \subsubsection{\texorpdfstring{Ext\+Id}{ExtId}} {\footnotesize\ttfamily uint32\+\_\+t Can\+Rx\+Msg\+::\+Ext\+Id} Specifies the extended identifier. This parameter can be a value between 0 to 0x1\+F\+F\+F\+F\+F\+FF. Definition at line 184 of file stm32f10x\+\_\+can.\+h. \mbox{\Hypertarget{<API key>}\label{<API key>}} \index{Can\+Rx\+Msg@{Can\+Rx\+Msg}!F\+MI@{F\+MI}} \index{F\+MI@{F\+MI}!Can\+Rx\+Msg@{Can\+Rx\+Msg}} \subsubsection{\texorpdfstring{F\+MI}{FMI}} {\footnotesize\ttfamily uint8\+\_\+t Can\+Rx\+Msg\+::\+F\+MI} Specifies the index of the filter the message stored in the mailbox passes through. This parameter can be a value between 0 to 0x\+FF Definition at line 201 of file stm32f10x\+\_\+can.\+h. \mbox{\Hypertarget{<API key>}\label{<API key>}} \index{Can\+Rx\+Msg@{Can\+Rx\+Msg}!I\+DE@{I\+DE}} \index{I\+DE@{I\+DE}!Can\+Rx\+Msg@{Can\+Rx\+Msg}} \subsubsection{\texorpdfstring{I\+DE}{IDE}} {\footnotesize\ttfamily uint8\+\_\+t Can\+Rx\+Msg\+::\+I\+DE} Specifies the type of identifier for the message that will be received. This parameter can be a value of \hyperlink{<API key>}{C\+A\+N\+\_\+identifier\+\_\+type} Definition at line 187 of file stm32f10x\+\_\+can.\+h. \mbox{\Hypertarget{<API key>}\label{<API key>}} \index{Can\+Rx\+Msg@{Can\+Rx\+Msg}!R\+TR@{R\+TR}} \index{R\+TR@{R\+TR}!Can\+Rx\+Msg@{Can\+Rx\+Msg}} \subsubsection{\texorpdfstring{R\+TR}{RTR}} {\footnotesize\ttfamily uint8\+\_\+t Can\+Rx\+Msg\+::\+R\+TR} Specifies the type of frame for the received message. This parameter can be a value of \hyperlink{<API key>}{C\+A\+N\+\_\+remote\+\_\+transmission\+\_\+request} Definition at line 191 of file stm32f10x\+\_\+can.\+h. \mbox{\Hypertarget{<API key>}\label{<API key>}} \index{Can\+Rx\+Msg@{Can\+Rx\+Msg}!Std\+Id@{Std\+Id}} \index{Std\+Id@{Std\+Id}!Can\+Rx\+Msg@{Can\+Rx\+Msg}} \subsubsection{\texorpdfstring{Std\+Id}{StdId}} {\footnotesize\ttfamily uint32\+\_\+t Can\+Rx\+Msg\+::\+Std\+Id} Specifies the standard identifier. This parameter can be a value between 0 to 0x7\+FF. Definition at line 181 of file stm32f10x\+\_\+can.\+h. The documentation for this struct was generated from the following file\+:\begin{DoxyCompactItemize} \item C\+:/\+Users/anilj/\+Desktop/cmsis/sorc/system/include/stm32f1-\/stdperiph/\hyperlink{stm32f10x__can_8h}{stm32f10x\+\_\+can.\+h}\end{DoxyCompactItemize}
package org.hath.base; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class OutTest { @Mock private OutListener listener; @Before public void setUp() throws Exception { } @Test public void testAddOutListener() throws Exception { Out.addOutListener(listener); } @Test public void <API key>() throws Exception { Out.removeOutListener(listener); } }
package soc.client; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.ConnectException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketAddress; import java.util.Collection; import java.util.Locale; import soc.baseclient.<API key>; import soc.baseclient.ServerConnectInfo; import soc.disableDebug.D; import soc.game.SOCGame; import soc.game.SOCGameOptionSet; import soc.message.SOCChannels; import soc.message.SOCGames; import soc.message.SOCJoinGame; import soc.message.SOCLeaveAll; import soc.message.SOCMessage; import soc.message.<API key>; import soc.message.SOCRejectConnection; import soc.message.SOCServerPing; import soc.message.SOCVersion; import soc.server.SOCServer; import soc.server.genericServer.Connection; import soc.server.genericServer.StringConnection; import soc.server.genericServer.StringServerSocket; import soc.util.SOCFeatureSet; import soc.util.Version; /** * Helper object to encapsulate and deal with {@link SOCPlayerClient}'s network connectivity. *<P> * Local practice server (if any) is started in {@link #startPracticeGame(String, SOCGameOptionSet)}. * Local tcp server (if any) is started in {@link #initLocalServer(int)}. *<br> * Messages from server to client are received in either {@link NetReadTask} or {@link <API key>}, * which call the client's {@link MessageHandler#handle(SOCMessage, boolean)}. * Those Task threads call {@link MessageHandler#init(SOCPlayerClient)} before starting their run loop. *<br> * Messages from client to server are formed in {@link GameMessageSender} or other classes, * which call back here to send to the server via {@link #putNet(String)} or {@link #putPractice(String)}. *<br> * Network shutdown is {@link #disconnect()} or {@link #dispose()}. *<P> * Before v2.0.00, most of these fields and methods were part of the main {@link SOCPlayerClient} class. * * @author Paul Bilnoski &lt;paul@bilnoski.net&gt; * @since 2.0.00 * @see SOCPlayerClient#getNet() */ /*package*/ class ClientNetwork { /** * Default tcp port number 8880 to listen, and to connect to remote server. * Should match SOCServer.SOC_PORT_DEFAULT. *<P> * 8880 is the default SOCPlayerClient port since jsettlers 1.0.4, per cvs history. * @since 1.1.00 */ public static final int SOC_PORT_DEFAULT = 8880; /** * Timeout for initial connection to server; default is 6000 milliseconds. */ public static int CONNECT_TIMEOUT_MS = 6000; /** * When client is running a local server, interval for how often to send {@link SOCServerPing} * keepalive messages: 45 minutes, in milliseconds. See {@link #connect(String, int)}. *<P> * Should be several minutes shorter than {@link soc.server.genericServer.NetConnection#TIMEOUT_VALUE}. * @since 2.5.00 */ protected static final int <API key> = 45 * 60 * 1000; /** * The client we're communicating for. * @see #mainDisplay */ private final SOCPlayerClient client; /** * MainDisplay for our {@link #client}, to display information and perform callbacks when needed. * Set after construction by calling {@link #setMainDisplay(MainDisplay)}. */ private MainDisplay mainDisplay; /** * Server connection info. {@code null} until {@link #connect(String, int)} is called. * Unlike {@code connect} params, localhost is not represented here as {@code null}: * see {@link ServerConnectInfo#hostname} javadoc. *<P> * Versions before 2.2.00 instead had {@code host} and {@code port} fields. * @since 2.2.00 */ protected ServerConnectInfo serverConnectInfo; /** * Client-hosted TCP server. If client is running this server, it's also connected * as a client, instead of being client of a remote server. * Started via {@link SwingMainDisplay#startLocalTCPServer(int)}. * {@link #practiceServer} may still be activated at the user's request. * Note that {@link SOCGame#isPractice} is false for localTCPServer's games. * @since 1.1.00 */ SOCServer localTCPServer = null; /** * Network socket. * Before v2.5.00 this field was {@code s}. */ Socket sock; DataInputStream in; DataOutputStream out; Thread reader = null; /** * Features supported by this built-in JSettlers client. * @since 2.0.00 */ private final SOCFeatureSet cliFeats; { cliFeats = new SOCFeatureSet(false, false); cliFeats.add(SOCFeatureSet.CLIENT_6_PLAYERS); cliFeats.add(SOCFeatureSet.CLIENT_SEA_BOARD); cliFeats.add(SOCFeatureSet.<API key>, Version.versionNumber()); } /** * Any network error (TCP communication) received while connecting * or sending messages in {@link #putNet(String)}, or null. * If {@code ex != null}, putNet will refuse to send. *<P> * The exception's {@link Throwable#toString() toString()} including its * {@link Throwable#getMessage() getMessage()} may be displayed to the user * by {@link SOCPlayerClient#shutdownFromNetwork()}; if throwing an error that the user * should see, be sure to set the detail message. * @see #ex_P */ Exception ex = null; /** * Practice-server error (stringport pipes), or null. *<P> * Before v2.0.00 this field was {@code ex_L} (Local server). * @see #ex * @since 1.1.00 */ Exception ex_P = null; /** * Are we connected to a TCP server (remote or {@link #localTCPServer})? * {@link #practiceServer} is not a TCP server. * If true, {@link #serverConnectInfo} != null. * @see #ex */ boolean connected = false; /** * For debug, our last message sent over the net. *<P> * Before v1.1.00 this field was {@code lastMessage}. * @see #lastMessage_P */ protected String lastMessage_N; /** * For debug, our last message sent to practice server (stringport pipes). *<P> * Before v2.0.00 this field was {@code lastMessage_L} (Local server). * @see #lastMessage_N * @since 1.1.00 */ protected String lastMessage_P; /** * Server for practice games via {@link #prCli}; not connected to the network, * not suited for hosting multi-player games. Use {@link #localTCPServer} * for those. * SOCMessages of games where {@link SOCGame#isPractice} is true are sent * to practiceServer. *<P> * Null before it's started in {@link SOCPlayerClient#startPracticeGame()}. * @since 1.1.00 */ protected SOCServer practiceServer = null; /** * Client connection to {@link #practiceServer practice server}. * Null before it's started in {@link #startPracticeGame()}. *<P> * Last message is in {@link #lastMessage_P}; any error is in {@link #ex_P}. * @since 1.1.00 */ protected StringConnection prCli = null; /** * Create our client's ClientNetwork. * Before using the ClientNetwork, caller client must construct their GUI * and call {@link #setMainDisplay(MainDisplay)}. * Then, call {@link #connect(String, int)}. */ public ClientNetwork(SOCPlayerClient c) { client = c; if (client == null) throw new <API key>("client is null"); } /** * Set our MainDisplay; must be done after construction. * @param md MainDisplay to use * @throws <API key> if {@code md} is {@code null} */ public void setMainDisplay(final MainDisplay md) throws <API key> { if (md == null) throw new <API key>("null"); mainDisplay = md; } /** Shut down the local TCP server (if any) and disconnect from the network. */ public void dispose() { shutdownLocalServer(); disconnect(); } /** * Start a practice game. If needed, create and start {@link #practiceServer}. * @param practiceGameName Game name * @param gameOpts Game options, or {@code null} * @return True if the practice game request was sent, false if there was a problem * starting the practice server or client * @since 1.1.00 */ public boolean startPracticeGame(final String practiceGameName, final SOCGameOptionSet gameOpts) { if (practiceServer == null) { try { if (Version.versionNumber() == 0) { throw new <API key>("Packaging error: Cannot determine JSettlers version"); } practiceServer = new SOCServer(SOCServer.PRACTICE_STRINGPORT, SOCServer.SOC_MAXCONN_DEFAULT, null, null); practiceServer.setPriority(5); // same as in SOCServer.main practiceServer.start(); } catch (Throwable th) { mainDisplay.showErrorDialog (client.strings.get("pcli.error.startingpractice") + "\n" + th, // "Problem starting practice server:" client.strings.get("base.cancel")); return false; } } if (prCli == null) { try { prCli = StringServerSocket.connectTo(SOCServer.PRACTICE_STRINGPORT); new <API key>(prCli); // Reader will start its own thread // Send VERSION right away sendVersion(true); // Practice server supports per-game options mainDisplay.enableOptions(); } catch (ConnectException e) { ex_P = e; return false; } } // Ask internal practice server to create the game if (gameOpts == null) putPractice(SOCJoinGame.toCmd(client.practiceNickname, "", SOCMessage.EMPTYSTR, practiceGameName)); else putPractice(<API key>.toCmd (client.practiceNickname, "", SOCMessage.EMPTYSTR, practiceGameName, gameOpts.getAll())); return true; } /** * Get the tcp port number of the local server. * @see #<API key>() */ public int getLocalServerPort() { if (localTCPServer == null) return 0; return localTCPServer.getPort(); } /** Shut down the local TCP server. */ public void shutdownLocalServer() { if ((localTCPServer != null) && (localTCPServer.isUp())) { localTCPServer.stopServer(); localTCPServer = null; } } /** * Create and start the local TCP server on a given port. * If startup fails, show a {@link NotifyDialog} with the error message. * @return True if started, false if not */ public boolean initLocalServer(int tport) { try { localTCPServer = new SOCServer(tport, SOCServer.SOC_MAXCONN_DEFAULT, null, null); localTCPServer.setPriority(5); // same as in SOCServer.main localTCPServer.start(); } catch (Throwable th) { mainDisplay.showErrorDialog (client.strings.get("pcli.error.startingserv") + "\n" + th, // "Problem starting server:" client.strings.get("base.cancel")); return false; } return true; } /** * Port number of the tcp server we're a client of, * or default {@link #SOC_PORT_DEFAULT} if not {@link #isConnected()}. * @see #getHost() */ public int getPort() { return (connected) ? serverConnectInfo.port : SOC_PORT_DEFAULT; } /** * Hostname of the tcp server we're a client of, * from {@link ServerConnectInfo#hostname}, * or {@code null} if not {@link #isConnected()}. * @see #getPort() */ public String getHost() { return (connected) ? serverConnectInfo.hostname : null; } /** * Are we connected to a tcp server? * @see #getHost() */ public synchronized boolean isConnected() { return connected; } /** * Attempts to connect to the server. See {@link #isConnected()} for success or * failure. Once connected, starts a {@link #reader} thread. * The first message sent from client to server is our {@link SOCVersion}. * From server to client when client connects: If server is full, it sends {@link SOCRejectConnection}. * Otherwise its {@code SOCVersion} and current channels and games ({@link SOCChannels}, {@link SOCGames}) are sent. *<P> * Since user login and authentication don't occur until a game or channel join is requested, * no username or password is needed here. *<P> * If {@code host} is {@code null}, assumes client has started a local TCP server and is now connecting to it. * Will start a thread here to periodically {@link SOCServerPing} that server to prevent timeouts when idle. * * @param host Server host to connect to, or {@code null} for localhost * @param port Server TCP port to connect to; the default server port is {@link ClientNetwork#SOC_PORT_DEFAULT}. * @throws <API key> if already connected * or if {@link Version#versionNumber()} returns 0 (packaging error) * @see soc.server.SOCServer#newConnection1(Connection) */ public synchronized void connect(final String host, final int port) throws <API key> { if (connected) { throw new <API key> ("Already connected to " + (serverConnectInfo.hostname != null ? serverConnectInfo.hostname : "localhost") + ":" + serverConnectInfo.port); } if (Version.versionNumber() == 0) { throw new <API key>("Packaging error: Cannot determine JSettlers version"); } ex = null; final String hostString = (host != null) ? host : "localhost"; // I18N: no need to localize this hostname serverConnectInfo = new ServerConnectInfo(hostString, port, null); System.out.println("Connecting to " + hostString + ":" + port); // I18N: Not localizing console output yet mainDisplay.setMessage (client.strings.get("pcli.message.connecting.serv")); // "Connecting to server..." try { if (client.gotPassword) { mainDisplay.setPassword(client.password); // when ! gotPassword, SwingMainDisplay.getPassword() will read pw from there client.gotPassword = false; } final SocketAddress srvAddr = (host != null) ? new InetSocketAddress(host, port) : new InetSocketAddress(InetAddress.getByName(null), port); // loopback sock = new Socket(); sock.connect(srvAddr, CONNECT_TIMEOUT_MS); sock.setSoTimeout(0); // ensure no read timeouts; is probably already 0 from Socket defaults in = new DataInputStream(sock.getInputStream()); out = new DataOutputStream(sock.getOutputStream()); connected = true; (reader = new Thread(new NetReadTask(client, this))).start(); // send VERSION right away (1.1.06 and later) sendVersion(false); if (host == null) { final Thread pinger = new Thread("cli-ping-local-srv") { public void run() { final String pingCmd = new SOCServerPing(0).toCmd(); while(connected) { try { Thread.sleep(<API key>); } catch (<API key> e) {} putNet(pingCmd); } } }; pinger.setDaemon(true); pinger.start(); } } catch (Exception e) { ex = e; String msg = client.strings.get("pcli.error.couldnotconnect", ex); // "Could not connect to the server: " + ex System.err.println(msg); mainDisplay.showErrorPanel(msg, (ex_P == null)); if (connected) { disconnect(); connected = false; } serverConnectInfo = null; if (in != null) { try { in.close(); } catch (Throwable th) {} in = null; } if (out != null) { try { out.close(); } catch (Throwable th) {} out = null; } sock = null; } } /** * Disconnect from the net (client of remote server). * If a problem occurs, sets {@link #ex}. * @see #dispose() */ protected synchronized void disconnect() { connected = false; // reader will die once 'connected' is false, and socket is closed try { sock.close(); } catch (Exception e) { ex = e; } } /** * Construct and send a {@link SOCVersion} message during initial connection to a server. * Version message includes features and locale in 2.0.00 and later clients; v1.x.xx servers will ignore them. *<P> * If debug property {@link SOCPlayerClient#<API key> <API key>} * is set, its value is sent instead of {@link #cliFeats}.{@link SOCFeatureSet#getEncodedList() getEncodedList()}. * Then if debug property * {@link <API key>#<API key> <API key>} * is set, its value is appended to client features as {@code "com.example.js.feat."} + gameopt3p. * * @param isPractice True if sending to client's practice server with {@link #putPractice(String)}, * false if to a TCP server with {@link #putNet(String)}. * @since 2.0.00 */ private void sendVersion(final boolean isPractice) { String feats = System.getProperty(SOCPlayerClient.<API key>); if (feats == null) feats = cliFeats.getEncodedList(); else if (feats.length() == 0) feats = null; String gameopt3p = System.getProperty(<API key>.<API key>); if (gameopt3p != null) { gameopt3p = "com.example.js.feat." + gameopt3p.toUpperCase(Locale.US) + ';'; if (feats != null) feats = feats + gameopt3p; else feats = ';' + gameopt3p; } final String msg = SOCVersion.toCmd (Version.versionNumber(), Version.version(), Version.buildnum(), feats, client.cliLocale.toString()); if (isPractice) putPractice(msg); else putNet(msg); } /** * Are we running a local tcp server? * @see #getLocalServerPort() * @see #<API key>() * @since 1.1.00 */ public boolean <API key>() { return localTCPServer != null; } /** * Look for active games that we're hosting (state >= START1A, not yet OVER). * * @return If any hosted games of ours are active * @see MainDisplay#hasAnyActiveGame(boolean) * @see SwingMainDisplay#findAnyActiveGame(boolean) * @since 1.1.00 */ public boolean <API key>() { if (localTCPServer == null) return false; Collection<String> gameNames = localTCPServer.getGameNames(); for (String tryGm : gameNames) { int gs = localTCPServer.getGameState(tryGm); if ((gs < SOCGame.OVER) && (gs >= SOCGame.START1A)) { return true; // Active } } return false; // No active games found } /** * write a message to the net: either to a remote server, * or to {@link #localTCPServer} for games we're hosting. *<P> * If {@link #ex} != null, or ! {@link #connected}, {@code putNet} * returns false without attempting to send the message. *<P> * This message is copied to {@link #lastMessage_N}; any error sets {@link #ex} * and calls {@link SOCPlayerClient#shutdownFromNetwork()} to show the error message. * * @param s the message * @return true if the message was sent, false if not * @see GameMessageSender#put(String, boolean) * @see #putPractice(String) */ public synchronized boolean putNet(String s) { lastMessage_N = s; if ((ex != null) || !isConnected()) { return false; } if (client.debugTraffic || D.ebugIsEnabled()) soc.debug.D.ebugPrintlnINFO("OUT - " + SOCMessage.toMsg(s)); try { out.writeUTF(s); out.flush(); } catch (IOException e) { ex = e; System.err.println("could not write to the net: " + ex); // I18N: Not localizing console output yet client.shutdownFromNetwork(); return false; } return true; } /** * write a message to the practice server. {@link #localTCPServer} is not * the same as the practice server; use {@link #putNet(String)} to send * a message to the local TCP server. * Use <tt>putPractice</tt> only with {@link #practiceServer}. *<P> * Before version 1.1.14, this was <tt>putLocal</tt>. * * @param s the message * @return true if the message was sent, false if not * @see GameMessageSender#put(String, boolean) * @throws <API key> if {@code s} is {@code null} * @see #putNet(String) * @since 1.1.00 */ public synchronized boolean putPractice(String s) throws <API key> { if (s == null) throw new <API key>("null"); lastMessage_P = s; if ((ex_P != null) || ! prCli.isConnected()) { return false; } if (client.debugTraffic || D.ebugIsEnabled()) soc.debug.D.ebugPrintlnINFO("OUT L- " + SOCMessage.toMsg(s)); prCli.put(s); return true; } /** * resend the last message (to the network) * @see #resendPractice() */ public void resendNet() { if (lastMessage_N != null) putNet(lastMessage_N); } /** * resend the last message (to the practice server) * @see #resendNet() * @since 1.1.00 */ public void resendPractice() { if (lastMessage_P != null) putPractice(lastMessage_P); } /** * For shutdown - Tell the server we're leaving all games. * If we've started a practice server, also tell that server. * If we've started a TCP server, tell all players on that server, and shut it down. *<P><em> * Since no other state variables are set, call this only right before * discarding this object or calling System.exit. *</em> * @return Can we still start practice games? (No local exception yet in {@link #ex_P}) * @since 1.1.00 */ public boolean putLeaveAll() { final boolean canPractice = (ex_P == null); // Can we still start a practice game? SOCLeaveAll leaveAllMes = new SOCLeaveAll(); putNet(leaveAllMes.toCmd()); if ((prCli != null) && ! canPractice) putPractice(leaveAllMes.toCmd()); shutdownLocalServer(); return canPractice; } /** * A task to continuously read from the server socket. * Not used for talking to the practice server. * @see <API key> */ static class NetReadTask implements Runnable { final ClientNetwork net; final SOCPlayerClient client; public NetReadTask(SOCPlayerClient client, ClientNetwork net) { this.client = client; this.net = net; } /** * continuously read from the net in a separate thread; * not used for talking to the practice server. * If disconnected or an {@link IOException} occurs, * calls {@link SOCPlayerClient#shutdownFromNetwork()}. */ public void run() { Thread.currentThread().setName("cli-netread"); // Thread name for debug try { final MessageHandler handler = client.getMessageHandler(); handler.init(client); while (net.isConnected()) { String s = net.in.readUTF(); SOCMessage msg = SOCMessage.toMsg(s); if (msg != null) handler.handle(msg, false); else if (client.debugTraffic) soc.debug.D.ebugERROR("Could not parse net message: " + s); } } catch (IOException e) { // purposefully closing the socket brings us here too if (net.isConnected()) { net.ex = e; System.out.println("could not read from the net: " + net.ex); // I18N: Not localizing console output yet client.shutdownFromNetwork(); } } } } // nested class NetReadTask /** * For practice games, reader thread to get messages from the * practice server to be treated and reacted to. *<P> * Before v2.0.00 this class was {@code SOCPlayerClient.<API key>}. * * @see NetReadTask * @author jdmonin * @since 1.1.00 */ class <API key> implements Runnable { StringConnection locl; /** * Start a new thread and listen to practice server. * * @param prConn Active connection to practice server */ protected <API key>(StringConnection prConn) { locl = prConn; Thread thr = new Thread(this); thr.setDaemon(true); thr.start(); } /** * Continuously read from the practice string server in a separate thread. * If disconnected or an {@link IOException} occurs, calls * {@link SOCPlayerClient#shutdownFromNetwork()}. */ public void run() { Thread.currentThread().setName("cli-stringread"); // Thread name for debug try { final MessageHandler handler = client.getMessageHandler(); handler.init(client); while (locl.isConnected()) { String s = locl.readNext(); SOCMessage msg = SOCMessage.toMsg(s); if (msg != null) handler.handle(msg, true); else if (client.debugTraffic) soc.debug.D.ebugERROR("Could not parse practice server message: " + s); } } catch (IOException e) { // purposefully closing the socket brings us here too if (locl.isConnected()) { ex_P = e; System.out.println("could not read from practice server: " + ex_P); // I18N: Not localizing console output yet client.shutdownFromNetwork(); } } } } // nested class <API key> }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Diagnostics; using System.Media; using System.Net; using System.Text.RegularExpressions; using System.IO; namespace TwitchGUI { <summary> Interaction logic for MainWindow.xaml </summary> public partial class MainWindow : Window { //lista di stringhe da concatenare per passare parametri #region Global variables string path_to_ls = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\Livestreamer\\livestreamer.exe"; string video_quality = "best"; string path_to_fav = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\LivestreamerGUI\\Favourites.txt"; string path_to_history = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\LivestreamerGUI\\History.txt"; cls_qualityitem[] qualitylist = new cls_qualityitem[] { new cls_qualityitem(0,"Audio", "audio_mp4","audio"), new cls_qualityitem(1,"Best (default)", "720p","source"), new cls_qualityitem(2,"High", "480p","high"), new cls_qualityitem(3,"Medium", "360p","medium"), new cls_qualityitem(4,"Low", "240p","low"), new cls_qualityitem(5,"Worst", "144p","mobile") }; List<cls_historyitem> typedhistory = new List<cls_historyitem>(); List<cls_historyitem> tmptypedhistory = new List<cls_historyitem>(); List<cls_historyitem> favslist = new List<cls_historyitem>(); #endregion public MainWindow() { InitializeComponent(); if (!File.Exists(path_to_ls)) { MessageBox.Show("Livestreamer.exe not found in the default folder. Please install livestreamer in your \"Program Files (x86)\" folder. \nIf you don't have livestreamer installed on your computer you can download it from http://docs.livestreamer.io/install.html"); if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\LivestreamerGUI")) Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\LivestreamerGUI"); } load_history(); load_favs(); #region fill combobox/listbox cmb_quality.ItemsSource = qualitylist; cmb_quality.DisplayMemberPath = "Name"; lst_typedhistory.ItemsSource = typedhistory; lst_typedhistory.DisplayMemberPath = "Name"; cmb_favs.ItemsSource = favslist; cmb_favs.DisplayMemberPath = "Name"; #endregion // removed because it was more of an annoiance than useful /*if (Clipboard.GetText().Contains("youtu") || Clipboard.GetText().Contains("twitch")) { txtin_url.Text = Clipboard.GetText(); btn_play_Click(null, null); }*/ } // play function private void btn_play_Click(object sender, RoutedEventArgs e) { ProcessStartInfo video = new ProcessStartInfo(); video.CreateNoWindow = false; video.UseShellExecute = false; video.FileName = path_to_ls; video.WindowStyle = ProcessWindowStyle.Normal; asssign_quality(); string args = ""; if ((chk_timeline.IsChecked == true) && txtin_url.Text.Contains("twitch")) { args += " --player-passthrough hls"; } args += " " +txtin_url.Text + " " + video_quality; video.Arguments = args; /*Process p =*/ Process.Start(video); if ((chk_chat.IsChecked == true) && (txtin_url.Text.Contains("twitch"))) { System.Diagnostics.Process.Start(txtin_url.Text + "/chat"); } add_to_history(); // this should stop me from doing anything until the process is over // I'm not sure this is a good idea. It's a good idea for playlists though // I can use this only whit playlists // p.WaitForExit(); } // just passes all typed text as argument to livestreamer to use it like from cli private void btn_advanced_Click(object sender, RoutedEventArgs e) { ProcessStartInfo video = new ProcessStartInfo(); video.CreateNoWindow = true; video.UseShellExecute = false; video.FileName = path_to_ls; video.WindowStyle = ProcessWindowStyle.Normal; string args = txtin_advanced.Text; video.Arguments = args; Process.Start(video); } // simple code to assign the right keywords based on the kind of stream (youtube/twitch) private void asssign_quality() { cls_qualityitem temp = cmb_quality.SelectedItem as cls_qualityitem; if (temp != null) { if (txtin_url.Text.Contains("youtu")) { video_quality = temp.YT_arg; } else if (txtin_url.Text.Contains("twitch")) { video_quality = temp.TW_arg; } } else if (txtin_url.Text.Contains("youtu")) { video_quality = "720p"; } } #region Stuff related to history functions // handles typedhistory private void add_to_history() { // picks the right keywords depending on source string title = txtin_url.Text; string sauce = ""; if (txtin_url.Text.Contains("youtu")) { title = yt_parser(); sauce = "YouTube"; } else if (txtin_url.Text.Contains("twitch")) { title = tw_parser(); if (txtin_url.Text.Contains("/v/")) sauce = "Twitch VOD"; else sauce = "Twitch stream"; } // adds element to the volatile history typedhistory.Insert(0,new cls_historyitem(title, txtin_url.Text, sauce)); // adds element to the txt for non volatile history StreamWriter tempsw = new StreamWriter(path_to_history, true); tempsw.WriteLine(title + "§" + txtin_url.Text + "§" + sauce); tempsw.Close(); tempsw.Dispose(); // forces the listbox to update by changing the items source to a fake list and back to the right one string[] fake = new string[30]; lst_typedhistory.ItemsSource = fake; lst_typedhistory.ItemsSource = typedhistory; } // change content of url field and goes back to main tab after selecting an item from history private void <API key>(object sender, <API key> e) { if (lst_typedhistory.SelectedItem != null) { cls_historyitem temp = lst_typedhistory.SelectedItem as cls_historyitem; txtin_url.Text = temp.Url; tabControl.SelectedItem = main; } } private void <API key>(object sender, RoutedEventArgs e) { string[] fake = new string[30]; lst_typedhistory.ItemsSource = fake; typedhistory = new List<cls_historyitem>(); File.Delete(path_to_history); load_history(); lst_typedhistory.ItemsSource = typedhistory; } // parse last 20 history items from the txt file to a local list private void load_history() { if (!File.Exists(path_to_history)) File.Create(path_to_history); else { string[] lines = File.ReadAllLines(path_to_history); List<string[]> triplets = new List<string[]>(); foreach (string l in lines) { triplets.Add(l.Split('§')); } foreach (string[] ss in triplets) { tmptypedhistory.Add(new cls_historyitem(ss[0], ss[1], ss[2])); } for (int i = 1; i <= tmptypedhistory.Count; i++) { if (i <= 20) typedhistory.Add(tmptypedhistory[tmptypedhistory.Count - i]); } } } #endregion #region Stuff related to favourites private void add_to_favs() { // picks the right keywords depending on source string title = txtin_url.Text; string sauce = ""; if (txtin_url.Text.Contains("youtu")) { title = yt_parser(); sauce = "YouTube"; } else if (txtin_url.Text.Contains("twitch")) { title = tw_parser(); if (txtin_url.Text.Contains("/v/")) sauce = "Twitch VOD"; else sauce = "Twitch stream"; } // adds element to the volatile history favslist.Add(new cls_historyitem(title, txtin_url.Text, sauce)); // adds element to the txt for non volatile history StreamWriter tempsw = new StreamWriter(path_to_fav, true); tempsw.WriteLine(title + "§" + txtin_url.Text + "§" + sauce); tempsw.Close(); tempsw.Dispose(); // forces the listbox to update by changing the items source to a fake list and back to the right one string[] fake = new string[30]; cmb_favs.ItemsSource = fake; cmb_favs.ItemsSource = favslist; } private void btn_rm_fav_Click(object sender, RoutedEventArgs e) { if (cmb_favs.SelectedItem != null) { cls_historyitem si = cmb_favs.SelectedItem as cls_historyitem; favslist = si.remove_from_list(favslist); remove_from_favtxt(); string[] fake = new string[30]; cmb_favs.ItemsSource = fake; cmb_favs.ItemsSource = favslist; } } // function called when the button is pressed private void btn_add_fav_Click(object sender, RoutedEventArgs e) { add_to_favs(); } // change content of url field after selecting an item from favs private void <API key>(object sender, <API key> e) { if (cmb_favs.SelectedItem != null) { cls_historyitem temp = cmb_favs.SelectedItem as cls_historyitem; txtin_url.Text = temp.Url; } } // parse all items from the txt favourites file to the combobox private void load_favs() { if (!File.Exists(path_to_fav)) File.Create(path_to_fav); else { string[] lines = File.ReadAllLines(path_to_fav); List<string[]> triplets = new List<string[]>(); foreach (string l in lines) { triplets.Add(l.Split('§')); } foreach (string[] ss in triplets) { favslist.Add(new cls_historyitem(ss[0], ss[1], ss[2])); } favslist.Sort((x, y) => x.Name.CompareTo(y.Name)); } } #endregion #region Support functions // parser for the title of a youtube video private string yt_parser() { WebClient url_source = new WebClient(); url_source.Encoding = Encoding.UTF8; string html = url_source.DownloadString(txtin_url.Text); string[] splitted_html_t1 = Regex.Split(html, "<meta name=\"title\" content=\""); string[] splitted_html_t2 = Regex.Split(splitted_html_t1[1], "\">"); return splitted_html_t2[0]; } // parser for the title of a twitch stream/VOD private string tw_parser() { WebClient url_source = new WebClient(); url_source.Encoding = Encoding.UTF8; string html = url_source.DownloadString(txtin_url.Text); string[] splitted_html_t1 = Regex.Split(html, "' property='og:description'>"); string[] splitted_html_t2 = Regex.Split(splitted_html_t1[0], "<meta content='"); return splitted_html_t2[splitted_html_t2.Length - 1]; } private void remove_from_favtxt() { StreamWriter swtemp = new StreamWriter("temp.txt", true); foreach (cls_historyitem item in favslist) { swtemp.WriteLine(item.Name + "§" + item.Url + "§" + item.Source); } swtemp.Close(); swtemp.Dispose(); File.Delete(path_to_fav); File.Copy("temp.txt", path_to_fav); File.Delete("temp.txt"); } #endregion #region GUI input behaviour // paste from clipboard in url field on doubleclick private void <API key>(object sender, <API key> e) { if (Clipboard.GetText().Contains("http")) { txtin_url.Text = Clipboard.GetText(); if (Clipboard.GetText().Contains("youtu") || Clipboard.GetText().Contains("twitch")) btn_play_Click(null, null); } } // simple code to clear the text field upon focus private void txtin_url_GotFocus(object sender, RoutedEventArgs e) { TextBox tb = (TextBox)sender; tb.Text = string.Empty; tb.GotFocus -= txtin_url_GotFocus; } private void txtin_url_KeyUp(object sender, KeyEventArgs e) { if (e.Key == System.Windows.Input.Key.Enter) { btn_play_Click(null, null); } } #endregion } }
var blob; function setup() { createCanvas(600, 600); blob = new Blob(); } function draw() { background(0); blob.show(); }
require 'package' class Xzutils < Package description 'XZ Utils is free general-purpose data compression software with a high compression ratio.' homepage 'http://tukaani.org/xz/' version '5.2.5' compatibility 'all' source_url 'https://tukaani.org/xz/xz-5.2.5.tar.gz' source_sha256 '<SHA256-like>' binary_url ({ aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/xzutils-5.2.5-chromeos-armv7l.tar.xz', armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/xzutils-5.2.5-chromeos-armv7l.tar.xz', i686: 'https://dl.bintray.com/chromebrew/chromebrew/xzutils-5.2.5-chromeos-i686.tar.xz', x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/xzutils-5.2.5-chromeos-x86_64.tar.xz', }) binary_sha256 ({ aarch64: '<SHA256-like>', armv7l: '<SHA256-like>', i686: '<SHA256-like>', x86_64: '<SHA256-like>', }) def self.build system './configure', "--prefix=#{CREW_PREFIX}", "--libdir=#{CREW_LIB_PREFIX}", '--disable-docs', '--enable-shared', '--disable-static', '--with-pic' system 'make' end def self.check system 'make', 'check' end def self.install system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install' end end
package battleUnits; public class Hero extends Unit{ private life.Hero model; public Hero(int x, int y, life.Hero model) { super(x, y); this.setModel(model); this.setHpMax(model.getHp()); this.setHpCurrent(this.getHpMax()); } public life.Hero getModel() { return model; } public void setModel(life.Hero model) { this.model = model; } }
import startbot, stats, os, re, random, sys import utils MARKOV_LENGTH = 2 #changes made: allowed it to hook up from the text gotten directly from messages #changed it to be encompassed in a class structure. Made minor changes to make it Py3.X compatible class markov(): # These mappings can get fairly large -- they're stored globally to # save copying time. # (tuple of words) -> {dict: word -> number of times the word appears following the tuple} # Example entry: # ('eyes', 'turned') => {'to': 2.0, 'from': 1.0} # Used briefly while first constructing the normalized mapping tempMapping = {} # (tuple of words) -> {dict: word -> *normalized* number of times the word appears following the tuple} # Example entry: # ('eyes', 'turned') => {'to': 0.66666666, 'from': 0.33333333} mapping = {} # Contains the set of words that can start sentences starts = [] m_botName = None def __init__(self, groupObj, groupName, bot): self.m_botName = bot.name self.train(groupObj, groupName) def train(self, groupObj, groupName): stats.getAllText(groupObj, groupName, self.m_botName) self.buildMapping(self.wordlist('..{1}cache{1}messages-{0}.txt'.format(groupName, os.path.sep)), MARKOV_LENGTH) utils.showOutput("bot successfully trained.") def talk(self, message, bot, groupName): try: bot.post(self.genSentence2(message, MARKOV_LENGTH)) except: bot.post(self.genSentence(MARKOV_LENGTH)) # We want to be able to compare words independent of their capitalization. def fixCaps(self, word): # Ex: "FOO" -> "foo" if word.isupper() and word != "I": word = word.lower() # Ex: "LaTeX" => "Latex" elif word [0].isupper(): word = word.lower().capitalize() # Ex: "wOOt" -> "woot" else: word = word.lower() return word # Tuples can be hashed; lists can't. We need hashable values for dict keys. # This looks like a hack (and it is, a little) but in practice it doesn't # affect processing time too negatively. def toHashKey(self, lst): return tuple(lst) # Returns the contents of the file, split into a list of words and # (some) punctuation. def wordlist(self, filename): f = open(filename, 'r', encoding='utf-8') wordlist = [self.fixCaps(w) for w in re.findall(r"[\w']+|[.,!?;]", f.read())] f.close() return wordlist # Self-explanatory -- adds "word" to the "tempMapping" dict under "history". # tempMapping (and mapping) both match each word to a list of possible next # words. # Given history = ["the", "rain", "in"] and word = "Spain", we add "Spain" to # the entries for ["the", "rain", "in"], ["rain", "in"], and ["in"]. def <API key>(self, history, word): while len(history) > 0: first = self.toHashKey(history) if first in self.tempMapping: if word in self.tempMapping[first]: self.tempMapping[first][word] += 1.0 else: self.tempMapping[first][word] = 1.0 else: self.tempMapping[first] = {} self.tempMapping[first][word] = 1.0 history = history[1:] # Building and normalizing the mapping. def buildMapping(self, wordlist, markovLength): self.starts.append(wordlist [0]) for i in range(1, len(wordlist) - 1): if i <= markovLength: history = wordlist[: i + 1] else: history = wordlist[i - markovLength + 1 : i + 1] follow = wordlist[i + 1] # if the last elt was a period, add the next word to the start list if history[-1] == "." and follow not in ".,!?;": self.starts.append(follow) self.<API key>(history, follow) # Normalize the values in tempMapping, put them into mapping for first, followset in self.tempMapping.items(): total = sum(followset.values()) # Normalizing here: self.mapping[first] = dict([(k, v / total) for k, v in followset.items()]) # Returns the next word in the sentence (chosen randomly), # given the previous ones. def next(self, prevList): sum = 0.0 retval = "" index = random.random() # Shorten prevList until it's in mapping while self.toHashKey(prevList) not in self.mapping: prevList.pop(0) # Get a random word from the mapping, given prevList for k, v in self.mapping[self.toHashKey(prevList)].items(): sum += v if sum >= index and retval == "": retval = k return retval def genSentence2(self, message, markovLength): #attempts to use input sentence material to construct a sentence # Start with a random "starting word" from the input message splitmessage = message.lower().split() splitmessage.remove('{0},'.format(self.m_botName.lower())) if len(splitmessage) == 0: curr = random.choice(self.starts) else: curr = random.choice(splitmessage) sent = curr.capitalize() prevList = [curr] # Keep adding words until we hit a period while (curr not in "."): curr = self.next(prevList) prevList.append(curr) # if the prevList has gotten too long, trim it if len(prevList) > markovLength: prevList.pop(0) if (curr not in ".,!?;"): sent += " " # Add spaces between words (but not punctuation) sent += curr return sent def genSentence(self, markovLength): # Start with a random "starting word" curr = random.choice(self.starts) sent = curr.capitalize() prevList = [curr] # Keep adding words until we hit a period while (curr not in "."): curr = self.next(prevList) prevList.append(curr) # if the prevList has gotten too long, trim it if len(prevList) > markovLength: prevList.pop(0) if (curr not in ".,!?;"): sent += " " # Add spaces between words (but not punctuation) sent += curr return sent
#!/usr/bin/python # to run an example # python RunMakeFigures.py -p Demo -i 0 -j 1 -f 3FITC_4PE_004.fcs -h ./projects/Demo import getopt,sys,os import numpy as np ## important line to fix popup error in mac osx import matplotlib matplotlib.use('Agg') from cytostream import Model import matplotlib.pyplot as plt ## parse inputs def bad_input(): print "\nERROR: incorrect args" print sys.argv[0] + "-p projectID -i channel1 -j channel2 -f selectedFile -a alternateDirectory -s subset -t modelType -h homeDir" print " projectID (-p) project name" print " channel1 (-i) channel 1 name" print " channel2 (-j) channel 2 name" print " homeDir (-h) home directory of current project" print " selectedFile (-f) name of selected file" print " altDir (-a) alternative directory (optional)" print " subset (-s) subsampling number (optional)" print " modelName (-m) model name" print " modelType (-t) model type" print "\n" sys.exit() try: optlist, args = getopt.getopt(sys.argv[1:],'i:j:s:a:p:f:m:t:h:') except getopt.GetoptError: print getopt.GetoptError bad_input() projectID = None channel1 = None channel2 = None selectedFile = None altDir = None homeDir = None modelType = None modelName = None subset = "all" run = True for o, a in optlist: if o == '-i': channel1 = a if o == '-j': channel2 = a if o == '-f': selectedFile = a if o == '-a': altDir = a if o == '-p': projectID = a if o == '-s': subset = a if o == '-m': modelName = a if o == '-t': modelType = a if o == '-h': homeDir = a def make_scatter_plot(model,selectedFile,channel1Ind,channel2Ind,subset='all',labels=None,buff=0.02,altDir=None): #fig = pyplot.figure(figsize=(7,7)) markerSize = 5 alphaVal = 0.5 fontName = 'arial' fontSize = 12 plotType = 'png' ## prepare figure fig = plt.figure(figsize=(7,7)) ax = fig.add_subplot(111) ## specify channels fileChannels = model.<API key>(selectedFile) index1 = int(channel1Ind) index2 = int(channel2Ind) channel1 = fileChannels[index1] channel2 = fileChannels[index2] data = model.pyfcm_load_fcs_file(selectedFile) ## subset give an numpy array of indices if subset != "all": subsampleIndices = model.<API key>(subset) data = data[subsampleIndices,:] ## make plot totalPoints = 0 if labels == None: ax.scatter([data[:,index1]],[data[:,index2]],color='blue',s=markerSize) else: if type(np.array([])) != type(labels): labels = np.array(labels) numLabels = np.unique(labels).size maxLabel = np.max(labels) cmp = model.<API key>(maxLabel+1) for l in np.sort(np.unique(labels)): rgbVal = tuple([val * 256 for val in cmp[l,:3]]) hexColor = model.rgb_to_hex(rgbVal)[:7] x = data[:,index1][np.where(labels==l)[0]] y = data[:,index2][np.where(labels==l)[0]] totalPoints+=x.size if x.size == 0: continue ax.scatter(x,y,color=hexColor,s=markerSize) #ax.scatter(x,y,color=hexColor,s=markerSize) ## handle data edge buffers bufferX = buff * (data[:,index1].max() - data[:,index1].min()) bufferY = buff * (data[:,index2].max() - data[:,index2].min()) ax.set_xlim([data[:,index1].min()-bufferX,data[:,index1].max()+bufferX]) ax.set_ylim([data[:,index2].min()-bufferY,data[:,index2].max()+bufferY]) ## save file fileName = selectedFile ax.set_title("%s_%s_%s"%(channel1,channel2,fileName),fontname=fontName,fontsize=fontSize) ax.set_xlabel(channel1,fontname=fontName,fontsize=fontSize) ax.set_ylabel(channel2,fontname=fontName,fontsize=fontSize) if altDir == None: fileName = os.path.join(model.homeDir,'figs',"%s_%s_%s.%s"%(selectedFile[:-4],channel1,channel2,plotType)) fig.savefig(fileName,transparent=False,dpi=50) else: fileName = os.path.join(altDir,"%s_%s_%s.%s"%(selectedFile[:-4],channel1,channel2,plotType)) fig.savefig(fileName,transparent=False,dpi=50) ## error checking if altDir == 'None': altDir = None if homeDir == 'None': homeDir = None if modelName == 'None': modelName = None statModel,statModelClasses = None,None if altDir == None and homeDir == None: bad_input() run = False print "WARNING: RunMakeFigures failed errorchecking" if projectID == None or channel1 == None or channel2 == None or selectedFile == None: bad_input() run = False print "WARNING: RunMakeFigures failed errorchecking" if os.path.isdir(homeDir) == False: print "ERROR: homedir does not exist -- bad project name", projectID, homeDir run = False if altDir != None and os.path.isdir(altDir) == False: print "ERROR: specified alternative dir does not exist\n", altDir run = False if run == True: model = Model() model.initialize(projectID,homeDir) if modelName == None: make_scatter_plot(model,selectedFile,channel1,channel2,subset=subset,altDir=altDir) else: statModel,statModelClasses = model.<API key>(modelName,modelType) make_scatter_plot(model,selectedFile,channel1,channel2,labels=statModelClasses,subset=subset,altDir=altDir)
<!--suppress ALL <html> <head> <title>This is my Title</title> <meta content="http://facebook.image" property="og:image"/> <meta content="one, two, three" name="keywords" /> <meta name="keywords" content="Java, Java, Json, MVC, Spring" /> <meta name="no.description" content="should-be-null" /> </head> <body> <h1>This is my H1 Tag</h1> <div id="myid">This is my id text</div> <div class="myclass" myattr="grouchy"> <span>This is my class text</span> </div> <div id="content"> <img src="/one.png" alt="one" height="40" width="40"/> <img src="/two.png" alt="" class="myimage"/> <a href="/one.html">First Link</a> <a href="/two.html" class="mylink">Second Link</a> </div> <img src="/three.png" alt="image outside of content area"/> <a href="/three.html">Third Link</a> </body> </html>
<?php /* CAT:Drawing */ /* pChart library inclusions */ include("../class/pDraw.class.php"); include("../class/pImage.class.php"); /* Create the pChart object */ $myPicture = new pImage(700,230); /* Draw the background */ $Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107); $myPicture->drawFilledRectangle(0,0,700,230,$Settings); /* Overlay with a gradient */ $Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50); $myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,$Settings); $myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80)); /* Add a border to the picture */ $myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0)); /* Write the picture title */ $myPicture->setFontProperties(array("FontName"=>"../fonts/Silkscreen.ttf","FontSize"=>6)); $myPicture->drawText(10,13,"drawCircle() - Transparency & colors",array("R"=>255,"G"=>255,"B"=>255)); /* Draw some filled circles */ $myPicture->drawFilledCircle(100,125,50,array("R"=>213,"G"=>226,"B"=>0,"Alpha"=>100)); $myPicture->drawFilledCircle(140,125,50,array("R"=>213,"G"=>226,"B"=>0,"Alpha"=>70)); $myPicture->drawFilledCircle(180,125,50,array("R"=>213,"G"=>226,"B"=>0,"Alpha"=>40)); $myPicture->drawFilledCircle(220,125,50,array("R"=>213,"G"=>226,"B"=>0,"Alpha"=>20)); /* Turn on shadow computing */ $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); /* Draw a customized filled circles */ $CircleSettings = array("R"=>209,"G"=>31,"B"=>27,"Alpha"=>100,"Surrounding"=>30); $myPicture->drawFilledCircle(480,60,19,$CircleSettings); /* Draw a customized filled circles */ $CircleSettings = array("R"=>209,"G"=>125,"B"=>27,"Alpha"=>100,"Surrounding"=>30); $myPicture->drawFilledCircle(480,100,19,$CircleSettings); /* Draw a customized filled circles */ $CircleSettings = array("R"=>209,"G"=>198,"B"=>27,"Alpha"=>100,"Surrounding"=>30,"Ticks"=>4); $myPicture->drawFilledCircle(480,140,19,$CircleSettings); /* Draw a customized filled circles */ $CircleSettings = array("R"=>134,"G"=>209,"B"=>27,"Alpha"=>100,"Surrounding"=>30,"Ticks"=>4); $myPicture->drawFilledCircle(480,180,19,$CircleSettings); /* Render the picture (choose the best way) */ $myPicture->autoOutput("pictures/example.drawFilledCircle.png"); ?>
<html> <head> <title>MaildropHost Instantiation</title> </head> <body> <table border="1" cellpadding="2"> <tbody> <tr> <td colspan="3"> MaildropHost Instantiation </td> </tr> <tr> <td>open</td> <td>/manage_main</td> <td>&nbsp;</td> </tr> <tr> <td>assertLocation</td> <td>/manage_main</td> <td>&nbsp;</td> </tr> <tr> <td>selectAndWait</td> <td>name=:action</td> <td>Maildrop Host</td> </tr> <tr> <td>type</td> <td>name=id</td> <td>TestMaildropHost</td> </tr> <tr> <td>type</td> <td>name=title</td> <td>MaildropHost Title</gtd> </tr> <tr> <td>clickAndWait</td> <td>name=submit</td> <td>&nbsp;</td> </tr> <tr> <td>verifyLocation</td> <td>/TestMaildropHost/manage_main</td> <td>&nbsp;</td> </tr> <tr> <td>verifyValue</td> <td>name=title</td> <td>MaildropHost Title</td> </tr> <tr> <td>verifyValue</td> <td>name=transactional</td> <td>on</td> </td> </tbody> </table> </body> </html>
window.advancedSettings = { "debug": false, "upgradeToSocket": false, "pages": { "default": "Home", "groupingThreshold": 50 }, "epg": { "width": 20, "padding": 4 }, "jsonRPC": { "debug": false }, "xbmc": { "debug": false }, "home": { "hideVideos": false, "hideMovies": false, "hideTvShows": false, "hideMusicVideos": false, "hideMusic": false, "hidePictures": false, "hidePlaylists": false, "hideRadio": false, "hideLiveTv": false, "hideAddons": false }, 'dateFormat': 'LL', "imageSize": { "album": [ 500, 500 ], "movie": [ 333.33, 500 ], "episode": [ 500, 375 ] } };
<script type="text/javascript"> /*<![CDATA[*/ $(document).ready(function() { $(".<API key>").each().live('click', function() { var id = $(this).attr("id"); id = id.replace("<API key>",""); $.ajax( { type: "POST", url: "ajax.php?session_id="+get_array['session_id']+"&nav=organisation_unit&run=admin_delete_owner", data: "<API key>=[[<API key>]]&user_id="+id, success: function(data) { if (data == 1) { list.reload(); } } }); }); $('#<API key>').click(function() { $("#UserSelectDialog").dialog("open"); $("#<API key>").val(""); return false; }); $("#UserSelectDialog").bind( "dialogbeforeclose", function(event, ui) { if ($("#UserSelectDialogOK").html() == "true") { var user_id = $("#<API key> option:selected").attr("id"); if (user_id != undefined) { user_id = user_id.replace("User",""); $.ajax( { type: "POST", url: "ajax.php?session_id="+get_array['session_id']+"&nav=organisation_unit&run=admin_add_owner", data: "<API key>=[[<API key>]]&user_id="+user_id, success: function(data) { if (data == 1) { list.reload(); } } }); } } }); }); </script> [[ADD_DIALOG]] <!-- CONTAINER BEGIN ("Owners [[TITLE]]") --> <div id='ListButtonBar'> <a id='<API key>' class='ListButton'> <img src='images/icons/add.png' alt='' /> <div>Add an Owner</div> </a> </div> <div id='ListButtonBarClear'></div> [[LIST]] <!-- CONTAINER END () -->
#include "common.h" #include "test_moves.h" #include "board_tanbo.h" #include "point_tanbo.h" #include "root_tanbo.h" #include <boost/shared_ptr.hpp> void MovesTest::test_turn_change() { boost::shared_ptr<PointTanbo> point = gameboard->at(0, 1); CPPUNIT_ASSERT( gameboard->is_move_valid(*point, PLAYER_1) ); // Should be WHITE's move after single BLACK move at 0, 1 MoveTanbo move = MoveTanbo(PLAYER_1, 0, 1, gameboard->at(0, 0)); gameboard->play_move(move); CPPUNIT_ASSERT( PLAYER_2 == gameboard->get_turn() ); point = gameboard->at(7, 12); CPPUNIT_ASSERT( gameboard->is_move_valid(*point, PLAYER_2) ); // Should be BLACK's move after WHITE move at 7, 12 move = MoveTanbo(PLAYER_2, 7, 12, gameboard->at(6, 12)); gameboard->play_move(move); CPPUNIT_ASSERT( PLAYER_1 == gameboard->get_turn() ); } void MovesTest::test_move_effects() { //Check that this is a valid move for BLACK boost::shared_ptr<PointTanbo> point = gameboard->at(11, 12); CPPUNIT_ASSERT( gameboard->is_move_valid(*point, PLAYER_1) ); //Make the move and assert that the point has been changed to BLACK MoveTanbo move = MoveTanbo(PLAYER_1, 11, 12, gameboard->at(12, 12)); gameboard->play_move(move); CPPUNIT_ASSERT( PLAYER_1 == point->color ); //The point should no longer be a valid move for either player CPPUNIT_ASSERT( ! gameboard->is_move_valid(*point, PLAYER_1) ); CPPUNIT_ASSERT( ! gameboard->is_move_valid(*point, PLAYER_2) ); // All of these moves should now be valid boost::shared_ptr<PointTanbo> next_move = gameboard->at(10, 12); CPPUNIT_ASSERT( gameboard->is_move_valid(*next_move, PLAYER_1) ); next_move = gameboard->at(11, 13); CPPUNIT_ASSERT( gameboard->is_move_valid(*next_move, PLAYER_1) ); next_move = gameboard->at(11, 11); CPPUNIT_ASSERT( gameboard->is_move_valid(*next_move, PLAYER_1) ); gameboard->play_random_move(PLAYER_1); }
#coding:utf-8 from KNNDetector.KNN_Detect import * import requests from PIL import Image import base64 import getpass def login(username,passwd): session=requests.session() session.get('http://wsxk.hust.edu.cn/login.jsp').text img=session.get('http://wsxk.hust.edu.cn/randomImage.action').content with open('captcha.jpeg','wb') as imgfile: imgfile.write(img) imageRecognize=CaptchaRecognize() image=Image.open('captcha.jpeg') result=imageRecognize.recognise(image) string='' for item in result: string+=item[1] print(string) data={ 'usertype':"xs", 'username':username, 'password':passwd, 'rand':string, 'sm1':"", 'ln':"app610.dc.hust.edu.cn" } headers = { 'Host':"wsxk.hust.edu.cn", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Encoding": "gzip, deflate", "Accept-Language": "en-US,en;q=0.5", "Connection": "keep-alive", 'Referer':"http://wsxk.hust.edu.cn/login.jsp", "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0"} session.post('http://wsxk.hust.edu.cn/hublogin.action',data=data,headers=headers) html=session.get('http://wsxk.hust.edu.cn/select.jsp',headers=headers).text print(html) return session def main(): username=input('username:') passwd=base64.b64encode(getpass.getpass('Passwd:').encode()).decode() login(username,passwd) main()
package com.rapidminer.gui.new_plotter.engine.jfreechart.renderer; import com.rapidminer.gui.new_plotter.engine.jfreechart.<API key>; import com.rapidminer.gui.new_plotter.utility.DataStructureUtils; import java.awt.Color; import java.awt.Paint; import java.awt.Shape; import org.jfree.chart.renderer.category.<API key>; /** * @author Marius Helf */ public class <API key> extends <API key> implements FormattedRenderer { private static final long serialVersionUID = 1L; private <API key> formatDelegate = new <API key>(); public <API key>() { super(); } public <API key>(boolean lines, boolean shapes) { super(lines, shapes); } @Override public <API key> getFormatDelegate() { return formatDelegate; } @Override public Paint getItemPaint(int seriesIdx, int valueIdx) { Paint paintFromDelegate = getFormatDelegate().getItemPaint(seriesIdx, valueIdx); if (paintFromDelegate == null) { return super.getItemPaint(seriesIdx, valueIdx); } else { return paintFromDelegate; } } @Override public Shape getItemShape(int seriesIdx, int valueIdx) { Shape shapeFromDelegate = getFormatDelegate().getItemShape(seriesIdx, valueIdx); if (shapeFromDelegate == null) { return super.getItemShape(seriesIdx, valueIdx); } else { return shapeFromDelegate; } } @Override public Paint getItemOutlinePaint(int seriesIdx, int valueIdx) { if (getFormatDelegate().isItemSelected(seriesIdx, valueIdx)) { return super.getItemOutlinePaint(seriesIdx, valueIdx); } else { return DataStructureUtils.setColorAlpha(Color.LIGHT_GRAY, 20); } } }
using Hood.Extensions; using Newtonsoft.Json; using System; namespace Hood.Models { public interface IMetadata { string BaseValue { get; } int Id { get; set; } string InputDisplayName { get; } string InputId { get; } string InputName { get; } string InputType { get; } bool IsImageSetting { get; } bool IsTemplate { get; } string Name { get; set; } string Type { get; set; } void SetValue(string value); T GetValue<T>(); string ToString(); } public static class IMetadataExtensions { public static T Get<T>(this IMetadata meta) { if (meta.BaseValue.IsSet()) { return JsonConvert.DeserializeObject<T>(meta.BaseValue); } else { return default(T); } } public static string GetStringValue(this IMetadata meta) { try { string ret = JsonConvert.DeserializeObject<string>(meta.BaseValue); return ret.IsSet() ? ret : ""; } catch { if (!meta.BaseValue.IsSet()) { return ""; } else { return JsonConvert.DeserializeObject<string>(JsonConvert.SerializeObject(meta.BaseValue)); } } } } }
using Door_of_Soul.Communication.<API key>.EndPoint; using Door_of_Soul.Communication.Protocol.Internal.Scene; using Door_of_Soul.Core.<API key>; using System.Collections.Generic; namespace Door_of_Soul.Communication.<API key>.Scene { public static class SceneEventApi { public static void SendEvent(TerminalEndPoint terminal, VirtualScene target, SceneEventCode eventCode, Dictionary<byte, object> parameters) { EndPointEventApi.SceneEvent(terminal, target, eventCode, parameters); } public static void SendBroadcastEvent(VirtualScene target, SceneEventCode eventCode, Dictionary<byte, object> parameters) { EndPointEventApi.BroadcastSceneEvent(target, eventCode, parameters); } } }
#include "<API key>.h" #include <QtCore/QString> #include <QtCore/QSet> #include <QtCore/QtEndian> QT_BEGIN_NAMESPACE /*! \namespace QWebSocketProtocol \inmodule QtWebSockets \brief Contains constants related to the WebSocket standard. \since 5.3 */ /*! \enum QWebSocketProtocol::CloseCode \inmodule QtWebSockets The close codes supported by WebSockets V13 \value CloseCodeNormal Normal closure \value CloseCodeGoingAway Going away \value <API key> Protocol error \value <API key> Unsupported data \value <API key> Reserved \value <API key> No status received \value <API key> Abnormal closure \value <API key> Invalid frame payload data \value <API key> Policy violation \value <API key> Message too big \value <API key> Mandatory extension missing \value <API key> Internal server error \value <API key> TLS handshake failed \sa QWebSocket::close() */ /*! \enum QWebSocketProtocol::Version \inmodule QtWebSockets \brief The different defined versions of the WebSocket protocol. For an overview of the differences between the different protocols, see \l {pywebsocket's <API key>}. \value VersionUnknown Unknown or unspecified version. \value Version0 \l{hixie76} and \l{hybi-00}. Works with key1, key2 and a key in the payload. Attribute: Sec-WebSocket-Draft value 0. Not supported by QtWebSockets. \value Version4 \l{hybi-04}. Changed handshake: key1, key2, key3 ==> Sec-WebSocket-Key, Sec-WebSocket-Nonce, <API key> Sec-WebSocket-Draft renamed to <API key> <API key> = 4. Not supported by QtWebSockets. \value Version5 \l{hybi-05}. <API key> = 5 Removed Sec-WebSocket-Nonce Added <API key>. Not supported by QtWebSockets. \value Version6 <API key> = 6. Not supported by QtWebSockets. \value Version7 \l{hybi-07}. <API key> = 7. Not supported by QtWebSockets. \value Version8 hybi-8, hybi-9, hybi-10, hybi-11 and hybi-12. Status codes 1005 and 1006 are added and all codes are now unsigned Internal error results in 1006. Not supported by QtWebSockets. \value Version13 hybi-13, hybi14, hybi-15, hybi-16, hybi-17 and \l{RFC 6455}. <API key> = 13 Status code 1004 is now reserved Added 1008, 1009 and 1010 Must support TLS Clarify multiple version support. Supported by QtWebSockets. \value VersionLatest Refers to the latest known version to QtWebSockets. */ /*! \enum QWebSocketProtocol::OpCode \inmodule QtWebSockets The frame opcodes as defined by the WebSockets standard \value OpCodeContinue Continuation frame \value OpCodeText Text frame \value OpCodeBinary Binary frame \value OpCodeReserved3 Reserved \value OpCodeReserved4 Reserved \value OpCodeReserved5 Reserved \value OpCodeReserved6 Reserved \value OpCodeReserved7 Reserved \value OpCodeClose Close frame \value OpCodePing Ping frame \value OpCodePong Pong frame \value OpCodeReservedB Reserved \value OpCodeReservedC Reserved \value OpCodeReservedD Reserved \value OpCodeReservedE Reserved \value OpCodeReservedF Reserved \internal */ /*! \fn QWebSocketProtocol::isOpCodeReserved(OpCode code) Checks if \a code is a valid OpCode \internal */ /*! \fn QWebSocketProtocol::isCloseCodeValid(int closeCode) Checks if \a closeCode is a valid WebSocket close code \internal */ /*! \fn QWebSocketProtocol::currentVersion() Returns the latest version that WebSocket is supporting \internal */ /*! Parses the \a versionString and converts it to a Version value \internal */ QWebSocketProtocol::Version QWebSocketProtocol::versionFromString(const QString &versionString) { bool ok = false; Version version = VersionUnknown; const int ver = versionString.toInt(&ok); QSet<Version> supportedVersions; supportedVersions << Version0 << Version4 << Version5 << Version6 << Version7 << Version8 << Version13; if (Q_LIKELY(ok) && (supportedVersions.contains(static_cast<Version>(ver)))) version = static_cast<Version>(ver); return version; } /*! Mask the \a payload with the given \a maskingKey and stores the result back in \a payload. \internal */ void QWebSocketProtocol::mask(QByteArray *payload, quint32 maskingKey) { Q_ASSERT(payload); mask(payload->data(), payload->size(), maskingKey); } /*! Masks the \a payload of length \a size with the given \a maskingKey and stores the result back in \a payload. \internal */ void QWebSocketProtocol::mask(char *payload, quint64 size, quint32 maskingKey) { Q_ASSERT(payload); const quint8 mask[] = { quint8((maskingKey & 0xFF000000u) >> 24), quint8((maskingKey & 0x00FF0000u) >> 16), quint8((maskingKey & 0x0000FF00u) >> 8), quint8((maskingKey & 0x000000FFu)) }; int i = 0; while (size *payload++ ^= mask[i++ % 4]; } QT_END_NAMESPACE
/* * The Node class is the heart and soul of this implementation. It uses a state * machine and timers to control the behaviour of the node. * It uses the FruityMesh algorithm to build up connections with surrounding nodes * */ #pragma once #include <types.h> #include <adv_packets.h> #include <conn_packets.h> #include <LedWrapper.h> #include <ConnectionManager.h> #include <Connection.h> #include <SimpleBuffer.h> #include <Storage.h> #include <Module.h> #include <Terminal.h> extern "C" { #include <ble.h> } typedef struct { u8 bleAddressType; /**< See @ref BLE_GAP_ADDR_TYPES. */ u8 bleAddress[BLE_GAP_ADDR_LEN]; /**< 48-bit address, LSB format. */ u8 connectable; i8 rssi; u32 receivedTime; <API key> payload; }joinMeBufferPacket; class Node: public <API key>, public <API key>, public <API key> { private: static Node* instance; static ConnectionManager* cm; nodeID ackFieldDebugCopy; bool <API key> = false; //Persistently saved configuration (should be multiple of 4 bytes long) struct NodeConfiguration{ u8 version; ble_gap_addr_t nodeAddress; //7 bytes networkID networkId; nodeID nodeId; u8 networkKey[BLE_GAP_SEC_KEY_LEN]; //16 bytes u16 <API key>; deviceTypes deviceType; u8 calibratedRSSI; //The average RSSI, received in a distance of 1m with a tx power of +0 dBm u8 reserved; }; //For our test devices typedef struct{ u32 chipID; nodeID id; deviceTypes deviceType; char name[4]; ble_gap_addr_t addr; } testDevice; #define NUM_TEST_DEVICES 10 static testDevice testDevices[]; void <API key>(); public: static Node* getInstance() { return instance; } LedWrapper* LedRed; LedWrapper* LedGreen; LedWrapper* LedBlue; SimpleBuffer* joinMePacketBuffer; NodeConfiguration persistentConfig; //Array that holds all active modules Module* activeModules[MAX_MODULE_COUNT] = {0}; discoveryState <API key>; discoveryState nextDiscoveryState; //The global time is saved as 32768 ticks per second (<API key>) //Any node that uses a prescaler must therefore adapt to this u64 globalTime; //Hooray to the compiler for abstracting 64bit operations :-) u32 globalTimeSetAt; //The value of the RTC timer when the globalTime was set u16 <API key>; i32 <API key>; u32 appTimerMs; u32 lastDecisionTimeMs; u8 noNodesFoundCounter; //Incremented every time that no interesting cluster packets are found //Variables (kinda private, but I'm too lazy to write getters) clusterSIZE clusterSize; clusterID clusterId; u32 radioActiveCount; u32 <API key>; enum ledMode { LED_MODE_OFF, <API key>, LED_MODE_RADIO }; ledMode currentLedMode; bool outputRawData; // Result of the bestCluster calculation enum decisionResult { <API key>, <API key>, <API key> }; //Node Node(networkID networkId); //Connection void <API key>(Connection* connection); //Stuff Node::decisionResult <API key>(void); void UpdateJoinMePacket(joinMeBufferPacket* ackCluster); void <API key>(u8* newData, u8 length); //States void ChangeState(discoveryState newState); void DisableStateMachine(bool disable); //Disables the ChangeState function and does therefore kill all automatic mesh functionality void Stop(); //Persistent configuration void SaveConfiguration(); //Connection handlers //Message handlers void <API key>(ble_evt_t* bleEvent); //Timers and Stuff handler static void RadioEventHandler(bool radioActive); void TimerTickHandler(u16 timerMs); //Helpers clusterID GenerateClusterID(void); void UpdateClusterInfo(Connection* connection, <API key>* packet); u32 <API key>(joinMeBufferPacket* packet); u32 <API key>(joinMeBufferPacket* packet); void PrintStatus(void); void PrintBufferStatus(void); void <API key>(void); //Uart communication void UartSetCampaign(); //Methods of <API key> bool <API key>(string commandName, vector<string> commandArgs); //Implements Storage Callback for loading the configuration void <API key>(); //Methods of <API key> void <API key>(ble_evt_t* bleEvent); void <API key>(ble_evt_t* bleEvent); void <API key>(ble_evt_t* bleEvent); void <API key>(connectionPacket* inPacket); //Set to true, to reset the system every 25 seconds and lock it when we find invalid states static bool <API key>; };
using CP77.CR2W.Reflection; using FastMember; using static CP77.CR2W.Types.Enums; namespace CP77.CR2W.Types { [REDMeta] public class AIFollowSlotDef : <API key> { [Ordinal(0)] [RED("slotID")] public <API key> SlotID { get; set; } [Ordinal(1)] [RED("slotTransform")] public <API key> SlotTransform { get; set; } public AIFollowSlotDef(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name) { } } }
#include "../../unp.h" static int servfd; static int nsec; // #seconds between each alarm. static int maxnalarms; // #alarms w/no client probe before quit. static int nprobes; // #alarms since last client probe. static void sig_urg(int), sig_alrm(int); void heartbeat_serv(int servfd_arg, int nsec_arg, int maxnalarms_arg) { servfd = servfd_arg; // set globals for signal handlers. nsec = max(1, nsec_arg); maxnalarms = max(nsec, maxnalarms_arg); Signal(SIGURG, sig_urg); Fcntl(servfd, F_SETOWN, getpid()); Signal(SIGALRM, sig_alrm); alarm(nsec); } static void sig_urg(int) { int n; char c; if ((n = recv(servfd, &c, 1, MSG_OOB)) < 0) { if (errno != EWOULDBLOCK) { err_sys("recv error"); } } Send(servfd, &c, 1, MSG_OOB); // echo back out-of-band byte. nprobes = 0; return; } static void sig_alrm(int) { if (++nprobes > maxnalarms) { printf("no probes from client\n"); exit(0); } alarm(nsec); return; }