Best Python code snippet using pytest-benchmark
smartSteps.js
Source:smartSteps.js
1/**2 * echarts å¼è½´å段å»åº¦è®¡ç®æ¹æ³3 *4 * @desc echartsåºäºCanvasï¼çº¯Javascriptå¾è¡¨åºï¼æä¾ç´è§ï¼çå¨ï¼å¯äº¤äºï¼å¯ä¸ªæ§åå®å¶çæ°æ®ç»è®¡å¾è¡¨ã5 * @author Kener (@Kener-æå³°, kener.linfeng@gmail.com)6 * @author xieshiwei (è°¢ä¸å¨, i6ma@i6ma.com)7 *8 */9/**10 * æå¼ã跨度ãæ¥é¿åè¿ä¼¼å¼11 * 注æï¼ä¸éç¨äºé«ç²¾åº¦éæ±ï¼æè
å¾å¤ä½æææ°åçæ
åµï¼ï¼ï¼12 * @function smartSteps13 * @param {Number} min æå°å¼14 * @param {Number} max æ大å¼15 * @param {Number} [section] 段æ°åªè½æ¯ [0, 99] çæ´æ°ï¼æ®µæ°ä¸º 0 æè
ä¸æå®æ®µæ°æ¶ï¼å°èªå¨è°æ´æ®µæ°16 * @param {Object} [opts] å
¶å®æ©å±åæ°17 * @param {Array} opts.steps èªå®ä¹æ¥é¿å¤éå¼ï¼å¦ [10, 12, 15, 20, 25, 30, 40, 50, 60, 80] ï¼ä½å¿
é¡» => [10, 99]18 * @return {Object} {min: æ°æå°å¼, max: æ°æ大å¼, secs: å段æ°, step: æ¯æ®µé¿, fix: å°æ°ä¿çä½æ°, pnts: [å段ç»æ]}19 */20define(function() {21var mySteps = [10, 20, 25, 50];22var mySections = [4, 5, 6];23var custOpts;24var custSteps;25var custSecs;26var minLocked;27var maxLocked;28var MT = Math;29var MATH_ROUND = MT.round;30var MATH_FLOOR = MT.floor;31var MATH_CEIL = MT.ceil;32var MATH_ABS = MT.abs;33function MATH_LOG(n) {return MT.log(MATH_ABS(n)) / MT.LN10;}34function MATH_POW(n) {return MT.pow(10, n);}35function MATH_ISINT(n) {return n === MATH_FLOOR(n);}36function smartSteps(min, max, section, opts) {37 // æ¿å
Œ
±åéæ¥æ¥æ¶ opts.steps è¿ä¸ªåæ°ï¼å°±ä¸ç¨å¸¦çåæ°å±å±ä¼ éäºï¼æ³¨æå¨å½æ°çæç»åºå£å¤éæ¾è¿ä¸ªå¼38 custOpts = opts || {};39 custSteps = custOpts.steps || mySteps;40 custSecs = custOpts.secs || mySections;41 section = MATH_ROUND(+section || 0) % 99; // 段æ°éå®å¨ [0, 99] ï¼0 åèªéåº42 min = +min || 0;43 max = +max || 0;44 minLocked = maxLocked = 0;45 if ('min' in custOpts) {46 min = +custOpts.min || 0;47 minLocked = 1;48 }49 if ('max' in custOpts) {50 max = +custOpts.max || 0;51 maxLocked = 1;52 }53 if (min > max) {max = [min, min = max][0];} // æå¼äº¤æ¢54 var span = max - min;55 if (minLocked && maxLocked) {56 return bothLocked(min, max, section); // 两个æå¼åæ¶è¢«éå®ï¼æ³¨æå·®å¼ä¸º 0 çæ
åµ57 }58 if (span < (section || 5)) { // 跨度å¼å°äºè¦åç段æ°ï¼æ¥é¿å°ä¼å°äº 159 if (MATH_ISINT(min) && MATH_ISINT(max)) { // æ¥é¿å°äº 1 åæ¶ä¸¤ä¸ªæå¼é½æ¯æ´æ°ï¼ç¹å«å¤ç60 return forInteger(min, max, section); // ä¹è¦èèå·®å¼ä¸º 0 çæ
åµ61 }62 else if (span === 0) { // éæ´æ°ä¸è·¨åº¦ä¸º 0 çæ
åµ63 return forSpan0(min, max, section);64 }65 }66 return coreCalc(min, max, section); // éç¹æ®æ
åµç计ç®ï¼é¡»ç¡®ä¿ min < max67}68/**69 * æé è¿åå¼ï¼å¤çå°æ°ç²¾åº¦çé®é¢70 * @param {Number} newMin æå°å¼71 * @param {Number} newMax æ大å¼72 * @param {Number} section å段æ°73 * @param {Number} [expon] 计ç®é级74 * @return {Object} å smartSteps75 */76function makeResult(newMin, newMax, section, expon) {77 expon = expon || 0; // è¿æ¯ä¸é´è®¡ç®é级ï¼åæ¥é¿å¢é¿ãç¹å«æ¯æå¼éå®çå½±åï¼å¯è½ä¼å°äºåºåé级ï¼å 为æ´æ°é¨å被è¿åº¦æ¾å¤§78 var expStep = expNum((newMax - newMin) / section, -1);79 var expMin = expNum(newMin, -1, 1); // éå®çæå¼æææ°ä½å¯è½å¾å¤ï¼éè¦å
¨ç²¾åº¦ä¿ç80 var expMax = expNum(newMax, -1);81 var minExp = MT.min(expStep.e, expMin.e, expMax.e); // è¿ä¸ªå¼å®é
ä¸å°±æ¯åå¼æ´æ°é¨åå°¾é¨å¤ä½ç 0 ç个æ°82 if (expMin.c === 0) { // 0 å¯ä»¥æä»»æå¤ä¸ªå°¾083 minExp = MT.min(expStep.e, expMax.e);84 } else if (expMax.c === 0) {85 minExp = MT.min(expStep.e, expMin.e);86 }87 expFixTo(expStep, {c: 0, e: minExp});88 expFixTo(expMin, expStep, 1);89 expFixTo(expMax, expStep);90 expon += minExp; // æç»çåºåé级ï¼å¨è¿ä¸ªé级ä¸ï¼åå¼å好è½è¡¨ç¤ºææ´æ°91 newMin = expMin.c;92 newMax = expMax.c;93 var step = (newMax - newMin) / section;94 var zoom = MATH_POW(expon);95 var fixTo = 0;96 var points = [];97 for (var i = section + 1; i--;) { // å 为ç¹æ°æ¯æ®µæ°å¤ 198 points[i] = (newMin + step * i) * zoom; // å¦æä¸æ¶åå°æ°é®é¢ï¼è¿éå°±ç´æ¥ä½¿ç¨æ°å¼å99 }100 if (expon < 0) {101 fixTo = decimals(zoom); // åé¢å·²ç»å»æäºåå¼å°¾é¨å¤ä½ç 0 ï¼æ以 zoom çå°æ°ä½å°±æ¯æç»ç fix ä½æ°102 step = +(step * zoom).toFixed(fixTo); // toFixed å¤çé¿å°¾å°æ°é®é¢ï¼å¦ï¼0.2 * 0.1 = 0.020000000000000004103 newMin = +(newMin * zoom).toFixed(fixTo);104 newMax = +(newMax * zoom).toFixed(fixTo);105 for (var i = points.length; i--;) {106 points[i] = points[i].toFixed(fixTo); // 为ä¿è¯å°æ°ç¹å¯¹é½ï¼ç»ä¸è½¬ä¸ºå符å107 +points[i] === 0 && (points[i] = '0'); // 0.000 ä¸å¥½ç108 }109 }110 else {111 newMin *= zoom;112 newMax *= zoom;113 step *= zoom;114 }115 custSecs = 0;116 custSteps = 0;117 custOpts = 0;118 // è¿äºå
Œ
±åéå¯è½æç¨äºå¯¹ç¨æ·åæ°çå¼ç¨ï¼è¿éæ¯å½æ°çæç»åºå£ï¼éæ¾å¼ç¨119 return {120 min: newMin, // æ°æå°å¼121 max: newMax, // æ°æ大å¼122 secs: section, // å段æ°123 step: step, // æ¯æ®µé¿124 fix: fixTo, // å°æ°ä¿çä½æ°ï¼0 å为æ´æ°125 exp: expon, // åºåé级ï¼å¹¶éåå¼æå¨çé级ï¼èæ¯è¯´å¨è¿ä¸ªé级ä¸ï¼åå¼è½è¡¨ç¤ºææ´æ°126 pnts: points // å段ç»æï¼æ´æ°é½æ¯æ°å¼åï¼å°æ°æ¶ä¸ºäºå¯¹é½å°æ°ç¹ï¼é½æ¯å符åï¼ä½å
¶ä¸ 0 ä¸å¸¦å°æ°ç¹ï¼å³æ²¡æ "0.000"127 };128}129/**130 * é级计æ°æ³ 表示æ°å¼ï¼ä¸éç¨äºå¾å¤§æè
å¾å°çæ°ï¼0 æ´ä¸è¡131 * @param {Number} num åæ°132 * @param {Number} [digit = 2] 精度ä½æ°ï¼å¿
é¡» => [1, 9]133 * @param {Boolean} [byFloor = 0] é»è®¤ä¸º 0 表示è¿ä¼¼å¼ä¸å°äºåå¼ï¼ç½® 1 表示è¿ä¼¼å¼ä¸å¤§äºåå¼134 * @return {Object} {c: c, e: e} c e é½æ¯æ´æ°ï¼c * 10 ^ e å³ä¸ºåå¼çè¿ä¼¼æ°135 * @description è¿åå¼åºè¯¥æ´è¯¦ç»ä¸ç¹ï¼{c: c, e: e, d: d, n: n} ï¼å
¶ä¸ d æ¯ c çä½æ°ï¼n = c * 10 ^ e ï¼ä¸è¿ç®å好åä¸å¤ªæç¨136 */137function expNum(num, digit, byFloor) {138 digit = MATH_ROUND(digit % 10) || 2;139 if (digit < 0) { // å
¨ç²¾åº¦ä½æ°140 if (MATH_ISINT(num)) { // æ´æ°çå
¨ç²¾åº¦ä½æ°ï¼è¦å»æå°¾ 0 ï¼ä½ 0 ä¹æ¯æ´æ°ï¼è¦ä¸é¨çä¸ä½ç²¾åº¦141 digit = ('' + MATH_ABS(num)).replace(/0+$/, '').length || 1;142 }143 else { // å°æ°çå
¨ç²¾åº¦ä½æ°ï¼è¦å»æé¦ 0144 num = num.toFixed(15).replace(/0+$/, ''); // toFixed å¤çé¿å°¾å°æ°145 digit = num.replace('.', '').replace(/^[-0]+/, '').length;146 num = +num; // '' + 0.0000001 ä¼å¾å° '1e-7'147 }148 }149 var expon = MATH_FLOOR(MATH_LOG(num)) - digit + 1;150 var cNum = +(num * MATH_POW(-expon)).toFixed(15) || 0; // toFixed å¤çé¿å°¾å°æ°é®é¢151 cNum = byFloor ? MATH_FLOOR(cNum) : MATH_CEIL(cNum); // åä¸åæ´å¯è½åçè¿ä½ï¼ä½¿ç²¾åº¦ä½æ°å¢å 1152 !cNum && (expon = 0);153 if (('' + MATH_ABS(cNum)).length > digit) { // æ´æ°ä½æ°å¤æï¼å符串æ³æ¯å¯¹æ°æ³å¿«è¿ä¸å154 expon += 1;155 cNum /= 10;156 }157 return {158 c: cNum,159 e: expon160 };161}162/**163 * å°åè
çææ°å¯¹é½å°åè
ï¼å¦æåè
é级è¾å°ï¼å°±æ¯å¼ºå¶å 大ææ°ï¼å¼è¯¯å·®å¯è½ä¸¥éæ¾å¤§ï¼çè³å¼å为 0164 */165function expFixTo(expnum1, expnum2, byFloor) {166 var deltaExp = expnum2.e - expnum1.e;167 if (deltaExp) {168 expnum1.e += deltaExp; // ææ°åå°æ¶ï¼åªéå°æ´æ°é¨åç¸åºæ¾å¤§169 expnum1.c *= MATH_POW(-deltaExp); // ææ°å¢å æ¶ï¼æ´æ°é¨åå°ç¼©å°ï¼å°±æ¶å floor ceil åæ´åå 0 é®é¢170 expnum1.c = byFloor ? MATH_FLOOR(expnum1.c) : MATH_CEIL(expnum1.c);171 }172}173/**174 * å°ä¸¤ä¸ªé级æ°çææ°å¯¹é½å°è¾å°è
175 */176function expFixMin(expnum1, expnum2, byFloor) {177 if (expnum1.e < expnum2.e) {178 expFixTo(expnum2, expnum1, byFloor);179 }180 else {181 expFixTo(expnum1, expnum2, byFloor);182 }183}184/**185 * åºäºé级计æ°æ³ï¼å¯¹åå¼çæ´æ°é¨ååè¿ä¼¼ï¼ä¸éç¨äºè´æ°å 0186 * @param {Number} num åå¼187 * @param {Array} [rounds] å¨åè¿ä¼¼æ¶ï¼æä¾é¢ç½®é项ï¼è¿ä¼¼å° rounds ä¸çæ项188 * @return {Object} expNum 2 ä½ç²¾åº¦çé级计æ°æ³å¯¹è±¡ï¼ä¸å°äºåå¼189 */190function getCeil(num, rounds) {191 rounds = rounds || mySteps;192 num = expNum(num); // 2 ä½ç²¾åº¦é级计æ°æ³193 var cNum = num.c;194 var i = 0;195 while (cNum > rounds[i]) { // å¨é¢ç½®çè¿ä¼¼æ°ä¸ï¼æ¾å°ä¸å°äºç®æ cNum ç项196 i++;197 }198 if (!rounds[i]) { // å¦æ没æ¾å°åéçé¢ç½®é¡¹ï¼ä¸å®æ¯ç®æ å¼å¤§äºå
¨é¨çé¢ç½®é¡¹199 cNum /= 10; // å°ç®æ å¼ç¼©å° 10 åï¼éæ¾ä¸æ¬¡å®è½å½ä¸200 num.e += 1;201 i = 0;202 while (cNum > rounds[i]) {203 i++;204 }205 }206 num.c = rounds[i];207 return num;208}209/**210 * åºäºé级计æ°æ³ç计ç®ï¼å¿
é¡» min < max211 */212function coreCalc(min, max, section) {213 var step;214 var secs = section || +custSecs.slice(-1);215 var expStep = getCeil((max - min) / secs, custSteps); // è¿æ¯å¯è½çæå°æ¥é¿ï¼ä»¥å®çé级ä½ä¸ºåç»è®¡ç®çåºåé级ï¼ä»¥ä¿è¯æ´æ°è®¡ç®ç¹æ§216 var expSpan = expNum(max - min); // 2 ä½ç²¾åº¦çæå¼è·¨åº¦ï¼è¿é«ç精度æå³çæææ°ä½æ´å¤217 var expMin = expNum(min, -1, 1); // æå°å¼åä¸è¿ä¼¼ï¼ä»¥æ¶µçåæå°å¼218 var expMax = expNum(max, -1); // æ大å¼åä¸è¿ä¼¼ï¼åæ° -1 表示ä¿çå
¨ç²¾åº¦ï¼å 为è¦æ³¨æ min = 10000001, max = 10000002 çæ
åµ219 expFixTo(expSpan, expStep); // ææ°å¯¹é½220 expFixTo(expMin, expStep, 1); // ç»è¿ææ°å¯¹é½ï¼åæ大å¼ãæå°å¼é½æå¯è½å为 0221 expFixTo(expMax, expStep);222 if (!section) {223 secs = look4sections(expMin, expMax);224 }225 else {226 step = look4step(expMin, expMax, secs);227 }228 // å¦æåæå¼é½æ¯æ´æ°ï¼å°½é让è¾åºå¼ä¹ä¿ææ´æ°ï¼ä½åæå¼è·¨ 0 çåä¸è°æ´229 if (MATH_ISINT(min) && MATH_ISINT(max) && min * max >= 0) {230 if (max - min < secs) { // å次åºç°è·¨åº¦å°äºæ®µæ°231 return forInteger(min, max, secs);232 }233 secs = tryForInt(min, max, section, expMin, expMax, secs);234 }235 var arrMM = cross0(min, max, expMin.c, expMax.c);236 expMin.c = arrMM[0];237 expMax.c = arrMM[1];238 if (minLocked || maxLocked) {239 singleLocked(min, max, expMin, expMax);240 }241 return makeResult(expMin.c, expMax.c, secs, expMax.e);242}243/**244 * å¨é¢ç½®çå¯é段æ°ä¸ï¼æ¾åºä¸ä¸ªåéçå¼ï¼è®©è·¨åº¦è¯¯å·®å°½éå°245 */246function look4sections(expMin, expMax) {247 var section;248 var tmpStep, tmpMin, tmpMax;249 var reference = [];250 for (var i = custSecs.length; i--;) { // éæ¥åå°æ®µæ°ï¼æ¥é¿å°±ä¼æ¸å¤§251 section = custSecs[i];252 tmpStep = getCeil((expMax.c - expMin.c) / section, custSteps);253 tmpStep = tmpStep.c * MATH_POW(tmpStep.e); // æ¥é¿é½ç¨å¸¸è§æ´æ°åä¸è®¡ç®254 tmpMin = MATH_FLOOR(expMin.c / tmpStep) * tmpStep;255 tmpMax = MATH_CEIL(expMax.c / tmpStep) * tmpStep;256 reference[i] = {257 min: tmpMin,258 max: tmpMax,259 step: tmpStep,260 span: tmpMax - tmpMin // æ¥é¿ç误差被 æ®µæ° æåæ¾å¤§ï¼å¯è½ä¼ç»è·¨åº¦é ææ´å¤§ç误差ï¼ä½¿æåç段æ°å¤§äºé¢ç½®çæ大å¼261 };262 }263 reference.sort(function (a, b) {264 var delta = a.span - b.span; // å段è°æ´ä¹åç跨度ï¼ä¸å®ä¸å°äºå跨度ï¼æ以è¶å°è¶å¥½265 if (delta === 0) {266 delta = a.step - b.step; // 跨度ç¸åæ¶ï¼æ¥é¿å°è
èåº267 }268 return delta;269 });270 reference = reference[0];271 section = reference.span / reference.step;272 expMin.c = reference.min;273 expMax.c = reference.max;274 return section < 3 ? section * 2 : section; // å¦ææç»æ¥é¿æ¯æå°æ¥é¿å¤§å¾å¤ï¼æ®µæ°å°±å¯è½åå¾å¾å°275}276/**277 * æå®æ®µæ°ï¼å¨é¢ç½®çå¯éæ¥é¿ä¸ï¼æ¾åºä¸ä¸ªåéçå¼ï¼è®© æ¥é¿ * æ®µæ° ç§¯å好涵çåæ大å¼ä¸æå°å¼278 */279function look4step(expMin, expMax, secs) {280 var span;281 var tmpMax;282 var tmpMin = expMax.c;283 var tmpStep = (expMax.c - expMin.c) / secs - 1;284 while (tmpMin > expMin.c) {285 tmpStep = getCeil(tmpStep + 1, custSteps);286 tmpStep = tmpStep.c * MATH_POW(tmpStep.e);287 span = tmpStep * secs;288 tmpMax = MATH_CEIL(expMax.c / tmpStep) * tmpStep;289 tmpMin = tmpMax - span; // ä¼å
ä¿è¯ max 端ç误差æå°ï¼è¯çå min å¼è½å¦è¢«è¦çå°290 }291 var deltaMin = expMin.c - tmpMin; // ä¸é¢ç计ç®å¯è½ä¼è®© min 端ç误差æ´å¤§ï¼ä¸é¢å°è¯å衡误差292 var deltaMax = tmpMax - expMax.c;293 var deltaDelta = deltaMin - deltaMax;294 if (deltaDelta > tmpStep * 1.1) { // å½ min 端çè¯¯å·®æ¯ max 端大å¾å¤æ¶ï¼èèå° tmpMin tmpMax åæ¶ä¸ç§»295 deltaDelta = MATH_ROUND(deltaDelta / tmpStep / 2) * tmpStep;296 tmpMin += deltaDelta;297 tmpMax += deltaDelta;298 }299 expMin.c = tmpMin;300 expMax.c = tmpMax;301 return tmpStep;302}303/**304 * åæå¼é½æ¯æ´æ°æ¶ï¼å°è¯è®©è¾åºä¹ä¿ææ´æ°305 */306function tryForInt(min, max, section, expMin, expMax, secs) {307 var span = expMax.c - expMin.c;308 var step = span / secs * MATH_POW(expMax.e);309 if (!MATH_ISINT(step)) { // åæå¼é½æ¯æ´æ°ï¼ä½è®¡ç®æ¥é¿å¯è½åºç°å°æ°ï¼å¦ 2.5310 step = MATH_FLOOR(step); // æ¥é¿æ»æ¯è¦å°½éå°ï¼ä»¥åå°è·¨åº¦è¯¯å·®ï¼æ以 2.5 å¯è½è¢«è°æ´ä¸º 2 æè
3311 span = step * secs;312 if (span < max - min) {313 step += 1;314 span = step * secs;315 if (!section && (step * (secs - 1) >= (max - min))) {316 secs -= 1;317 span = step * secs;318 }319 }320 if (span >= max - min) {321 var delta = span - (max - min); // 误差åè¡¡322 expMin.c = MATH_ROUND(min - delta / 2);323 expMax.c = MATH_ROUND(max + delta / 2);324 expMin.e = 0;325 expMax.e = 0;326 }327 }328 return secs;329}330/**331 * æ´æ°æ
åµä¸ï¼è·¨åº¦å°äºæ®µæ°çå¤ç332 */333function forInteger(min, max, section) {334 section = section || 5;335 if (minLocked) {336 max = min + section; // min max 没æåéï¼å 为 min locked æ以 max å¨ min ä¸æµ®å¨337 }338 else if (maxLocked) {339 min = max - section;340 }341 else {342 var delta = section - (max - min); // 没æ端ç¹éå®æ¶ï¼åä¸ä¸å»¶å±è·¨åº¦343 var newMin = MATH_ROUND(min - delta / 2);344 var newMax = MATH_ROUND(max + delta / 2);345 var arrMM = cross0(min, max, newMin, newMax); // é¿å
è·¨ 0346 min = arrMM[0];347 max = arrMM[1];348 }349 return makeResult(min, max, section);350}351/**352 * éæ´æ°æ
åµä¸ï¼è·¨åº¦ä¸º 0 çå¤ç353 */354function forSpan0(min, max, section) {355 section = section || 5;356 // delta ä¸å®ä¸ä¸º 0 ï¼å 为 min === max === 0 çæ
åµä¼è¿å
¥ forInteger åæ¯357 var delta = MT.min(MATH_ABS(max / section), section) / 2.1;358 if (minLocked) {359 max = min + delta; // min max 没æåéï¼å 为 min locked æ以 max å¨ min ä¸æµ®å¨360 }361 else if (maxLocked) {362 min = max - delta;363 }364 else { // 以æå¼ä¸ºä¸å¿ï¼ä¸ä¸å延å±ä¸å°æ®µ365 min = min - delta;366 max = max + delta;367 }368 return coreCalc(min, max, section);369}370/**371 * å½åå§æå¼é½å¨ 0 çå侧æ¶ï¼è®©è¾åºä¹ä¿æå¨ 0 çå侧372 */373function cross0(min, max, newMin, newMax) {374 if (min >= 0 && newMin < 0) {375 newMax -= newMin;376 newMin = 0;377 }378 else if (max <= 0 && newMax > 0) {379 newMin -= newMax;380 newMax = 0;381 }382 return [newMin, newMax];383}384/**385 * åä¸ä¸ªæ°çå°æ°ä½æ°386 * @param {Number} num åæ°å¼387 * @return {Number} decimals æ´æ°åè¿å 0 ï¼å°æ°åè¿åå°æ°ç¹åçä½æ°388 */389function decimals(num) {390 num = (+num).toFixed(15).split('.'); // String(0.0000001) ä¼å¾å° '1e-7'391 return num.pop().replace(/0+$/, '').length;392}393/**394 * å个æå¼éå®å¤çï¼åªæ¯å¨å计ç®çåºç¡ä¸ï¼éå®ä¸ä¸ªï¼å¹³ç§»å¦ä¸ä¸ª395 */396function singleLocked(min, max, emin, emax) {397 if (minLocked) {398 var expMin = expNum(min, 4, 1); // 4 ä½ç²¾åº¦åä¸è¿ä¼¼399 if (emin.e - expMin.e > 6) { // å¦æéå®å¼çé级è¿å°äºåºåé级ï¼è®¤ä¸ºéå®å¤±è´¥ï¼å¼ºç½®ä¸º 0400 expMin = {c: 0, e: emin.e};401 }402 expFixMin(emin, expMin); // å°ææ°ä¸é级è¾å°è
对é½403 expFixMin(emax, expMin);404 emax.c += expMin.c - emin.c; // æ大å¼å¹³ç§»405 emin.c = expMin.c; // æå°å¼éå®406 }407 else if (maxLocked) {408 var expMax = expNum(max, 4); // 4 ä½ç²¾åº¦åä¸è¿ä¼¼409 if (emax.e - expMax.e > 6) { // å¦æéå®å¼çé级è¿å°äºåºåé级ï¼è®¤ä¸ºéå®å¤±è´¥ï¼å¼ºç½®ä¸º 0410 expMax = {c: 0, e: emax.e};411 }412 expFixMin(emin, expMax); // å°ææ°ä¸é级è¾å°è
对é½413 expFixMin(emax, expMax);414 emin.c += expMax.c - emax.c; // æå°å¼å¹³ç§»415 emax.c = expMax.c; // æ大å¼éå®416 }417}418/**419 * æå°å¼åæ大å¼åæ¶è¢«éå®çæ
åµå¨è¿éï¼å
¶å®å°æ¹åªèèåè¾¹æå¼éå®420 * @param {Number} min éå®çæå°å¼421 * @param {Number} max éå®çæ大å¼422 * @param {Number} [section] 段æ°423 * @return {Object} å smartSteps424 */425function bothLocked(min, max, section) {426 var trySecs = section ? [section] : custSecs;427 var span = max - min;428 if (span === 0) { // æ大æå°å¼é½éå®å°åä¸ä¸ªå¼ä¸ï¼è®¤ä¸ºéå®å¤±è´¥429 max = expNum(max, 3); // 3 ä½ç²¾åº¦åä¸è¿ä¼¼430 section = trySecs[0];431 max.c = MATH_ROUND(max.c + section / 2);432 return makeResult(max.c - section, max.c, section, max.e);433 }434 if (MATH_ABS(max / span) < 1e-6) { // å¦æéå®å¼è¿å°äºè·¨åº¦ï¼ä¹è®¤ä¸ºéå®å¤±è´¥ï¼å¼ºç½®ä¸º 0435 max = 0;436 }437 if (MATH_ABS(min / span) < 1e-6) {438 min = 0;439 }440 var step, deltaSpan, score;441 var scoreS = [[5, 10], [10, 2], [50, 10], [100, 2]];442 var reference = [];443 var debugLog = [];444 var expSpan = expNum((max - min), 3); // 3 ä½ç²¾åº¦åä¸è¿ä¼¼445 var expMin = expNum(min, -1, 1);446 var expMax = expNum(max, -1);447 expFixTo(expMin, expSpan, 1);448 expFixTo(expMax, expSpan);449 span = expMax.c - expMin.c;450 expSpan.c = span;451 452 for (var i = trySecs.length; i--;) {453 section = trySecs[i];454 step = MATH_CEIL(span / section);455 deltaSpan = step * section - span;456 score = (deltaSpan + 3) * 3; // 误差è¶å¤§å¾åè¶é«457 score += (section - trySecs[0] + 2) * 2; // å段è¶å¤å¾åè¶é«458 if (section % 5 === 0) { // 段æ°ä¸º 5 å¯ä»¥åå459 score -= 10;460 }461 for (var j = scoreS.length; j--;) { // 好çæ¥é¿æ¯æéè¦çåå项462 if (step % scoreS[j][0] === 0) {463 score /= scoreS[j][1];464 }465 }466 debugLog[i] = [section, step, deltaSpan, score].join();467 reference[i] = {468 secs: section,469 step: step,470 delta: deltaSpan,471 score: score472 };473 }474 //console.log(debugLog);475 reference.sort(function (a, b) {return a.score - b.score;});476 reference = reference[0];477 expMin.c = MATH_ROUND(expMin.c - reference.delta / 2);478 expMax.c = MATH_ROUND(expMax.c + reference.delta / 2);479 return makeResult(expMin.c, expMax.c, reference.secs, expSpan.e);480}481return smartSteps;...
Constants.py
Source:Constants.py
1MAX_NAMELEN = 16 # 设å¤ç»å½ç¨æ·åé¿åº¦2MAX_RIGHT = 32 # 设å¤æ¯æçæéï¼1~12表示æ¬å°æéï¼13~32表示è¿ç¨æéï¼3NAME_LEN = 32 # ç¨æ·åé¿åº¦4PASSWD_LEN = 16 # å¯ç é¿åº¦5SERIALNO_LEN = 48 # åºåå·é¿åº¦6MACADDR_LEN = 6 # MACå°åé¿åº¦7MAX_ETHERNET = 2 # 设å¤å¯é
以太ç½ç»8MAX_NETWORK_CARD = 4 # 设å¤å¯é
æ大ç½å¡æ°ç®9MAX_BOND_NUM = 2 # 设å¤å¯é
BONDINGç½å¡æ°10PATHNAME_LEN = 128 # è·¯å¾é¿åº¦11MAX_TIMESEGMENT_V30 = 8 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大æ¶é´æ®µæ°12MAX_TIMESEGMENT = 4 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大æ¶é´æ®µæ°13MAX_SHELTERNUM = 4 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大é®æ¡åºåæ°14MAX_DAYS = 7 # æ¯å¨ç天æ°15PHONENUMBER_LEN = 32 # PPPoEæ¨å·å·ç æ大é¿åº¦16MAX_DISK_NUM = 128 # 设å¤æ¯æçæ大硬çæ°ï¼æ©å±ï¼17MAX_DISKNUM_V30 = 33 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大硬çæ°ï¼æå¤33个硬ç(å
æ¬16个å
ç½®SATA硬çã1个eSATA硬çå16个NFSç)18MAX_DISKNUM = 16 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大硬çæ°19MAX_DISKNUM_V10 = 8 # 1.2çæ¬ä¹åçæ¬20MAX_WINDOW_V40 = 64 # 设å¤æ大æ¯æçæ¬å°æ¾ç¤ºææ¾çªå£æ°(æ©å±)21MAX_WINDOW_V30 = 32 # V3.0以ä¸çæ¬æ¯æç设å¤çæ¬å°æ¾ç¤ºæ大ææ¾çªå£æ°22MAX_WINDOW = 16 # V3.0以ä¸çæ¬æ¯æç设å¤çæ¬å°æ¾ç¤ºæ大ææ¾çªå£æ°23MAX_VGA_V30 = 4 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大å¯æ¥VGAæ°24MAX_VGA = 1 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大å¯æ¥VGAæ°25MAX_USERNUM_V30 = 32 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大ç¨æ·æ°26MAX_USERNUM = 16 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大ç¨æ·æ°27MAX_EXCEPTIONNUM_V30 = 32 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大å¼å¸¸å¤çæ°28MAX_EXCEPTIONNUM = 16 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大å¼å¸¸å¤çæ°29MAX_LINK = 6 # V3.0以ä¸çæ¬æ¯æç设å¤çåééæ大è§é¢æµè¿æ¥æ°30MAX_LINK_V30 = 128 # V3.0以ä¸çæ¬æ¯æç设å¤çåééæ大è§é¢æµè¿æ¥æ°31MAX_DECPOOLNUM = 4 # å路解ç å¨æ¯ä¸ªè§£ç ééæ大å¯å¾ªç¯è§£ç æ°32MAX_DECNUM = 4 # å路解ç å¨çæ大解ç ééæ°ï¼å®é
åªæä¸ä¸ªï¼å
¶ä»ä¸ä¸ªä¿çï¼33MAX_TRANSPARENTNUM = 2 # å路解ç å¨å¯é
ç½®æ大éæééæ°34MAX_CYCLE_CHAN = 16 # å路解ç å¨æ大轮巡ééæ°35MAX_CYCLE_CHAN_V30 = 64 # æ大轮巡ééæ°ï¼æ©å±ï¼36MAX_DIRNAME_LENGTH = 80 # æ大ç®å½é¿åº¦37MAX_CUSTOM_DIR = 64 # èªå®ä¹ç®å½æ大é¿åº¦38MAX_WINDOWS = 16 # æ大çªå£æ°39MAX_WINDOWS_V41 = 16 # æ大çªå£æ°(v4.1çæ¬SDK)40MAX_STRINGNUM_V30 = 8 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大OSDå符è¡æ°41MAX_STRINGNUM = 4 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大OSDå符è¡æ°42MAX_AUXOUT = 4 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大è¾
å©è¾åºæ°43MAX_HD_GROUP = 16 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大硬çç»æ°44MAX_NFS_DISK = 8 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大NFS硬çæ°45IW_ESSID_MAX_SIZE = 32 # WIFIçSSIDå·é¿åº¦46IW_ENCODING_TOKEN_MAX = 32 # WIFIå¯é¥æ大åèæ°47MAX_SERIAL_NUM = 64 # æå¤æ¯æçéæééè·¯æ°48MAX_DDNS_NUMS = 10 # V3.0以ä¸çæ¬æ¯æç设å¤æ大å¯é
DDNSæ°49MAX_DOMAIN_NAME = 64 # æ大ååé¿åº¦50MAXPROGRESS = 100 # åæ¾æ¶çæ大ç¾åç51MAX_SERIALNUM = 2 # 设å¤æ¯æç串å£æ°ï¼1-232ï¼2-48552CARDNUM_LEN = 20 # å¡å·é¿åº¦53MAX_VIDEOOUT_V30 = 4 # V3.0以ä¸çæ¬æ¯æç设å¤çè§é¢è¾åºæ°54MAX_VIDEOOUT = 2 # V3.0以ä¸çæ¬æ¯æç设å¤çè§é¢è¾åºæ°55MAX_EMAIL_ADDR_LEN = 48 # æ大EMAILå°åé¿åº¦56MAX_EMAIL_PWD_LEN = 32 # æ大EMAILå¯ç é¿åº¦57MAX_PRESET_V30 = 256 # V3.0以ä¸çæ¬æ¯æç设å¤æ¯æçäºå°é¢ç½®ç¹æ°58MAX_TRACK_V30 = 256 # V3.0以ä¸çæ¬æ¯æç设å¤æ¯æçäºå°è½¨è¿¹æ°59MAX_CRUISE_V30 = 256 # V3.0以ä¸çæ¬æ¯æç设å¤æ¯æçäºå°å·¡èªæ°60MAX_PRESET = 128 # V3.0以ä¸çæ¬æ¯æç设å¤æ¯æçäºå°é¢ç½®ç¹æ°61MAX_TRACK = 128 # V3.0以ä¸çæ¬æ¯æç设å¤æ¯æçäºå°è½¨è¿¹æ°62MAX_CRUISE = 128 # V3.0以ä¸çæ¬æ¯æç设å¤æ¯æçäºå°å·¡èªæ°63CRUISE_MAX_PRESET_NUMS = 32 # ä¸æ¡å·¡èªæå¤çå·¡èªç¹64MAX_PTZCRUISE_POINT_NUM = 32 # æ大æ¯æå·¡èªç¹ä¸ªæ°65MAX_SERIAL_PORT = 8 # V3.0以ä¸çæ¬æ¯æç设å¤æ¯æ232串å£æ°66MAX_PREVIEW_MODE = 8 # 设å¤æ¯ææ大é¢è§æ¨¡å¼æ°ç®67MAX_MATRIXOUT = 16 # æ大模æç©éµè¾åºä¸ªæ°68LOG_INFO_LEN = 11840 # æ¥å¿éå ä¿¡æ¯é¿åº¦69DESC_LEN = 16 # äºå°æè¿°å符串é¿åº¦70DESC_LEN_64 = 64 # æè¿°å符串é¿åº¦71PTZ_PROTOCOL_NUM = 200 # V3.0以ä¸çæ¬æ¯æç设å¤æ大æ¯æçäºå°åè®®æ°72MAX_AUDIO = 1 # V3.0以ä¸çæ¬æ¯æç设å¤çè¯é³å¯¹è®²ééæ°73MAX_AUDIO_V30 = 2 # V3.0以ä¸çæ¬æ¯æç设å¤çè¯é³å¯¹è®²ééæ°74MAX_CHANNUM = 16 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大ééæ°75MAX_ALARMIN = 16 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大æ¥è¦è¾å
¥æ°76MAX_ALARMOUT = 4 # V3.0以ä¸çæ¬æ¯æç设å¤çæ大æ¥è¦è¾åºæ°77MAX_ANALOG_CHANNUM = 32 # æ大32个模æéé78MAX_ANALOG_ALARMOUT = 32 # æ大32路模ææ¥è¦è¾åº79MAX_ANALOG_ALARMIN = 32 # æ大32路模ææ¥è¦è¾å
¥80MAX_IP_DEVICE = 32 # å
许æ¥å
¥çæ大IP设å¤æ°81MAX_IP_DEVICE_V40 = 64 # å
许æ¥å
¥çæ大IP设å¤æ°82MAX_IP_CHANNEL = 32 # å
许å å
¥çæå¤IPééæ°83MAX_IP_ALARMIN = 128 # å
许å å
¥çæå¤æ¥è¦è¾å
¥æ°84MAX_IP_ALARMOUT = 64 # å
许å å
¥çæå¤æ¥è¦è¾åºæ°85MAX_IP_ALARMOUT_V40 = 4096 # å
许å å
¥çæå¤æ¥è¦è¾åºæ°(æ©å±)86MAX_CHANNUM_V30 = 64 # (MAX_ANALOG_CHANNUM87MAX_CHANNUM_V40 = 512 # æ大éé个æ°88MAX_ALARMOUT_V30 = 96 # (MAX_ANALOG_ALARMOUT89MAX_ALARMOUT_V40 = 4128 # (MAX_IP_ALARMOUT_V4090MAX_ALARMIN_V30 = 160 # (MAX_ANALOG_ALARMIN91MAX_MULTI_AREA_NUM = 24 # æ大移å¨ä¾¦æµåºå个æ°92MAX_RULE_NUM = 8 # æ大è§åæ¡æ°93MAX_RULE_NUM_4 = 4 # æ大è§åæ°94MAX_TIMESEGMENT_2 = 2 # æ大æ¶é´æ®µæ°95VCA_MAX_POLYGON_POINT_NUM = 10 # æ£æµåºåæå¤æ¯æ10个ç¹çå¤è¾¹å½¢96MAX_TARGET_NUM = 30 # æ大ç®æ 个æ°97MAX_VCA_CHAN = 16 # æ大æºè½ééæ°98IW_ESSID_MAX_SIZE = 32 # SSIDçé¿åº¦99WIFI_WEP_MAX_KEY_COUNT = 4 # æ大å¯é¥ä¸ªæ°100WIFI_WEP_MAX_KEY_LENGTH = 33 # æ大å¯é¥é¿åº¦101WIFI_WPA_PSK_MAX_KEY_LENGTH = 63 # å å¯å符çæ大é¿åº¦102WIFI_WPA_PSK_MIN_KEY_LENGTH = 8 # å å¯å符çæå°é¿åº¦103WIFI_MAX_AP_COUNT = 20 # æ 线APçæ大个æ°104NET_DVR_MAX_DISPREGION = 16 # æ¯ä¸ªæ¾ç¤ºééæå¤å¯ä»¥æ¾ç¤ºççªå£105MAX_DECODECHANNUM = 32 # å¤è·¯è§£ç å¨æ大解ç ééæ°106MAX_DISPCHANNUM = 24 # å¤è·¯è§£ç å¨æ大æ¾ç¤ºééæ°107MAX_NET_DISK = 16 # æ大ç½ç»ç¡¬çæ°108MAX_ATM_PROTOCOL_NUM = 256 # ATMæ大åè®®æ°109ATM_PROTOCOL_SORT = 4 # ATMå议段æ°110ATM_DESC_LEN = 32 # ATMæè¿°å符串é¿åº¦111MAX_ACTION_TYPE = 12 # ATMèªå®ä¹åè®®å å 交æè¡ä¸ºæ大è¡ä¸ºä¸ªæ°112SEARCH_EVENT_INFO_LEN = 300 # äºä»¶ä¿¡æ¯é¿åº¦113MAX_MASK_REGION_NUM = 4 # æ大å±è½åºå个æ°114MAX_CALIB_PT = 6 # æ大æ å®ç¹ä¸ªæ°115MAX_RECT_NUM = 6 # æ大ç©å½¢æ¡ä¸ªæ°116MAX_RESOLUTIONNUM = 64 # æ¯æçæ大å辨çæ°ç®117MAX_LOOPPLANNUM = 16 # æ大计ååæ¢ç»æ°118DECODE_TIMESEGMENT = 4 # 计å解ç æ¯å¤©æ¶é´æ®µæ°119MAX_RECORD_FILE_NUM = 20 # ä¸æ¬¡æä½æ件(120DESC_LEN_32 = 32 # æè¿°åé¿åº¦121MAX_NODE_NUM = 256 # èç¹ä¸ªæ°122MAX_ABILITYTYPE_NUM = 12 # æ大è½å项123IPC_PROTOCOL_NUM = 50 # IPCåè®®æ大个æ°124MAX_SADP_NUM = 256 # æç´¢å°è®¾å¤æ大æ°ç®125SOFTWARE_VERSION_LEN = 48 # 软件çæ¬å·é¿åº¦126MAX_REDAREA_NUM = 6 # æ大红绿ç¯åºå个æ°127MAX_LANERECT_NUM = 5 # æ大车çè¯å«åºåæ°128MAX_LICENSE_LEN = 16 # 车çå·æ大é¿åº¦129MAX_FORTIFY_NUM = 10 # æ大å¸é²ä¸ªæ°130MAX_INTERVAL_NUM = 4 # æ大æ¶é´é´é个æ°131MAX_CHJC_NUM = 3 # æ大车è¾ç份ç®ç§°å符个æ°132MAX_VL_NUM = 5 # æ大èæ线å个æ°133MAX_DRIVECHAN_NUM = 16 # æ大车éæ°134MAX_COIL_NUM = 3 # æ大线å个æ°135MAX_IOSPEED_GROUP_NUM = 4 # IOæµéç»ä¸ªæ°136MAX_IOOUT_NUM = 4 # æ大IOè¾åºå£ä¸ªæ°137MAX_IOIN_NUM = 8 # æ大IOè¾å
¥å£ä¸ªæ°138MAX_IOIN_NUMEX = 10 # æ大IOè¾å
¥å£ä¸ªæ°(æ©å±)139MAX_ITC_LANE_NUM = 6 # æ大车é个æ°140MAX_LIGHT_NUM = 6 # æ大交éç¯æ°141MAX_VIDEO_DETECT_LIGHT_NUM = 12 # æ大è§é¢æ£æµä¿¡å·ç¯ä¸ªæ°142MAX_VIDEO_INTERVAL_NUM = 2 # æ大ææé´éæ°143PICNAME_MAXITEM = 2 # å¾çå½ä»¤æå¤å
ç´ ä¸ªæ°144MAX_LANEAREA_NUM = 2 # å车éæ大åºå个æ°145MAX_ICR_NUM = 8 # æææºçº¢å¤æ»¤å
çé¢ç½®ç¹æ°146MAX_PARKNO_LEN = 16 # 车ä½ç¼å·é¿åº¦147MAX_CUSTOMDIR_LEN = 32 # èªå®ä¹ç®å½é¿åº¦148MAX_ITC_EXCEPTIONOUT = 32 # æææºæ大æ¥è¦è¾åºä¸ªæ°149MAX_ITS_SCENE_NUM = 16 # æ大åºæ¯æ°é150MAX_SCENE_TIMESEG_NUM = 16 # æ大åºæ¯æ¶é´æ®µæ°é151DEVICE_ID_LEN = 48 # 设å¤ç¼å·é¿åº¦152MONITORSITE_ID_LEN = 48 # çæµç¹ç¼å·é¿åº¦153MAX_SCH_TASKS_NUM = 10 # å®æ¶ä»»å¡æ大个æ°154ITC_MAX_POLYGON_POINT_NUM = 20 # æ£æµåºåæå¤æ¯æ20个ç¹çå¤è¾¹å½¢155MAX_ITC_SERIALCHECK_NUM = 8 # 串å£æ ¡éªç±»å个æ°156MAX_LINE_SEG_NUM = 8 # æå¤§æ ·æ¬çº¿ä¸ªæ°157MAX_SAMPLE_NUM = 5 # æå¤§æ ·æ¬ä¸ªæ°158MAX_SAMPLE_NUM_EX = 7 # æ ·æ¬æ å®ä¸ªæ°æ©å±159MAX_SIGNALLIGHT_NUM = 6 # æ大信å·ç¯ä¸ªæ°160SUPPORT_PD_NUM = 16 # æ大æ¯æçç©çç£ç个æ°161SUPPORT_ARRAY_NUM = 8 # æ大æ¯æçéµå个æ°162SUPPORT_VD_NUM = 128 # æ大æ¯æçèæç£ç个æ°163LABEL_NAME_LEN = 40 # å½åæ ç¾å称çé¿åº¦164LABEL_IDENTIFY_LEN = 64 # æ ç¾æ è¯çé¿åº¦165MAX_DEL_LABEL_IDENTIFY = 20 # å é¤çæ大æ ç¾æ è¯ä¸ªæ°166MAX_PIC_EVENT_NUM = 32 # äºä»¶æå¾çäºä»¶ç±»å个æ°167MAX_ALARMIN_CAPTURE = 16 # äºä»¶æå¾æ¥è¦è¾å
¥ä¸ªæ°168CARDNUM_LEN_V30 = 40 # å¡å·çé¿åº¦169PICTURE_NAME_LEN = 64 # å¾çå称çé¿åº¦170MAX_RECORD_PICTURE_NUM = 50 # æ大å¤ä»½å¾çå¼ æ°171CALIB_PT_NUM = 4 # æºè½äº¤éäºä»¶æ å®ä¸ªæ°172MAX_REGION_NUM = 8 # åºåå表æ大æ°ç®173MAX_LANE_NUM = 8 # æ大车éæ°ç®174MAX_AID_RULE = 8 # æ大äºä»¶è§åæ°ç®175MAX_TPS_RULE = 8 # æ大åæ°è§åæ°ç®176INQUEST_MESSAGE_LEN = 44 # 审讯éç¹æ è®°ä¿¡æ¯é¿åº¦177INQUEST_MAX_ROOM_NUM = 2 # æ大审讯室个æ°178MAX_RESUME_SEGMENT = 2 # æ¯æåæ¶æ¢å¤çç段æ°ç®179MAX_ALARMHOST_SUBSYSTEM = 32 # ç½ç»æ¥è¦ä¸»æºåç³»ç»ä¸ªæ°180MAX_ALARMHOST_ALARMIN_NUM = 512 # ç½ç»æ¥è¦ä¸»æºæ大æ¥è¦è¾å
¥å£æ°181MAX_ALARMHOST_ALARMOUT_NUM = 512 # ç½ç»æ¥è¦ä¸»æºæ大æ¥è¦è¾åºå£æ°182ALARMHOST_MAX_AUDIOOUT_NUM = 32 # ç½ç»æ¥è¦ä¸»æºæ大è¯é³è¾åºæ°183ALARMHOST_MAX_ELECTROLOCK_NUM = 32 # ç½ç»æ¥è¦ä¸»æºæ大çµéæ°184ALARMHOST_MAX_MOBILEGATE_NUM = 32 # ç½ç»æ¥è¦ä¸»æºæ大移å¨é¨æ°185ALARMHOST_MAX_SIREN_NUM = 8 # ç½ç»æ¥è¦ä¸»æºæ大è¦å·æ°ç®186MAX_DEVICE_PROTO_NUM = 256 # ç½ç»æ¥è¦ä¸»æºå议类å个æ°187MAX_DEVICE_TYPE_NUM = 256 # ç½ç»æ¥è¦ä¸»æºè®¾å¤ç±»å个æ°188MAX_CENTERNUM = 4 # ç½ç»æ¥è¦ä¸»æºæ¯æçæ大ä¸å¿ä¸ªæ°189MAX_PHONE_NUM = 32 # æ¨å·å·ç é¿åº¦190MAX_CONTENT_LEN = 512 # LEDå±æ¾å
容æ大é¿åº¦191LED_TIMER_NUM = 3 # LEDå¼å
³æºæ¶é´ç»æ°192TIME_SEGMENT_A_DAY = 48 # æ¶é´æ®µä¸ªæ°ï¼ä¸å¤©24å°æ¶ï¼åå°æ¶ä¸ä¸ªæ®µ193MAX_SUPPORT_RES = 32 # æå¤æ¯æçå辨çç±»å个æ°194MAX_DISPNUM_V41 = 32 # æ大æ¾ç¤ºéé个æ°195MAX_BIGSCREENNUM = 100 # æå¤å¤§å±æ¼æ¥åå±æ°196MAX_WIN_COUNT = 224 # 大å±æ¯ææ大çå¼çªä¸ªæ°197MAX_WINDOWSMODE = 12 # æå¤æ¯æçç»é¢åå²ç±»å个æ°198MAX_HUMAN_BIRTHDATE_LEN = 10 # æ大åºçå¹´æé¿åº¦199MAX_HUMAN_PICTURE_NUM = 10 # æ大å¾çæ°200MAX_FACE_PIC_LEN = 6144 # æ大人è¸å¾çæ°æ®é¿åº¦201MAX_OSDCHAR_NUM = 256 # èæLEDå符æ°202STREAM_ID_LEN = 32 # æµIDæ è¯é¿åº¦203MAX_AUX_ALARM_NUM = 8 # æ大è¾
å©æ¥è¦ä¸ªæ°204MAX_WIRELESS_ALARM_NUM = 8 # æ大æ 线æ¥è¦ä¸ªæ°205MAX_PRO_PATH = 256 # æ大å议路å¾é¿åº¦206DEVICEID_LEN = 32 # 设å¤IDå·é¿åº¦207DVCS_DEVICEID_LEN = 16 # 设å¤IDæ è¯ç¬¦é¿åº¦208MAX_ROIDETECT_NUM = 8 # ROIæ£æµåºå个æ°209MAX_CABINET_COUNT = 8 # æ大æºæ个æ°210ITS_MAX_DEVICE_NUM = 32 # æ大设å¤ä¸ªæ°211MAX_ALERTLINE_NUM = 8 # æ大è¦æ线æ¡æ°212MAX_INTRUSIONREGION_NUM = 8 # æ大åºå个æ°213MAX_PARKING_NUM = 4 # ä¸ä¸ªééæ大车ä½ä¸ªæ°214MAX_PARKING_STATUS = 8 # 车ä½ç¶æ个æ°215MAX_ID_LEN = 48 # ç¼å·æ大é¿åº¦216MAX_ALARMREASON_LEN = 32 # æ¥è¦ç±»åæè¿°æ大é¿åº¦217MAX_SERVERID_LEN = 64 # æ大æå¡å¨IDçé¿åº¦218MAX_SERVERDOMAIN_LEN = 128 # æå¡å¨ååæ大é¿åº¦219MAX_AUTHENTICATEID_LEN = 64 # 认è¯IDæ大é¿åº¦220MAX_AUTHENTICATEPASSWD_LEN = 32 # 认è¯å¯ç æ大é¿åº¦221MAX_SERVERNAME_LEN = 64 # æ大æå¡å¨ç¨æ·å222MAX_COMPRESSIONID_LEN = 64 # ç¼ç IDçæ大é¿åº¦223MAX_SIPSERVER_ADDRESS_LEN = 128 # SIPæå¡å¨å°åæ¯æåååIPå°å224MATRIX_MAX_OUTPUT_NUM = 256 # ç©éµæ大è¾åºéé个æ°225CLOUD_NAME_LEN = 48 # äºåå¨æå¡å¨ç¨æ·åé¿åº¦226CLOUD_PASSWD_LEN = 48 # äºåå¨æå¡å¨å¯ç é¿åº¦227MAX_URL_LEN = 240 # URLæ大é¿åº¦228MAX_OPERATE_INDEX_LEN = 32 # æä½æ°æ大é¿åº¦229MAX_FACE_PIC_NUM = 30 # 人è¸åå¾æ大个æ°230CHAN_NO_LEN = 24 # ééç¼å·æ大é¿åº¦231# ************** åè°å½æ°ç±»å begin ***************/232COMM_ALARM = 0x1100233COMM_TRADEINFO = 0x1500234COMM_ALARM_V30 = 0x4000235COMM_ALARM_V40 = 0x4007236COMM_ALARM_RULE = 0x1102237COMM_ALARM_PDC = 0x1103238COMM_UPLOAD_PLATE_RESULT = 0x2800239COMM_ITS_PLATE_RESULT = 0x3050240COMM_IPCCFG = 0x4001241COMM_ITS_PARK_VEHICLE = 0x3056242COMM_ALARM_TFS = 0x1113243COMM_ALARM_TPS_V41 = 0x1114244COMM_ALARM_AID_V41 = 0x1115245COMM_UPLOAD_FACESNAP_RESULT = 0x1112246COMM_SNAP_MATCH_ALARM = 0x2902247COMM_ALARM_ACS = 0x5002248COMM_ID_INFO_ALARM = 0x5200249COMM_VCA_ALARM = 0x4993250COMM_PASSNUM_INFO_ALARM = 0x5201251COMM_ISAPI_ALARM = 0x6009252COMM_ALARM_TPS_STATISTICS = 0x3082253ACS_CARD_NO_LEN = 32 # é¨ç¦å¡å·é¿åº¦254MAX_GROUP_NUM_128 = 128 # æ大群ç»æ°255MAX_DOOR_NUM_256 = 256 # æ大é¨æ°256CARD_PASSWORD_LEN = 8 # å¡å¯ç é¿åº¦257MAX_CARD_READER_NUM = 64 # æ大读å¡å¨æ°258MAX_DOOR_CODE_LEN = 8 # æ¿é´ä»£ç é¿åº¦259MAX_LOCK_CODE_LEN = 8 # é代ç é¿åº¦260MAX_CARD_RIGHT_PLAN_NUM = 4 # å¡æéæ大计å个æ°261MAX_ID_NUM_LEN = 32 # æ大身份è¯å·é¿åº¦262MAX_ID_NAME_LEN = 128 # æ大å§åé¿åº¦263MAX_ID_ADDR_LEN = 280 # æ大ä½åé¿åº¦264MAX_ID_ISSUING_AUTHORITY_LEN = 128 # æ大ç¾åæºå
³é¿åº¦265MAX_CARD_READER_NUM_512 = 512 # æ大读å¡å¨æ°266ERROR_MSG_LEN = 32 # ä¸åé误信æ¯267MAX_FACE_NUM = 2 # æ大人è¸æ°268MAX_FINGER_PRINT_LEN = 768 # æ大æ纹é¿åº¦269# ****************ä¼åæ¥å£ç»æä½å®ä¹å¼å§*************270NET_DVR_GET_CARD = 2560271NET_DVR_SET_CARD = 2561272NET_DVR_SET_FACE = 2567273NET_DVR_DEL_CARD = 2562274NET_SDK_CONFIG_STATUS_SUCCESS = 1000275NET_SDK_CONFIG_STATUS_NEEDWAIT = 1001276NET_SDK_CONFIG_STATUS_FINISH = 1002277NET_SDK_CONFIG_STATUS_FAILED = 1003278NET_SDK_CONFIG_STATUS_EXCEPTION = 1004279# ****************ä¼åæ¥å£ç»æä½å®ä¹ç»æ*************280NET_SDK_GET_NEXT_STATUS_SUCCESS = 1000 # æå读åå°æ°æ®,å¤çå®æ¬æ¬¡æ°æ®åéè¦å次è°ç¨NET_DVR_GetNextRemoteConfigè·åä¸ä¸æ¡æ°æ®281NET_SDK_GET_NETX_STATUS_NEED_WAIT = 1001 # éçå¾
设å¤åéæ°æ®ï¼ç»§ç»è°ç¨NET_DVR_GetNextRemoteConfig282NET_SDK_GET_NEXT_STATUS_FINISH = 1002 # æ°æ®å
¨é¨åå®ï¼å¯è°ç¨NET_DVR_StopRemoteConfigç»æé¿è¿æ¥...
IN.py
Source:IN.py
1# Generated by h2py from /usr/include/netinet/in.h2_NETINET_IN_H = 13# Included from features.h4_FEATURES_H = 15__USE_ANSI = 16__FAVOR_BSD = 17_ISOC99_SOURCE = 18_POSIX_SOURCE = 19_POSIX_C_SOURCE = 19950610_XOPEN_SOURCE = 60011_XOPEN_SOURCE_EXTENDED = 112_LARGEFILE64_SOURCE = 113_BSD_SOURCE = 114_SVID_SOURCE = 115_BSD_SOURCE = 116_SVID_SOURCE = 117__USE_ISOC99 = 118_POSIX_SOURCE = 119_POSIX_C_SOURCE = 220_POSIX_C_SOURCE = 19950621__USE_POSIX = 122__USE_POSIX2 = 123__USE_POSIX199309 = 124__USE_POSIX199506 = 125__USE_XOPEN = 126__USE_XOPEN_EXTENDED = 127__USE_UNIX98 = 128_LARGEFILE_SOURCE = 129__USE_XOPEN2K = 130__USE_ISOC99 = 131__USE_XOPEN_EXTENDED = 132__USE_LARGEFILE = 133__USE_LARGEFILE64 = 134__USE_FILE_OFFSET64 = 135__USE_MISC = 136__USE_BSD = 137__USE_SVID = 138__USE_GNU = 139__USE_REENTRANT = 140__STDC_IEC_559__ = 141__STDC_IEC_559_COMPLEX__ = 142__STDC_ISO_10646__ = 20000943__GNU_LIBRARY__ = 644__GLIBC__ = 245__GLIBC_MINOR__ = 246# Included from sys/cdefs.h47_SYS_CDEFS_H = 148def __PMT(args): return args49def __P(args): return args50def __PMT(args): return args51def __STRING(x): return #x52__flexarr = []53__flexarr = [0]54__flexarr = []55__flexarr = [1]56def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname)57def __attribute__(xyz): return58def __attribute_format_arg__(x): return __attribute__ ((__format_arg__ (x)))59def __attribute_format_arg__(x): return60__USE_LARGEFILE = 161__USE_LARGEFILE64 = 162__USE_EXTERN_INLINES = 163# Included from gnu/stubs.h64# Included from stdint.h65_STDINT_H = 166# Included from bits/wchar.h67_BITS_WCHAR_H = 168__WCHAR_MIN = (-2147483647 - 1)69__WCHAR_MAX = (2147483647)70# Included from bits/wordsize.h71__WORDSIZE = 3272def __INT64_C(c): return c ## L73def __UINT64_C(c): return c ## UL74def __INT64_C(c): return c ## LL75def __UINT64_C(c): return c ## ULL76INT8_MIN = (-128)77INT16_MIN = (-32767-1)78INT32_MIN = (-2147483647-1)79INT64_MIN = (-__INT64_C(9223372036854775807)-1)80INT8_MAX = (127)81INT16_MAX = (32767)82INT32_MAX = (2147483647)83INT64_MAX = (__INT64_C(9223372036854775807))84UINT8_MAX = (255)85UINT16_MAX = (65535)86UINT64_MAX = (__UINT64_C(18446744073709551615))87INT_LEAST8_MIN = (-128)88INT_LEAST16_MIN = (-32767-1)89INT_LEAST32_MIN = (-2147483647-1)90INT_LEAST64_MIN = (-__INT64_C(9223372036854775807)-1)91INT_LEAST8_MAX = (127)92INT_LEAST16_MAX = (32767)93INT_LEAST32_MAX = (2147483647)94INT_LEAST64_MAX = (__INT64_C(9223372036854775807))95UINT_LEAST8_MAX = (255)96UINT_LEAST16_MAX = (65535)97UINT_LEAST64_MAX = (__UINT64_C(18446744073709551615))98INT_FAST8_MIN = (-128)99INT_FAST16_MIN = (-9223372036854775807-1)100INT_FAST32_MIN = (-9223372036854775807-1)101INT_FAST16_MIN = (-2147483647-1)102INT_FAST32_MIN = (-2147483647-1)103INT_FAST64_MIN = (-__INT64_C(9223372036854775807)-1)104INT_FAST8_MAX = (127)105INT_FAST16_MAX = (9223372036854775807)106INT_FAST32_MAX = (9223372036854775807)107INT_FAST16_MAX = (2147483647)108INT_FAST32_MAX = (2147483647)109INT_FAST64_MAX = (__INT64_C(9223372036854775807))110UINT_FAST8_MAX = (255)111UINT_FAST64_MAX = (__UINT64_C(18446744073709551615))112INTPTR_MIN = (-9223372036854775807-1)113INTPTR_MAX = (9223372036854775807)114INTPTR_MIN = (-2147483647-1)115INTPTR_MAX = (2147483647)116INTMAX_MIN = (-__INT64_C(9223372036854775807)-1)117INTMAX_MAX = (__INT64_C(9223372036854775807))118UINTMAX_MAX = (__UINT64_C(18446744073709551615))119PTRDIFF_MIN = (-9223372036854775807-1)120PTRDIFF_MAX = (9223372036854775807)121PTRDIFF_MIN = (-2147483647-1)122PTRDIFF_MAX = (2147483647)123SIG_ATOMIC_MIN = (-2147483647-1)124SIG_ATOMIC_MAX = (2147483647)125WCHAR_MIN = __WCHAR_MIN126WCHAR_MAX = __WCHAR_MAX127def INT8_C(c): return c128def INT16_C(c): return c129def INT32_C(c): return c130def INT64_C(c): return c ## L131def INT64_C(c): return c ## LL132def UINT8_C(c): return c ## U133def UINT16_C(c): return c ## U134def UINT32_C(c): return c ## U135def UINT64_C(c): return c ## UL136def UINT64_C(c): return c ## ULL137def INTMAX_C(c): return c ## L138def UINTMAX_C(c): return c ## UL139def INTMAX_C(c): return c ## LL140def UINTMAX_C(c): return c ## ULL141# Included from bits/types.h142_BITS_TYPES_H = 1143__FD_SETSIZE = 1024144# Included from bits/pthreadtypes.h145_BITS_PTHREADTYPES_H = 1146# Included from bits/sched.h147SCHED_OTHER = 0148SCHED_FIFO = 1149SCHED_RR = 2150CSIGNAL = 0x000000ff151CLONE_VM = 0x00000100152CLONE_FS = 0x00000200153CLONE_FILES = 0x00000400154CLONE_SIGHAND = 0x00000800155CLONE_PID = 0x00001000156CLONE_PTRACE = 0x00002000157CLONE_VFORK = 0x00004000158__defined_schedparam = 1159def IN_CLASSA(a): return ((((in_addr_t)(a)) & (-2147483648)) == 0)160IN_CLASSA_NET = (-16777216)161IN_CLASSA_NSHIFT = 24162IN_CLASSA_HOST = ((-1) & ~IN_CLASSA_NET)163IN_CLASSA_MAX = 128164def IN_CLASSB(a): return ((((in_addr_t)(a)) & (-1073741824)) == (-2147483648))165IN_CLASSB_NET = (-65536)166IN_CLASSB_NSHIFT = 16167IN_CLASSB_HOST = ((-1) & ~IN_CLASSB_NET)168IN_CLASSB_MAX = 65536169def IN_CLASSC(a): return ((((in_addr_t)(a)) & (-536870912)) == (-1073741824))170IN_CLASSC_NET = (-256)171IN_CLASSC_NSHIFT = 8172IN_CLASSC_HOST = ((-1) & ~IN_CLASSC_NET)173def IN_CLASSD(a): return ((((in_addr_t)(a)) & (-268435456)) == (-536870912))174def IN_MULTICAST(a): return IN_CLASSD(a)175def IN_EXPERIMENTAL(a): return ((((in_addr_t)(a)) & (-536870912)) == (-536870912))176def IN_BADCLASS(a): return ((((in_addr_t)(a)) & (-268435456)) == (-268435456))177IN_LOOPBACKNET = 127178INET_ADDRSTRLEN = 16179INET6_ADDRSTRLEN = 46180# Included from bits/socket.h181# Included from limits.h182_LIBC_LIMITS_H_ = 1183MB_LEN_MAX = 16184_LIMITS_H = 1185CHAR_BIT = 8186SCHAR_MIN = (-128)187SCHAR_MAX = 127188UCHAR_MAX = 255189CHAR_MIN = 0190CHAR_MAX = UCHAR_MAX191CHAR_MIN = SCHAR_MIN192CHAR_MAX = SCHAR_MAX193SHRT_MIN = (-32768)194SHRT_MAX = 32767195USHRT_MAX = 65535196INT_MAX = 2147483647197LONG_MAX = 9223372036854775807198LONG_MAX = 2147483647199LONG_MIN = (-LONG_MAX - 1)200# Included from bits/posix1_lim.h201_BITS_POSIX1_LIM_H = 1202_POSIX_AIO_LISTIO_MAX = 2203_POSIX_AIO_MAX = 1204_POSIX_ARG_MAX = 4096205_POSIX_CHILD_MAX = 6206_POSIX_DELAYTIMER_MAX = 32207_POSIX_LINK_MAX = 8208_POSIX_MAX_CANON = 255209_POSIX_MAX_INPUT = 255210_POSIX_MQ_OPEN_MAX = 8211_POSIX_MQ_PRIO_MAX = 32212_POSIX_NGROUPS_MAX = 0213_POSIX_OPEN_MAX = 16214_POSIX_FD_SETSIZE = _POSIX_OPEN_MAX215_POSIX_NAME_MAX = 14216_POSIX_PATH_MAX = 256217_POSIX_PIPE_BUF = 512218_POSIX_RTSIG_MAX = 8219_POSIX_SEM_NSEMS_MAX = 256220_POSIX_SEM_VALUE_MAX = 32767221_POSIX_SIGQUEUE_MAX = 32222_POSIX_SSIZE_MAX = 32767223_POSIX_STREAM_MAX = 8224_POSIX_TZNAME_MAX = 6225_POSIX_QLIMIT = 1226_POSIX_HIWAT = _POSIX_PIPE_BUF227_POSIX_UIO_MAXIOV = 16228_POSIX_TTY_NAME_MAX = 9229_POSIX_TIMER_MAX = 32230_POSIX_LOGIN_NAME_MAX = 9231_POSIX_CLOCKRES_MIN = 20000000232# Included from bits/local_lim.h233# Included from linux/limits.h234NR_OPEN = 1024235NGROUPS_MAX = 32236ARG_MAX = 131072237CHILD_MAX = 999238OPEN_MAX = 256239LINK_MAX = 127240MAX_CANON = 255241MAX_INPUT = 255242NAME_MAX = 255243PATH_MAX = 4096244PIPE_BUF = 4096245RTSIG_MAX = 32246_POSIX_THREAD_KEYS_MAX = 128247PTHREAD_KEYS_MAX = 1024248_POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4249PTHREAD_DESTRUCTOR_ITERATIONS = _POSIX_THREAD_DESTRUCTOR_ITERATIONS250_POSIX_THREAD_THREADS_MAX = 64251PTHREAD_THREADS_MAX = 1024252AIO_PRIO_DELTA_MAX = 20253PTHREAD_STACK_MIN = 16384254TIMER_MAX = 256255SSIZE_MAX = LONG_MAX256NGROUPS_MAX = _POSIX_NGROUPS_MAX257# Included from bits/posix2_lim.h258_BITS_POSIX2_LIM_H = 1259_POSIX2_BC_BASE_MAX = 99260_POSIX2_BC_DIM_MAX = 2048261_POSIX2_BC_SCALE_MAX = 99262_POSIX2_BC_STRING_MAX = 1000263_POSIX2_COLL_WEIGHTS_MAX = 2264_POSIX2_EXPR_NEST_MAX = 32265_POSIX2_LINE_MAX = 2048266_POSIX2_RE_DUP_MAX = 255267_POSIX2_CHARCLASS_NAME_MAX = 14268BC_BASE_MAX = _POSIX2_BC_BASE_MAX269BC_DIM_MAX = _POSIX2_BC_DIM_MAX270BC_SCALE_MAX = _POSIX2_BC_SCALE_MAX271BC_STRING_MAX = _POSIX2_BC_STRING_MAX272COLL_WEIGHTS_MAX = 255273EXPR_NEST_MAX = _POSIX2_EXPR_NEST_MAX274LINE_MAX = _POSIX2_LINE_MAX275CHARCLASS_NAME_MAX = 2048276RE_DUP_MAX = (0x7fff)277# Included from bits/xopen_lim.h278_XOPEN_LIM_H = 1279# Included from bits/stdio_lim.h280L_tmpnam = 20281TMP_MAX = 238328282FILENAME_MAX = 4096283L_ctermid = 9284L_cuserid = 9285FOPEN_MAX = 16286IOV_MAX = 1024287_XOPEN_IOV_MAX = _POSIX_UIO_MAXIOV288NL_ARGMAX = _POSIX_ARG_MAX289NL_LANGMAX = _POSIX2_LINE_MAX290NL_MSGMAX = INT_MAX291NL_NMAX = INT_MAX292NL_SETMAX = INT_MAX293NL_TEXTMAX = INT_MAX294NZERO = 20295WORD_BIT = 16296WORD_BIT = 32297WORD_BIT = 64298WORD_BIT = 16299WORD_BIT = 32300WORD_BIT = 64301WORD_BIT = 32302LONG_BIT = 32303LONG_BIT = 64304LONG_BIT = 32305LONG_BIT = 64306LONG_BIT = 64307LONG_BIT = 32308from TYPES import *309PF_UNSPEC = 0310PF_LOCAL = 1311PF_UNIX = PF_LOCAL312PF_FILE = PF_LOCAL313PF_INET = 2314PF_AX25 = 3315PF_IPX = 4316PF_APPLETALK = 5317PF_NETROM = 6318PF_BRIDGE = 7319PF_ATMPVC = 8320PF_X25 = 9321PF_INET6 = 10322PF_ROSE = 11323PF_DECnet = 12324PF_NETBEUI = 13325PF_SECURITY = 14326PF_KEY = 15327PF_NETLINK = 16328PF_ROUTE = PF_NETLINK329PF_PACKET = 17330PF_ASH = 18331PF_ECONET = 19332PF_ATMSVC = 20333PF_SNA = 22334PF_IRDA = 23335PF_PPPOX = 24336PF_WANPIPE = 25337PF_BLUETOOTH = 31338PF_MAX = 32339AF_UNSPEC = PF_UNSPEC340AF_LOCAL = PF_LOCAL341AF_UNIX = PF_UNIX342AF_FILE = PF_FILE343AF_INET = PF_INET344AF_AX25 = PF_AX25345AF_IPX = PF_IPX346AF_APPLETALK = PF_APPLETALK347AF_NETROM = PF_NETROM348AF_BRIDGE = PF_BRIDGE349AF_ATMPVC = PF_ATMPVC350AF_X25 = PF_X25351AF_INET6 = PF_INET6352AF_ROSE = PF_ROSE353AF_DECnet = PF_DECnet354AF_NETBEUI = PF_NETBEUI355AF_SECURITY = PF_SECURITY356AF_KEY = PF_KEY357AF_NETLINK = PF_NETLINK358AF_ROUTE = PF_ROUTE359AF_PACKET = PF_PACKET360AF_ASH = PF_ASH361AF_ECONET = PF_ECONET362AF_ATMSVC = PF_ATMSVC363AF_SNA = PF_SNA364AF_IRDA = PF_IRDA365AF_PPPOX = PF_PPPOX366AF_WANPIPE = PF_WANPIPE367AF_BLUETOOTH = PF_BLUETOOTH368AF_MAX = PF_MAX369SOL_RAW = 255370SOL_DECNET = 261371SOL_X25 = 262372SOL_PACKET = 263373SOL_ATM = 264374SOL_AAL = 265375SOL_IRDA = 266376SOMAXCONN = 128377# Included from bits/sockaddr.h378_BITS_SOCKADDR_H = 1379def __SOCKADDR_COMMON(sa_prefix): return \380_SS_SIZE = 128381def CMSG_FIRSTHDR(mhdr): return \382# Included from asm/socket.h383# Included from asm/sockios.h384FIOSETOWN = 0x8901385SIOCSPGRP = 0x8902386FIOGETOWN = 0x8903387SIOCGPGRP = 0x8904388SIOCATMARK = 0x8905389SIOCGSTAMP = 0x8906390SOL_SOCKET = 1391SO_DEBUG = 1392SO_REUSEADDR = 2393SO_TYPE = 3394SO_ERROR = 4395SO_DONTROUTE = 5396SO_BROADCAST = 6397SO_SNDBUF = 7398SO_RCVBUF = 8399SO_KEEPALIVE = 9400SO_OOBINLINE = 10401SO_NO_CHECK = 11402SO_PRIORITY = 12403SO_LINGER = 13404SO_BSDCOMPAT = 14405SO_PASSCRED = 16406SO_PEERCRED = 17407SO_RCVLOWAT = 18408SO_SNDLOWAT = 19409SO_RCVTIMEO = 20410SO_SNDTIMEO = 21411SO_SECURITY_AUTHENTICATION = 22412SO_SECURITY_ENCRYPTION_TRANSPORT = 23413SO_SECURITY_ENCRYPTION_NETWORK = 24414SO_BINDTODEVICE = 25415SO_ATTACH_FILTER = 26416SO_DETACH_FILTER = 27417SO_PEERNAME = 28418SO_TIMESTAMP = 29419SCM_TIMESTAMP = SO_TIMESTAMP420SO_ACCEPTCONN = 30421SOCK_STREAM = 1422SOCK_DGRAM = 2423SOCK_RAW = 3424SOCK_RDM = 4425SOCK_SEQPACKET = 5426SOCK_PACKET = 10427SOCK_MAX = (SOCK_PACKET+1)428# Included from bits/in.h429IP_TOS = 1430IP_TTL = 2431IP_HDRINCL = 3432IP_OPTIONS = 4433IP_ROUTER_ALERT = 5434IP_RECVOPTS = 6435IP_RETOPTS = 7436IP_PKTINFO = 8437IP_PKTOPTIONS = 9438IP_PMTUDISC = 10439IP_MTU_DISCOVER = 10440IP_RECVERR = 11441IP_RECVTTL = 12442IP_RECVTOS = 13443IP_MULTICAST_IF = 32444IP_MULTICAST_TTL = 33445IP_MULTICAST_LOOP = 34446IP_ADD_MEMBERSHIP = 35447IP_DROP_MEMBERSHIP = 36448IP_RECVRETOPTS = IP_RETOPTS449IP_PMTUDISC_DONT = 0450IP_PMTUDISC_WANT = 1451IP_PMTUDISC_DO = 2452SOL_IP = 0453IP_DEFAULT_MULTICAST_TTL = 1454IP_DEFAULT_MULTICAST_LOOP = 1455IP_MAX_MEMBERSHIPS = 20456IPV6_ADDRFORM = 1457IPV6_PKTINFO = 2458IPV6_HOPOPTS = 3459IPV6_DSTOPTS = 4460IPV6_RTHDR = 5461IPV6_PKTOPTIONS = 6462IPV6_CHECKSUM = 7463IPV6_HOPLIMIT = 8464IPV6_NEXTHOP = 9465IPV6_AUTHHDR = 10466IPV6_UNICAST_HOPS = 16467IPV6_MULTICAST_IF = 17468IPV6_MULTICAST_HOPS = 18469IPV6_MULTICAST_LOOP = 19470IPV6_JOIN_GROUP = 20471IPV6_LEAVE_GROUP = 21472IPV6_ROUTER_ALERT = 22473IPV6_MTU_DISCOVER = 23474IPV6_MTU = 24475IPV6_RECVERR = 25476IPV6_RXHOPOPTS = IPV6_HOPOPTS477IPV6_RXDSTOPTS = IPV6_DSTOPTS478IPV6_ADD_MEMBERSHIP = IPV6_JOIN_GROUP479IPV6_DROP_MEMBERSHIP = IPV6_LEAVE_GROUP480IPV6_PMTUDISC_DONT = 0481IPV6_PMTUDISC_WANT = 1482IPV6_PMTUDISC_DO = 2483SOL_IPV6 = 41484SOL_ICMPV6 = 58485IPV6_RTHDR_LOOSE = 0486IPV6_RTHDR_STRICT = 1487IPV6_RTHDR_TYPE_0 = 0488# Included from endian.h489_ENDIAN_H = 1490__LITTLE_ENDIAN = 1234491__BIG_ENDIAN = 4321492__PDP_ENDIAN = 3412493# Included from bits/endian.h494__BYTE_ORDER = __LITTLE_ENDIAN495__FLOAT_WORD_ORDER = __BYTE_ORDER496LITTLE_ENDIAN = __LITTLE_ENDIAN497BIG_ENDIAN = __BIG_ENDIAN498PDP_ENDIAN = __PDP_ENDIAN499BYTE_ORDER = __BYTE_ORDER500# Included from bits/byteswap.h501_BITS_BYTESWAP_H = 1502def __bswap_constant_16(x): return \503def __bswap_16(x): return \504def __bswap_16(x): return __bswap_constant_16 (x)505def __bswap_constant_32(x): return \506def __bswap_32(x): return \507def __bswap_32(x): return \508def __bswap_32(x): return __bswap_constant_32 (x)509def __bswap_constant_64(x): return \510def __bswap_64(x): return \511def ntohl(x): return (x)512def ntohs(x): return (x)513def htonl(x): return (x)514def htons(x): return (x)515def ntohl(x): return __bswap_32 (x)516def ntohs(x): return __bswap_16 (x)517def htonl(x): return __bswap_32 (x)518def htons(x): return __bswap_16 (x)519def IN6_IS_ADDR_UNSPECIFIED(a): return \520def IN6_IS_ADDR_LOOPBACK(a): return \521def IN6_IS_ADDR_LINKLOCAL(a): return \522def IN6_IS_ADDR_SITELOCAL(a): return \523def IN6_IS_ADDR_V4MAPPED(a): return \524def IN6_IS_ADDR_V4COMPAT(a): return \525def IN6_IS_ADDR_MC_NODELOCAL(a): return \526def IN6_IS_ADDR_MC_LINKLOCAL(a): return \527def IN6_IS_ADDR_MC_SITELOCAL(a): return \528def IN6_IS_ADDR_MC_ORGLOCAL(a): return \...
World.js
Source:World.js
1import * as util from './utils.js'2// class World defines the coordinate system for the model.3// It will be upgraded with methods converting from other4// transforms like GIS and DataSets.5// const defaultZ = (maxX, maxY) => Math.max(maxX, maxY)6/**7 * @private8 * @typedef {Object} WorldOptions9 * @property {number} minX Max world patch x integer value10 * @property {number} minY Max world patch y integer value11 * @property {number} minZ Max world patch z integer value12 * @property {number} maxX Min world patch x integer value13 * @property {number} maxY Min world patch y integer value14 * @property {number} maxZ Min world patch z integer value15 */16/**17 * @description18 * Class World defines the coordinate system for the model.19 * It has transforms for multiple coordinate systems.20 *21 * The world is defined by an object with 6 properties:22 *23 * WorldOptions = {24 * minX: integer,25 * maxX: integer,26 * minY: integer,27 * maxY: integer,28 * minZ: integer,29 * maxZ: integer,30 * }31 */32export default class World {33 maxX = 1634 maxY = 1635 maxZ = 1636 minX = -1637 minY = -1638 minZ = -1639 /**40 * Create a new World object given an Object with optional41 * minX, maxX, minY, maxY, minZ, maxZ overriding class properties.42 * @param {World|WorldOptions|Object} options Object with overrides for class properties43 */44 constructor(options = {}) {45 Object.assign(this, options) // set the option override values46 this.setWorld() // convert these to rest of world parameters47 }48 /**49 * Return a default options object, origin at center.50 *51 * @param {number} [maxX=16] Integer max X value52 * @param {number} [maxY=maxX] Integer max Y value53 * @param {number} [maxZ=Math.max(maxX, maxY)] Integer max Z value54 * @returns {WorldOptions}55 */56 static defaultOptions(maxX = 16, maxY = maxX, maxZ = Math.max(maxX, maxY)) {57 return {58 minX: -maxX,59 maxX: maxX,60 minY: -maxY,61 maxY: maxY,62 minZ: -maxZ,63 maxZ: maxZ,64 }65 }66 /**67 * Factory to create a default World instance.68 *69 * @param {number} [maxX=16] Integer max X value70 * @param {number} [maxY=maxX] Integer max Y value71 * @param {number} [maxZ=Math.max(maxX, maxY)] Integer max Z value72 * @returns {World}73 */74 static defaultWorld(maxX = 16, maxY = maxX, maxZ = maxX) {75 return new World(World.defaultOptions(maxX, maxY, maxZ))76 }77 // ======================78 setWorld() {79 // Complete properties derived from minX/Y, maxX/Y (patchSize === 1)80 let { minX, maxX, minY, maxY, minZ, maxZ } = this81 util.forLoop({ minX, maxX, minY, maxY, minZ, maxZ }, (val, key) => {82 if (!Number.isInteger(val))83 throw Error(`${key}:${val} must be an integer`)84 })85 this.numX = this.width = maxX - minX + 186 this.numY = this.height = maxY - minY + 187 // if (maxZ == null) maxZ = this.maxZ = Math.max(this.width, this.height)88 this.numZ = this.depth = maxZ - minZ + 189 this.minXcor = minX - 0.590 this.maxXcor = maxX + 0.591 this.minYcor = minY - 0.592 this.maxYcor = maxY + 0.593 this.minZcor = minZ - 0.594 this.maxZcor = maxZ + 0.595 // The midpoints of the world, in world coords.96 this.centerX = (minX + maxX) / 297 this.centerY = (minY + maxY) / 298 this.centerZ = (minZ + maxZ) / 299 this.numPatches = this.numX * this.numY100 }101 /**...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!