hexsha
stringlengths 40
40
| size
int64 5
1.05M
| ext
stringclasses 98
values | lang
stringclasses 21
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
118
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
int64 1
368k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
118
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
int64 1
134k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
135
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 5
1.05M
| avg_line_length
float64 1
1.03M
| max_line_length
int64 2
1.03M
| alphanum_fraction
float64 0
1
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a7c3ff98894bf382169a4ad06ef7e61812f29281
| 1,766
|
css
|
CSS
|
public/css/seller_home_header.css
|
jatinkumar027/Zarurat.in
|
cbb35d17675812bb0243b1baf0bdc3dbf13ef103
|
[
"MIT"
] | null | null | null |
public/css/seller_home_header.css
|
jatinkumar027/Zarurat.in
|
cbb35d17675812bb0243b1baf0bdc3dbf13ef103
|
[
"MIT"
] | 2
|
2020-07-19T15:10:49.000Z
|
2020-07-20T08:20:39.000Z
|
public/css/seller_home_header.css
|
jatinkumar027/Zarurat.in
|
cbb35d17675812bb0243b1baf0bdc3dbf13ef103
|
[
"MIT"
] | 6
|
2020-07-19T13:21:30.000Z
|
2021-02-06T15:03:52.000Z
|
.header
{
height: 60px;
background : linear-gradient(57deg, rgba(26, 66, 127 ,1), rgba(0, 153, 130 ,1), rgba(51, 51, 51 ,1));
}
.header
{
display: flex;
justify-content: flex-end;
height: 50px;
background : linear-gradient(57deg, rgba(26, 66, 127 ,1), rgba(0, 153, 130 ,1), rgba(51, 51, 51 ,1));
position: fixed;
width: 100%;
z-index: 2;
}
.header div
{
height: 100%;
display: flex;
align-items: center;
}
.left-container
{
flex: 1;
display: flex;
justify-content: flex-start;
}
.left a
{
height: 100%;
cursor: pointer;
color: white;
padding: 0px 15px;
line-height: 50px;
}
.left a:hover
{
background: rgba(0, 153, 130 ,0.5);
}
.right
{
display: flex;
flex : 0.5;
}
.right ul
{
height: 100%;
cursor: pointer;
color: white;
padding: 0px 10px;
display: flex;
justify-content: flex-end;
align-items: center;
list-style: none;
line-height: 50px;
}
.right ul li
{ padding-left: 10px;
width: 150px;
position: relative;
}
.right ul li:hover
{
background: rgba(0, 153, 130 ,0.5);
}
.right ul li:hover > ul
{
display: block;
}
.right ul li ul
{
position: absolute;
top : 50px;
left : -10px;
background: transparent;
color : black;
width : 250px;
display: none;
}
.right ul li ul li
{
background: white;
display: flex;
width: 100%;
align-items: center;
flex : 1;
box-shadow: 0px 0px 1px 0px black;
font-size: 15px;
height: 40px;
padding-left : 5px;
}
.right ul li ul li:hover
{
background: rgba(75, 75, 75,0.8);
color : white;
transition :linear 300ms;
}
/* Google Translate*/
#google_translate_element
{
height: 25px;
margin-right: 10px;
}
#google_translate_element:hover
{
background: none;
}
.goog-te-banner-frame.skiptranslate {
display: none !important;
}
body {
top: 0px !important;
}
| 14.966102
| 105
| 0.651755
|
33bfe32053030ab3612888b7af0c2664924da7ba
| 1,675
|
c
|
C
|
src/defender.c
|
gfmota/rugby-game
|
222bea5128a42b528290b518e005f1258784d5a3
|
[
"MIT"
] | null | null | null |
src/defender.c
|
gfmota/rugby-game
|
222bea5128a42b528290b518e005f1258784d5a3
|
[
"MIT"
] | null | null | null |
src/defender.c
|
gfmota/rugby-game
|
222bea5128a42b528290b518e005f1258784d5a3
|
[
"MIT"
] | null | null | null |
// Standard headers
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// Internal headers
#include "direction.h"
#include "position.h"
#include "spy.h"
// Main header
#include "defender.h"
// Macros
#define UNUSED(x) (void)(x) // Auxiliary to avoid error of unused parameter
/*----------------------------------------------------------------------------*/
/* PUBLIC FUNCTIONS */
/*----------------------------------------------------------------------------*/
#define equal_direction(dir1, dir2) ((dir1.i == dir2.i) && (dir1.j == dir2.j))
direction_t execute_defender_strategy(
position_t defender_position, Spy attacker_spy) {
UNUSED(attacker_spy);
// Static variables declaration
static position_t prev_position = INVALID_POSITION;
static direction_t prev_direction = DIR_STAY;
static const direction_t directions[9] = {
DIR_STAY,
DIR_UP,
DIR_UP_RIGHT,
DIR_RIGHT,
DIR_DOWN_RIGHT,
DIR_DOWN,
DIR_DOWN_LEFT,
DIR_LEFT,
DIR_UP_LEFT
};
// Generate new seed and get a random index in directions array
srand((unsigned) time(NULL));
int ind = rand() % 9;
// In case he tried to move to an invalid position previous turn, we get a different direction
while (equal_positions(prev_position, defender_position) &&
!equal_direction(prev_direction, (direction_t) DIR_STAY) &&
equal_direction(directions[ind], prev_direction)) {
ind = rand() % 9;
}
prev_direction = directions[ind];
prev_position = defender_position;
return directions[ind];
}
/*----------------------------------------------------------------------------*/
| 29.385965
| 96
| 0.580896
|
dbf2ae31b51cc6ffcfe941bdf73d220ab97ae7f0
| 51,675
|
c
|
C
|
testsuite/EXP_1/test749.c
|
ishiura-compiler/CF3
|
0718aa176d0303a4ea8a46bd6c794997cbb8fabb
|
[
"MIT"
] | 34
|
2017-07-04T14:16:12.000Z
|
2021-04-22T21:04:43.000Z
|
testsuite/EXP_1/test749.c
|
ishiura-compiler/CF3
|
0718aa176d0303a4ea8a46bd6c794997cbb8fabb
|
[
"MIT"
] | 1
|
2017-07-06T03:43:44.000Z
|
2017-07-06T03:43:44.000Z
|
testsuite/EXP_1/test749.c
|
ishiura-compiler/CF3
|
0718aa176d0303a4ea8a46bd6c794997cbb8fabb
|
[
"MIT"
] | 6
|
2017-07-04T16:30:42.000Z
|
2019-10-16T05:37:29.000Z
|
/*
CF3
Copyright (c) 2015 ishiura-lab.
Released under the MIT license.
https://github.com/ishiura-compiler/CF3/MIT-LICENSE.md
*/
#include<stdio.h>
#include<stdint.h>
#include<stdlib.h>
#include"test1.h"
int64_t x6 = INT64_MIN;
int8_t x10 = 1;
int8_t x11 = -1;
volatile int32_t t5 = -263191;
uint16_t x26 = UINT16_MAX;
volatile uint64_t x27 = 483374082879262LLU;
static int32_t x30 = -1008528369;
volatile int8_t x33 = -1;
volatile int16_t x39 = 9573;
volatile uint16_t x42 = 225U;
uint32_t x43 = 988U;
static int32_t t10 = -492;
static int8_t x52 = 39;
uint64_t x58 = 1794391969670LLU;
int16_t x59 = INT16_MAX;
volatile int16_t x75 = INT16_MAX;
int16_t x77 = INT16_MIN;
int32_t t18 = 59;
static int16_t x85 = -20;
uint8_t x88 = 56U;
volatile int32_t t20 = 32;
uint16_t x97 = UINT16_MAX;
volatile int32_t t23 = -27976;
int16_t x117 = -1;
int32_t t27 = -90168;
static volatile uint64_t x122 = UINT64_MAX;
volatile int32_t t29 = -911;
uint8_t x132 = UINT8_MAX;
static int16_t x137 = -2058;
volatile int16_t x142 = -634;
int32_t t34 = 213;
static int32_t x162 = -1;
uint8_t x165 = 97U;
int32_t t40 = -105;
static volatile int8_t x174 = INT8_MIN;
int16_t x175 = -1;
int8_t x176 = INT8_MIN;
static int32_t t41 = 378;
int32_t t42 = 1;
uint32_t x193 = UINT32_MAX;
static uint8_t x196 = UINT8_MAX;
int32_t x200 = 610;
int8_t x205 = 4;
static volatile uint8_t x220 = 10U;
volatile uint64_t x229 = UINT64_MAX;
int8_t x230 = INT8_MAX;
volatile int8_t x246 = INT8_MIN;
int32_t x248 = INT32_MIN;
int32_t x253 = -1;
uint64_t x255 = UINT64_MAX;
static int32_t t60 = -5467;
int8_t x264 = INT8_MIN;
volatile int8_t x273 = -1;
int32_t t64 = 54544273;
uint16_t x279 = UINT16_MAX;
volatile uint16_t x281 = 1479U;
volatile uint32_t x284 = UINT32_MAX;
static uint32_t x291 = UINT32_MAX;
int32_t x293 = INT32_MIN;
static int32_t x301 = 231266852;
int8_t x304 = -1;
int32_t t71 = 167;
int8_t x312 = -20;
volatile int16_t x321 = INT16_MIN;
volatile int16_t x330 = 3;
int32_t t75 = -172816;
int32_t x335 = -23539;
volatile uint8_t x336 = 126U;
volatile int64_t x342 = 2023469439LL;
uint16_t x343 = UINT16_MAX;
volatile int8_t x356 = INT8_MIN;
volatile int32_t t81 = -421170;
int16_t x358 = INT16_MAX;
volatile int32_t t82 = 20536;
uint32_t x364 = 226U;
volatile uint16_t x368 = 1263U;
int64_t x372 = 775LL;
volatile int64_t x375 = 1337351LL;
int8_t x378 = -1;
uint32_t x379 = 3U;
volatile uint32_t x382 = UINT32_MAX;
volatile int32_t t88 = -31;
int64_t x390 = 648848991867300LL;
uint32_t x394 = 31991504U;
volatile int32_t t90 = -9;
int16_t x399 = INT16_MIN;
volatile int32_t t92 = -431;
uint8_t x406 = 62U;
static volatile uint64_t x407 = UINT64_MAX;
volatile uint8_t x410 = 29U;
static int16_t x413 = 57;
int16_t x416 = -1;
int16_t x419 = INT16_MAX;
volatile int32_t t96 = 1;
int16_t x428 = INT16_MAX;
int32_t t98 = -6691181;
int64_t x429 = 43710023LL;
static int32_t x433 = INT32_MAX;
int16_t x451 = INT16_MIN;
volatile int32_t t105 = -23;
static uint64_t x472 = 53351LLU;
volatile int64_t x477 = INT64_MIN;
volatile uint32_t x481 = UINT32_MAX;
int8_t x482 = 2;
volatile int8_t x486 = -1;
volatile int32_t t113 = -977581;
uint16_t x489 = 24U;
volatile int32_t x490 = -1;
volatile uint8_t x491 = 25U;
static volatile int64_t x493 = INT64_MAX;
uint64_t x496 = 163273656672090LLU;
int32_t t116 = -1305;
uint32_t x503 = 25575507U;
static int32_t t119 = -9292224;
volatile int8_t x518 = 30;
volatile int32_t t121 = -206910;
static uint8_t x522 = 48U;
uint32_t x527 = 1608U;
volatile int32_t t124 = -34;
int8_t x535 = INT8_MAX;
uint64_t x540 = 186LLU;
uint32_t x542 = 1580U;
static uint16_t x545 = 3U;
uint64_t x546 = 45716119090511LLU;
int16_t x557 = -1;
int8_t x569 = INT8_MAX;
static int64_t x571 = INT64_MIN;
volatile int32_t t134 = -204698235;
int32_t t135 = -88;
int8_t x581 = INT8_MIN;
static int8_t x583 = INT8_MIN;
int8_t x584 = -15;
static int32_t x593 = -1;
volatile uint32_t x596 = 782767U;
volatile int8_t x602 = INT8_MAX;
int32_t t142 = -2;
volatile int8_t x611 = INT8_MIN;
uint8_t x616 = 31U;
static volatile int8_t x622 = -10;
volatile int32_t t146 = 1705828;
uint32_t x634 = 93U;
volatile int32_t t149 = -18;
volatile int32_t x647 = INT32_MAX;
int32_t t152 = 27267323;
int64_t x655 = -1LL;
int8_t x656 = INT8_MAX;
uint64_t x669 = 48534601661994LLU;
int64_t x670 = -225577LL;
volatile int32_t x671 = INT32_MIN;
volatile uint32_t x688 = 8U;
int32_t t163 = 34696308;
static uint32_t x699 = 44199788U;
uint8_t x713 = 5U;
int16_t x714 = INT16_MAX;
volatile int64_t x719 = -1LL;
int8_t x724 = -43;
volatile int32_t t171 = 7399606;
int32_t t172 = -2938144;
int8_t x730 = 32;
static volatile int32_t x731 = -106;
int64_t x732 = -1360571448776LL;
volatile uint32_t x738 = 6U;
int32_t x739 = INT32_MIN;
volatile int32_t t175 = 2173396;
int8_t x745 = -1;
uint16_t x748 = 8773U;
int32_t t177 = -55813;
uint16_t x749 = 0U;
uint32_t x752 = UINT32_MAX;
static uint32_t x757 = UINT32_MAX;
uint8_t x758 = 40U;
int32_t t180 = -17;
volatile int32_t t182 = 36;
static int32_t x771 = 2799921;
static uint32_t x775 = 659U;
int16_t x779 = INT16_MIN;
volatile uint16_t x780 = 7008U;
static volatile int32_t t185 = -2445;
int32_t x792 = -1;
volatile int32_t t188 = -195301260;
volatile int32_t x824 = INT32_MIN;
int32_t x832 = INT32_MIN;
int32_t t195 = 61385;
uint8_t x833 = UINT8_MAX;
int32_t t197 = 14851;
int32_t x842 = INT32_MAX;
uint16_t x847 = 174U;
void f0(void) {
int64_t x1 = INT64_MAX;
static int16_t x2 = INT16_MIN;
int8_t x3 = 62;
static int8_t x4 = INT8_MIN;
volatile int32_t t0 = 224;
t0 = (((x1/x2)&x3)!=x4);
if (t0 != 1) { NG(); } else { ; }
}
void f1(void) {
volatile uint64_t x5 = 177812344546LLU;
int16_t x7 = 29;
int16_t x8 = 12;
int32_t t1 = -10290;
t1 = (((x5/x6)&x7)!=x8);
if (t1 != 1) { NG(); } else { ; }
}
void f2(void) {
int8_t x9 = -1;
int64_t x12 = -46880683877LL;
int32_t t2 = -1194;
t2 = (((x9/x10)&x11)!=x12);
if (t2 != 1) { NG(); } else { ; }
}
void f3(void) {
int32_t x13 = 8;
int8_t x14 = -12;
volatile uint64_t x15 = 556406346877674LLU;
int64_t x16 = INT64_MIN;
int32_t t3 = 43175732;
t3 = (((x13/x14)&x15)!=x16);
if (t3 != 1) { NG(); } else { ; }
}
void f4(void) {
int64_t x17 = INT64_MIN;
int8_t x18 = INT8_MIN;
int8_t x19 = -1;
int64_t x20 = INT64_MIN;
static int32_t t4 = -2;
t4 = (((x17/x18)&x19)!=x20);
if (t4 != 1) { NG(); } else { ; }
}
void f5(void) {
int64_t x21 = INT64_MIN;
volatile int16_t x22 = INT16_MIN;
int64_t x23 = INT64_MAX;
int16_t x24 = INT16_MIN;
t5 = (((x21/x22)&x23)!=x24);
if (t5 != 1) { NG(); } else { ; }
}
void f6(void) {
int8_t x25 = -1;
static uint16_t x28 = 2844U;
int32_t t6 = 1;
t6 = (((x25/x26)&x27)!=x28);
if (t6 != 1) { NG(); } else { ; }
}
void f7(void) {
uint64_t x29 = 4LLU;
int64_t x31 = INT64_MIN;
uint16_t x32 = UINT16_MAX;
volatile int32_t t7 = 88034;
t7 = (((x29/x30)&x31)!=x32);
if (t7 != 1) { NG(); } else { ; }
}
void f8(void) {
static volatile int64_t x34 = INT64_MIN;
static volatile int32_t x35 = -7603759;
uint32_t x36 = 21U;
int32_t t8 = 21;
t8 = (((x33/x34)&x35)!=x36);
if (t8 != 1) { NG(); } else { ; }
}
void f9(void) {
volatile int64_t x37 = INT64_MAX;
volatile int8_t x38 = -1;
int32_t x40 = INT32_MIN;
volatile int32_t t9 = 0;
t9 = (((x37/x38)&x39)!=x40);
if (t9 != 1) { NG(); } else { ; }
}
void f10(void) {
int32_t x41 = INT32_MAX;
int16_t x44 = -55;
t10 = (((x41/x42)&x43)!=x44);
if (t10 != 1) { NG(); } else { ; }
}
void f11(void) {
static int64_t x45 = INT64_MAX;
static uint64_t x46 = UINT64_MAX;
int16_t x47 = -1;
int32_t x48 = INT32_MIN;
volatile int32_t t11 = 0;
t11 = (((x45/x46)&x47)!=x48);
if (t11 != 1) { NG(); } else { ; }
}
void f12(void) {
int64_t x49 = -1LL;
int64_t x50 = INT64_MIN;
static volatile int16_t x51 = 1;
int32_t t12 = 149795;
t12 = (((x49/x50)&x51)!=x52);
if (t12 != 1) { NG(); } else { ; }
}
void f13(void) {
int8_t x53 = INT8_MIN;
static int8_t x54 = -25;
static uint16_t x55 = UINT16_MAX;
uint16_t x56 = 48U;
int32_t t13 = -25;
t13 = (((x53/x54)&x55)!=x56);
if (t13 != 1) { NG(); } else { ; }
}
void f14(void) {
uint64_t x57 = 202431LLU;
volatile int32_t x60 = 186;
volatile int32_t t14 = -20158;
t14 = (((x57/x58)&x59)!=x60);
if (t14 != 1) { NG(); } else { ; }
}
void f15(void) {
static volatile int64_t x65 = -1LL;
int64_t x66 = 461463347132128LL;
int64_t x67 = -1LL;
volatile uint64_t x68 = 7904LLU;
static volatile int32_t t15 = 1161608;
t15 = (((x65/x66)&x67)!=x68);
if (t15 != 1) { NG(); } else { ; }
}
void f16(void) {
static uint32_t x69 = 126275U;
uint32_t x70 = 2210U;
int32_t x71 = -1;
uint32_t x72 = 99U;
volatile int32_t t16 = 8103;
t16 = (((x69/x70)&x71)!=x72);
if (t16 != 1) { NG(); } else { ; }
}
void f17(void) {
uint16_t x73 = UINT16_MAX;
int8_t x74 = -55;
uint64_t x76 = 287588LLU;
static int32_t t17 = -61225889;
t17 = (((x73/x74)&x75)!=x76);
if (t17 != 1) { NG(); } else { ; }
}
void f18(void) {
int16_t x78 = -483;
static int64_t x79 = INT64_MIN;
volatile int16_t x80 = -850;
t18 = (((x77/x78)&x79)!=x80);
if (t18 != 1) { NG(); } else { ; }
}
void f19(void) {
volatile int16_t x81 = INT16_MIN;
volatile int32_t x82 = INT32_MAX;
static volatile uint8_t x83 = UINT8_MAX;
volatile uint64_t x84 = UINT64_MAX;
volatile int32_t t19 = 3;
t19 = (((x81/x82)&x83)!=x84);
if (t19 != 1) { NG(); } else { ; }
}
void f20(void) {
static int16_t x86 = INT16_MAX;
uint8_t x87 = UINT8_MAX;
t20 = (((x85/x86)&x87)!=x88);
if (t20 != 1) { NG(); } else { ; }
}
void f21(void) {
int8_t x89 = INT8_MAX;
int64_t x90 = -21005893LL;
int8_t x91 = -12;
static volatile int64_t x92 = INT64_MAX;
static volatile int32_t t21 = -6626120;
t21 = (((x89/x90)&x91)!=x92);
if (t21 != 1) { NG(); } else { ; }
}
void f22(void) {
volatile int64_t x93 = INT64_MAX;
volatile int64_t x94 = -25617790LL;
int16_t x95 = INT16_MIN;
int64_t x96 = 5231LL;
int32_t t22 = 61608;
t22 = (((x93/x94)&x95)!=x96);
if (t22 != 1) { NG(); } else { ; }
}
void f23(void) {
int16_t x98 = INT16_MIN;
int16_t x99 = -1;
volatile int16_t x100 = INT16_MIN;
t23 = (((x97/x98)&x99)!=x100);
if (t23 != 1) { NG(); } else { ; }
}
void f24(void) {
int32_t x101 = INT32_MAX;
static uint64_t x102 = 257575434861LLU;
int16_t x103 = -173;
int64_t x104 = INT64_MIN;
int32_t t24 = 268;
t24 = (((x101/x102)&x103)!=x104);
if (t24 != 1) { NG(); } else { ; }
}
void f25(void) {
int8_t x105 = 1;
volatile uint64_t x106 = UINT64_MAX;
uint64_t x107 = UINT64_MAX;
int16_t x108 = INT16_MIN;
static volatile int32_t t25 = 702019;
t25 = (((x105/x106)&x107)!=x108);
if (t25 != 1) { NG(); } else { ; }
}
void f26(void) {
uint32_t x113 = 10U;
uint32_t x114 = 6U;
int16_t x115 = INT16_MAX;
int64_t x116 = INT64_MAX;
int32_t t26 = 5585;
t26 = (((x113/x114)&x115)!=x116);
if (t26 != 1) { NG(); } else { ; }
}
void f27(void) {
int16_t x118 = -84;
int8_t x119 = INT8_MIN;
uint8_t x120 = 11U;
t27 = (((x117/x118)&x119)!=x120);
if (t27 != 1) { NG(); } else { ; }
}
void f28(void) {
uint64_t x121 = 444427237076455LLU;
uint16_t x123 = 1U;
int64_t x124 = -1LL;
volatile int32_t t28 = -1;
t28 = (((x121/x122)&x123)!=x124);
if (t28 != 1) { NG(); } else { ; }
}
void f29(void) {
static volatile uint16_t x125 = 7U;
int64_t x126 = 22001286271532LL;
volatile int16_t x127 = 0;
int32_t x128 = 2;
t29 = (((x125/x126)&x127)!=x128);
if (t29 != 1) { NG(); } else { ; }
}
void f30(void) {
volatile int16_t x129 = 205;
static uint64_t x130 = UINT64_MAX;
uint8_t x131 = UINT8_MAX;
static volatile int32_t t30 = 12229267;
t30 = (((x129/x130)&x131)!=x132);
if (t30 != 1) { NG(); } else { ; }
}
void f31(void) {
int64_t x133 = -1LL;
uint32_t x134 = UINT32_MAX;
int32_t x135 = 11157;
int8_t x136 = INT8_MIN;
volatile int32_t t31 = 19038784;
t31 = (((x133/x134)&x135)!=x136);
if (t31 != 1) { NG(); } else { ; }
}
void f32(void) {
volatile int32_t x138 = INT32_MIN;
volatile uint64_t x139 = 15941973566055LLU;
uint32_t x140 = UINT32_MAX;
static int32_t t32 = -963727;
t32 = (((x137/x138)&x139)!=x140);
if (t32 != 1) { NG(); } else { ; }
}
void f33(void) {
volatile int16_t x141 = -1;
static uint32_t x143 = UINT32_MAX;
int32_t x144 = INT32_MIN;
volatile int32_t t33 = 62463;
t33 = (((x141/x142)&x143)!=x144);
if (t33 != 1) { NG(); } else { ; }
}
void f34(void) {
uint64_t x145 = 4612LLU;
uint32_t x146 = 45U;
static volatile int16_t x147 = 9906;
int64_t x148 = INT64_MIN;
t34 = (((x145/x146)&x147)!=x148);
if (t34 != 1) { NG(); } else { ; }
}
void f35(void) {
uint64_t x149 = 534LLU;
int32_t x150 = -1;
int64_t x151 = -1LL;
volatile uint8_t x152 = 12U;
static volatile int32_t t35 = -5;
t35 = (((x149/x150)&x151)!=x152);
if (t35 != 1) { NG(); } else { ; }
}
void f36(void) {
int64_t x153 = INT64_MIN;
int32_t x154 = -93;
uint64_t x155 = 12297469952312LLU;
int32_t x156 = INT32_MIN;
static int32_t t36 = 28129868;
t36 = (((x153/x154)&x155)!=x156);
if (t36 != 1) { NG(); } else { ; }
}
void f37(void) {
static int32_t x157 = 470;
volatile int64_t x158 = INT64_MIN;
int8_t x159 = INT8_MIN;
uint8_t x160 = 2U;
static volatile int32_t t37 = -22;
t37 = (((x157/x158)&x159)!=x160);
if (t37 != 1) { NG(); } else { ; }
}
void f38(void) {
uint16_t x161 = 11357U;
uint32_t x163 = UINT32_MAX;
int64_t x164 = INT64_MIN;
int32_t t38 = 7432;
t38 = (((x161/x162)&x163)!=x164);
if (t38 != 1) { NG(); } else { ; }
}
void f39(void) {
uint16_t x166 = UINT16_MAX;
uint8_t x167 = 26U;
int8_t x168 = INT8_MIN;
static volatile int32_t t39 = 16;
t39 = (((x165/x166)&x167)!=x168);
if (t39 != 1) { NG(); } else { ; }
}
void f40(void) {
uint64_t x169 = 492LLU;
int32_t x170 = INT32_MIN;
volatile int64_t x171 = -1LL;
static uint8_t x172 = UINT8_MAX;
t40 = (((x169/x170)&x171)!=x172);
if (t40 != 1) { NG(); } else { ; }
}
void f41(void) {
uint16_t x173 = 805U;
t41 = (((x173/x174)&x175)!=x176);
if (t41 != 1) { NG(); } else { ; }
}
void f42(void) {
uint64_t x177 = UINT64_MAX;
int8_t x178 = -1;
int64_t x179 = INT64_MIN;
int32_t x180 = INT32_MAX;
t42 = (((x177/x178)&x179)!=x180);
if (t42 != 1) { NG(); } else { ; }
}
void f43(void) {
volatile int64_t x181 = INT64_MIN;
int16_t x182 = INT16_MAX;
int32_t x183 = INT32_MIN;
uint8_t x184 = 3U;
int32_t t43 = -39;
t43 = (((x181/x182)&x183)!=x184);
if (t43 != 1) { NG(); } else { ; }
}
void f44(void) {
static int16_t x185 = 92;
uint32_t x186 = UINT32_MAX;
static volatile uint8_t x187 = UINT8_MAX;
volatile uint8_t x188 = 0U;
static int32_t t44 = -179075;
t44 = (((x185/x186)&x187)!=x188);
if (t44 != 0) { NG(); } else { ; }
}
void f45(void) {
int16_t x189 = -1;
static uint32_t x190 = 14643455U;
int16_t x191 = INT16_MAX;
static int32_t x192 = INT32_MIN;
int32_t t45 = 637691086;
t45 = (((x189/x190)&x191)!=x192);
if (t45 != 1) { NG(); } else { ; }
}
void f46(void) {
static uint32_t x194 = 1U;
uint32_t x195 = UINT32_MAX;
volatile int32_t t46 = -656;
t46 = (((x193/x194)&x195)!=x196);
if (t46 != 1) { NG(); } else { ; }
}
void f47(void) {
uint32_t x197 = 3354846U;
static int16_t x198 = -1;
volatile uint16_t x199 = UINT16_MAX;
int32_t t47 = -28166287;
t47 = (((x197/x198)&x199)!=x200);
if (t47 != 1) { NG(); } else { ; }
}
void f48(void) {
uint16_t x201 = 215U;
volatile uint16_t x202 = 25U;
int32_t x203 = INT32_MIN;
int64_t x204 = INT64_MIN;
volatile int32_t t48 = -12;
t48 = (((x201/x202)&x203)!=x204);
if (t48 != 1) { NG(); } else { ; }
}
void f49(void) {
volatile uint16_t x206 = UINT16_MAX;
static volatile int16_t x207 = INT16_MAX;
static volatile int16_t x208 = INT16_MIN;
volatile int32_t t49 = -348198935;
t49 = (((x205/x206)&x207)!=x208);
if (t49 != 1) { NG(); } else { ; }
}
void f50(void) {
uint16_t x209 = UINT16_MAX;
int64_t x210 = 88897806320126279LL;
int32_t x211 = INT32_MIN;
volatile uint8_t x212 = 54U;
volatile int32_t t50 = 126069;
t50 = (((x209/x210)&x211)!=x212);
if (t50 != 1) { NG(); } else { ; }
}
void f51(void) {
static uint8_t x213 = UINT8_MAX;
static int8_t x214 = INT8_MAX;
int16_t x215 = INT16_MAX;
volatile int8_t x216 = INT8_MIN;
volatile int32_t t51 = -31279;
t51 = (((x213/x214)&x215)!=x216);
if (t51 != 1) { NG(); } else { ; }
}
void f52(void) {
int32_t x217 = -6093;
int32_t x218 = INT32_MIN;
volatile int32_t x219 = INT32_MIN;
int32_t t52 = 6428;
t52 = (((x217/x218)&x219)!=x220);
if (t52 != 1) { NG(); } else { ; }
}
void f53(void) {
int32_t x225 = INT32_MAX;
uint16_t x226 = UINT16_MAX;
volatile int16_t x227 = -1;
uint64_t x228 = UINT64_MAX;
static volatile int32_t t53 = -23176819;
t53 = (((x225/x226)&x227)!=x228);
if (t53 != 1) { NG(); } else { ; }
}
void f54(void) {
int16_t x231 = INT16_MAX;
static int8_t x232 = INT8_MIN;
int32_t t54 = 2;
t54 = (((x229/x230)&x231)!=x232);
if (t54 != 1) { NG(); } else { ; }
}
void f55(void) {
int64_t x233 = -13142231LL;
int32_t x234 = INT32_MIN;
int32_t x235 = -1;
int8_t x236 = -1;
static volatile int32_t t55 = 9141;
t55 = (((x233/x234)&x235)!=x236);
if (t55 != 1) { NG(); } else { ; }
}
void f56(void) {
uint64_t x237 = 7649LLU;
volatile int64_t x238 = -1LL;
volatile int16_t x239 = INT16_MAX;
int16_t x240 = INT16_MAX;
static volatile int32_t t56 = -34;
t56 = (((x237/x238)&x239)!=x240);
if (t56 != 1) { NG(); } else { ; }
}
void f57(void) {
static uint8_t x241 = 15U;
static uint8_t x242 = UINT8_MAX;
int64_t x243 = -1LL;
volatile int8_t x244 = -1;
int32_t t57 = -879915066;
t57 = (((x241/x242)&x243)!=x244);
if (t57 != 1) { NG(); } else { ; }
}
void f58(void) {
int64_t x245 = INT64_MIN;
uint32_t x247 = UINT32_MAX;
volatile int32_t t58 = 1453428;
t58 = (((x245/x246)&x247)!=x248);
if (t58 != 1) { NG(); } else { ; }
}
void f59(void) {
volatile uint16_t x249 = 0U;
static uint16_t x250 = 90U;
static uint16_t x251 = 716U;
int16_t x252 = -4;
int32_t t59 = -283503912;
t59 = (((x249/x250)&x251)!=x252);
if (t59 != 1) { NG(); } else { ; }
}
void f60(void) {
int32_t x254 = -1;
int8_t x256 = 13;
t60 = (((x253/x254)&x255)!=x256);
if (t60 != 1) { NG(); } else { ; }
}
void f61(void) {
static int16_t x261 = -13;
int16_t x262 = INT16_MAX;
int8_t x263 = -1;
volatile int32_t t61 = -21;
t61 = (((x261/x262)&x263)!=x264);
if (t61 != 1) { NG(); } else { ; }
}
void f62(void) {
volatile uint32_t x265 = UINT32_MAX;
int16_t x266 = -1;
int32_t x267 = -8;
int32_t x268 = -1;
static volatile int32_t t62 = 15066601;
t62 = (((x265/x266)&x267)!=x268);
if (t62 != 1) { NG(); } else { ; }
}
void f63(void) {
static uint32_t x269 = UINT32_MAX;
int16_t x270 = INT16_MAX;
uint64_t x271 = 225LLU;
int16_t x272 = -5402;
volatile int32_t t63 = 230269757;
t63 = (((x269/x270)&x271)!=x272);
if (t63 != 1) { NG(); } else { ; }
}
void f64(void) {
volatile uint32_t x274 = 5U;
uint64_t x275 = UINT64_MAX;
uint16_t x276 = 9U;
t64 = (((x273/x274)&x275)!=x276);
if (t64 != 1) { NG(); } else { ; }
}
void f65(void) {
int64_t x277 = 7LL;
int64_t x278 = -14509238LL;
int32_t x280 = 3960928;
int32_t t65 = -725196618;
t65 = (((x277/x278)&x279)!=x280);
if (t65 != 1) { NG(); } else { ; }
}
void f66(void) {
static int16_t x282 = -1;
int16_t x283 = INT16_MAX;
static volatile int32_t t66 = 878604372;
t66 = (((x281/x282)&x283)!=x284);
if (t66 != 1) { NG(); } else { ; }
}
void f67(void) {
int16_t x285 = INT16_MAX;
volatile int16_t x286 = -1;
volatile uint32_t x287 = 0U;
uint16_t x288 = 30U;
int32_t t67 = -52604109;
t67 = (((x285/x286)&x287)!=x288);
if (t67 != 1) { NG(); } else { ; }
}
void f68(void) {
int8_t x289 = -1;
int16_t x290 = INT16_MAX;
int32_t x292 = -1;
int32_t t68 = -111247;
t68 = (((x289/x290)&x291)!=x292);
if (t68 != 1) { NG(); } else { ; }
}
void f69(void) {
uint16_t x294 = UINT16_MAX;
int64_t x295 = 82LL;
int8_t x296 = INT8_MIN;
volatile int32_t t69 = -100487654;
t69 = (((x293/x294)&x295)!=x296);
if (t69 != 1) { NG(); } else { ; }
}
void f70(void) {
int64_t x302 = INT64_MIN;
volatile uint8_t x303 = 4U;
int32_t t70 = 19;
t70 = (((x301/x302)&x303)!=x304);
if (t70 != 1) { NG(); } else { ; }
}
void f71(void) {
uint32_t x305 = 448684867U;
int64_t x306 = INT64_MIN;
int16_t x307 = INT16_MIN;
int32_t x308 = -40511;
t71 = (((x305/x306)&x307)!=x308);
if (t71 != 1) { NG(); } else { ; }
}
void f72(void) {
int64_t x309 = 14479909099LL;
static int16_t x310 = -1;
int8_t x311 = INT8_MAX;
volatile int32_t t72 = 1;
t72 = (((x309/x310)&x311)!=x312);
if (t72 != 1) { NG(); } else { ; }
}
void f73(void) {
uint64_t x317 = UINT64_MAX;
int32_t x318 = INT32_MIN;
int64_t x319 = INT64_MIN;
int32_t x320 = INT32_MIN;
int32_t t73 = 144816;
t73 = (((x317/x318)&x319)!=x320);
if (t73 != 1) { NG(); } else { ; }
}
void f74(void) {
static volatile int64_t x322 = -1LL;
int32_t x323 = -700964;
volatile int32_t x324 = 104403687;
int32_t t74 = -500;
t74 = (((x321/x322)&x323)!=x324);
if (t74 != 1) { NG(); } else { ; }
}
void f75(void) {
volatile int8_t x329 = INT8_MIN;
int64_t x331 = 798860LL;
static volatile uint32_t x332 = 1U;
t75 = (((x329/x330)&x331)!=x332);
if (t75 != 1) { NG(); } else { ; }
}
void f76(void) {
volatile int64_t x333 = INT64_MAX;
uint8_t x334 = UINT8_MAX;
volatile int32_t t76 = -27571821;
t76 = (((x333/x334)&x335)!=x336);
if (t76 != 1) { NG(); } else { ; }
}
void f77(void) {
int8_t x337 = -1;
int64_t x338 = INT64_MIN;
static uint16_t x339 = UINT16_MAX;
static uint16_t x340 = 4084U;
int32_t t77 = -383596146;
t77 = (((x337/x338)&x339)!=x340);
if (t77 != 1) { NG(); } else { ; }
}
void f78(void) {
int64_t x341 = -1LL;
static uint16_t x344 = 1815U;
volatile int32_t t78 = -63760606;
t78 = (((x341/x342)&x343)!=x344);
if (t78 != 1) { NG(); } else { ; }
}
void f79(void) {
int16_t x345 = INT16_MAX;
int16_t x346 = -1018;
int64_t x347 = 1356265LL;
int16_t x348 = INT16_MIN;
int32_t t79 = -150;
t79 = (((x345/x346)&x347)!=x348);
if (t79 != 1) { NG(); } else { ; }
}
void f80(void) {
int8_t x349 = INT8_MIN;
volatile uint32_t x350 = UINT32_MAX;
volatile int32_t x351 = INT32_MIN;
int8_t x352 = INT8_MAX;
volatile int32_t t80 = 319396;
t80 = (((x349/x350)&x351)!=x352);
if (t80 != 1) { NG(); } else { ; }
}
void f81(void) {
int8_t x353 = INT8_MIN;
uint8_t x354 = 37U;
int8_t x355 = -11;
t81 = (((x353/x354)&x355)!=x356);
if (t81 != 1) { NG(); } else { ; }
}
void f82(void) {
volatile int8_t x357 = INT8_MIN;
int8_t x359 = 1;
static uint16_t x360 = UINT16_MAX;
t82 = (((x357/x358)&x359)!=x360);
if (t82 != 1) { NG(); } else { ; }
}
void f83(void) {
int8_t x361 = -1;
int32_t x362 = INT32_MAX;
int16_t x363 = INT16_MIN;
volatile int32_t t83 = -19138;
t83 = (((x361/x362)&x363)!=x364);
if (t83 != 1) { NG(); } else { ; }
}
void f84(void) {
uint8_t x365 = 10U;
int64_t x366 = -1LL;
uint64_t x367 = UINT64_MAX;
int32_t t84 = -7;
t84 = (((x365/x366)&x367)!=x368);
if (t84 != 1) { NG(); } else { ; }
}
void f85(void) {
static volatile int16_t x369 = 2449;
int8_t x370 = INT8_MIN;
int8_t x371 = INT8_MIN;
int32_t t85 = 57;
t85 = (((x369/x370)&x371)!=x372);
if (t85 != 1) { NG(); } else { ; }
}
void f86(void) {
static uint16_t x373 = 1006U;
int8_t x374 = INT8_MIN;
uint64_t x376 = 3242LLU;
int32_t t86 = 1;
t86 = (((x373/x374)&x375)!=x376);
if (t86 != 1) { NG(); } else { ; }
}
void f87(void) {
int64_t x377 = INT64_MAX;
uint32_t x380 = 0U;
static int32_t t87 = 548776;
t87 = (((x377/x378)&x379)!=x380);
if (t87 != 1) { NG(); } else { ; }
}
void f88(void) {
volatile int8_t x381 = INT8_MIN;
volatile int8_t x383 = 0;
static int32_t x384 = 1008485572;
t88 = (((x381/x382)&x383)!=x384);
if (t88 != 1) { NG(); } else { ; }
}
void f89(void) {
uint16_t x389 = 4U;
uint64_t x391 = 34669157LLU;
static int64_t x392 = -1LL;
int32_t t89 = 7629006;
t89 = (((x389/x390)&x391)!=x392);
if (t89 != 1) { NG(); } else { ; }
}
void f90(void) {
int16_t x393 = INT16_MAX;
uint64_t x395 = UINT64_MAX;
int64_t x396 = -103510LL;
t90 = (((x393/x394)&x395)!=x396);
if (t90 != 1) { NG(); } else { ; }
}
void f91(void) {
static int32_t x397 = INT32_MIN;
int8_t x398 = INT8_MIN;
int32_t x400 = -2;
volatile int32_t t91 = 26966298;
t91 = (((x397/x398)&x399)!=x400);
if (t91 != 1) { NG(); } else { ; }
}
void f92(void) {
int64_t x401 = INT64_MIN;
volatile int16_t x402 = INT16_MIN;
int16_t x403 = -1;
static uint16_t x404 = UINT16_MAX;
t92 = (((x401/x402)&x403)!=x404);
if (t92 != 1) { NG(); } else { ; }
}
void f93(void) {
uint8_t x405 = 43U;
uint8_t x408 = 0U;
int32_t t93 = 196;
t93 = (((x405/x406)&x407)!=x408);
if (t93 != 0) { NG(); } else { ; }
}
void f94(void) {
int64_t x409 = -1LL;
volatile int8_t x411 = -6;
int32_t x412 = -3;
int32_t t94 = 0;
t94 = (((x409/x410)&x411)!=x412);
if (t94 != 1) { NG(); } else { ; }
}
void f95(void) {
int16_t x414 = -20;
static volatile int32_t x415 = INT32_MIN;
static int32_t t95 = 7872374;
t95 = (((x413/x414)&x415)!=x416);
if (t95 != 1) { NG(); } else { ; }
}
void f96(void) {
int8_t x417 = -1;
int32_t x418 = -1;
int32_t x420 = -987833394;
t96 = (((x417/x418)&x419)!=x420);
if (t96 != 1) { NG(); } else { ; }
}
void f97(void) {
int8_t x421 = INT8_MAX;
int16_t x422 = INT16_MAX;
uint64_t x423 = UINT64_MAX;
int8_t x424 = INT8_MIN;
volatile int32_t t97 = 3945;
t97 = (((x421/x422)&x423)!=x424);
if (t97 != 1) { NG(); } else { ; }
}
void f98(void) {
static uint64_t x425 = 496673136624819754LLU;
int64_t x426 = -4881266LL;
int64_t x427 = -58838137326543LL;
t98 = (((x425/x426)&x427)!=x428);
if (t98 != 1) { NG(); } else { ; }
}
void f99(void) {
volatile int64_t x430 = INT64_MAX;
int64_t x431 = INT64_MAX;
static volatile int16_t x432 = 76;
volatile int32_t t99 = 2231;
t99 = (((x429/x430)&x431)!=x432);
if (t99 != 1) { NG(); } else { ; }
}
void f100(void) {
static int64_t x434 = INT64_MIN;
volatile int32_t x435 = -1;
int32_t x436 = INT32_MAX;
int32_t t100 = 0;
t100 = (((x433/x434)&x435)!=x436);
if (t100 != 1) { NG(); } else { ; }
}
void f101(void) {
int32_t x437 = INT32_MAX;
static uint8_t x438 = 13U;
volatile int32_t x439 = INT32_MAX;
volatile int32_t x440 = -2326824;
static volatile int32_t t101 = 12;
t101 = (((x437/x438)&x439)!=x440);
if (t101 != 1) { NG(); } else { ; }
}
void f102(void) {
volatile int16_t x441 = INT16_MIN;
volatile int8_t x442 = 1;
uint8_t x443 = UINT8_MAX;
int16_t x444 = INT16_MAX;
int32_t t102 = -935;
t102 = (((x441/x442)&x443)!=x444);
if (t102 != 1) { NG(); } else { ; }
}
void f103(void) {
volatile uint32_t x445 = 6U;
uint32_t x446 = 1230020U;
volatile int8_t x447 = 1;
static uint32_t x448 = UINT32_MAX;
int32_t t103 = -1160;
t103 = (((x445/x446)&x447)!=x448);
if (t103 != 1) { NG(); } else { ; }
}
void f104(void) {
volatile uint32_t x449 = UINT32_MAX;
int8_t x450 = INT8_MIN;
static int64_t x452 = -1LL;
volatile int32_t t104 = 0;
t104 = (((x449/x450)&x451)!=x452);
if (t104 != 1) { NG(); } else { ; }
}
void f105(void) {
uint16_t x453 = 287U;
uint32_t x454 = 742825U;
int32_t x455 = -1;
static int8_t x456 = INT8_MIN;
t105 = (((x453/x454)&x455)!=x456);
if (t105 != 1) { NG(); } else { ; }
}
void f106(void) {
int8_t x457 = INT8_MAX;
uint64_t x458 = UINT64_MAX;
int32_t x459 = -1;
int64_t x460 = INT64_MAX;
volatile int32_t t106 = 79;
t106 = (((x457/x458)&x459)!=x460);
if (t106 != 1) { NG(); } else { ; }
}
void f107(void) {
int16_t x461 = INT16_MIN;
static int8_t x462 = 3;
static uint16_t x463 = 261U;
int16_t x464 = INT16_MIN;
volatile int32_t t107 = -1;
t107 = (((x461/x462)&x463)!=x464);
if (t107 != 1) { NG(); } else { ; }
}
void f108(void) {
static int64_t x465 = INT64_MAX;
uint64_t x466 = 914470704LLU;
volatile uint32_t x467 = UINT32_MAX;
int8_t x468 = INT8_MAX;
int32_t t108 = -7;
t108 = (((x465/x466)&x467)!=x468);
if (t108 != 1) { NG(); } else { ; }
}
void f109(void) {
static uint8_t x469 = UINT8_MAX;
int64_t x470 = INT64_MIN;
static int32_t x471 = INT32_MIN;
int32_t t109 = 926127621;
t109 = (((x469/x470)&x471)!=x472);
if (t109 != 1) { NG(); } else { ; }
}
void f110(void) {
int32_t x473 = INT32_MIN;
uint8_t x474 = UINT8_MAX;
uint16_t x475 = 92U;
int16_t x476 = INT16_MAX;
static int32_t t110 = -1;
t110 = (((x473/x474)&x475)!=x476);
if (t110 != 1) { NG(); } else { ; }
}
void f111(void) {
int64_t x478 = INT64_MIN;
uint64_t x479 = 7201228913356LLU;
uint64_t x480 = UINT64_MAX;
volatile int32_t t111 = -66722;
t111 = (((x477/x478)&x479)!=x480);
if (t111 != 1) { NG(); } else { ; }
}
void f112(void) {
static uint16_t x483 = UINT16_MAX;
uint64_t x484 = 13889LLU;
volatile int32_t t112 = -836;
t112 = (((x481/x482)&x483)!=x484);
if (t112 != 1) { NG(); } else { ; }
}
void f113(void) {
uint32_t x485 = 610213U;
uint32_t x487 = 4022U;
static int32_t x488 = INT32_MIN;
t113 = (((x485/x486)&x487)!=x488);
if (t113 != 1) { NG(); } else { ; }
}
void f114(void) {
int64_t x492 = INT64_MIN;
int32_t t114 = -1991301;
t114 = (((x489/x490)&x491)!=x492);
if (t114 != 1) { NG(); } else { ; }
}
void f115(void) {
int8_t x494 = -13;
uint64_t x495 = 858154913967LLU;
int32_t t115 = -1;
t115 = (((x493/x494)&x495)!=x496);
if (t115 != 1) { NG(); } else { ; }
}
void f116(void) {
uint64_t x497 = 747025328092LLU;
int16_t x498 = INT16_MIN;
int32_t x499 = -223506903;
int16_t x500 = 1;
t116 = (((x497/x498)&x499)!=x500);
if (t116 != 1) { NG(); } else { ; }
}
void f117(void) {
int16_t x501 = 83;
uint32_t x502 = 2U;
int32_t x504 = INT32_MIN;
volatile int32_t t117 = -100423970;
t117 = (((x501/x502)&x503)!=x504);
if (t117 != 1) { NG(); } else { ; }
}
void f118(void) {
int8_t x505 = -1;
uint8_t x506 = 94U;
int64_t x507 = INT64_MAX;
int16_t x508 = INT16_MIN;
volatile int32_t t118 = 1;
t118 = (((x505/x506)&x507)!=x508);
if (t118 != 1) { NG(); } else { ; }
}
void f119(void) {
volatile int64_t x509 = INT64_MIN;
int32_t x510 = 11935763;
int32_t x511 = INT32_MIN;
static int64_t x512 = -1LL;
t119 = (((x509/x510)&x511)!=x512);
if (t119 != 1) { NG(); } else { ; }
}
void f120(void) {
int16_t x513 = INT16_MIN;
uint64_t x514 = 8131012853225984LLU;
static uint64_t x515 = 68569LLU;
int64_t x516 = 113549893815142143LL;
volatile int32_t t120 = 2;
t120 = (((x513/x514)&x515)!=x516);
if (t120 != 1) { NG(); } else { ; }
}
void f121(void) {
int32_t x517 = 4770;
int32_t x519 = 0;
int16_t x520 = -5299;
t121 = (((x517/x518)&x519)!=x520);
if (t121 != 1) { NG(); } else { ; }
}
void f122(void) {
int64_t x521 = 1LL;
int32_t x523 = -1;
int32_t x524 = -1;
int32_t t122 = -194;
t122 = (((x521/x522)&x523)!=x524);
if (t122 != 1) { NG(); } else { ; }
}
void f123(void) {
int8_t x525 = -1;
int8_t x526 = INT8_MIN;
static int8_t x528 = INT8_MAX;
int32_t t123 = -2743187;
t123 = (((x525/x526)&x527)!=x528);
if (t123 != 1) { NG(); } else { ; }
}
void f124(void) {
int8_t x529 = -1;
volatile uint64_t x530 = UINT64_MAX;
uint16_t x531 = 122U;
static uint32_t x532 = 6332308U;
t124 = (((x529/x530)&x531)!=x532);
if (t124 != 1) { NG(); } else { ; }
}
void f125(void) {
static int32_t x533 = INT32_MIN;
uint64_t x534 = UINT64_MAX;
volatile uint64_t x536 = 7LLU;
volatile int32_t t125 = -119044334;
t125 = (((x533/x534)&x535)!=x536);
if (t125 != 1) { NG(); } else { ; }
}
void f126(void) {
int16_t x537 = INT16_MIN;
int64_t x538 = -9871322278334LL;
static uint8_t x539 = 0U;
int32_t t126 = 880192913;
t126 = (((x537/x538)&x539)!=x540);
if (t126 != 1) { NG(); } else { ; }
}
void f127(void) {
int16_t x541 = -1;
uint8_t x543 = 18U;
int16_t x544 = -1;
volatile int32_t t127 = -1;
t127 = (((x541/x542)&x543)!=x544);
if (t127 != 1) { NG(); } else { ; }
}
void f128(void) {
uint32_t x547 = 194U;
uint64_t x548 = 409585LLU;
static volatile int32_t t128 = -327831926;
t128 = (((x545/x546)&x547)!=x548);
if (t128 != 1) { NG(); } else { ; }
}
void f129(void) {
int32_t x549 = INT32_MAX;
volatile int16_t x550 = INT16_MAX;
int64_t x551 = 40162LL;
static volatile uint8_t x552 = 2U;
volatile int32_t t129 = 0;
t129 = (((x549/x550)&x551)!=x552);
if (t129 != 0) { NG(); } else { ; }
}
void f130(void) {
int64_t x553 = INT64_MIN;
int64_t x554 = INT64_MIN;
static uint64_t x555 = 7LLU;
uint16_t x556 = 3U;
static int32_t t130 = -21;
t130 = (((x553/x554)&x555)!=x556);
if (t130 != 1) { NG(); } else { ; }
}
void f131(void) {
int64_t x558 = INT64_MAX;
uint64_t x559 = 3581312882333200LLU;
uint16_t x560 = UINT16_MAX;
int32_t t131 = -30777;
t131 = (((x557/x558)&x559)!=x560);
if (t131 != 1) { NG(); } else { ; }
}
void f132(void) {
volatile int8_t x565 = 1;
int64_t x566 = -1LL;
uint32_t x567 = 12U;
int32_t x568 = INT32_MIN;
static volatile int32_t t132 = -13732532;
t132 = (((x565/x566)&x567)!=x568);
if (t132 != 1) { NG(); } else { ; }
}
void f133(void) {
uint16_t x570 = 4489U;
uint64_t x572 = 23176LLU;
volatile int32_t t133 = -767;
t133 = (((x569/x570)&x571)!=x572);
if (t133 != 1) { NG(); } else { ; }
}
void f134(void) {
int8_t x573 = INT8_MIN;
static int64_t x574 = -141958754816LL;
int64_t x575 = -1LL;
int8_t x576 = 3;
t134 = (((x573/x574)&x575)!=x576);
if (t134 != 1) { NG(); } else { ; }
}
void f135(void) {
int16_t x577 = -1;
static uint64_t x578 = UINT64_MAX;
int32_t x579 = INT32_MAX;
volatile int16_t x580 = INT16_MIN;
t135 = (((x577/x578)&x579)!=x580);
if (t135 != 1) { NG(); } else { ; }
}
void f136(void) {
uint64_t x582 = 230920381558LLU;
static volatile int32_t t136 = 6857;
t136 = (((x581/x582)&x583)!=x584);
if (t136 != 1) { NG(); } else { ; }
}
void f137(void) {
static int64_t x585 = INT64_MAX;
volatile uint16_t x586 = UINT16_MAX;
int8_t x587 = INT8_MAX;
int32_t x588 = -1;
static int32_t t137 = 1957;
t137 = (((x585/x586)&x587)!=x588);
if (t137 != 1) { NG(); } else { ; }
}
void f138(void) {
static int64_t x589 = -1048683145629357LL;
static int8_t x590 = INT8_MIN;
uint16_t x591 = 10U;
int16_t x592 = 1;
volatile int32_t t138 = 10;
t138 = (((x589/x590)&x591)!=x592);
if (t138 != 1) { NG(); } else { ; }
}
void f139(void) {
volatile uint16_t x594 = UINT16_MAX;
int16_t x595 = 0;
int32_t t139 = -1;
t139 = (((x593/x594)&x595)!=x596);
if (t139 != 1) { NG(); } else { ; }
}
void f140(void) {
int64_t x597 = 14LL;
int32_t x598 = INT32_MIN;
volatile int64_t x599 = INT64_MIN;
uint8_t x600 = UINT8_MAX;
volatile int32_t t140 = 1;
t140 = (((x597/x598)&x599)!=x600);
if (t140 != 1) { NG(); } else { ; }
}
void f141(void) {
uint64_t x601 = 197172460216612LLU;
uint8_t x603 = UINT8_MAX;
int32_t x604 = -1;
int32_t t141 = -46999;
t141 = (((x601/x602)&x603)!=x604);
if (t141 != 1) { NG(); } else { ; }
}
void f142(void) {
int8_t x605 = INT8_MIN;
volatile uint64_t x606 = 1031268LLU;
int64_t x607 = -4749LL;
int8_t x608 = INT8_MIN;
t142 = (((x605/x606)&x607)!=x608);
if (t142 != 1) { NG(); } else { ; }
}
void f143(void) {
static uint64_t x609 = 1467792047LLU;
volatile int32_t x610 = -1596710;
uint32_t x612 = 18U;
volatile int32_t t143 = -968;
t143 = (((x609/x610)&x611)!=x612);
if (t143 != 1) { NG(); } else { ; }
}
void f144(void) {
int64_t x613 = -5672LL;
uint64_t x614 = 2416LLU;
static int8_t x615 = 17;
volatile int32_t t144 = 27788;
t144 = (((x613/x614)&x615)!=x616);
if (t144 != 1) { NG(); } else { ; }
}
void f145(void) {
int32_t x617 = 48947056;
int64_t x618 = 1603LL;
static volatile int8_t x619 = INT8_MIN;
int8_t x620 = 7;
volatile int32_t t145 = 57203;
t145 = (((x617/x618)&x619)!=x620);
if (t145 != 1) { NG(); } else { ; }
}
void f146(void) {
int16_t x621 = -1;
volatile uint8_t x623 = UINT8_MAX;
static volatile int32_t x624 = 80794607;
t146 = (((x621/x622)&x623)!=x624);
if (t146 != 1) { NG(); } else { ; }
}
void f147(void) {
volatile int8_t x625 = 0;
int8_t x626 = 1;
static volatile uint32_t x627 = 944U;
static int16_t x628 = INT16_MIN;
int32_t t147 = -27990841;
t147 = (((x625/x626)&x627)!=x628);
if (t147 != 1) { NG(); } else { ; }
}
void f148(void) {
int16_t x629 = INT16_MIN;
int32_t x630 = -460447149;
static uint32_t x631 = 6647U;
int16_t x632 = INT16_MIN;
int32_t t148 = 26;
t148 = (((x629/x630)&x631)!=x632);
if (t148 != 1) { NG(); } else { ; }
}
void f149(void) {
uint16_t x633 = 3U;
static int16_t x635 = INT16_MAX;
volatile uint16_t x636 = 213U;
t149 = (((x633/x634)&x635)!=x636);
if (t149 != 1) { NG(); } else { ; }
}
void f150(void) {
int64_t x637 = -4320063LL;
int16_t x638 = INT16_MAX;
int64_t x639 = INT64_MIN;
volatile uint16_t x640 = 154U;
int32_t t150 = -38566;
t150 = (((x637/x638)&x639)!=x640);
if (t150 != 1) { NG(); } else { ; }
}
void f151(void) {
int8_t x641 = -1;
int16_t x642 = -1;
static int32_t x643 = -11137457;
uint64_t x644 = 17022LLU;
int32_t t151 = 88747;
t151 = (((x641/x642)&x643)!=x644);
if (t151 != 1) { NG(); } else { ; }
}
void f152(void) {
uint32_t x645 = 1023161U;
static int8_t x646 = INT8_MAX;
uint16_t x648 = UINT16_MAX;
t152 = (((x645/x646)&x647)!=x648);
if (t152 != 1) { NG(); } else { ; }
}
void f153(void) {
int64_t x649 = INT64_MIN;
static uint16_t x650 = UINT16_MAX;
uint8_t x651 = 45U;
volatile uint32_t x652 = 23U;
static volatile int32_t t153 = -977931;
t153 = (((x649/x650)&x651)!=x652);
if (t153 != 1) { NG(); } else { ; }
}
void f154(void) {
int8_t x653 = 1;
int32_t x654 = 62829311;
int32_t t154 = -1691229;
t154 = (((x653/x654)&x655)!=x656);
if (t154 != 1) { NG(); } else { ; }
}
void f155(void) {
int16_t x657 = 1346;
static uint32_t x658 = 2468U;
volatile int16_t x659 = INT16_MAX;
int8_t x660 = 1;
int32_t t155 = -244908;
t155 = (((x657/x658)&x659)!=x660);
if (t155 != 1) { NG(); } else { ; }
}
void f156(void) {
int16_t x661 = INT16_MAX;
static uint64_t x662 = UINT64_MAX;
volatile int32_t x663 = INT32_MIN;
volatile int64_t x664 = INT64_MIN;
int32_t t156 = -25841;
t156 = (((x661/x662)&x663)!=x664);
if (t156 != 1) { NG(); } else { ; }
}
void f157(void) {
uint8_t x665 = UINT8_MAX;
int32_t x666 = INT32_MAX;
int32_t x667 = INT32_MAX;
uint64_t x668 = 538166580649892163LLU;
static int32_t t157 = -481842132;
t157 = (((x665/x666)&x667)!=x668);
if (t157 != 1) { NG(); } else { ; }
}
void f158(void) {
static int16_t x672 = INT16_MIN;
volatile int32_t t158 = 7;
t158 = (((x669/x670)&x671)!=x672);
if (t158 != 1) { NG(); } else { ; }
}
void f159(void) {
int32_t x673 = INT32_MIN;
uint8_t x674 = 11U;
static volatile int32_t x675 = INT32_MIN;
uint32_t x676 = 94199736U;
static volatile int32_t t159 = -5907767;
t159 = (((x673/x674)&x675)!=x676);
if (t159 != 1) { NG(); } else { ; }
}
void f160(void) {
static int64_t x677 = 60735890449882807LL;
int64_t x678 = INT64_MAX;
int32_t x679 = INT32_MAX;
volatile uint32_t x680 = UINT32_MAX;
volatile int32_t t160 = 952324;
t160 = (((x677/x678)&x679)!=x680);
if (t160 != 1) { NG(); } else { ; }
}
void f161(void) {
int8_t x681 = INT8_MIN;
uint16_t x682 = 2711U;
int32_t x683 = INT32_MIN;
int16_t x684 = INT16_MAX;
volatile int32_t t161 = 22;
t161 = (((x681/x682)&x683)!=x684);
if (t161 != 1) { NG(); } else { ; }
}
void f162(void) {
uint32_t x685 = 7396957U;
int64_t x686 = INT64_MIN;
int16_t x687 = -8;
volatile int32_t t162 = 492887;
t162 = (((x685/x686)&x687)!=x688);
if (t162 != 1) { NG(); } else { ; }
}
void f163(void) {
int32_t x689 = INT32_MIN;
uint64_t x690 = 2967779LLU;
int64_t x691 = INT64_MIN;
int32_t x692 = -1;
t163 = (((x689/x690)&x691)!=x692);
if (t163 != 1) { NG(); } else { ; }
}
void f164(void) {
static int64_t x693 = -1LL;
volatile int16_t x694 = -212;
volatile int32_t x695 = INT32_MIN;
int32_t x696 = 1554;
volatile int32_t t164 = 504447;
t164 = (((x693/x694)&x695)!=x696);
if (t164 != 1) { NG(); } else { ; }
}
void f165(void) {
volatile int8_t x697 = INT8_MAX;
int64_t x698 = -23012142LL;
volatile int64_t x700 = INT64_MIN;
volatile int32_t t165 = -349;
t165 = (((x697/x698)&x699)!=x700);
if (t165 != 1) { NG(); } else { ; }
}
void f166(void) {
volatile int64_t x701 = -1LL;
int16_t x702 = INT16_MIN;
int64_t x703 = -22297LL;
static int32_t x704 = INT32_MIN;
static int32_t t166 = 286151;
t166 = (((x701/x702)&x703)!=x704);
if (t166 != 1) { NG(); } else { ; }
}
void f167(void) {
int64_t x705 = -23727148752LL;
int8_t x706 = INT8_MIN;
int32_t x707 = INT32_MAX;
volatile uint8_t x708 = UINT8_MAX;
static int32_t t167 = 0;
t167 = (((x705/x706)&x707)!=x708);
if (t167 != 1) { NG(); } else { ; }
}
void f168(void) {
volatile int64_t x709 = INT64_MIN;
volatile int64_t x710 = INT64_MIN;
uint8_t x711 = UINT8_MAX;
int8_t x712 = 29;
volatile int32_t t168 = -574116123;
t168 = (((x709/x710)&x711)!=x712);
if (t168 != 1) { NG(); } else { ; }
}
void f169(void) {
volatile int8_t x715 = 0;
uint8_t x716 = 0U;
volatile int32_t t169 = 479;
t169 = (((x713/x714)&x715)!=x716);
if (t169 != 0) { NG(); } else { ; }
}
void f170(void) {
int8_t x717 = -1;
int64_t x718 = INT64_MAX;
volatile uint16_t x720 = UINT16_MAX;
static int32_t t170 = -2;
t170 = (((x717/x718)&x719)!=x720);
if (t170 != 1) { NG(); } else { ; }
}
void f171(void) {
int8_t x721 = 2;
uint16_t x722 = 4346U;
uint64_t x723 = UINT64_MAX;
t171 = (((x721/x722)&x723)!=x724);
if (t171 != 1) { NG(); } else { ; }
}
void f172(void) {
uint32_t x725 = 228U;
static int16_t x726 = INT16_MIN;
int16_t x727 = -1;
int8_t x728 = INT8_MIN;
t172 = (((x725/x726)&x727)!=x728);
if (t172 != 1) { NG(); } else { ; }
}
void f173(void) {
int32_t x729 = -404094680;
int32_t t173 = 1643030;
t173 = (((x729/x730)&x731)!=x732);
if (t173 != 1) { NG(); } else { ; }
}
void f174(void) {
int8_t x733 = 4;
uint32_t x734 = 590U;
uint64_t x735 = 6915345LLU;
int64_t x736 = -703LL;
int32_t t174 = 1;
t174 = (((x733/x734)&x735)!=x736);
if (t174 != 1) { NG(); } else { ; }
}
void f175(void) {
int8_t x737 = INT8_MIN;
volatile uint8_t x740 = 51U;
t175 = (((x737/x738)&x739)!=x740);
if (t175 != 1) { NG(); } else { ; }
}
void f176(void) {
uint64_t x741 = 526499082564210LLU;
volatile uint16_t x742 = UINT16_MAX;
static int8_t x743 = INT8_MIN;
int32_t x744 = INT32_MIN;
static int32_t t176 = -15;
t176 = (((x741/x742)&x743)!=x744);
if (t176 != 1) { NG(); } else { ; }
}
void f177(void) {
static uint64_t x746 = UINT64_MAX;
uint32_t x747 = UINT32_MAX;
t177 = (((x745/x746)&x747)!=x748);
if (t177 != 1) { NG(); } else { ; }
}
void f178(void) {
static int16_t x750 = INT16_MAX;
int16_t x751 = INT16_MIN;
volatile int32_t t178 = 0;
t178 = (((x749/x750)&x751)!=x752);
if (t178 != 1) { NG(); } else { ; }
}
void f179(void) {
int8_t x753 = -1;
int16_t x754 = -1;
int16_t x755 = INT16_MAX;
static uint8_t x756 = 0U;
static volatile int32_t t179 = 11;
t179 = (((x753/x754)&x755)!=x756);
if (t179 != 1) { NG(); } else { ; }
}
void f180(void) {
volatile int16_t x759 = INT16_MIN;
uint32_t x760 = 156478U;
t180 = (((x757/x758)&x759)!=x760);
if (t180 != 1) { NG(); } else { ; }
}
void f181(void) {
static int64_t x761 = INT64_MAX;
uint64_t x762 = 916907317399LLU;
int8_t x763 = INT8_MIN;
uint16_t x764 = UINT16_MAX;
int32_t t181 = -1587987;
t181 = (((x761/x762)&x763)!=x764);
if (t181 != 1) { NG(); } else { ; }
}
void f182(void) {
static int64_t x765 = 22LL;
static int16_t x766 = INT16_MIN;
volatile int8_t x767 = -29;
int64_t x768 = 169LL;
t182 = (((x765/x766)&x767)!=x768);
if (t182 != 1) { NG(); } else { ; }
}
void f183(void) {
volatile uint8_t x769 = UINT8_MAX;
static volatile int32_t x770 = -1;
int64_t x772 = 249LL;
int32_t t183 = 473603101;
t183 = (((x769/x770)&x771)!=x772);
if (t183 != 1) { NG(); } else { ; }
}
void f184(void) {
static int16_t x773 = INT16_MAX;
int16_t x774 = 1;
static uint8_t x776 = 3U;
int32_t t184 = -80682;
t184 = (((x773/x774)&x775)!=x776);
if (t184 != 1) { NG(); } else { ; }
}
void f185(void) {
int32_t x777 = -1;
uint16_t x778 = UINT16_MAX;
t185 = (((x777/x778)&x779)!=x780);
if (t185 != 1) { NG(); } else { ; }
}
void f186(void) {
int32_t x781 = -774;
int64_t x782 = 10LL;
static int64_t x783 = INT64_MAX;
static uint8_t x784 = UINT8_MAX;
int32_t t186 = 1;
t186 = (((x781/x782)&x783)!=x784);
if (t186 != 1) { NG(); } else { ; }
}
void f187(void) {
int32_t x785 = INT32_MIN;
int16_t x786 = -802;
static uint64_t x787 = 1524356195821LLU;
int8_t x788 = -2;
int32_t t187 = 266136;
t187 = (((x785/x786)&x787)!=x788);
if (t187 != 1) { NG(); } else { ; }
}
void f188(void) {
int8_t x789 = INT8_MIN;
int64_t x790 = INT64_MIN;
int64_t x791 = -20610326555LL;
t188 = (((x789/x790)&x791)!=x792);
if (t188 != 1) { NG(); } else { ; }
}
void f189(void) {
int64_t x801 = INT64_MAX;
int8_t x802 = -2;
int32_t x803 = -1;
static volatile int8_t x804 = -5;
volatile int32_t t189 = 1828;
t189 = (((x801/x802)&x803)!=x804);
if (t189 != 1) { NG(); } else { ; }
}
void f190(void) {
int8_t x805 = 4;
static int32_t x806 = INT32_MIN;
static int8_t x807 = INT8_MAX;
uint8_t x808 = UINT8_MAX;
int32_t t190 = -5;
t190 = (((x805/x806)&x807)!=x808);
if (t190 != 1) { NG(); } else { ; }
}
void f191(void) {
volatile int8_t x809 = -1;
uint64_t x810 = 937534LLU;
volatile uint32_t x811 = 2455U;
int32_t x812 = INT32_MAX;
volatile int32_t t191 = -594864;
t191 = (((x809/x810)&x811)!=x812);
if (t191 != 1) { NG(); } else { ; }
}
void f192(void) {
int16_t x813 = INT16_MIN;
static int8_t x814 = INT8_MIN;
int32_t x815 = -2113909;
int32_t x816 = INT32_MIN;
static volatile int32_t t192 = 445815;
t192 = (((x813/x814)&x815)!=x816);
if (t192 != 1) { NG(); } else { ; }
}
void f193(void) {
uint64_t x821 = 4302738984453LLU;
volatile int64_t x822 = INT64_MAX;
uint32_t x823 = 55709U;
static volatile int32_t t193 = 619;
t193 = (((x821/x822)&x823)!=x824);
if (t193 != 1) { NG(); } else { ; }
}
void f194(void) {
static int64_t x825 = INT64_MIN;
int8_t x826 = INT8_MAX;
volatile int16_t x827 = 0;
uint8_t x828 = UINT8_MAX;
volatile int32_t t194 = -759141;
t194 = (((x825/x826)&x827)!=x828);
if (t194 != 1) { NG(); } else { ; }
}
void f195(void) {
int8_t x829 = 0;
int32_t x830 = INT32_MIN;
int64_t x831 = INT64_MIN;
t195 = (((x829/x830)&x831)!=x832);
if (t195 != 1) { NG(); } else { ; }
}
void f196(void) {
uint64_t x834 = 91LLU;
uint64_t x835 = UINT64_MAX;
uint16_t x836 = 8U;
int32_t t196 = -268584032;
t196 = (((x833/x834)&x835)!=x836);
if (t196 != 1) { NG(); } else { ; }
}
void f197(void) {
uint64_t x837 = UINT64_MAX;
static uint16_t x838 = 12U;
volatile int16_t x839 = INT16_MIN;
int8_t x840 = 1;
t197 = (((x837/x838)&x839)!=x840);
if (t197 != 1) { NG(); } else { ; }
}
void f198(void) {
volatile int16_t x841 = INT16_MIN;
static int8_t x843 = 0;
int16_t x844 = -1;
volatile int32_t t198 = 883339448;
t198 = (((x841/x842)&x843)!=x844);
if (t198 != 1) { NG(); } else { ; }
}
void f199(void) {
uint32_t x845 = 90U;
int32_t x846 = INT32_MIN;
uint16_t x848 = 2628U;
static volatile int32_t t199 = 53640;
t199 = (((x845/x846)&x847)!=x848);
if (t199 != 1) { NG(); } else { ; }
}
int main(void) {
f0();
f1();
f2();
f3();
f4();
f5();
f6();
f7();
f8();
f9();
f10();
f11();
f12();
f13();
f14();
f15();
f16();
f17();
f18();
f19();
f20();
f21();
f22();
f23();
f24();
f25();
f26();
f27();
f28();
f29();
f30();
f31();
f32();
f33();
f34();
f35();
f36();
f37();
f38();
f39();
f40();
f41();
f42();
f43();
f44();
f45();
f46();
f47();
f48();
f49();
f50();
f51();
f52();
f53();
f54();
f55();
f56();
f57();
f58();
f59();
f60();
f61();
f62();
f63();
f64();
f65();
f66();
f67();
f68();
f69();
f70();
f71();
f72();
f73();
f74();
f75();
f76();
f77();
f78();
f79();
f80();
f81();
f82();
f83();
f84();
f85();
f86();
f87();
f88();
f89();
f90();
f91();
f92();
f93();
f94();
f95();
f96();
f97();
f98();
f99();
f100();
f101();
f102();
f103();
f104();
f105();
f106();
f107();
f108();
f109();
f110();
f111();
f112();
f113();
f114();
f115();
f116();
f117();
f118();
f119();
f120();
f121();
f122();
f123();
f124();
f125();
f126();
f127();
f128();
f129();
f130();
f131();
f132();
f133();
f134();
f135();
f136();
f137();
f138();
f139();
f140();
f141();
f142();
f143();
f144();
f145();
f146();
f147();
f148();
f149();
f150();
f151();
f152();
f153();
f154();
f155();
f156();
f157();
f158();
f159();
f160();
f161();
f162();
f163();
f164();
f165();
f166();
f167();
f168();
f169();
f170();
f171();
f172();
f173();
f174();
f175();
f176();
f177();
f178();
f179();
f180();
f181();
f182();
f183();
f184();
f185();
f186();
f187();
f188();
f189();
f190();
f191();
f192();
f193();
f194();
f195();
f196();
f197();
f198();
f199();
return 0;
}
| 18.298513
| 54
| 0.577668
|
ddb7ad7a52eb8a3fcb722a992585db26e4e265a6
| 1,859
|
java
|
Java
|
GraceJava/ToStr.java
|
thautwarm/Projects
|
732329177dcbd378f1992d33fbdd2e67b9c4ac1e
|
[
"Apache-2.0"
] | null | null | null |
GraceJava/ToStr.java
|
thautwarm/Projects
|
732329177dcbd378f1992d33fbdd2e67b9c4ac1e
|
[
"Apache-2.0"
] | null | null | null |
GraceJava/ToStr.java
|
thautwarm/Projects
|
732329177dcbd378f1992d33fbdd2e67b9c4ac1e
|
[
"Apache-2.0"
] | null | null | null |
package GraceJava;
import java.sql.Timestamp;
import java.util.Date;
public class ToStr {
public ToStr(){
}
public static Long str2long(String a){
if (a==null||a.equals("null")) return null;
return Long.valueOf(a);
}
public static Integer str2int(String a){
if (a==null||a.equals("null")) return null;
return Integer.valueOf(a);
}
public static String date2sqldate(Date a){
if (a==null) return null;
return new Timestamp(a.getTime()).toString();
}
public static Date sqldate2date(Timestamp a){
if (a==null) return null;
return new Date(a.getTime());
}
public static Timestamp str2Timestamp(String a){
if (a==null||a.equals("null")) return null;
return Timestamp.valueOf(a);
}
public static Date Timestamp2Date(Timestamp date){
if (date==null) return null;
return new Date(date.getTime());
}
public static Timestamp Date2Timestamp(Date date){
if (date==null) return null;
return new Timestamp(date.getTime());
}
public static String double2str(Double a){
if (a==null) return null;
return a.toString();
}
public static Double str2double(String a){
if (a==null) return null;
return Double.valueOf(a);
}
public static String[] ExceptNull(String columns,String values){
String[] columnsList=columns.split(",");
String[] valuesList=values.split(",");
columns="";
values="";
int index=0;
int num=valuesList.length;
for(;index<num;++index){
String value=valuesList[index];
if (!value.equals(null)&&(!value.equals("null"))){
columns=columns+columnsList[index]+",";
values=values+value+",";
}
}
columns=String.join(",",columns.split(",") );
values=String.join(",", values.split(","));
String []ret=new String[]{columns,values};
return ret;
}
public static void main(String[] args){
Long a= null;
System.out.println(((Object) a));
}
}
| 23.531646
| 65
| 0.670253
|
c293b44635d8c362599044c93d9597f9ef089bd2
| 1,068
|
html
|
HTML
|
examples/mapbox-streets/index.html
|
GlobeletJS/satellite-view
|
c5b7ddc6b28e4a8d77b195606a09f01e17ae048c
|
[
"MIT"
] | 3
|
2019-10-19T18:24:10.000Z
|
2019-12-12T15:55:28.000Z
|
examples/mapbox-streets/index.html
|
GlobeletJS/satellite-view
|
c5b7ddc6b28e4a8d77b195606a09f01e17ae048c
|
[
"MIT"
] | 1
|
2020-04-10T18:51:55.000Z
|
2020-04-10T18:51:55.000Z
|
examples/mapbox-streets/index.html
|
GlobeletJS/satellite-view
|
c5b7ddc6b28e4a8d77b195606a09f01e17ae048c
|
[
"MIT"
] | null | null | null |
<html>
<head>
<title>satellite-view</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="splitearth_v12b.png">
<link rel="stylesheet" type="text/css" href="styles.css">
<script src="main.min.js"></script>
</head>
<body onload="app.main()">
<form id="coordInput" class="inline-inputs">
<label class="text">
<span class="boxlabel">Longitude:</span>
<input name="lon" type="text" value="-95.366">°
</label>
<label class="text">
<span class="boxlabel">Latitude:</span>
<input name="lat" type="text" value="29.7535">°
</label>
<label class="text">
<span class="boxlabel">Altitude:</span>
<input name="alt" type="text" value="15000">km
</label>
</form>
<canvas id="globe"></canvas>
<p>
Data by <a href="http://openstreetmap.org">OpenStreetMap</a>,
under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.
</p>
</body>
</html>
| 28.105263
| 74
| 0.585206
|
c6e98ed31052e0357512e828d5b3c0be2b22dd54
| 52
|
py
|
Python
|
enthought/traits/ui/help_template.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 3
|
2016-12-09T06:05:18.000Z
|
2018-03-01T13:00:29.000Z
|
enthought/traits/ui/help_template.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | 1
|
2020-12-02T00:51:32.000Z
|
2020-12-02T08:48:55.000Z
|
enthought/traits/ui/help_template.py
|
enthought/etsproxy
|
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
|
[
"BSD-3-Clause"
] | null | null | null |
# proxy module
from traitsui.help_template import *
| 17.333333
| 36
| 0.807692
|
85e16226e81be7599949809ba6646882fe236a30
| 21,542
|
dart
|
Dart
|
packages/free_flutter_pdf/lib/src/pdf/implementation/forms/pdf_text_box_field.dart
|
cholojuanito/free_flutter_widgets
|
da1679540f3de9f92682494d53d2149b65bc2ea3
|
[
"MIT"
] | 3
|
2021-04-12T21:35:08.000Z
|
2021-11-20T11:07:47.000Z
|
packages/free_flutter_pdf/lib/src/pdf/implementation/forms/pdf_text_box_field.dart
|
cholojuanito/free_flutter_widgets
|
da1679540f3de9f92682494d53d2149b65bc2ea3
|
[
"MIT"
] | null | null | null |
packages/free_flutter_pdf/lib/src/pdf/implementation/forms/pdf_text_box_field.dart
|
cholojuanito/free_flutter_widgets
|
da1679540f3de9f92682494d53d2149b65bc2ea3
|
[
"MIT"
] | 1
|
2021-06-23T19:20:10.000Z
|
2021-06-23T19:20:10.000Z
|
part of pdf;
/// Represents text box field in the PDF form.
class PdfTextBoxField extends PdfField {
//Constructor
/// Initializes a new instance of the [PdfTextBoxField] class with the provided page and name.
PdfTextBoxField(PdfPage page, String name, Rect bounds,
{PdfFont? font,
String? text,
String? defaultValue,
int maxLength = 0,
bool spellCheck = false,
bool insertSpaces = false,
bool multiline = false,
bool isPassword = false,
bool scrollable = false,
PdfTextAlignment alignment = PdfTextAlignment.left,
PdfColor? borderColor,
PdfColor? foreColor,
PdfColor? backColor,
int? borderWidth,
PdfHighlightMode highlightMode = PdfHighlightMode.invert,
PdfBorderStyle borderStyle = PdfBorderStyle.solid,
String? tooltip})
: super(page, name, bounds,
font: font,
alignment: alignment,
borderColor: borderColor,
foreColor: foreColor,
backColor: backColor,
borderWidth: borderWidth,
highlightMode: highlightMode,
borderStyle: borderStyle,
tooltip: tooltip) {
this.font =
font != null ? font : PdfStandardFont(PdfFontFamily.helvetica, 8);
_init(text, defaultValue, maxLength, spellCheck, insertSpaces, multiline,
isPassword, scrollable);
}
/// Initializes a new instance of the [PdfTextBoxField] class.
PdfTextBoxField._load(_PdfDictionary dictionary, _PdfCrossTable crossTable)
: super._load(dictionary, crossTable) {
_items = PdfFieldItemCollection._(this);
final _PdfArray? kids = _kids;
if (kids != null) {
for (int i = 0; i < kids.count; ++i) {
final _PdfDictionary? itemDictionary =
crossTable._getObject(kids[i]) as _PdfDictionary?;
_items!._add(PdfTextBoxItem._(this, i, itemDictionary));
}
_array = kids;
}
}
//Fields
String? _text = '';
String? _defaultValue = '';
bool _spellCheck = false;
bool _insertSpaces = false;
bool _multiline = false;
bool _password = false;
bool _scrollable = true;
int _maxLength = 0;
PdfFieldItemCollection? _items;
//Properties
/// Gets or sets the text in the text box.
String get text {
if (_isLoadedField) {
_IPdfPrimitive? str;
final _IPdfPrimitive? referenceHolder =
_dictionary[_DictionaryProperties.v];
if (referenceHolder != null && referenceHolder is _PdfReferenceHolder) {
final _IPdfPrimitive? textObject =
_PdfCrossTable._dereference(referenceHolder);
if (textObject is _PdfStream) {
final _PdfStream stream = referenceHolder.object as _PdfStream;
stream._decompress();
final List<int> bytes = stream._dataStream!;
final String data = utf8.decode(bytes);
str = _PdfString(data);
} else if (textObject is _PdfString) {
str = PdfField._getValue(
_dictionary, _crossTable, _DictionaryProperties.v, true);
} else {
str = _PdfString('');
}
} else {
str = PdfField._getValue(
_dictionary, _crossTable, _DictionaryProperties.v, true);
}
_text = str != null && str is _PdfString ? str.value : '';
return _text!;
}
return _text!;
}
set text(String value) {
if (_isLoadedField) {
//check if not readOnly.
if (!_isFlagPresent(_FieldFlags.readOnly)) {
_isTextChanged = true;
if (_dictionary.containsKey(_DictionaryProperties.aa)) {
final _IPdfPrimitive? dic = _dictionary[_DictionaryProperties.aa];
if (dic != null && dic is _PdfDictionary) {
final _IPdfPrimitive? dicRef = dic[_DictionaryProperties.k];
if (dicRef != null && dicRef is _PdfReferenceHolder) {
final _IPdfPrimitive? dict = dicRef.object;
if (dict != null && dict is _PdfDictionary) {
final _IPdfPrimitive? str =
_PdfCrossTable._dereference(dict['JS']);
if (str != null && str is _PdfString) {
_dictionary.setProperty(
_DictionaryProperties.v, _PdfString(str.value!));
}
}
}
}
}
_dictionary.setProperty(_DictionaryProperties.v, _PdfString(value));
_changed = true;
_form!._setAppearanceDictionary = true;
if (_form!._isUR3) {
_dictionary._beginSaveList ??= [];
_dictionary._beginSaveList!.add(_dictSave);
}
} else {
_changed = false;
}
} else {
if (_text != value) {
_text = value;
_dictionary._setString(_DictionaryProperties.v, _text);
}
}
}
/// Gets or sets the font.
PdfFont get font => _font!;
set font(PdfFont value) {
_font = value;
}
/// Gets or sets the default value.
String get defaultValue {
if (_isLoadedField) {
final _IPdfPrimitive? str = PdfField._getValue(
_dictionary, _crossTable, _DictionaryProperties.dv, true);
if (str != null && str is _PdfString) {
_defaultValue = str.value;
}
}
return _defaultValue!;
}
set defaultValue(String value) {
if (defaultValue != value) {
_defaultValue = value;
_dictionary._setString(_DictionaryProperties.dv, _defaultValue);
if (_isLoadedField) {
_changed = true;
}
}
}
/// Gets or sets the maximum number of characters that can be entered in the text box.
///
/// The default value is 0.
int get maxLength {
if (_isLoadedField) {
final _IPdfPrimitive? number = PdfField._getValue(
_dictionary, _crossTable, _DictionaryProperties.maxLen, true);
if (number != null && number is _PdfNumber) {
_maxLength = number.value!.toInt();
}
}
return _maxLength;
}
set maxLength(int value) {
if (maxLength != value) {
_maxLength = value;
_dictionary._setNumber(_DictionaryProperties.maxLen, _maxLength);
if (_isLoadedField) {
_changed = true;
}
}
}
/// Gets or sets a value indicating whether to check spelling.
///
/// The default value is false.
bool get spellCheck {
if (_isLoadedField) {
_spellCheck = !(_isFlagPresent(_FieldFlags.doNotSpellCheck) ||
_flags.contains(_FieldFlags.doNotSpellCheck));
}
return _spellCheck;
}
set spellCheck(bool value) {
if (spellCheck != value) {
_spellCheck = value;
_spellCheck
? _isLoadedField
? _removeFlag(_FieldFlags.doNotSpellCheck)
: _flags.remove(_FieldFlags.doNotSpellCheck)
: _flags.add(_FieldFlags.doNotSpellCheck);
}
}
/// Meaningful only if the maxLength property is set and the multiline, isPassword properties are false.
///
/// If set, the field is automatically divided into as many equally spaced positions, or combs,
/// as the value of maxLength, and the text is laid out into those combs.
///
/// The default value is false.
bool get insertSpaces {
_insertSpaces = _flags.contains(_FieldFlags.comb) &&
!_flags.contains(_FieldFlags.multiline) &&
!_flags.contains(_FieldFlags.password) &&
!_flags.contains(_FieldFlags.fileSelect);
if (_isLoadedField) {
_insertSpaces = _insertSpaces ||
(_isFlagPresent(_FieldFlags.comb) &&
!_isFlagPresent(_FieldFlags.multiline) &&
!_isFlagPresent(_FieldFlags.password) &&
!_isFlagPresent(_FieldFlags.fileSelect));
}
return _insertSpaces;
}
set insertSpaces(bool value) {
if (insertSpaces != value) {
_insertSpaces = value;
_insertSpaces
? _flags.add(_FieldFlags.comb)
: _isLoadedField
? _removeFlag(_FieldFlags.comb)
: _flags.remove(_FieldFlags.comb);
}
}
/// Gets or sets a value indicating whether this [PdfTextBoxField] is multiline.
///
/// The default value is false.
bool get multiline {
if (_isLoadedField) {
_multiline = _isFlagPresent(_FieldFlags.multiline) ||
_flags.contains(_FieldFlags.multiline);
}
return _multiline;
}
set multiline(bool value) {
if (multiline != value) {
_multiline = value;
if (_multiline) {
_flags.add(_FieldFlags.multiline);
_format!.lineAlignment = PdfVerticalAlignment.top;
} else {
_isLoadedField
? _removeFlag(_FieldFlags.multiline)
: _flags.remove(_FieldFlags.multiline);
_format!.lineAlignment = PdfVerticalAlignment.middle;
}
}
}
/// Gets or sets a value indicating whether this [PdfTextBoxField] is password field.
///
/// The default value is false.
bool get isPassword {
if (_isLoadedField) {
_password = _isFlagPresent(_FieldFlags.password) ||
_flags.contains(_FieldFlags.password);
}
return _password;
}
set isPassword(bool value) {
if (isPassword != value) {
_password = value;
_password
? _flags.add(_FieldFlags.password)
: _isLoadedField
? _removeFlag(_FieldFlags.password)
: _flags.remove(_FieldFlags.password);
}
}
/// Gets or sets a value indicating whether this [PdfTextBoxField] is scrollable.
///
/// The default value is true.
bool get scrollable {
if (_isLoadedField) {
_scrollable = !(_isFlagPresent(_FieldFlags.doNotScroll) ||
_flags.contains(_FieldFlags.doNotScroll));
}
return _scrollable;
}
set scrollable(bool value) {
if (scrollable != value) {
_scrollable = value;
_spellCheck
? _isLoadedField
? _removeFlag(_FieldFlags.doNotScroll)
: _flags.remove(_FieldFlags.doNotScroll)
: _flags.add(_FieldFlags.doNotScroll);
}
}
/// Gets or sets the text alignment.
///
/// The default alignment is left.
PdfTextAlignment get textAlignment => _textAlignment;
set textAlignment(PdfTextAlignment value) => _textAlignment = value;
/// Gets or sets the color of the border.
///
/// The default color is black.
PdfColor get borderColor => _borderColor;
set borderColor(PdfColor value) => _borderColor = value;
/// Gets or sets the color of the background.
///
/// The default color is empty.
PdfColor get backColor => _backColor;
set backColor(PdfColor value) => _backColor = value;
/// Gets or sets the color of the text.
///
/// The default color is black.
PdfColor get foreColor => _foreColor;
set foreColor(PdfColor value) => _foreColor = value;
/// Gets or sets the width of the border.
///
/// The default value is 1.
int get borderWidth => _borderWidth;
set borderWidth(int value) => _borderWidth = value;
/// Gets or sets the highlighting mode.
///
/// The default mode is invert.
PdfHighlightMode get highlightMode => _highlightMode;
set highlightMode(PdfHighlightMode value) => _highlightMode = value;
/// Gets or sets the border style.
///
/// The default style is solid.
PdfBorderStyle get borderStyle => _borderStyle;
set borderStyle(PdfBorderStyle value) => _borderStyle = value;
/// Gets the collection of text box field items.
PdfFieldItemCollection? get items => _items;
//Implementations
@override
void _initialize() {
super._initialize();
_flags.add(_FieldFlags.doNotSpellCheck);
_dictionary.setProperty(
_DictionaryProperties.ft, _PdfName(_DictionaryProperties.tx));
}
@override
void _save() {
super._save();
if (_fieldItems != null && _fieldItems!.length > 1) {
for (int i = 1; i < _fieldItems!.length; i++) {
final PdfTextBoxField field = _fieldItems![i] as PdfTextBoxField;
field.text = text;
field._save();
}
}
}
void _dictSave(Object sender, _SavePdfPrimitiveArgs? ars) {
_beginSave();
}
@override
void _drawAppearance(PdfTemplate template) {
super._drawAppearance(template);
final _PaintParams params = _PaintParams(
bounds: Rect.fromLTWH(0, 0, bounds.width, bounds.height),
backBrush: _backBrush,
foreBrush: _foreBrush,
borderPen: _borderPen,
style: borderStyle,
borderWidth: borderWidth,
shadowBrush: _shadowBrush);
template._writeTransformation = false;
final PdfGraphics graphics = template.graphics!;
_beginMarkupSequence(graphics._streamWriter!._stream!);
graphics._initializeCoordinates();
if (params._borderWidth == 0 && params._borderPen != null) {
params._borderWidth = 1;
params._borderPen!.width = 1;
}
_drawTextBox(graphics, params: params);
_endMarkupSequence(graphics._streamWriter!._stream!);
}
void _init(String? text, String? defaultValue, int maxLength, bool spellCheck,
bool insertSpaces, bool multiline, bool password, bool scrollable) {
if (text != null) {
this.text = text;
}
if (defaultValue != null) {
this.defaultValue = defaultValue;
}
this.maxLength = maxLength;
this.spellCheck = spellCheck;
this.insertSpaces = insertSpaces;
this.multiline = multiline;
this.isPassword = password;
this.scrollable = scrollable;
}
void _drawTextBox(PdfGraphics? graphics,
{_PaintParams? params, PdfFieldItem? item}) {
if (params != null) {
String newText = text;
if (isPassword && text.isNotEmpty) {
newText = '';
for (int i = 0; i < text.length; ++i) {
newText += '*';
}
}
graphics!.save();
if (insertSpaces) {
double width = 0;
final List<String> ch = text.split('');
if (maxLength > 0) {
width = params._bounds!.width / maxLength;
}
graphics.drawRectangle(bounds: params._bounds!, pen: _borderPen);
for (int i = 0; i < maxLength; i++) {
if (_format!.alignment != PdfTextAlignment.right) {
if (_format!.alignment == PdfTextAlignment.center &&
ch.length < maxLength) {
final int startLocation =
(maxLength / 2 - (ch.length / 2).ceil()).toInt();
newText = i >= startLocation && i < startLocation + ch.length
? ch[i - startLocation]
: '';
} else {
newText = ch.length > i ? ch[i] : '';
}
} else {
newText = maxLength - ch.length <= i
? ch[i - (maxLength - ch.length)]
: '';
}
params._bounds = Rect.fromLTWH(params._bounds!.left,
params._bounds!.top, width, params._bounds!.height);
final PdfStringFormat format = PdfStringFormat(
alignment: PdfTextAlignment.center,
lineAlignment: _format!.lineAlignment);
_FieldPainter().drawTextBox(
graphics, params, newText, font, format, insertSpaces, multiline);
params._bounds = Rect.fromLTWH(params._bounds!.left + width,
params._bounds!.top, width, params._bounds!.height);
if (params._borderWidth != 0) {
graphics.drawLine(
params._borderPen!,
Offset(params._bounds!.left, params._bounds!.top),
Offset(params._bounds!.left,
params._bounds!.top + params._bounds!.height));
}
}
} else {
_FieldPainter().drawTextBox(
graphics, params, newText, font, _format!, insertSpaces, multiline);
}
graphics.restore();
} else {
final _GraphicsProperties gp = item != null
? _GraphicsProperties.fromFieldItem(item)
: _GraphicsProperties(this);
if (gp._borderWidth == 0 && gp._borderPen != null) {
gp._borderWidth = 1;
gp._borderPen!.width = 1;
}
if (graphics!._layer == null) {
gp._bounds = Rect.fromLTWH(gp._bounds!.left, gp._bounds!.top,
graphics.size.width, graphics.size.height);
}
if (!_flattenField) {
gp._bounds = Rect.fromLTWH(0, 0, gp._bounds!.width, gp._bounds!.height);
}
final _PaintParams prms = _PaintParams(
bounds: gp._bounds,
backBrush: gp._backBrush,
foreBrush: gp._foreBrush,
borderPen: gp._borderPen,
style: gp._style,
borderWidth: gp._borderWidth,
shadowBrush: gp._shadowBrush);
_drawTextBox(graphics, params: prms);
}
}
@override
void _beginSave() {
super._beginSave();
final _PdfArray? kids = _kids;
if ((kids != null)) {
for (int i = 0; i < kids.count; ++i) {
final _PdfDictionary? widget =
_crossTable!._getObject(kids[i]) as _PdfDictionary?;
_applyAppearance(widget, items![i]);
}
} else {
_applyAppearance(_getWidgetAnnotation(_dictionary, _crossTable));
}
}
void _applyAppearance(_PdfDictionary? widget, [PdfFieldItem? item]) {
if (_form!._setAppearanceDictionary) {
if (widget != null && !_form!._needAppearances!) {
final _PdfDictionary appearance = _PdfDictionary();
final Rect bounds = item == null ? this.bounds : item.bounds;
PdfTemplate? template;
if (widget.containsKey(_DictionaryProperties.mk)) {
final _IPdfPrimitive? mkDic = widget[_DictionaryProperties.mk];
if (mkDic != null &&
mkDic is _PdfDictionary &&
mkDic.containsKey(_DictionaryProperties.r)) {
final _IPdfPrimitive? angle = mkDic[_DictionaryProperties.r];
if (angle != null && angle is _PdfNumber) {
if (angle.value == 90) {
template = PdfTemplate(bounds.size.height, bounds.size.width);
template._content[_DictionaryProperties.matrix] =
_PdfArray([0, 1, -1, 0, bounds.size.width, 0]);
} else if (angle.value == 180) {
template = PdfTemplate(bounds.size.width, bounds.size.height);
template._content[_DictionaryProperties.matrix] = _PdfArray(
[-1, 0, 0, -1, bounds.size.width, bounds.size.height]);
} else if (angle.value == 270) {
template = PdfTemplate(bounds.size.height, bounds.size.width);
template._content[_DictionaryProperties.matrix] =
_PdfArray([0, -1, 1, 0, 0, bounds.size.height]);
}
if (template != null) {
template._writeTransformation = false;
}
}
}
}
if (template == null) {
template = PdfTemplate(bounds.size.width, bounds.size.height);
template._writeTransformation = false;
template._content[_DictionaryProperties.matrix] =
_PdfArray([1, 0, 0, 1, 0, 0]);
}
if (item != null) {
_beginMarkupSequence(template.graphics!._streamWriter!._stream!);
template.graphics!._initializeCoordinates();
_drawTextBox(template.graphics, item: item);
_endMarkupSequence(template.graphics!._streamWriter!._stream!);
} else {
_drawAppearance(template);
}
appearance.setProperty(
_DictionaryProperties.n, _PdfReferenceHolder(template));
widget.setProperty(_DictionaryProperties.ap, appearance);
} else {
_form!._needAppearances = true;
}
}
}
double _getFontHeight(PdfFontFamily family) {
double s = 12;
if (!multiline) {
final PdfStandardFont font = PdfStandardFont(family, 12);
final Size fontSize = font.measureString(text);
s = (8 * (bounds.size.width - 4 * borderWidth)) / fontSize.width;
s = (s > 8) ? 8 : s;
} else {
s = 12.5;
}
return s;
}
void _draw() {
super._draw();
if (!_isLoadedField && _widget!._pdfAppearance != null) {
page!.graphics.drawPdfTemplate(
_widget!._pdfAppearance!.normal, Offset(bounds.width, bounds.height));
if (_fieldItems != null && _fieldItems!.length > 1) {
for (int i = 1; i < _fieldItems!.length; i++) {
final PdfTextBoxField field = _fieldItems![i] as PdfTextBoxField;
field.text = text;
field.page!.graphics.drawPdfTemplate(
field._widget!._pdfAppearance!.normal,
Offset(field.bounds.width, field.bounds.height));
}
}
} else {
if (_isLoadedField) {
final _PdfArray? kids = _kids;
if (kids != null) {
for (int i = 0; i < kids.count; ++i) {
final PdfFieldItem item = items![i];
if (item.page != null && item.page!._isLoadedPage) {
_drawTextBox(item.page!.graphics, item: item);
}
}
} else {
_drawTextBox(page!.graphics);
}
} else {
_drawTextBox(page!.graphics);
if (_fieldItems != null && _fieldItems!.length > 1) {
for (int i = 1; i < _fieldItems!.length; i++) {
final PdfTextBoxField field = _fieldItems![i] as PdfTextBoxField;
field.text = text;
field._drawTextBox(field.page!.graphics);
}
}
}
}
}
}
/// Represents an item in a text box field collection.
class PdfTextBoxItem extends PdfFieldItem {
PdfTextBoxItem._(PdfField field, int index, _PdfDictionary? dictionary)
: super._(field, index, dictionary);
}
| 33.817896
| 106
| 0.607418
|
2c8a23656a92a960f174178be9c97caaf0170a56
| 13,907
|
py
|
Python
|
tools/gen_sensor_graph_setting.py
|
CK-RK3326-P/hardware_rockchip_camera
|
f2771726c34f2f1819ff85921fe45bc2136bfebe
|
[
"Apache-2.0"
] | null | null | null |
tools/gen_sensor_graph_setting.py
|
CK-RK3326-P/hardware_rockchip_camera
|
f2771726c34f2f1819ff85921fe45bc2136bfebe
|
[
"Apache-2.0"
] | null | null | null |
tools/gen_sensor_graph_setting.py
|
CK-RK3326-P/hardware_rockchip_camera
|
f2771726c34f2f1819ff85921fe45bc2136bfebe
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python
import sys
import xml.etree.ElementTree as ET
import xml.dom.minidom as minidom
import os
import datetime
from optparse import OptionParser
def cal_crop(source, target):
ratio_src = source['W'] * 1.0 / source['H']
ratio_dst = target['W'] * 1.0 / target['H']
ret = {}
if ratio_src == ratio_dst:
height = source['H']
width = source['W']
elif ratio_src > ratio_dst:
height = source['H']
width = int(height * ratio_dst)
else:
width = source['W']
height = int(width / ratio_dst)
height = height - height % 2
return {'W': width, 'H': height}
def cal_reso(reso, sp_reso, mp_reso):
ret = {}
""" sp_reso always smaller than mp_reso"""
if mp_reso:
ret['sensor'] = reso[0] if len(reso) == 1 or mp_reso['W'] > reso[1]['W'] else reso[1]
elif sp_reso:
ret['sensor'] = reso[0] if len(reso) == 1 or sp_reso['W'] > reso[1]['W'] else reso[1]
else:
raise Exception('Mp and SP both are NULL')
if mp_reso:
ret['mp_crop'] = cal_crop(ret['sensor'], mp_reso)
if sp_reso:
ret['sp_crop'] = cal_crop(ret['sensor'], sp_reso)
return ret
def gen_settings(root, key, sensor, sp_crop, sp, mp_crop, mp, mode):
""" for one stream, the sp and sp_crop are None """
active_outputs = 2 if sp else 1
setting = ET.SubElement(root, 'settings',
attrib={'key': str(key),
'id' : str(1),
'fps': str(sensor['FPS']),
'active_outputs': str(active_outputs)})
video = ET.SubElement(setting, 'video',
attrib={'width': str(mp['W']),
'height': str(mp['H']),
'stream_id': str(1),
'format': 'NV12',
'peer': 'output'})
v_crp = ET.SubElement(video, 'pcrp',
attrib={'width': str(mp_crop['W']),
'height': str(mp_crop['H'])})
v_rsz = ET.SubElement(video, 'prsz',
attrib={'width': str(mp['W']),
'height': str(mp['H'])})
if sp and sp_crop:
preview = ET.SubElement(setting, 'preview',
attrib={'width': str(sp['W']),
'height': str(sp['H']),
'stream_id': str(1),
'format': 'NV12',
'peer': 'output'})
p_crp = ET.SubElement(preview, 'pcrp',
attrib={'width': str(sp_crop['W']),
'height': str(sp_crop['H'])})
p_rsz = ET.SubElement(preview, 'prsz',
attrib={'width': str(sp['W']),
'height': str(sp['H'])})
else:
preview = ET.SubElement(setting, 'preview', attrib={'enabled': str(0)})
still = ET.SubElement(setting, 'still', attrib={'enabled': str(0)})
et_sensor = ET.SubElement(setting, 'sensor',
attrib={'stream_id': str(1),
'vflip': str(0),
'hflip': str(0),
'mode_id': str(sensor['W']) + 'x' + str(sensor['H']),
'analogue_gain': str(100),
'exposure': str(500)})
et_sensor_port = ET.SubElement(et_sensor, 'port_0',
attrib={'type': 'port',
'width': str(sensor['W']),
'height': str(sensor['H']),
'format': mode['sensor_fmt']})
csi = ET.SubElement(setting, 'csi_be_soc')
csi_output = ET.SubElement(csi, 'output',
attrib={'width': str(sensor['W']),
'height': str(sensor['H']),
'format': mode['sensor_fmt']})
imgu = ET.SubElement(setting, 'imgu', attrib={'stream_id': str(1)})
imgu_input = ET.SubElement(imgu, 'input',
attrib={'width': str(sensor['W']),
'height': str(sensor['H']),
'format': mode['sensor_fmt']})
iac = ET.SubElement(imgu_input, 'iac',
attrib={'width': str(sensor['W']),
'height': str(sensor['H'])})
imgu_output = ET.SubElement(imgu, 'output',
attrib={'width': str(sensor['W']),
'height': str(sensor['H']),
'format': 'NV16',
'pipe_output_id': str(0)})
ism = ET.SubElement(imgu_output, 'ism',
attrib={'width': str(sensor['W']),
'height': str(sensor['H'])})
def gen_sensor_modes(root, reso, mode):
et_mode = ET.SubElement(root, 'sensor_modes',
attrib={'sensor_name': mode['name'],
'i2c_address': mode['i2c_address'],
'csi_port': '0',
'metadata': '0',
'bayer_order': mode['bayer_order']})
et_bpp = ET.SubElement(et_mode, 'available_bit_per_pixel')
et_bpp_value = ET.SubElement(et_bpp, 'bpp', attrib={'value': str(mode['bpp'])})
et_pll = ET.SubElement(et_mode, 'pll_configs')
et_pll_item = ET.SubElement(et_pll, 'pll_config',
attrib={'id': '0',
'pixel_rate': str(mode['pixel_rate']),
'pixel_rate_csi': str(mode['pixel_rate']),
'bpp': str(mode['bpp'])})
i = 0
item_max = reso[0]
for item in reso:
et_item = ET.SubElement(et_mode, 'sensor_mode',
attrib={'name': str(item['W']) + 'x' + str(item['H']),
'id': str(i),
'width': str(item['W']),
'height': str(item['H']),
'fps': str(item['FPS']),
'csi_port': '0',
'scaler_pad': '1',
'target': '0',
'min_fll': '0',
'min_llp': '0'})
i = i + 1
et_pixel = ET.SubElement(et_item, 'pixel_array')
et_pixel_input = ET.SubElement(et_pixel, 'input',
attrib={'width': str(item_max['W']),
'height': str(item_max['H']),
'left': '0',
'top': '0'})
et_pixel_output = ET.SubElement(et_pixel, 'output',
attrib={'width': str(item['W']),
'height': str(item['H']),
'left': '0',
'top': '0'})
et_binner = ET.SubElement(et_item, 'binner',
attrib={'h_factor': str(item['binner_h']),
'v_factor': str(item['binner_w'])})
# binner input === max reso ?
et_binner_input = ET.SubElement(et_binner, 'input',
attrib={'width': str(item_max['W']),
'height': str(item_max['H']),
'left': '0',
'top': '0'})
et_binner_output = ET.SubElement(et_binner, 'output',
attrib={'width': str(item['W']),
'height': str(item['H']),
'left': '0',
'top': '0'})
def generate_xml(fn, reso, mode, target):
sp_max = {'W': 1920, 'H': 1080}
root = ET.Element('graph_settings')
gen_sensor_modes(root, reso, mode)
key = 7000
for mp in target:
for sp in target:
if sp['W'] > mp['W'] or sp['W'] > sp_max['W']:
continue
ret = cal_reso(reso, sp, mp)
gen_settings(root, key, ret['sensor'], ret['sp_crop'], sp, ret['mp_crop'], mp, mode)
key = key + 1
key = 8000
for mp in target:
ret = cal_reso(reso, None, mp)
gen_settings(root, key, ret['sensor'], None, None, ret['mp_crop'], mp, mode)
key = key + 1
# ET.dump(root)
xml = minidom.parseString(ET.tostring(root)).toprettyxml(indent=' ')
with open(fn, 'w') as f:
f.write(xml)
def get_user_paras():
try:
opt = OptionParser()
opt.add_option('--name',
dest="name",
type=str,
default="none",
help="sensor name which could be got from sys/class/video4linux/v4l-subdev2/name or cmd: media-ctl -p")
opt.add_option('--i2c_address',
dest="i2c_address",
type=str,
default="0-0000",
help="sensor i2c_address which could be got from sys/class/video4linux/v4l-subdev2/name or cmd: media-ctl -p")
opt.add_option('--bayer_order',
dest="bayer_order",
type=str,
default="BGGR",
help="sensor bayer_order which could be got from cmd: media-ctl -p")
opt.add_option('--sensor_fmt',
dest="sensor_fmt",
type=str,
default="BG10",
help="sensor fmt which could be got from cmd: media-ctl -p")
opt.add_option('--bpp',
dest="bpp",
type=int,
default=10,
help="sensor bpp")
opt.add_option('--pixel_rate',
dest="pixel_rate",
type=int,
default=180000000,
help="sensor pixel_rate ")
opt.add_option('--width',
dest="width",
type=int,
default=0,
help="sensor output width")
opt.add_option('--height',
dest="height",
type=int,
default=0,
help="sensor output height")
opt.add_option('--binner_width',
dest="binner_width",
type=int,
default=0,
help="sensor output binner width")
opt.add_option('--binner_height',
dest="binner_height",
type=int,
default=0,
help="sensor output binner height")
(options, args) = opt.parse_args()
is_valid_paras = True
error_messages = ["Config Err:"]
if not options.name:
error_messages.append("--name must be set;")
is_valid_paras = False
if not options.width:
error_messages.append("--width must be set;")
is_valid_paras = False
if not options.height:
error_messages.append("--height must be set;")
error_messages.append("if you do not clear how to config all the options, just config name, width, height")
is_valid_paras = False
if is_valid_paras:
return options
else:
for error_message in error_messages:
print(error_message)
opt.print_help()
return None
except Exception as ex:
print("exception :{0}".format(str(ex)))
return None
def main(argv):
opts = get_user_paras()
if not opts:
return None
else:
reso = [{'W': opts.width, 'H': opts.height, 'FPS': 30, 'binner_h': 1, 'binner_w': 1}]
if opts.binner_width and opts.binner_height:
reso.append({'W': opts.binner_width, 'H': opts.binner_height, 'FPS': 60,
'binner_h': 2, 'binner_w': 2})
mode = {'name': opts.name,
'i2c_address': opts.i2c_address,
'bayer_order': opts.bayer_order,
'bpp': opts.bpp,
'pixel_rate': opts.pixel_rate,
'sensor_fmt': opts.sensor_fmt}
settings = [{'W': 1920, 'H': 1080},
{'W': 1280, 'H': 960},
{'W': 1280, 'H': 720},
{'W': 800, 'H': 600},
{'W': 640, 'H': 480},
{'W': 352, 'H': 288},
{'W': 320, 'H': 240},
{'W': 176, 'H': 144}]
target = []
for s in settings:
if opts.width > s["W"] and opts.height > s["H"]:
target.append(s)
target.insert(0, {'W': opts.width, 'H': opts.height})
if opts.binner_width and opts.binner_height:
binners = {'W': opts.binner_width, 'H': opts.binner_height}
if binners not in target:
target.insert(0, binners)
target.sort(reverse=True)
print reso
print mode
print target
generate_xml('./graph_settings_' + opts.name + '.xml', reso, mode, target)
print "generate " + './graph_settings_' + opts.name + '.xml'
if __name__ == '__main__':
main(sys.argv)
| 42.270517
| 126
| 0.427698
|
d4f20f9e733fda7d345d8af585e5b9f2f67a3e42
| 602
|
tsx
|
TypeScript
|
packages/app/src/components/CodeTextarea.tsx
|
koredefashokun/coding-notes
|
e7d80ce1cd5d8cc27e6bcf716cec78a8b9d3178f
|
[
"MIT"
] | null | null | null |
packages/app/src/components/CodeTextarea.tsx
|
koredefashokun/coding-notes
|
e7d80ce1cd5d8cc27e6bcf716cec78a8b9d3178f
|
[
"MIT"
] | 17
|
2020-09-05T01:55:43.000Z
|
2022-02-26T01:38:21.000Z
|
packages/app/src/components/CodeTextarea.tsx
|
koredefashokun/coding-notes
|
e7d80ce1cd5d8cc27e6bcf716cec78a8b9d3178f
|
[
"MIT"
] | null | null | null |
import React from 'react';
import { highlight, languages } from 'prismjs';
import 'prismjs/components/prism-clike';
import 'prismjs/components/prism-javascript';
import 'prismjs/components/prism-markup';
import 'prismjs/themes/prism.css';
import { BlockCodeTextarea } from './elements';
interface CodeTextareaProps {
content: string;
onChange(content: string): void;
}
const CodeTextarea = ({ content, onChange }: CodeTextareaProps) => (
<BlockCodeTextarea
value={content}
onValueChange={onChange}
highlight={code => highlight(code, languages.js, 'js')}
/>
);
export default CodeTextarea;
| 26.173913
| 68
| 0.745847
|
da925e2763a2d822ae6f8a14f43696e1011bdc39
| 319
|
php
|
PHP
|
tests/Rules/Doctrine/ORM/data/EntityWithUnknownType.php
|
sasezaki/phpstan-doctrine
|
abf6068c9318735235c40ab6018e074352e92a55
|
[
"MIT"
] | 442
|
2017-01-31T00:00:31.000Z
|
2022-03-25T23:18:59.000Z
|
tests/Rules/Doctrine/ORM/data/EntityWithUnknownType.php
|
sasezaki/phpstan-doctrine
|
abf6068c9318735235c40ab6018e074352e92a55
|
[
"MIT"
] | 283
|
2017-03-10T02:31:50.000Z
|
2022-03-31T07:52:43.000Z
|
tests/Rules/Doctrine/ORM/data/EntityWithUnknownType.php
|
ruudk/phpstan-doctrine
|
f2a650cf667cb99bc4f595a32d370f4ad8e3c9ca
|
[
"MIT"
] | 88
|
2017-02-12T00:38:35.000Z
|
2022-02-08T11:35:16.000Z
|
<?php declare(strict_types = 1);
namespace PHPStan\Rules\Doctrine\ORM;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity()
*/
class EntityWithUnknownType
{
/**
* @ORM\Id()
* @ORM\Column(type="integer")
* @var int
*/
private $id;
/**
* @ORM\Column(type="unknown")
* @var int
*/
private $foo;
}
| 12.269231
| 37
| 0.601881
|
dde5f45006c86e3934af77d26aa864ed0975ae2d
| 681
|
java
|
Java
|
src/maven-repair/src/main/java/com/github/tdurieux/repair/maven/plugin/NPEFixMojo.java
|
zen93/repairnator
|
aa184717e6e755801572e9cf0bb7dde1a7591ead
|
[
"MIT"
] | 271
|
2018-04-06T10:47:52.000Z
|
2019-08-31T09:16:49.000Z
|
src/maven-repair/src/main/java/com/github/tdurieux/repair/maven/plugin/NPEFixMojo.java
|
zen93/repairnator
|
aa184717e6e755801572e9cf0bb7dde1a7591ead
|
[
"MIT"
] | 470
|
2018-02-01T15:32:38.000Z
|
2019-09-02T21:10:46.000Z
|
src/maven-repair/src/main/java/com/github/tdurieux/repair/maven/plugin/NPEFixMojo.java
|
zen93/repairnator
|
aa184717e6e755801572e9cf0bb7dde1a7591ead
|
[
"MIT"
] | 48
|
2019-09-08T09:51:24.000Z
|
2022-03-25T18:05:25.000Z
|
package com.github.tdurieux.repair.maven.plugin;
import fr.inria.spirals.repairnator.process.step.repair.NPERepair;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
@Mojo(name = "npefix", aggregator = true,
defaultPhase = LifecyclePhase.TEST,
requiresDependencyResolution = ResolutionScope.TEST)
public class NPEFixMojo extends AbstractNPEFixMojo {
public void execute() throws MojoExecutionException {
this.repairStep = new NPERepair();
super.execute();
}
}
| 32.428571
| 66
| 0.773862
|
e081bc21391286c713e957bc359844bcbd2c4dcf
| 13,238
|
h
|
C
|
freebsd3/sys/i386/include/asnames.h
|
MarginC/kame
|
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
|
[
"BSD-3-Clause"
] | 91
|
2015-01-05T15:18:31.000Z
|
2022-03-11T16:43:28.000Z
|
freebsd3/sys/i386/include/asnames.h
|
MarginC/kame
|
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
|
[
"BSD-3-Clause"
] | 1
|
2016-02-25T15:57:55.000Z
|
2016-02-25T16:01:02.000Z
|
freebsd3/sys/i386/include/asnames.h
|
MarginC/kame
|
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
|
[
"BSD-3-Clause"
] | 21
|
2015-02-07T08:23:07.000Z
|
2021-12-14T06:01:49.000Z
|
/*-
* Copyright (c) 1997 John D. Polstra
* 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 BY THE AUTHOR 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 AUTHOR 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.
*
* $Id: asnames.h,v 1.26.2.3 1999/02/25 14:36:28 bde Exp $
*/
#ifndef _MACHINE_ASNAMES_H_
#define _MACHINE_ASNAMES_H_
/*
* This file is used by the kernel assembly language sources to provide
* the proper mapping between the global names used in assembly language
* code and the corresponding C symbols. By convention, all C symbols
* that are referenced from assembly language are prefixed with `_'.
* That happens to be the same prefix that the a.out compiler attaches
* to each C symbol.
*
* When using the ELF compiler, C symbols are identical to the corresponding
* assembly language symbols. Thus the extra underscores cause problems.
* The defines in this file map the underscore names back to the proper
* unadorned names.
*
* Every global symbol that is referenced from both C source and assembly
* language source must have an entry in this file, or the kernel will
* not build properly using the ELF compiler.
*
* This file is included by <machine/asmacros.h>, and it is OK to rely
* on that.
*/
#ifdef __ELF__
#define _APTD APTD
#define _APTDpde APTDpde
#define _APTmap APTmap
#define _CONST_QNaN CONST_QNaN
#define _IdlePTD IdlePTD
#define _KPTphys KPTphys
#define _MP_GDT MP_GDT
#define _MPgetlock MPgetlock
#define _MPrellock MPrellock
#define _MPtrylock MPtrylock
#define _PTD PTD
#define _PTDpde PTDpde
#define _PTmap PTmap
#define _SMP_ioapic SMP_ioapic
#define _SMP_prvpt SMP_prvpt
#define _Xalign Xalign
#define _Xbnd Xbnd
#define _Xbpt Xbpt
#define _Xcpuast Xcpuast
#define _Xcpucheckstate Xcpucheckstate
#define _Xcpustop Xcpustop
#define _Xdbg Xdbg
#define _Xdiv Xdiv
#define _Xdna Xdna
#define _Xfastintr0 Xfastintr0
#define _Xfastintr1 Xfastintr1
#define _Xfastintr10 Xfastintr10
#define _Xfastintr11 Xfastintr11
#define _Xfastintr12 Xfastintr12
#define _Xfastintr13 Xfastintr13
#define _Xfastintr14 Xfastintr14
#define _Xfastintr15 Xfastintr15
#define _Xfastintr16 Xfastintr16
#define _Xfastintr17 Xfastintr17
#define _Xfastintr18 Xfastintr18
#define _Xfastintr19 Xfastintr19
#define _Xfastintr2 Xfastintr2
#define _Xfastintr20 Xfastintr20
#define _Xfastintr21 Xfastintr21
#define _Xfastintr22 Xfastintr22
#define _Xfastintr23 Xfastintr23
#define _Xfastintr3 Xfastintr3
#define _Xfastintr4 Xfastintr4
#define _Xfastintr5 Xfastintr5
#define _Xfastintr6 Xfastintr6
#define _Xfastintr7 Xfastintr7
#define _Xfastintr8 Xfastintr8
#define _Xfastintr9 Xfastintr9
#define _Xforward_irq Xforward_irq
#define _Xfpu Xfpu
#define _Xfpusegm Xfpusegm
#define _Xill Xill
#define _Xint0x80_syscall Xint0x80_syscall
#define _Xintr0 Xintr0
#define _Xintr1 Xintr1
#define _Xintr10 Xintr10
#define _Xintr11 Xintr11
#define _Xintr12 Xintr12
#define _Xintr13 Xintr13
#define _Xintr14 Xintr14
#define _Xintr15 Xintr15
#define _Xintr16 Xintr16
#define _Xintr17 Xintr17
#define _Xintr18 Xintr18
#define _Xintr19 Xintr19
#define _Xintr2 Xintr2
#define _Xintr20 Xintr20
#define _Xintr21 Xintr21
#define _Xintr22 Xintr22
#define _Xintr23 Xintr23
#define _Xintr3 Xintr3
#define _Xintr4 Xintr4
#define _Xintr5 Xintr5
#define _Xintr6 Xintr6
#define _Xintr7 Xintr7
#define _Xintr8 Xintr8
#define _Xintr8254 Xintr8254
#define _Xintr9 Xintr9
#define _XintrRTC XintrRTC
#define _Xinvltlb Xinvltlb
#define _Xmchk Xmchk
#define _Xmissing Xmissing
#define _Xnmi Xnmi
#define _Xofl Xofl
#define _Xpage Xpage
#define _Xprot Xprot
#define _Xrsvd Xrsvd
#define _Xspuriousint Xspuriousint
#define _Xstk Xstk
#define _Xsyscall Xsyscall
#define _Xtss Xtss
#define __default_ldt _default_ldt
#define __ucodesel _ucodesel
#define __udatasel _udatasel
#define _alltraps alltraps
#define _ap_init ap_init
#define _apic_base apic_base
#define _apic_id_to_logical apic_id_to_logical
#define _apic_imen apic_imen
#define _apic_isrbit_location apic_isrbit_location
#define _apic_pin_trigger apic_pin_trigger
#define _apm_addr apm_addr
#define _apm_bios_call apm_bios_call
#define _apm_cs16_base apm_cs16_base
#define _apm_cs16_limit apm_cs16_limit
#define _apm_cs32_base apm_cs32_base
#define _apm_cs32_limit apm_cs32_limit
#define _apm_cs_entry apm_cs_entry
#define _apm_cs_limit apm_cs_limit
#define _apm_current_gdt_pdesc apm_current_gdt_pdesc
#define _apm_ds_base apm_ds_base
#define _apm_ds_limit apm_ds_limit
#define _apm_flags apm_flags
#define _apm_init_image apm_init_image
#define _apm_init_image_size apm_init_image_size
#define _apm_setup apm_setup
#define _apm_version apm_version
#define _arith_invalid arith_invalid
#define _arith_overflow arith_overflow
#define _arith_underflow arith_underflow
#define _bcopy bcopy
#define _bcopy_vector bcopy_vector
#define _bigJump bigJump
#define _bio_imask bio_imask
#define _bluetrap bluetrap
#define _bootCodeSeg bootCodeSeg
#define _bootDataSeg bootDataSeg
#define _bootMP bootMP
#define _bootMP_size bootMP_size
#define _bootPTD bootPTD
#define _boot_get_mplock boot_get_mplock
#define _bootdev bootdev
#define _boothowto boothowto
#define _bootinfo bootinfo
#define _bootstrap_gdt bootstrap_gdt
#define _bzero bzero
#define _cam_imask cam_imask
#define _checkstate_cpus checkstate_cpus
#define _checkstate_cpustate checkstate_cpustate
#define _checkstate_curproc checkstate_curproc
#define _checkstate_need_ast checkstate_need_ast
#define _checkstate_pc checkstate_pc
#define _checkstate_pending_ast checkstate_pending_ast
#define _checkstate_probed_cpus checkstate_probed_cpus
#define _clock_lock clock_lock
#define _cnt cnt
#define _common_tss common_tss
#define _common_tssd common_tssd
#define _copyin_vector copyin_vector
#define _copyout_vector copyout_vector
#define _cpl cpl
#define _cpl_lock cpl_lock
#define _cpu cpu
#define _cpu0prvpage cpu0prvpage
#define _cpu0prvpt cpu0prvpt
#define _cpu_apic_versions cpu_apic_versions
#define _cpu_class cpu_class
#define _cpu_feature cpu_feature
#define _cpu_high cpu_high
#define _cpu_id cpu_id
#define _cpu_num_to_apic_id cpu_num_to_apic_id
#define _cpu_switch cpu_switch
#define _cpu_vendor cpu_vendor
#define _cpuid cpuid
#define _curpcb curpcb
#define _curproc curproc
#define _currentldt currentldt
#define _cypoll cypoll
#define _default_halt default_halt
#define _denormal_operand denormal_operand
#define _div_small div_small
#define _divide_by_zero divide_by_zero
#define _divide_kernel divide_kernel
#define _do_page_zero_idle do_page_zero_idle
#define _edata edata
#define _eintrcnt eintrcnt
#define _eintrnames eintrnames
#define _end end
#define _etext etext
#define _exception exception
#define _fast_intr_lock fast_intr_lock
#define _fastmove fastmove
#define _gdt gdt
#define _generic_bcopy generic_bcopy
#define _generic_bzero generic_bzero
#define _generic_copyin generic_copyin
#define _generic_copyout generic_copyout
#define _get_align_lock get_align_lock
#define _get_altsyscall_lock get_altsyscall_lock
#define _get_fpu_lock get_fpu_lock
#define _get_isrlock get_isrlock
#define _get_mplock get_mplock
#define _get_syscall_lock get_syscall_lock
#define _getmicrouptime getmicrouptime
#define _idqs idqs
#define _ihandlers ihandlers
#define _imen imen
#define _imen_lock imen_lock
#define _in_vm86call in_vm86call
#define _init386 init386
#define _init_secondary init_secondary
#define _initial_bioscalls initial_bioscalls
#define _inside_intr inside_intr
#define _intr_countp intr_countp
#define _intr_handler intr_handler
#define _intr_mask intr_mask
#define _intr_nesting_level intr_nesting_level
#define _intr_unit intr_unit
#define _intrcnt intrcnt
#define _intrnames intrnames
#define _invltlb_ok invltlb_ok
#define _ioapic ioapic
#define _ipending ipending
#define _isr_lock isr_lock
#define _ivectors ivectors
#define _kernelname kernelname
#define _kstack kstack
#define _lapic lapic
#define _linux_sigcode linux_sigcode
#define _linux_szsigcode linux_szsigcode
#define _main main
#define _mask8254 mask8254
#define _maskRTC maskRTC
#define _microuptime microuptime
#define _mp_gdtbase mp_gdtbase
#define _mp_lock mp_lock
#define _mp_ncpus mp_ncpus
#define _mul64 mul64
#define _my_idlePTD my_idlePTD
#define _my_tr my_tr
#define _net_imask net_imask
#define _netisr netisr
#define _netisrs netisrs
#define _nfs_diskless nfs_diskless
#define _nfs_diskless_valid nfs_diskless_valid
#define _normalize normalize
#define _normalize_nuo normalize_nuo
#define _npx_intrs_while_probing npx_intrs_while_probing
#define _npx_traps_while_probing npx_traps_while_probing
#define _npxintr npxintr
#define _npxproc npxproc
#define _npxsave npxsave
#define _other_cpus other_cpus
#define _ovbcopy_vector ovbcopy_vector
#define _panic panic
#define _pc98_system_parameter pc98_system_parameter
#define _poly_div16 poly_div16
#define _poly_div2 poly_div2
#define _poly_div4 poly_div4
#define _polynomial polynomial
#define _private_tss private_tss
#define _probeintr probeintr
#define _probetrap probetrap
#define _proc0 proc0
#define _proc0paddr proc0paddr
#define _prv_CMAP1 prv_CMAP1
#define _prv_CMAP2 prv_CMAP2
#define _prv_CMAP3 prv_CMAP3
#define _prv_PMAP1 prv_PMAP1
#define _prv_CPAGE1 prv_CPAGE1
#define _prv_CPAGE2 prv_CPAGE2
#define _prv_CPAGE3 prv_CPAGE3
#define _prv_PPAGE1 prv_PPAGE1
#define _qs qs
#define _rcpoll rcpoll
#define _real_2op_NaN real_2op_NaN
#define _reg_div reg_div
#define _reg_u_add reg_u_add
#define _reg_u_div reg_u_div
#define _reg_u_mul reg_u_mul
#define _reg_u_sub reg_u_sub
#define _rel_mplock rel_mplock
#define _round_reg round_reg
#define _rtqs rtqs
#define _s_lock s_lock
#define _s_unlock s_unlock
#define _secondary_main secondary_main
#define _set_precision_flag_down set_precision_flag_down
#define _set_precision_flag_up set_precision_flag_up
#define _set_user_ldt set_user_ldt
#define _shrx shrx
#define _shrxs shrxs
#define _sigcode sigcode
#define _siopoll siopoll
#define _smp_active smp_active
#define _soft_imask soft_imask
#define _softclock softclock
#define _softnet_imask softnet_imask
#define _softtty_imask softtty_imask
#define _spl0 spl0
#define _splz splz
#define _ss_lock ss_lock
#define _ss_unlock ss_unlock
#define _started_cpus started_cpus
#define _stopped_cpus stopped_cpus
#define _swi_dispatcher swi_dispatcher
#define _swi_generic swi_generic
#define _swi_null swi_null
#define _swi_vm swi_vm
#define _switchticks switchticks
#define _switchtime switchtime
#define _syscall syscall
#define _szsigcode szsigcode
#define _ticks ticks
#define _time time
#define _timer0_max_count timer0_max_count
#define _timer0_overflow_threshold timer0_overflow_threshold
#define _timer0_prescaler_count timer0_prescaler_count
#define _trap trap
#define _trap_by_wrmsr trap_by_wrmsr
#define _trapwrite trapwrite
#define _tsc_bias tsc_bias
#define _tsc_freq tsc_freq
#define _tsc_multiplier tsc_multiplier
#define _tty_imask tty_imask
#define _userconfig_from_boot userconfig_from_boot
#define _vec vec
#define _vec8254 vec8254
#define _vecRTC vecRTC
#define _vm86_emulate vm86_emulate
#define _vm86_prepcall vm86_prepcall
#define _vm86_sysarch vm86_sysarch
#define _vm86_trap vm86_trap
#define _vm86pa vm86pa
#define _vm86paddr vm86paddr
#define _vm86pcb vm86pcb
#define _vm_page_zero_idle vm_page_zero_idle
#define _want_resched want_resched
#define _whichidqs whichidqs
#define _whichqs whichqs
#define _whichrtqs whichrtqs
#define _wm_sqrt wm_sqrt
#endif /* __ELF__ */
#endif /* !_MACHINE_ASNAMES_H_ */
| 33.856777
| 77
| 0.801481
|
6385d22de1789b1a0435f0b5bb5330d53f4aedf8
| 7,117
|
rs
|
Rust
|
flash-lso/src/types.rs
|
CUB3D/rust-sol
|
1af96043e752145893da4a9754d92d3c7b6b749f
|
[
"MIT"
] | 7
|
2020-06-27T09:24:02.000Z
|
2021-05-07T09:31:25.000Z
|
flash-lso/src/types.rs
|
CUB3D/rust-sol
|
1af96043e752145893da4a9754d92d3c7b6b749f
|
[
"MIT"
] | 6
|
2021-06-20T21:37:12.000Z
|
2022-01-05T02:52:42.000Z
|
flash-lso/src/types.rs
|
CUB3D/rust-sol
|
1af96043e752145893da4a9754d92d3c7b6b749f
|
[
"MIT"
] | 3
|
2021-07-22T08:07:18.000Z
|
2021-08-09T11:56:57.000Z
|
use cookie_factory::lib::std::fmt::Formatter;
use core::fmt;
use derive_try_from_primitive::TryFromPrimitive;
use enumset::EnumSet;
use enumset::EnumSetType;
use nom::lib::std::iter::FromIterator;
use std::ops::Deref;
use std::rc::Rc;
/// A container for lso files
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, PartialEq, Clone)]
pub struct Lso {
/// The header of this lso
pub header: Header,
/// The elements at the root level of this lso
pub body: Vec<Element>,
}
impl Lso {
/// Create a new Lso with a header with the given name and version and an empty body
#[inline]
pub fn new_empty(name: impl Into<String>, version: AMFVersion) -> Self {
Self::new(Vec::new(), name, version)
}
/// Crate a new Lso with a header with the given name, version and body
#[inline]
pub fn new(body: Vec<Element>, name: impl Into<String>, version: AMFVersion) -> Self {
Self {
header: Header::new(name, version),
body,
}
}
}
impl IntoIterator for Lso {
type Item = Element;
type IntoIter = std::vec::IntoIter<Self::Item>;
fn into_iter(self) -> Self::IntoIter {
self.body.into_iter()
}
}
/// The version of AMF being used
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(TryFromPrimitive, Eq, PartialEq, Debug, Copy, Clone)]
#[repr(u8)]
pub enum AMFVersion {
/// AMF0
AMF0 = 0,
/// AMF3
AMF3 = 3,
}
impl fmt::Display for AMFVersion {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
AMFVersion::AMF0 => f.write_str("AMF0"),
AMFVersion::AMF3 => f.write_str("AMF3"),
}
}
}
/// The header of a lso file
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, PartialEq, Clone)]
pub struct Header {
/// The length of the lso in bytes
pub length: u32,
/// The name of the lso file
pub name: String,
/// The version of AMF used to encode the data
pub format_version: AMFVersion,
}
impl Header {
/// Create a new header with the given name and version, will have a size of 0 by default
#[inline]
pub fn new(name: impl Into<String>, version: AMFVersion) -> Self {
Self {
length: 0,
name: name.into(),
format_version: version,
}
}
}
/// Represent a named element
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, PartialEq)]
pub struct Element {
/// The name of the element
pub name: String,
/// The value of the element
pub value: Rc<Value>,
}
impl Element {
/// Create a new Element
#[inline]
pub fn new(name: impl Into<String>, value: impl Into<Value>) -> Self {
Self {
name: name.into(),
value: Rc::new(value.into()),
}
}
/// Get the Value of this element
pub fn value(&self) -> &Value {
self.value.deref()
}
/// Get the name of this element
pub fn name(&self) -> &str {
self.name.as_str()
}
}
//TODO: should amf3 assoc arrays be their own type with a dense and assoc section
/// A single or compound value
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq)]
pub enum Value {
/// Represent the type number (amf0) and double (amf3)
Number(f64),
/// Represents the type boolean (amf0) and both the true/false type (amf3)
Bool(bool),
/// Represent both the string (amf0/3) and long string type (amf0)
String(String),
/// Represents the object type in both amf0 and amf3, class definition are only available with amf3
Object(Vec<Element>, Option<ClassDefinition>),
/// Represent the null type
Null,
/// Represent the undefined type
Undefined,
/// Represent ECMA-Arrays (amf0) and associative arrays (amf3, even if they contain a dense part)
/// Final value represents the length of the array in amf0, this can differ from the actual number of elements
ECMAArray(Vec<Rc<Value>>, Vec<Element>, u32),
/// Represent a strict array (amf0) or a dense array (amf3)
StrictArray(Vec<Rc<Value>>),
/// Represent a timezone in the format (seconds since epoch, timezone or UTC if missing (amf3) )
Date(f64, Option<u16>),
/// Represent the unsupported type
Unsupported,
/// Represent the XML type, (value, is_string)
XML(String, bool),
/// Represent an amf3 element embedded in an AMF0 file
AMF3(Rc<Value>),
// AMF3
/// Represent the integer type (u29) (amf3)
Integer(i32),
/// Represent the bytearray type (amf3)
ByteArray(Vec<u8>),
/// Represent the int vector type (amf3)
/// Format is (values, is_fixed_length)
VectorInt(Vec<i32>, bool),
/// Represent the unsigned int vector type (amf3)
/// Format is (values, is_fixed_length)
VectorUInt(Vec<u32>, bool),
/// Represent the double vector type (amf3)
/// Format is (values, is_fixed_length)
VectorDouble(Vec<f64>, bool),
/// Represent the object vector type (amf3)
/// Format is (values, is_fixed_length)
VectorObject(Vec<Rc<Value>>, String, bool),
/// Represent the dictionary type (amf3)
/// Format is ((key, value), has_weak_keys)
Dictionary(Vec<(Rc<Value>, Rc<Value>)>, bool),
/// Represent a external object, such as from flex
/// (custom_elements, regular elements, class def)
Custom(Vec<Element>, Vec<Element>, Option<ClassDefinition>),
}
impl FromIterator<Value> for Vec<Rc<Value>> {
fn from_iter<T: IntoIterator<Item = Value>>(iter: T) -> Self {
iter.into_iter().map(Rc::new).collect()
}
}
/// A class definition (trait) used in AMF3
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ClassDefinition {
/// The name of the class definition
pub name: String,
/// The attributes on this trait
pub attributes: EnumSet<Attribute>,
/// The name of the static properties defined in this definition
pub static_properties: Vec<String>,
}
impl Default for ClassDefinition {
fn default() -> Self {
Self {
name: "Object".to_string(),
attributes: EnumSet::empty(),
static_properties: Vec::new(),
}
}
}
impl ClassDefinition {
/// Creates a new ClassDefinition with the given name, and no attributes or properties
pub fn default_with_name(name: String) -> Self {
Self {
name,
attributes: EnumSet::empty(),
static_properties: Vec::new(),
}
}
}
/// Encodes the possible attributes that can be given to a trait
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(EnumSetType, Debug)]
pub enum Attribute {
/// If a trait is dynamic then the object it constructs may have additional properties other than the ones specified in the trait
Dynamic,
/// If a trait is external then it requires custom serialization and deserialization support
External,
}
| 31.772321
| 133
| 0.640017
|
cd7d8be92a93012291ce29107b7de446b7e87661
| 297
|
asm
|
Assembly
|
libsrc/_DEVELOPMENT/adt/b_array/c/sccz80/b_array_insert_n_callee.asm
|
teknoplop/z88dk
|
bb03fbfd6b2ab0f397a1358559089f9cd3706485
|
[
"ClArtistic"
] | 8
|
2017-01-18T12:02:17.000Z
|
2021-06-12T09:40:28.000Z
|
libsrc/_DEVELOPMENT/adt/b_array/c/sccz80/b_array_insert_n_callee.asm
|
teknoplop/z88dk
|
bb03fbfd6b2ab0f397a1358559089f9cd3706485
|
[
"ClArtistic"
] | 1
|
2017-03-06T07:41:56.000Z
|
2017-03-06T07:41:56.000Z
|
libsrc/_DEVELOPMENT/adt/b_array/c/sccz80/b_array_insert_n_callee.asm
|
teknoplop/z88dk
|
bb03fbfd6b2ab0f397a1358559089f9cd3706485
|
[
"ClArtistic"
] | 3
|
2017-03-07T03:19:40.000Z
|
2021-09-15T17:59:19.000Z
|
; size_t b_array_insert_n(b_array_t *a, size_t idx, size_t n, int c)
SECTION code_clib
SECTION code_adt_b_array
PUBLIC b_array_insert_n_callee
EXTERN asm_b_array_insert_n
b_array_insert_n_callee:
pop hl
pop de
ld a,e
pop de
pop bc
ex (sp),hl
jp asm_b_array_insert_n
| 14.142857
| 68
| 0.744108
|
9a424edee06322be99676be26eddc232c7cca6c0
| 3,887
|
sql
|
SQL
|
sql/core/src/test/resources/tpcds/q5.sql
|
wangyixiaohuihui/spark2-annotation
|
25fe53ac7167275114a1ef0be802db92a7010ec8
|
[
"BSD-3-Clause-Open-MPI",
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"MIT-0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause-Clear",
"PostgreSQL",
"BSD-3-Clause"
] | null | null | null |
sql/core/src/test/resources/tpcds/q5.sql
|
wangyixiaohuihui/spark2-annotation
|
25fe53ac7167275114a1ef0be802db92a7010ec8
|
[
"BSD-3-Clause-Open-MPI",
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"MIT-0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause-Clear",
"PostgreSQL",
"BSD-3-Clause"
] | null | null | null |
sql/core/src/test/resources/tpcds/q5.sql
|
wangyixiaohuihui/spark2-annotation
|
25fe53ac7167275114a1ef0be802db92a7010ec8
|
[
"BSD-3-Clause-Open-MPI",
"PSF-2.0",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"MIT-0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause-Clear",
"PostgreSQL",
"BSD-3-Clause"
] | null | null | null |
WITH ssr AS
( SELECT
s_store_id,
sum(sales_price) AS sales,
sum(profit) AS profit,
sum(return_amt) AS RETURNS,
sum(net_loss) AS profit_loss
FROM
(SELECT
ss_store_sk AS store_sk,
ss_sold_date_sk AS date_sk,
ss_ext_sales_price AS sales_price,
ss_net_profit AS profit,
cast(0 AS DECIMAL(7, 2)) AS return_amt,
cast(0 AS DECIMAL(7, 2)) AS net_loss
FROM store_sales
UNION ALL
SELECT
sr_store_sk AS store_sk,
sr_returned_date_sk AS date_sk,
cast(0 AS DECIMAL(7, 2)) AS sales_price,
cast(0 AS DECIMAL(7, 2)) AS profit,
sr_return_amt AS return_amt,
sr_net_loss AS net_loss
FROM store_returns)
salesreturns, date_dim, store
WHERE date_sk = d_date_sk
AND d_date BETWEEN cast('2000-08-23' AS DATE)
AND ((cast('2000-08-23' AS DATE) + INTERVAL 14 days))
AND store_sk = s_store_sk
GROUP BY s_store_id),
csr AS
( SELECT
cp_catalog_page_id,
sum(sales_price) AS sales,
sum(profit) AS profit,
sum(return_amt) AS RETURNS,
sum(net_loss) AS profit_loss
FROM
(SELECT
cs_catalog_page_sk AS page_sk,
cs_sold_date_sk AS date_sk,
cs_ext_sales_price AS sales_price,
cs_net_profit AS profit,
cast(0 AS DECIMAL(7, 2)) AS return_amt,
cast(0 AS DECIMAL(7, 2)) AS net_loss
FROM catalog_sales
UNION ALL
SELECT
cr_catalog_page_sk AS page_sk,
cr_returned_date_sk AS date_sk,
cast(0 AS DECIMAL(7, 2)) AS sales_price,
cast(0 AS DECIMAL(7, 2)) AS profit,
cr_return_amount AS return_amt,
cr_net_loss AS net_loss
FROM catalog_returns
) salesreturns, date_dim, catalog_page
WHERE date_sk = d_date_sk
AND d_date BETWEEN cast('2000-08-23' AS DATE)
AND ((cast('2000-08-23' AS DATE) + INTERVAL 14 days))
AND page_sk = cp_catalog_page_sk
GROUP BY cp_catalog_page_id)
,
wsr AS
( SELECT
web_site_id,
sum(sales_price) AS sales,
sum(profit) AS profit,
sum(return_amt) AS RETURNS,
sum(net_loss) AS profit_loss
FROM
(SELECT
ws_web_site_sk AS wsr_web_site_sk,
ws_sold_date_sk AS date_sk,
ws_ext_sales_price AS sales_price,
ws_net_profit AS profit,
cast(0 AS DECIMAL(7, 2)) AS return_amt,
cast(0 AS DECIMAL(7, 2)) AS net_loss
FROM web_sales
UNION ALL
SELECT
ws_web_site_sk AS wsr_web_site_sk,
wr_returned_date_sk AS date_sk,
cast(0 AS DECIMAL(7, 2)) AS sales_price,
cast(0 AS DECIMAL(7, 2)) AS profit,
wr_return_amt AS return_amt,
wr_net_loss AS net_loss
FROM web_returns
LEFT OUTER JOIN web_sales ON
(wr_item_sk = ws_item_sk
AND wr_order_number = ws_order_number)
) salesreturns, date_dim, web_site
WHERE date_sk = d_date_sk
AND d_date BETWEEN cast('2000-08-23' AS DATE)
AND ((cast('2000-08-23' AS DATE) + INTERVAL 14 days))
AND wsr_web_site_sk = web_site_sk
GROUP BY web_site_id)
SELECT
channel,
id,
sum(sales) AS sales,
sum(returns) AS returns,
sum(profit) AS profit
FROM
(SELECT
'store channel' AS channel,
concat('store', s_store_id) AS id,
sales,
returns,
(profit - profit_loss) AS profit
FROM ssr
UNION ALL
SELECT
'catalog channel' AS channel,
concat('catalog_page', cp_catalog_page_id) AS id,
sales,
returns,
(profit - profit_loss) AS profit
FROM csr
UNION ALL
SELECT
'web channel' AS channel,
concat('web_site', web_site_id) AS id,
sales,
returns,
(profit - profit_loss) AS profit
FROM wsr
) x
GROUP BY ROLLUP (channel, id)
ORDER BY channel, id
LIMIT 100
| 29.44697
| 76
| 0.627219
|
20c74354f7c2c5c82f2eeb3ec6c6297a6628a0ed
| 1,282
|
cs
|
C#
|
Operators/Types/BoolToFloats.cs
|
still-scene/t3
|
22dd85b3084dd04ca449ac08db5d0eb5967041bc
|
[
"MIT"
] | 23
|
2021-06-10T00:22:37.000Z
|
2022-03-17T00:22:13.000Z
|
Operators/Types/BoolToFloats.cs
|
still-scene/t3
|
22dd85b3084dd04ca449ac08db5d0eb5967041bc
|
[
"MIT"
] | 5
|
2021-07-17T15:01:48.000Z
|
2022-02-17T21:05:07.000Z
|
Operators/Types/BoolToFloats.cs
|
still-scene/t3
|
22dd85b3084dd04ca449ac08db5d0eb5967041bc
|
[
"MIT"
] | 3
|
2021-06-04T18:56:11.000Z
|
2021-09-06T16:08:41.000Z
|
using System.Collections.Generic;
using T3.Core.Logging;
using T3.Core.Operator;
using T3.Core.Operator.Attributes;
using T3.Core.Operator.Slots;
namespace T3.Operators.Types.Id_9db2fcbf_54b9_4222_878b_80d1a0dc6edf
{
public class BoolToFloats : Instance<BoolToFloats>
{
[Output(Guid = "F0321A54-E844-482F-A161-7F137ABC54B0")]
public readonly Slot<float> Result = new Slot<float>();
public BoolToFloats()
{
Result.UpdateAction = Update;
}
private void Update(EvaluationContext context)
{
var trueValue = ForTrue.GetValue(context);
var falseValue = ForFalse.GetValue(context);
Result.Value = BoolValue.GetValue(context)
? trueValue
: falseValue;
}
[Input(Guid = "253b9ae4-fac5-4641-bf0c-d8614606a840")]
public readonly InputSlot<bool> BoolValue = new InputSlot<bool>();
[Input(Guid = "24FFA0A7-9195-4B38-9C88-37CF4C3AFC36")]
public readonly InputSlot<float> ForFalse = new InputSlot<float>();
[Input(Guid = "0A53A4FF-4DFB-455A-B70B-0D7EED5E5F22")]
public readonly InputSlot<float> ForTrue = new InputSlot<float>();
}
}
| 34.648649
| 75
| 0.620905
|
f5f919da40d3edf74dbab3c2b88118c3af6dae42
| 80
|
css
|
CSS
|
packages/client/src/styles/bxicons/index.css
|
Romakita/ts-gphoto-driver
|
38c18069c151e767b2a83fa2fd2b1af1df368953
|
[
"MIT"
] | 7
|
2021-05-13T16:06:53.000Z
|
2022-02-07T16:17:10.000Z
|
packages/client/src/styles/bxicons/index.css
|
Romakita/ts-gphoto-driver
|
38c18069c151e767b2a83fa2fd2b1af1df368953
|
[
"MIT"
] | 43
|
2021-06-01T08:10:37.000Z
|
2022-03-28T09:30:29.000Z
|
packages/shared/src/styles/fonts/bxicons/index.css
|
tsedio/tsed-example-formio
|
840d70b7b670c0927529218de0c33f10b7d1eace
|
[
"Unlicense",
"MIT"
] | 4
|
2021-07-22T14:26:51.000Z
|
2022-02-02T21:54:47.000Z
|
@import "boxicons.css";
@import "animations.css";
@import "transformations.css";
| 26.666667
| 30
| 0.75
|
79ea6804cca8aa9bc42b74b00cebe388d964cf92
| 2,553
|
php
|
PHP
|
src/OpenConext/Value/Assert/Assertion.php
|
OpenConext/SamlValueObject
|
cb1f17e18b7964b53954de0754bc1ff569b967b2
|
[
"Apache-2.0"
] | null | null | null |
src/OpenConext/Value/Assert/Assertion.php
|
OpenConext/SamlValueObject
|
cb1f17e18b7964b53954de0754bc1ff569b967b2
|
[
"Apache-2.0"
] | 10
|
2015-12-18T12:35:07.000Z
|
2018-01-22T09:37:37.000Z
|
src/OpenConext/Value/Assert/Assertion.php
|
OpenConext/SamlValueObject
|
cb1f17e18b7964b53954de0754bc1ff569b967b2
|
[
"Apache-2.0"
] | 2
|
2016-10-19T14:38:29.000Z
|
2017-06-11T09:46:54.000Z
|
<?php
namespace OpenConext\Value\Assert;
use Assert\Assertion as BaseAssertion;
/**
* @method static void nullOrNonEmptyString($value, $message = null, $propertyPath = null)
* @method static void allNonEmptyString($value, $message = null, $propertyPath = null)
* @method static void allValidRegularExpression($value, $message = null, $propertyPath = null)
* @method static void allKeysExist($value, $data, $message = null, $propertyPath = null)
*/
class Assertion extends BaseAssertion
{
const INVALID_NON_EMPTY_STRING = 501;
const INVALID_REGULAR_EXPRESSION = 502;
const INVALID_CALLABLE = 503;
protected static $exceptionClass = 'OpenConext\Value\Exception\InvalidArgumentException';
/**
* @param string $value
* @param string $propertyPath
* @return void
*/
public static function nonEmptyString($value, $propertyPath)
{
if (!is_string($value) || trim($value) === '') {
$message = 'Expected non-empty string for "%s", "%s" given';
throw static::createException(
$value,
sprintf($message, $propertyPath, static::stringify($value)),
static::INVALID_NON_EMPTY_STRING,
$propertyPath
);
}
}
/**
* @param $regularExpression
* @param $propertyPath
* @return void
*/
public static function validRegularExpression($regularExpression, $propertyPath)
{
$pregMatchErrored = false;
set_error_handler(
function () use (&$pregMatchErrored) {
$pregMatchErrored = true;
}
);
preg_match($regularExpression, 'some test string');
restore_error_handler();
if ($pregMatchErrored || preg_last_error()) {
throw static::createException(
$regularExpression,
sprintf('The pattern "%s" is not a valid regular expression', self::stringify($regularExpression)),
static::INVALID_REGULAR_EXPRESSION,
$propertyPath
);
}
}
/**
* @param array $requiredKeys
* @param array $value
* @param null|string $message
* @param null|string $propertyPath
* @return void
*/
public static function keysExist(array $value, array $requiredKeys, $message = null, $propertyPath = null)
{
foreach ($requiredKeys as $requiredKey) {
self::keyExists($value, $requiredKey, $message, $propertyPath);
}
}
}
| 31.134146
| 115
| 0.603995
|
5cb4777556509203209a680424d218a7bc3a4205
| 2,908
|
rs
|
Rust
|
src/view/src/render_context.rs
|
MitMaro/git-rebase-tool
|
ab4627c6f770c94658f030eaa3a93d9ba33b91ea
|
[
"DOC"
] | 2
|
2016-12-21T19:04:25.000Z
|
2016-12-22T19:20:45.000Z
|
src/view/src/render_context.rs
|
MitMaro/git-rebase-tool
|
ab4627c6f770c94658f030eaa3a93d9ba33b91ea
|
[
"DOC"
] | null | null | null |
src/view/src/render_context.rs
|
MitMaro/git-rebase-tool
|
ab4627c6f770c94658f030eaa3a93d9ba33b91ea
|
[
"DOC"
] | null | null | null |
const MINIMUM_WINDOW_HEIGHT: usize = 5; // title + pad top + line + pad bottom + help
const MINIMUM_COMPACT_WINDOW_WIDTH: usize = 20; // ">s ccc mmmmmmmmmmmmm".len()
const MINIMUM_FULL_WINDOW_WIDTH: usize = 34; // " > squash cccccccc mmmmmmmmmmmmm %".len()
/// Represents data associated with rendering content.
#[derive(Debug, Copy, Clone)]
pub struct RenderContext {
height: usize,
width: usize,
}
impl RenderContext {
/// Create a new instance with a width and height.
#[must_use]
#[inline]
pub const fn new(width: usize, height: usize) -> Self {
Self { height, width }
}
/// Update the recorded width and height.
#[inline]
pub fn update(&mut self, width: u16, height: u16) {
self.width = width as usize;
self.height = height as usize;
}
/// Get the width of the terminal window.
#[must_use]
#[inline]
pub const fn width(&self) -> usize {
self.width
}
/// Get the height of the terminal window.
#[must_use]
#[inline]
pub const fn height(&self) -> usize {
self.height
}
/// Is the terminal window width at least the minimal supported width.
#[must_use]
#[inline]
pub const fn is_minimum_view_width(&self) -> bool {
self.width > MINIMUM_COMPACT_WINDOW_WIDTH
}
/// Is the terminal window height at least the minimal supported height.
#[must_use]
#[inline]
pub const fn is_minimum_view_height(&self) -> bool {
self.height > MINIMUM_WINDOW_HEIGHT
}
/// Is the terminal window large enough to render lines using their full width.
#[must_use]
#[inline]
pub const fn is_full_width(&self) -> bool {
self.width >= MINIMUM_FULL_WINDOW_WIDTH
}
/// Is the terminal window too small to render content.
#[must_use]
#[inline]
pub const fn is_window_too_small(&self) -> bool {
!self.is_minimum_view_width() || !self.is_minimum_view_height()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn update() {
let mut context = RenderContext { width: 10, height: 20 };
context.update(100, 200);
assert_eq!(context.width(), 100);
assert_eq!(context.height(), 200);
}
#[test]
fn is_window_too_small_width_too_small() {
let context = RenderContext {
width: MINIMUM_COMPACT_WINDOW_WIDTH,
height: MINIMUM_WINDOW_HEIGHT + 1,
};
assert!(context.is_window_too_small());
}
#[test]
fn is_window_too_small_height_too_small() {
let context = RenderContext {
width: MINIMUM_COMPACT_WINDOW_WIDTH + 1,
height: MINIMUM_WINDOW_HEIGHT,
};
assert!(context.is_window_too_small());
}
#[test]
fn is_window_too_small_height_and_width_too_small() {
let context = RenderContext {
width: MINIMUM_COMPACT_WINDOW_WIDTH,
height: MINIMUM_WINDOW_HEIGHT,
};
assert!(context.is_window_too_small());
}
#[test]
fn is_window_too_small_width_and_height_large() {
let context = RenderContext {
width: MINIMUM_COMPACT_WINDOW_WIDTH + 1,
height: MINIMUM_WINDOW_HEIGHT + 1,
};
assert!(!context.is_window_too_small());
}
}
| 24.644068
| 90
| 0.705296
|
ef34f45ef958972a6e88d41df655b929f587c231
| 615
|
h
|
C
|
DetectorDescription/Parser/src/DDLTrapezoid.h
|
ckamtsikis/cmssw
|
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
|
[
"Apache-2.0"
] | 852
|
2015-01-11T21:03:51.000Z
|
2022-03-25T21:14:00.000Z
|
DetectorDescription/Parser/src/DDLTrapezoid.h
|
ckamtsikis/cmssw
|
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
|
[
"Apache-2.0"
] | 30,371
|
2015-01-02T00:14:40.000Z
|
2022-03-31T23:26:05.000Z
|
DetectorDescription/Parser/src/DDLTrapezoid.h
|
ckamtsikis/cmssw
|
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
|
[
"Apache-2.0"
] | 3,240
|
2015-01-02T05:53:18.000Z
|
2022-03-31T17:24:21.000Z
|
#ifndef DDLTRAPEZOID_H
#define DDLTRAPEZOID_H
#include <string>
#include <vector>
#include "DDLSolid.h"
class DDCompactView;
class DDLElementRegistry;
/** @class DDLTrapezoid
* @author Michael Case
*
* DDLTrapezoid.h - description
* -------------------
* begin: Mon Oct 29 2001
* email: case@ucdhep.ucdavis.edu
*
* Trapezoid processor processes Trapezoid and Trd1 DDL elements.
*
*/
class DDLTrapezoid final : public DDLSolid {
public:
DDLTrapezoid(DDLElementRegistry* myreg);
void processElement(const std::string& name, const std::string& nmspace, DDCompactView& cpv) override;
};
#endif
| 20.5
| 104
| 0.715447
|
bc6b48fabe5440fec4929840fffab025935557ec
| 1,757
|
swift
|
Swift
|
Alto/Horizontal.swift
|
marcbaldwin/Alto
|
57ae09bf025f1835594eca9cab9cc5aae8285728
|
[
"MIT"
] | 3
|
2016-02-27T11:29:49.000Z
|
2018-10-06T02:04:00.000Z
|
Alto/Horizontal.swift
|
marcbaldwin/Alto
|
57ae09bf025f1835594eca9cab9cc5aae8285728
|
[
"MIT"
] | null | null | null |
Alto/Horizontal.swift
|
marcbaldwin/Alto
|
57ae09bf025f1835594eca9cab9cc5aae8285728
|
[
"MIT"
] | null | null | null |
import Foundation
public enum Horizontal {
case centerX, left, right, leading, trailing
}
extension Horizontal: SingleOffset, SingleAttribute {
var nsAttribute: NSLayoutConstraint.Attribute {
switch self {
case .centerX: return .centerX
case .left: return .left
case .right: return .right
case .leading: return .leading
case .trailing: return .trailing
}
}
}
public extension UIView {
@discardableResult
func set(_ attr1: Horizontal, _ relation: Relation, _ view: UIView, _ attr2: Horizontal, priority: Priority? = nil, isActive: Bool = true) -> NSLayoutConstraint {
return NSLayoutConstraint(self, attr1, relation, view, attr2, priority: priority, isActive: isActive)
}
@discardableResult
func set(_ attr1: Horizontal, _ relation: Relation, _ view: UIView, _ attr2: MultiplierOffset<Horizontal>, priority: Priority? = nil, isActive: Bool = true) -> NSLayoutConstraint {
return NSLayoutConstraint(self, attr1, relation, view, attr2, priority: priority, isActive: isActive)
}
}
public extension Array where Element: UIView {
@discardableResult
func set(_ attr1: Horizontal, _ relation: Relation, _ view: UIView, _ attr2: Horizontal, priority: Priority? = nil, isActive: Bool = true) -> [NSLayoutConstraint] {
return map { $0.set(attr1, relation, view, attr2, priority: priority, isActive: isActive) }
}
@discardableResult
func set(_ attr1: Horizontal, _ relation: Relation, _ view: UIView, _ attr2: MultiplierOffset<Horizontal>, priority: Priority? = nil, isActive: Bool = true) -> [NSLayoutConstraint] {
return map { $0.set(attr1, relation, view, attr2, priority: priority, isActive: isActive) }
}
}
| 39.044444
| 186
| 0.692658
|
a10476d3a2408fc8d5a20ef185d29f646a533c6e
| 11,137
|
cpp
|
C++
|
lugre/src/lugre_camera_L.cpp
|
ghoulsblade/vegaogre
|
2ece3b799f9bd667f081d47c1a0f3ef5e78d3e0f
|
[
"MIT"
] | 1
|
2020-10-18T14:33:05.000Z
|
2020-10-18T14:33:05.000Z
|
lugre/src/lugre_camera_L.cpp
|
ghoulsblade/vegaogre
|
2ece3b799f9bd667f081d47c1a0f3ef5e78d3e0f
|
[
"MIT"
] | null | null | null |
lugre/src/lugre_camera_L.cpp
|
ghoulsblade/vegaogre
|
2ece3b799f9bd667f081d47c1a0f3ef5e78d3e0f
|
[
"MIT"
] | null | null | null |
#include "lugre_prefix.h"
#include "lugre_luabind.h"
#include "lugre_luabind_direct.h"
#include "lugre_luabind_ogrehelper.h"
#include "lugre_camera.h"
#include "lugre_ogrewrapper.h"
#include "lugre_scripting.h"
#include <Ogre.h>
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
using namespace Ogre;
class lua_State;
namespace Lugre {
/// todo : port existing cam completely to this system ?
cCamera::cCamera (Ogre::Camera* pCam) : mpCam(pCam) {}
cCamera::cCamera (Ogre::SceneManager* pSceneMgr,const char* szCamName) {
assert(pSceneMgr);
mpCam = pSceneMgr->createCamera(szCamName);
}
cCamera::~cCamera() {
// detach before delete ?
if (mpCam) mpCam->getSceneManager()->destroyCamera(mpCam); mpCam = 0;
}
/*
mCamera->setAspectRatio(Real(mViewport->getActualWidth()) / Real(mViewport->getActualHeight()));
mCamera->setPosition(Vector3(0,0,40));
// Look back along -Z
//mCamera->lookAt(Vector3(0,0,0));
mCamera->setNearClipDistance(1);
//mCamera->setPolygonMode(PM_WIREFRAME);
Ogre::Quaternion qCamRot = cOgreWrapper::GetSingleton().mCamera->getOrientation();
// ortho mode with screen coords = screensize in pixels
pCam->setFOVy( Ogre::Degree(90) );
pCam->setNearClipDistance( 0.5 * cOgreWrapper::GetSingleton().mViewport->getActualHeight() );
pCam->setProjectionType( Ogre::PT_ORTHOGRAPHIC );
*/
class cCamera_L : public cLuaBind<cCamera> { public:
/// called by Register(), registers object-methods (see cLuaBind constructor for examples)
virtual void RegisterMethods (lua_State *L) { PROFILE
LUABIND_QUICKWRAP( GetQuickHandle, { return cLuaBindDirectOgreHelper::PushCamera(L,checkudata_alive(L)->mpCam); });
#define REGISTER_METHOD(methodname) mlMethod.push_back(make_luaL_reg(#methodname,&cCamera_L::methodname));
REGISTER_METHOD(Destroy);
REGISTER_METHOD(SetFOVy);
REGISTER_METHOD(SetNearClipDistance);
REGISTER_METHOD(SetFarClipDistance);
REGISTER_METHOD(SetAspectRatio);
REGISTER_METHOD(Move);
REGISTER_METHOD(SetPos);
REGISTER_METHOD(GetPos);
REGISTER_METHOD(SetRot);
REGISTER_METHOD(GetRot);
REGISTER_METHOD(LookAt);
REGISTER_METHOD(GetNearClipDistance);
REGISTER_METHOD(GetFarClipDistance);
REGISTER_METHOD(GetEulerAng);
REGISTER_METHOD(EnableReflection);
REGISTER_METHOD(DisableReflection);
REGISTER_METHOD(IsReflecting);
REGISTER_METHOD(GetPolygonMode);
REGISTER_METHOD(SetPolygonMode);
REGISTER_METHOD(GetProjectionType);
REGISTER_METHOD(SetProjectionType);
REGISTER_METHOD(SetOrthoWindow);
REGISTER_METHOD(GetOrthoWindow);
lua_register(L,"CreateCamera", &cCamera_L::CreateCamera);
lua_register(L,"GetMainCam", &cCamera_L::GetMainCam);
#define RegisterClassConstant(name,constant) cScripting::SetGlobal(L,#name,constant)
RegisterClassConstant(kCamera_PM_POINTS,Ogre::PM_POINTS);
RegisterClassConstant(kCamera_PM_WIREFRAME ,Ogre::PM_WIREFRAME);
RegisterClassConstant(kCamera_PM_SOLID ,Ogre::PM_SOLID);
RegisterClassConstant(kCamera_PT_ORTHOGRAPHIC ,Ogre::PT_ORTHOGRAPHIC);
RegisterClassConstant(kCamera_PT_PERSPECTIVE ,Ogre::PT_PERSPECTIVE);
#undef RegisterClassConstant
}
// object methods exported to lua
// todo : rotation, position, aspect ratio, near/farclip...
/// void Destroy ()
static int Destroy (lua_State *L) { PROFILE delete checkudata_alive(L); return 0; }
/// void SetFOVy (float fAngInRadians)
static int SetFOVy (lua_State *L) { PROFILE
if (Ogre::Camera* pCam = checkudata_alive(L)->mpCam) pCam->setFOVy(Ogre::Radian(luaL_checknumber(L,2)));
return 0;
}
/// void SetNearClipDistance (float f)
static int SetNearClipDistance (lua_State *L) { PROFILE
if (Ogre::Camera* pCam = checkudata_alive(L)->mpCam) pCam->setNearClipDistance(luaL_checknumber(L,2));
return 0;
}
/// void SetFarClipDistance (float f) : 0=infinite
static int SetFarClipDistance (lua_State *L) { PROFILE
if (Ogre::Camera* pCam = checkudata_alive(L)->mpCam) pCam->setFarClipDistance(luaL_checknumber(L,2));
return 0;
}
/// usually SetAspectRatio(Real(mViewport->getActualWidth()) / Real(mViewport->getActualHeight()))
static int SetAspectRatio (lua_State *L) { PROFILE
if (Ogre::Camera* pCam = checkudata_alive(L)->mpCam)
pCam->setAspectRatio(luaL_checknumber(L,2));
return 0;
}
static int Move (lua_State *L) { PROFILE
if (Ogre::Camera* pCam = checkudata_alive(L)->mpCam)
pCam->move(Ogre::Vector3(luaL_checknumber(L,2),luaL_checknumber(L,3),luaL_checknumber(L,4)));
return 0;
}
static int SetPos (lua_State *L) { PROFILE
if (Ogre::Camera* pCam = checkudata_alive(L)->mpCam)
pCam->setPosition(luaL_checknumber(L,2),luaL_checknumber(L,3),luaL_checknumber(L,4));
return 0;
}
static int SetRot (lua_State *L) { PROFILE
if (Ogre::Camera* pCam = checkudata_alive(L)->mpCam)
pCam->setOrientation(Ogre::Quaternion(luaL_checknumber(L,2),luaL_checknumber(L,3),luaL_checknumber(L,4),luaL_checknumber(L,5)));
return 0;
}
/// for lua : x,y,z GetPos ()
static int GetPos (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
Ogre::Vector3 vCamPos = pCam->getPosition();
lua_pushnumber(L,vCamPos.x);
lua_pushnumber(L,vCamPos.y);
lua_pushnumber(L,vCamPos.z);
return 3;
}
/// for lua : w,x,y,z GetRot ()
static int GetRot (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
Ogre::Quaternion qCamRot = pCam->getOrientation();
lua_pushnumber(L,qCamRot.w);
lua_pushnumber(L,qCamRot.x);
lua_pushnumber(L,qCamRot.y);
lua_pushnumber(L,qCamRot.z);
return 4;
}
static int LookAt (lua_State *L) { PROFILE
if (Ogre::Camera* pCam = checkudata_alive(L)->mpCam)
pCam->lookAt(luaL_checknumber(L,2),luaL_checknumber(L,3),luaL_checknumber(L,4));
return 0;
}
static int GetNearClipDistance (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
lua_pushnumber(L,pCam->getNearClipDistance());
return 1;
}
static int GetFarClipDistance (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
lua_pushnumber(L,pCam->getFarClipDistance());
return 1;
}
/// camera polygone mode: kCamera_PM_POINTS,kCamera_PM_WIREFRAME,kCamera_PM_SOLID
static int GetPolygonMode (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
lua_pushnumber(L,pCam->getPolygonMode());
return 1;
}
/// camera polygone mode: kCamera_PM_POINTS,kCamera_PM_WIREFRAME,kCamera_PM_SOLID
static int SetPolygonMode (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
pCam->setPolygonMode(static_cast<Ogre::PolygonMode>(luaL_checkint(L,2)));
return 0;
}
/// camera projection mode: kCamera_PT_ORTHOGRAPHIC,kCamera_PT_PERSPECTIVE
static int GetProjectionType (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
lua_pushnumber(L,pCam->getProjectionType());
return 1;
}
/// camera projection mode: kCamera_PT_ORTHOGRAPHIC,kCamera_PT_PERSPECTIVE
static int SetProjectionType (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
pCam->setProjectionType(static_cast<Ogre::ProjectionType>(luaL_checkint(L,2)));
return 0;
}
/// lua: w,h cam:GetOrthoWindow()
static int GetOrthoWindow (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
#if OGRE_VERSION_MINOR >= 6
lua_pushnumber(L,pCam->getOrthoWindowWidth());
lua_pushnumber(L,pCam->getOrthoWindowHeight());
#else
lua_pushnumber(L,0.0f);
lua_pushnumber(L,0.0f);
#endif
return 2;
}
/// lua: cam:SetOrthoWindow(w,h = nil)
static int SetOrthoWindow (lua_State *L) { PROFILE
int argc = lua_gettop(L);
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
#if OGRE_VERSION_MINOR >= 6
if(argc == 3){
pCam->setOrthoWindow(luaL_checknumber(L,2), luaL_checknumber(L,3));
} else {
pCam->setOrthoWindowWidth(luaL_checknumber(L,2));
}
return 0;
#else
return 0;
#endif
}
/// returns cam rotation as euler angles
static int GetEulerAng (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
Ogre::Quaternion qCamRot = pCam->getOrientation();
lua_pushnumber(L,qCamRot.getRoll().valueRadians());
lua_pushnumber(L,qCamRot.getPitch().valueRadians());
lua_pushnumber(L,qCamRot.getYaw().valueRadians());
return 3;
}
/// lua: void cCamera:EnableReflection(x,y,z, nx,ny,nz)
/// switches this render target to reflection mode with the given plane
static int EnableReflection (lua_State *L) { PROFILE
cCamera *t = checkudata_alive(L);
Ogre::Camera* pCam = t->mpCam;
if (!pCam) return 0;
Ogre::Vector3 point(
(Ogre::Real)luaL_checknumber(L, 2),
(Ogre::Real)luaL_checknumber(L, 3),
(Ogre::Real)luaL_checknumber(L, 4)
);
Ogre::Vector3 normal(
(Ogre::Real)luaL_checknumber(L, 5),
(Ogre::Real)luaL_checknumber(L, 6),
(Ogre::Real)luaL_checknumber(L, 7)
);
t->mReflectionPlane.redefine(normal, point);
pCam->enableReflection(t->mReflectionPlane);
//pCam->enableCustomNearClipPlane(t->mReflectionPlane);
return 0;
}
/// lua : void cRenderTexture:DisableReflection ()
static int DisableReflection (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
pCam->disableReflection();
return 0;
}
/// lua : bool cRenderTexture:IsReflecting ()
static int IsReflecting (lua_State *L) { PROFILE
Ogre::Camera* pCam = checkudata_alive(L)->mpCam;
if (!pCam) return 0;
lua_pushboolean(L,pCam->isReflected());
return 1;
}
// static methods exported to lua
/// udata_cam CreateCamera (sSceneMgrName="main",sCamName=uniquename())
static int CreateCamera (lua_State *L) { PROFILE
std::string sSceneMgrName = (lua_gettop(L) >= 1 && !lua_isnil(L,1)) ? luaL_checkstring(L,1) : "main";
std::string sCamName = (lua_gettop(L) >= 2 && !lua_isnil(L,2)) ? luaL_checkstring(L,2) : cOgreWrapper::GetSingleton().GetUniqueName();
Ogre::SceneManager* pSceneMgr = cOgreWrapper::GetSingleton().GetSceneManager(sSceneMgrName.c_str());
cCamera* target = pSceneMgr ? new cCamera(pSceneMgr,sCamName.c_str()) : 0;
return CreateUData(L,target);
}
/// udata_cam GetMainCam ()
static int GetMainCam (lua_State *L) { PROFILE
static cCamera* pMainCam = 0;
if (!pMainCam) pMainCam = new cCamera(cOgreWrapper::GetSingleton().mCamera);
return CreateUData(L,pMainCam);
}
virtual const char* GetLuaTypeName () { return "lugre.camera"; }
};
/// lua binding
void cCamera::LuaRegister (lua_State *L) { PROFILE
cLuaBind<cCamera>::GetSingletonPtr(new cCamera_L())->LuaRegister(L);
}
};
| 32.755882
| 139
| 0.703062
|
21971884aa304e160b28b4b382aafc5dc9a7d78d
| 3,969
|
swift
|
Swift
|
Multiplatform/Shared/Sidebar/SidebarContextMenu.swift
|
Mackarous/NetNewsWire
|
4355d7617ae3999188c4b9ac383fd02e89696f02
|
[
"MIT"
] | 6
|
2020-10-31T00:52:51.000Z
|
2020-12-31T06:55:00.000Z
|
Multiplatform/Shared/Sidebar/SidebarContextMenu.swift
|
danielpunkass/NetNewsWire
|
ff82c613ca946ca404cb9db6661b1cedc3c3a3e3
|
[
"MIT"
] | 1
|
2018-09-27T22:34:12.000Z
|
2018-09-27T22:34:12.000Z
|
Multiplatform/Shared/Sidebar/SidebarContextMenu.swift
|
danielpunkass/NetNewsWire
|
ff82c613ca946ca404cb9db6661b1cedc3c3a3e3
|
[
"MIT"
] | 1
|
2021-11-21T13:59:57.000Z
|
2021-11-21T13:59:57.000Z
|
//
// SidebarContextMenu.swift
// NetNewsWire
//
// Created by Maurice Parker on 7/17/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import SwiftUI
import RSCore
import Account
struct SidebarContextMenu: View {
@Environment(\.undoManager) var undoManager
@Environment(\.openURL) var openURL
@EnvironmentObject private var sidebarModel: SidebarModel
@Binding var showInspector: Bool
var sidebarItem: SidebarItem
var body: some View {
// MARK: Account Context Menu
if sidebarItem.representedType == .account {
Button {
showInspector = true
} label: {
Text("Get Info")
#if os(iOS)
AppAssets.getInfoImage
#endif
}
Button {
sidebarModel.markAllAsReadInAccount.send(sidebarItem.represented as! Account)
} label: {
Text("Mark All As Read")
#if os(iOS)
AppAssets.markAllAsReadImage
#endif
}
}
// MARK: Pseudofeed Context Menu
if sidebarItem.representedType == .pseudoFeed {
Button {
guard let feed = sidebarItem.feed else {
return
}
sidebarModel.markAllAsReadInFeed.send(feed)
} label: {
Text("Mark All As Read")
#if os(iOS)
AppAssets.markAllAsReadImage
#endif
}
}
// MARK: Webfeed Context Menu
if sidebarItem.representedType == .webFeed {
Button {
showInspector = true
} label: {
Text("Get Info")
#if os(iOS)
AppAssets.getInfoImage
#endif
}
Button {
guard let feed = sidebarItem.feed else {
return
}
sidebarModel.markAllAsReadInFeed.send(feed)
} label: {
Text("Mark All As Read")
#if os(iOS)
AppAssets.markAllAsReadImage
#endif
}
Divider()
Button {
guard let homepage = (sidebarItem.feed as? WebFeed)?.homePageURL,
let url = URL(string: homepage) else {
return
}
openURL(url)
} label: {
Text("Open Home Page")
#if os(iOS)
AppAssets.openInBrowserImage
#endif
}
Divider()
Button {
guard let feedUrl = (sidebarItem.feed as? WebFeed)?.url else {
return
}
#if os(macOS)
URLPasteboardWriter.write(urlString: feedUrl, to: NSPasteboard.general)
#else
UIPasteboard.general.string = feedUrl
#endif
} label: {
Text("Copy Feed URL")
#if os(iOS)
AppAssets.copyImage
#endif
}
Button {
guard let homepage = (sidebarItem.feed as? WebFeed)?.homePageURL else {
return
}
#if os(macOS)
URLPasteboardWriter.write(urlString: homepage, to: NSPasteboard.general)
#else
UIPasteboard.general.string = homepage
#endif
} label: {
Text("Copy Home Page URL")
#if os(iOS)
AppAssets.copyImage
#endif
}
Divider()
Button {
if AppDefaults.shared.sidebarConfirmDelete == false {
sidebarModel.deleteFromAccount.send(sidebarItem.feed!)
} else {
sidebarModel.sidebarItemToDelete = sidebarItem.feed!
sidebarModel.showDeleteConfirmation = true
}
} label: {
Text("Delete")
#if os(iOS)
AppAssets.deleteImage
#endif
}
}
// MARK: Folder Context Menu
if sidebarItem.representedType == .folder {
Button {
showInspector = true
} label: {
Text("Get Info")
#if os(iOS)
AppAssets.getInfoImage
#endif
}
Button {
guard let feed = sidebarItem.feed else {
return
}
sidebarModel.markAllAsReadInFeed.send(feed)
} label: {
Text("Mark All As Read")
#if os(iOS)
AppAssets.markAllAsReadImage
#endif
}
/*
You cannot select folder level items in b4. Delete is disabled for the time being.
*/
/*
Divider()
Button {
if AppDefaults.shared.sidebarConfirmDelete == false {
sidebarModel.deleteFromAccount.send(sidebarItem.feed!)
} else {
sidebarModel.sidebarContextMenuItem = sidebarItem.feed
sidebarModel.showDeleteConfirmation = true
}
} label: {
Text("Delete")
#if os(iOS)
AppAssets.deleteImage
#endif
}
*/
}
}
}
| 21.454054
| 86
| 0.641471
|
e77f83c102270bd98a02ad39887fa9b4d08ae6cb
| 390
|
php
|
PHP
|
app/Http/Controllers/API/Usuario.php
|
VictorAfonso044/DigitalInnovationOneLaravel
|
b96292c8c153689d19ccc837dcfedb3abb35b175
|
[
"MIT"
] | 1
|
2021-05-17T14:58:50.000Z
|
2021-05-17T14:58:50.000Z
|
app/Http/Controllers/API/Usuario.php
|
VictorAfonso044/DigitalInnovationOneLaravel
|
b96292c8c153689d19ccc837dcfedb3abb35b175
|
[
"MIT"
] | null | null | null |
app/Http/Controllers/API/Usuario.php
|
VictorAfonso044/DigitalInnovationOneLaravel
|
b96292c8c153689d19ccc837dcfedb3abb35b175
|
[
"MIT"
] | null | null | null |
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use App\Models\Usuario as ModelsUsuario;
use Illuminate\Http\Request;
class Usuario extends Controller
{
public function salvar(Request $request){
if(ModelsUsuario::cadastrar($request)){
return response("ok", 200);
}else{
return response("Erro",409);
}
}
}
| 20.526316
| 46
| 0.666667
|
8d7aff33b7f99abb9aaed9dc64298eb9546ce4db
| 713
|
js
|
JavaScript
|
app/javascript/controllers/theme_controller.js
|
matthewl/WriteAbout
|
3e0c55b57820f2916b1928647721392804e2fa88
|
[
"MIT"
] | null | null | null |
app/javascript/controllers/theme_controller.js
|
matthewl/WriteAbout
|
3e0c55b57820f2916b1928647721392804e2fa88
|
[
"MIT"
] | 5
|
2019-11-26T08:35:23.000Z
|
2019-11-26T20:59:48.000Z
|
app/javascript/controllers/theme_controller.js
|
matthewl/WriteAbout
|
3e0c55b57820f2916b1928647721392804e2fa88
|
[
"MIT"
] | null | null | null |
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["light", "dark", "system"]
connect() {
this.switchTheme()
}
switchTheme() {
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark')
} else {
document.documentElement.classList.remove('dark')
}
}
switchToLight() {
localStorage.theme = 'light'
this.switchTheme()
}
switchToDark() {
localStorage.theme = 'dark'
this.switchTheme()
}
switchToSystem() {
localStorage.removeItem('theme')
this.switchTheme()
}
}
| 21.606061
| 133
| 0.642356
|
0f5d79272590b662bc8fe163351026ec992df0f9
| 411
|
swift
|
Swift
|
MovieDB/Controllers/ViewController.swift
|
rusito-23/MovieDB
|
66a585424e0e86514058a1a32fb9b158f7cf1cd7
|
[
"MIT"
] | null | null | null |
MovieDB/Controllers/ViewController.swift
|
rusito-23/MovieDB
|
66a585424e0e86514058a1a32fb9b158f7cf1cd7
|
[
"MIT"
] | null | null | null |
MovieDB/Controllers/ViewController.swift
|
rusito-23/MovieDB
|
66a585424e0e86514058a1a32fb9b158f7cf1cd7
|
[
"MIT"
] | null | null | null |
//
// ViewController.swift
// MovieDB
//
// Created by Igor Andruskiewitsch on 18/02/2019.
// Copyright © 2019 Igor Andruskiewitsch. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func exploreMovies(_ sender: Any) {
self.performSegue(withIdentifier: "MoviesListSegue", sender: nil)
}
}
| 17.869565
| 69
| 0.698297
|
74c889a16591d9db53ae692c03a23af42c1f2c00
| 813
|
css
|
CSS
|
frontend/views/sensors/createsensor-view.css
|
Burdis28/diplomka
|
f662a83a1e315541dbc7c253af2d74997b03be9d
|
[
"Unlicense"
] | 1
|
2021-08-09T23:58:25.000Z
|
2021-08-09T23:58:25.000Z
|
frontend/views/sensors/createsensor-view.css
|
Burdis28/diplomka
|
f662a83a1e315541dbc7c253af2d74997b03be9d
|
[
"Unlicense"
] | 2
|
2021-08-09T22:26:52.000Z
|
2021-08-21T23:23:07.000Z
|
frontend/views/sensors/createsensor-view.css
|
Burdis28/diplomka
|
f662a83a1e315541dbc7c253af2d74997b03be9d
|
[
"Unlicense"
] | null | null | null |
createsensor-view {
background-color: var(--lumo-contrast-10pct);
box-sizing: border-box;
display: block;
font-size: var(--lumo-font-size-m);
height: 100%;
overflow: auto;
padding: var(--lumo-space-l) var(--lumo-space-l) var(--lumo-space-l) var(--lumo-space-l);
}
createsensor-view div{
background-color: var(--lumo-base-color);
display: block;
margin: var(--lumo-space-l) var(--lumo-space-l) var(--lumo-space-l) var(--lumo-space-l);
box-shadow: var(--lumo-box-shadow-l);
padding: var(--lumo-space-l) var(--lumo-space-l) var(--lumo-space-xl) var(--lumo-space-l);
max-width: 1024px;
height: max-content;
}
createsensor-view .validation-error-dialog-style {
color: red;
}
createsensor-view .button-layout {
margin-bottom: var(--lumo-space-l);
margin-top: var(--lumo-space-m);
}
| 28.034483
| 92
| 0.671587
|
387531ca5e54ce393eebfdd55e81dba46f08b54c
| 10,087
|
php
|
PHP
|
resources/views/home/goods/show.blade.php
|
dieche1227/blog
|
76acf8c0d0fc0deec8618ffaf4da6f2667948be9
|
[
"MIT"
] | 2
|
2017-08-25T01:38:16.000Z
|
2018-03-21T05:49:00.000Z
|
resources/views/home/goods/show.blade.php
|
dieche1227/blog
|
76acf8c0d0fc0deec8618ffaf4da6f2667948be9
|
[
"MIT"
] | null | null | null |
resources/views/home/goods/show.blade.php
|
dieche1227/blog
|
76acf8c0d0fc0deec8618ffaf4da6f2667948be9
|
[
"MIT"
] | null | null | null |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<block name="title"><title>标题</title></block>
<link rel="stylesheet" href="{{asset('s9/css/common.css')}}">
<link rel="stylesheet" href="{{asset('s9/css/home.css')}}">
<link rel="stylesheet" href="{{asset('s9/css/module.css')}}">
<link rel="stylesheet" href="{{asset('s9/css/list.css')}}">
<link rel="stylesheet" href="{{asset('s9/css/fabu.css')}}">
<link rel="stylesheet" href="{{asset('s9/css/det.css')}}">
<link rel="stylesheet" href="{{asset('s9/css/addbid/uicn.css')}}">
<link rel="stylesheet" href="{{asset('s9/css/addbid/new_enter.css')}}">
<link rel="stylesheet" href="{{asset('s9/css/modal.css')}}">
<link rel="stylesheet" href="{{asset('s9/css/form_basic.css')}}">
<style>
.media-object{
width:40%;
}
.media-body{
width:60%;
}
</style>
<style type="text/css">
/*/* css 重置 */
.js{width:90%; margin:10px auto 0 auto; }
.js p{ padding:5px 0; font-weight:bold; overflow:hidden; }
.js p span{ float:right; }
.js p span a{ color:#f00; text-decoration:underline; }
.js textarea{ height:100px; width:98%; padding:5px; border:1px solid #ccc; border-top:2px solid #aaa; border-left:2px solid #aaa; }
/* 本例子css */
.game163{ position: relative; border: 1px solid #dcdddd; padding: 4px; overflow: hidden; width: 300px; }
.game163 .bigImg{ height: 258px; position: relative;}
.game163 .bigImg li img{ vertical-align:middle; width:300px; height:225px; }
.game163 .bigImg h4{ font-size: 14px; font-weight: bold; line-height: 33px; height: 33px; padding-right: 30px; overflow: hidden; text-align: left; }
.game163 .smallScroll{ height: 47px; margin-bottom: 6px;}
.game163 .sPrev,.game163 .sNext{ float: left; display: block; width: 14px; height: 47px; text-indent: -9999px; background: url(images/sprites1008.png) no-repeat 0 -3046px; }
.game163 .sNext{ background-position: 0 -2698px;}
.game163 .sPrev:hover{ background-position: 0 -3133px;}
.game163 .sNext:hover{ background-position: 0 -2785px;}
.game163 .smallImg{ float:left; margin: 0 6px; display:inline; width: 260px; overflow: hidden;}
.game163 .smallImg ul{ height:54px; width: 9999px; overflow: hidden; }
.game163 .smallImg li{ float: left; padding: 0 4px 0 0; width:62px; cursor:pointer; display: inline; }
.game163 .smallImg img{ border: 1px solid #dcdddd; width:60px; height:45px; }
.game163 .smallImg .on img{ border-color: #1e50a2;}
.game163 .pageState{ position: absolute; top: 235px; right: 5px; font-family: "Times New Roman", serif; letter-spacing: 1px;}
.game163 .pageState span{ color: #f00; font-size: 16px;}
.det_hd_info > div {
width: auto;
height: auto;
}
.det_hd_info .tag {
border-left: none;
border-right: none;
padding-left: 0px;
}
.det_hd_info {
padding: 0px 0 0px;
}
</style>
<style type="text/css" media="screen">
.a{width: 100px;height:50px;background: red;cursor: pointer;display: inline-block;margin: 30px;}
</style>
</head>
<body>
<div id="ajax-hook"></div>
<!-- {/* 商品信息 */} -->
<div class="container mtv">
<div class="wrap_1180 bg_white wpn ptv">
<div class="main more">
<div class="main_warp" style="padding-top: 0px;padding-bottom: 20px;">
<div class="title cl">
<div class="h1 z">意向招标商品</div>
</div>
<div class="title cl">
<div class="f16 z">
<a href="/singlelist/{$goodinfo['zid']}">{$goodinfo['fulei']}</a>
    >    
</div>
<div class="f16 z">
<a href="/singlelist/{$goodinfo['zsid']}">{$goodinfo['zilei']}</a>
</div>
</div>
</div>
</div>
<div class="cl">
<div class="z media-object" id="preview">
<div class="game163" style="margin:0 auto">
<ul class="bigImg" style="position: relative; width: 300px; height: 258px;">
@foreach ($goodsImgs as $img)
<!-- <foreach name="goodinfo['pics']" item="vo" key="k" > -->
<li style="position: absolute; width: 300px; left: 0px; top: 0px; display: none;">
<a href="" target="_blank"><img src="http://img.maixiangtong.com/{{ $img->path }}"></a>
<h4><a href="#" target="_blank"></a></h4>
</li>
@endforeach
<!-- </foreach> -->
</ul>
<div class="smallScroll">
<a class="sPrev prevStop" href="javascript:void(0)">←</a>
<div class="smallImg">
<div class="tempWrap" style="overflow:hidden; position:relative; width:264px">
<ul style="width: 528px; left: 0px; position: relative; overflow: hidden; padding: 0px; margin: 0px;">
@foreach ($goodsImgs as $img)
<li class="" style="float: left; width: 62px;"><a><img src="http://img.maixiangtong.com/{{ $img->path }}"></a></li>
@endforeach
</ul>
</div>
</div>
<a class="sNext" href="javascript:void(0)">→</a>
</div>
<div class="pageState"><span>2</span>/8</div>
</div>
</div>
<div class="media-body det_hd_info z">
<h2 class="mbv">{$goodinfo['name']}</h2>
<!-- 参数列表 -->
<dl class="cl">
<dt class="z f14 mrv">参数名1:</dt>
<dd class="z">
<ul class="cl">
<li class="f14 z mrv">参数值1</li>
<li class="f14 z mrv">参数值3</li>
</ul>
</dd>
</dl>
<foreach name="canshus" item="canshu">
<dl class="cl">
<dt class="z f14 mrv">{$key}:</dt>
<dd class="z">
<ul class="cl">
<foreach name="canshu" item="vo">
<li class="f14 z mrv">{$vo}</li>
</foreach>
</ul>
</dd>
</dl>
</foreach>
<div class="f16 cl mtv mrv">
<span>数量:</span>{$goodinfo['allnum']}/{$goodinfo['jiliang']}/
<empty name="isanyue">
年
<else />
月
</empty>
</div>
<div class="f16 cl mrv">
<span>人数</span>
<a target="_blank" href="#"> {$goodinfo['usernum']}(会员)
</a>
</div>
<!-- <div class="f16">
<span></span>写点儿啥呢
</div> -->
<div class="tag_wp mlv mbw">
<ul class="tag cl">
<foreach name="goodinfo['parameters']" item="vo" key="k" >
<li>{$vo['name']}:{$vo['desc']}</li>
</foreach>
</ul>
</div>
<div class="func f16 mlv mbw">
<button class="btn btn_orange z" goodid="{$goodinfo['id']}" data-target="#modal-email">对此商品也有需求</button>
<button class="btn btn_green z mlv" goodid="{$goodinfo['id']}" data-target="">分享</button>
<a class="btn btn-like" href="#accuse-layer" data-toggle="modal">举报</a>
</div>
</div>
</div>
<!-- {/* 选项卡 */} -->
<div class="wpn">
<ul class="det_nav cl">
<li class="on"
><a href="/goodinfo/{$goodinfo['id']}">简介</a></li>
<li class="on"
>
<a
href="/goodmembers/{$goodinfo['id']}">会员<small>()</small></a></li>
<li><a href="#">活动<small>(0)</small></a></li>
<li><a href="#">评论<small>(0)</small></a></li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="wrap_1180 bg_white wpn ">
<div class="fbox cl fbox_first mlv">
<div class="w800 z">
<p class="text">还记得年少时的梦么,那是永远不凋零的花</p>
</div>
</div>
</div>
</div>
</body>
</html>
<script src="{{asset('s9/js/form_basic.js')}}"></script>
<script type="text/javascript" src="{{asset('s9/js/superslide/jquery1.42.min.js')}}"></script>
<script type="text/javascript" src="{{asset('s9/js/superslide/jquery.SuperSlide.2.1.js')}}"></script>
<script type="text/javascript">
//大图切换
jQuery(".game163").slide({ titCell:".smallImg li", mainCell:".bigImg", effect:"fold", autoPlay:true,delayTime:200,
startFun:function(i,p){
//控制小图自动翻页
if(i==0){ jQuery(".game163 .sPrev").click() } else if( i%4==0 ){ jQuery(".game163 .sNext").click()}
}
});
//小图左滚动切换
jQuery(".game163 .smallScroll").slide({ mainCell:"ul",delayTime:100,vis:4,scroll:4,effect:"left",autoPage:true,prevCell:".sPrev",nextCell:".sNext",pnLoop:false });
</script>
<script type="text/javascript" src="{{asset('s9/js/modal.js')}}"></script>
<script>
//我 也常买
$('#changmai').click(function(){
var goodid = $(this).attr('goodid');
var shuliang = $('input[name=shuliang]').val();
shuliang = $.trim(shuliang);
if(shuliang == '' || shuliang.length <=0){
globalTip({'msg':'数量不能为空','Time':3});
$('input[name=shuliang]').focus();
return false;
}
// if(!isNaN(shuliang)){
// globalTip({'msg':'只能为数字','Time':3});
// $('input[name=shuliang]').focus();
// return false;
// }
var danwei = $('input[name=danwei]').val();
var zhouqi = $('input[name=zhouqi]').val();
data = {
goodid : goodid,
shuliang:shuliang,
danwei:danwei,
zhouqi:zhouqi,
};
$.ajax({
type:'post',
url:'/woyechangmai',
data:data,
dataType:'json',
success:function(msg){
globalTip(msg);
return false;
},
error : function(data){
alert('网络故障');
}
});
return false;
})
</script>
| 33.400662
| 175
| 0.531377
|
0afdf9968d66ce8acc6a2083baff455ea9b0130d
| 1,046
|
kt
|
Kotlin
|
app/src/main/kotlin/pl/mbaleczny/rapid_mg/util/RxUtils.kt
|
mbaleczny/rapid-mg
|
972d8e4fd0f9715383416949919aad0b868a6ad2
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/kotlin/pl/mbaleczny/rapid_mg/util/RxUtils.kt
|
mbaleczny/rapid-mg
|
972d8e4fd0f9715383416949919aad0b868a6ad2
|
[
"Apache-2.0"
] | 1
|
2017-12-24T14:00:32.000Z
|
2017-12-25T17:53:02.000Z
|
app/src/main/kotlin/pl/mbaleczny/rapid_mg/util/RxUtils.kt
|
mbaleczny/rapid-mg
|
972d8e4fd0f9715383416949919aad0b868a6ad2
|
[
"Apache-2.0"
] | null | null | null |
package pl.mbaleczny.rapid_mg.util
import io.reactivex.Observable
import io.reactivex.ObservableTransformer
import pl.mbaleczny.rapid_mg.R
import pl.mbaleczny.rapid_mg.RapidApp
import pl.mbaleczny.rapid_mg.util.schedulers.BaseSchedulerProvider
import java.io.IOException
/**
* @author Mariusz Baleczny
* @date 16.02.17
*/
/**
* Sets schedulers for default action (which is network request)
*/
fun <T> applySchedulers(schedulerProvider: BaseSchedulerProvider?)
: ObservableTransformer<T, T> =
ObservableTransformer {
it.subscribeOn(schedulerProvider?.io())
.observeOn(schedulerProvider?.ui())
}
/**
* Handles action on network connection availability.
*/
fun <T> connectivityCheck(): ObservableTransformer<T, T> =
ObservableTransformer {
if (RapidApp.isNetworkAvailable())
it
else
Observable.error(IOException(RapidApp.instance.
getString(R.string.no_internet_connection_message)))
}
| 29.885714
| 76
| 0.679732
|
57f577783000e3a2996d07144c6464aaefd0bcc8
| 665
|
sql
|
SQL
|
src/test/resources/jp/co/tis/gsp/tools/dba/mojo/ImportSchemaMojo_test/basic/oracle/ddl/90_extra_ddl.sql
|
y-ok/gsp-dba-maven-plugin
|
e37358cf85ca2ab735ba19544a99cd923fcd703c
|
[
"Apache-2.0"
] | 15
|
2015-06-26T01:53:33.000Z
|
2020-12-05T13:01:31.000Z
|
src/test/resources/jp/co/tis/gsp/tools/dba/mojo/ImportSchemaMojo_test/basic/oracle/ddl/90_extra_ddl.sql
|
y-ok/gsp-dba-maven-plugin
|
e37358cf85ca2ab735ba19544a99cd923fcd703c
|
[
"Apache-2.0"
] | 49
|
2016-01-18T02:29:09.000Z
|
2022-03-09T07:00:16.000Z
|
src/test/resources/jp/co/tis/gsp/tools/dba/mojo/ImportSchemaMojo_test/basic/oracle/ddl/90_extra_ddl.sql
|
y-ok/gsp-dba-maven-plugin
|
e37358cf85ca2ab735ba19544a99cd923fcd703c
|
[
"Apache-2.0"
] | 12
|
2016-01-13T01:31:55.000Z
|
2022-02-24T13:34:44.000Z
|
-- シーケンス
-- ORACLEはGSPで作成している
-- シノニム
CREATE SYNONYM SYN_TEST_TBL1 FOR TEST_TBL1;
-- プロシージャ
CREATE OR REPLACE PROCEDURE PROC_SELECT_TEST_TBL1 (AA IN NUMBER, BB OUT NUMBER) AS BEGIN SELECT TEST_TBL1_ID INTO BB FROM TEST_TBL1 WHERE TEST_TBL1_ID = AA; DBMS_OUTPUT.PUT_LINE('ID:' || BB); END;/
-- ファンクション
CREATE OR REPLACE FUNCTION FUNC_SELECT_TEST_TBL1(param1 IN NUMBER) RETURN NUMBER IS rtn NUMBER(5); BEGIN SELECT TEST_TBL1_ID INTO rtn FROM TEST_TBL1 WHERE TEST_TBL1_ID = param1; RETURN(rtn); END;/
-- トリガ
CREATE OR REPLACE TRIGGER Print_TEST_TBL1 AFTER INSERT ON TEST_TBL1 FOR EACH ROW BEGIN dbms_output.put_line('-------------------------'); END;/
| 47.5
| 198
| 0.738346
|
86a19eff96891cfbbd5f903fe7f4d1bced562e22
| 5,184
|
lua
|
Lua
|
test_scripts/Policies/user_consent_of_Policies/199_ATF_appPermissionsConsentNeeded_true.lua
|
shiniwat/sdl_atf_test_scripts
|
7e8686f682ea0fac7ba1ba53d380c842a6434875
|
[
"BSD-3-Clause"
] | 3
|
2016-03-17T02:26:56.000Z
|
2021-11-06T08:04:19.000Z
|
test_scripts/Policies/user_consent_of_Policies/199_ATF_appPermissionsConsentNeeded_true.lua
|
shiniwat/sdl_atf_test_scripts
|
7e8686f682ea0fac7ba1ba53d380c842a6434875
|
[
"BSD-3-Clause"
] | 1,335
|
2016-03-14T18:29:40.000Z
|
2022-03-30T10:40:28.000Z
|
test_scripts/Policies/user_consent_of_Policies/199_ATF_appPermissionsConsentNeeded_true.lua
|
shiniwat/sdl_atf_test_scripts
|
7e8686f682ea0fac7ba1ba53d380c842a6434875
|
[
"BSD-3-Clause"
] | 72
|
2016-03-30T13:44:17.000Z
|
2021-07-26T06:48:24.000Z
|
---------------------------------------------------------------------------------------------
-- Requirement summary:
-- [Policies]: User consent required on permissions change
-- [Policies] GetListOfPermissions with appID
-- [HMI API] OnAppPermissionChanged notification
--
-- Description:
-- Local PT is successfully updated and there are new permissions that require User`s consent
-- 1. Used preconditions:
-- Unregister default application
-- Register application
-- Activate application
--
-- 2. Performed steps
-- Perform PTU with new permissions that require User consent
--
-- Expected result:
-- Policies Manager must notify HMI about 'user-consent-required' via SDL.OnAppPermissionChanged{appID, appPermissionsConsentNeeded:true,
-- provide the list of permissions that require User`s consent upon request from HMI via GetListOfPermissions(appID);
-- PoliciesManager must respond with the list of <groupName>s that have the field "user_consent_prompt" in corresponding <functional grouping> and
-- are assigned to the specified application (section "<appID>" -> "groups")
---------------------------------------------------------------------------------------------
require('user_modules/script_runner').isTestApplicable({ { extendedPolicy = { "EXTERNAL_PROPRIETARY" } } })
--[[ Required Shared libraries ]]
local commonFunctions = require ('user_modules/shared_testcases/commonFunctions')
local commonSteps = require('user_modules/shared_testcases/commonSteps')
local testCasesForPolicyTable = require('user_modules/shared_testcases/testCasesForPolicyTable')
local utils = require ('user_modules/utils')
--[[ General Precondition before ATF start ]]
commonSteps:DeleteLogsFileAndPolicyTable()
--TODO(vvvakulenko): Should be removed when issue: "ATF does not stop HB timers by closing session and connection" is fixed
config.defaultProtocolVersion = 2
--[[ General Settings for configuration ]]
Test = require('connecttest')
require('cardinalities')
require('user_modules/AppTypes')
--[[ Preconditions ]]
commonFunctions:newTestCasesGroup("Preconditions")
function Test:Precondition_Activate_app()
testCasesForPolicyTable:trigger_getting_device_consent(self, config.application1.registerAppInterfaceParams.appName, utils.getDeviceMAC())
end
--[[ Test ]]
commonFunctions:newTestCasesGroup("Test")
function Test:TestStep_PTU_appPermissionsConsentNeeded_true()
local requestId = self.hmiConnection:SendRequest("SDL.GetPolicyConfigurationData",
{ policyType = "module_config", property = "endpoints" })
EXPECT_HMIRESPONSE(requestId)
:Do(function(_,_)
EXPECT_HMINOTIFICATION("SDL.OnStatusUpdate", {status = "UP_TO_DATE"})
:Do(function(_,data)
if(data.params.status == "UP_TO_DATE") then
EXPECT_HMINOTIFICATION("SDL.OnAppPermissionChanged",
{appID = self.applications[config.application1.registerAppInterfaceParams.appName], appPermissionsConsentNeeded = true })
:Do(function(_,_)
local RequestIdListOfPermissions = self.hmiConnection:SendRequest("SDL.GetListOfPermissions",
{ appID = self.applications[config.application1.registerAppInterfaceParams.appName] })
EXPECT_HMIRESPONSE(RequestIdListOfPermissions)
:Do(function(_,data1)
local groups = {}
if #data1.result.allowedFunctions > 0 then
for i = 1, #data1.result.allowedFunctions do
groups[i] = {
name = data1.result.allowedFunctions[i].name,
id = data1.result.allowedFunctions[i].id,
allowed = true}
end
end
self.hmiConnection:SendNotification("SDL.OnAppPermissionConsent", { appID = self.applications[config.application1.registerAppInterfaceParams.appName], consentedFunctions = groups, source = "GUI"})
EXPECT_NOTIFICATION("OnPermissionsChange")
end)
end)
end
end)
self.hmiConnection:SendNotification("BasicCommunication.OnSystemRequest", { requestType = "PROPRIETARY", fileName = "filename"})
EXPECT_NOTIFICATION("OnSystemRequest", { requestType = "PROPRIETARY" })
:Do(function(_,_)
self.mobileSession:SendRPC("SystemRequest", { fileName = "PolicyTableUpdate", requestType = "PROPRIETARY"}, "files/PTU_NewPermissionsForUserConsent.json")
local systemRequestId
EXPECT_HMICALL("BasicCommunication.SystemRequest")
:Do(function(_,data)
systemRequestId = data.id
self.hmiConnection:SendNotification("SDL.OnReceivedPolicyUpdate", { policyfile = "/tmp/fs/mp/images/ivsu_cache/PolicyTableUpdate"})
local function to_run()
self.hmiConnection:SendResponse(systemRequestId,"BasicCommunication.SystemRequest", "SUCCESS", {})
end
RUN_AFTER(to_run, 500)
end)
end)
end)
end
--[[ Postconditions ]]
commonFunctions:newTestCasesGroup("Postconditions")
function Test.Postcondition_StopSDL()
StopSDL()
end
return Test
| 45.473684
| 216
| 0.678434
|
da86d9d813af9cf51fbdc4cfed4877df1f8d9d39
| 927
|
php
|
PHP
|
app/Models/BusinessBranch.php
|
Lakshander/grizfit
|
7baf4c0df8477519d1f94a107e307b4657383d6e
|
[
"MIT"
] | null | null | null |
app/Models/BusinessBranch.php
|
Lakshander/grizfit
|
7baf4c0df8477519d1f94a107e307b4657383d6e
|
[
"MIT"
] | null | null | null |
app/Models/BusinessBranch.php
|
Lakshander/grizfit
|
7baf4c0df8477519d1f94a107e307b4657383d6e
|
[
"MIT"
] | 2
|
2021-02-20T03:48:01.000Z
|
2021-11-23T10:06:01.000Z
|
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BusinessBranch extends Model
{
protected $table = "business_branches";
// Add your validation rules here
public static $rules = [
'detail_id' => 'required',
'area_id' => 'required'
];
public static function businessBranches($businessId)
{
return BusinessBranch::where('detail_id','=',$businessId)
->where('status','=','active')
->get();
}
public static function businessAppointmentBranches($businessId)
{
return BusinessBranch::where('detail_id','=',$businessId)
->where('status','=','active')
->where('book_appointments','=','yes')
->get();
}
public function area()
{
return $this->belongsTo(Area::class,'area_id');
}
// Don't forget to fill this array
protected $guarded = ['id'];
}
| 23.175
| 67
| 0.586839
|
4ce9532d84835930198b2fdf6ff25a02c5a9fca1
| 358
|
py
|
Python
|
yolo/vedanet/engine/__init__.py
|
hilman-dayo/ObjectDetection-OneStageDet
|
44054ad335e24e99a98fdad0d18b9bf3a80c941c
|
[
"MIT"
] | 331
|
2020-06-05T05:10:21.000Z
|
2022-03-29T07:32:42.000Z
|
vedanet/engine/__init__.py
|
xiongcaihua/ObjectDetection-OneStageDet
|
d29f69cdce32b006bd040edb6e66427b3c987c70
|
[
"Apache-2.0"
] | 10
|
2020-06-12T07:53:42.000Z
|
2021-05-11T00:09:10.000Z
|
vedanet/engine/__init__.py
|
xiongcaihua/ObjectDetection-OneStageDet
|
d29f69cdce32b006bd040edb6e66427b3c987c70
|
[
"Apache-2.0"
] | 84
|
2020-06-05T10:21:11.000Z
|
2022-03-27T23:42:44.000Z
|
"""
Lightnet Engine Module |br|
This module contains classes and functions to manage the training of your networks.
It has an engine, capable of orchestrating your training and test cycles, and also contains function to easily visualise data with visdom_.
"""
#from .engine import *
from ._voc_train import *
from ._voc_test import *
from ._speed import *
| 29.833333
| 139
| 0.776536
|
ef606720f1a21954f353a131920915a803ced757
| 3,425
|
js
|
JavaScript
|
test/lazyfunSpec.js
|
desfero/lazyfun
|
c0547b65482d078b00f58903399b58fe3a0d6d48
|
[
"MIT"
] | 1
|
2016-10-20T18:53:34.000Z
|
2016-10-20T18:53:34.000Z
|
test/lazyfunSpec.js
|
desfero/lazyfun
|
c0547b65482d078b00f58903399b58fe3a0d6d48
|
[
"MIT"
] | null | null | null |
test/lazyfunSpec.js
|
desfero/lazyfun
|
c0547b65482d078b00f58903399b58fe3a0d6d48
|
[
"MIT"
] | null | null | null |
'use strict';
var chai = require('chai'),
spies = require('chai-spies');
chai.use(spies);
var expect = chai.expect,
lazyfun = require('../lazyfun');
describe('lazyfun', function () {
it('should be a function', function () {
expect(lazyfun).to.be.a('function');
});
describe('lazy', function () {
it('should invoke callback in lazy way', function () {
var callback = chai.spy();
var func = lazyfun(callback);
expect(callback).to.not.have.been.called();
func();
expect(callback).to.have.been.called.once;
});
it('should invoke callback with passed parameter', function () {
var callback = chai.spy();
var func = lazyfun(callback, null, 'foo', 'bar');
func();
expect(callback).to.have.been.called.with('foo', 'bar');
});
it('should return result from callback', function () {
var callbackResult = 'foo';
var func = lazyfun(function () {
return callbackResult;
});
var result = func();
expect(callbackResult).to.equal(result);
});
it('should invoke function returned from callback', function () {
var callbackResult = chai.spy();
var func = lazyfun(function () {
return callbackResult;
});
func();
expect(callbackResult).to.have.been.called.once;
});
it('should invoke function returned from callback with passed parameters', function () {
var callbackResult = chai.spy();
var func = lazyfun(function () {
return callbackResult;
});
func('foo', 'bar');
expect(callbackResult).to.have.been.called.with('foo', 'bar');
});
it('should not invoke callback more than once', function () {
var callback = chai.spy();
var func = lazyfun(callback);
for (var i = 0; i < 10; i += 1) {
func();
}
expect(callback).to.have.been.called.once;
});
});
describe('deferred', function () {
it('should invoke callback after passed timeout', function (done) {
var callback = chai.spy();
lazyfun(callback, 10);
setTimeout(function () {
expect(callback).to.have.been.called.once;
done();
}, 11);
});
it('should not invoke callback before passed timeout', function (done) {
var callback = chai.spy();
lazyfun(callback, 10);
setTimeout(function () {
expect(callback).to.not.have.been.called();
done();
}, 6);
});
it('should invoke callback on demand', function (done) {
var callback = chai.spy();
var func = lazyfun(callback, 10);
func();
expect(callback).to.have.been.called.once;
setTimeout(function () {
expect(callback).to.have.been.called.once;
done();
}, 15);
});
it('should invoke callback on demand only once', function (done) {
var callback = chai.spy();
var func = lazyfun(callback, 10);
for (var i = 0; i < 10; i += 1) {
func();
}
expect(callback).to.have.been.called.once;
setTimeout(function () {
expect(callback).to.have.been.called.once;
done();
}, 15);
});
});
describe('immediate', function () {
it('should invoke callback immediately', function () {
var callback = chai.spy();
lazyfun(callback, -1);
expect(callback).to.have.been.called.once;
});
});
});
| 22.096774
| 92
| 0.571095
|
8bf4bbecae8930eb93a4d2ecc9b1bfc98e2d499f
| 1,014
|
rb
|
Ruby
|
test/test_esperanto.rb
|
tricknotes/ruby-esperanto
|
80e1507040e6645db0a03f5d56b353b8ed7f7324
|
[
"MIT"
] | null | null | null |
test/test_esperanto.rb
|
tricknotes/ruby-esperanto
|
80e1507040e6645db0a03f5d56b353b8ed7f7324
|
[
"MIT"
] | null | null | null |
test/test_esperanto.rb
|
tricknotes/ruby-esperanto
|
80e1507040e6645db0a03f5d56b353b8ed7f7324
|
[
"MIT"
] | null | null | null |
require 'minitest/autorun'
require 'minitest/power_assert'
require 'esperanto'
class TestEsperanto < MiniTest::Test
def test_to_amd
source = <<-JS
export default 'hi';
JS
expected = <<-JS.strip
define(function () {
\t'use strict';
\treturn 'hi';
});
JS
assert { Esperanto.to_amd(source)['code'] == expected }
end
def test_to_cjs
source = <<-JS
export default 'hi';
JS
expected = <<-JS.strip
'use strict';
module.exports = 'hi';
JS
assert { Esperanto.to_cjs(source)['code'] == expected }
end
def test_to_umd
source = <<-JS
export default 'hi';
JS
expected = <<-JS.strip
(function (global, factory) {
\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
\ttypeof define === 'function' && define.amd ? define(factory) :
\tglobal.homura = factory()
}(this, function () { 'use strict';
\treturn 'hi';
}));
JS
assert { Esperanto.to_umd(source, name: 'homura')['code'] == expected }
end
end
| 16.9
| 93
| 0.625247
|
e51521839a9582c538f936171e673d10f0a11803
| 4,163
|
swift
|
Swift
|
MyAppCatalog/MyAppCatalog/ApiConnectCatalog.swift
|
rsaenzi/MyAppCatalog
|
894907ebff5a8335f0beaf9f6b5fc0697206312c
|
[
"MIT"
] | null | null | null |
MyAppCatalog/MyAppCatalog/ApiConnectCatalog.swift
|
rsaenzi/MyAppCatalog
|
894907ebff5a8335f0beaf9f6b5fc0697206312c
|
[
"MIT"
] | null | null | null |
MyAppCatalog/MyAppCatalog/ApiConnectCatalog.swift
|
rsaenzi/MyAppCatalog
|
894907ebff5a8335f0beaf9f6b5fc0697206312c
|
[
"MIT"
] | null | null | null |
//
// ApiConnectCatalog.swift
// MyAppCatalog
//
// Created by Rigoberto Sáenz Imbacuán [https://www.linkedin.com/in/rsaenzi] on 1/22/17.
// Copyright © 2017 Rigoberto Sáenz Imbacuán. All rights reserved.
//
import Alamofire
typealias CallbackApiCatalog = (response: ApiResponseCatalog) -> ()
class ApiConnectCatalog {
// --------------------------------------------------
// Members
// --------------------------------------------------
private let endpointUrl = "https://itunes.apple.com/us/rss/topfreeapplications/limit=20/json"
// --------------------------------------------------
// Public Methods
// --------------------------------------------------
func get(callback: CallbackApiCatalog) {
// Configuration
let method = Alamofire.Method.GET
// Create the request
let connector = Alamofire.Manager.sharedInstance.request(method, endpointUrl)
// Start the connection
connector.responseString { result in
// Handle the result properly
self.handleResult(result, callback: callback)
}
}
// --------------------------------------------------
// Private Methods
// --------------------------------------------------
private func handleResult(result: Response<String, NSError>, callback: CallbackApiCatalog) {
// Response object
let response = ApiResponseCatalog()
// If an error was reported
if let error = result.result.error {
// Error code for no connectivity
if error.code == -1009 {
// There is no internet connectivity
response.code = .noInternet
}else{
// Error establishing connection, could be a server down
response.code = .wrongConnection
}
}else {
// If connection was established
if result.result.isSuccess == true {
// Process the HTTP code
switch result.response!.statusCode {
case 200:
// Sanitation of the Json string to allow parsing
if let jsonString = result.result.value?.replace("\"im:", replacement: "\"") {
// Parse the entities from the Json string
let catalog = EntityCatalog(JSONString: jsonString)
// Saves the response
response.code = .success
response.catalog = catalog
response.jsonString = jsonString
}else {
// There is no Json data to parse...
response.code = .emptyResponse
}
case 400:
// Client error
response.code = .httpClientError
case 500:
// Server error
response.code = .httpServerError
default:
// No valid HTTP code
response.code = .httpBadCode
}
}else {
// Error establishing connection, could be a server down
response.code = .wrongConnection
}
}
// Sends back the response
callback(response: response)
}
// --------------------------------------------------
// Unique-Access Singleton
// --------------------------------------------------
private static var instanceCreated = false
required init?() {
if ApiConnectCatalog.instanceCreated == false {
ApiConnectCatalog.instanceCreated = true
}else{
return nil
}
}
}
| 32.523438
| 98
| 0.427336
|
dd7dcc8b4285b335103e719d2a09b694641a1a07
| 4,874
|
java
|
Java
|
logisland-components/logisland-processors/logisland-processor-botsearch/src/test/java/com/hurence/logisland/botsearch/TraceTest.java
|
FeizNouri/logisland
|
be0f2f3640d750e7978190fe804d291d5d032524
|
[
"Apache-2.0"
] | 101
|
2016-11-04T06:11:22.000Z
|
2021-12-16T14:45:36.000Z
|
logisland-components/logisland-processors/logisland-processor-botsearch/src/test/java/com/hurence/logisland/botsearch/TraceTest.java
|
FeizNouri/logisland
|
be0f2f3640d750e7978190fe804d291d5d032524
|
[
"Apache-2.0"
] | 386
|
2016-09-26T08:40:46.000Z
|
2022-01-04T11:51:38.000Z
|
logisland-components/logisland-processors/logisland-processor-botsearch/src/test/java/com/hurence/logisland/botsearch/TraceTest.java
|
FeizNouri/logisland
|
be0f2f3640d750e7978190fe804d291d5d032524
|
[
"Apache-2.0"
] | 29
|
2016-10-13T13:34:51.000Z
|
2021-12-16T14:44:53.000Z
|
/**
* Copyright (C) 2016 Hurence (support@hurence.com)
*
* 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.
*/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.hurence.logisland.botsearch;
import com.hurence.logisland.util.time.DateUtil;
import java.text.ParseException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author tom
*/
public class TraceTest {
private static Trace getSampleTrace() {
Trace t = new Trace();
String[] flows
= {"Thu Jan 02 08:43:39 CET 2014 GET 10.118.32.164 193.251.214.117 http webmail.laposte.net 80 /webmail/fr_FR/Images/Images-2013091.0.0-RC226/Images/RightJauge.gif 724 409 false false",
"Thu Jan 02 08:43:40 CET 2014 GET 10.118.32.164 193.251.214.117 http webmail.laposte.net 80 /webmail/fr_FR/Images/Images-2013091.0.0-RC226/Images/fondJauge.gif 723 402 false false",
"Thu Jan 02 08:43:42 CET 2014 GET 10.118.32.164 193.252.23.209 http static1.lecloud.wanadoo.fr 80 /home/fr_FR/20131202100641/img/sprite-icons.pn 495 92518 false false",
"Thu Jan 02 08:43:43 CET 2014 GET 10.118.32.164 173.194.66.94 https www.google.fr 443 /complete/search 736 812 false false",
"Thu Jan 02 08:43:45 CET 2014 GET 10.118.32.164 193.251.214.117 http webmail.laposte.net 80 /webmail/fr_FR/Images/Images-2013091.0.0-RC226/Images/digiposte/archiver-btn.png 736 2179 false false",
"Thu Jan 02 08:43:49 CET 2014 GET 10.118.32.164 193.251.214.117 http webmail.laposte.net 80 /webmail/fr_FR/Images/Images-2013091.0.0-RC226/Images/picto_trash.gif 725 544 false false"};
for (String flowString : flows) {
String[] split = flowString.split("\t");
HttpFlow flow = new HttpFlow();
try {
flow.setDate(DateUtil.fromLegacyStringToDate(split[0]));
flow.setipSource(split[2]);
flow.setRequestSize(Long.parseLong(split[8]));
flow.setResponseSize(Long.parseLong(split[9]));
} catch (ParseException ex) {
Logger.getLogger(TraceTest.class.getName()).log(Level.SEVERE, null, ex);
}
t.add(flow);
}
return t;
}
@Test(expected = IllegalArgumentException.class)
public void testComputeVoid() {
System.out.println("computeVoid");
Trace trace = new Trace();
trace.compute();
}
@Test
public void testCompute() {
System.out.println("compute");
Trace instance = getSampleTrace();
instance.compute();
// durations 1 2 1 2 4
assertTrue( instance.getFlows().size() == 6);
}
/**
* Test of sampleFlows method, of class Trace.
*/
//@Test
public void testSampleFlows() {
System.out.println("sampleFlows");
Trace instance = new Trace();
double[] expResult = null;
double[] result = instance.sampleFlows();
assertArrayEquals(expResult, result, 0.01);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of computePowerSpectralDensity method, of class Trace.
*/
//@Test
public void testComputePowerSpectralDensity() {
System.out.println("computePowerSpectralDensity");
double[] samples = null;
Trace instance = new Trace();
double[] expResult = null;
double[] result = instance.computePowerSpectralDensity(samples);
assertArrayEquals(expResult, result, 0.01);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of smoothArray method, of class Trace.
*/
//@Test
public void testSmoothArray() {
System.out.println("smoothArray");
double[] values = null;
double smoothing = 0.0;
Trace instance = new Trace();
instance.smoothArray(values, smoothing);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}
| 37.492308
| 215
| 0.636438
|
c3d18584dc6f79f2e35f5e0249e4a925de6e6d45
| 1,608
|
cs
|
C#
|
CSharp/GildedTros.App/Constants.cs
|
DevidTeugels/GildedTros
|
f7192fc4e87ae3b1fb78bc1b80dfbea12cff21fe
|
[
"MIT"
] | null | null | null |
CSharp/GildedTros.App/Constants.cs
|
DevidTeugels/GildedTros
|
f7192fc4e87ae3b1fb78bc1b80dfbea12cff21fe
|
[
"MIT"
] | null | null | null |
CSharp/GildedTros.App/Constants.cs
|
DevidTeugels/GildedTros
|
f7192fc4e87ae3b1fb78bc1b80dfbea12cff21fe
|
[
"MIT"
] | null | null | null |
using System.Collections.Generic;
namespace GildedTros.App
{
public static class Constants
{
public static class IncreasingQualityItems
{
public static readonly List<string> Items = new List<string>(){SpecialItems.goodWine};
}
public static class LegendaryItems
{
public static readonly List<string> Items = new List<string>(){SpecialItems.bDawgKeychain};
}
public static class SmellyItems
{
public static readonly List<string> Items = new List<string>(){SpecialItems.duplicateCode,SpecialItems.longMethods,SpecialItems.uglyVariableNames};
}
public static class BackstagePassesItems
{
public static readonly List<string> Items = new List<string>(){SpecialItems.backstagePasses};
}
private static class SpecialItems
{
public static readonly string goodWine = "Good Wine";
public static readonly string bDawgKeychain = "B-DAWG Keychain";
public static readonly string backstagePasses = "Backstage passes";
public static readonly string duplicateCode = "Duplicate Code";
public static readonly string longMethods = "Long Methods";
public static readonly string uglyVariableNames = "Ugly Variable Names";
}
public static class QualityValues
{
public static int minQuality = 0;
public static int maxQuality = 50;
public static int lengendaryQuality = 80;
}
}
}
| 34.956522
| 159
| 0.628109
|
d63e7959b11dc2db06b428397eb5ed55a942f745
| 1,525
|
cs
|
C#
|
src/DiabloSharp/Endpoints/ProfileEndpoint.cs
|
leardev/DiabloSharp
|
e5f4169546bfbd15cc444b343501bee45580b88b
|
[
"MIT"
] | 8
|
2019-04-16T18:01:05.000Z
|
2022-01-27T13:14:32.000Z
|
src/DiabloSharp/Endpoints/ProfileEndpoint.cs
|
leardev/DiabloSharp
|
e5f4169546bfbd15cc444b343501bee45580b88b
|
[
"MIT"
] | null | null | null |
src/DiabloSharp/Endpoints/ProfileEndpoint.cs
|
leardev/DiabloSharp
|
e5f4169546bfbd15cc444b343501bee45580b88b
|
[
"MIT"
] | 2
|
2019-07-21T17:44:29.000Z
|
2021-11-23T09:53:49.000Z
|
using System.Threading.Tasks;
using DiabloSharp.Mappers;
using DiabloSharp.Models;
using DiabloSharp.RateLimiters;
namespace DiabloSharp.Endpoints
{
internal class ProfileEndpoint : Endpoint,
IProfileEndpoint
{
public ProfileEndpoint(ITokenBucket tokenBucket)
: base(tokenBucket)
{
}
public async Task<Account> GetAccountAsync(IAuthenticationScope authenticationScope, BattleTagId battleTagId)
{
var mapper = new AccountMapper();
var battleTag = $"{battleTagId.Name}-{battleTagId.Index}";
using (var client = CreateClient(authenticationScope))
{
var account = await client.GetAccountAsync(battleTag);
return mapper.Map(account);
}
}
public async Task<Hero> GetHeroAsync(IAuthenticationScope authenticationScope, HeroId heroId)
{
var battleTag = $"{heroId.BattleTag.Name}-{heroId.BattleTag.Index}";
using (var client = CreateClient(authenticationScope))
{
var hero = await client.GetHeroAsync(battleTag, heroId.Id);
var items = await client.GetDetailedHeroItemsAsync(battleTag, heroId.Id);
var followerItems = await client.GetDetailedFollowerItemsAsync(battleTag, heroId.Id);
var mapper = new HeroMapper(heroId, items, followerItems);
return mapper.Map(hero);
}
}
}
}
| 35.465116
| 117
| 0.616393
|
03848eca07c63f1898bcdf8afe04716b6edc9d92
| 791
|
rb
|
Ruby
|
activerecord/lib/active_record/connection_adapters/postgresql/oid/timestamp_with_time_zone.rb
|
swaathi/rails
|
c3d4ab00b69daf6044edd3f425ead228a540e68b
|
[
"MIT"
] | 36,239
|
2015-01-01T05:27:12.000Z
|
2022-03-31T14:24:11.000Z
|
activerecord/lib/active_record/connection_adapters/postgresql/oid/timestamp_with_time_zone.rb
|
swaathi/rails
|
c3d4ab00b69daf6044edd3f425ead228a540e68b
|
[
"MIT"
] | 24,106
|
2015-01-01T01:41:20.000Z
|
2022-03-31T23:57:49.000Z
|
activerecord/lib/active_record/connection_adapters/postgresql/oid/timestamp_with_time_zone.rb
|
swaathi/rails
|
c3d4ab00b69daf6044edd3f425ead228a540e68b
|
[
"MIT"
] | 19,522
|
2015-01-01T04:47:16.000Z
|
2022-03-31T20:59:40.000Z
|
# frozen_string_literal: true
module ActiveRecord
module ConnectionAdapters
module PostgreSQL
module OID # :nodoc:
class TimestampWithTimeZone < DateTime # :nodoc:
def type
real_type_unless_aliased(:timestamptz)
end
def cast_value(value)
return if value.blank?
time = super
return time if time.is_a?(ActiveSupport::TimeWithZone)
# While in UTC mode, the PG gem may not return times back in "UTC" even if they were provided to Postgres in UTC.
# We prefer times always in UTC, so here we convert back.
if is_utc?
time.getutc
else
time.getlocal
end
end
end
end
end
end
end
| 25.516129
| 125
| 0.573957
|
af0e6ebdb9c748e825743a36b9af270de0a88c0a
| 1,511
|
py
|
Python
|
baseq/snv/docs.py
|
basedata10/baseq
|
0f1786c3392a51a6ec7cb0f32355cd28eaa5df29
|
[
"MIT"
] | 1
|
2018-08-30T20:29:17.000Z
|
2018-08-30T20:29:17.000Z
|
baseq/snv/docs.py
|
basedata10/baseq
|
0f1786c3392a51a6ec7cb0f32355cd28eaa5df29
|
[
"MIT"
] | null | null | null |
baseq/snv/docs.py
|
basedata10/baseq
|
0f1786c3392a51a6ec7cb0f32355cd28eaa5df29
|
[
"MIT"
] | null | null | null |
doc="""
#Enrich Quality
baseq-SNV qc_enrich ./bam ./bedfile ./out
#Alignment
baseq-SNV run_bwa -1 Read1M.P457.1.fq.gz -2 Read1M.P457.2.fq.gz -g hg38 -n Test -o Test.bam -t 10
#MarkDuplicate
baseq-SNV run_markdup -b Test.bam -m Test.marked.bam
#bqsr
baseq-SNV run_bqsr -m Test.marked.bam -g hg38 -q Test.marked.bqsr.bam
#call variants
baseq-SNV run_callvar -q Test.marked.bqsr.bam -r Test.raw.indel.snp.vcf -g hg38
#select variants
baseq-SNV run_selectvar -r Test.raw.indel.snp.vcf -s Test.raw.snp.vcf -f Test.filtered.snp.vcf -g hg38
#annovar annotation
baseq-SNV run_annovar -g hg38 -n Test -f Test.filtered.snp.vcf -a Test.snps.avinput
#run gatk pipeline
baseq-SNV run_gatkpipe -1 Read1M.P457.1.fq.gz -2 Read1M.P457.2.fq.gz -n Test -g hg38 -d ./
#run gatk pipeline from bam file
baseq-SNV run_gatkpipe -m
#create PoN files
baseq-SNV create_pon -p /mnt/gpfs/Users/wufan/p12_HEC/GATK/baseq_mutect_test/ -l /mnt/gpfs/Users/wufan/p12_HEC/GATK/28wuchen/mutect_call.txt -L /mnt/gpfs/Users/wufan/p12_HEC/GATK/28wuchen/merge.all.target.1.list -g hg37
#single mutect:/mnt/gpfs/Users/wufan/p12_HEC/GATK/28wuchen/N506/
baseq-SNV run_mutect2 -g hg37 -n N506 -N N506_marked_bqsr.bam -t T506 -T T506_marked_bqsr.bam -o ./
#filter mutect call
baseq-SNV filter_mutect_call -r /mnt/gpfs/Users/wufan/p12_HEC/GATK/resources/ref_b37/small_exac_common_3_b37.vcf.gz -s /mnt/gpfs/Users/wufan/p12_HEC/GATK/mutect_test/T506.vcf.gz -T /mnt/gpfs/Users/wufan/p12_HEC/GATK/28wuchen/T506/T506_marked_bqsr.bam -o ./ -t T506
"""
| 40.837838
| 264
| 0.762409
|
e00694acd091d44a6fbb848952980b93951853b3
| 480
|
php
|
PHP
|
resources/views/livewire/frontend/common/sub-category-list.blade.php
|
mbd24/blog
|
1041cd6e885cfd90f8e4b920dee4d48139ae3e58
|
[
"MIT"
] | null | null | null |
resources/views/livewire/frontend/common/sub-category-list.blade.php
|
mbd24/blog
|
1041cd6e885cfd90f8e4b920dee4d48139ae3e58
|
[
"MIT"
] | null | null | null |
resources/views/livewire/frontend/common/sub-category-list.blade.php
|
mbd24/blog
|
1041cd6e885cfd90f8e4b920dee4d48139ae3e58
|
[
"MIT"
] | null | null | null |
<?php $dash.='-- '; ?>
@foreach($subcategories as $subcategory)
@if ($subcategory->posts->count() > 0)
<li><i class="fa-solid fa-angles-right"></i> <a href="{{ route('post-category', $subcategory->slug) }}">{{$dash}}{{$subcategory->name}} ({{ $subcategory->posts->count() }})</a></li>
@endif
@if(count($subcategory->subcategory))
@include('livewire.frontend.common.sub-category-list', ['subcategories' => $subcategory->subcategory])
@endif
@endforeach
| 48
| 185
| 0.627083
|
b31a0122660d2f37bf6822970447885785f59113
| 17,266
|
py
|
Python
|
cidr_trie/__init__.py
|
Figglewatts/cidr-trie
|
2e6fe499fdc48e81188a99cdfdf232bc02422608
|
[
"MIT"
] | 7
|
2019-11-30T15:43:54.000Z
|
2021-05-24T19:44:37.000Z
|
cidr_trie/__init__.py
|
Figglewatts/cidr-trie
|
2e6fe499fdc48e81188a99cdfdf232bc02422608
|
[
"MIT"
] | 10
|
2019-07-13T01:28:47.000Z
|
2021-08-11T06:14:59.000Z
|
cidr_trie/__init__.py
|
Figglewatts/cidr-trie
|
2e6fe499fdc48e81188a99cdfdf232bc02422608
|
[
"MIT"
] | 2
|
2019-07-13T01:28:53.000Z
|
2020-07-18T18:05:56.000Z
|
"""Store CIDR IP addresses (both v4 and v6) in a PATRICIA trie for easy lookup.
A Patricia trie can be created, inserted to, and searched like this
.. code-block:: python
trie = PatriciaTrie()
trie.insert("0.0.0.0/0", "Internet")
trie.insert("32.0.0.0/9", "RIR-A")
trie.insert("32.128.0.0/9", "RIR-B")
trie.insert("32.32.0.0/16", "another")
trie.insert("32.32.32.0/24", "third")
trie.insert("32.32.32.32/32", "you")
trie.insert("192.168.0.1/32", "totally different")
trie.insert("33.0.0.0/8", "RIR3")
trie.insert("64.0.0.0/8", "RIR2")
# find all node values on the way down
print(trie.find_all("32.32.32.32"))
"""
import threading
from .cidr_util import is_v6, cidr_atoi, longest_common_prefix_length, get_subnet_mask, ip_itoa
from .bits_util import is_set, ffs
from typing import Any, List, Dict, Tuple
class PatriciaNode:
"""A node in the Patricia trie.
Attributes:
ip (int): The IP address associated with this node.
bit (int): How many bits along the IP the decision is made to branch.
masks (Dict[int, Any]): The data stored on this node. Maps netmasks to data.
left (PatriciaNode): The left subtrie of this node. Self pointer if no left node.
right (PatriciaNode): The right subtrie of this node. Self pointer if no right node.
parent (PatriciaNode): The parent node of this node. None if root node.
"""
def __init__(self, ip: int=0, bit: int=0, masks: Dict[int, Any]={}) -> None:
self.ip = ip
self.bit = bit
self.masks = masks
self.left = self
self.right = self
self.parent = None
def __str__(self):
return f"IP: {self.ip}, Decision bit: {self.bit}"
def get_values(self, prefix: str) -> List[Tuple[str, Any]]:
"""Get values from this node by iterating through netmasks and
checking to see if the given prefix is contained within.
Args:
prefix: The prefix to use to check, i.e. "192.168.0.0/16"
Returns:
List[Tuple[str, Any]]: list of tuples of prefixes and values, i.e. [("192.168.0.0/16", 2856), ...]
"""
# parse the CIDR string
ip, mask = cidr_atoi(prefix)
v6 = is_v6(prefix)
result = []
# for each mask stored on this node, check to see if the IP given by the
# prefix masked by the mask is equal to the IP stored in the node
# this indicates that this IP is within the network defined by the node
# and particular netmask
for m in self.masks.keys():
# if the mask is greater than the given mask, there's no way the
# prefix can be in this range, as it's bigger than this network
if m > mask:
continue
# make sure this ip is within the network defined by the mask
if self.ip == (ip & get_subnet_mask(m, v6)):
ip_str = f"{ip_itoa(self.ip, v6)}/{m}"
result.append((ip_str, self.masks[m]))
return result
def get_child_values(self, prefix: str) -> List[Tuple[str, Any]]:
"""Get all child values from this node by iterating through netmasks and
checking to see if the given prefix is larger than the given netmask.
Args:
prefix: The prefix to use to check, i.e. "192.168.0.0/16"
Returns:
List[Tuple[str, Any]]: list of tuples of prefixes and values, i.e. [("192.168.0.0/16", 2856), ...]
"""
# parse the CIDR string
_, mask = cidr_atoi(prefix)
v6 = is_v6(prefix)
result = []
# for each mask stored in this node, check to see if the netmask is
# greater than the given netmask
for m in self.masks.keys():
if m < mask:
continue
ip_str = f"{ip_itoa(self.ip, v6)}/{m}"
result.append((ip_str, self.masks[m]))
return result
class PatriciaTrie:
"""A Patricia trie that stores IP addresses and data.
Attributes:
root (PatriciaNode): The root element of the trie. Always exists as 0.0.0.0.
v6 (bool): Whether this trie stores IPv6 addresses or not.
size (int): The number of nodes in this trie, not counting the root node.
A Patricia trie can be created, inserted to, and searched like this
.. code-block:: python
trie = PatriciaTrie()
trie.insert("0.0.0.0/0", "Internet")
trie.insert("32.0.0.0/9", "RIR-A")
trie.insert("32.128.0.0/9", "RIR-B")
trie.insert("32.32.0.0/16", "another")
trie.insert("32.32.32.0/24", "third")
trie.insert("32.32.32.32/32", "you")
trie.insert("192.168.0.1/32", "totally different")
trie.insert("33.0.0.0/8", "RIR3")
trie.insert("64.0.0.0/8", "RIR2")
# find all node values on the way down
print(trie.find_all("32.32.32.32"))
"""
def __init__(self) -> None:
self.root = PatriciaNode(bit=-1)
self.v6 = False
self.size = 0
def validate_ip_type_for_trie(self, ip: str) -> None:
"""Make sure this IP is valid for this trie.
Raises:
ValueError: if trying to insert a v4 address into a v6 trie and vice-versa.
"""
v6 = is_v6(ip)
if v6 == True and self.v6 == False:
raise ValueError("Cannot store IPv6 prefix in IPv4 trie")
elif v6 == False and self.v6 == True:
raise ValueError("Cannot store IPv4 prefix in IPv6 trie")
def insert(self, prefix: str, data: Any) -> PatriciaNode:
"""Insert an IP and data into the trie.
If the IP was already in the trie it will overwrite the value.
.. code-block:: python
trie = PatriciaTrie()
trie.insert("192.168.0.0/16", 1234)
Args:
prefix: The prefix to insert, i.e. "192.168.0.0/16"
data: The value to associate with the IP and netmask.
Returns:
PatriciaNode: The node that was inserted in the trie.
Raises:
ValueError: When trying to store an IPv4 address in a trie currently storing IPv6 addresses, and vice-versa.
"""
if self.size == 0:
# set the v6 value if first insert
self.v6 = is_v6(prefix)
self.validate_ip_type_for_trie(prefix)
ip, mask = cidr_atoi(prefix)
# traverse the trie until we get to a leaf to check
last_bit = -2 # -2 as it has to be lower than the root (which is -1)
cur_node = self.root
while last_bit < cur_node.bit:
last_bit = cur_node.bit
if is_set(cur_node.bit, ip, self.v6):
cur_node = cur_node.right
else:
cur_node = cur_node.left
# check to see if the IP is equal
if cur_node.ip == ip:
cur_node.masks[mask] = data
return cur_node
# they're different, so find the rightmost bit where they differ
differ_bit = 0
while is_set(differ_bit, cur_node.ip, self.v6) == is_set(differ_bit, ip, self.v6):
differ_bit += 1
# special case: if we're inserting a node below the root, we want to
# set the bit to the rightmost set bit, otherwise the bit will be set
# to zero, causing other non-subprefix nodes to be inserted below
# this node erroneously
if differ_bit == 0:
differ_bit = (127 if self.v6 else 31) - ffs(ip)
# travel down the trie to that point
last_node = PatriciaNode(bit=-2) # -2 as it has to be lower than the root (-1)
cur_node = self.root
while last_node.bit < cur_node.bit and cur_node.bit <= differ_bit:
last_node = cur_node
if is_set(cur_node.bit, ip, self.v6):
cur_node = cur_node.right
else:
cur_node = cur_node.left
# create the new node
to_insert = PatriciaNode(ip, differ_bit, {mask: data})
# figure out where to put child
if is_set(to_insert.bit, cur_node.ip, self.v6):
to_insert.right = cur_node
else:
to_insert.left = cur_node
# set the child's new parent if it isn't pointing back up
if cur_node.bit > to_insert.bit:
cur_node.parent = to_insert
# figure out which side to insert on
if is_set(last_node.bit, ip, self.v6):
last_node.right = to_insert
else:
last_node.left = to_insert
to_insert.parent = last_node
self.size += 1
return to_insert
def check_value_exists(self, prefix: str) -> (bool, bool):
"""Check to see if a value exists in the trie already.
Returns 2 bools, the first to indicate whether the IP existed in the trie, and the
second to indicate whether the mask existed on that IP.
There can only be one of any IP stored in the trie, if you stored 2 prefixes,
"192.168.0.0/16", and "192.168.0.0/24", the data would be stored on the same
node, as the IP address "192.168.0.0" is the same. Even though these refer
to 2 separate networks.
This method exists so you can check to see if this will happen. The first boolean
returned indicates if an IP address is already present, for example in the case
above, if called after inserting "192.168.0.0/16", this method would return True
in the first boolean for a prefix of "192.168.0.0/24" and other netmasks, and False
for the second boolean.
The second boolean is for checking if the mask is present -- if called after
inserting "192.168.0.0/16" with a prefix of "192.168.0.0/16" it would return
True for both booleans.
Args:
prefix: The prefix to find in the trie, i.e. "192.168.0.0/16"
Returns:
(bool, bool): A 2-tuple of bools indicating whether the IP existed and the mask existed, respectively.
Raises:
ValueError: When trying to find an IPv4 address in a v6 trie and vice-versa.
"""
self.validate_ip_type_for_trie(prefix)
# parse the CIDR string
ip, mask = cidr_atoi(prefix)
# traverse the trie with the given IP
last_node = None
for node in self.traverse(prefix):
last_node = node
if node.ip == ip:
break
ip_exists = False
mask_exists = False
if last_node.ip == ip:
# if the last node's IP equals this IP, the IP exists
# we now need to check if the mask is in the set of masks
ip_exists = True
mask_exists = mask in last_node.masks
return ip_exists, mask_exists
def find(self, prefix: str) -> PatriciaNode:
"""Find a value in the trie.
Args:
prefix: The prefix to find in the trie, i.e. "192.168.0.0/16"
Returns:
PatriciaNode: The node if found, None otherwise.
Raises:
ValueError: When trying to find an IPv4 address in a v6 trie and vice-versa.
"""
self.validate_ip_type_for_trie(prefix)
ip, _ = cidr_atoi(prefix)
for node in self.traverse(prefix):
if node.ip == ip:
return node
# if we get to here, the node isn't in the trie
return None
def find_all(self, prefix: str, children: bool=False) -> List[Tuple[str, Any]]:
"""Find all values for this prefix, traversing the trie at all levels.
With get all values from common prefixes of 'prefix', then traverse all
children of 'prefix' to get their values too.
Args:
prefix: The prefix to find in the trie.
children: Whether to find all child values of the exact node found. (Defaults to False, as this isn't performant in large tries)
Returns:
List[Tuple[str, Any]]: list of tuples of prefixes and values, i.e. [("192.168.0.0/16", 2856), ...]
Raises:
ValueError: When trying to find an IPv4 address in a v6 trie and vice-versa.
"""
self.validate_ip_type_for_trie(prefix)
result = []
ip, mask = cidr_atoi(prefix)
# for each node on the way down
last_node = None
for node in self.traverse(prefix):
result += node.get_values(prefix)
last_node = node
if node.ip == ip:
break
if children and last_node.ip == ip:
# for each child node underneath the last found node
for node in self.traverse_inorder_from_node(last_node):
# skip the first node, as it's already in the result
if node.ip == last_node.ip:
continue
# make sure this child is within the prefix
if (node.ip & get_subnet_mask(mask, self.v6)) == (ip & get_subnet_mask(mask, self.v6)):
result += node.get_child_values(prefix)
return result
def traverse(self, prefix: str) -> PatriciaNode:
"""Traverse the entire trie (from root) using a prefix.
Args:
prefix: The prefix to find in the trie, i.e. "192.168.0.0/16"
Yields:
PatriciaNode: The next node traversed when searching for 'prefix'.
Raises:
ValueError: When trying to find an IPv4 address in a v6 trie and vice-versa.
"""
for node in self.traverse_from_node(self.root, prefix):
yield node
def traverse_from_node(self, node: PatriciaNode, prefix: str) -> PatriciaNode:
"""Traverse the trie from a specific node using a prefix.
Args:
node: The node to start traversing from.
prefix: The prefix to find in the trie, i.e. "192.168.0.0/16"
Yields:
PatriciaNode: The next node traversed when searching for 'prefix'.
Raises:
ValueError: When trying to find an IPv4 address in a v6 trie and vice-versa.
"""
self.validate_ip_type_for_trie(prefix)
ip, _ = cidr_atoi(prefix)
# look for a leaf
last_node = PatriciaNode(bit=-2) # -2 as it has to be lower than the root (-1)
cur_node = node
while last_node.bit < cur_node.bit:
last_node = cur_node
yield cur_node
if is_set(cur_node.bit, ip, self.v6):
cur_node = cur_node.right
else:
cur_node = cur_node.left
def traverse_inorder(self) -> PatriciaNode:
"""Perform an inorder traversal of the trie from the root node.
Yields:
PatriciaNode: The next node in the traversal.
Raises:
ValueError: When trying to find an IPv4 address in a v6 trie and vice-versa.
"""
for node in self.traverse_inorder_from_node(self.root):
yield node
def traverse_inorder_from_node(self, node: PatriciaNode) -> PatriciaNode:
"""Perform an inorder traversal of the trie from a given node.
Args:
node: The node to traverse from.
Yields:
PatriciaNode: The next node in the traversal.
Raises:
ValueError: When trying to find an IPv4 address in a v6 trie and vice-versa.
"""
stack = []
last_bit = -2 # -2 as it has to be lower than the root (-1)
cur_node = node
while len(stack) > 0 or last_bit < cur_node.bit:
while last_bit < cur_node.bit:
stack.append(cur_node)
last_bit = cur_node.bit
cur_node = cur_node.left
if len(stack) > 0:
cur_node = stack.pop()
yield cur_node
last_bit = cur_node.bit
cur_node = cur_node.right
def traverse_preorder(self) -> PatriciaNode:
"""Perform a preorder traversal of the trie from the root node.
Yields:
PatriciaNode: The next node in the traversal.
Raises:
ValueError: When trying to find an IPv4 address in a v6 trie and vice-versa.
"""
for node in self.traverse_preorder_from_node(self.root):
yield node
def traverse_preorder_from_node(self, node: PatriciaNode) -> PatriciaNode:
"""Perform a preorder traversal of the trie from a given node.
Args:
node: The node to traverse from.
Yields:
PatriciaNode: The next node in the traversal.
Raises:
ValueError: When trying to find an IPv4 address in a v6 trie and vice-versa.
"""
stack = []
last_bit = -2 # -2 as it has to be lower than the root (-1)
cur_node = node
while len(stack) > 0 or last_bit < cur_node.bit:
while last_bit < cur_node.bit:
stack.append(cur_node)
yield cur_node
last_bit = cur_node.bit
cur_node = cur_node.left
if len(stack) > 0:
cur_node = stack.pop()
last_bit = cur_node.bit
cur_node = cur_node.right
| 36.503171
| 140
| 0.587513
|
2c8c834831719e425d519b2c0b9966f3d5ef31b0
| 1,035
|
cpp
|
C++
|
Problem Set Volumes/Volume 2/291 - The House Of Santa Claus.cpp
|
ztrixack/uva-online-judge
|
ef87e745390a6a1965fe06621e50c6dc48db7257
|
[
"MIT"
] | null | null | null |
Problem Set Volumes/Volume 2/291 - The House Of Santa Claus.cpp
|
ztrixack/uva-online-judge
|
ef87e745390a6a1965fe06621e50c6dc48db7257
|
[
"MIT"
] | null | null | null |
Problem Set Volumes/Volume 2/291 - The House Of Santa Claus.cpp
|
ztrixack/uva-online-judge
|
ef87e745390a6a1965fe06621e50c6dc48db7257
|
[
"MIT"
] | null | null | null |
//============================================================================
// Name : 291 - The House Of Santa Claus.cpp
// Author : ztrixack
// Copyright : MIT License
// Description : 278 The House Of Santa Claus in C++, Ansi-style
// Run Time : 0.008 seconds
//============================================================================
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define FRI(i, a, b) for (i = a; i < b; ++i)
int mem[] = { 1, 2, 3, 1, 5, 3, 4, 5, 2 };
int main() {
int i, x, y;
bool ma;
do {
bool direct[5][5] = { {0, 1, 1, 0, 1}, {0, 0, 1, 0, 1}, {0, 0, 0, 1, 1}, {0, 0, 0, 0, 1}, {0, 0, 0, 0, 0} };
ma = true;
FRI (i, 0, 8) {
x = min(mem[i] - 1, mem[i + 1] - 1);
y = max(mem[i] - 1, mem[i + 1] - 1);
if (!(direct[x][y]) || direct[y][x]) {
ma = false;
break;
}
direct[y][x] = true;
}
if (ma) {
FRI(i, 0, 9) cout << mem[i];
cout << endl;
}
next_permutation(mem, mem + 9);
} while (mem[0] == 1);
return 0;
}
| 25.875
| 110
| 0.416425
|
1abb5442866e6f959af496e22fcc22f25e962b2d
| 1,520
|
dart
|
Dart
|
test/over_react_test/common_component_util_test.dart
|
greglittlefield-wf/over_react_test
|
186f1eb4e3ecfc8d4263665e3d36870955999b99
|
[
"Apache-2.0"
] | null | null | null |
test/over_react_test/common_component_util_test.dart
|
greglittlefield-wf/over_react_test
|
186f1eb4e3ecfc8d4263665e3d36870955999b99
|
[
"Apache-2.0"
] | null | null | null |
test/over_react_test/common_component_util_test.dart
|
greglittlefield-wf/over_react_test
|
186f1eb4e3ecfc8d4263665e3d36870955999b99
|
[
"Apache-2.0"
] | null | null | null |
// Copyright 2017 Workiva Inc.
//
// 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.
import 'package:over_react/over_react.dart';
import 'package:test/test.dart';
import 'package:over_react_test/over_react_test.dart';
import './utils/test_common_component.dart';
import './utils/test_common_component_required_props.dart';
/// Main entry point for [commonComponentTests] testing
main() {
group('commonComponentTests', () {
// TODO: Improve / expand upon these tests.
group('should pass when the correct unconsumed props are specified', () {
commonComponentTests(TestCommon, unconsumedPropKeys: [
PropsThatShouldBeForwarded.meta.keys,
]);
});
group('should pass when the correct required props are specified', () {
commonComponentTests(() => TestCommonRequired()..bar = true,
shouldTestRequiredProps: true,
shouldTestClassNameMerging: false,
shouldTestClassNameOverrides: false,
shouldTestPropForwarding: false);
});
});
}
| 37.073171
| 77
| 0.721053
|
29c51e707e11687f327a060a44020847dad1860f
| 884
|
rb
|
Ruby
|
app/controllers/lakatan/notifications_controller.rb
|
platanus/lakatan-engine
|
8bbffe81bc360af72d96d80b53f1ff2bc03882e7
|
[
"MIT"
] | null | null | null |
app/controllers/lakatan/notifications_controller.rb
|
platanus/lakatan-engine
|
8bbffe81bc360af72d96d80b53f1ff2bc03882e7
|
[
"MIT"
] | null | null | null |
app/controllers/lakatan/notifications_controller.rb
|
platanus/lakatan-engine
|
8bbffe81bc360af72d96d80b53f1ff2bc03882e7
|
[
"MIT"
] | null | null | null |
module Lakatan
class NotificationsController < ::ApplicationController
skip_before_action :verify_authenticity_token
def create
respond_to do |format|
format.json { render update_model }
end
end
private
def update_model
Lakatan::UpdateModelJob.perform_later(
update_request.model_name,
update_request.model_id,
update_request.notification_action
)
{ json: { result: :success }.to_json, status: :accepted }
rescue StandardError => e
{ json: { result: :failure, error: e.message }.to_json, status: :internal_server_error }
end
def update_request
@update_request ||= Lakatan::UpdateModelRequest.new(permitted_params)
end
def permitted_params
params.permit(
:model_name,
:model_id,
:notification_action
).to_hash
end
end
end
| 23.891892
| 94
| 0.665158
|
c50b0326752952c64470908308227acf43d59f26
| 2,302
|
css
|
CSS
|
Runequest_3.5/combat/attackTemplate.css
|
MarkGrSlater/roll20-character-sheets
|
175de010a5d68f208c3eb92e61268ac5bcefc901
|
[
"MIT"
] | null | null | null |
Runequest_3.5/combat/attackTemplate.css
|
MarkGrSlater/roll20-character-sheets
|
175de010a5d68f208c3eb92e61268ac5bcefc901
|
[
"MIT"
] | null | null | null |
Runequest_3.5/combat/attackTemplate.css
|
MarkGrSlater/roll20-character-sheets
|
175de010a5d68f208c3eb92e61268ac5bcefc901
|
[
"MIT"
] | null | null | null |
/* style for melee attack template */
.sheet-rolltemplate-test div.sheet-template-container {
border: 2px solid #000 !important;
border-radius: 3px 3px 3px 3px;
}
.sheet-rolltemplate-test .sheet-template-header {
background-color: rgba(112, 32, 130,1);
color: #000;
padding: 2px;
border-bottom: 1px solid black;
line-height: 1.6em;
font-size: 1.2em;
}
.sheet-rolltemplate-test div {
padding: 5px;
border-bottom: 1px solid black;
}
.sheet-rolltemplate-test div:nth-child(odd) {
background-color: rgba(217, 217, 214,1);
}
.sheet-rolltemplate-test div:nth-child(even) {
background-color: rgba(233, 233, 233,1);
}
.sheet-rolltemplate-test div.sheet-normal:nth-child(even) {
background-color: #e5fd8e !important;
}
.sheet-rolltemplate-test div.sheet-special:nth-child(even) {
background-color: #d0fd8e !important;
}
.sheet-rolltemplate-test div.sheet-critical:nth-child(even) {
background-color: #a1fd8e !important;
}
.sheet-rolltemplate-test div.sheet-supercritical:nth-child(even) {
background-color: #8efdd3 !important;
}
.sheet-rolltemplate-test div.sheet-hypercritical:nth-child(even) {
background-color: #8ee8fd !important;
}
.sheet-rolltemplate-test div.sheet-normal:nth-child(odd) {
background-color: #e5fd8e !important;
}
.sheet-rolltemplate-test div.sheet-special:nth-child(odd) {
background-color: #d0fd8e !important;
}
.sheet-rolltemplate-test div.sheet-critical:nth-child(odd) {
background-color: #a1fd8e !important;
}
.sheet-rolltemplate-test div.sheet-supercritical:nth-child(odd) {
background-color: #8efdd3 !important;
}
.sheet-rolltemplate-test div.sheet-hypercritical:nth-child(odd) {
background-color: #8ee8fd !important;
}
.sheet-rolltemplate-test div.sheet-fail:nth-child(even) {
background-color: #fde18e !important;
}
.sheet-rolltemplate-test div.sheet-fumble:nth-child(even) {
background-color: #f28282 !important;
}
.sheet-rolltemplate-test .inlinerollresult {
display: inline-block;
min-width: 1.5em;
text-align: center;
border: 2px solid rgba(167, 168, 170,1);
}
.sheet-rolltemplate-test .inlinerollresult.fullcrit {
border: 2px solid #3FB315;
}
.sheet-rolltemplate-test .inlinerollresult.fullfail {
border: 2px solid #B31515;
}
.sheet-rolltemplate-test .inlinerollresult.importantroll {
border: 2px solid #4A57ED;
}
| 24.752688
| 67
| 0.742398
|
ee8aad8d06a5debdf806f5aa3c300e8a3ea1ccc6
| 748
|
rb
|
Ruby
|
modules/health_quest/config/routes.rb
|
darkbushido/vets-api
|
b436ad3cbcb35821995a3fd2499b8e0859179842
|
[
"CC0-1.0"
] | 150
|
2016-07-01T18:52:26.000Z
|
2022-03-30T11:30:31.000Z
|
modules/health_quest/config/routes.rb
|
darkbushido/vets-api
|
b436ad3cbcb35821995a3fd2499b8e0859179842
|
[
"CC0-1.0"
] | 3,372
|
2016-07-15T14:28:16.000Z
|
2022-03-31T17:18:40.000Z
|
modules/health_quest/config/routes.rb
|
darkbushido/vets-api
|
b436ad3cbcb35821995a3fd2499b8e0859179842
|
[
"CC0-1.0"
] | 63
|
2016-09-14T14:29:27.000Z
|
2022-03-30T20:48:10.000Z
|
# frozen_string_literal: true
HealthQuest::Engine.routes.draw do
match '/health_quest/v0/*path', to: 'application#cors_preflight', via: [:options]
namespace :v0, defaults: { format: :json } do
resources :lighthouse_appointments, only: %i[index show]
resources :locations, only: %i[index show]
resources :organizations, only: %i[index show]
resources :pgd_questionnaires, only: %i[show]
resources :patients, only: %i[create]
resources :questionnaires, only: %i[index show]
resources :questionnaire_responses, only: %i[index show create]
resources :questionnaire_manager, only: %i[index show create]
get 'signed_in_patient', to: 'patients#signed_in_patient'
get 'apidocs', to: 'apidocs#index'
end
end
| 37.4
| 83
| 0.720588
|
38e10c3ddf4195935eca1ce70285961d1a56ffa6
| 4,125
|
php
|
PHP
|
contact/sales-map.php
|
QETHAN/theme-hengda
|
23471a02013705b4419ff8736205176fdb0d8629
|
[
"MIT"
] | null | null | null |
contact/sales-map.php
|
QETHAN/theme-hengda
|
23471a02013705b4419ff8736205176fdb0d8629
|
[
"MIT"
] | null | null | null |
contact/sales-map.php
|
QETHAN/theme-hengda
|
23471a02013705b4419ff8736205176fdb0d8629
|
[
"MIT"
] | null | null | null |
<?php
/*
* Template Name: Sales Map模板
* Template Post Type: post, page, product
*/
get_header();
?>
<?php get_template_part("template_parts/top"); ?>
<div id="m-warp">
<div class="s-middle">
<div class="s-left" id="conLeft" style="height: 1060px;">
<ul>
<li><a href="<?php echo home_url(); ?>/contact-us">Contact Us</a></li>
<?php $posts = get_posts( "category=39&numberposts=10&order=asc" ); ?>
<?php if( $posts ) : ?>
<ul><?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<li>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<li class="conLeftLast"></li>
</ul>
<div class="clear"></div>
</div>
<div class="s-right" id="conRight">
<div class="rightTitle">
<span class="guide">
<a href="<?php echo home_url(); ?>">Home</a> » <?php
$get_cat = get_the_category();
$first_cat = $get_cat[0];
$category_name = $first_cat->cat_name;
$category_link = get_category_link( $first_cat->cat_ID ); ?>
<a href="<?php echo esc_url( $category_link ); ?>" title="<?php echo esc_attr( ucfirst(strtolower($category_name)) ); ?>">
<?php echo esc_html( ucfirst(strtolower($category_name)) ); ?></a> » Sales Map</span>
<h1>Sales Map</h1>
</div>
<div class="about-info">
<p class="aboutinfo">Hengda company professional engaged in the research, development and manufacture of the complete sets of waste paper pulp and paper production equipment for over decades of years. Hengda are commited to establish a world brand in paper and pulp industry with professional skill and positive innovation spirit.</p>
<p>By taking science and technology as the guide, good product quality as assurance, with the sincere service at your back, Hengda provide high quality and low price complete sets of pulp and paper production equipment to our customers. Moreover, Hengda provide the perfect pre-sale and after-sale service for the customer from factory design to producing line design, installation, commissioning and training. </p>
<p>Thanks to the superior quality products and perfect services, our products has a huge market at home and aboard.</p>
<p>Domestic service network includes: Xinjiang, Shanxi, Shannxi, Hebei, Henan, Hunan, Anhui, Hubei, Liaoning, Jilin, Heilongjiang, Shandong, Guizhou, Sichuan, Yunnan, Jiangsu, Fujian, Jiangxi, Guangdong, etc. </p>
<p style="text-align: center"><img alt="Sales map" src="<?php echo home_url(); ?>/wp-content/themes/hengdapapermachine/images/contant6.jpg"></p>
<p>International service network includes: India, Indonesia, Iran, Egypt, Malaysia, Saudi Arabian, South Africa, Syria, Vietnam, Zambia, etc.</p>
<p style="text-align: center"><img alt="Sales map" src="<?php echo home_url(); ?>/wp-content/themes/hengdapapermachine/images/contant7.jpg"></p>
<p><img alt="Sales map" src="<?php echo home_url(); ?>/wp-content/themes/hengdapapermachine/images/contant3.jpg"></p>
<div style="width: 220px; float: right; height: 230px; clear: right"><img alt="Contact us" src="<?php echo home_url(); ?>/wp-content/themes/hengdapapermachine/images/contant2.jpg"></div>
<p>If you are interested in our products, welcome to our company or our local offices, you can also consult via telephone or email. We will offer you product details and working knowledge. You will not only get high quality equipment with competitive price but also intimate service.</p>
<p> </p>
<p><strong>Sales Hotline: +86-371-69277066</strong></p>
<p>If you want to contact us for free immediately: please click <a rel="nofollow" target="_blank" href="" onclick="openZoosUrl('chatwin');" title="chat online"><strong>Free online service</strong></a>.</p>
<div class="clear"></div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
| 65.47619
| 426
| 0.65697
|
3a23bbd3b69b678badee12413a5511ccc6f31238
| 582
|
asm
|
Assembly
|
programs/oeis/002/A002994.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | 1
|
2021-03-15T11:38:20.000Z
|
2021-03-15T11:38:20.000Z
|
programs/oeis/002/A002994.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
programs/oeis/002/A002994.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
; A002994: Initial digit of cubes.
; 0,1,8,2,6,1,2,3,5,7,1,1,1,2,2,3,4,4,5,6,8,9,1,1,1,1,1,1,2,2,2,2,3,3,3,4,4,5,5,5,6,6,7,7,8,9,9,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
pow $0,3
lpb $0
mov $1,$0
div $0,10
lpe
| 64.666667
| 501
| 0.513746
|
0d8915618637c63a35359b187d53a9a230fc73c3
| 2,389
|
h
|
C
|
driver/ubuntu_1604/EW-7822ULC_Linux_Driver_1.0.1.6/hal/halmac/halmac_88xx/halmac_sdio_88xx.h
|
kjoelovelife/Knight_car
|
5d5909ce495094fdc46bb87be2e28be8ba718854
|
[
"CC-BY-2.0"
] | null | null | null |
driver/ubuntu_1604/EW-7822ULC_Linux_Driver_1.0.1.6/hal/halmac/halmac_88xx/halmac_sdio_88xx.h
|
kjoelovelife/Knight_car
|
5d5909ce495094fdc46bb87be2e28be8ba718854
|
[
"CC-BY-2.0"
] | null | null | null |
driver/ubuntu_1604/EW-7822ULC_Linux_Driver_1.0.1.6/hal/halmac/halmac_88xx/halmac_sdio_88xx.h
|
kjoelovelife/Knight_car
|
5d5909ce495094fdc46bb87be2e28be8ba718854
|
[
"CC-BY-2.0"
] | 4
|
2019-08-17T03:36:07.000Z
|
2020-09-29T02:19:46.000Z
|
/******************************************************************************
*
* Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
******************************************************************************/
#ifndef _HALMAC_SDIO_88XX_H_
#define _HALMAC_SDIO_88XX_H_
#include "../halmac_api.h"
#if HALMAC_88XX_SUPPORT
enum halmac_ret_status
init_sdio_cfg_88xx(struct halmac_adapter *adapter);
enum halmac_ret_status
deinit_sdio_cfg_88xx(struct halmac_adapter *adapter);
enum halmac_ret_status
cfg_sdio_rx_agg_88xx(struct halmac_adapter *adapter,
struct halmac_rxagg_cfg *cfg);
enum halmac_ret_status
cfg_txagg_sdio_align_88xx(struct halmac_adapter *adapter, u8 enable,
u16 align_size);
u32
sdio_indirect_reg_r32_88xx(struct halmac_adapter *adapter, u32 offset);
enum halmac_ret_status
sdio_reg_rn_88xx(struct halmac_adapter *adapter, u32 offset, u32 size,
u8 *value);
enum halmac_ret_status
set_sdio_bulkout_num_88xx(struct halmac_adapter *adapter, u8 num);
enum halmac_ret_status
get_sdio_bulkout_id_88xx(struct halmac_adapter *adapter, u8 *buf, u32 size,
u8 *id);
enum halmac_ret_status
sdio_cmd53_4byte_88xx(struct halmac_adapter *adapter,
enum halmac_sdio_cmd53_4byte_mode mode);
enum halmac_ret_status
sdio_hw_info_88xx(struct halmac_adapter *adapter,
struct halmac_sdio_hw_info *info);
void
cfg_sdio_tx_page_threshold_88xx(struct halmac_adapter *adapter,
struct halmac_tx_page_threshold_info *info);
enum halmac_ret_status
cnv_to_sdio_bus_offset_88xx(struct halmac_adapter *adapter, u32 *offset);
enum halmac_ret_status
leave_sdio_suspend_88xx(struct halmac_adapter *adapter);
u32
r_indir_sdio_88xx(struct halmac_adapter *adapter, u32 adr,
enum halmac_io_size size);
enum halmac_ret_status
w_indir_sdio_88xx(struct halmac_adapter *adapter, u32 adr, u32 val,
enum halmac_io_size size);
#endif /* HALMAC_88XX_SUPPORT */
#endif/* _HALMAC_SDIO_88XX_H_ */
| 29.8625
| 80
| 0.753035
|
af6472ceb3d6a5becbc7b863f8eece39269a9b5b
| 16,035
|
py
|
Python
|
app.py
|
Abduarraheem/RapAnalysis
|
b5f2eb48a1742d718364769317ceb6dd8433522e
|
[
"MIT"
] | null | null | null |
app.py
|
Abduarraheem/RapAnalysis
|
b5f2eb48a1742d718364769317ceb6dd8433522e
|
[
"MIT"
] | null | null | null |
app.py
|
Abduarraheem/RapAnalysis
|
b5f2eb48a1742d718364769317ceb6dd8433522e
|
[
"MIT"
] | 4
|
2020-11-24T02:47:34.000Z
|
2021-03-31T05:33:31.000Z
|
'''
Juno Mayer, Alex Marozick and Abduarraheem Elfandi
'''
from flask import Flask, render_template, url_for, request, redirect, abort, flash, jsonify, session, make_response
from flask_session import Session
from pprint import pprint as pp
from werkzeug.utils import secure_filename
from werkzeug.exceptions import HTTPException, default_exceptions, Aborter
from spotipy.oauth2 import SpotifyOAuth
import os
import pprint
import requests
import json
import config
import spotipy
import time
import uuid
import logging
import pymongo
import analyzeSong
import datetime
import spotifyData
# logging.basicConfig(level=app.logger.debug)
class FileTypeException(HTTPException): # this error is thrown when the file type is incorrect
code = 400
description = 'Error: File Type Incorrect!'
default_exceptions[400] = FileTypeException
abort = Aborter()
session_counter = 0 # for debugging
app = Flask(__name__)
secret_key = os.urandom(64)
app.secret_key = secret_key
app.config['SESSION_TYPE'] = 'filesystem'
app.config['SESSION_FILE_DIR'] = './.flask_session/'
Session(app)
scope = "playlist-modify-public playlist-read-private user-follow-read user-read-recently-played"
client_id = config.get('SPOTIPY_CLIENT_ID','api') # NOTE hey do this
client_secret = config.get('SPOTIPY_CLIENT_SECRET','api') # NOTE hey do this
token_url = 'https://accounts.spotify.com/api/token'
mongo_clusters = config.get("CLIENT",'MONGODB')
db_name = config.get("DB_NAME",'MONGODB')
cluster = pymongo.MongoClient(mongo_clusters)
db = cluster[db_name]
possible_hues = [i for i in range(0,370) if i % 10 == 0]
# NOTE Make sure this is also the same in your Spotify app.
REDIRECT_URI = config.get('SPOTIPY_REDIRECT_URI','uri')
GENIUS_ACCESS_TOKEN = config.get('GENIUS_CLIENT_ACCESS_TOKEN','api')
# All the cached spotify data will be in this folder
# but will be deleted as soon as the user signsout/session ends.
caches_folder = '.spotify_caches/'
if not os.path.exists(caches_folder):
os.makedirs(caches_folder)
def session_cache_path():
'''
Function that returns the session cached path (basically the cache folder).
'''
app.logger.debug("Starting session_cache_path") # for debugging
app.logger.debug(caches_folder) # for debugging
app.logger.debug(session.get('uuid')) # for debugging
app.logger.debug("Finished session_cache_path") # for debugging
return caches_folder + session.get('uuid')
def getsongdata(songdict :list) -> list:
'''
Gets the lyrics of a dict of artists and their songs
songdict : {"song" : SONGNAME, "artist"}
returns [{object_id: ObjectID, "album": ALBUM, "colors" : COLORS, 'lyrics' : LYRICS}]
COLORS is a list of lists. Each sublist corresponds to a section of the song (deliminated by something like [Intro] or [Chorus])
'''
dbArtists = db.list_collection_names()
res = []
query_result = []
#for each song
for item in songdict:
#case of multiple artists per song
if type(item['artist']) == list: # NOTE the way I am doing these checks could probably be done better also something else to consider is what if no artist is given - Abduarraheem
for a in item['artist']:
artist = a.lower().replace("$","s").replace(".", "")
# query_result = db[artist].find({ "song": item['song'] })
if artist in dbArtists:
query_result = db[artist].find({"$text" :{"$search" : item['song'], "$caseSensitive" : False}})
# print(item['song'])
# break because one of the artists was in the data base,
# NOTE then since we can't be 100% sure that this artist
# has the song we are looking for we would need to go
# to the next artist in the list to check if the artist has the song given.
break
#case of one artist per song
else:
artist = item['artist'].lower().replace("$","s").replace(".", "")
if artist in dbArtists:
query_result = db[artist].find({"$text" :{"$search" : item['song'], "$caseSensitive" : False}})
if query_result == []:
print(f"Error Artist {artist} not in the Data Base")
continue
# res.append("NoArtist")
try:
docs = [doc for doc in query_result]
res.append(docs)
except (UnboundLocalError, TypeError): # if the artist wasn't in the db, go the next song.
continue
# pp(res)
logging.debug(f"RETURNING {res} from getsongdata")
return res
@app.route('/')
def index():
return render_template("index.html")
@app.route('/about')
def about():
return render_template("about.html")
@app.route('/_analyzeSpotify')
def analyzeSpotify():
print(request.args)
analyzeType = request.args.get('type')
# print(playlist)
sp_oauth = SpotifyOAuth(client_id=client_id, client_secret=client_secret, redirect_uri=REDIRECT_URI,
scope=scope, cache_path=session_cache_path(), show_dialog=True)
spotify = spotipy.Spotify(auth_manager=sp_oauth)
if analyzeType == 'playlist':
playlistID = request.args.get('playlistID')
songs_artists = spotifyData.get_songs_from_playlist(spotify, playlistID)
songdata = getsongdata(songs_artists)
elif analyzeType == 'recent':
recent_num = request.args.get('recent_num', 10, int)
songs_artists = spotifyData.get_recent_plays(spotify, recent_num)
songdata = getsongdata(songs_artists)
songs = []
# get all song names from the playlist
songnames = [songname['song'] for songname in songs_artists]
# loop through all the queries returned from getsongdata
for i, query in enumerate(songdata):
# Set skip to be true for init
if query is not []:
skip = True
# strip some characters from the song name that was gotten from the playlist
songnameP = ((songnames[i].lower()).strip(" ")).replace(".",'')
# loop through the results of one query
for songDict in query:
# strip some characters from the song name that was gotten from the query
#print(f'Song name from playlist{songnameP}') # for debugging
songnameDB = ((songDict['song'].lower()).strip(" ")).replace(".",'')
#print(f'Song name from Data Base{songnameDB}') # for debugging
# check if the song name from the play list is a sub string of the one gotten from the database,
# NOTE this check might need to be modified.
if songnameP in songnameDB:
skip = False # if so then do not skip
if not skip:
# call functions
lyrics, colors = parse_songdata2(songDict)
highlighted = highlight_words(lyrics,colors)
songs.append({'song' : songnames[i], 'index' : i, 'highlight' : highlighted})
break
else:
print(f"Missing Artist {songnames[i]}")
return jsonify(result=songs)
def parse_songdata2(songdata : dict) -> (list, list):
'''
Pareses a songdata query from the DB and returns a list of lyrics and colors to be
applied
'''
skip_header = False
proc_lyrics = []
proc_colors = []
# add a check to see if songdata is none.
proc_lyrics = songdata['lyrics'] # string
if 'colors' in songdata:
proc_colors = songdata['colors']
else:
proc_colors = songdata['rhyme']
# list of lists
app.logger.debug(proc_lyrics)
app.logger.debug(proc_colors)
# split the lyrics into a list of lists
split_newl = proc_lyrics.replace('\n', '\n ').split(' ')
#take section headers out of lyrics
lyrics_nosection = []
for word in split_newl:
if '[' in word:
skip_header = True
if ']' in word:
skip_header = False
continue
if not skip_header:
lyrics_nosection.append(word)
colorlist = []
for l in proc_colors:
for color in l:
colorlist.append(color)
# these should be roughly the same
#print(len(lyrics_nosection))
#print(len(colorlist))
return lyrics_nosection, colorlist
@app.route('/spotify_login')
def spotify_login():
# global session_counter # used for debugging
# If a new user joins give random id to the user.
if not session.get('uuid'):
session['uuid'] = str(uuid.uuid4())
# session_counter +=1 # for debugging
# print(f"Session counter: {session_counter}\n Session id: {session['uuid']}") # for debugging
sp_oauth = SpotifyOAuth(client_id=client_id, client_secret=client_secret, redirect_uri=REDIRECT_URI,
scope=scope, cache_path=session_cache_path(), show_dialog=True)
# Authorization Code Flow Step 2
if request.args.get('code'):
auth_code = request.args.get('code') # get the code from the url.
sp_token = sp_oauth.get_access_token(auth_code) # use that code to get a token
return redirect("/spotify_login")
display = "Login to Spotify"
if sp_oauth.get_cached_token():
# Authorization Code Flow Step 3
# NOTE here we can get data from the Spotify API.
spotify = spotipy.Spotify(auth_manager=sp_oauth)
display = "User: " + spotify.me()["display_name"] + " (Sign Out)"
spotify_data = spotifyData.spotify_data(spotify)
# pp(spotify_data)
return render_template("spotify.html", display=display, playlists=spotify_data["playlists"])
return render_template("spotify_login.html", display=display)
@app.route('/login-btn', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
try:
sp_oauth = SpotifyOAuth(client_id=client_id, client_secret=client_secret, redirect_uri=REDIRECT_URI,
scope=scope, cache_path=session_cache_path(), show_dialog=True)
# So if we have a token(which means we are logged in)
# and the login button is clicked then we need to sign out
if not sp_oauth.get_cached_token():
# Authorization Code Flow Step 1
auth_url = sp_oauth.get_authorize_url()
return redirect(auth_url)
return redirect("/sign_out")
except TypeError:
pass
return redirect("spotify_login")
@app.route('/sign_out')
def sign_out():
try:
os.remove(session_cache_path())
session.clear()
except OSError as e:
print ("Error: %s - %s." % (e.filename, e.strerror))
return redirect('/')
# @app.route('/user-lyrics')
# def analyze_user_lyrics():
# print("GOT INTO USER LYRICS")
# lyrics = request.args.get('textboxid')
# if lyrics is None:
# print('lyrics is none')
# print(lyrics)
# return jsonify(result=lyrics)
@app.route('/get-lyrics')
def get_input():
song_name = request.args.get('songid')
artist_name = request.args.get('artistid')
error = ''
if (song_name == '' or artist_name == ''):
print("User submitted an empty string: returning to throw error message")
return jsonify(result = error)
# print(song_name)
# print(artist_name)
song_name = song_name.strip()
artist_name = artist_name.strip()
app.logger.debug(song_name)
app.logger.debug(artist_name)
# pass in a dictionary to display and highlight in form {"song": song_name, "artist" : artist_name}
songdata = getsongdata([{'song': song_name, 'artist': artist_name}])
if songdata == []:
return jsonify(result=f"Could not find artist {artist_name} in Database")
elif songdata == [[]]:
return jsonify(result="Found the Artist, but not the song! Check your spelling")
# app.logger.debug(f"Result from query: \n {songdata}")
songnames = [song[0]['song'] for song in songdata]
print(songnames)
lyrics = []
colors = []
for query in songdata:
for song in query:
print(song)
if song_name.lower().replace("'","") in song['song'].lower().replace('’', ""):
lyrics, colors = parse_songdata2(song)
break
if len(lyrics) + len(colors) == 0:
return jsonify(result="Found the Artist, but not the song! Sorry! PARSE ")
highlighted = highlight_words(lyrics,colors)
return jsonify(result = highlighted)
def highlight_words(lyrics : str, colorlist : list):
"""
Applies a list of colors to a list of lyrics
"""
possible_hues = [i for i in range(0,370) if i % 10 == 0]
#print(lyrics)
highlighted = ""
coloritr = 0
skip = False
for idx, word in enumerate(lyrics):
first_pass = True
try:
if word != '\n':
if colorlist[coloritr] != -1:
num = colorlist[coloritr]
modded_num = (num *2) % len(possible_hues)
if modded_num == 0 and first_pass == False:
num += 1
if possible_hues[modded_num] in [350,360]:
first_pass = False
hue = possible_hues[modded_num]
lum = 80 if (modded_num) % 2 == 0 else 50
highlightword = f'<mark style=\"background: hsl({hue}, 100% ,{lum}% );\">{word}</mark> '
if '\n' in word:
highlightword += '<br>'
highlighted += highlightword
else:
highlighted += word.replace('\n','<br>') if '\n' in word else f"{word} "
coloritr +=1
else:
highlighted += '<br>'
app.logger.debug(f'FOUND NEWLINE at {idx}')
except IndexError:
app.logger.debug(f"OVERFLOW at word {idx} out of {len(lyrics)}-- here's whats left")
app.logger.debug(lyrics[idx:])
return highlighted
# if not skip
return highlighted
@app.errorhandler(404)
def page_not_found(e):
return render_template("404.html"), 404
@app.errorhandler(403)
def page_forbidden(e):
return render_template("403.html"), 403
if __name__ == "__main__":
app.run(debug=False)
# def parse_songdata(artist_name : str,song_name : str, songdata : list) -> (list, list):
# '''
# Pareses a songdata query from the DB and returns a list of lyrics and colors to be
# applied
# '''
# skip_header = False
# proc_lyrics = songdata['lyrics'] # string
# proc_colors = songdata['colors'] # list of lists
# # app.logger.debug(proc_lyrics)
# # app.logger.debug(proc_colors)
# if proc_lyrics == []:
# return [],[]
# # split the lyrics into a list of lists
# split_newl = proc_lyrics.replace('\n', '\n ').split(' ')
# #take section headers out of lyrics
# lyrics_nosection = []
# for word in split_newl:
# if '[' in word:
# skip_header = True
# if ']' in word:
# skip_header = False
# continue
# if not skip_header:
# lyrics_nosection.append(word)
# # app.logger.debug(lyrics_nosection)
# #flatten colorlist from [list[lyrics]] to [lyrics]
# colorlist = []
# for l in proc_colors:
# for color in l:
# colorlist.append(color)
# # these should be roughly the same
# print(len(lyrics_nosection))
# print(len(colorlist))
# return lyrics_nosection, colorlist
| 35.319383
| 186
| 0.607297
|
dcf02bd151b866fc5069bd69b5a73d9bb79553a9
| 1,011
|
rb
|
Ruby
|
lib/sequelize.rb
|
Jesterovskiy/sequelize
|
3eb0804c44f2691b87f625a4b42054735a6e4723
|
[
"MIT"
] | null | null | null |
lib/sequelize.rb
|
Jesterovskiy/sequelize
|
3eb0804c44f2691b87f625a4b42054735a6e4723
|
[
"MIT"
] | null | null | null |
lib/sequelize.rb
|
Jesterovskiy/sequelize
|
3eb0804c44f2691b87f625a4b42054735a6e4723
|
[
"MIT"
] | null | null | null |
require 'sequelize/version'
require 'sequel'
require 'adamantium'
require 'sequoia'
require 'sequelize/connection_options'
module Sequelize
class << self
include Sequoia::Configurable
attr_reader :config, :connection_options
def setup(env=:development)
@config = build_configuration(env)
setup_connection_options(env)
end
def connection
@connection ||= connect!
end
def connect!
Sequel.connect(options)
end
private
ADDITIONAL_OPTIONS_KEYS = Set.new([:logger, :after_connect]).freeze
def setup_connection_options(env)
@connection_options = ConnectionOptions::Reader.new(env, config).connection_options
end
def options
connection_options.to_hash.merge(additional_options)
end
def additional_options
source_config = config.to_hash
ADDITIONAL_OPTIONS_KEYS.each_with_object({}) do |key, result|
result[key] = source_config[key] if source_config.has_key? key
end
end
end
end
| 20.22
| 89
| 0.709199
|
b34c35c7201cd8644d244aa50d49831bd70f1b9d
| 1,885
|
py
|
Python
|
diesis/scrapers/LyricsScraper.py
|
RyanJ93/diesis
|
56b98f36bae56d63fa8558f3ac1d0dfdca79e1a6
|
[
"MIT"
] | 4
|
2020-12-23T11:50:45.000Z
|
2021-09-04T14:06:49.000Z
|
diesis/scrapers/LyricsScraper.py
|
RyanJ93/diesis
|
56b98f36bae56d63fa8558f3ac1d0dfdca79e1a6
|
[
"MIT"
] | null | null | null |
diesis/scrapers/LyricsScraper.py
|
RyanJ93/diesis
|
56b98f36bae56d63fa8558f3ac1d0dfdca79e1a6
|
[
"MIT"
] | null | null | null |
from typing import Optional
class LyricsScraper:
query: str = None
minimal_query: str = None
lyrics: str = None
lyrics_writer: str = None
def set_query(self, query: str, minimal_query: str) -> None:
"""
Sets the search query to use for lyrics look up.
:param query: A string containing the search query for this song.
:type query: str
:param minimal_query: A string containing a shorter query, usually it doesn't include texts inside parenthesis.
:type minimal_query: str
"""
self.query = query
self.minimal_query = minimal_query
def get_query(self, minimal: bool = False) -> str:
"""
Returns the search query that will be used for lyrics look up.
:param minimal: If set to "True", the shorter query version will be returned instead.
:type minimal: bool
:return: A string containing the search query, if no query has been defined, an empty string will be returned.
:rtype: str
"""
if minimal:
query: str = self.minimal_query
else:
query: str = self.query
if query is None:
return ''
return query
def get_lyrics(self) -> Optional[str]:
"""
Returns the lyrics that has been found, before using this method, you must invoke the "fetch" method.
:return: A string containing the song lyrics found, if no lyrics were found, None will be returned.
:rtype: Optional[str]
"""
return self.lyrics
def get_lyrics_writer(self) -> Optional[str]:
"""
Returns the authors who wrote the lyrics separated by a comma.
:return: A string containing the lyrics authors, if no author was found, None will be returned instead.
:rtype: Optional[str]
"""
return self.lyrics_writer
| 36.25
| 119
| 0.625995
|
0a6208271850c57e0c9644eb84d29165b5897f8d
| 810
|
cs
|
C#
|
src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/ProjectTreeVsExtensions.cs
|
aodl/project-system
|
eb2850aa96dd8936bec9455ea61cbe7cb0c04e8e
|
[
"Apache-2.0"
] | 1
|
2020-04-04T18:58:53.000Z
|
2020-04-04T18:58:53.000Z
|
src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/ProjectTreeVsExtensions.cs
|
aodl/project-system
|
eb2850aa96dd8936bec9455ea61cbe7cb0c04e8e
|
[
"Apache-2.0"
] | 1
|
2019-02-19T00:34:21.000Z
|
2019-02-19T00:34:21.000Z
|
src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/ProjectTreeVsExtensions.cs
|
aodl/project-system
|
eb2850aa96dd8936bec9455ea61cbe7cb0c04e8e
|
[
"Apache-2.0"
] | 1
|
2019-12-24T12:35:02.000Z
|
2019-12-24T12:35:02.000Z
|
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.VisualStudio.Shell;
namespace Microsoft.VisualStudio.ProjectSystem.VS
{
internal static class ProjectTreeVsExtensions
{
/// <summary>
/// Returns the specified <see cref="HierarchyId"/> for the specified node.
/// </summary>
/// <remarks>
/// This method should only be called on and the result used on the UI thread.
/// </remarks>
public static HierarchyId GetHierarchyId(this IProjectTree node)
{
return new HierarchyId(node.IsRoot() ? VSConstants.VSITEMID_ROOT : unchecked((uint)node.Identity));
}
}
}
| 38.571429
| 162
| 0.64321
|
5e1edfe8f11c1bbef75dd898e84404e618e0b9db
| 2,988
|
rb
|
Ruby
|
spec/classes/swift_proxy_ceilometer_spec.rb
|
charlesdunbar/puppet-swift
|
ad6a7e4987d68ef8d6870ca472dc3d048e11f509
|
[
"Apache-2.0"
] | null | null | null |
spec/classes/swift_proxy_ceilometer_spec.rb
|
charlesdunbar/puppet-swift
|
ad6a7e4987d68ef8d6870ca472dc3d048e11f509
|
[
"Apache-2.0"
] | 4
|
2022-03-22T07:29:22.000Z
|
2022-03-22T07:29:46.000Z
|
spec/classes/swift_proxy_ceilometer_spec.rb
|
puppetlabs-operations/puppet-swift
|
ad6a7e4987d68ef8d6870ca472dc3d048e11f509
|
[
"Apache-2.0"
] | 1
|
2017-03-23T19:32:44.000Z
|
2017-03-23T19:32:44.000Z
|
require 'spec_helper'
describe 'swift::proxy::ceilometer' do
let :facts do
OSDefaults.get_facts({ :osfamily => 'Debian' })
end
let :pre_condition do
'concat { "/etc/swift/proxy-server.conf": }
class { "swift":
swift_hash_path_suffix => "dummy"
}'
end
describe "when using default parameters" do
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/paste.filter_factory').with_value('ceilometermiddleware.swift:filter_factory') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://guest:guest@127.0.0.1:5672//') }
it { is_expected.to contain_user('swift').with_groups('ceilometer') }
it { is_expected.to contain_file('/var/log/ceilometer/swift-proxy-server.log').with(:owner => 'swift', :group => 'swift', :mode => '0664') }
end
describe "when overriding default parameters" do
let :params do
{ :group => 'www-data',
:rabbit_user => 'user_1',
:rabbit_password => 'user_1_passw',
:rabbit_host => '1.1.1.1',
:rabbit_port => '5673',
:rabbit_virtual_host => 'rabbit',
:driver => 'messagingv2',
:topic => 'notifications',
:control_exchange => 'swift',
}
end
context 'with single rabbit host' do
it { is_expected.to contain_user('swift').with_groups('www-data') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/paste.filter_factory').with_value('ceilometermiddleware.swift:filter_factory') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://user_1:user_1_passw@1.1.1.1:5673/rabbit') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/driver').with_value('messagingv2') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/topic').with_value('notifications') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/control_exchange').with_value('swift') }
end
context 'with multiple rabbit hosts' do
before do
params.merge!({ :rabbit_hosts => ['127.0.0.1:5672', '127.0.0.2:5672'] })
end
it { is_expected.to contain_user('swift').with_groups('www-data') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/paste.filter_factory').with_value('ceilometermiddleware.swift:filter_factory') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/url').with_value('rabbit://user_1:user_1_passw@127.0.0.1:5672,user_1:user_1_passw@127.0.0.2:5672/rabbit') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/driver').with_value('messagingv2') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/topic').with_value('notifications') }
it { is_expected.to contain_swift_proxy_config('filter:ceilometer/control_exchange').with_value('swift') }
end
end
end
| 48.193548
| 179
| 0.685074
|
e73ca235ac7da6507fb3ebd645d570ab18c87825
| 790
|
php
|
PHP
|
var/cache/dev/srcApp_KernelDevDebugContainer.php
|
Ajerbouh/symfony-demo-master
|
ba64c5bbdaa94a1930472828c6fe07a31099accb
|
[
"WTFPL"
] | null | null | null |
var/cache/dev/srcApp_KernelDevDebugContainer.php
|
Ajerbouh/symfony-demo-master
|
ba64c5bbdaa94a1930472828c6fe07a31099accb
|
[
"WTFPL"
] | null | null | null |
var/cache/dev/srcApp_KernelDevDebugContainer.php
|
Ajerbouh/symfony-demo-master
|
ba64c5bbdaa94a1930472828c6fe07a31099accb
|
[
"WTFPL"
] | null | null | null |
<?php
// This file has been auto-generated by the Symfony Dependency Injection Component for internal use.
if (\class_exists(\ContainerUx0xZe5\srcApp_KernelDevDebugContainer::class, false)) {
// no-op
} elseif (!include __DIR__.'/ContainerUx0xZe5/srcApp_KernelDevDebugContainer.php') {
touch(__DIR__.'/ContainerUx0xZe5.legacy');
return;
}
if (!\class_exists(srcApp_KernelDevDebugContainer::class, false)) {
\class_alias(\ContainerUx0xZe5\srcApp_KernelDevDebugContainer::class, srcApp_KernelDevDebugContainer::class, false);
}
return new \ContainerUx0xZe5\srcApp_KernelDevDebugContainer(array(
'container.build_hash' => 'Ux0xZe5',
'container.build_id' => 'e06c381c',
'container.build_time' => 1546959772,
), __DIR__.\DIRECTORY_SEPARATOR.'ContainerUx0xZe5');
| 35.909091
| 120
| 0.767089
|
47ca9363b37df6fe24399f4ecf69a365dd3fe764
| 2,898
|
rb
|
Ruby
|
lib/su/config_file.rb
|
rkiel/aws-utilities
|
4714cb5d98a90c9d39833cf075d61f4cc6e9f18b
|
[
"MIT"
] | null | null | null |
lib/su/config_file.rb
|
rkiel/aws-utilities
|
4714cb5d98a90c9d39833cf075d61f4cc6e9f18b
|
[
"MIT"
] | null | null | null |
lib/su/config_file.rb
|
rkiel/aws-utilities
|
4714cb5d98a90c9d39833cf075d61f4cc6e9f18b
|
[
"MIT"
] | null | null | null |
require_relative './file_base'
module SwitchUser
class ConfigFile < ::SwitchUser::FileBase
attr_accessor :awssu_account
attr_accessor :awssu_user
attr_accessor :awssu_pki
attr_accessor :awssu_codecommit
attr_accessor :aws_access_key_id
attr_accessor :aws_secret_access_key
attr_accessor :region
attr_accessor :output
def export(profile)
set_file_contents nil
aws_configure_keys.each do |key|
cmd = "aws configure get #{key} --profile #{profile}"
puts cmd
send("#{key}=", `#{cmd}`.strip)
end
end
def show
set_file_contents nil
profile = 'default'
json_hash = {}
all_configure_keys.each do |key|
cmd = "aws configure get #{key} --profile #{profile}"
puts cmd
json_hash[key] = `#{cmd}`.strip
end
puts JSON.pretty_generate(json_hash)
end
def switch(safe_mode = true)
all_configure_keys.each do |key|
default_value = "SAFE_#{key.upcase}"
value = safe_mode ? default_value : send("#{key}")
cmd = "aws configure set #{key} #{value}"
puts cmd
system cmd
end
end
def search
users = Hash.new
Dir.chdir(awssu_root_dir) do
Dir['*'].each do |account|
users[account] = []
end
end
users.keys.each do |account|
Dir.chdir(File.join(awssu_root_dir,account)) do
Dir['*'].each do |user|
begin
cf = ::SwitchUser::ConfigFile.new(account, user)
cf.must_exist
users[account] << cf
rescue => e
end
end
end
end
users
end
private
def file_name
@file_name ||= begin
#name = [account,user, 'awssu'].join('_')
name = 'configure'
name = [name,'json'].join('.')
File.join(awssu_root_dir, account, user, name)
end
end
def get_file_contents
json_hash = {}
all_configure_keys.each do |key|
json_hash[key] = send("#{key}")
end
JSON.pretty_generate(json_hash)
end
def set_file_contents (contents)
if contents
json_hash = JSON.parse(contents)
else
json_hash = {
"awssu_account" => account,
"awssu_user" => user,
"awssu_pki" => false,
"awssu_codecommit" => false
}
end
all_configure_keys.each do |key|
send("#{key}=", json_hash[key])
end
end
def aws_configure_keys
["aws_access_key_id", "aws_secret_access_key", "region", "output"]
end
def awssu_configure_keys
["awssu_account","awssu_user","awssu_pki","awssu_codecommit"]
end
def all_configure_keys
awssu_configure_keys + aws_configure_keys
end
def lock_down (file_name)
File.chmod(0600,file_name)
end
end
end
| 23.560976
| 72
| 0.581781
|
282c1d6243b22b3cafd3cb80a1c668db1a0810ac
| 1,258
|
swift
|
Swift
|
Show/UIViewController+Return.swift
|
congncif/SiFUtilities
|
d05b0b71ebdf7367477489ea91eef2ad36b49b91
|
[
"MIT"
] | 6
|
2016-08-11T21:22:19.000Z
|
2019-03-04T08:14:01.000Z
|
Show/UIViewController+Return.swift
|
congncif/SiFUtilities
|
d05b0b71ebdf7367477489ea91eef2ad36b49b91
|
[
"MIT"
] | 1
|
2017-10-03T02:21:52.000Z
|
2017-10-04T03:28:20.000Z
|
Show/UIViewController+Return.swift
|
congncif/SiFUtilities
|
d05b0b71ebdf7367477489ea91eef2ad36b49b91
|
[
"MIT"
] | 2
|
2016-08-11T21:22:20.000Z
|
2017-06-09T20:13:19.000Z
|
//
// UIViewController+Return.swift
// SiFUtilities
//
// Created by NGUYEN CHI CONG on 8/18/20.
//
import Foundation
import UIKit
extension UIViewController {
public func returnHere(animated: Bool = true, completion: (() -> Void)? = nil) {
if self.presentedViewController != nil {
self.dismiss(animated: animated, completion: completion)
self.popToShowIfNeeded(animated: animated, completion: nil)
} else {
self.popToShowIfNeeded(animated: animated, completion: completion)
}
}
private func popToShowIfNeeded(animated: Bool, completion: (() -> Void)?) {
CATransaction.begin()
CATransaction.setCompletionBlock(completion)
if let nav = navigationController, let foundTarget = findParentViewController(in: nav) {
nav.popToViewController(foundTarget, animated: animated)
}
CATransaction.commit()
}
private func findParentViewController(in navigationController: UINavigationController) -> UIViewController? {
if navigationController.viewControllers.contains(self) {
return self
} else {
return allParents.first { navigationController.viewControllers.contains($0) }
}
}
}
| 33.105263
| 113
| 0.666137
|
af07153e9195fb4655765de73405e3e20d9e14f9
| 729
|
py
|
Python
|
LAMARCK_ML/utils/compareClass_test.py
|
JonasDHomburg/LAMARCK
|
0e372c908ff59effc6fd68e6477d04c4d89e6c26
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 3
|
2019-09-20T08:03:47.000Z
|
2021-05-10T11:02:09.000Z
|
LAMARCK_ML/utils/compareClass_test.py
|
JonasDHomburg/LAMARCK_ML
|
0e372c908ff59effc6fd68e6477d04c4d89e6c26
|
[
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
LAMARCK_ML/utils/compareClass_test.py
|
JonasDHomburg/LAMARCK_ML
|
0e372c908ff59effc6fd68e6477d04c4d89e6c26
|
[
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
import unittest
from LAMARCK_ML.utils.compareClass import CompareClass
class TestCompareClass(unittest.TestCase):
def test_comparefunction(self):
prim = 'a'
sec0 = 'b'
sec1 = 'c'
cmp = CompareClass(**{
CompareClass.arg_PRIMARY_ALPHA: -1,
CompareClass.arg_PRIMARY_OBJECTIVE: prim,
CompareClass.arg_PRIMARY_THRESHOLD: 0.5,
CompareClass.arg_SECONDARY_OBJECTIVES: {sec0: -10/0.1,
sec1: -20/0.1}
})
one = {prim: -0.7,
sec0: 10000,
sec1: 40}
other = {prim: -0.6,
sec0: 10000,
sec1: 30}
self.assertTrue(cmp.greaterThan(one, other))
self.assertFalse(cmp.greaterThan(other, one))
| 29.16
| 60
| 0.595336
|
4b6f9ef0f862da502aaa6a2bd64d1b87072fd18e
| 2,606
|
cpp
|
C++
|
mbed-glove-firmware/drivers/collector.cpp
|
apadin1/Team-GLOVE
|
d5f5134da79d050164dffdfdf87f12504f6b1370
|
[
"Apache-2.0"
] | null | null | null |
mbed-glove-firmware/drivers/collector.cpp
|
apadin1/Team-GLOVE
|
d5f5134da79d050164dffdfdf87f12504f6b1370
|
[
"Apache-2.0"
] | null | null | null |
mbed-glove-firmware/drivers/collector.cpp
|
apadin1/Team-GLOVE
|
d5f5134da79d050164dffdfdf87f12504f6b1370
|
[
"Apache-2.0"
] | 1
|
2019-01-09T05:16:42.000Z
|
2019-01-09T05:16:42.000Z
|
/*
* Filename: collector.cpp
* Project: EECS 473 - Team GLOVE
* Date: Fall 2016
* Authors:
* Nick Bertoldi
* Ben Heckathorn
* Ryan O’Keefe
* Adrian Padin
* Tim Schumacher
*
* Purpose:
* Implementation of collector.h
*
* Copyright (c) 2016 by Nick Bertoldi, Ben Heckathorn, Ryan O'Keefe,
* Adrian Padin, Timothy Schumacher
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include "collector.h"
#include "string.h"
Collector::Collector(FlexSensors& _flex, IMU_BNO055& _imu,
TouchSensor& _touch, AdvertBLE& _adble)
: flex(_flex), imu(_imu), touch(_touch), adble(_adble) {
flex_data = glove_data.flex_sensors; // ptr to the first flex_sensor_t
touch_data = &(glove_data.touch_sensor); // ptr to the key_states_t struct
imu_data = &(glove_data.imu); // ptr to the bno_imu_t struct in glove data
update_task_timer =
new RtosTimer(this, &Collector::updateAndAdvertise, osTimerPeriodic);
}
void Collector::updateAndAdvertise() {
imu.updateAndWrite(imu_data);
flex.updateAndWrite(flex_data);
touch.spawnUpdateThread();
Thread::wait(8);
touch.writeKeys(touch_data);
compressGloveSensors(&glove_data, &glove_data_compressed);
adble.update((uint8_t*)&glove_data_compressed, glove_sensors_compressed_size);
touch.terminateUpdateThreadIfBlocking();
adble.waitForEvent();
}
void Collector::startUpdateTask(uint32_t ms) {
update_task_timer->start(ms);
}
void Collector::stopUpdateTask() {
update_task_timer->stop();
}
| 34.289474
| 82
| 0.719493
|
f4c80ff745ead197b0f74acd696750f4ca7f29f4
| 1,359
|
ts
|
TypeScript
|
www/src/app/employee/components/employee-card/employee-card-request-list/employee-card-request-list.component.ts
|
narg1s1/gpnmarket
|
d007dd993ce9fa6afd74a65be6462d1da5f2ada0
|
[
"Apache-2.0"
] | null | null | null |
www/src/app/employee/components/employee-card/employee-card-request-list/employee-card-request-list.component.ts
|
narg1s1/gpnmarket
|
d007dd993ce9fa6afd74a65be6462d1da5f2ada0
|
[
"Apache-2.0"
] | null | null | null |
www/src/app/employee/components/employee-card/employee-card-request-list/employee-card-request-list.component.ts
|
narg1s1/gpnmarket
|
d007dd993ce9fa6afd74a65be6462d1da5f2ada0
|
[
"Apache-2.0"
] | null | null | null |
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { EmployeeInfoRequestItem } from "../../../models/employee-info";
import { Router } from "@angular/router";
import { RequestListItem } from "../../../../request/common/models/requests-list/requests-list-item";
import { Uuid } from "../../../../cart/models/uuid";
import { UserInfoService } from "../../../../user/service/user-info.service";
import { PermissionType } from "../../../../auth/enum/permission-type";
@Component({
selector: 'app-employee-card-request-list',
templateUrl: './employee-card-request-list.component.html',
styleUrls: ['./employee-card-request-list.component.scss']
})
export class EmployeeCardRequestListComponent {
@Input() requests: EmployeeInfoRequestItem[];
@Output() setResponsibleUser = new EventEmitter<{ requestId: Uuid, userId: Uuid }>();
responsibleModalPayload: RequestListItem;
readonly permissionType = PermissionType;
constructor(
private router: Router,
public user: UserInfoService
) {}
calcPieChart(request: any): number {
const completedItems = (request.completedCount) / (request.positionCount) * 100;
return (65 - (65 * (completedItems || 0)) / 100);
}
onRowClick(request: EmployeeInfoRequestItem): void {
this.router.navigateByUrl(`/requests/backoffice/${request.request.id}`);
}
}
| 37.75
| 101
| 0.702723
|
5444f0ec2fd8d768132f98f69e648548a13ceb18
| 364
|
css
|
CSS
|
jekyll-search/assets/search.css
|
CarsonTheCanuck/tutorial-apps
|
074eb7a11a263a269e119e5f5cb989cf2a6f4c67
|
[
"MIT"
] | 4
|
2020-08-06T14:30:05.000Z
|
2022-03-11T04:26:38.000Z
|
jekyll-search/assets/search.css
|
CarsonTheCanuck/tutorial-apps
|
074eb7a11a263a269e119e5f5cb989cf2a6f4c67
|
[
"MIT"
] | null | null | null |
jekyll-search/assets/search.css
|
CarsonTheCanuck/tutorial-apps
|
074eb7a11a263a269e119e5f5cb989cf2a6f4c67
|
[
"MIT"
] | 1
|
2021-09-03T19:41:59.000Z
|
2021-09-03T19:41:59.000Z
|
.search-wrapper {
float: right;
position: relative;
}
.site-search {
margin: 18px 20px;
width: 180px;
}
.search-results {
position: absolute;
top: 38px;
left: 20px;
width: 165px;
}
.search-results ul {
margin: 0;
}
.search-results li {
padding: 10px;
list-style: none;
background-color: #eee;
width: 100%;
}
| 13
| 27
| 0.587912
|
746dcdab7ffc589a3de5506ca2bba93f2706408c
| 86
|
css
|
CSS
|
core/static/assets/extra.css
|
cesarbcruz/ecommerce-python-django
|
d80462b831124d6932bd94896f90efe4a9e8c016
|
[
"CC0-1.0"
] | 60
|
2016-06-07T00:34:53.000Z
|
2021-11-22T11:33:43.000Z
|
core/static/assets/extra.css
|
cesarbcruz/ecommerce-python-django
|
d80462b831124d6932bd94896f90efe4a9e8c016
|
[
"CC0-1.0"
] | 3
|
2021-09-08T01:35:47.000Z
|
2022-03-12T00:12:19.000Z
|
core/static/assets/extra.css
|
cesarbcruz/ecommerce-python-django
|
d80462b831124d6932bd94896f90efe4a9e8c016
|
[
"CC0-1.0"
] | 45
|
2016-07-15T18:07:08.000Z
|
2021-07-27T20:14:42.000Z
|
.margin-top {
margin-top: 2em;
}
#paypal input[type=image] {
display: none;
}
| 12.285714
| 27
| 0.604651
|
f23df48d4810b83148a4d5e38eb29c8b42ed61f1
| 1,376
|
php
|
PHP
|
www/models/ebcryption.php
|
diorcokorea/dentonephp
|
aba9b1484e1de6be31b8bafcb12c53564e1b7d06
|
[
"Unlicense"
] | null | null | null |
www/models/ebcryption.php
|
diorcokorea/dentonephp
|
aba9b1484e1de6be31b8bafcb12c53564e1b7d06
|
[
"Unlicense"
] | null | null | null |
www/models/ebcryption.php
|
diorcokorea/dentonephp
|
aba9b1484e1de6be31b8bafcb12c53564e1b7d06
|
[
"Unlicense"
] | null | null | null |
<?php
#region 암호화
#region SHA
function SHAebcvry256($plainText)
{
//SHA-256
$hashed256 = base64_encode(hash('sha256', $plainText , true));
// echo $hashed256;
return $hashed256;
}
function SHAebcvry512($plainText)
{
//SHA-512
$hashed512 = base64_encode(hash('sha512', $plainText, true));
// echo $hashed512;
return $hashed512;
}
#endregion
#region AES
$password = 'password string';
// 256 bit 키를 만들기 위해서 비밀번호를 해시해서 첫 32바이트를 사용합니다.
$password = substr(hash('sha256', $password, true), 0, 32);
// Initial Vector(IV)는 128 bit(16 byte)입니다.
$iv = chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0) . chr(0x0);
function AESencode($plainText)
{
// 암호화
$encrypted = base64_encode(openssl_encrypt($plainText, 'aes-256-cbc', $GLOBALS['password'], OPENSSL_RAW_DATA, $GLOBALS['iv']));
return $encrypted;
}
function AESdecrypted($encrypted)
{
// 복호화
$decrypted = openssl_decrypt(base64_decode($encrypted), 'aes-256-cbc', $GLOBALS['password'], OPENSSL_RAW_DATA, $GLOBALS['iv']);
return $decrypted;
}
#endregion
#endregion
?>
| 28.666667
| 185
| 0.566134
|
7be87f0fc7184f828e943e9549befc4d54b88ac8
| 49,603
|
sql
|
SQL
|
database/yii2start-2019-11-18.sql
|
monmartius/yii2start
|
0f016d08713edffa0970e38cfb7fd23a86e701cc
|
[
"BSD-3-Clause"
] | null | null | null |
database/yii2start-2019-11-18.sql
|
monmartius/yii2start
|
0f016d08713edffa0970e38cfb7fd23a86e701cc
|
[
"BSD-3-Clause"
] | null | null | null |
database/yii2start-2019-11-18.sql
|
monmartius/yii2start
|
0f016d08713edffa0970e38cfb7fd23a86e701cc
|
[
"BSD-3-Clause"
] | null | null | null |
-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1
-- Время создания: Ноя 18 2019 г., 05:25
-- Версия сервера: 10.1.37-MariaDB
-- Версия PHP: 7.3.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- База данных: `yii2start`
--
-- --------------------------------------------------------
--
-- Структура таблицы `category`
--
CREATE TABLE `category` (
`id` int(10) NOT NULL,
`parent_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
`name` text NOT NULL,
`keywords` text,
`description` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `category`
--
INSERT INTO `category` (`id`, `parent_id`, `name`, `keywords`, `description`) VALUES
(1, 0, 'Sportswear', 'Sportswear keywords', 'Description Sportswear'),
(2, 1, 'Nike', 'Nike keywords', 'Description Nike'),
(3, 1, 'Under Armour', 'Under Armour keywords', 'Description Under Armour'),
(4, 1, 'Adidas', 'Adidas keywords', 'Description Adidas'),
(5, 1, 'Puma', 'Puma keywords', 'Description Puma'),
(6, 1, 'ASICS ', 'ASICS keywords', 'Description ASICS '),
(7, 0, 'Mens', 'Mens keywords', 'Description Mens'),
(8, 7, 'Fendi', 'Fendi keywords', 'Description Fendi'),
(9, 7, 'Guess', 'Guess keywords', 'Description Guess'),
(10, 7, 'Valentino', 'Valentino keywords', 'Description Valentino'),
(11, 7, 'Dior', 'Dior keywords', 'Description Dior'),
(12, 7, 'Versace', 'Versace keywords', 'Description Versace'),
(13, 7, 'Armani', 'Armani keywords', 'Description Armani'),
(14, 7, 'Prada', 'Prada keywords', 'Description Prada'),
(15, 7, 'Dolce and Gabbana', 'Dolce and Gabbana keywords', 'Description Dolce and Gabbana'),
(16, 7, 'Chanel', 'Chanel keywords', 'Description Chanel'),
(17, 7, 'Gucci', 'Gucci keywords', 'Description Gucci'),
(18, 0, 'Womens', 'Womens keywords', 'Description Womens'),
(19, 18, 'Fendi', 'Fendi keywords', 'Description Fendi'),
(20, 18, 'Guess', 'Guess keywords', 'Description Guess'),
(21, 18, 'Valentino', 'Valentino keywords', 'Description Valentino'),
(22, 18, 'Dior', 'Dior keywords', 'Description Dior'),
(23, 18, 'Versace', 'Versace keywords', 'Description Versace'),
(24, 0, 'Kids', 'Kids keywords', 'Description Kids'),
(25, 0, 'Fashion', 'Fashion keywords', 'Description Fashion'),
(26, 0, 'Households', 'Households keywords', 'Description Households'),
(27, 0, 'Interiors ', 'Interiors keywords', 'Description Interiors '),
(28, 0, 'Clothing', 'Clothing keywords', 'Description Clothing'),
(29, 0, 'Bags', 'Bags keywords', 'Description Bags'),
(30, 0, 'Shoes', 'Shoes keywords', 'Description Shoes');
-- --------------------------------------------------------
--
-- Структура таблицы `migration`
--
CREATE TABLE `migration` (
`version` varchar(180) NOT NULL,
`apply_time` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `migration`
--
INSERT INTO `migration` (`version`, `apply_time`) VALUES
('m000000_000000_base', 1573504698),
('m191111_191053_create_category_table', 1573504701),
('m191111_191108_create_product_table', 1573505209);
-- --------------------------------------------------------
--
-- Структура таблицы `product`
--
CREATE TABLE `product` (
`id` int(10) NOT NULL,
`category_id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) NOT NULL,
`content` text,
`price` decimal(19,4) NOT NULL DEFAULT '0.0000',
`keywords` varchar(255) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`img` varchar(255) DEFAULT 'no-image.png',
`hit` enum('0','1') NOT NULL DEFAULT '0',
`new` enum('0','1') NOT NULL DEFAULT '0',
`sale` enum('0','1') NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Дамп данных таблицы `product`
--
INSERT INTO `product` (`id`, `category_id`, `name`, `content`, `price`, `keywords`, `description`, `img`, `hit`, `new`, `sale`) VALUES
(2, 23, 'общечеловеческие интересный зависит безусловно существующих принимать элементы особенности ограничений вектор', 'лишь однако будут лишь сверхзадачи сложившуюся повседневная концептуальных богатый представителей практика непосредственные процесса значит говорит набирают участия независимые постоянный проекта развитие развитие над господа уровня рациональное резервов уровень разума поставленных ключевые противодействий типа новой как', '1.1900', 'рациональных поставленных', 'показатели каждого широким свершениям посмешище уровня', 'image0002.png', '0', '0', '0'),
(3, 19, 'намеченных что объективно самодостаточных морали особенности взгляд упомянуто', 'различных своём создаёт исследований важность элементы вещи как точка доказательством анализа институционализации однако указаны хотя количественный развитие информационно разбор должны фракционных рациональных самодостаточных количественный соответствующих разбавленное значительной решения явные граница конкурентов однако современные', '11.6400', 'картины', 'показатели решения активизации чрезвычайно обнародованы участника диаграммы чем особенности разумеется собственных однозначно оценить', 'image0003.png', '1', '0', '0'),
(4, 10, 'возможности нашей внешне массового разумеется современные будут значимость зрения воздействия новые модели', 'высокий путь модель отметить что понимание таким подходит разбор последовательного повышение конкурентов современная для консультация внутренней вещи также разума включения активно дальнейших разработки ключевые целого', '20.4100', 'базе несомненную поведения открывает ясность несомненную', 'роль необходимость могут эмпатии развития сознания компаний предполагает модели эмоциями особенности', 'image0004.png', '0', '0', '0'),
(5, 26, 'требует неутешительны непосредственные компаний улучшить упускаем социально непосредственные практика теория описаны точка ресурсосберегающих', 'национальный этих как шанса', '1.1300', 'активно современных успешности типа каждого общей почему', 'рост чрезвычайно непосредственные рассуждений существование задача сложившейся политики современных как которые разногласий являясь', 'image0005.png', '1', '0', '0'),
(6, 16, 'технологий уровня позиционных повседневная занимаемых разногласий прежде задача ясность определенных разнесены процесса однозначно также', 'превращены', '10.1800', 'структуры что граждане', 'прогрессивного другой граница морали обусловливает особенности маркетинговых ряда независимые быть направлений как явные развития', 'image0006.png', '0', '0', '0'),
(7, 5, 'заблокированы разрезе внимание уровня внешних диаграммы очередь обусловливает сфера учётом вовлечения что проекта почему', 'решений сфера рост общей проверки свою граница победы обществу для зависимых интернет каждый значительной как предполагает способного достигли неутешительны является', '12.4300', 'обусловливает своём', 'международной неутешительны учитывая населения курс есть своевременно', 'image0007.png', '0', '0', '0'),
(8, 7, 'сценарии функционально будут противоположная своих предоставляет резервов', 'технического сложившаяся стремлении кстати занимаемых что день является уровня разнообразный оставляет тщательные', '28.1300', 'эмпатии морали', 'быть кластеризации сегодняшнего порядка разнообразный сказать связей информационно формированию такого новой само повестка связей', 'image0008.png', '1', '0', '0'),
(9, 10, 'системы морали признаки лишь', 'выводы нами что информационно позволяет представлены активности политической безусловно сознания решений развития превозмогая свершениям идейные создаёт быть создаёт повышение точка анализа предварительные чрезвычайно быть заблокированы рациональных нормы модели независимые принимать очередь для экономическое развития ясность каждого быть план', '28.4500', 'остаются прежде курс страны', 'ситуацию населения следует', 'image0009.png', '0', '0', '0'),
(10, 4, 'нам представляет повышение системы степени быть заблокированы выводы следует участники должны ситуацию', 'направлений последовательного рациональных описаны очередь идейные играет являются нашей рост зависимости континентально общей что понимание уровня рассуждений уделом что гражданского кадров каждый нашей внеочередных превозмогая сложившуюся разногласий конкретные развития для свою условий предполагает', '10.4400', 'непосредственные', 'упомянуто постоянное ясность неутешительны развития максимально морали объективно взгляд решения спецификации социально', 'image0010.png', '1', '1', '0'),
(11, 16, 'источников реплицированные своих остаются', 'сверхзадачи ключевые достигли внешне проекта обучения своём сути идейные почему гражданского вещи экономическую представляет предварительные другой экономической пользу определяет однозначно сообщества', '23.5900', 'элементы политического политической', 'быть целом повышению стремлении курс', 'image0011.png', '0', '0', '0'),
(12, 10, 'ключевые собой сделанные некоторые реализации нашей уровня рациональное понимание', 'профессионального социально ряда неоднозначны прежде повседневная подвергнуты проекта социально сфера тщательные консультация тщательные фракционных информационно технологии добавляют приносит факта ключевые требований степени как нами как комплекса', '6.8300', 'модели будут кстати', 'определяет', 'image0012.png', '0', '0', '0'),
(13, 26, 'прогресса следует перспективное резервов сценарии гражданского реализации', 'горизонты способного неоднократно представлены уже', '23.2300', 'организационной', 'анафеме что стандартов гражданского участия обучения приносит так соответствующих глубокий уделом для', 'image0013.png', '0', '0', '0'),
(14, 22, 'уже быть аналитики призваны реализации успешности стороны пользовательский непосредственные что', 'для мероприятий развивающиеся фракционных различных нашей инстанциями политического занимаемых предварительные развития внедрение участники позиций методик общей степени конкретные посмешище степени последовательного типа базе внутренней собственных лишь описаны пользу свершениям предпосылки зависимых будут уровня также', '20.3300', 'разбавленное почему методом должны проекта постоянное преданы следует которые', 'демократической реплицированные собственных зависит достигли уровня развития вещи как', 'image0014.png', '0', '0', '0'),
(15, 26, 'как модель кластеризации отношении уровня укрепления также что важность', 'развития исключительно всего способного анафеме явные серии для также успешности существование разнесены сегодняшнего повседневной рассуждений как элементы задача выводы общества анафеме социально проекта экономической собой включения уровня тщательные посмешище процесса ступенью повышение уровня развивающиеся быть над', '15.4800', 'европейского', 'международной сказать описаны подробно проекта', 'image0015.png', '0', '0', '0'),
(16, 14, 'тщательные базе безусловно', 'непосредственные современные горизонты как намеченных однозначно также нормы касаемо рациональных что гражданского населения экспериментов', '12.6400', 'кадров участники системы паттернов как существующих нам неутешительны', 'важные следует сознания открывает', 'image0016.png', '0', '0', '0'),
(17, 4, 'связей целом противодействий предопределяет необходимость набирают касаемо ступенью зрения показатели проблем выводы неоднократно', 'значимость количественный концептуальных консультация факторов так экономическую как элементы повестка уже однако предполагает рациональных участники участники путь непростую намеченных освещают однако разоблачены первоочередных поведения ресурсосберегающих особенности задач уровень позиционных проект лишь превращены признаки реализация объявлены внешних системы собственные', '2.2100', 'уточнения своевременно особенности сознания', 'прогрессивного нарушающими степени неоднократно', 'image0017.png', '0', '0', '0'),
(18, 21, 'успешности для внешне модели рациональное вот прекрасно экономической собой системы быть лишь ступенью поведения своём', 'как своевременно однозначно уточнения сознания выполнить упомянуто является остаются всего выводы как как культуры эмоциями зарубежных элементы нас технологий экспериментов нарушающими принимаемых', '22.4300', 'уровня профессионального что диаграммы', 'развития призывают неутешительны свежий лишь хотя сфера важные призывают непосредственные', 'image0018.png', '0', '0', '0'),
(19, 17, 'принимать рассмотрены подвергнуты касаемо оценить', 'для конкурентов обеспечение учитывая широкие собственных поэтапного', '16.6300', 'технологий частью внешне есть', 'гражданского следует верифицированы поэтапного проекта определения однозначно принимать также рассуждений резервов', 'image0019.png', '0', '0', '0'),
(20, 2, 'прежде высшего всего привычные типа исследования', 'глубокомысленных современные прогресса исследований внутренней анализа граждане либералов крупнейших уровень системы системы позиции добавляют свете конкурентов противодействий над долей является управления своевременно уделом будут также собственных изрядной уровня лишь некоторые процесса', '5.1500', 'пользовательский собственные связей рассуждений набирают предопределяет что', 'повседневной рассуждений реплицированные предприниматели способствует', 'image0020.png', '0', '0', '0'),
(21, 19, 'обеспечение рост уровень образом', 'независимые качественно выводы будут свою технологий общества выводы современные что', '25.0300', 'граждане яркий нашей развития участия организации почему роль рассмотрены уделом путь', 'пользовательский понимает проекта сознания призваны предпосылки гражданского связей прогрессивного максимально само активности', 'image0021.png', '0', '0', '0'),
(22, 5, 'экономическое гражданского проект значительной новых ограничений профессионального проекта постоянный разнесены', 'исследований непростую как политического показывает общей первоочередных должны управления современных быть уровня ограничений ответу современные предоставляет ограничений нарушающими уровня поведения поведения однако методик среди сложно жаждут проекта объективно комплекса всего разногласий', '0.9600', 'однозначно', 'открывает обнародованы свежий внутренней уровня', 'image0022.png', '1', '0', '0'),
(23, 6, 'способного', 'высокое безусловно позволяет картины однозначно другой сказать позволяет решения превозмогая значительной практика является элементы концептуальных прогрессивного внутренних касаемо участия диаграммы постоянный требований всего факторов своём что', '1.7600', 'интернет особенности сознания стороны', 'определения отношении независимые обучения определения укрепления для', 'image0023.png', '0', '0', '0'),
(24, 7, 'качество идейные производственный', 'развития некоторые однозначно следует направлений позиции эксперимент посмешище современных простого задач как обеспечение информационно резервов лишь семантический предложений претенденты ключевые учитывая дня соображения лишь функционально неутешительны развития существование очевидна как', '29.5400', 'наблюдать победы поставленных фиксирует', 'обстановки будут современных фракционных своевременно соображения другой решений как требует анафеме собственные фиксирует анализа для', 'image0024.png', '0', '0', '0'),
(25, 4, 'современные этики однозначно прогресса', 'развития начало демократической предопределяет спецификации проект что', '4.6700', 'представители конкурентов собственные', 'что как которые задача обществу системы принимая', 'image0025.png', '0', '0', '0'),
(26, 18, 'над ответу будут понимает исключительно выводы образом национальный также разногласий сообщества прекрасно развития', 'безусловно вещи упомянуто что посмешище поведения первоочередных ресурсосберегающих день учитывая ступенью', '7.7200', 'деятельности общей экспериментов фракционных', 'участия ясность положительном значимость участника рассуждений улучшить эмпатии ступенью однозначно фиксирует есть моральных превращены', 'image0026.png', '1', '0', '0'),
(27, 16, 'ориентированный неоднократно современные сообщества', 'сути есть информационно повышение направлений очевидна поведения ясность развития сложившуюся нарушающими граница разоблачены современных картины порядка источников рамках управления развития объявлены эксперимент количественный работы добавляют роль наблюдать проект стандартов представителей формированию предпосылки первоочередных начало сей забывать своём', '5.5500', 'целесообразности рамках', 'являются объявлены методология почему глубокомысленных', 'image0027.png', '0', '0', '0'),
(28, 1, 'выводы свете определенных стремлении каждого богатый', 'массового ресурсов обучения очевидна сознания очевидна нашей всего обусловливает учитывая глубокий рациональных объявлены явные технического яркий', '22.9700', 'развития очевидна акционеры', 'сознания', 'image0028.png', '0', '0', '0'),
(29, 17, 'работы повестка рост что уделом несомненную яркий', 'быть уточнения сообщества объявлены фракционных нас анализа внедрение что неутешительны такого прекрасно представляют функционально участия хотя выводы', '15.4500', 'оценить прежде уровня следует активности выводы положительном', 'решений разногласий', 'image0029.png', '0', '0', '0'),
(30, 12, 'тщательные системы работы исследования независимые своих безусловно опыт выводы высшего вещь', 'ключевые касаемо деятельности технического производственный максимально участника общей упомянуто разоблачены развития позиции развитие демократической добавляют общества говорит путь опыт ключевые день усилий политического фиксирует новых лишь вне работы всего противоположная', '21.8600', 'своевременно понимает целого чрезвычайно подходит зависимых явные', 'ресурсосберегающих проект касаемо зависимости', 'image0030.png', '0', '0', '0'),
(31, 13, 'ситуацию свершениям улучшить морали уже сути оставляет над учётом развития уже предварительные своевременно', 'направлений широкие явные эксперимент роль разумеется нормы требует экспериментов сложно развития предварительные быть превозмогая новым поражающих оценить картины для формированию прогрессивного', '21.3700', 'разнообразный активно своевременно выводы развития политического постоянный объективно', 'создаёт нами яркий некоторые', 'image0031.png', '0', '0', '0'),
(32, 10, 'определяет экспериментов', 'общечеловеческие', '17.3000', 'безусловно крупнейших проекта самодостаточных важную граница уровня значит независимые', 'участия исследований нас прогресса некоторые эксперимент что разногласий что открывает обусловливает точка зрения', 'image0032.png', '0', '0', '0'),
(33, 8, 'поведения показатели говорит касаемо показатели развитие ограничений', 'оценить целом явные соответствующими особенности уже идейные играет активом вещи является кстати проекта своих упомянуто сложившуюся непростую некоторые собственные морали дальнейших курс', '15.6500', 'экономическую', 'институционализации', 'image0033.png', '0', '0', '0'),
(34, 12, 'говорит могут непосредственные нас укрепления повседневной сложившуюся несомненную пользу своевременно ограничений как рост организации как', 'само призваны общей проекта способы ключевые требует пропагандистское уже технологий предпосылок форм говорит', '14.7400', 'должны верифицированы нормы так приоритизации', 'чрезвычайно оценить что значительной которые качества свою сей', 'image0034.png', '0', '0', '0'),
(35, 5, 'нарушающими очередь принимаемых системы', 'сознания нас', '19.6600', 'технологии настолько выводы решений социальных зрения также как', 'мышление лишь системы своевременно элементы направлений что внешне что общечеловеческие как разработке определяет ясность для', 'image0035.png', '0', '0', '0'),
(36, 29, 'повседневной целесообразности развивающиеся высшего формированию картины способы общечеловеческие', 'над формированию целого спецификации укрепления морали уровня развития степени вне сказать превозмогая тщательные пример гражданского повседневной позволяет развития деятельности разногласий этих', '21.7300', 'прежде является также источников рост концептуальных', 'уже либералов', 'image0036.png', '0', '0', '0'),
(37, 27, 'показывает сегодняшнего повышение глубокомысленных всего включения нашей структура значимость лишь сценарии', 'соображения несомненную лишь определяет связей дальнейших технологии поэтапного очередь показатели тщательные внешне оценить пользу решения всего морали', '9.3900', 'активно освещают системы сознания', 'фракционных направлений эксперимент которые определения развития', 'image0037.png', '0', '0', '0'),
(38, 26, 'добавляют лишь', 'принимая точка зависимых массового победы профессионального элементы глубокомысленных зависимых деятельности системы реплицированные сложившаяся всего что свою простого кадров изрядной играет интернет методик верифицированы', '20.3600', 'либералов консультация обучения пример современные степени', 'важность превозмогая упомянуто каждый порядка посмешище включения лишь которые проект рамках этих сфера', 'image0038.png', '0', '0', '0'),
(39, 19, 'положительном целом добавляют день уже стремлении крупнейших несомненную', 'развития яркий что обществу собой для степени различных гражданского высокую анафеме свете связей напрямую учитывая проект', '17.4400', 'требует разногласий развития эксперимент зависит организационной решений деятельности', 'позволяет описаны являясь вам которые сей внедрение ключевые', 'image0039.png', '0', '0', '0'),
(40, 3, 'привычные оценить сей образом подробно предоставляет очередь очевидна высшего должны модели', 'упускаем некоторые возможностях только непростую понимание', '13.4600', 'для день направлений', 'мышление исключительно следует направлений прогресса независимые необходимость создаёт явные этики аналитики прогрессивного', 'image0040.png', '0', '0', '0'),
(41, 29, 'качественно лишь касаемо упомянуто аналитики оценить некоторые', 'уровень плановых необходимость позволяет говорит неоднократно зарубежных быть направлений предполагает также четким нарушающими общества другой как повышение постоянный нас практика начало реплицированные выводы вещи неутешительны функционально также обучения реализации открывает взгляд противоположная серии социально так развитие исключительно ясность понимание прежде внедрение лишь', '21.0200', 'сказать позиционных ресурсосберегающих несомненную задача высшего решений активности', 'нашей ориентированный значит вовлечения объективно исследования описаны', 'image0041.png', '0', '0', '0'),
(42, 18, 'экономическая', 'технологии политики участия новой участники вне поставленных', '28.5100', 'институционализации мира концептуальных пользовательский быть пользовательский', 'другой приносит экономическую поведения мышление технологий зрения оставляет прогресса управления принимать указаны форм', 'image0042.png', '0', '0', '0'),
(43, 19, 'напрямую', 'развития условий разработке методов функционально новой предварительные инновационных сфера резервов факторов', '4.1600', 'работы определения', 'для степени прежде', 'image0043.png', '0', '0', '0'),
(44, 5, 'стремлении заблокированы', 'фиксирует для', '7.4400', 'опыт поведения', 'для социальных населения прогресса исследования как разумеется также современных картины', 'image0044.png', '0', '0', '0'),
(45, 27, 'зависит вещь информационно быть требует решения разнообразный экономическую уже тщательные как непосредственные', 'частью социально глубокомысленных базовый своих общей зависимости либералов богатый укрепления поражающих сфера усилий инстанциями чрезвычайно исследования экономическое ступенью структуры идейные структуры рост нарушающими ступенью новая ключевые деятельности оценить пример новые зарубежных будут упомянуто явные представлены обусловливает технологии социально ресурсов', '9.6800', 'обусловливает прогрессивного упомянуто постоянный требует мира модели участия независимые', 'непосредственные', 'image0045.png', '0', '0', '0'),
(46, 14, 'существующих демократической объективно приносит постоянное', 'позиции развития слоев европейского картины очевидную сложившуюся современные организации победы постоянный', '25.1600', 'обеспечение сложно значит', 'сказать', 'image0046.png', '0', '0', '0'),
(47, 6, 'развития комплекса способствует значит признаки проекта национальный экономическое говорит взгляд вещь быть значение международной', 'для которые технологии повестка обществу внутренней улучшить позиции лишь формировании преданы зарубежных свершениям внутренней требований качественно постоянный этих сути резервов внимание', '7.1000', 'политической принимая', 'развитие грандиозности прогресса анализа участника поведения также лишь намеченных этики нами так сути резервов несомненную ограничений частью', 'image0047.png', '0', '0', '0'),
(48, 14, 'должны роль верифицированы такого внутренней форм значение сообщества', 'выводы решений значение позволяет объективно противоположная точка общества конкурентов резервов тщательные предложений приоритизации решений проект общечеловеческие также воздействия зависимых лишь фракционных глубокий компаний понимание сути высшего', '15.8200', 'особенности пример сложившаяся начало', 'компаний повседневная прогресса', 'image0048.png', '0', '0', '0'),
(49, 6, 'прогрессивного призывают особенности также признаки очередь исследования включения выбранный нас граница информационно', 'однако разногласий эмоциями самодостаточных экономическое яркий базовый быть политики популярность фракционных нашей мероприятий типа яркий идейные задач ресурсов связей европейского разногласий обусловливает лишь решений постоянное опыт своём позволяет представлены спецификации анализа важную', '29.4900', 'стороны что анафеме частью инстанциями открывает оценить доказательством', 'требований степени конкурентов такого позиционных ресурсосберегающих фракционных', 'image0049.png', '0', '0', '0'),
(50, 5, 'образом морали ситуацию приносит нашей очередь', 'неутешительны добавляют фиксирует рациональных достигли только свою', '23.1500', 'точка модели такого изрядной степени', 'соответствующими', 'image0050.png', '0', '0', '0'),
(51, 11, 'возможностях будут', 'частью неоднозначны количественный оценить поведения повышение настолько четким включения максимально роль разработке объективно важность институционализации фракционных предопределяет однозначно лишь верифицированы верифицированы участника общечеловеческие высшего базе связей обусловливает принимая почему уровня разработки каждый взгляд качества современные', '1.7200', 'внутренней сложно должны', 'взгляд собственных уделом достигли модель для проект сфера значимость реализации частью', 'image0051.png', '0', '0', '0'),
(52, 27, 'формированию эмоциями количественный диаграммы дня', 'для как оценить однозначно поведения участия современные связей вектор постоянный обществу следует внимание концептуальных хотя положительном прогрессивного ориентированный важную глубокомысленных своём качества стороны представлены создаёт что пример сценарии исследования конкретные однако диаграммы точка пример новой план', '11.8300', 'активности новая гражданского технологий фиксирует ресурсосберегающих', 'социально современные кадров добавляют анализа для ключевые глубокомысленных концептуальных должны связей', 'image0052.png', '0', '0', '0'),
(53, 19, 'тщательные вектор позиции зарубежных непростую освещают упомянуто порядка разбор резервов тщательные уточнения организации дня', 'ресурсосберегающих важные начало должны которые соображения плановых особенности внедрение своих рассуждений процессами общей объявлены является неоднократно особенности фиксирует нас работы выводы населения непростую подходит такого как зрения отметить что что информационно структура зрения технологии упускаем', '3.4800', 'вещь принимая рассуждений является ситуацию элементы своей исследования что уровня', 'что для для собственных решения явные современных деятельности инстанциями наблюдать способы структура обнародованы резервов', 'image0053.png', '0', '0', '0'),
(54, 14, 'добавляют', 'источников неоднократно прогрессивного ключевые новых современные будут прогресса политического рациональное улучшить решений участника спецификации уже вещь проект прежде предложений рациональных существование выбранный чрезвычайно призывают упомянуто инновационный собой ключевые высшего проект рамках важность анафеме разногласий деятельности маркетинговых своих прогресса определяющее', '6.2300', 'исследований однозначно чрезвычайно внешне для активом морали заданий', 'направлений способы мероприятий горизонты количественный широкие современных всего целом внеочередных технологии свежий способного некоторые', 'image0054.png', '0', '0', '0'),
(55, 15, 'уже разоблачены свежий заблокированы развитие что неутешительны порядка над горизонты процессами глубокомысленных несомненную', 'сознания пример аналитики пользу напрямую ресурсосберегающих политического мышление изрядной сложившуюся нашей форм возможности ясность объективно количественный ориентированный создаёт опыт степени сознания свете этих направлений однозначно уровня как требований крупнейших для значительной прежде следует ключевые своих новой которые гражданского', '30.5900', 'непростую заблокированы определяет внимание указаны слоев национальный прежде', 'исключительно исследования населения широкие что призваны подразумевает должны своих яркий решений показатели сети технологий', 'image0055.png', '0', '0', '0'),
(56, 9, 'сказать поведения экономическую подразумевает инстанциями процессами проблем социальных базе', 'прогресса однозначно реализации заблокированы ряда направлений интересные объявлены обстановки диаграммы самодостаточных роль уровень противоположная неутешительны разоблачены независимые обстановки исследования само конкурентов опыт значительной', '25.5600', 'говорит важность сценарии хотя', 'прогресса ключевые ориентированный процессами развития остаются европейского', 'image0056.png', '0', '0', '0'),
(57, 16, 'рост такого сложившейся наблюдать резервов решения выбранный верифицированы фиксирует', 'деятельности представляют своевременно неоднократно внедрение внимание пользу разбавленное которые своём сделанные', '24.2300', 'политической что значение экономическую добавляют количественный', 'гражданского сути ограничений экономическое новой рациональных роль элементы быть для общечеловеческие которые', 'image0057.png', '0', '0', '0'),
(58, 27, 'процесса поведения зарубежных приоритизации кстати', 'гражданского сознания лишь гражданского сей методов лишь методик стандартов экономическую нарушающими ключевые', '28.2700', 'приоритизации также базовый упускаем что', 'нашей усилий вещи разногласий уровня объявлены предварительные независимые факторов привычные зависимых', 'image0058.png', '0', '0', '0'),
(59, 27, 'успешности рассуждений', 'заданий внешних свете ценностей грандиозности свершениям что точка чем сознания значение сети воздействия направлений выводы прежде резервов требует страны чрезвычайно преданы положительном разнесены целого ситуацию', '28.4800', 'разоблачены', 'соображения противоположная этики свершениям будут уже масштабности', 'image0059.png', '0', '0', '0'),
(60, 29, 'для для способы развития однозначно приносит ситуацию широким диаграммы морали что что начало', 'определения социально важность следует сложившуюся способного неутешительны всего слоев самодостаточных технического интересные быть участия', '8.1100', 'безусловно необходимость', 'направлений очевидна несомненную соображения', 'image0060.png', '0', '0', '0'),
(61, 24, 'сфера фракционных пропагандистское быть предложений уровня этих социально как требует рост повышение формированию', 'глубокомысленных есть разбавленное развития работы выводы возможности достигли количественный необходимость глубокомысленных уже процессами участники как крупнейших также сознания посмешище понимание разногласий позволяет выводы существование методология', '12.3200', 'качество институционализации серии понимает рамках формированию', 'быть рассуждений важную предопределяет исследований серии выполнения тщательные', 'image0061.png', '0', '0', '0'),
(62, 29, 'путь новым новых этих идейные для ресурсосберегающих пример являются рассуждений призывают целом признаки', 'требует путь показатели объективно высокое картины элементы горизонты учётом пользовательский участия общей комплекса постоянное соответствующими рост принимая призывают порядка ясность погружения целом высокую', '10.9500', 'собственных элементы прежде для предпосылок развивающиеся упускаем', 'заданий упомянуто', 'image0062.png', '0', '0', '0'),
(63, 2, 'уровень превращены также описаны современные упомянуто план напрямую профессионального проблем предполагает', 'зрения уровень должны неутешительны кстати повестка позиции представляют сути безусловно исключительно модели качество пропагандистское ключевые технологий зависимых уровня источников выводы начало что сознания зависит господа будут сообщества участия кстати политического также прежде будут принимаемых нашей ступенью говорит развития экономическое диаграммы максимально которые', '2.7500', 'значение над определяет всего нас новые выполнить повседневной превозмогая оценить', 'либералов демократической как частью богатый значение нарушающими реплицированные призваны разработки', 'image0063.png', '0', '0', '0'),
(64, 30, 'активно говорит интернет концептуальных своих важную', 'внутренних порядка представлены аудитории направлений что учитывая несомненную собственных внутренних которые массового разнесены разоблачены', '2.2500', 'нарушающими целого практика максимально пользовательский', 'профессионального', 'image0064.png', '0', '0', '0'),
(65, 4, 'включения культуры почему постоянный гражданского', 'компаний ключевые реализация особенности пользовательский исследования собственных глубокомысленных', '28.4800', 'теория оценить', 'предопределяет для некоторые очевидна ресурсов активности', 'image0065.png', '0', '0', '0'),
(66, 8, 'задуматься собственных ряда участника соответствующими', 'этих так победы функционально условий быть постоянный разнообразный неоднократно повседневная нас ориентированный уделом разработки эксперимент сказать следует объективно играет европейского преданы собственные также своём как которые работы факта преданы анализа внешних горизонты курс европейского прекрасно демократической уже есть важность уточнения', '3.3600', 'сути общества участия как определения разработке заблокированы', 'целой уровень горизонты призваны методов предпосылки аудитории анализа факторов мира упомянуто проблем решений разногласий', 'image0066.png', '0', '0', '0'),
(67, 28, 'напрямую новые обеспечение грандиозности уровня модель организационной быть быть тенденций гражданского', 'что рост приносит что требований среди технологий учитывая неутешительны важность которые определенных практика', '14.5800', 'особенности понимание', 'неутешительны', 'image0067.png', '0', '0', '0'),
(68, 4, 'само существующая', 'постоянное высокое также своевременно сценарии реализации чем особенности особенности участия консультация экономическую сложившуюся яркий выполнить развития участники кадров представлены различных начало пример свою являются роль формировании для что ориентированный ограничений однако приоритизации неоднозначны аудитории наблюдать деятельности указаны развития понимает развивающиеся', '18.2800', 'морали преданы современная экономическое прекрасно играет нашей степени морали', 'безусловно уровень реализации перспективное плановых верифицированы', 'image0068.png', '0', '0', '0'),
(69, 24, 'условий этики господа уровень участия серии формированию семантический богатый очередь связей', 'глубокомысленных методом есть', '26.4200', 'рассуждений предложений анализа оценить что наблюдать разработке масштабности уровня', 'инновационных достигли требует нормы проекта фракционных хотя развития особенности значительной прогресса участия гражданского', 'image0069.png', '0', '0', '0'),
(70, 1, 'нормы приносит', 'организации является роль говорит развивающиеся пример высокий что кстати следует существующая нарушающими участника тенденций противоположная лишь повышение диаграммы такого создаёт внимание прогресса доказательством сети сказать разнесены', '7.9700', 'нормы как развития новым управления разработки', 'требует развития что решения упускаем сложно предпосылки степени значение таким разоблачены либералов что', 'image0070.png', '0', '0', '0'),
(71, 21, 'требований источников повестка сей источников тщательные анафеме пользу практика внешне повышение определяющее целой уровня ответу', 'как очевидную структура', '18.2800', 'форм континентально', 'анализа господа представители лишь некоторые моральных особенности', 'image0071.png', '0', '0', '0'),
(72, 13, 'привычные связей', 'которые сделанные представлены картины лишь зависимости работы реализация каждого решения которые активности нашей всего постоянный', '13.8800', 'возможности целом глубокомысленных для модели признаки активности', 'экономическое конкурентов порядка отметить несомненную является соображения исключительно нашей направлений', 'image0072.png', '0', '0', '0'),
(73, 3, 'подвергнуты высшего могут что', 'технического национальный социально социально непосредственные кстати конкретные касаемо заблокированы свежий внедрение также современных свершениям новые подвергнуты', '27.7200', 'последовательного анализа господа сознания', 'повышению учитывая', 'image0073.png', '0', '0', '0'),
(74, 13, 'быть сложно поведения глубокомысленных стремлении опыт', 'прежде широким профессионального участия широкие вот выполнения возможностях упомянуто', '8.3700', 'могут значительной что сути структуры демократической', 'социально конкурентов значительной связей ключевые активом сей', 'image0074.png', '0', '0', '0'),
(75, 19, 'практика ключевые поэтапного нас методик различных внедрение для', 'уровня новым разногласий жаждут своём внешне системы картины для ситуацию населения национальный быть современных форм типа серии свете кадров анафеме разработке требует сфера существующая богатый семантический всего', '6.2900', 'несомненную богатый значит сути массового', 'обстановки своевременного высокую экономическую ясность концептуальных', 'image0075.png', '0', '0', '0'),
(76, 9, 'проект исследования социальных', 'ограничений само процесса поэтапного остаются обеспечение крупнейших современных превращены связей пользовательский вовлечения зависимых экспериментов непростую глубокомысленных', '23.2000', 'прогресса разбавленное инстанциями простого дальнейших', 'моральных рамках конкурентов как победы технологий обществу поведения значение стремлении технологии современных однозначно требует', 'image0076.png', '0', '0', '0'),
(77, 24, 'ключевые также', 'богатый самодостаточных практика', '10.0700', 'быть значение качественно социально частью рамках порядка', 'показатели которые граница элементы современные общей описаны', 'image0077.png', '0', '0', '0'),
(78, 29, 'значительной постоянный набирают обеспечение требует инстанциями претенденты внешне формировании граждане политики', 'понимание решения проект', '9.0100', 'проект элементы работы обеспечение методом предпосылки нас направлений позволяет оценить своей', 'концептуальных сей эмоциями аудитории всего активом высокую уровня реплицированные простого разрезе', 'image0078.png', '0', '0', '0'),
(79, 13, 'постоянный рамках', 'порядка значительной перспективное развития вектор проекта обществу является повышение задания структура современные проблем предопределяет однако уровня существование хотя положительном вещи почему победы элементы также фракционных анафеме особенности', '7.4500', 'хотя ценностей говорит ресурсосберегающих', 'картины которые быть производственный упускаем гражданского привычные очевидную значительной экономическую демократической развитие участия', 'image0079.png', '0', '0', '0'),
(80, 18, 'верифицированы модели требований своей', 'развития новые', '20.2500', 'призывают постоянный источников', 'кстати уровня показывает методология участия поэтапного есть', 'image0080.png', '0', '0', '0'),
(81, 25, 'развития прежде объявлены зависимых простого функционально каждого требует', 'развития соображения прогресса ключевые соответствующими порядка участия экспериментов предпосылок участия особенности принимая поведения исключительно горизонты анафеме сей рамках гражданского современных дня учитывая горизонты внутренней выполнения курс повседневной анализа верифицированы собой как повышение успешности что сей вещи', '11.5500', 'определения уровня говорит быть неутешительны принимать пользовательский высшего', 'внутренних', 'image0081.png', '0', '0', '0'),
(82, 30, 'сложившуюся нашей конкурентов ограничений оставляет касаемо добавляют проекта наблюдать быть', 'максимально', '22.4900', 'что добавляют', 'активом достигли особенности вовлечения собственных предполагает', 'image0082.png', '0', '0', '0'),
(83, 26, 'зависит выполнить лишь', 'внешне собственных деятельности степени разработки создаёт стремлении особенности подробно тенденций ряда учётом рассмотрены инновационных напрямую зависимых исследований нарушающими что для источников определения элементы', '0.2800', 'касаемо экспериментов особенности объявлены экономическую новых уже прогрессивного', 'постоянное прогресса активности картины опыт', 'image0083.png', '0', '0', '0'),
(84, 30, 'привычные решений', 'фракционных рациональное внешне исследования успешности однако современных воздействия некоторые инновационный оценить будут также что технического другой которые мышление гражданского своевременного определения реализация резервов прежде связей частью касаемо социально слоев путь открывает эмпатии зарубежных качество противоположная доказательством активно', '20.6500', 'нарушающими сути непосредственные анализа инновационных которые повышение повседневной', 'представителей поставленных курс преданы', 'image0084.png', '0', '0', '0'),
(85, 29, 'идейные экспериментов ограничений сказать сказать', 'развития типа высшего оценить касаемо вне источников зависимости понимание экономическое важность реализации как рост реплицированные свежий опыт как технологии превращены элементы проверки независимые разрезе проекта путь максимально ключевые высшего', '19.2500', 'своевременно эксперимент морали показатели что исследований ресурсосберегающих мира высшего другой', 'обстановки кстати порядка разногласий предпосылок которые улучшить что как сказать позиций', 'image0085.png', '0', '0', '0'),
(86, 24, 'выполнения также однако слоев сфера этих', 'соображения хотя вещи развития необходимость участника упомянуто европейского горизонты подробно ресурсов позволяет для эмоциями выводы анализа успешности свою современных существование социально повседневная высокое что почему является исключительно экономическую распределения что неоднозначны вещи технологий активно быть активом должны своей сценарии что реализация исключительно', '4.1100', 'описаны призывают быть широким количественный должны важность позволяет', 'однозначно улучшить', 'image0086.png', '0', '0', '0'),
(87, 28, 'аудитории разумеется день массового нашей реализация внутренней ресурсосберегающих', 'количественный национальный ситуацию что новых сценарии будут начало простого исследований наблюдать требует качество', '16.4100', 'приоритизации принимать призывают фиксирует деятельности разнесены нас', 'источников анафеме сути национальный', 'image0087.png', '0', '0', '0'),
(88, 9, 'рассмотрены технологии диаграммы что', 'однозначно новая внешних уровень признаки семантический поведения определяет фракционных обнародованы определяющее ситуацию уровня сложившуюся говорит дальнейшее предварительные жаждут оставляет', '27.8000', 'следует что уровня', 'прогресса вещь аналитики поставленных своевременного упомянуто добавляют ключевые целевой современная', 'image0088.png', '0', '0', '0'),
(89, 2, 'работы исследований методология концептуальных хотя образом тщательные разногласий фиксирует сути освещают предварительные поражающих такого', 'практика разногласий', '2.2800', 'формированию другой конкурентов', 'уделом необходимость направлений такого яркий напрямую ресурсосберегающих эксперимент конкретные ценностей', 'image0089.png', '0', '0', '0'),
(90, 16, 'опыт создаёт поражающих диаграммы масштабности кадров свою внедрение максимально институционализации обусловливает фракционных', 'разнесены жаждут сознания либералов исключительно', '10.7700', 'хотя позиции требований обществу для', 'будут приоритизации описаны развитие качества для гражданского граждане нормы также уточнения сложившуюся', 'image0090.png', '0', '0', '0'),
(91, 18, 'поведения свершениям', 'однозначно эмпатии сфера информационно будут успешности повышение сложившейся социально современных описаны диаграммы простого тщательные показатели чем теория нарушающими новым как участия начало способы обнародованы внедрение ключевые модель экономической стремлении предпосылки поведения аудитории свою однако', '29.6400', 'ключевые объективно стремлении планирование участники', 'спецификации своём важную что важную', 'image0091.png', '0', '0', '0'),
(92, 4, 'требует начало уже активности рассуждений', 'каждого особенности тщательные развития современные победы свою интересный активности должны прогресса способного что серии курс значение показывает предопределяет повышение воздействия', '28.1200', 'общей прогресса', 'проверки упускаем открывает уровня являются новая принимая внешних позволяет сознания современная', 'image0092.png', '0', '0', '0'),
(93, 6, 'что преданы компаний национальный повышение над', 'паттернов современные уровня особенности такого маркетинговых лишь нас глубокомысленных проект анафеме выбранный', '7.5200', 'нарушающими будут шанса так разногласий развитие объективно исключительно', 'независимые реализации современных эксперимент что неутешительны структуры нашей', 'image0093.png', '0', '0', '0'),
(94, 8, 'высшего проверки вещи новые повседневная технологии понимание быть спецификации таким как', 'значит этики так участники нашей всего что модели частью представлены исследования упускаем реализации связей конкурентов технического процессами фиксирует широкие участия массового плановых нас поведения формированию методом очередь что своём задач призывают зрения базе направлений преданы лишь является', '23.3500', 'позволяет независимые задач', 'поражающих прогрессивного экономическое массового наблюдать господа достигли идейные некоторые', 'image0094.png', '0', '0', '0'),
(95, 6, 'пользовательский своём способного', 'форм поставленных интересные противодействий участия анализа что акционеры как уделом позиций факторов приоритизации повседневная конкурентов погружения неутешительны сложно обществом каждого направлений разоблачены источников повышение связей рациональных поведения неутешительны технологии что приоритизации диаграммы стандартов яркий', '5.2800', 'своём позиции задуматься глубокий экономическое остаются экономическую политики дня', 'рассуждений что стремлении условий описаны учётом решения свежий целесообразности важность экономическую сознания что', 'image0095.png', '0', '0', '0'),
(96, 27, 'подразумевает участия очередь диаграммы граждане развития', 'третьего призывают гражданского рассуждений информационно высокое касаемо', '19.4600', 'уровня претенденты усилий наблюдать', 'конкурентов технологии неутешительны значит необходимость сей показатели', 'image0096.png', '0', '0', '0'),
(97, 13, 'всего', 'изрядной существование социально разработке есть будут очередь реализация касаемо', '12.8800', 'горизонты граждане', 'уточнения картины интересный путь упускаем ситуацию исследования что нас диаграммы интересный профессионального', 'image0097.png', '0', '0', '0'),
(98, 18, 'либералов вещи тенденций своевременно однозначно соображения ресурсов исследования широким тщательные среди нас будут что деятельности', 'принимать ключевых самодостаточных повседневной должны рамках задания обусловливает понимает которые обусловливает важность современных упускаем', '16.1300', 'подробно инстанциями глубокомысленных уже добавляют организации', 'однозначно ключевые зрения конкретные уровня реализации важность повышению сложившуюся превращены также ключевые', 'image0098.png', '0', '0', '0'),
(99, 29, 'четким однако возможностях маркетинговых деятельности неоднократно технического проекта либералов разнесены собственных каждого', 'учётом постоянный форм что серии уровня ступенью разумеется сегодняшнего нас описаны представлены определенных лишь ресурсов тенденций вам', '25.9400', 'дальнейших представлены', 'каждый такого чрезвычайно лишь уже', 'image0099.png', '0', '0', '0'),
(100, 15, 'такого яркий определяет либералов политической касаемо важность современные развития сложно что участники внимание как значение пользу', 'для высшего уже дальнейших высшего освещают всего участия учитывая должны широкие что такого диаграммы предварительные высокий ориентированный выводы развития взгляд факторов экономическая резервов эмоциями разумеется частью каждого соответствующими приятно уточнения', '14.3500', 'реализации каждого каждого широкие нашей улучшить вещи нашей таким', 'рост участники возможностях пример', 'image0100.png', '0', '0', '0');
--
-- Индексы сохранённых таблиц
--
--
-- Индексы таблицы `category`
--
ALTER TABLE `category`
ADD PRIMARY KEY (`id`);
--
-- Индексы таблицы `migration`
--
ALTER TABLE `migration`
ADD PRIMARY KEY (`version`);
--
-- Индексы таблицы `product`
--
ALTER TABLE `product`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT для сохранённых таблиц
--
--
-- AUTO_INCREMENT для таблицы `category`
--
ALTER TABLE `category`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;
--
-- AUTO_INCREMENT для таблицы `product`
--
ALTER TABLE `product`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=101;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 189.324427
| 743
| 0.803963
|
dd60f524e109dafaf546c1284d7ce204a0d0c248
| 8,102
|
java
|
Java
|
material/tokenNotifier/src/com/explodingpixels/widgets/TableUtils.java
|
mathieulegoc/SmartTokens
|
f54e739cdd1faf80d3fed8912a361a7ac017662a
|
[
"MIT"
] | 10
|
2016-09-30T11:03:06.000Z
|
2019-06-03T00:05:10.000Z
|
material/tokenNotifier/src/com/explodingpixels/widgets/TableUtils.java
|
mathieulegoc/SmartTokens
|
f54e739cdd1faf80d3fed8912a361a7ac017662a
|
[
"MIT"
] | null | null | null |
material/tokenNotifier/src/com/explodingpixels/widgets/TableUtils.java
|
mathieulegoc/SmartTokens
|
f54e739cdd1faf80d3fed8912a361a7ac017662a
|
[
"MIT"
] | 4
|
2016-10-19T08:06:26.000Z
|
2021-02-01T01:07:24.000Z
|
package com.explodingpixels.widgets;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.BorderFactory;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JViewport;
import javax.swing.table.TableColumnModel;
/**
* A collection of utility methods to be used with {@link JTable}.
*/
public class TableUtils {
private TableUtils() {
// no constructor - utility class.
}
/**
* Add's striping to the background of the given {@link JTable}. The actual striping is
* installed on the containing {@link JScrollPane}'s {@link JViewport}, so if this table is not
* added to a {@code JScrollPane}, then no stripes will be painted. This method can be called
* before the given table is added to a scroll pane, though, as a {@link PropertyChangeListener}
* will be installed to handle "ancestor" changes.
*
* @param table the table to paint row stripes for.
* @param stipeColor the color of the stripes to paint.
*/
public static void makeStriped(JTable table, Color stipeColor) {
table.addPropertyChangeListener("ancestor",
createAncestorPropertyChangeListener(table, stipeColor));
// install a listener to cause the whole table to repaint when a column is resized. we do
// this because the extended grid lines may need to be repainted. this could be cleaned up,
// but for now, it works fine.
for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
table.getColumnModel().getColumn(i).addPropertyChangeListener(
createAncestorPropertyChangeListener(table, stipeColor)
);
}
}
private static PropertyChangeListener createAncestorPropertyChangeListener(
final JTable table, final Color stipeColor) {
return new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
// indicate that the parent of the JTable has changed.
parentDidChange(table, stipeColor);
}
};
}
private static void parentDidChange(JTable table, Color stipeColor) {
// if the parent of the table is an instance of JViewport, and that JViewport's parent is
// a JScrollpane, then install the custom BugFixedViewportLayout.
if (table.getParent() instanceof JViewport
&& table.getParent().getParent() instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) table.getParent().getParent();
scrollPane.setViewportBorder(
new StripedViewportBorder(scrollPane.getViewport(), table, stipeColor));
scrollPane.getViewport().setOpaque(false);
scrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER,
TableHeaderUtils.createCornerComponent(table));
scrollPane.setBorder(BorderFactory.createEmptyBorder());
}
}
// Sort support. //////////////////////////////////////////////////////////////////////////////
/**
* An enumeration representing the sort order of a table column.
*/
public enum SortDirection {
NONE(""), ASCENDING("ascending"), DESCENDING("descending");
private final String fValue;
SortDirection(String value) {
fValue = value;
}
String getValue() {
return fValue;
}
static SortDirection find(String value) {
for (SortDirection sortDirection : values()) {
if (sortDirection.getValue().equals(value)) {
return sortDirection;
}
}
throw new IllegalArgumentException("No sort direction found for " + value);
}
}
/**
* An interface that will be notified when sorting of a {@link JTable} should occur.
*
* @see TableUtils#makeSortable(javax.swing.JTable, com.explodingpixels.widgets.TableUtils.SortDelegate)
*/
public interface SortDelegate {
/**
* Called when a table should sort its' rows based on the given column.
*
* @param columnModelIndex the column model index to base the sorting on.
* @param sortDirection the direction to sort the table's rows in.
*/
void sort(int columnModelIndex, SortDirection sortDirection);
}
/**
* Installs a listener on the given {@link JTable}'s {@link javax.swing.table.JTableHeader},
* which will notify the given {@link SortDelegate} when the user clicks the header
* and thus wishes to sort. The listener will also call
* {@link com.explodingpixels.widgets.TableHeaderUtils#toggleSortDirection(javax.swing.table.JTableHeader, int)}
* and {@link TableHeaderUtils#setPressedColumn(javax.swing.table.JTableHeader, int)}
* which will install hints for header renders to render the column headers in the
* appropriate state.
*
* @param table the table so install the {@code SortDelegate} on.
* @param sortDelegate the delegate to notify when sorting should be performed.
*/
public static void makeSortable(JTable table, SortDelegate sortDelegate) {
validateSortDelegate(sortDelegate);
MouseListener mouseListener = new ColumnHeaderMouseListener(table, sortDelegate);
table.getTableHeader().addMouseListener(mouseListener);
}
private static void validateSortDelegate(SortDelegate sortDelegate) {
if (sortDelegate == null) {
throw new IllegalArgumentException("The given SortDelegate cannot be null.");
}
}
private static class ColumnHeaderMouseListener extends MouseAdapter {
private final JTable fTable;
private final TableUtils.SortDelegate fSortDelegate;
private boolean fMouseEventIsPerformingPopupTrigger = false;
private ColumnHeaderMouseListener(JTable fTable, TableUtils.SortDelegate fSortDelegate) {
this.fTable = fTable;
this.fSortDelegate = fSortDelegate;
}
public void mouseClicked(MouseEvent mouseEvent) {
if (shouldProcessMouseClicked()) {
final TableColumnModel columnModel = fTable.getColumnModel();
int columnViewIndex = columnModel.getColumnIndexAtX(mouseEvent.getX());
int columnModelIndex = fTable.convertColumnIndexToModel(columnViewIndex);
TableUtils.SortDirection sortDirection =
TableHeaderUtils.toggleSortDirection(fTable.getTableHeader(), columnModelIndex);
fSortDelegate.sort(columnModelIndex, sortDirection);
fTable.getTableHeader().repaint();
}
}
private boolean shouldProcessMouseClicked() {
return !fMouseEventIsPerformingPopupTrigger && isNotResizeCursor();
}
private boolean isNotResizeCursor() {
return fTable.getTableHeader().getCursor() != Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
}
public void mousePressed(MouseEvent mouseEvent) {
fMouseEventIsPerformingPopupTrigger = mouseEvent.isPopupTrigger();
if (isNotResizeCursor()) {
final TableColumnModel columnModel = fTable.getColumnModel();
int viewColumnIndex = columnModel.getColumnIndexAtX(mouseEvent.getX());
int columnModelIndex = fTable.convertColumnIndexToModel(viewColumnIndex);
TableHeaderUtils.setPressedColumn(fTable.getTableHeader(), columnModelIndex);
fTable.getTableHeader().repaint();
}
}
@Override
public void mouseReleased(MouseEvent e) {
TableHeaderUtils.setPressedColumn(fTable.getTableHeader(), TableHeaderUtils.NO_COLUMN);
fTable.getTableHeader().repaint();
}
}
}
| 41.548718
| 116
| 0.657615
|
46e1b022b346c4300d2c6158665fc0076d246cb7
| 1,305
|
py
|
Python
|
servers/Radiation/archive_scrapper/archive_scrapper/spiders/noaa_archive.py
|
arpitgogia/mars_city
|
30cacd80487a8c2354bbc15b4fad211ed1cb4f9d
|
[
"BSD-2-Clause-FreeBSD"
] | 25
|
2016-07-20T04:49:14.000Z
|
2021-08-25T09:05:04.000Z
|
servers/Radiation/archive_scrapper/archive_scrapper/spiders/noaa_archive.py
|
arpitgogia/mars_city
|
30cacd80487a8c2354bbc15b4fad211ed1cb4f9d
|
[
"BSD-2-Clause-FreeBSD"
] | 16
|
2016-12-27T08:30:27.000Z
|
2018-06-18T08:51:44.000Z
|
servers/Radiation/archive_scrapper/archive_scrapper/spiders/noaa_archive.py
|
arpitgogia/mars_city
|
30cacd80487a8c2354bbc15b4fad211ed1cb4f9d
|
[
"BSD-2-Clause-FreeBSD"
] | 49
|
2016-07-20T13:08:27.000Z
|
2020-06-02T18:26:12.000Z
|
import scrapy
from scrapy.http import Request
class FtpSpider(scrapy.Spider):
name = "NOAA"
handle_httpstatus_list = [404]
count = 2007
string = 'ftp://ftp.swpc.noaa.gov/pub/warehouse/'
def start_requests(self):
urls = ['ftp://ftp.swpc.noaa.gov/pub/' +
'warehouse/2007/2007_DPD.txt']
for url in urls:
yield Request(url,
meta={'ftp_user': 'anonymous', 'ftp_password': ''})
def parse(self, response):
datas = response.css("p::text").extract()
data = []
for i in datas:
i = i.split('\n')
d = i
data.append(d)
data = data[0][12:]
for i, v in enumerate(data):
data[i] = data[i].split(' ')
for idx, val in enumerate(data):
data[idx] = ' '.join(data[idx]).split()
yield{
'data': data,
}
if self.count < 2017:
self.count = self.count + 1
url = self.string + str(self.count) + '/' + \
str(self.count) + '_DPD.txt'
yield scrapy.Request(url,
callback=self.parse,
meta={'ftp_user': 'anonymous',
'ftp_password': ''})
| 31.071429
| 77
| 0.467433
|
a3da1ac4ce48edd16e3f3c171525c7f78c049dbf
| 566
|
java
|
Java
|
src/main/java/com/mrh0/horth/instructions/high/stackops/other/HVoid.java
|
mrh0/horth
|
9f3da998b7d16f3b44674d723ef48865492a8d77
|
[
"MIT"
] | 1
|
2022-02-02T22:25:54.000Z
|
2022-02-02T22:25:54.000Z
|
src/main/java/com/mrh0/horth/instructions/high/stackops/other/HVoid.java
|
mrh0/horth
|
9f3da998b7d16f3b44674d723ef48865492a8d77
|
[
"MIT"
] | null | null | null |
src/main/java/com/mrh0/horth/instructions/high/stackops/other/HVoid.java
|
mrh0/horth
|
9f3da998b7d16f3b44674d723ef48865492a8d77
|
[
"MIT"
] | null | null | null |
package com.mrh0.horth.instructions.high.stackops.other;
import com.mrh0.horth.ast.nodes.ITok;
import com.mrh0.horth.instructions.high.HighInst;
import com.mrh0.horth.typechecker.Contract;
import com.mrh0.horth.typechecker.IContract;
import com.mrh0.horth.typechecker.types.AllTypes;
public class HVoid extends HighInst {
public static final IContract contract = new Contract.Builder().push(AllTypes.VOID).build();
public HVoid(ITok token) {
super(token);
}
@Override
public IContract getContract() {
return contract;
}
}
| 26.952381
| 96
| 0.740283
|
e580bcf5ecb255458b4497a6d38ee952acce7766
| 1,432
|
dart
|
Dart
|
lib/x/auth/account.dart
|
mdmohsin7/alan.dart
|
a8c8c2afc3b29840d1e2b4e127781574f844a8a1
|
[
"MIT"
] | 17
|
2020-07-15T12:02:59.000Z
|
2022-02-09T19:36:11.000Z
|
lib/x/auth/account.dart
|
mdmohsin7/alan.dart
|
a8c8c2afc3b29840d1e2b4e127781574f844a8a1
|
[
"MIT"
] | 29
|
2020-08-27T06:42:44.000Z
|
2022-02-27T09:50:47.000Z
|
lib/x/auth/account.dart
|
mdmohsin7/alan.dart
|
a8c8c2afc3b29840d1e2b4e127781574f844a8a1
|
[
"MIT"
] | 7
|
2020-10-28T18:15:23.000Z
|
2022-02-07T19:59:45.000Z
|
import 'package:alan/alan.dart';
import 'package:fixnum/fixnum.dart';
import 'package:alan/proto/cosmos/auth/v1beta1/auth.pb.dart' as auth;
abstract class AccountI {
String get address;
Any get pubKey;
Int64 get accountNumber;
Int64 get sequence;
}
class BaseAccount extends AccountI {
final auth.BaseAccount account;
@override
String get address {
return account.address;
}
@override
Any get pubKey {
return account.pubKey;
}
@override
Int64 get accountNumber {
return account.accountNumber;
}
@override
Int64 get sequence {
return account.sequence;
}
BaseAccount(auth.BaseAccount account) : account = account;
static BaseAccount fromAny(Any any) {
final account = auth.BaseAccount.fromBuffer(any.value);
return BaseAccount(account);
}
}
class ModuleAccount implements AccountI {
final auth.ModuleAccount account;
@override
String get address {
return account.baseAccount.address;
}
@override
Any get pubKey {
return account.baseAccount.pubKey;
}
@override
Int64 get accountNumber {
return account.baseAccount.accountNumber;
}
@override
Int64 get sequence {
return account.baseAccount.sequence;
}
ModuleAccount(auth.ModuleAccount account) : account = account;
static ModuleAccount fromAny(Any any) {
final account = auth.ModuleAccount.fromBuffer(any.value);
return ModuleAccount(account);
}
}
| 18.842105
| 69
| 0.719274
|
1a4e5c340d8bbd93d0c165fd63df3895508c7feb
| 915
|
py
|
Python
|
timemachines/skaters/pmd/pmdcomposed.py
|
iklasky/timemachines
|
1820fa9453d31d4daaeff75274a935c7455febe3
|
[
"MIT"
] | 253
|
2021-01-08T17:33:30.000Z
|
2022-03-21T17:32:36.000Z
|
timemachines/skaters/pmd/pmdcomposed.py
|
iklasky/timemachines
|
1820fa9453d31d4daaeff75274a935c7455febe3
|
[
"MIT"
] | 65
|
2021-01-20T16:43:35.000Z
|
2022-03-30T19:07:22.000Z
|
timemachines/skaters/pmd/pmdcomposed.py
|
iklasky/timemachines
|
1820fa9453d31d4daaeff75274a935c7455febe3
|
[
"MIT"
] | 28
|
2021-02-04T14:58:30.000Z
|
2022-01-17T04:35:17.000Z
|
from timemachines.skaters.pmd.pmdinclusion import using_pmd
if using_pmd:
from timemachines.skaters.pmd.pmdskaters import pmd_univariate
from timemachines.skatertools.composition.residualshypocratic import quickly_moving_hypocratic_residual_factory
from timemachines.skatertools.utilities.conventions import Y_TYPE, A_TYPE, E_TYPE, T_TYPE
def pmd_univariate_hypocratic(y: Y_TYPE, s: dict, k: int, a: A_TYPE = None, t: T_TYPE = None, e: E_TYPE = None):
return quickly_moving_hypocratic_residual_factory(f=pmd_univariate, y=y,s=s,k=k,a=a,t=t,e=e)
def pmd_exogenous_hypocratic(y: Y_TYPE, s: dict, k: int, a: A_TYPE = None, t: T_TYPE = None, e: E_TYPE = None):
return quickly_moving_hypocratic_residual_factory(f=pmd_univariate, y=y,s=s,k=k,a=a,t=t,e=e)
PMD_SKATERS_COMPOSED = [ pmd_univariate_hypocratic, pmd_exogenous_hypocratic ]
else:
PMD_SKATERS_COMPOSED = []
| 39.782609
| 116
| 0.762842
|
11707b9a37a66cbe139e47140e821d62e6bdf465
| 4,722
|
kt
|
Kotlin
|
app/src/main/java/com/mynasmah/mykamus/utils/Constants.kt
|
anas-abdrahman/mykamus
|
a0f5b56d52bb41b9e3847172b5528e7555ad9159
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/mynasmah/mykamus/utils/Constants.kt
|
anas-abdrahman/mykamus
|
a0f5b56d52bb41b9e3847172b5528e7555ad9159
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/mynasmah/mykamus/utils/Constants.kt
|
anas-abdrahman/mykamus
|
a0f5b56d52bb41b9e3847172b5528e7555ad9159
|
[
"MIT"
] | null | null | null |
package com.mynasmah.mykamus.utils
import android.content.Context
import android.content.Intent
/**
* Created by ANAS on 2017/02/05.
*/
class Constants {
companion object {
const val TAG = "com.mynasmah.mykamus"
const val OFFLINE = "Offline"
const val RESULT_EMPTY: Int = 1000
const val RESULT_HISTORY: Int = 1011
const val CODE_CHECKED = "checked"
const val CODE_UNCHECKED = "unchecked"
const val EXCEPTION_SUGGEST = "exception_suggestion"
const val EXTRA_HISTORY_TEXT = "extra_history_text"
const val EXTRA_HISTORY_BAHASA = "extra_history_bahasa"
const val EXTRA_BAHASA = "erti_bahasa"
const val EXTRA_ERTI_0 = "erti_0"
const val EXTRA_ERTI_1 = "erti_1"
const val EXTRA_ERTI_2 = "erti_2"
const val EXTRA_ERTI_3 = "erti_3"
const val EXTRA_ERTI_4 = "erti_4"
const val EXTRA_ERTI_5 = "erti_5"
const val EXTRA_EMPTY = " -- "
const val AR = "arab"
const val MY = "melayu"
const val EN = "english"
const val FAV = "favorite"
const val PAGE_AR = 0
const val PAGE_MY = 1
const val PAGE_EN = 2
const val DIR_SUGGESTION_AR = "suggestion_ar"
const val DIR_SUGGESTION_MY = "suggestion_my"
const val DIR_SUGGESTION_EN = "suggestion_en"
const val FILE_TXT_ARAB = "perkataan_arab.txt"
const val FILE_TXT_MELAYU = "perkataan_melayu.txt"
const val FILE_TXT_ENGLISH = "perkataan_english.txt"
const val DB_NAME = "mykamus_6_0.db"
const val PREF_NAME = "KAMUS_APP"
const val PREF_FAVORITES = "Kamus_Favorite"
const val PREF_HISTORY = "Kamus_History"
const val PREF_FONT_SIZE = "font_size"
const val SARAF_ENABLE = "saraf_enable"
const val TAG_BAHASA = "bahasa"
const val WEB = "http://mynasmah.com/mykamus/"
const val API_KEY = "AIzaSyDqTxvZeqOH96RMN5JM1P7LwSdncn1Szus"
const val APP_RETURN = "jn@$439ijfsof903j3kse"
const val VISIBLE_RESULT = "visible_result"
const val VISIBLE_NORESULT = "visible_noresult"
const val VISIBLE_DEFAULT = "visible_clear"
const val VISIBLE_SEARCH = "visible_search"
const val VISIBLE_RESULT_ONLINE = "visible_result_online"
const val VISIBLE_NORESULT_ONLINE = "visible_noresult_online"
fun voiddd() : Boolean{
return true
}
fun shareText(context: Context, lang: String, arab_1: String, arab_2: String, melayu: String, english: String) {
var getText = ""
when (lang) {
"arab" -> {
getText = if (arab_2 != " -- " && arab_2.isNotEmpty())
"$arab_1 : $arab_2\n-----------\n$melayu\n"
else
"$arab_1\n-----------\n$melayu\n"
if (english != " -- " && english.isNotEmpty())
getText += "-----------\n$english\n"
}
"melayu" -> {
getText = if (melayu != " -- " && melayu.isNotEmpty())
"$melayu\n-----------\n$arab_1 : $arab_2\n"
else
"$melayu\n-----------\n$arab_1\n"
if (english != " -- " && english.isNotEmpty())
getText += "-----------\n$english\n"
}
"english" -> {
getText = if (english != " -- " && english.isNotEmpty())
"$english\n-----------\n$arab_1 : $arab_2\n-----------\n$melayu\n"
else
"$english\n-----------\n$arab_1\n-----------\n$melayu\n"
}
"favorite" -> {
getText = if (arab_2 != " -- " && arab_2.isNotEmpty())
"$arab_1 : $arab_2\n-----------\n$melayu\n"
else
"$arab_1\n-----------\n$melayu\n"
if (english != " -- " && english.isNotEmpty())
getText += "-----------\n$english\n"
}
}
getText += "\n[Share From mykamus]"
val sharingIntent = Intent(Intent.ACTION_SEND)
sharingIntent.type = "text/plain"
sharingIntent.putExtra(Intent.EXTRA_TEXT, getText)
context.startActivity(Intent.createChooser(sharingIntent, "Share Using : "))
}
}
}
enum class LANGUAGE(val text: String, val code: Int) {
ARAB(Constants.AR, Constants.PAGE_AR),
MELAYU(Constants.MY, Constants.PAGE_MY),
ENGLISH(Constants.EN, Constants.PAGE_EN)
}
| 30.269231
| 120
| 0.529013
|
6624984d4dc57068ea5cd2d9159a563f960f1d4a
| 1,276
|
py
|
Python
|
utils/mixin.py
|
bhavya17037/corobo
|
77788cb5ca0fb0923f595929a058492056e5aa7f
|
[
"MIT"
] | null | null | null |
utils/mixin.py
|
bhavya17037/corobo
|
77788cb5ca0fb0923f595929a058492056e5aa7f
|
[
"MIT"
] | null | null | null |
utils/mixin.py
|
bhavya17037/corobo
|
77788cb5ca0fb0923f595929a058492056e5aa7f
|
[
"MIT"
] | null | null | null |
from itertools import chain
class DefaultConfigMixin():
@property
def _default_config(self):
if (hasattr(self.bot_config, 'DEFAULT_CONFIG') and
self.name in self.bot_config.DEFAULT_CONFIG):
return self.bot_config.DEFAULT_CONFIG[self.name]
def __init__(self, bot, name=None):
super().__init__(bot, name=name)
default_config = self._default_config
if default_config and not hasattr(self, 'config'):
self.configure(default_config)
def get_configuration_template(self):
default_config = self._default_config
if default_config:
return default_config
elif self.CONFIG_TEMPLATE:
return self.CONFIG_TEMPLATE
def configure(self, configuration):
default_config = self._default_config
if configuration and default_config:
config = dict(chain(
default_config.items(),
configuration.items()))
elif configuration:
config = dict(chain(self.CONFIG_TEMPLATE.items(),
configuration.items()))
elif default_config:
config = default_config
else:
config = self.CONFIG_TEMPLATE
self.config = config
| 32.717949
| 61
| 0.626176
|
b331f45ac0f8b9b280cbeead735fd1c4261a32c5
| 449
|
py
|
Python
|
app/models.py
|
nferiel/shareabook
|
3b8834d4203533e6afcc92b66d0fb44e9a52fee1
|
[
"MIT"
] | null | null | null |
app/models.py
|
nferiel/shareabook
|
3b8834d4203533e6afcc92b66d0fb44e9a52fee1
|
[
"MIT"
] | null | null | null |
app/models.py
|
nferiel/shareabook
|
3b8834d4203533e6afcc92b66d0fb44e9a52fee1
|
[
"MIT"
] | 1
|
2018-04-22T23:13:25.000Z
|
2018-04-22T23:13:25.000Z
|
from app import db
class Book(object):
pass
class User(db.DynamicDocument):
email = db.StringField(required=True, unique=True)
# hash_pw = db.BinaryField(required=True)
password = db.BinaryField()
firstname = db.StringField(default='')
lastname = db.StringField(default='')
meta = {'collection': 'users'}
class Book(db.DynamicDocument):
isbn = db.StringField(required=True)
meta = {'collection': 'books'}
| 20.409091
| 54
| 0.674833
|
daa9be234ee5cf0a3110d94e53fe2a32ed22a5d9
| 3,316
|
php
|
PHP
|
test/Unit/CleanRegex/Internal/GroupNameValidatorTest.php
|
open-source-contributions/T-Regx
|
310779ad7d9039caeb6c57a81d5a19a35f6b3723
|
[
"MIT"
] | null | null | null |
test/Unit/CleanRegex/Internal/GroupNameValidatorTest.php
|
open-source-contributions/T-Regx
|
310779ad7d9039caeb6c57a81d5a19a35f6b3723
|
[
"MIT"
] | null | null | null |
test/Unit/CleanRegex/Internal/GroupNameValidatorTest.php
|
open-source-contributions/T-Regx
|
310779ad7d9039caeb6c57a81d5a19a35f6b3723
|
[
"MIT"
] | null | null | null |
<?php
namespace Test\Unit\TRegx\CleanRegex\Internal;
use PHPUnit\Framework\TestCase;
use TRegx\CleanRegex\Internal\GroupNameValidator;
class GroupNameValidatorTest extends TestCase
{
/**
* @test
* @dataProvider validGroups
* @param string|int $nameOrIndex
*/
public function shouldValidate($nameOrIndex)
{
// given
$validatorString = new GroupNameValidator($nameOrIndex);
// when
$validatorString->validate();
// then
$this->assertTrue(true);
}
/**
* @test
* @dataProvider validGroups
* @param string|int $nameOrIndex
*/
public function shouldBeValid($nameOrIndex)
{
// given
$validatorString = new GroupNameValidator($nameOrIndex);
// when
$isValid = $validatorString->isGroupValid();
// then
$this->assertTrue($isValid);
}
/**
* @test
* @dataProvider invalidGroup
* @param string|int $nameOrIndex
* @param string $message
*/
public function shouldNotValidate($nameOrIndex, string $message)
{
// given
$validatorString = new GroupNameValidator($nameOrIndex);
// then
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage($message);
// when
$validatorString->validate();
}
/**
* @test
* @dataProvider invalidGroup
* @param string|int $nameOrIndex
*/
public function shouldNotBeValid($nameOrIndex)
{
// given
$validatorString = new GroupNameValidator($nameOrIndex);
// when
$isValid = $validatorString->isGroupValid();
// then
$this->assertFalse($isValid);
}
public function validGroups(): array
{
return [
['group'],
['_group'],
['GROUP'],
['g'],
['a123_'],
[0],
[14],
];
}
/**
* @test
*/
public function shouldNotLetFuckedUpPhpRuinGroupValidation(): void
{
// given
setlocale(LC_CTYPE, "pl");
$validator = new GroupNameValidator('grópa');
// when
$valid = $validator->isGroupValid();
// then
$this->assertFalse($valid, 'Failed asserting that group validator ignores locale');
}
public function invalidGroup(): array
{
return [
['9group', "Group name must be an alphanumeric string, not starting with a digit, given: '9group'"],
['group space', "Group name must be an alphanumeric string, not starting with a digit, given: 'group space'"],
[-15, 'Group index must be a non-negative integer, given: -15'],
[2.23, 'Group index must be an integer or a string, given: double (2.23)'],
[null, 'Group index must be an integer or a string, given: null'],
["group\n", "Group name must be an alphanumeric string, not starting with a digit, given: 'group\\n'"],
["a\x7f\x7fb", "Group name must be an alphanumeric string, not starting with a digit, given: 'a[DEL\\x7f][DEL\\x7f]b'"],
["a\xc2\xa0b", "Group name must be an alphanumeric string, not starting with a digit, given: 'a[NBSP\\xc2\\xa0]b'"],
];
}
}
| 27.180328
| 132
| 0.57509
|
dbaf29600612b3a100097738f4454c3c2ad482a8
| 409
|
php
|
PHP
|
assets/ShareThisAsset.php
|
p2made/yii2-triangle-theme
|
78b7e606d6cd3d9f4c8c67fe787a1bc9ef2c40d7
|
[
"MIT"
] | 1
|
2019-03-03T07:53:14.000Z
|
2019-03-03T07:53:14.000Z
|
assets/ShareThisAsset.php
|
p2made/yii2-triangle-theme
|
78b7e606d6cd3d9f4c8c67fe787a1bc9ef2c40d7
|
[
"MIT"
] | 1
|
2015-09-30T18:21:13.000Z
|
2015-10-01T23:56:35.000Z
|
assets/ShareThisAsset.php
|
p2made/yii2-triangle-theme
|
78b7e606d6cd3d9f4c8c67fe787a1bc9ef2c40d7
|
[
"MIT"
] | null | null | null |
<?php
/**
* ShareThisAsset.php
*
* @copyright Copyright © Pedro Plowman, https://github.com/p2made, 2016
* @author Pedro Plowman
* @package p2made/yii2-triangle-theme
* @license MIT
*/
namespace p2m\theme\Triangle\assets;
class ShareThisAsset extends \yii\web\AssetBundle
{
public $sourcePath = null;
public $js = [
'http://w.sharethis.com/button/buttons.js',
];
public $depends = [];
}
| 17.782609
| 77
| 0.691932
|
a34ddc5573dff6e824252ca70e7465ddd33fe853
| 6,599
|
h
|
C
|
src/poc/poc.h
|
bjoernknafla/poc
|
84ddcc244b6c6f29e08c3b720012c5f6dd1f29fa
|
[
"BSD-3-Clause"
] | 9
|
2015-06-25T02:48:50.000Z
|
2021-01-25T23:47:45.000Z
|
src/poc/poc.h
|
bjoernknafla/poc
|
84ddcc244b6c6f29e08c3b720012c5f6dd1f29fa
|
[
"BSD-3-Clause"
] | null | null | null |
src/poc/poc.h
|
bjoernknafla/poc
|
84ddcc244b6c6f29e08c3b720012c5f6dd1f29fa
|
[
"BSD-3-Clause"
] | 1
|
2021-03-02T08:29:30.000Z
|
2021-03-02T08:29:30.000Z
|
/*
* Copyright (c) 2009-2010, Bjoern Knafla
* 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.
* - Neither the name of the Bjoern Knafla nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* 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.
*/
/**
* @file
*
* Preprocessor symbols prefixed with @c POC_ to detect the target platform the
* code is compiled for and to allow cross platform compatible keywords, for
* example to align data types on the stack.
* POC is primarily targeted at 32 or 64 bit gaming platforms.
*
* Use POC to detect the target platform the code unit is compiled for, for example:
* - @c POC_ARCH stores an id identifying the machine architecture
* - @c POC_COMPILER stores an id identifying the used compiler, @c POC_COMPILER_VERSION stores a number representing
* the compiler version
* - @c POC_DATA_MODEL stores an id identifying the platforms data model alas the bit-count of integral, floating point,
* and pointer types.
* - @c POC_ENDIAN stores an id identifying the endienness of the platform.
* - @c POC_LANG stores an id identifying the language (C, C++, Objective-C, OpenCL, CUDA, etc.) compiling for.
* - @c POC_OS stores an id identifying the target operating system.
*
* Each of these preprocessor symbols (other than the ones ending with @c _VERSION) is accompanied by a macro
* with a @c _STRING postfix that stores a character string describing the macro's value.
*
* In addition, each compiler, architecture, language, etc. also defines a specific macro when detected, e.g.
* @c POC_ARCH_X86_32 is defined if compiling for a 32bit x86 machine architecture. @c POC_ARCH and @c POC_ARCH_X86_32
* are both set to an (always) predefined @c POC_ARCH_X86_32_ID macro.
*
* If no known language, compiler, or endienness could be determined special @c UNKNOWN ids and strings are used as
* values, e.g. @ POC_OS might be set to @c POC_OS_UNKNOWN_ID and @c POC_OS_STRING is set to @c POC_OS_UNKNOWN_STRING .
*
* See poc_diagnose_main.c for an example how to use POC's platform detection macros.
*
*
* It is possible to suppress automatic platform detection for everything POC detects by defining
* @c POC_DISABLE_AUTODETECT , or to disable the auto-detection for a specific platform attribue, e.g. to suppress
* compiler detection define @c POC_COMPILER_DISABLE_AUTODETECT .
* By disabling the platform auto-detection it is possible to provide self-defined macros, e.g. to set the compiler
* yourself define @c POC_COMPILER_DISABLE_AUTODETECT, and then @c POC_COMPILER, @c POC_COMPILER_STRING,
* @c POC_COMPILER_VERSION, and possible also define a preprocessor macro for the compiler you are
* setting, e.g. @c POC_COMPILER_IBM_XLC for IBM's XL C/C++ compiler.
*
*
* Aside the platform detection macros POC also defines preprocessor symbols to allow portable usage of keywords to:
* - Align data types automatically on the stack by wrapping the type in @c POC_ALIGN_BEING(<byte-alignment>)
* and @c POC_ALIGN_END(<byte-alignment>) macros.
* - Using @c POC_RESTRICT to enable C99's @c restrict keyword or disable it when compiling for other languages that
* don't support it.
*
* POC can also be used to @c typedef primary types of specified bit sized on platforms
* that don't support C99's stdint.h or C++0x cstdint headers for example by using
* @c POC_BYTE, @c POC_INT32, @c POC_UINT32, @c POC_FLOAT32, @c POC_INTPTR_T,
* @c POC_UINTPTR_T, etc.
*
*
* When adding new platforms (operating system, compiler, architecture, C/C++ standards, etc.) then
* first add the following code into every detection branch
* @code
* #error Untested. Remove error preprocessor directive after having ported and tested the code to the platform.
* @endcode .
*
* Only remove the preprocessor error directive after having ported and tested the code on the platform!
* Don't forget to check that your @c POC_ @c _STRING macros are at most @c POC_STRINGS_MAX_LENGTH characters long
* (see poc_preprocessor_utilities_def.h).
*
* The error-directive is also present if a platform couldn't be tested yet - remove it but be warned that the code isn't
* tested and might possibly be erroreneous.
*
* For convenience include this header and don't use poc_def.h directly. Use the
* @c _def.h and @c _undef.h files for fine grained control of the parts in the code where
* @c POC_ prefixed macros are defined (or undefined) but keep care for yourself that macros aren't redefined.
* By including the POC headers without the @c _def.h or @c _undef.h postfix the defined macros
* exist throughout the whole compilation unit and can't be undefined by including the corresponding
* @c _undef.h anymore.
*
* All trademarks belong to their trademark holders.
*/
#ifndef POC_poc_H
#define POC_poc_H
#include "poc_os.h"
#include "poc_compiler.h"
#include "poc_arch.h"
#include "poc_endian.h"
#include "poc_lang.h"
#include "poc_data_model.h"
#include "poc_posix.h"
#include "poc_portability_macros.h"
#include "poc_primary_types.h"
#include "poc_opencl_extensions.h"
/* Disable macro undefines via including poc_undef.h and prevent re-defines from accidential
* includes of poc_def.h .
*/
#define POC_HEADER_DISABLE_DEF_UNDEF
#endif /* POC_poc_H */
| 52.373016
| 122
| 0.759661
|
10b10fd658cebd708eda8f1dbbbbb4f7629cef56
| 4,777
|
swift
|
Swift
|
Sources/Xplore/Tr3Parse2.swift
|
musesum/Tr3
|
0f03a83f2db00a96e9ec277cde1f88502f195c6a
|
[
"Apache-2.0"
] | 2
|
2022-01-12T03:02:23.000Z
|
2022-02-19T18:52:28.000Z
|
Sources/xplore/Tr3Parse2.swift
|
musesum/Tr3
|
0f03a83f2db00a96e9ec277cde1f88502f195c6a
|
[
"Apache-2.0"
] | null | null | null |
Sources/xplore/Tr3Parse2.swift
|
musesum/Tr3
|
0f03a83f2db00a96e9ec277cde1f88502f195c6a
|
[
"Apache-2.0"
] | null | null | null |
//
// Tr3Parse2.swift
// Tr3
//
// Created by warren on 4/2/21.
//
import Foundation
// a(+) << b(1) b(10) b! a:1 b! a:2 b! a:3
// a(/) << b, a(1) a:1, b(2)! a:.50, b! a:.25, ...
// a(1 * b / c) << (b c), b(1) a:nil, c(2) a:0.5, b(3) a:1.5, c(4) a:.75
// a(1 * b / c) << z, z(3 4) a:.75, z(c 4 b 1) a:.25
class T {}
public typealias fn = ((T)->(T?))
let tr3: fn = { t in
let nodes: fn = { t in
let path: fn = { t in }
let name: fn = { t in }
}
let edges: fn = { t in
let edgeOp: fn = { t in }
let edgeParen: fn = { t in tr3.edges.edge(t+1).many() }
let edge: fn = { t in
let nodes: fn = { t in tr3.nodes(t+1) }
let exprs: fn = { t in }
let quote: fn = { t in }
let ternary: fn = { t in }
let comment: fn = { t in }
}
}
let values: fn = { t in
let exprs: fn = { t in tr3.values.expr(t+1).many() }
let expr: fn = { t in
let exprOp: fn = { t in }
let names: fn = { t in }
let scalar: fn = { t in }
let ternary: fn = { t in }
let comma: fn = { t in }
}
let scalar: fn = { t in
let thru: fn = { t in
let num: fn = { t in }
}
let modu: fn = { t in
let max: fn = { t in }
let dflt: fn = { t in }
}
let index: fn = { t in
let name: fn = { t in }
let num: fn = { t in }
}
let data: fn = { t in }
let num: fn = { t in }
}
let ternary: fn = { t in
let ternIf: fn = { t in tr3.val.expr(t+1).addTo(Tr3ValTern) }
let ternThen: fn = { t in tr3.val.expr(t+1).addTo(Tr3ValTern) }
let ternElse: fn = { t in tr3.val.expr(t+1).addTo(Tr3ValTern) }
let ternRadio: fn = { t in tr3.val.expr(t+1).addTo(Tr3ValTern) }
}
let embed: fn = { t in }
}
let branches: fn = { t in
let child: fn = { t in
let comment: fn = { t in }
let tr3: fn = { t in }
}
let many: fn = { t in }
let array: fn = { t in }
let copyat: fn = { t in }
}
let quote: fn = { t in }
let comment: fn = { t in }
}
let _tr3: Fn = { token in
switch token.name {
case "nodes": _nodes(token)?.add()
case "edges": _edges(token)?.add()
case "values": _values(token)?.add()
case "branches": _branches(token)?.add()
case "comment": _coment(token)?.add()
default: break
}
return token
}
let _nodes: Fn = { token in
switch token.name {
case "path": _path(token)?.add()
case "name": _name(token)?.add()
default: break
}
return token
}
let _values: Fn = { token in
switch token.name {
case "exprs": _exprs(token)?.add()
case "quote": _quote(token)?.add()
case "scalar": _scalar(token)?.add()
case "ternary": _ternary(token)?.add()
case "embed": _embed(token)?.add()
default: break
}
return token
}
let _exprs: Fn = { token in
switch token.name {
case "expr": _expr(token.next)?.add()
default: break
}
return token
}
let _expr: Fn = { token in
switch token.name {
case "exprOp": _exprOp(token)?.add()
case "names": _names(token)?.add()
case "scalar": _scalar(token)?.add()
case "ternary": _ternary(token)?.add()
case "comma": _comma(token)?.add()
default: break
}
return token
}
let _scalar: Fn = { token in
switch token.name {
case "thru": _thru(token)?.add()
case "modu": _modu(token)?.add()
case "data": _data(token)?.add()
case "comma": _comma(token)?.add()
case "num": _num(token)?.add()
default: break
}
return token
}
let _ternary: Fn = { token in
switch token.name {
case "ternIf": return _expr(token)?.add()
case "ternThen": return _expr(token)?.add()
case "ternElse": return _expr(token)?.add()
case "ternRadio": return _ternary(token)?.add()
default: break
}
return token
}
let _embed: Fn = { token in
return token
}
let _branches: Fn = { token in
switch token.name {
case "child": return _child(token)?.add()
case "many": return _many(token)?.add()
case "array": return _array(token)?.add()
case "copyat": return _copyat(token)?.add()
default: break
}
return token
}
let _quote: Fn = { token in
return token
}
let _comment: Fn = { token in
switch token.prev.pattern {
case "tr3": return token.tr3.addComment()
case "edges": return token.edges.addComment()
case "child": return token.addChild().addComment(token.value)
default: break
}
}
| 26.988701
| 76
| 0.501779
|
f5d58d85091b20152f31c9d1cc8c99556e5851e3
| 243
|
lua
|
Lua
|
questions/geom_2/q00007/terms.rs.lua
|
bradunov/shkola
|
6ef057f5bd483318bf5763392972d48de481d0fb
|
[
"MIT"
] | 2
|
2019-08-25T09:37:27.000Z
|
2021-01-25T20:22:30.000Z
|
questions/geom_2/q00007/terms.rs.lua
|
bradunov/shkola
|
6ef057f5bd483318bf5763392972d48de481d0fb
|
[
"MIT"
] | 28
|
2019-07-04T19:53:36.000Z
|
2020-10-24T13:27:56.000Z
|
questions/geom_2/q00007/terms.rs.lua
|
bradunov/shkola
|
6ef057f5bd483318bf5763392972d48de481d0fb
|
[
"MIT"
] | null | null | null |
place = {
" Krugovi nemaju zajedničkih tačaka, ",
" Krugovi se dodiruju spolja, ",
" Krugovi se dodiruju iznutra, ",
" Krugovi se seku, ",
" Manji krug je ceo sadržan u većem, ",
" Krugovi su koncentrični, "
}
| 24.3
| 43
| 0.588477
|
65709f88fac05340d866a7a2b0aff12fbd92ca04
| 33
|
sql
|
SQL
|
tutorcare-core/api/db/migrations/000003_create_geolocation_table.down.sql
|
zaneHawkins/TutorCare
|
6a37756c4f6089d3a1450cf461ba1f237ff50626
|
[
"MIT"
] | 2
|
2022-01-02T05:09:45.000Z
|
2022-01-02T22:11:09.000Z
|
tutorcare-core/api/db/migrations/000003_create_geolocation_table.down.sql
|
zaneHawkins/TutorCare
|
6a37756c4f6089d3a1450cf461ba1f237ff50626
|
[
"MIT"
] | 42
|
2022-01-02T21:51:48.000Z
|
2022-01-21T02:11:21.000Z
|
tutorcare-core/api/db/migrations/000003_create_geolocation_table.down.sql
|
zaneHawkins/TutorCare
|
6a37756c4f6089d3a1450cf461ba1f237ff50626
|
[
"MIT"
] | 2
|
2021-12-22T02:29:24.000Z
|
2022-01-18T20:57:34.000Z
|
DROP TABLE IF EXISTS geolocation;
| 33
| 33
| 0.848485
|
c055b734abcb13a4f8eba3f2159989e1a09bdfbb
| 248
|
swift
|
Swift
|
snippets_swift/uniqued_comparable.swift
|
semisagi0/kyopro-snippet
|
bf4a91bfb679af9488b6c5eb765838ddf7100f9b
|
[
"Unlicense"
] | 5
|
2021-08-31T11:08:07.000Z
|
2022-02-15T16:57:17.000Z
|
snippets_swift/uniqued_comparable.swift
|
semisagi0/kyopro-snippet
|
bf4a91bfb679af9488b6c5eb765838ddf7100f9b
|
[
"Unlicense"
] | 1
|
2021-09-27T12:59:45.000Z
|
2021-09-27T13:41:24.000Z
|
snippets_swift/uniqued_comparable.swift
|
semisagi0/kyopro-snippet
|
bf4a91bfb679af9488b6c5eb765838ddf7100f9b
|
[
"Unlicense"
] | 1
|
2021-09-27T08:29:32.000Z
|
2021-09-27T08:29:32.000Z
|
extension Array where Element: Comparable {
func uniqued() -> [Element] {
var result = [Element]()
for element in sorted() where element != result.last {
result.append(element)
}
return result
}
}
| 27.555556
| 62
| 0.568548
|
0a46e22e16629ae1ce2da527e140ec7d45d4486e
| 2,074
|
rs
|
Rust
|
src/api/admin_tag_api.rs
|
iPersona/blog
|
ca6d88db7dded3e9f4b7517a3d00f5b0288a77f3
|
[
"MIT"
] | null | null | null |
src/api/admin_tag_api.rs
|
iPersona/blog
|
ca6d88db7dded3e9f4b7517a3d00f5b0288a77f3
|
[
"MIT"
] | null | null | null |
src/api/admin_tag_api.rs
|
iPersona/blog
|
ca6d88db7dded3e9f4b7517a3d00f5b0288a77f3
|
[
"MIT"
] | 1
|
2021-09-01T05:11:13.000Z
|
2021-09-01T05:11:13.000Z
|
use crate::api::JsonResponse;
use crate::models::tag::{DeleteTag, ViewTag};
use crate::{AppState, NewTag, TagCount, Tags};
use actix_web::error::ErrorInternalServerError;
use actix_web::http::Method;
use actix_web::{App, AsyncResponder, Form, HttpRequest};
use futures::future::Future;
pub struct Tag;
impl Tag {
pub fn create_tag((req, params): (HttpRequest<AppState>, Form<NewTag>)) -> JsonResponse {
let res = params.into_inner().insert(&req.state());
match res {
true => api_resp_ok!(),
false => api_resp_err!("create_tag failed!"),
}
}
pub fn delete_tag((req, params): (HttpRequest<AppState>, Form<DeleteTag>)) -> JsonResponse {
let res = Tags::delete_tag(&req.state(), params.into_inner().id);
match res {
Ok(v) => api_resp_data!(v),
Err(_) => api_resp_err!("delete_tag failed!"),
}
}
pub fn view_tag(req: &HttpRequest<AppState>) -> JsonResponse {
ViewTag::new(req.query()).map_or(api_resp_err!("parse query string failed!"), |params| {
let res = TagCount::view_all_tag_count(&req.state(), params.limit, params.offset);
match res {
Ok(v) => api_resp_data!(v),
Err(_) => api_resp_err!("delete_tag failed!"),
}
})
}
pub fn edit_tag((req, params): (HttpRequest<AppState>, Form<Tags>)) -> JsonResponse {
let res = params.into_inner().edit_tag(&req.state());
match res {
Ok(v) => api_resp_data!(v),
Err(_) => api_resp_err!("edit_tag failed!"),
}
}
pub fn configure(app: App<AppState>) -> App<AppState> {
app.scope("/api/v1/tag", |scope| {
scope
.resource("/new", |r| r.method(Method::POST).with(Tag::create_tag))
.resource("/view", |r| r.get().f(Tag::view_tag))
.resource("/delete", |r| r.method(Method::POST).with(Tag::delete_tag))
.resource("/edit", |r| r.method(Method::POST).with(Tag::edit_tag))
})
}
}
| 37.035714
| 96
| 0.57136
|
5d43ad0d9b3cf124ef0a593cbac87f07d63dce2e
| 3,753
|
cpp
|
C++
|
tests/longest_strictly_increasing_subsequence_tester.cpp
|
pawel-kieliszczyk/algorithms
|
0703ec99ce9fb215709b56fb0eefbdd576c71ed2
|
[
"MIT"
] | null | null | null |
tests/longest_strictly_increasing_subsequence_tester.cpp
|
pawel-kieliszczyk/algorithms
|
0703ec99ce9fb215709b56fb0eefbdd576c71ed2
|
[
"MIT"
] | null | null | null |
tests/longest_strictly_increasing_subsequence_tester.cpp
|
pawel-kieliszczyk/algorithms
|
0703ec99ce9fb215709b56fb0eefbdd576c71ed2
|
[
"MIT"
] | null | null | null |
#include <vector>
#include <gtest/gtest.h>
#include "longest_monotonic_subsequence.hpp"
namespace gt = testing;
namespace pk
{
namespace testing
{
struct longest_strictly_increasing_subsequence_tester : public gt::Test
{
static const int MAX_SEQUENCE_SIZE = 9;
// tested class:
typedef longest_monotonic_subsequence<MAX_SEQUENCE_SIZE> lms;
};
TEST_F(longest_strictly_increasing_subsequence_tester, tests_empty_sequence)
{
// given
std::vector<int> numbers;
// when and then
EXPECT_EQ(0, lms::strictly_increasing(numbers.begin(), numbers.end()));
}
TEST_F(longest_strictly_increasing_subsequence_tester, tests_one_element_sequence)
{
// given
std::vector<int> numbers;
numbers.push_back(42);
// when and then
EXPECT_EQ(1, lms::strictly_increasing(numbers.begin(), numbers.end()));
}
TEST_F(longest_strictly_increasing_subsequence_tester, tests_sequence_of_all_equal_elements)
{
// given
std::vector<int> numbers;
numbers.push_back(42);
numbers.push_back(42);
numbers.push_back(42);
// when and then
EXPECT_EQ(1, lms::strictly_increasing(numbers.begin(), numbers.end()));
}
TEST_F(longest_strictly_increasing_subsequence_tester, tests_sequence_of_all_strictly_decreasing_elements)
{
// given
std::vector<int> numbers;
numbers.push_back(33);
numbers.push_back(11);
numbers.push_back(0);
numbers.push_back(-22);
numbers.push_back(-55);
// when and then
EXPECT_EQ(1, lms::strictly_increasing(numbers.begin(), numbers.end()));
}
TEST_F(longest_strictly_increasing_subsequence_tester, tests_sequence_of_all_strictly_increasing_elements)
{
// given
std::vector<int> numbers;
numbers.push_back(-55);
numbers.push_back(-22);
numbers.push_back(0);
numbers.push_back(11);
numbers.push_back(33);
// when and then
EXPECT_EQ(5, lms::strictly_increasing(numbers.begin(), numbers.end()));
}
TEST_F(longest_strictly_increasing_subsequence_tester, tests_sequence_of_all_weakly_decreasing_elements)
{
// given
std::vector<int> numbers;
numbers.push_back(33);
numbers.push_back(22);
numbers.push_back(22);
numbers.push_back(11);
numbers.push_back(11);
// when and then
EXPECT_EQ(1, lms::strictly_increasing(numbers.begin(), numbers.end()));
}
TEST_F(longest_strictly_increasing_subsequence_tester, tests_sequence_of_all_weakly_increasing_elements)
{
// given
std::vector<int> numbers;
numbers.push_back(11);
numbers.push_back(11);
numbers.push_back(22);
numbers.push_back(22);
numbers.push_back(33);
// when and then
EXPECT_EQ(3, lms::strictly_increasing(numbers.begin(), numbers.end()));
}
TEST_F(longest_strictly_increasing_subsequence_tester, tests_sequence_of_randomized_elements)
{
// given
std::vector<int> numbers;
numbers.push_back(55);
numbers.push_back(-22);
numbers.push_back(33);
numbers.push_back(77);
numbers.push_back(22);
numbers.push_back(22);
numbers.push_back(44);
numbers.push_back(11);
numbers.push_back(66);
// when and then
EXPECT_EQ(4, lms::strictly_increasing(numbers.begin(), numbers.end()));
}
TEST_F(longest_strictly_increasing_subsequence_tester, tests_sequence_of_floatoing_point_elements)
{
// given
std::vector<double> numbers;
numbers.push_back(-1.1);
numbers.push_back(-1.2);
numbers.push_back(-1.2);
numbers.push_back(-1.1);
numbers.push_back(0.0);
numbers.push_back(0.0);
numbers.push_back(0.0);
numbers.push_back(0.1);
numbers.push_back(0.3);
// when and then
EXPECT_EQ(5, lms::strictly_increasing(numbers.begin(), numbers.end()));
}
} // namespace testing
} // namespace pk
| 23.45625
| 106
| 0.716227
|
439d96c0a706f7585c12a9e690531c0f67f253f7
| 1,953
|
ts
|
TypeScript
|
packages/broker/amqp/src/amqp-plugin.ts
|
gabliam/gabliam
|
c3feee62b18f98ea2209833115cc9a03037c7657
|
[
"MIT"
] | 5
|
2018-11-05T15:19:41.000Z
|
2019-05-24T04:12:12.000Z
|
packages/broker/amqp/src/amqp-plugin.ts
|
gabliam/gabliam
|
c3feee62b18f98ea2209833115cc9a03037c7657
|
[
"MIT"
] | 14
|
2018-03-21T13:18:45.000Z
|
2020-11-26T14:27:02.000Z
|
packages/broker/amqp/src/amqp-plugin.ts
|
gabliam/gabliam
|
c3feee62b18f98ea2209833115cc9a03037c7657
|
[
"MIT"
] | 3
|
2019-01-12T20:10:14.000Z
|
2019-04-28T10:17:28.000Z
|
import {
Container,
GabliamPlugin,
Plugin,
reflection,
Registry,
Scan,
} from '@gabliam/core';
import d from 'debug';
import { AmqpConnectionManager } from './amqp-manager';
import { TYPE } from './constants';
import {
CUnit,
RabbitConsumer,
RabbitHandler,
RabbitListener,
} from './metadatas';
const debug = d('Gabliam:Plugin:AmqpPlugin');
@Plugin()
@Scan()
export class AmqpPlugin implements GabliamPlugin {
build(container: Container, registry: Registry) {
debug('build AmqpPlugin');
const controllerIds = registry.get(TYPE.RabbitController);
const connectionManager = container.get(AmqpConnectionManager);
debug('controllerIds', controllerIds, container);
controllerIds.forEach(({ id: controllerId }) => {
const controller = container.get<any>(controllerId);
debug('controller', controller);
const handlerMetadatas = reflection.propMetadataOfDecorator<RabbitHandler>(
controller.constructor,
RabbitConsumer,
RabbitListener,
);
const [cunit] = reflection
.annotationsOfDecorator<CUnit>(controller.constructor, CUnit)
.slice(-1);
if (Object.keys(handlerMetadatas)) {
for (const [key, metas] of Object.entries(handlerMetadatas)) {
const [handlerMetadata] = metas.slice(-1);
if (cunit) {
connectionManager
.getConnection(cunit.name)
.constructAndAddConsume(key, handlerMetadata, controller);
} else {
connectionManager
.getDefaultConnection()
.constructAndAddConsume(key, handlerMetadata, controller);
}
}
}
});
}
async start(container: Container) {
const connection = container.get(AmqpConnectionManager);
await connection.start();
}
async stop(container: Container) {
const connection = container.get(AmqpConnectionManager);
await connection.stop();
}
}
| 27.9
| 81
| 0.658986
|
6b78e8c04d657c1111b936d47d6e67e54137ffcc
| 1,458
|
dart
|
Dart
|
lib/screens/authentication/recover/recover_account_found/interactor/viewmodels/recover_account_found_event.dart
|
chuck-h/seeds_light_wallet
|
a95d20d3724d5b458faf03fc5c0677798c6d208b
|
[
"MIT"
] | 2
|
2019-12-21T10:38:56.000Z
|
2019-12-22T01:23:51.000Z
|
lib/screens/authentication/recover/recover_account_found/interactor/viewmodels/recover_account_found_event.dart
|
chuck-h/seeds_light_wallet
|
a95d20d3724d5b458faf03fc5c0677798c6d208b
|
[
"MIT"
] | null | null | null |
lib/screens/authentication/recover/recover_account_found/interactor/viewmodels/recover_account_found_event.dart
|
chuck-h/seeds_light_wallet
|
a95d20d3724d5b458faf03fc5c0677798c6d208b
|
[
"MIT"
] | null | null | null |
part of 'recover_account_found_bloc.dart';
abstract class RecoverAccountFoundEvent extends Equatable {
const RecoverAccountFoundEvent();
@override
List<Object?> get props => [];
}
class FetchInitialData extends RecoverAccountFoundEvent {
const FetchInitialData();
@override
String toString() => 'FetchInitialData';
}
class OnClaimAccountTapped extends RecoverAccountFoundEvent {
const OnClaimAccountTapped();
@override
String toString() => 'OnClaimAccountTapped';
}
class OnCopyIconTapped extends RecoverAccountFoundEvent {
const OnCopyIconTapped();
@override
String toString() => 'OnCopyIconTapped';
}
class OnRefreshTapped extends RecoverAccountFoundEvent {
const OnRefreshTapped();
@override
String toString() => 'OnRefreshTapped';
}
class OnCancelProcessTapped extends RecoverAccountFoundEvent {
const OnCancelProcessTapped();
@override
String toString() => 'OnCancelProcessTapped';
}
class ClearRecoverPageCommand extends RecoverAccountFoundEvent {
const ClearRecoverPageCommand();
@override
String toString() => 'ClearRecoverPageCommand';
}
class StartCycleCountdown extends RecoverAccountFoundEvent {
const StartCycleCountdown();
@override
String toString() => 'StartCycleCountdown';
}
class Tick extends RecoverAccountFoundEvent {
final int count;
const Tick(this.count);
@override
List<Object?> get props => [count];
@override
String toString() => 'Tick { $count }';
}
| 20.828571
| 64
| 0.759945
|
f488f0c9cb136767415b6895177ebcb0e795a5b4
| 2,892
|
ts
|
TypeScript
|
src/index.ts
|
acollierr17/paginate
|
d5b1d00eeb13bd916fc7be5a315b561f2ff6d6e5
|
[
"MIT"
] | 4
|
2020-09-14T11:06:35.000Z
|
2021-05-04T13:29:15.000Z
|
src/index.ts
|
acollierr17/paginate.js
|
d5b1d00eeb13bd916fc7be5a315b561f2ff6d6e5
|
[
"MIT"
] | 5
|
2020-09-13T01:47:31.000Z
|
2020-12-20T11:40:35.000Z
|
src/index.ts
|
acollierr17/paginate.js
|
d5b1d00eeb13bd916fc7be5a315b561f2ff6d6e5
|
[
"MIT"
] | null | null | null |
// noinspection SuspiciousTypeOfGuard,JSUnusedGlobalSymbols
/**
* The class for creating paginated arrays.
* @template T
*/
export class Paginate<T> {
/**
* The array that will be used to generate a paginated array.
*/
public array: Array<T>;
/**
* The amount of elements to display per page.
*/
public size: number;
/**
* @param {Array<T>} array The array that will be used to generate a paginated array.
* @param {number} size The amount of elements to display per page.
*/
constructor(array: Array<T> = [], size = 1) {
this.array = array;
this.size = size;
if (!Array.isArray(this.array) || !this.array)
throw new TypeError(`You must pass in a valid Array object! (Current type: ${typeof this.array})`);
if (typeof this.size !== 'number')
throw new TypeError(`You must pass in a valid number for the page size! (Current type: ${typeof this.size})`);
}
/**
* Sets the array of the Paginate class.
* @param {Array<T>} array The array to set.
* @returns {Paginate<T>}
*/
public setArray(array: Array<T>): Paginate<T> {
if (!Array.isArray(array) || !array)
throw new TypeError(`You must pass in a valid Array object! (Current type: ${typeof array})`);
if (!array.length)
throw new RangeError('There must be at least (1) one element in the array!');
this.array = array;
return this;
}
/**
* Sets the page size of the Paginate class.
* @param {number} size The size to set.
* @returns {Paginate<T>}
*/
public setSize(size: number): Paginate<T> {
if (typeof size !== 'number')
throw new TypeError(`You must pass in a valid number for the page size! (Current type: ${typeof size})`);
if (size < 1)
throw new RangeError('The size of elements per page must be at least (1) one!');
if (size > this.array.length)
throw new RangeError('The size of elements per page cannot be greater than the elements in the array!');
this.size = size;
return this;
}
/**
* Gets the new paginated array with the defined amount of elements per page.
* @returns {Array<Array<T>>}
*/
public getPaginatedArray(): Array<Array<T>> {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return [...this.pageGenerator()];
}
private *pageGenerator(): Generator<Array<T>, void, Array<T>> {
const pages = Math.ceil(this.array.length / this.size);
for (let page = 0; page < pages; page++) {
const start = Math.max(this.getPageStart(page), 0);
const end = Math.min(this.getPageStart(page + 1), this.array.length);
yield this.array.slice(start, end);
}
}
/**
* Gets the first array element of the current page.
* @param {number} page The page to get.
* @returns {number}
*/
private getPageStart(page: number): number {
return this.size * page;
}
}
| 31.78022
| 116
| 0.639004
|
c2f48f0a5c3e238d4de7c54c28a696f7cce30413
| 164
|
asm
|
Assembly
|
sw/552tests/inst_tests/seq_9.asm
|
JPShen-UWM/ThreadKraken
|
849c510531f28e36d3469535737b2120bd774935
|
[
"MIT"
] | 1
|
2022-02-15T16:03:25.000Z
|
2022-02-15T16:03:25.000Z
|
sw/552tests/inst_tests/seq_9.asm
|
JPShen-UWM/ThreadKraken
|
849c510531f28e36d3469535737b2120bd774935
|
[
"MIT"
] | null | null | null |
sw/552tests/inst_tests/seq_9.asm
|
JPShen-UWM/ThreadKraken
|
849c510531f28e36d3469535737b2120bd774935
|
[
"MIT"
] | null | null | null |
// Test provided by Karu
//SEQ test 9. Test when rd and rt are the same register
//
// Michael McKinley (mckinley)
lbi r1, 0xff
lbi r2, 0x35
seq r2, r1, r2
halt
| 16.4
| 56
| 0.689024
|
3017edccd48bae0c14a7247ba347a5b010be8ded
| 300,702
|
asm
|
Assembly
|
src/sh.asm
|
dalegebit/DamnOS-DamnFS
|
165cece9fedf8f45b25c0b948fd4185d3d633fb2
|
[
"MIT"
] | 2
|
2017-03-27T16:02:57.000Z
|
2018-03-03T03:28:29.000Z
|
src/sh.asm
|
dalegebit/DamnOS-DamnFS
|
165cece9fedf8f45b25c0b948fd4185d3d633fb2
|
[
"MIT"
] | null | null | null |
src/sh.asm
|
dalegebit/DamnOS-DamnFS
|
165cece9fedf8f45b25c0b948fd4185d3d633fb2
|
[
"MIT"
] | null | null | null |
sh: file format elf32-i386
Disassembly of section .text:
80001020 <_start>:
;// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
;// See if we were started with arguments on the stack
cmpl $USTACKTOP, %esp
80001020: 81 fc 00 e0 bf ee cmp $0xeebfe000,%esp
jne args_exist
80001026: 75 04 jne 8000102c <args_exist>
;// If not, push dummy argc/argv arguments.
;// This happens when we are loaded by the kernel,
;// because the kernel does not know about passing arguments.
pushl $0
80001028: 6a 00 push $0x0
pushl $0
8000102a: 6a 00 push $0x0
8000102c <args_exist>:
args_exist:
call libmain
8000102c: e8 d5 0c 00 00 call 80001d06 <libmain>
1: jmp 1b
80001031: eb fe jmp 80001031 <args_exist+0x5>
80001033 <_gettoken>:
#define WHITESPACE " \t\r\n"
#define SYMBOLS "<|>&;()"
int
_gettoken(char *s, char **p1, char **p2)
{
80001033: 55 push %ebp
80001034: 89 e5 mov %esp,%ebp
80001036: 57 push %edi
80001037: 56 push %esi
80001038: 53 push %ebx
80001039: 83 ec 0c sub $0xc,%esp
8000103c: 8b 5d 08 mov 0x8(%ebp),%ebx
8000103f: 8b 75 0c mov 0xc(%ebp),%esi
int t;
if (s == 0) {
80001042: 85 db test %ebx,%ebx
80001044: 75 2c jne 80001072 <_gettoken+0x3f>
if (debug > 1)
cprintf("GETTOKEN NULL\n");
return 0;
80001046: b8 00 00 00 00 mov $0x0,%eax
_gettoken(char *s, char **p1, char **p2)
{
int t;
if (s == 0) {
if (debug > 1)
8000104b: 83 3d 00 60 00 80 01 cmpl $0x1,0x80006000
80001052: 0f 8e 45 01 00 00 jle 8000119d <_gettoken+0x16a>
cprintf("GETTOKEN NULL\n");
80001058: 83 ec 0c sub $0xc,%esp
8000105b: 68 c0 41 00 80 push $0x800041c0
80001060: e8 ea 2e 00 00 call 80003f4f <cprintf>
80001065: 83 c4 10 add $0x10,%esp
return 0;
80001068: b8 00 00 00 00 mov $0x0,%eax
8000106d: e9 2b 01 00 00 jmp 8000119d <_gettoken+0x16a>
}
if (debug > 1)
80001072: 83 3d 00 60 00 80 01 cmpl $0x1,0x80006000
80001079: 7e 11 jle 8000108c <_gettoken+0x59>
cprintf("GETTOKEN: %s\n", s);
8000107b: 83 ec 08 sub $0x8,%esp
8000107e: 53 push %ebx
8000107f: 68 cf 41 00 80 push $0x800041cf
80001084: e8 c6 2e 00 00 call 80003f4f <cprintf>
80001089: 83 c4 10 add $0x10,%esp
*p1 = 0;
8000108c: c7 06 00 00 00 00 movl $0x0,(%esi)
*p2 = 0;
80001092: 8b 45 10 mov 0x10(%ebp),%eax
80001095: c7 00 00 00 00 00 movl $0x0,(%eax)
while (strchr(WHITESPACE, *s))
8000109b: eb 07 jmp 800010a4 <_gettoken+0x71>
*s++ = 0;
8000109d: 83 c3 01 add $0x1,%ebx
800010a0: c6 43 ff 00 movb $0x0,-0x1(%ebx)
cprintf("GETTOKEN: %s\n", s);
*p1 = 0;
*p2 = 0;
while (strchr(WHITESPACE, *s))
800010a4: 83 ec 08 sub $0x8,%esp
800010a7: 0f be 03 movsbl (%ebx),%eax
800010aa: 50 push %eax
800010ab: 68 dd 41 00 80 push $0x800041dd
800010b0: e8 b4 09 00 00 call 80001a69 <strchr>
800010b5: 83 c4 10 add $0x10,%esp
800010b8: 85 c0 test %eax,%eax
800010ba: 75 e1 jne 8000109d <_gettoken+0x6a>
*s++ = 0;
if (*s == 0) {
800010bc: 0f b6 03 movzbl (%ebx),%eax
800010bf: 84 c0 test %al,%al
800010c1: 75 2c jne 800010ef <_gettoken+0xbc>
if (debug > 1)
cprintf("EOL\n");
return 0;
800010c3: b8 00 00 00 00 mov $0x0,%eax
*p2 = 0;
while (strchr(WHITESPACE, *s))
*s++ = 0;
if (*s == 0) {
if (debug > 1)
800010c8: 83 3d 00 60 00 80 01 cmpl $0x1,0x80006000
800010cf: 0f 8e c8 00 00 00 jle 8000119d <_gettoken+0x16a>
cprintf("EOL\n");
800010d5: 83 ec 0c sub $0xc,%esp
800010d8: 68 e2 41 00 80 push $0x800041e2
800010dd: e8 6d 2e 00 00 call 80003f4f <cprintf>
800010e2: 83 c4 10 add $0x10,%esp
return 0;
800010e5: b8 00 00 00 00 mov $0x0,%eax
800010ea: e9 ae 00 00 00 jmp 8000119d <_gettoken+0x16a>
}
if (strchr(SYMBOLS, *s)) {
800010ef: 83 ec 08 sub $0x8,%esp
800010f2: 0f be c0 movsbl %al,%eax
800010f5: 50 push %eax
800010f6: 68 f3 41 00 80 push $0x800041f3
800010fb: e8 69 09 00 00 call 80001a69 <strchr>
80001100: 83 c4 10 add $0x10,%esp
80001103: 85 c0 test %eax,%eax
80001105: 74 30 je 80001137 <_gettoken+0x104>
t = *s;
80001107: 0f be 3b movsbl (%ebx),%edi
*p1 = s;
8000110a: 89 1e mov %ebx,(%esi)
*s++ = 0;
8000110c: c6 03 00 movb $0x0,(%ebx)
*p2 = s;
8000110f: 83 c3 01 add $0x1,%ebx
80001112: 8b 45 10 mov 0x10(%ebp),%eax
80001115: 89 18 mov %ebx,(%eax)
if (debug > 1)
cprintf("TOK %c\n", t);
return t;
80001117: 89 f8 mov %edi,%eax
if (strchr(SYMBOLS, *s)) {
t = *s;
*p1 = s;
*s++ = 0;
*p2 = s;
if (debug > 1)
80001119: 83 3d 00 60 00 80 01 cmpl $0x1,0x80006000
80001120: 7e 7b jle 8000119d <_gettoken+0x16a>
cprintf("TOK %c\n", t);
80001122: 83 ec 08 sub $0x8,%esp
80001125: 57 push %edi
80001126: 68 e7 41 00 80 push $0x800041e7
8000112b: e8 1f 2e 00 00 call 80003f4f <cprintf>
80001130: 83 c4 10 add $0x10,%esp
return t;
80001133: 89 f8 mov %edi,%eax
80001135: eb 66 jmp 8000119d <_gettoken+0x16a>
}
*p1 = s;
80001137: 89 1e mov %ebx,(%esi)
while (*s && !strchr(WHITESPACE SYMBOLS, *s))
80001139: 0f b6 03 movzbl (%ebx),%eax
8000113c: 84 c0 test %al,%al
8000113e: 75 0c jne 8000114c <_gettoken+0x119>
80001140: eb 22 jmp 80001164 <_gettoken+0x131>
s++;
80001142: 83 c3 01 add $0x1,%ebx
if (debug > 1)
cprintf("TOK %c\n", t);
return t;
}
*p1 = s;
while (*s && !strchr(WHITESPACE SYMBOLS, *s))
80001145: 0f b6 03 movzbl (%ebx),%eax
80001148: 84 c0 test %al,%al
8000114a: 74 18 je 80001164 <_gettoken+0x131>
8000114c: 83 ec 08 sub $0x8,%esp
8000114f: 0f be c0 movsbl %al,%eax
80001152: 50 push %eax
80001153: 68 ef 41 00 80 push $0x800041ef
80001158: e8 0c 09 00 00 call 80001a69 <strchr>
8000115d: 83 c4 10 add $0x10,%esp
80001160: 85 c0 test %eax,%eax
80001162: 74 de je 80001142 <_gettoken+0x10f>
s++;
*p2 = s;
80001164: 8b 45 10 mov 0x10(%ebp),%eax
80001167: 89 18 mov %ebx,(%eax)
t = **p2;
**p2 = 0;
cprintf("WORD: %s\n", *p1);
**p2 = t;
}
return 'w';
80001169: b8 77 00 00 00 mov $0x77,%eax
}
*p1 = s;
while (*s && !strchr(WHITESPACE SYMBOLS, *s))
s++;
*p2 = s;
if (debug > 1) {
8000116e: 83 3d 00 60 00 80 01 cmpl $0x1,0x80006000
80001175: 7e 26 jle 8000119d <_gettoken+0x16a>
t = **p2;
80001177: 0f b6 3b movzbl (%ebx),%edi
**p2 = 0;
8000117a: c6 03 00 movb $0x0,(%ebx)
cprintf("WORD: %s\n", *p1);
8000117d: 83 ec 08 sub $0x8,%esp
80001180: ff 36 pushl (%esi)
80001182: 68 fb 41 00 80 push $0x800041fb
80001187: e8 c3 2d 00 00 call 80003f4f <cprintf>
**p2 = t;
8000118c: 8b 45 10 mov 0x10(%ebp),%eax
8000118f: 8b 00 mov (%eax),%eax
80001191: 89 fa mov %edi,%edx
80001193: 88 10 mov %dl,(%eax)
80001195: 83 c4 10 add $0x10,%esp
}
return 'w';
80001198: b8 77 00 00 00 mov $0x77,%eax
}
8000119d: 8d 65 f4 lea -0xc(%ebp),%esp
800011a0: 5b pop %ebx
800011a1: 5e pop %esi
800011a2: 5f pop %edi
800011a3: 5d pop %ebp
800011a4: c3 ret
800011a5 <gettoken>:
int
gettoken(char *s, char **p1)
{
800011a5: 55 push %ebp
800011a6: 89 e5 mov %esp,%ebp
800011a8: 83 ec 08 sub $0x8,%esp
800011ab: 8b 45 08 mov 0x8(%ebp),%eax
static int c, nc;
static char* np1, *np2;
if (s) {
800011ae: 85 c0 test %eax,%eax
800011b0: 74 22 je 800011d4 <gettoken+0x2f>
nc = _gettoken(s, &np1, &np2);
800011b2: 83 ec 04 sub $0x4,%esp
800011b5: 68 0c 60 00 80 push $0x8000600c
800011ba: 68 10 60 00 80 push $0x80006010
800011bf: 50 push %eax
800011c0: e8 6e fe ff ff call 80001033 <_gettoken>
800011c5: a3 08 60 00 80 mov %eax,0x80006008
return 0;
800011ca: 83 c4 10 add $0x10,%esp
800011cd: b8 00 00 00 00 mov $0x0,%eax
800011d2: eb 3a jmp 8000120e <gettoken+0x69>
}
c = nc;
800011d4: a1 08 60 00 80 mov 0x80006008,%eax
800011d9: a3 04 60 00 80 mov %eax,0x80006004
*p1 = np1;
800011de: 8b 45 0c mov 0xc(%ebp),%eax
800011e1: 8b 15 10 60 00 80 mov 0x80006010,%edx
800011e7: 89 10 mov %edx,(%eax)
nc = _gettoken(np2, &np1, &np2);
800011e9: 83 ec 04 sub $0x4,%esp
800011ec: 68 0c 60 00 80 push $0x8000600c
800011f1: 68 10 60 00 80 push $0x80006010
800011f6: ff 35 0c 60 00 80 pushl 0x8000600c
800011fc: e8 32 fe ff ff call 80001033 <_gettoken>
80001201: a3 08 60 00 80 mov %eax,0x80006008
return c;
80001206: a1 04 60 00 80 mov 0x80006004,%eax
8000120b: 83 c4 10 add $0x10,%esp
}
8000120e: c9 leave
8000120f: c3 ret
80001210 <runcmd>:
// runcmd() is called in a forked child,
// so it's OK to manipulate file descriptor state.
#define MAXARGS 16
void
runcmd(char* s)
{
80001210: 55 push %ebp
80001211: 89 e5 mov %esp,%ebp
80001213: 57 push %edi
80001214: 56 push %esi
80001215: 53 push %ebx
80001216: 81 ec 64 04 00 00 sub $0x464,%esp
char *argv[MAXARGS], *t, argv0buf[BUFSIZ];
int argc, c, i, r, p[2], fd, pipe_child;
pipe_child = 0;
gettoken(s, 0);
8000121c: 6a 00 push $0x0
8000121e: ff 75 08 pushl 0x8(%ebp)
80001221: e8 7f ff ff ff call 800011a5 <gettoken>
80001226: 83 c4 10 add $0x10,%esp
again:
argc = 0;
while (1) {
switch ((c = gettoken(0, &t))) {
80001229: 8d 5d a4 lea -0x5c(%ebp),%ebx
pipe_child = 0;
gettoken(s, 0);
again:
argc = 0;
8000122c: be 00 00 00 00 mov $0x0,%esi
while (1) {
switch ((c = gettoken(0, &t))) {
80001231: 83 ec 08 sub $0x8,%esp
80001234: 53 push %ebx
80001235: 6a 00 push $0x0
80001237: e8 69 ff ff ff call 800011a5 <gettoken>
8000123c: 83 c4 10 add $0x10,%esp
8000123f: 83 f8 3e cmp $0x3e,%eax
80001242: 0f 84 cc 00 00 00 je 80001314 <runcmd+0x104>
80001248: 83 f8 3e cmp $0x3e,%eax
8000124b: 7f 12 jg 8000125f <runcmd+0x4f>
8000124d: 85 c0 test %eax,%eax
8000124f: 0f 84 3b 02 00 00 je 80001490 <runcmd+0x280>
80001255: 83 f8 3c cmp $0x3c,%eax
80001258: 74 3e je 80001298 <runcmd+0x88>
8000125a: e9 1f 02 00 00 jmp 8000147e <runcmd+0x26e>
8000125f: 83 f8 77 cmp $0x77,%eax
80001262: 74 0e je 80001272 <runcmd+0x62>
80001264: 83 f8 7c cmp $0x7c,%eax
80001267: 0f 84 25 01 00 00 je 80001392 <runcmd+0x182>
8000126d: e9 0c 02 00 00 jmp 8000147e <runcmd+0x26e>
case 'w': // Add an argument
if (argc == MAXARGS) {
80001272: 83 fe 10 cmp $0x10,%esi
80001275: 75 15 jne 8000128c <runcmd+0x7c>
cprintf("too many arguments\n");
80001277: 83 ec 0c sub $0xc,%esp
8000127a: 68 05 42 00 80 push $0x80004205
8000127f: e8 cb 2c 00 00 call 80003f4f <cprintf>
exit();
80001284: e8 c3 24 00 00 call 8000374c <exit>
80001289: 83 c4 10 add $0x10,%esp
}
argv[argc++] = t;
8000128c: 8b 45 a4 mov -0x5c(%ebp),%eax
8000128f: 89 44 b5 a8 mov %eax,-0x58(%ebp,%esi,4)
80001293: 8d 76 01 lea 0x1(%esi),%esi
break;
80001296: eb 99 jmp 80001231 <runcmd+0x21>
case '<': // Input redirection
// Grab the filename from the argument list
if (gettoken(0, &t) != 'w') {
80001298: 83 ec 08 sub $0x8,%esp
8000129b: 53 push %ebx
8000129c: 6a 00 push $0x0
8000129e: e8 02 ff ff ff call 800011a5 <gettoken>
800012a3: 83 c4 10 add $0x10,%esp
800012a6: 83 f8 77 cmp $0x77,%eax
800012a9: 74 15 je 800012c0 <runcmd+0xb0>
cprintf("syntax error: < not followed by word\n");
800012ab: 83 ec 0c sub $0xc,%esp
800012ae: 68 a8 43 00 80 push $0x800043a8
800012b3: e8 97 2c 00 00 call 80003f4f <cprintf>
exit();
800012b8: e8 8f 24 00 00 call 8000374c <exit>
800012bd: 83 c4 10 add $0x10,%esp
// If not, dup 'fd' onto file descriptor 0,
// then close the original 'fd'.
// LAB 5: Your code here.
// panic("< redirection not implemented");
if((fd = open(t, O_RDONLY)) < 0)
800012c0: 83 ec 08 sub $0x8,%esp
800012c3: 6a 00 push $0x0
800012c5: ff 75 a4 pushl -0x5c(%ebp)
800012c8: e8 2c 16 00 00 call 800028f9 <open>
800012cd: 89 c7 mov %eax,%edi
800012cf: 83 c4 10 add $0x10,%esp
800012d2: 85 c0 test %eax,%eax
800012d4: 79 1b jns 800012f1 <runcmd+0xe1>
{
cprintf("open %s for read: %e", t, fd);
800012d6: 83 ec 04 sub $0x4,%esp
800012d9: 50 push %eax
800012da: ff 75 a4 pushl -0x5c(%ebp)
800012dd: 68 19 42 00 80 push $0x80004219
800012e2: e8 68 2c 00 00 call 80003f4f <cprintf>
exit();
800012e7: e8 60 24 00 00 call 8000374c <exit>
800012ec: 83 c4 10 add $0x10,%esp
800012ef: eb 08 jmp 800012f9 <runcmd+0xe9>
}
if(fd != 0)
800012f1: 85 c0 test %eax,%eax
800012f3: 0f 84 38 ff ff ff je 80001231 <runcmd+0x21>
{
dup(fd, 0);
800012f9: 83 ec 08 sub $0x8,%esp
800012fc: 6a 00 push $0x0
800012fe: 57 push %edi
800012ff: e8 bb 10 00 00 call 800023bf <dup>
close(fd);
80001304: 89 3c 24 mov %edi,(%esp)
80001307: e8 63 10 00 00 call 8000236f <close>
8000130c: 83 c4 10 add $0x10,%esp
8000130f: e9 1d ff ff ff jmp 80001231 <runcmd+0x21>
}
break;
case '>': // Output redirection
// Grab the filename from the argument list
if (gettoken(0, &t) != 'w') {
80001314: 83 ec 08 sub $0x8,%esp
80001317: 53 push %ebx
80001318: 6a 00 push $0x0
8000131a: e8 86 fe ff ff call 800011a5 <gettoken>
8000131f: 83 c4 10 add $0x10,%esp
80001322: 83 f8 77 cmp $0x77,%eax
80001325: 74 15 je 8000133c <runcmd+0x12c>
cprintf("syntax error: > not followed by word\n");
80001327: 83 ec 0c sub $0xc,%esp
8000132a: 68 d0 43 00 80 push $0x800043d0
8000132f: e8 1b 2c 00 00 call 80003f4f <cprintf>
exit();
80001334: e8 13 24 00 00 call 8000374c <exit>
80001339: 83 c4 10 add $0x10,%esp
}
if ((fd = open(t, O_WRONLY|O_CREAT|O_TRUNC)) < 0) {
8000133c: 83 ec 08 sub $0x8,%esp
8000133f: 68 01 03 00 00 push $0x301
80001344: ff 75 a4 pushl -0x5c(%ebp)
80001347: e8 ad 15 00 00 call 800028f9 <open>
8000134c: 89 c7 mov %eax,%edi
8000134e: 83 c4 10 add $0x10,%esp
80001351: 85 c0 test %eax,%eax
80001353: 79 19 jns 8000136e <runcmd+0x15e>
cprintf("open %s for write: %e", t, fd);
80001355: 83 ec 04 sub $0x4,%esp
80001358: 50 push %eax
80001359: ff 75 a4 pushl -0x5c(%ebp)
8000135c: 68 2e 42 00 80 push $0x8000422e
80001361: e8 e9 2b 00 00 call 80003f4f <cprintf>
exit();
80001366: e8 e1 23 00 00 call 8000374c <exit>
8000136b: 83 c4 10 add $0x10,%esp
}
if (fd != 1) {
8000136e: 83 ff 01 cmp $0x1,%edi
80001371: 0f 84 ba fe ff ff je 80001231 <runcmd+0x21>
dup(fd, 1);
80001377: 83 ec 08 sub $0x8,%esp
8000137a: 6a 01 push $0x1
8000137c: 57 push %edi
8000137d: e8 3d 10 00 00 call 800023bf <dup>
close(fd);
80001382: 89 3c 24 mov %edi,(%esp)
80001385: e8 e5 0f 00 00 call 8000236f <close>
8000138a: 83 c4 10 add $0x10,%esp
8000138d: e9 9f fe ff ff jmp 80001231 <runcmd+0x21>
}
break;
case '|': // Pipe
if ((r = pipe(p)) < 0) {
80001392: 83 ec 0c sub $0xc,%esp
80001395: 8d 85 9c fb ff ff lea -0x464(%ebp),%eax
8000139b: 50 push %eax
8000139c: e8 ea 17 00 00 call 80002b8b <pipe>
800013a1: 83 c4 10 add $0x10,%esp
800013a4: 85 c0 test %eax,%eax
800013a6: 79 16 jns 800013be <runcmd+0x1ae>
cprintf("pipe: %e", r);
800013a8: 83 ec 08 sub $0x8,%esp
800013ab: 50 push %eax
800013ac: 68 44 42 00 80 push $0x80004244
800013b1: e8 99 2b 00 00 call 80003f4f <cprintf>
exit();
800013b6: e8 91 23 00 00 call 8000374c <exit>
800013bb: 83 c4 10 add $0x10,%esp
}
if (debug)
800013be: 83 3d 00 60 00 80 00 cmpl $0x0,0x80006000
800013c5: 74 1c je 800013e3 <runcmd+0x1d3>
cprintf("PIPE: %d %d\n", p[0], p[1]);
800013c7: 83 ec 04 sub $0x4,%esp
800013ca: ff b5 a0 fb ff ff pushl -0x460(%ebp)
800013d0: ff b5 9c fb ff ff pushl -0x464(%ebp)
800013d6: 68 4d 42 00 80 push $0x8000424d
800013db: e8 6f 2b 00 00 call 80003f4f <cprintf>
800013e0: 83 c4 10 add $0x10,%esp
if ((r = fork()) < 0) {
800013e3: e8 1d 1b 00 00 call 80002f05 <fork>
800013e8: 89 c7 mov %eax,%edi
800013ea: 85 c0 test %eax,%eax
800013ec: 79 16 jns 80001404 <runcmd+0x1f4>
cprintf("fork: %e", r);
800013ee: 83 ec 08 sub $0x8,%esp
800013f1: 50 push %eax
800013f2: 68 5a 42 00 80 push $0x8000425a
800013f7: e8 53 2b 00 00 call 80003f4f <cprintf>
exit();
800013fc: e8 4b 23 00 00 call 8000374c <exit>
80001401: 83 c4 10 add $0x10,%esp
}
if (r == 0) {
80001404: 85 ff test %edi,%edi
80001406: 75 3c jne 80001444 <runcmd+0x234>
if (p[0] != 0) {
80001408: 8b 85 9c fb ff ff mov -0x464(%ebp),%eax
8000140e: 85 c0 test %eax,%eax
80001410: 74 1c je 8000142e <runcmd+0x21e>
dup(p[0], 0);
80001412: 83 ec 08 sub $0x8,%esp
80001415: 6a 00 push $0x0
80001417: 50 push %eax
80001418: e8 a2 0f 00 00 call 800023bf <dup>
close(p[0]);
8000141d: 83 c4 04 add $0x4,%esp
80001420: ff b5 9c fb ff ff pushl -0x464(%ebp)
80001426: e8 44 0f 00 00 call 8000236f <close>
8000142b: 83 c4 10 add $0x10,%esp
}
close(p[1]);
8000142e: 83 ec 0c sub $0xc,%esp
80001431: ff b5 a0 fb ff ff pushl -0x460(%ebp)
80001437: e8 33 0f 00 00 call 8000236f <close>
goto again;
8000143c: 83 c4 10 add $0x10,%esp
8000143f: e9 e8 fd ff ff jmp 8000122c <runcmd+0x1c>
} else {
pipe_child = r;
if (p[1] != 1) {
80001444: 8b 85 a0 fb ff ff mov -0x460(%ebp),%eax
8000144a: 83 f8 01 cmp $0x1,%eax
8000144d: 74 1c je 8000146b <runcmd+0x25b>
dup(p[1], 1);
8000144f: 83 ec 08 sub $0x8,%esp
80001452: 6a 01 push $0x1
80001454: 50 push %eax
80001455: e8 65 0f 00 00 call 800023bf <dup>
close(p[1]);
8000145a: 83 c4 04 add $0x4,%esp
8000145d: ff b5 a0 fb ff ff pushl -0x460(%ebp)
80001463: e8 07 0f 00 00 call 8000236f <close>
80001468: 83 c4 10 add $0x10,%esp
}
close(p[0]);
8000146b: 83 ec 0c sub $0xc,%esp
8000146e: ff b5 9c fb ff ff pushl -0x464(%ebp)
80001474: e8 f6 0e 00 00 call 8000236f <close>
goto runit;
80001479: 83 c4 10 add $0x10,%esp
8000147c: eb 17 jmp 80001495 <runcmd+0x285>
case 0: // String is complete
// Run the current command!
goto runit;
default:
panic("bad return %d from gettoken", c);
8000147e: 50 push %eax
8000147f: 68 63 42 00 80 push $0x80004263
80001484: 6a 7a push $0x7a
80001486: 68 7f 42 00 80 push $0x8000427f
8000148b: e8 e7 2c 00 00 call 80004177 <_panic>
runcmd(char* s)
{
char *argv[MAXARGS], *t, argv0buf[BUFSIZ];
int argc, c, i, r, p[2], fd, pipe_child;
pipe_child = 0;
80001490: bf 00 00 00 00 mov $0x0,%edi
}
}
runit:
// Return immediately if command line was empty.
if(argc == 0) {
80001495: 85 f6 test %esi,%esi
80001497: 75 22 jne 800014bb <runcmd+0x2ab>
if (debug)
80001499: 83 3d 00 60 00 80 00 cmpl $0x0,0x80006000
800014a0: 0f 84 9b 01 00 00 je 80001641 <runcmd+0x431>
cprintf("EMPTY COMMAND\n");
800014a6: 83 ec 0c sub $0xc,%esp
800014a9: 68 84 42 00 80 push $0x80004284
800014ae: e8 9c 2a 00 00 call 80003f4f <cprintf>
800014b3: 83 c4 10 add $0x10,%esp
800014b6: e9 86 01 00 00 jmp 80001641 <runcmd+0x431>
// Clean up command line.
// Read all commands from the filesystem: add an initial '/' to
// the command name.
// This essentially acts like 'PATH=/'.
if (argv[0][0] != '/') {
800014bb: 8b 45 a8 mov -0x58(%ebp),%eax
800014be: 80 38 2f cmpb $0x2f,(%eax)
800014c1: 74 23 je 800014e6 <runcmd+0x2d6>
argv0buf[0] = '/';
800014c3: c6 85 a4 fb ff ff 2f movb $0x2f,-0x45c(%ebp)
strcpy(argv0buf + 1, argv[0]);
800014ca: 83 ec 08 sub $0x8,%esp
800014cd: 50 push %eax
800014ce: 8d 9d a4 fb ff ff lea -0x45c(%ebp),%ebx
800014d4: 8d 85 a5 fb ff ff lea -0x45b(%ebp),%eax
800014da: 50 push %eax
800014db: e8 45 04 00 00 call 80001925 <strcpy>
argv[0] = argv0buf;
800014e0: 89 5d a8 mov %ebx,-0x58(%ebp)
800014e3: 83 c4 10 add $0x10,%esp
}
argv[argc] = 0;
800014e6: c7 44 b5 a8 00 00 00 movl $0x0,-0x58(%ebp,%esi,4)
800014ed: 00
// Print the command.
if (debug) {
800014ee: 83 3d 00 60 00 80 00 cmpl $0x0,0x80006000
800014f5: 74 4e je 80001545 <runcmd+0x335>
cprintf("[%08x] SPAWN:", thisenv->env_id);
800014f7: a1 20 64 00 80 mov 0x80006420,%eax
800014fc: 8b 40 48 mov 0x48(%eax),%eax
800014ff: 83 ec 08 sub $0x8,%esp
80001502: 50 push %eax
80001503: 68 93 42 00 80 push $0x80004293
80001508: e8 42 2a 00 00 call 80003f4f <cprintf>
for (i = 0; argv[i]; i++)
8000150d: 8b 45 a8 mov -0x58(%ebp),%eax
80001510: 83 c4 10 add $0x10,%esp
80001513: 85 c0 test %eax,%eax
80001515: 74 1e je 80001535 <runcmd+0x325>
80001517: 8d 5d ac lea -0x54(%ebp),%ebx
cprintf(" %s", argv[i]);
8000151a: 83 ec 08 sub $0x8,%esp
8000151d: 50 push %eax
8000151e: 68 a1 42 00 80 push $0x800042a1
80001523: e8 27 2a 00 00 call 80003f4f <cprintf>
80001528: 83 c3 04 add $0x4,%ebx
argv[argc] = 0;
// Print the command.
if (debug) {
cprintf("[%08x] SPAWN:", thisenv->env_id);
for (i = 0; argv[i]; i++)
8000152b: 8b 43 fc mov -0x4(%ebx),%eax
8000152e: 83 c4 10 add $0x10,%esp
80001531: 85 c0 test %eax,%eax
80001533: 75 e5 jne 8000151a <runcmd+0x30a>
cprintf(" %s", argv[i]);
cprintf("\n");
80001535: 83 ec 0c sub $0xc,%esp
80001538: 68 e0 41 00 80 push $0x800041e0
8000153d: e8 0d 2a 00 00 call 80003f4f <cprintf>
80001542: 83 c4 10 add $0x10,%esp
}
// Spawn the command!
if ((r = spawn(argv[0], (const char**) argv)) < 0)
80001545: 83 ec 08 sub $0x8,%esp
80001548: 8d 45 a8 lea -0x58(%ebp),%eax
8000154b: 50 push %eax
8000154c: ff 75 a8 pushl -0x58(%ebp)
8000154f: e8 15 1c 00 00 call 80003169 <spawn>
80001554: 89 c3 mov %eax,%ebx
80001556: 83 c4 10 add $0x10,%esp
80001559: 85 c0 test %eax,%eax
8000155b: 0f 89 c3 00 00 00 jns 80001624 <runcmd+0x414>
cprintf("spawn %s: %e\n", argv[0], r);
80001561: 83 ec 04 sub $0x4,%esp
80001564: 50 push %eax
80001565: ff 75 a8 pushl -0x58(%ebp)
80001568: 68 a5 42 00 80 push $0x800042a5
8000156d: e8 dd 29 00 00 call 80003f4f <cprintf>
// In the parent, close all file descriptors and wait for the
// spawned command to exit.
close_all();
80001572: e8 23 0e 00 00 call 8000239a <close_all>
80001577: 83 c4 10 add $0x10,%esp
8000157a: eb 4c jmp 800015c8 <runcmd+0x3b8>
if (r >= 0) {
if (debug)
cprintf("[%08x] WAIT %s %08x\n", thisenv->env_id, argv[0], r);
8000157c: a1 20 64 00 80 mov 0x80006420,%eax
80001581: 8b 40 48 mov 0x48(%eax),%eax
80001584: 53 push %ebx
80001585: ff 75 a8 pushl -0x58(%ebp)
80001588: 50 push %eax
80001589: 68 b3 42 00 80 push $0x800042b3
8000158e: e8 bc 29 00 00 call 80003f4f <cprintf>
80001593: 83 c4 10 add $0x10,%esp
wait(r);
80001596: 83 ec 0c sub $0xc,%esp
80001599: 53 push %ebx
8000159a: e8 7c 1b 00 00 call 8000311b <wait>
if (debug)
8000159f: 83 c4 10 add $0x10,%esp
800015a2: 83 3d 00 60 00 80 00 cmpl $0x0,0x80006000
800015a9: 0f 84 8c 00 00 00 je 8000163b <runcmd+0x42b>
cprintf("[%08x] wait finished\n", thisenv->env_id);
800015af: a1 20 64 00 80 mov 0x80006420,%eax
800015b4: 8b 40 48 mov 0x48(%eax),%eax
800015b7: 83 ec 08 sub $0x8,%esp
800015ba: 50 push %eax
800015bb: 68 c8 42 00 80 push $0x800042c8
800015c0: e8 8a 29 00 00 call 80003f4f <cprintf>
800015c5: 83 c4 10 add $0x10,%esp
}
// If we were the left-hand part of a pipe,
// wait for the right-hand part to finish.
if (pipe_child) {
800015c8: 85 ff test %edi,%edi
800015ca: 74 51 je 8000161d <runcmd+0x40d>
if (debug)
800015cc: 83 3d 00 60 00 80 00 cmpl $0x0,0x80006000
800015d3: 74 1a je 800015ef <runcmd+0x3df>
cprintf("[%08x] WAIT pipe_child %08x\n", thisenv->env_id, pipe_child);
800015d5: a1 20 64 00 80 mov 0x80006420,%eax
800015da: 8b 40 48 mov 0x48(%eax),%eax
800015dd: 83 ec 04 sub $0x4,%esp
800015e0: 57 push %edi
800015e1: 50 push %eax
800015e2: 68 de 42 00 80 push $0x800042de
800015e7: e8 63 29 00 00 call 80003f4f <cprintf>
800015ec: 83 c4 10 add $0x10,%esp
wait(pipe_child);
800015ef: 83 ec 0c sub $0xc,%esp
800015f2: 57 push %edi
800015f3: e8 23 1b 00 00 call 8000311b <wait>
if (debug)
800015f8: 83 c4 10 add $0x10,%esp
800015fb: 83 3d 00 60 00 80 00 cmpl $0x0,0x80006000
80001602: 74 19 je 8000161d <runcmd+0x40d>
cprintf("[%08x] wait finished\n", thisenv->env_id);
80001604: a1 20 64 00 80 mov 0x80006420,%eax
80001609: 8b 40 48 mov 0x48(%eax),%eax
8000160c: 83 ec 08 sub $0x8,%esp
8000160f: 50 push %eax
80001610: 68 c8 42 00 80 push $0x800042c8
80001615: e8 35 29 00 00 call 80003f4f <cprintf>
8000161a: 83 c4 10 add $0x10,%esp
}
// Done!
exit();
8000161d: e8 2a 21 00 00 call 8000374c <exit>
80001622: eb 1d jmp 80001641 <runcmd+0x431>
if ((r = spawn(argv[0], (const char**) argv)) < 0)
cprintf("spawn %s: %e\n", argv[0], r);
// In the parent, close all file descriptors and wait for the
// spawned command to exit.
close_all();
80001624: e8 71 0d 00 00 call 8000239a <close_all>
if (r >= 0) {
if (debug)
80001629: 83 3d 00 60 00 80 00 cmpl $0x0,0x80006000
80001630: 0f 84 60 ff ff ff je 80001596 <runcmd+0x386>
80001636: e9 41 ff ff ff jmp 8000157c <runcmd+0x36c>
cprintf("[%08x] wait finished\n", thisenv->env_id);
}
// If we were the left-hand part of a pipe,
// wait for the right-hand part to finish.
if (pipe_child) {
8000163b: 85 ff test %edi,%edi
8000163d: 75 b0 jne 800015ef <runcmd+0x3df>
8000163f: eb dc jmp 8000161d <runcmd+0x40d>
cprintf("[%08x] wait finished\n", thisenv->env_id);
}
// Done!
exit();
}
80001641: 8d 65 f4 lea -0xc(%ebp),%esp
80001644: 5b pop %ebx
80001645: 5e pop %esi
80001646: 5f pop %edi
80001647: 5d pop %ebp
80001648: c3 ret
80001649 <usage>:
}
void
usage(void)
{
80001649: 55 push %ebp
8000164a: 89 e5 mov %esp,%ebp
8000164c: 83 ec 14 sub $0x14,%esp
cprintf("usage: sh [-dix] [command-file]\n");
8000164f: 68 f8 43 00 80 push $0x800043f8
80001654: e8 f6 28 00 00 call 80003f4f <cprintf>
exit();
80001659: e8 ee 20 00 00 call 8000374c <exit>
}
8000165e: 83 c4 10 add $0x10,%esp
80001661: c9 leave
80001662: c3 ret
80001663 <umain>:
void
umain(int argc, char **argv)
{
80001663: 55 push %ebp
80001664: 89 e5 mov %esp,%ebp
80001666: 57 push %edi
80001667: 56 push %esi
80001668: 53 push %ebx
80001669: 83 ec 38 sub $0x38,%esp
int interactive, echocmds;
struct Argstate args;
int r;
cprintf("initsh: running sh\n");
8000166c: 68 fb 42 00 80 push $0x800042fb
80001671: e8 d9 28 00 00 call 80003f4f <cprintf>
// being run directly from kernel, so no file descriptors open yet
close(0);
80001676: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8000167d: e8 ed 0c 00 00 call 8000236f <close>
if ((r = opencons()) < 0)
80001682: e8 ad 0a 00 00 call 80002134 <opencons>
80001687: 83 c4 10 add $0x10,%esp
8000168a: 85 c0 test %eax,%eax
8000168c: 79 15 jns 800016a3 <umain+0x40>
panic("opencons: %e", r);
8000168e: 50 push %eax
8000168f: 68 0f 43 00 80 push $0x8000430f
80001694: 68 19 01 00 00 push $0x119
80001699: 68 7f 42 00 80 push $0x8000427f
8000169e: e8 d4 2a 00 00 call 80004177 <_panic>
if (r != 0)
800016a3: 85 c0 test %eax,%eax
800016a5: 74 15 je 800016bc <umain+0x59>
panic("first opencons used fd %d", r);
800016a7: 50 push %eax
800016a8: 68 1c 43 00 80 push $0x8000431c
800016ad: 68 1b 01 00 00 push $0x11b
800016b2: 68 7f 42 00 80 push $0x8000427f
800016b7: e8 bb 2a 00 00 call 80004177 <_panic>
if ((r = dup(0, 1)) < 0)
800016bc: 83 ec 08 sub $0x8,%esp
800016bf: 6a 01 push $0x1
800016c1: 6a 00 push $0x0
800016c3: e8 f7 0c 00 00 call 800023bf <dup>
800016c8: 83 c4 10 add $0x10,%esp
800016cb: 85 c0 test %eax,%eax
800016cd: 79 15 jns 800016e4 <umain+0x81>
panic("dup: %e", r);
800016cf: 50 push %eax
800016d0: 68 36 43 00 80 push $0x80004336
800016d5: 68 1d 01 00 00 push $0x11d
800016da: 68 7f 42 00 80 push $0x8000427f
800016df: e8 93 2a 00 00 call 80004177 <_panic>
cprintf("init: starting sh\n");
800016e4: 83 ec 0c sub $0xc,%esp
800016e7: 68 3e 43 00 80 push $0x8000433e
800016ec: e8 5e 28 00 00 call 80003f4f <cprintf>
cprintf("sh begin!\n");
800016f1: c7 04 24 51 43 00 80 movl $0x80004351,(%esp)
800016f8: e8 52 28 00 00 call 80003f4f <cprintf>
interactive = '?';
echocmds = 0;
argstart(&argc, argv, &args);
800016fd: 83 c4 0c add $0xc,%esp
80001700: 8d 45 d8 lea -0x28(%ebp),%eax
80001703: 50 push %eax
80001704: ff 75 0c pushl 0xc(%ebp)
80001707: 8d 45 08 lea 0x8(%ebp),%eax
8000170a: 50 push %eax
8000170b: e8 91 20 00 00 call 800037a1 <argstart>
while ((r = argnext(&args)) >= 0)
80001710: 83 c4 10 add $0x10,%esp
cprintf("init: starting sh\n");
cprintf("sh begin!\n");
interactive = '?';
echocmds = 0;
80001713: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
panic("dup: %e", r);
cprintf("init: starting sh\n");
cprintf("sh begin!\n");
interactive = '?';
8000171a: be 3f 00 00 00 mov $0x3f,%esi
echocmds = 0;
argstart(&argc, argv, &args);
while ((r = argnext(&args)) >= 0)
8000171f: 8d 5d d8 lea -0x28(%ebp),%ebx
80001722: eb 2f jmp 80001753 <umain+0xf0>
switch (r) {
80001724: 83 f8 69 cmp $0x69,%eax
80001727: 74 25 je 8000174e <umain+0xeb>
80001729: 83 f8 78 cmp $0x78,%eax
8000172c: 74 07 je 80001735 <umain+0xd2>
8000172e: 83 f8 64 cmp $0x64,%eax
80001731: 75 14 jne 80001747 <umain+0xe4>
80001733: eb 09 jmp 8000173e <umain+0xdb>
break;
case 'i':
interactive = 1;
break;
case 'x':
echocmds = 1;
80001735: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%ebp)
8000173c: eb 15 jmp 80001753 <umain+0xf0>
echocmds = 0;
argstart(&argc, argv, &args);
while ((r = argnext(&args)) >= 0)
switch (r) {
case 'd':
debug++;
8000173e: 83 05 00 60 00 80 01 addl $0x1,0x80006000
break;
80001745: eb 0c jmp 80001753 <umain+0xf0>
break;
case 'x':
echocmds = 1;
break;
default:
usage();
80001747: e8 fd fe ff ff call 80001649 <usage>
8000174c: eb 05 jmp 80001753 <umain+0xf0>
switch (r) {
case 'd':
debug++;
break;
case 'i':
interactive = 1;
8000174e: be 01 00 00 00 mov $0x1,%esi
cprintf("sh begin!\n");
interactive = '?';
echocmds = 0;
argstart(&argc, argv, &args);
while ((r = argnext(&args)) >= 0)
80001753: 83 ec 0c sub $0xc,%esp
80001756: 53 push %ebx
80001757: e8 75 20 00 00 call 800037d1 <argnext>
8000175c: 83 c4 10 add $0x10,%esp
8000175f: 85 c0 test %eax,%eax
80001761: 79 c1 jns 80001724 <umain+0xc1>
break;
default:
usage();
}
if (argc > 2)
80001763: 83 7d 08 02 cmpl $0x2,0x8(%ebp)
80001767: 7e 05 jle 8000176e <umain+0x10b>
usage();
80001769: e8 db fe ff ff call 80001649 <usage>
if (argc == 2) {
8000176e: 83 7d 08 02 cmpl $0x2,0x8(%ebp)
80001772: 75 3f jne 800017b3 <umain+0x150>
close(0);
80001774: 83 ec 0c sub $0xc,%esp
80001777: 6a 00 push $0x0
80001779: e8 f1 0b 00 00 call 8000236f <close>
if ((r = open(argv[1], O_RDONLY)) < 0)
8000177e: 83 c4 08 add $0x8,%esp
80001781: 6a 00 push $0x0
80001783: 8b 45 0c mov 0xc(%ebp),%eax
80001786: ff 70 04 pushl 0x4(%eax)
80001789: e8 6b 11 00 00 call 800028f9 <open>
8000178e: 83 c4 10 add $0x10,%esp
80001791: 85 c0 test %eax,%eax
80001793: 79 1e jns 800017b3 <umain+0x150>
panic("open %s: %e", argv[1], r);
80001795: 83 ec 0c sub $0xc,%esp
80001798: 50 push %eax
80001799: 8b 45 0c mov 0xc(%ebp),%eax
8000179c: ff 70 04 pushl 0x4(%eax)
8000179f: 68 5c 43 00 80 push $0x8000435c
800017a4: 68 39 01 00 00 push $0x139
800017a9: 68 7f 42 00 80 push $0x8000427f
800017ae: e8 c4 29 00 00 call 80004177 <_panic>
}
if (interactive == '?')
800017b3: 83 fe 3f cmp $0x3f,%esi
800017b6: 75 0f jne 800017c7 <umain+0x164>
interactive = iscons(0);
800017b8: 83 ec 0c sub $0xc,%esp
800017bb: 6a 00 push $0x0
800017bd: e8 46 09 00 00 call 80002108 <iscons>
800017c2: 89 c6 mov %eax,%esi
800017c4: 83 c4 10 add $0x10,%esp
cprintf("sh work!\n");
800017c7: 83 ec 0c sub $0xc,%esp
800017ca: 68 68 43 00 80 push $0x80004368
800017cf: e8 7b 27 00 00 call 80003f4f <cprintf>
800017d4: 83 c4 10 add $0x10,%esp
800017d7: 85 f6 test %esi,%esi
800017d9: b8 00 00 00 00 mov $0x0,%eax
800017de: bf 72 43 00 80 mov $0x80004372,%edi
800017e3: 0f 44 f8 cmove %eax,%edi
while (1) {
char *buf;
buf = readline(interactive ? "$ " : NULL);
800017e6: 83 ec 0c sub $0xc,%esp
800017e9: 57 push %edi
800017ea: e8 95 28 00 00 call 80004084 <readline>
800017ef: 89 c3 mov %eax,%ebx
if (buf == NULL) {
800017f1: 83 c4 10 add $0x10,%esp
800017f4: 85 c0 test %eax,%eax
800017f6: 75 1e jne 80001816 <umain+0x1b3>
if (debug)
800017f8: 83 3d 00 60 00 80 00 cmpl $0x0,0x80006000
800017ff: 74 10 je 80001811 <umain+0x1ae>
cprintf("EXITING\n");
80001801: 83 ec 0c sub $0xc,%esp
80001804: 68 75 43 00 80 push $0x80004375
80001809: e8 41 27 00 00 call 80003f4f <cprintf>
8000180e: 83 c4 10 add $0x10,%esp
exit(); // end of file
80001811: e8 36 1f 00 00 call 8000374c <exit>
}
if (debug)
80001816: 83 3d 00 60 00 80 00 cmpl $0x0,0x80006000
8000181d: 74 11 je 80001830 <umain+0x1cd>
cprintf("LINE: %s\n", buf);
8000181f: 83 ec 08 sub $0x8,%esp
80001822: 53 push %ebx
80001823: 68 7e 43 00 80 push $0x8000437e
80001828: e8 22 27 00 00 call 80003f4f <cprintf>
8000182d: 83 c4 10 add $0x10,%esp
if (buf[0] == '#')
80001830: 80 3b 23 cmpb $0x23,(%ebx)
80001833: 74 b1 je 800017e6 <umain+0x183>
continue;
if (echocmds)
80001835: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
80001839: 74 11 je 8000184c <umain+0x1e9>
printf("# %s\n", buf);
8000183b: 83 ec 08 sub $0x8,%esp
8000183e: 53 push %ebx
8000183f: 68 88 43 00 80 push $0x80004388
80001844: e8 a0 27 00 00 call 80003fe9 <printf>
80001849: 83 c4 10 add $0x10,%esp
if (debug)
8000184c: 83 3d 00 60 00 80 00 cmpl $0x0,0x80006000
80001853: 74 10 je 80001865 <umain+0x202>
cprintf("BEFORE FORK\n");
80001855: 83 ec 0c sub $0xc,%esp
80001858: 68 8e 43 00 80 push $0x8000438e
8000185d: e8 ed 26 00 00 call 80003f4f <cprintf>
80001862: 83 c4 10 add $0x10,%esp
if ((r = fork()) < 0)
80001865: e8 9b 16 00 00 call 80002f05 <fork>
8000186a: 89 c6 mov %eax,%esi
8000186c: 85 c0 test %eax,%eax
8000186e: 79 15 jns 80001885 <umain+0x222>
panic("fork: %e", r);
80001870: 50 push %eax
80001871: 68 5a 42 00 80 push $0x8000425a
80001876: 68 51 01 00 00 push $0x151
8000187b: 68 7f 42 00 80 push $0x8000427f
80001880: e8 f2 28 00 00 call 80004177 <_panic>
if (debug)
80001885: 83 3d 00 60 00 80 00 cmpl $0x0,0x80006000
8000188c: 74 11 je 8000189f <umain+0x23c>
cprintf("FORK: %d\n", r);
8000188e: 83 ec 08 sub $0x8,%esp
80001891: 50 push %eax
80001892: 68 9b 43 00 80 push $0x8000439b
80001897: e8 b3 26 00 00 call 80003f4f <cprintf>
8000189c: 83 c4 10 add $0x10,%esp
if (r == 0) {
8000189f: 85 f6 test %esi,%esi
800018a1: 75 16 jne 800018b9 <umain+0x256>
runcmd(buf);
800018a3: 83 ec 0c sub $0xc,%esp
800018a6: 53 push %ebx
800018a7: e8 64 f9 ff ff call 80001210 <runcmd>
exit();
800018ac: e8 9b 1e 00 00 call 8000374c <exit>
800018b1: 83 c4 10 add $0x10,%esp
800018b4: e9 2d ff ff ff jmp 800017e6 <umain+0x183>
} else
wait(r);
800018b9: 83 ec 0c sub $0xc,%esp
800018bc: 56 push %esi
800018bd: e8 59 18 00 00 call 8000311b <wait>
800018c2: 83 c4 10 add $0x10,%esp
800018c5: e9 1c ff ff ff jmp 800017e6 <umain+0x183>
800018ca <strlen>:
#include <x86.h>
#define ASM 1
int
strlen(const char *s)
{
800018ca: 55 push %ebp
800018cb: 89 e5 mov %esp,%ebp
800018cd: 8b 55 08 mov 0x8(%ebp),%edx
int n;
for (n = 0; *s != '\0'; s++)
800018d0: 80 3a 00 cmpb $0x0,(%edx)
800018d3: 74 10 je 800018e5 <strlen+0x1b>
800018d5: b8 00 00 00 00 mov $0x0,%eax
n++;
800018da: 83 c0 01 add $0x1,%eax
int
strlen(const char *s)
{
int n;
for (n = 0; *s != '\0'; s++)
800018dd: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
800018e1: 75 f7 jne 800018da <strlen+0x10>
800018e3: eb 05 jmp 800018ea <strlen+0x20>
800018e5: b8 00 00 00 00 mov $0x0,%eax
n++;
return n;
}
800018ea: 5d pop %ebp
800018eb: c3 ret
800018ec <strnlen>:
int
strnlen(const char *s, size_t size)
{
800018ec: 55 push %ebp
800018ed: 89 e5 mov %esp,%ebp
800018ef: 53 push %ebx
800018f0: 8b 5d 08 mov 0x8(%ebp),%ebx
800018f3: 8b 4d 0c mov 0xc(%ebp),%ecx
int n;
for (n = 0; size > 0 && *s != '\0'; s++, size--)
800018f6: 85 c9 test %ecx,%ecx
800018f8: 74 1c je 80001916 <strnlen+0x2a>
800018fa: 80 3b 00 cmpb $0x0,(%ebx)
800018fd: 74 1e je 8000191d <strnlen+0x31>
800018ff: ba 01 00 00 00 mov $0x1,%edx
n++;
80001904: 89 d0 mov %edx,%eax
int
strnlen(const char *s, size_t size)
{
int n;
for (n = 0; size > 0 && *s != '\0'; s++, size--)
80001906: 39 ca cmp %ecx,%edx
80001908: 74 18 je 80001922 <strnlen+0x36>
8000190a: 83 c2 01 add $0x1,%edx
8000190d: 80 7c 13 ff 00 cmpb $0x0,-0x1(%ebx,%edx,1)
80001912: 75 f0 jne 80001904 <strnlen+0x18>
80001914: eb 0c jmp 80001922 <strnlen+0x36>
80001916: b8 00 00 00 00 mov $0x0,%eax
8000191b: eb 05 jmp 80001922 <strnlen+0x36>
8000191d: b8 00 00 00 00 mov $0x0,%eax
n++;
return n;
}
80001922: 5b pop %ebx
80001923: 5d pop %ebp
80001924: c3 ret
80001925 <strcpy>:
char *
strcpy(char *dst, const char *src)
{
80001925: 55 push %ebp
80001926: 89 e5 mov %esp,%ebp
80001928: 53 push %ebx
80001929: 8b 45 08 mov 0x8(%ebp),%eax
8000192c: 8b 4d 0c mov 0xc(%ebp),%ecx
char *ret;
ret = dst;
while ((*dst++ = *src++) != '\0')
8000192f: 89 c2 mov %eax,%edx
80001931: 83 c2 01 add $0x1,%edx
80001934: 83 c1 01 add $0x1,%ecx
80001937: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
8000193b: 88 5a ff mov %bl,-0x1(%edx)
8000193e: 84 db test %bl,%bl
80001940: 75 ef jne 80001931 <strcpy+0xc>
/* do nothing */;
return ret;
}
80001942: 5b pop %ebx
80001943: 5d pop %ebp
80001944: c3 ret
80001945 <strcat>:
char *
strcat(char *dst, const char *src)
{
80001945: 55 push %ebp
80001946: 89 e5 mov %esp,%ebp
80001948: 53 push %ebx
80001949: 8b 5d 08 mov 0x8(%ebp),%ebx
int len = strlen(dst);
8000194c: 53 push %ebx
8000194d: e8 78 ff ff ff call 800018ca <strlen>
80001952: 83 c4 04 add $0x4,%esp
strcpy(dst + len, src);
80001955: ff 75 0c pushl 0xc(%ebp)
80001958: 01 d8 add %ebx,%eax
8000195a: 50 push %eax
8000195b: e8 c5 ff ff ff call 80001925 <strcpy>
return dst;
}
80001960: 89 d8 mov %ebx,%eax
80001962: 8b 5d fc mov -0x4(%ebp),%ebx
80001965: c9 leave
80001966: c3 ret
80001967 <strncpy>:
char *
strncpy(char *dst, const char *src, size_t size) {
80001967: 55 push %ebp
80001968: 89 e5 mov %esp,%ebp
8000196a: 56 push %esi
8000196b: 53 push %ebx
8000196c: 8b 75 08 mov 0x8(%ebp),%esi
8000196f: 8b 55 0c mov 0xc(%ebp),%edx
80001972: 8b 5d 10 mov 0x10(%ebp),%ebx
size_t i;
char *ret;
ret = dst;
for (i = 0; i < size; i++) {
80001975: 85 db test %ebx,%ebx
80001977: 74 17 je 80001990 <strncpy+0x29>
80001979: 01 f3 add %esi,%ebx
8000197b: 89 f1 mov %esi,%ecx
*dst++ = *src;
8000197d: 83 c1 01 add $0x1,%ecx
80001980: 0f b6 02 movzbl (%edx),%eax
80001983: 88 41 ff mov %al,-0x1(%ecx)
// If strlen(src) < size, null-pad 'dst' out to 'size' chars
if (*src != '\0')
src++;
80001986: 80 3a 01 cmpb $0x1,(%edx)
80001989: 83 da ff sbb $0xffffffff,%edx
strncpy(char *dst, const char *src, size_t size) {
size_t i;
char *ret;
ret = dst;
for (i = 0; i < size; i++) {
8000198c: 39 cb cmp %ecx,%ebx
8000198e: 75 ed jne 8000197d <strncpy+0x16>
// If strlen(src) < size, null-pad 'dst' out to 'size' chars
if (*src != '\0')
src++;
}
return ret;
}
80001990: 89 f0 mov %esi,%eax
80001992: 5b pop %ebx
80001993: 5e pop %esi
80001994: 5d pop %ebp
80001995: c3 ret
80001996 <strlcpy>:
size_t
strlcpy(char *dst, const char *src, size_t size)
{
80001996: 55 push %ebp
80001997: 89 e5 mov %esp,%ebp
80001999: 56 push %esi
8000199a: 53 push %ebx
8000199b: 8b 75 08 mov 0x8(%ebp),%esi
8000199e: 8b 5d 0c mov 0xc(%ebp),%ebx
800019a1: 8b 55 10 mov 0x10(%ebp),%edx
800019a4: 89 f0 mov %esi,%eax
char *dst_in;
dst_in = dst;
if (size > 0) {
800019a6: 85 d2 test %edx,%edx
800019a8: 74 35 je 800019df <strlcpy+0x49>
while (--size > 0 && *src != '\0')
800019aa: 89 d0 mov %edx,%eax
800019ac: 83 e8 01 sub $0x1,%eax
800019af: 74 25 je 800019d6 <strlcpy+0x40>
800019b1: 0f b6 0b movzbl (%ebx),%ecx
800019b4: 84 c9 test %cl,%cl
800019b6: 74 22 je 800019da <strlcpy+0x44>
800019b8: 8d 53 01 lea 0x1(%ebx),%edx
800019bb: 01 c3 add %eax,%ebx
800019bd: 89 f0 mov %esi,%eax
*dst++ = *src++;
800019bf: 83 c0 01 add $0x1,%eax
800019c2: 88 48 ff mov %cl,-0x1(%eax)
{
char *dst_in;
dst_in = dst;
if (size > 0) {
while (--size > 0 && *src != '\0')
800019c5: 39 da cmp %ebx,%edx
800019c7: 74 13 je 800019dc <strlcpy+0x46>
800019c9: 83 c2 01 add $0x1,%edx
800019cc: 0f b6 4a ff movzbl -0x1(%edx),%ecx
800019d0: 84 c9 test %cl,%cl
800019d2: 75 eb jne 800019bf <strlcpy+0x29>
800019d4: eb 06 jmp 800019dc <strlcpy+0x46>
800019d6: 89 f0 mov %esi,%eax
800019d8: eb 02 jmp 800019dc <strlcpy+0x46>
800019da: 89 f0 mov %esi,%eax
*dst++ = *src++;
*dst = '\0';
800019dc: c6 00 00 movb $0x0,(%eax)
}
return dst - dst_in;
800019df: 29 f0 sub %esi,%eax
}
800019e1: 5b pop %ebx
800019e2: 5e pop %esi
800019e3: 5d pop %ebp
800019e4: c3 ret
800019e5 <strcmp>:
int
strcmp(const char *p, const char *q)
{
800019e5: 55 push %ebp
800019e6: 89 e5 mov %esp,%ebp
800019e8: 8b 4d 08 mov 0x8(%ebp),%ecx
800019eb: 8b 55 0c mov 0xc(%ebp),%edx
while (*p && *p == *q)
800019ee: 0f b6 01 movzbl (%ecx),%eax
800019f1: 84 c0 test %al,%al
800019f3: 74 15 je 80001a0a <strcmp+0x25>
800019f5: 3a 02 cmp (%edx),%al
800019f7: 75 11 jne 80001a0a <strcmp+0x25>
p++, q++;
800019f9: 83 c1 01 add $0x1,%ecx
800019fc: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while (*p && *p == *q)
800019ff: 0f b6 01 movzbl (%ecx),%eax
80001a02: 84 c0 test %al,%al
80001a04: 74 04 je 80001a0a <strcmp+0x25>
80001a06: 3a 02 cmp (%edx),%al
80001a08: 74 ef je 800019f9 <strcmp+0x14>
p++, q++;
return (int) ((unsigned char) *p - (unsigned char) *q);
80001a0a: 0f b6 c0 movzbl %al,%eax
80001a0d: 0f b6 12 movzbl (%edx),%edx
80001a10: 29 d0 sub %edx,%eax
}
80001a12: 5d pop %ebp
80001a13: c3 ret
80001a14 <strncmp>:
int
strncmp(const char *p, const char *q, size_t n)
{
80001a14: 55 push %ebp
80001a15: 89 e5 mov %esp,%ebp
80001a17: 56 push %esi
80001a18: 53 push %ebx
80001a19: 8b 5d 08 mov 0x8(%ebp),%ebx
80001a1c: 8b 55 0c mov 0xc(%ebp),%edx
80001a1f: 8b 75 10 mov 0x10(%ebp),%esi
while (n > 0 && *p && *p == *q)
80001a22: 85 f6 test %esi,%esi
80001a24: 74 29 je 80001a4f <strncmp+0x3b>
80001a26: 0f b6 03 movzbl (%ebx),%eax
80001a29: 84 c0 test %al,%al
80001a2b: 74 30 je 80001a5d <strncmp+0x49>
80001a2d: 3a 02 cmp (%edx),%al
80001a2f: 75 2c jne 80001a5d <strncmp+0x49>
80001a31: 8d 43 01 lea 0x1(%ebx),%eax
80001a34: 01 de add %ebx,%esi
n--, p++, q++;
80001a36: 89 c3 mov %eax,%ebx
80001a38: 83 c2 01 add $0x1,%edx
}
int
strncmp(const char *p, const char *q, size_t n)
{
while (n > 0 && *p && *p == *q)
80001a3b: 39 c6 cmp %eax,%esi
80001a3d: 74 17 je 80001a56 <strncmp+0x42>
80001a3f: 0f b6 08 movzbl (%eax),%ecx
80001a42: 84 c9 test %cl,%cl
80001a44: 74 17 je 80001a5d <strncmp+0x49>
80001a46: 83 c0 01 add $0x1,%eax
80001a49: 3a 0a cmp (%edx),%cl
80001a4b: 74 e9 je 80001a36 <strncmp+0x22>
80001a4d: eb 0e jmp 80001a5d <strncmp+0x49>
n--, p++, q++;
if (n == 0)
return 0;
80001a4f: b8 00 00 00 00 mov $0x0,%eax
80001a54: eb 0f jmp 80001a65 <strncmp+0x51>
80001a56: b8 00 00 00 00 mov $0x0,%eax
80001a5b: eb 08 jmp 80001a65 <strncmp+0x51>
else
return (int) ((unsigned char) *p - (unsigned char) *q);
80001a5d: 0f b6 03 movzbl (%ebx),%eax
80001a60: 0f b6 12 movzbl (%edx),%edx
80001a63: 29 d0 sub %edx,%eax
}
80001a65: 5b pop %ebx
80001a66: 5e pop %esi
80001a67: 5d pop %ebp
80001a68: c3 ret
80001a69 <strchr>:
// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
80001a69: 55 push %ebp
80001a6a: 89 e5 mov %esp,%ebp
80001a6c: 53 push %ebx
80001a6d: 8b 45 08 mov 0x8(%ebp),%eax
80001a70: 8b 5d 0c mov 0xc(%ebp),%ebx
for (; *s; s++)
80001a73: 0f b6 10 movzbl (%eax),%edx
80001a76: 84 d2 test %dl,%dl
80001a78: 74 1d je 80001a97 <strchr+0x2e>
80001a7a: 89 d9 mov %ebx,%ecx
if (*s == c)
80001a7c: 38 d3 cmp %dl,%bl
80001a7e: 75 06 jne 80001a86 <strchr+0x1d>
80001a80: eb 1a jmp 80001a9c <strchr+0x33>
80001a82: 38 ca cmp %cl,%dl
80001a84: 74 16 je 80001a9c <strchr+0x33>
// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
for (; *s; s++)
80001a86: 83 c0 01 add $0x1,%eax
80001a89: 0f b6 10 movzbl (%eax),%edx
80001a8c: 84 d2 test %dl,%dl
80001a8e: 75 f2 jne 80001a82 <strchr+0x19>
if (*s == c)
return (char *) s;
return 0;
80001a90: b8 00 00 00 00 mov $0x0,%eax
80001a95: eb 05 jmp 80001a9c <strchr+0x33>
80001a97: b8 00 00 00 00 mov $0x0,%eax
}
80001a9c: 5b pop %ebx
80001a9d: 5d pop %ebp
80001a9e: c3 ret
80001a9f <strfind>:
// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
80001a9f: 55 push %ebp
80001aa0: 89 e5 mov %esp,%ebp
80001aa2: 53 push %ebx
80001aa3: 8b 45 08 mov 0x8(%ebp),%eax
80001aa6: 8b 55 0c mov 0xc(%ebp),%edx
for (; *s; s++)
80001aa9: 0f b6 18 movzbl (%eax),%ebx
if (*s == c)
80001aac: 38 d3 cmp %dl,%bl
80001aae: 74 14 je 80001ac4 <strfind+0x25>
80001ab0: 89 d1 mov %edx,%ecx
80001ab2: 84 db test %bl,%bl
80001ab4: 74 0e je 80001ac4 <strfind+0x25>
// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
for (; *s; s++)
80001ab6: 83 c0 01 add $0x1,%eax
80001ab9: 0f b6 10 movzbl (%eax),%edx
if (*s == c)
80001abc: 38 ca cmp %cl,%dl
80001abe: 74 04 je 80001ac4 <strfind+0x25>
80001ac0: 84 d2 test %dl,%dl
80001ac2: 75 f2 jne 80001ab6 <strfind+0x17>
break;
return (char *) s;
}
80001ac4: 5b pop %ebx
80001ac5: 5d pop %ebp
80001ac6: c3 ret
80001ac7 <memset>:
#if ASM
void *
memset(void *v, int c, size_t n)
{
80001ac7: 55 push %ebp
80001ac8: 89 e5 mov %esp,%ebp
80001aca: 57 push %edi
80001acb: 56 push %esi
80001acc: 53 push %ebx
80001acd: 8b 7d 08 mov 0x8(%ebp),%edi
80001ad0: 8b 4d 10 mov 0x10(%ebp),%ecx
if (n == 0)
80001ad3: 85 c9 test %ecx,%ecx
80001ad5: 74 36 je 80001b0d <memset+0x46>
return v;
if ((int)v%4 == 0 && n%4 == 0) {
80001ad7: f7 c7 03 00 00 00 test $0x3,%edi
80001add: 75 28 jne 80001b07 <memset+0x40>
80001adf: f6 c1 03 test $0x3,%cl
80001ae2: 75 23 jne 80001b07 <memset+0x40>
c &= 0xFF;
80001ae4: 0f b6 55 0c movzbl 0xc(%ebp),%edx
c = (c<<24)|(c<<16)|(c<<8)|c;
80001ae8: 89 d3 mov %edx,%ebx
80001aea: c1 e3 08 shl $0x8,%ebx
80001aed: 89 d6 mov %edx,%esi
80001aef: c1 e6 18 shl $0x18,%esi
80001af2: 89 d0 mov %edx,%eax
80001af4: c1 e0 10 shl $0x10,%eax
80001af7: 09 f0 or %esi,%eax
80001af9: 09 c2 or %eax,%edx
asm volatile("cld; rep stosl\n"
80001afb: 89 d8 mov %ebx,%eax
80001afd: 09 d0 or %edx,%eax
80001aff: c1 e9 02 shr $0x2,%ecx
80001b02: fc cld
80001b03: f3 ab rep stos %eax,%es:(%edi)
80001b05: eb 06 jmp 80001b0d <memset+0x46>
:: "D" (v), "a" (c), "c" (n/4)
: "cc", "memory");
} else
asm volatile("cld; rep stosb\n"
80001b07: 8b 45 0c mov 0xc(%ebp),%eax
80001b0a: fc cld
80001b0b: f3 aa rep stos %al,%es:(%edi)
:: "D" (v), "a" (c), "c" (n)
: "cc", "memory");
return v;
}
80001b0d: 89 f8 mov %edi,%eax
80001b0f: 5b pop %ebx
80001b10: 5e pop %esi
80001b11: 5f pop %edi
80001b12: 5d pop %ebp
80001b13: c3 ret
80001b14 <memmove>:
void *
memmove(void *dst, const void *src, size_t n)
{
80001b14: 55 push %ebp
80001b15: 89 e5 mov %esp,%ebp
80001b17: 57 push %edi
80001b18: 56 push %esi
80001b19: 8b 45 08 mov 0x8(%ebp),%eax
80001b1c: 8b 75 0c mov 0xc(%ebp),%esi
80001b1f: 8b 4d 10 mov 0x10(%ebp),%ecx
const char *s;
char *d;
s = src;
d = dst;
if (s < d && s + n > d) {
80001b22: 39 c6 cmp %eax,%esi
80001b24: 73 35 jae 80001b5b <memmove+0x47>
80001b26: 8d 14 0e lea (%esi,%ecx,1),%edx
80001b29: 39 d0 cmp %edx,%eax
80001b2b: 73 2e jae 80001b5b <memmove+0x47>
s += n;
d += n;
80001b2d: 8d 3c 08 lea (%eax,%ecx,1),%edi
if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
80001b30: 89 d6 mov %edx,%esi
80001b32: 09 fe or %edi,%esi
80001b34: f7 c6 03 00 00 00 test $0x3,%esi
80001b3a: 75 13 jne 80001b4f <memmove+0x3b>
80001b3c: f6 c1 03 test $0x3,%cl
80001b3f: 75 0e jne 80001b4f <memmove+0x3b>
asm volatile("std; rep movsl\n"
80001b41: 83 ef 04 sub $0x4,%edi
80001b44: 8d 72 fc lea -0x4(%edx),%esi
80001b47: c1 e9 02 shr $0x2,%ecx
80001b4a: fd std
80001b4b: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
80001b4d: eb 09 jmp 80001b58 <memmove+0x44>
:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
else
asm volatile("std; rep movsb\n"
80001b4f: 83 ef 01 sub $0x1,%edi
80001b52: 8d 72 ff lea -0x1(%edx),%esi
80001b55: fd std
80001b56: f3 a4 rep movsb %ds:(%esi),%es:(%edi)
:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
// Some versions of GCC rely on DF being clear
asm volatile("cld" ::: "cc");
80001b58: fc cld
80001b59: eb 1d jmp 80001b78 <memmove+0x64>
} else {
if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
80001b5b: 89 f2 mov %esi,%edx
80001b5d: 09 c2 or %eax,%edx
80001b5f: f6 c2 03 test $0x3,%dl
80001b62: 75 0f jne 80001b73 <memmove+0x5f>
80001b64: f6 c1 03 test $0x3,%cl
80001b67: 75 0a jne 80001b73 <memmove+0x5f>
asm volatile("cld; rep movsl\n"
80001b69: c1 e9 02 shr $0x2,%ecx
80001b6c: 89 c7 mov %eax,%edi
80001b6e: fc cld
80001b6f: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
80001b71: eb 05 jmp 80001b78 <memmove+0x64>
:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
else
asm volatile("cld; rep movsb\n"
80001b73: 89 c7 mov %eax,%edi
80001b75: fc cld
80001b76: f3 a4 rep movsb %ds:(%esi),%es:(%edi)
:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
}
return dst;
}
80001b78: 5e pop %esi
80001b79: 5f pop %edi
80001b7a: 5d pop %ebp
80001b7b: c3 ret
80001b7c <memcpy>:
}
#endif
void *
memcpy(void *dst, const void *src, size_t n)
{
80001b7c: 55 push %ebp
80001b7d: 89 e5 mov %esp,%ebp
return memmove(dst, src, n);
80001b7f: ff 75 10 pushl 0x10(%ebp)
80001b82: ff 75 0c pushl 0xc(%ebp)
80001b85: ff 75 08 pushl 0x8(%ebp)
80001b88: e8 87 ff ff ff call 80001b14 <memmove>
}
80001b8d: c9 leave
80001b8e: c3 ret
80001b8f <memcmp>:
int
memcmp(const void *v1, const void *v2, size_t n)
{
80001b8f: 55 push %ebp
80001b90: 89 e5 mov %esp,%ebp
80001b92: 57 push %edi
80001b93: 56 push %esi
80001b94: 53 push %ebx
80001b95: 8b 5d 08 mov 0x8(%ebp),%ebx
80001b98: 8b 75 0c mov 0xc(%ebp),%esi
80001b9b: 8b 45 10 mov 0x10(%ebp),%eax
const uint8_t *s1 = (const uint8_t *) v1;
const uint8_t *s2 = (const uint8_t *) v2;
while (n-- > 0) {
80001b9e: 85 c0 test %eax,%eax
80001ba0: 74 39 je 80001bdb <memcmp+0x4c>
80001ba2: 8d 78 ff lea -0x1(%eax),%edi
if (*s1 != *s2)
80001ba5: 0f b6 13 movzbl (%ebx),%edx
80001ba8: 0f b6 0e movzbl (%esi),%ecx
80001bab: 38 ca cmp %cl,%dl
80001bad: 75 17 jne 80001bc6 <memcmp+0x37>
80001baf: b8 00 00 00 00 mov $0x0,%eax
80001bb4: eb 1a jmp 80001bd0 <memcmp+0x41>
80001bb6: 0f b6 54 03 01 movzbl 0x1(%ebx,%eax,1),%edx
80001bbb: 83 c0 01 add $0x1,%eax
80001bbe: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx
80001bc2: 38 ca cmp %cl,%dl
80001bc4: 74 0a je 80001bd0 <memcmp+0x41>
return (int) *s1 - (int) *s2;
80001bc6: 0f b6 c2 movzbl %dl,%eax
80001bc9: 0f b6 c9 movzbl %cl,%ecx
80001bcc: 29 c8 sub %ecx,%eax
80001bce: eb 10 jmp 80001be0 <memcmp+0x51>
memcmp(const void *v1, const void *v2, size_t n)
{
const uint8_t *s1 = (const uint8_t *) v1;
const uint8_t *s2 = (const uint8_t *) v2;
while (n-- > 0) {
80001bd0: 39 f8 cmp %edi,%eax
80001bd2: 75 e2 jne 80001bb6 <memcmp+0x27>
if (*s1 != *s2)
return (int) *s1 - (int) *s2;
s1++, s2++;
}
return 0;
80001bd4: b8 00 00 00 00 mov $0x0,%eax
80001bd9: eb 05 jmp 80001be0 <memcmp+0x51>
80001bdb: b8 00 00 00 00 mov $0x0,%eax
}
80001be0: 5b pop %ebx
80001be1: 5e pop %esi
80001be2: 5f pop %edi
80001be3: 5d pop %ebp
80001be4: c3 ret
80001be5 <memfind>:
void *
memfind(const void *s, int c, size_t n)
{
80001be5: 55 push %ebp
80001be6: 89 e5 mov %esp,%ebp
80001be8: 53 push %ebx
80001be9: 8b 55 08 mov 0x8(%ebp),%edx
const void *ends = (const char *) s + n;
80001bec: 89 d0 mov %edx,%eax
80001bee: 03 45 10 add 0x10(%ebp),%eax
for (; s < ends; s++)
80001bf1: 39 c2 cmp %eax,%edx
80001bf3: 73 1d jae 80001c12 <memfind+0x2d>
if (*(const unsigned char *) s == (unsigned char) c)
80001bf5: 0f b6 5d 0c movzbl 0xc(%ebp),%ebx
80001bf9: 0f b6 0a movzbl (%edx),%ecx
80001bfc: 39 d9 cmp %ebx,%ecx
80001bfe: 75 09 jne 80001c09 <memfind+0x24>
80001c00: eb 14 jmp 80001c16 <memfind+0x31>
80001c02: 0f b6 0a movzbl (%edx),%ecx
80001c05: 39 d9 cmp %ebx,%ecx
80001c07: 74 11 je 80001c1a <memfind+0x35>
void *
memfind(const void *s, int c, size_t n)
{
const void *ends = (const char *) s + n;
for (; s < ends; s++)
80001c09: 83 c2 01 add $0x1,%edx
80001c0c: 39 d0 cmp %edx,%eax
80001c0e: 75 f2 jne 80001c02 <memfind+0x1d>
80001c10: eb 0a jmp 80001c1c <memfind+0x37>
80001c12: 89 d0 mov %edx,%eax
80001c14: eb 06 jmp 80001c1c <memfind+0x37>
if (*(const unsigned char *) s == (unsigned char) c)
80001c16: 89 d0 mov %edx,%eax
80001c18: eb 02 jmp 80001c1c <memfind+0x37>
void *
memfind(const void *s, int c, size_t n)
{
const void *ends = (const char *) s + n;
for (; s < ends; s++)
80001c1a: 89 d0 mov %edx,%eax
if (*(const unsigned char *) s == (unsigned char) c)
break;
return (void *) s;
}
80001c1c: 5b pop %ebx
80001c1d: 5d pop %ebp
80001c1e: c3 ret
80001c1f <strtol>:
long
strtol(const char *s, char **endptr, int base)
{
80001c1f: 55 push %ebp
80001c20: 89 e5 mov %esp,%ebp
80001c22: 57 push %edi
80001c23: 56 push %esi
80001c24: 53 push %ebx
80001c25: 8b 4d 08 mov 0x8(%ebp),%ecx
80001c28: 8b 5d 10 mov 0x10(%ebp),%ebx
int neg = 0;
long val = 0;
// gobble initial whitespace
while (*s == ' ' || *s == '\t')
80001c2b: 0f b6 01 movzbl (%ecx),%eax
80001c2e: 3c 20 cmp $0x20,%al
80001c30: 74 04 je 80001c36 <strtol+0x17>
80001c32: 3c 09 cmp $0x9,%al
80001c34: 75 0e jne 80001c44 <strtol+0x25>
s++;
80001c36: 83 c1 01 add $0x1,%ecx
{
int neg = 0;
long val = 0;
// gobble initial whitespace
while (*s == ' ' || *s == '\t')
80001c39: 0f b6 01 movzbl (%ecx),%eax
80001c3c: 3c 20 cmp $0x20,%al
80001c3e: 74 f6 je 80001c36 <strtol+0x17>
80001c40: 3c 09 cmp $0x9,%al
80001c42: 74 f2 je 80001c36 <strtol+0x17>
s++;
// plus/minus sign
if (*s == '+')
80001c44: 3c 2b cmp $0x2b,%al
80001c46: 75 0a jne 80001c52 <strtol+0x33>
s++;
80001c48: 83 c1 01 add $0x1,%ecx
}
long
strtol(const char *s, char **endptr, int base)
{
int neg = 0;
80001c4b: bf 00 00 00 00 mov $0x0,%edi
80001c50: eb 11 jmp 80001c63 <strtol+0x44>
80001c52: bf 00 00 00 00 mov $0x0,%edi
s++;
// plus/minus sign
if (*s == '+')
s++;
else if (*s == '-')
80001c57: 3c 2d cmp $0x2d,%al
80001c59: 75 08 jne 80001c63 <strtol+0x44>
s++, neg = 1;
80001c5b: 83 c1 01 add $0x1,%ecx
80001c5e: bf 01 00 00 00 mov $0x1,%edi
// hex or octal base prefix
if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
80001c63: f7 c3 ef ff ff ff test $0xffffffef,%ebx
80001c69: 75 15 jne 80001c80 <strtol+0x61>
80001c6b: 80 39 30 cmpb $0x30,(%ecx)
80001c6e: 75 10 jne 80001c80 <strtol+0x61>
80001c70: 80 79 01 78 cmpb $0x78,0x1(%ecx)
80001c74: 75 7c jne 80001cf2 <strtol+0xd3>
s += 2, base = 16;
80001c76: 83 c1 02 add $0x2,%ecx
80001c79: bb 10 00 00 00 mov $0x10,%ebx
80001c7e: eb 16 jmp 80001c96 <strtol+0x77>
else if (base == 0 && s[0] == '0')
80001c80: 85 db test %ebx,%ebx
80001c82: 75 12 jne 80001c96 <strtol+0x77>
s++, base = 8;
else if (base == 0)
base = 10;
80001c84: bb 0a 00 00 00 mov $0xa,%ebx
s++, neg = 1;
// hex or octal base prefix
if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
s += 2, base = 16;
else if (base == 0 && s[0] == '0')
80001c89: 80 39 30 cmpb $0x30,(%ecx)
80001c8c: 75 08 jne 80001c96 <strtol+0x77>
s++, base = 8;
80001c8e: 83 c1 01 add $0x1,%ecx
80001c91: bb 08 00 00 00 mov $0x8,%ebx
else if (base == 0)
base = 10;
80001c96: b8 00 00 00 00 mov $0x0,%eax
80001c9b: 89 5d 10 mov %ebx,0x10(%ebp)
// digits
while (1) {
int dig;
if (*s >= '0' && *s <= '9')
80001c9e: 0f b6 11 movzbl (%ecx),%edx
80001ca1: 8d 72 d0 lea -0x30(%edx),%esi
80001ca4: 89 f3 mov %esi,%ebx
80001ca6: 80 fb 09 cmp $0x9,%bl
80001ca9: 77 08 ja 80001cb3 <strtol+0x94>
dig = *s - '0';
80001cab: 0f be d2 movsbl %dl,%edx
80001cae: 83 ea 30 sub $0x30,%edx
80001cb1: eb 22 jmp 80001cd5 <strtol+0xb6>
else if (*s >= 'a' && *s <= 'z')
80001cb3: 8d 72 9f lea -0x61(%edx),%esi
80001cb6: 89 f3 mov %esi,%ebx
80001cb8: 80 fb 19 cmp $0x19,%bl
80001cbb: 77 08 ja 80001cc5 <strtol+0xa6>
dig = *s - 'a' + 10;
80001cbd: 0f be d2 movsbl %dl,%edx
80001cc0: 83 ea 57 sub $0x57,%edx
80001cc3: eb 10 jmp 80001cd5 <strtol+0xb6>
else if (*s >= 'A' && *s <= 'Z')
80001cc5: 8d 72 bf lea -0x41(%edx),%esi
80001cc8: 89 f3 mov %esi,%ebx
80001cca: 80 fb 19 cmp $0x19,%bl
80001ccd: 77 16 ja 80001ce5 <strtol+0xc6>
dig = *s - 'A' + 10;
80001ccf: 0f be d2 movsbl %dl,%edx
80001cd2: 83 ea 37 sub $0x37,%edx
else
break;
if (dig >= base)
80001cd5: 3b 55 10 cmp 0x10(%ebp),%edx
80001cd8: 7d 0b jge 80001ce5 <strtol+0xc6>
break;
s++, val = (val * base) + dig;
80001cda: 83 c1 01 add $0x1,%ecx
80001cdd: 0f af 45 10 imul 0x10(%ebp),%eax
80001ce1: 01 d0 add %edx,%eax
// we don't properly detect overflow!
}
80001ce3: eb b9 jmp 80001c9e <strtol+0x7f>
if (endptr)
80001ce5: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80001ce9: 74 0d je 80001cf8 <strtol+0xd9>
*endptr = (char *) s;
80001ceb: 8b 75 0c mov 0xc(%ebp),%esi
80001cee: 89 0e mov %ecx,(%esi)
80001cf0: eb 06 jmp 80001cf8 <strtol+0xd9>
s++, neg = 1;
// hex or octal base prefix
if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
s += 2, base = 16;
else if (base == 0 && s[0] == '0')
80001cf2: 85 db test %ebx,%ebx
80001cf4: 74 98 je 80001c8e <strtol+0x6f>
80001cf6: eb 9e jmp 80001c96 <strtol+0x77>
// we don't properly detect overflow!
}
if (endptr)
*endptr = (char *) s;
return (neg ? -val : val);
80001cf8: 89 c2 mov %eax,%edx
80001cfa: f7 da neg %edx
80001cfc: 85 ff test %edi,%edi
80001cfe: 0f 45 c2 cmovne %edx,%eax
}
80001d01: 5b pop %ebx
80001d02: 5e pop %esi
80001d03: 5f pop %edi
80001d04: 5d pop %ebp
80001d05: c3 ret
80001d06 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";
void
libmain(int argc, char **argv)
{
80001d06: 55 push %ebp
80001d07: 89 e5 mov %esp,%ebp
80001d09: 56 push %esi
80001d0a: 53 push %ebx
80001d0b: 8b 5d 08 mov 0x8(%ebp),%ebx
80001d0e: 8b 75 0c mov 0xc(%ebp),%esi
// set thisenv to point at our Env structure in envs[].
thisenv = &envs[ENVX(sys_getenvid())];
80001d11: e8 b4 00 00 00 call 80001dca <sys_getenvid>
80001d16: 25 ff 03 00 00 and $0x3ff,%eax
80001d1b: 6b c0 7c imul $0x7c,%eax,%eax
80001d1e: 05 00 00 c0 ee add $0xeec00000,%eax
80001d23: a3 20 64 00 80 mov %eax,0x80006420
// save the name of the program so that panic() can use it
if (argc > 0)
80001d28: 85 db test %ebx,%ebx
80001d2a: 7e 07 jle 80001d33 <libmain+0x2d>
binaryname = argv[0];
80001d2c: 8b 06 mov (%esi),%eax
80001d2e: a3 00 50 00 80 mov %eax,0x80005000
// call user main routine
umain(argc, argv);
80001d33: 83 ec 08 sub $0x8,%esp
80001d36: 56 push %esi
80001d37: 53 push %ebx
80001d38: e8 26 f9 ff ff call 80001663 <umain>
// exit gracefully
exit();
80001d3d: e8 0a 1a 00 00 call 8000374c <exit>
}
80001d42: 83 c4 10 add $0x10,%esp
80001d45: 8d 65 f8 lea -0x8(%ebp),%esp
80001d48: 5b pop %ebx
80001d49: 5e pop %esi
80001d4a: 5d pop %ebp
80001d4b: c3 ret
80001d4c <sys_cputs>:
return ret;
}
void
sys_cputs(const char *s, size_t len)
{
80001d4c: 55 push %ebp
80001d4d: 89 e5 mov %esp,%ebp
80001d4f: 57 push %edi
80001d50: 56 push %esi
80001d51: 53 push %ebx
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001d52: b8 00 00 00 00 mov $0x0,%eax
80001d57: 8b 4d 0c mov 0xc(%ebp),%ecx
80001d5a: 8b 55 08 mov 0x8(%ebp),%edx
80001d5d: 89 c3 mov %eax,%ebx
80001d5f: 89 c7 mov %eax,%edi
80001d61: 89 c6 mov %eax,%esi
80001d63: cd 30 int $0x30
void
sys_cputs(const char *s, size_t len)
{
syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
80001d65: 5b pop %ebx
80001d66: 5e pop %esi
80001d67: 5f pop %edi
80001d68: 5d pop %ebp
80001d69: c3 ret
80001d6a <sys_cgetc>:
int
sys_cgetc(void)
{
80001d6a: 55 push %ebp
80001d6b: 89 e5 mov %esp,%ebp
80001d6d: 57 push %edi
80001d6e: 56 push %esi
80001d6f: 53 push %ebx
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001d70: ba 00 00 00 00 mov $0x0,%edx
80001d75: b8 01 00 00 00 mov $0x1,%eax
80001d7a: 89 d1 mov %edx,%ecx
80001d7c: 89 d3 mov %edx,%ebx
80001d7e: 89 d7 mov %edx,%edi
80001d80: 89 d6 mov %edx,%esi
80001d82: cd 30 int $0x30
int
sys_cgetc(void)
{
return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
80001d84: 5b pop %ebx
80001d85: 5e pop %esi
80001d86: 5f pop %edi
80001d87: 5d pop %ebp
80001d88: c3 ret
80001d89 <sys_env_destroy>:
int
sys_env_destroy(envid_t envid)
{
80001d89: 55 push %ebp
80001d8a: 89 e5 mov %esp,%ebp
80001d8c: 57 push %edi
80001d8d: 56 push %esi
80001d8e: 53 push %ebx
80001d8f: 83 ec 0c sub $0xc,%esp
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001d92: b9 00 00 00 00 mov $0x0,%ecx
80001d97: b8 03 00 00 00 mov $0x3,%eax
80001d9c: 8b 55 08 mov 0x8(%ebp),%edx
80001d9f: 89 cb mov %ecx,%ebx
80001da1: 89 cf mov %ecx,%edi
80001da3: 89 ce mov %ecx,%esi
80001da5: cd 30 int $0x30
"b" (a3),
"D" (a4),
"S" (a5)
: "cc", "memory");
if(check && ret > 0)
80001da7: 85 c0 test %eax,%eax
80001da9: 7e 17 jle 80001dc2 <sys_env_destroy+0x39>
panic("syscall %d returned %d (> 0)", num, ret);
80001dab: 83 ec 0c sub $0xc,%esp
80001dae: 50 push %eax
80001daf: 6a 03 push $0x3
80001db1: 68 23 44 00 80 push $0x80004423
80001db6: 6a 21 push $0x21
80001db8: 68 40 44 00 80 push $0x80004440
80001dbd: e8 b5 23 00 00 call 80004177 <_panic>
int
sys_env_destroy(envid_t envid)
{
return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
80001dc2: 8d 65 f4 lea -0xc(%ebp),%esp
80001dc5: 5b pop %ebx
80001dc6: 5e pop %esi
80001dc7: 5f pop %edi
80001dc8: 5d pop %ebp
80001dc9: c3 ret
80001dca <sys_getenvid>:
envid_t
sys_getenvid(void)
{
80001dca: 55 push %ebp
80001dcb: 89 e5 mov %esp,%ebp
80001dcd: 57 push %edi
80001dce: 56 push %esi
80001dcf: 53 push %ebx
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001dd0: ba 00 00 00 00 mov $0x0,%edx
80001dd5: b8 02 00 00 00 mov $0x2,%eax
80001dda: 89 d1 mov %edx,%ecx
80001ddc: 89 d3 mov %edx,%ebx
80001dde: 89 d7 mov %edx,%edi
80001de0: 89 d6 mov %edx,%esi
80001de2: cd 30 int $0x30
envid_t
sys_getenvid(void)
{
return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
80001de4: 5b pop %ebx
80001de5: 5e pop %esi
80001de6: 5f pop %edi
80001de7: 5d pop %ebp
80001de8: c3 ret
80001de9 <sys_yield>:
void
sys_yield(void)
{
80001de9: 55 push %ebp
80001dea: 89 e5 mov %esp,%ebp
80001dec: 57 push %edi
80001ded: 56 push %esi
80001dee: 53 push %ebx
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001def: ba 00 00 00 00 mov $0x0,%edx
80001df4: b8 0b 00 00 00 mov $0xb,%eax
80001df9: 89 d1 mov %edx,%ecx
80001dfb: 89 d3 mov %edx,%ebx
80001dfd: 89 d7 mov %edx,%edi
80001dff: 89 d6 mov %edx,%esi
80001e01: cd 30 int $0x30
void
sys_yield(void)
{
syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
80001e03: 5b pop %ebx
80001e04: 5e pop %esi
80001e05: 5f pop %edi
80001e06: 5d pop %ebp
80001e07: c3 ret
80001e08 <sys_page_alloc>:
int
sys_page_alloc(envid_t envid, void *va, int perm)
{
80001e08: 55 push %ebp
80001e09: 89 e5 mov %esp,%ebp
80001e0b: 57 push %edi
80001e0c: 56 push %esi
80001e0d: 53 push %ebx
80001e0e: 83 ec 0c sub $0xc,%esp
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001e11: be 00 00 00 00 mov $0x0,%esi
80001e16: b8 04 00 00 00 mov $0x4,%eax
80001e1b: 8b 4d 0c mov 0xc(%ebp),%ecx
80001e1e: 8b 55 08 mov 0x8(%ebp),%edx
80001e21: 8b 5d 10 mov 0x10(%ebp),%ebx
80001e24: 89 f7 mov %esi,%edi
80001e26: cd 30 int $0x30
"b" (a3),
"D" (a4),
"S" (a5)
: "cc", "memory");
if(check && ret > 0)
80001e28: 85 c0 test %eax,%eax
80001e2a: 7e 17 jle 80001e43 <sys_page_alloc+0x3b>
panic("syscall %d returned %d (> 0)", num, ret);
80001e2c: 83 ec 0c sub $0xc,%esp
80001e2f: 50 push %eax
80001e30: 6a 04 push $0x4
80001e32: 68 23 44 00 80 push $0x80004423
80001e37: 6a 21 push $0x21
80001e39: 68 40 44 00 80 push $0x80004440
80001e3e: e8 34 23 00 00 call 80004177 <_panic>
int
sys_page_alloc(envid_t envid, void *va, int perm)
{
return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
80001e43: 8d 65 f4 lea -0xc(%ebp),%esp
80001e46: 5b pop %ebx
80001e47: 5e pop %esi
80001e48: 5f pop %edi
80001e49: 5d pop %ebp
80001e4a: c3 ret
80001e4b <sys_page_map>:
int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
80001e4b: 55 push %ebp
80001e4c: 89 e5 mov %esp,%ebp
80001e4e: 57 push %edi
80001e4f: 56 push %esi
80001e50: 53 push %ebx
80001e51: 83 ec 0c sub $0xc,%esp
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001e54: b8 05 00 00 00 mov $0x5,%eax
80001e59: 8b 4d 0c mov 0xc(%ebp),%ecx
80001e5c: 8b 55 08 mov 0x8(%ebp),%edx
80001e5f: 8b 5d 10 mov 0x10(%ebp),%ebx
80001e62: 8b 7d 14 mov 0x14(%ebp),%edi
80001e65: 8b 75 18 mov 0x18(%ebp),%esi
80001e68: cd 30 int $0x30
"b" (a3),
"D" (a4),
"S" (a5)
: "cc", "memory");
if(check && ret > 0)
80001e6a: 85 c0 test %eax,%eax
80001e6c: 7e 17 jle 80001e85 <sys_page_map+0x3a>
panic("syscall %d returned %d (> 0)", num, ret);
80001e6e: 83 ec 0c sub $0xc,%esp
80001e71: 50 push %eax
80001e72: 6a 05 push $0x5
80001e74: 68 23 44 00 80 push $0x80004423
80001e79: 6a 21 push $0x21
80001e7b: 68 40 44 00 80 push $0x80004440
80001e80: e8 f2 22 00 00 call 80004177 <_panic>
int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
80001e85: 8d 65 f4 lea -0xc(%ebp),%esp
80001e88: 5b pop %ebx
80001e89: 5e pop %esi
80001e8a: 5f pop %edi
80001e8b: 5d pop %ebp
80001e8c: c3 ret
80001e8d <sys_page_unmap>:
int
sys_page_unmap(envid_t envid, void *va)
{
80001e8d: 55 push %ebp
80001e8e: 89 e5 mov %esp,%ebp
80001e90: 57 push %edi
80001e91: 56 push %esi
80001e92: 53 push %ebx
80001e93: 83 ec 0c sub $0xc,%esp
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001e96: bb 00 00 00 00 mov $0x0,%ebx
80001e9b: b8 06 00 00 00 mov $0x6,%eax
80001ea0: 8b 4d 0c mov 0xc(%ebp),%ecx
80001ea3: 8b 55 08 mov 0x8(%ebp),%edx
80001ea6: 89 df mov %ebx,%edi
80001ea8: 89 de mov %ebx,%esi
80001eaa: cd 30 int $0x30
"b" (a3),
"D" (a4),
"S" (a5)
: "cc", "memory");
if(check && ret > 0)
80001eac: 85 c0 test %eax,%eax
80001eae: 7e 17 jle 80001ec7 <sys_page_unmap+0x3a>
panic("syscall %d returned %d (> 0)", num, ret);
80001eb0: 83 ec 0c sub $0xc,%esp
80001eb3: 50 push %eax
80001eb4: 6a 06 push $0x6
80001eb6: 68 23 44 00 80 push $0x80004423
80001ebb: 6a 21 push $0x21
80001ebd: 68 40 44 00 80 push $0x80004440
80001ec2: e8 b0 22 00 00 call 80004177 <_panic>
int
sys_page_unmap(envid_t envid, void *va)
{
return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
80001ec7: 8d 65 f4 lea -0xc(%ebp),%esp
80001eca: 5b pop %ebx
80001ecb: 5e pop %esi
80001ecc: 5f pop %edi
80001ecd: 5d pop %ebp
80001ece: c3 ret
80001ecf <sys_env_set_status>:
// sys_exofork is inlined in lib.h
int
sys_env_set_status(envid_t envid, int status)
{
80001ecf: 55 push %ebp
80001ed0: 89 e5 mov %esp,%ebp
80001ed2: 57 push %edi
80001ed3: 56 push %esi
80001ed4: 53 push %ebx
80001ed5: 83 ec 0c sub $0xc,%esp
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001ed8: bb 00 00 00 00 mov $0x0,%ebx
80001edd: b8 08 00 00 00 mov $0x8,%eax
80001ee2: 8b 4d 0c mov 0xc(%ebp),%ecx
80001ee5: 8b 55 08 mov 0x8(%ebp),%edx
80001ee8: 89 df mov %ebx,%edi
80001eea: 89 de mov %ebx,%esi
80001eec: cd 30 int $0x30
"b" (a3),
"D" (a4),
"S" (a5)
: "cc", "memory");
if(check && ret > 0)
80001eee: 85 c0 test %eax,%eax
80001ef0: 7e 17 jle 80001f09 <sys_env_set_status+0x3a>
panic("syscall %d returned %d (> 0)", num, ret);
80001ef2: 83 ec 0c sub $0xc,%esp
80001ef5: 50 push %eax
80001ef6: 6a 08 push $0x8
80001ef8: 68 23 44 00 80 push $0x80004423
80001efd: 6a 21 push $0x21
80001eff: 68 40 44 00 80 push $0x80004440
80001f04: e8 6e 22 00 00 call 80004177 <_panic>
int
sys_env_set_status(envid_t envid, int status)
{
return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
80001f09: 8d 65 f4 lea -0xc(%ebp),%esp
80001f0c: 5b pop %ebx
80001f0d: 5e pop %esi
80001f0e: 5f pop %edi
80001f0f: 5d pop %ebp
80001f10: c3 ret
80001f11 <sys_env_set_trapframe>:
int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
80001f11: 55 push %ebp
80001f12: 89 e5 mov %esp,%ebp
80001f14: 57 push %edi
80001f15: 56 push %esi
80001f16: 53 push %ebx
80001f17: 83 ec 0c sub $0xc,%esp
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001f1a: bb 00 00 00 00 mov $0x0,%ebx
80001f1f: b8 09 00 00 00 mov $0x9,%eax
80001f24: 8b 4d 0c mov 0xc(%ebp),%ecx
80001f27: 8b 55 08 mov 0x8(%ebp),%edx
80001f2a: 89 df mov %ebx,%edi
80001f2c: 89 de mov %ebx,%esi
80001f2e: cd 30 int $0x30
"b" (a3),
"D" (a4),
"S" (a5)
: "cc", "memory");
if(check && ret > 0)
80001f30: 85 c0 test %eax,%eax
80001f32: 7e 17 jle 80001f4b <sys_env_set_trapframe+0x3a>
panic("syscall %d returned %d (> 0)", num, ret);
80001f34: 83 ec 0c sub $0xc,%esp
80001f37: 50 push %eax
80001f38: 6a 09 push $0x9
80001f3a: 68 23 44 00 80 push $0x80004423
80001f3f: 6a 21 push $0x21
80001f41: 68 40 44 00 80 push $0x80004440
80001f46: e8 2c 22 00 00 call 80004177 <_panic>
int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
80001f4b: 8d 65 f4 lea -0xc(%ebp),%esp
80001f4e: 5b pop %ebx
80001f4f: 5e pop %esi
80001f50: 5f pop %edi
80001f51: 5d pop %ebp
80001f52: c3 ret
80001f53 <sys_env_set_pgfault_upcall>:
int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
80001f53: 55 push %ebp
80001f54: 89 e5 mov %esp,%ebp
80001f56: 57 push %edi
80001f57: 56 push %esi
80001f58: 53 push %ebx
80001f59: 83 ec 0c sub $0xc,%esp
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001f5c: bb 00 00 00 00 mov $0x0,%ebx
80001f61: b8 0a 00 00 00 mov $0xa,%eax
80001f66: 8b 4d 0c mov 0xc(%ebp),%ecx
80001f69: 8b 55 08 mov 0x8(%ebp),%edx
80001f6c: 89 df mov %ebx,%edi
80001f6e: 89 de mov %ebx,%esi
80001f70: cd 30 int $0x30
"b" (a3),
"D" (a4),
"S" (a5)
: "cc", "memory");
if(check && ret > 0)
80001f72: 85 c0 test %eax,%eax
80001f74: 7e 17 jle 80001f8d <sys_env_set_pgfault_upcall+0x3a>
panic("syscall %d returned %d (> 0)", num, ret);
80001f76: 83 ec 0c sub $0xc,%esp
80001f79: 50 push %eax
80001f7a: 6a 0a push $0xa
80001f7c: 68 23 44 00 80 push $0x80004423
80001f81: 6a 21 push $0x21
80001f83: 68 40 44 00 80 push $0x80004440
80001f88: e8 ea 21 00 00 call 80004177 <_panic>
int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
80001f8d: 8d 65 f4 lea -0xc(%ebp),%esp
80001f90: 5b pop %ebx
80001f91: 5e pop %esi
80001f92: 5f pop %edi
80001f93: 5d pop %ebp
80001f94: c3 ret
80001f95 <sys_ipc_try_send>:
int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
80001f95: 55 push %ebp
80001f96: 89 e5 mov %esp,%ebp
80001f98: 57 push %edi
80001f99: 56 push %esi
80001f9a: 53 push %ebx
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001f9b: be 00 00 00 00 mov $0x0,%esi
80001fa0: b8 0c 00 00 00 mov $0xc,%eax
80001fa5: 8b 4d 0c mov 0xc(%ebp),%ecx
80001fa8: 8b 55 08 mov 0x8(%ebp),%edx
80001fab: 8b 5d 10 mov 0x10(%ebp),%ebx
80001fae: 8b 7d 14 mov 0x14(%ebp),%edi
80001fb1: cd 30 int $0x30
int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
80001fb3: 5b pop %ebx
80001fb4: 5e pop %esi
80001fb5: 5f pop %edi
80001fb6: 5d pop %ebp
80001fb7: c3 ret
80001fb8 <sys_ipc_recv>:
int
sys_ipc_recv(void *dstva)
{
80001fb8: 55 push %ebp
80001fb9: 89 e5 mov %esp,%ebp
80001fbb: 57 push %edi
80001fbc: 56 push %esi
80001fbd: 53 push %ebx
80001fbe: 83 ec 0c sub $0xc,%esp
//
// The last clause tells the assembler that this can
// potentially change the condition codes and arbitrary
// memory locations.
asm volatile("int %1\n"
80001fc1: b9 00 00 00 00 mov $0x0,%ecx
80001fc6: b8 0d 00 00 00 mov $0xd,%eax
80001fcb: 8b 55 08 mov 0x8(%ebp),%edx
80001fce: 89 cb mov %ecx,%ebx
80001fd0: 89 cf mov %ecx,%edi
80001fd2: 89 ce mov %ecx,%esi
80001fd4: cd 30 int $0x30
"b" (a3),
"D" (a4),
"S" (a5)
: "cc", "memory");
if(check && ret > 0)
80001fd6: 85 c0 test %eax,%eax
80001fd8: 7e 17 jle 80001ff1 <sys_ipc_recv+0x39>
panic("syscall %d returned %d (> 0)", num, ret);
80001fda: 83 ec 0c sub $0xc,%esp
80001fdd: 50 push %eax
80001fde: 6a 0d push $0xd
80001fe0: 68 23 44 00 80 push $0x80004423
80001fe5: 6a 21 push $0x21
80001fe7: 68 40 44 00 80 push $0x80004440
80001fec: e8 86 21 00 00 call 80004177 <_panic>
int
sys_ipc_recv(void *dstva)
{
return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
80001ff1: 8d 65 f4 lea -0xc(%ebp),%esp
80001ff4: 5b pop %ebx
80001ff5: 5e pop %esi
80001ff6: 5f pop %edi
80001ff7: 5d pop %ebp
80001ff8: c3 ret
80001ff9 <devcons_close>:
return tot;
}
static int
devcons_close(struct Fd *fd)
{
80001ff9: 55 push %ebp
80001ffa: 89 e5 mov %esp,%ebp
USED(fd);
return 0;
}
80001ffc: b8 00 00 00 00 mov $0x0,%eax
80002001: 5d pop %ebp
80002002: c3 ret
80002003 <devcons_stat>:
static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
80002003: 55 push %ebp
80002004: 89 e5 mov %esp,%ebp
80002006: 83 ec 10 sub $0x10,%esp
strcpy(stat->st_name, "<cons>");
80002009: 68 4a 44 00 80 push $0x8000444a
8000200e: ff 75 0c pushl 0xc(%ebp)
80002011: e8 0f f9 ff ff call 80001925 <strcpy>
return 0;
}
80002016: b8 00 00 00 00 mov $0x0,%eax
8000201b: c9 leave
8000201c: c3 ret
8000201d <devcons_write>:
return 1;
}
static ssize_t
devcons_write(struct Fd *fd, const void *vbuf, size_t n)
{
8000201d: 55 push %ebp
8000201e: 89 e5 mov %esp,%ebp
80002020: 57 push %edi
80002021: 56 push %esi
80002022: 53 push %ebx
80002023: 81 ec 8c 00 00 00 sub $0x8c,%esp
int tot, m;
char buf[128];
// mistake: have to nul-terminate arg to sys_cputs,
// so we have to copy vbuf into buf in chunks and nul-terminate.
for (tot = 0; tot < n; tot += m) {
80002029: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
8000202d: 74 46 je 80002075 <devcons_write+0x58>
8000202f: b8 00 00 00 00 mov $0x0,%eax
80002034: be 00 00 00 00 mov $0x0,%esi
m = n - tot;
if (m > sizeof(buf) - 1)
m = sizeof(buf) - 1;
memmove(buf, (char*)vbuf + tot, m);
80002039: 8d bd 68 ff ff ff lea -0x98(%ebp),%edi
char buf[128];
// mistake: have to nul-terminate arg to sys_cputs,
// so we have to copy vbuf into buf in chunks and nul-terminate.
for (tot = 0; tot < n; tot += m) {
m = n - tot;
8000203f: 8b 5d 10 mov 0x10(%ebp),%ebx
80002042: 29 c3 sub %eax,%ebx
if (m > sizeof(buf) - 1)
80002044: 83 fb 7f cmp $0x7f,%ebx
char buf[128];
// mistake: have to nul-terminate arg to sys_cputs,
// so we have to copy vbuf into buf in chunks and nul-terminate.
for (tot = 0; tot < n; tot += m) {
m = n - tot;
80002047: ba 7f 00 00 00 mov $0x7f,%edx
8000204c: 0f 47 da cmova %edx,%ebx
if (m > sizeof(buf) - 1)
m = sizeof(buf) - 1;
memmove(buf, (char*)vbuf + tot, m);
8000204f: 83 ec 04 sub $0x4,%esp
80002052: 53 push %ebx
80002053: 03 45 0c add 0xc(%ebp),%eax
80002056: 50 push %eax
80002057: 57 push %edi
80002058: e8 b7 fa ff ff call 80001b14 <memmove>
sys_cputs(buf, m);
8000205d: 83 c4 08 add $0x8,%esp
80002060: 53 push %ebx
80002061: 57 push %edi
80002062: e8 e5 fc ff ff call 80001d4c <sys_cputs>
int tot, m;
char buf[128];
// mistake: have to nul-terminate arg to sys_cputs,
// so we have to copy vbuf into buf in chunks and nul-terminate.
for (tot = 0; tot < n; tot += m) {
80002067: 01 de add %ebx,%esi
80002069: 89 f0 mov %esi,%eax
8000206b: 83 c4 10 add $0x10,%esp
8000206e: 3b 75 10 cmp 0x10(%ebp),%esi
80002071: 72 cc jb 8000203f <devcons_write+0x22>
80002073: eb 05 jmp 8000207a <devcons_write+0x5d>
80002075: be 00 00 00 00 mov $0x0,%esi
m = sizeof(buf) - 1;
memmove(buf, (char*)vbuf + tot, m);
sys_cputs(buf, m);
}
return tot;
}
8000207a: 89 f0 mov %esi,%eax
8000207c: 8d 65 f4 lea -0xc(%ebp),%esp
8000207f: 5b pop %ebx
80002080: 5e pop %esi
80002081: 5f pop %edi
80002082: 5d pop %ebp
80002083: c3 ret
80002084 <devcons_read>:
return fd2num(fd);
}
static ssize_t
devcons_read(struct Fd *fd, void *vbuf, size_t n)
{
80002084: 55 push %ebp
80002085: 89 e5 mov %esp,%ebp
80002087: 83 ec 08 sub $0x8,%esp
8000208a: b8 00 00 00 00 mov $0x0,%eax
int c;
if (n == 0)
8000208f: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80002093: 74 2a je 800020bf <devcons_read+0x3b>
80002095: eb 05 jmp 8000209c <devcons_read+0x18>
return 0;
while ((c = sys_cgetc()) == 0)
sys_yield();
80002097: e8 4d fd ff ff call 80001de9 <sys_yield>
int c;
if (n == 0)
return 0;
while ((c = sys_cgetc()) == 0)
8000209c: e8 c9 fc ff ff call 80001d6a <sys_cgetc>
800020a1: 85 c0 test %eax,%eax
800020a3: 74 f2 je 80002097 <devcons_read+0x13>
sys_yield();
if (c < 0)
800020a5: 85 c0 test %eax,%eax
800020a7: 78 16 js 800020bf <devcons_read+0x3b>
return c;
if (c == 0x04) // ctl-d is eof
800020a9: 83 f8 04 cmp $0x4,%eax
800020ac: 74 0c je 800020ba <devcons_read+0x36>
return 0;
*(char*)vbuf = c;
800020ae: 8b 55 0c mov 0xc(%ebp),%edx
800020b1: 88 02 mov %al,(%edx)
return 1;
800020b3: b8 01 00 00 00 mov $0x1,%eax
800020b8: eb 05 jmp 800020bf <devcons_read+0x3b>
while ((c = sys_cgetc()) == 0)
sys_yield();
if (c < 0)
return c;
if (c == 0x04) // ctl-d is eof
return 0;
800020ba: b8 00 00 00 00 mov $0x0,%eax
*(char*)vbuf = c;
return 1;
}
800020bf: c9 leave
800020c0: c3 ret
800020c1 <cputchar>:
#include <string.h>
#include <syslib.h>
void
cputchar(int ch)
{
800020c1: 55 push %ebp
800020c2: 89 e5 mov %esp,%ebp
800020c4: 83 ec 20 sub $0x20,%esp
char c = ch;
800020c7: 8b 45 08 mov 0x8(%ebp),%eax
800020ca: 88 45 f7 mov %al,-0x9(%ebp)
// Unlike standard Unix's putchar,
// the cputchar function _always_ outputs to the system console.
sys_cputs(&c, 1);
800020cd: 6a 01 push $0x1
800020cf: 8d 45 f7 lea -0x9(%ebp),%eax
800020d2: 50 push %eax
800020d3: e8 74 fc ff ff call 80001d4c <sys_cputs>
}
800020d8: 83 c4 10 add $0x10,%esp
800020db: c9 leave
800020dc: c3 ret
800020dd <getchar>:
int
getchar(void)
{
800020dd: 55 push %ebp
800020de: 89 e5 mov %esp,%ebp
800020e0: 83 ec 1c sub $0x1c,%esp
int r;
// JOS does, however, support standard _input_ redirection,
// allowing the user to redirect script files to the shell and such.
// getchar() reads a character from file descriptor 0.
r = read(0, &c, 1);
800020e3: 6a 01 push $0x1
800020e5: 8d 45 f7 lea -0x9(%ebp),%eax
800020e8: 50 push %eax
800020e9: 6a 00 push $0x0
800020eb: e8 b9 03 00 00 call 800024a9 <read>
if (r < 0)
800020f0: 83 c4 10 add $0x10,%esp
800020f3: 85 c0 test %eax,%eax
800020f5: 78 0f js 80002106 <getchar+0x29>
return r;
if (r < 1)
800020f7: 85 c0 test %eax,%eax
800020f9: 7e 06 jle 80002101 <getchar+0x24>
return -E_EOF;
return c;
800020fb: 0f b6 45 f7 movzbl -0x9(%ebp),%eax
800020ff: eb 05 jmp 80002106 <getchar+0x29>
// getchar() reads a character from file descriptor 0.
r = read(0, &c, 1);
if (r < 0)
return r;
if (r < 1)
return -E_EOF;
80002101: b8 f8 ff ff ff mov $0xfffffff8,%eax
return c;
}
80002106: c9 leave
80002107: c3 ret
80002108 <iscons>:
.dev_stat = devcons_stat
};
int
iscons(int fdnum)
{
80002108: 55 push %ebp
80002109: 89 e5 mov %esp,%ebp
8000210b: 83 ec 20 sub $0x20,%esp
int r;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0)
8000210e: 8d 45 f4 lea -0xc(%ebp),%eax
80002111: 50 push %eax
80002112: ff 75 08 pushl 0x8(%ebp)
80002115: e8 10 01 00 00 call 8000222a <fd_lookup>
8000211a: 83 c4 10 add $0x10,%esp
8000211d: 85 c0 test %eax,%eax
8000211f: 78 11 js 80002132 <iscons+0x2a>
return r;
return fd->fd_dev_id == devcons.dev_id;
80002121: 8b 45 f4 mov -0xc(%ebp),%eax
80002124: 8b 15 04 50 00 80 mov 0x80005004,%edx
8000212a: 39 10 cmp %edx,(%eax)
8000212c: 0f 94 c0 sete %al
8000212f: 0f b6 c0 movzbl %al,%eax
}
80002132: c9 leave
80002133: c3 ret
80002134 <opencons>:
int
opencons(void)
{
80002134: 55 push %ebp
80002135: 89 e5 mov %esp,%ebp
80002137: 83 ec 24 sub $0x24,%esp
int r;
struct Fd* fd;
if ((r = fd_alloc(&fd)) < 0)
8000213a: 8d 45 f4 lea -0xc(%ebp),%eax
8000213d: 50 push %eax
8000213e: e8 73 00 00 00 call 800021b6 <fd_alloc>
80002143: 83 c4 10 add $0x10,%esp
return r;
80002146: 89 c2 mov %eax,%edx
opencons(void)
{
int r;
struct Fd* fd;
if ((r = fd_alloc(&fd)) < 0)
80002148: 85 c0 test %eax,%eax
8000214a: 78 3e js 8000218a <opencons+0x56>
return r;
if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
8000214c: 83 ec 04 sub $0x4,%esp
8000214f: 68 07 04 00 00 push $0x407
80002154: ff 75 f4 pushl -0xc(%ebp)
80002157: 6a 00 push $0x0
80002159: e8 aa fc ff ff call 80001e08 <sys_page_alloc>
8000215e: 83 c4 10 add $0x10,%esp
return r;
80002161: 89 c2 mov %eax,%edx
int r;
struct Fd* fd;
if ((r = fd_alloc(&fd)) < 0)
return r;
if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
80002163: 85 c0 test %eax,%eax
80002165: 78 23 js 8000218a <opencons+0x56>
return r;
fd->fd_dev_id = devcons.dev_id;
80002167: 8b 15 04 50 00 80 mov 0x80005004,%edx
8000216d: 8b 45 f4 mov -0xc(%ebp),%eax
80002170: 89 10 mov %edx,(%eax)
fd->fd_omode = O_RDWR;
80002172: 8b 45 f4 mov -0xc(%ebp),%eax
80002175: c7 40 08 02 00 00 00 movl $0x2,0x8(%eax)
return fd2num(fd);
8000217c: 83 ec 0c sub $0xc,%esp
8000217f: 50 push %eax
80002180: e8 09 00 00 00 call 8000218e <fd2num>
80002185: 89 c2 mov %eax,%edx
80002187: 83 c4 10 add $0x10,%esp
}
8000218a: 89 d0 mov %edx,%eax
8000218c: c9 leave
8000218d: c3 ret
8000218e <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------
int
fd2num(struct Fd *fd)
{
8000218e: 55 push %ebp
8000218f: 89 e5 mov %esp,%ebp
return ((uintptr_t) fd - FDTABLE) / PGSIZE;
80002191: 8b 45 08 mov 0x8(%ebp),%eax
80002194: 2d 00 00 00 20 sub $0x20000000,%eax
80002199: c1 e8 0c shr $0xc,%eax
}
8000219c: 5d pop %ebp
8000219d: c3 ret
8000219e <fd2data>:
char*
fd2data(struct Fd *fd)
{
8000219e: 55 push %ebp
8000219f: 89 e5 mov %esp,%ebp
return INDEX2DATA(fd2num(fd));
800021a1: 8b 45 08 mov 0x8(%ebp),%eax
800021a4: 2d 00 00 00 20 sub $0x20000000,%eax
800021a9: 25 00 f0 ff ff and $0xfffff000,%eax
800021ae: 8d 80 00 00 02 20 lea 0x20020000(%eax),%eax
}
800021b4: 5d pop %ebp
800021b5: c3 ret
800021b6 <fd_alloc>:
// Returns 0 on success, < 0 on error. Errors are:
// -E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
800021b6: 55 push %ebp
800021b7: 89 e5 mov %esp,%ebp
int i;
struct Fd *fd;
for (i = 0; i < MAXFD; i++) {
fd = INDEX2FD(i);
if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
800021b9: a1 00 d2 7b ef mov 0xef7bd200,%eax
800021be: a8 01 test $0x1,%al
800021c0: 74 34 je 800021f6 <fd_alloc+0x40>
800021c2: a1 00 00 48 ef mov 0xef480000,%eax
800021c7: a8 01 test $0x1,%al
800021c9: 74 32 je 800021fd <fd_alloc+0x47>
800021cb: b8 00 10 00 20 mov $0x20001000,%eax
{
int i;
struct Fd *fd;
for (i = 0; i < MAXFD; i++) {
fd = INDEX2FD(i);
800021d0: 89 c1 mov %eax,%ecx
if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
800021d2: 89 c2 mov %eax,%edx
800021d4: c1 ea 16 shr $0x16,%edx
800021d7: 8b 14 95 00 d0 7b ef mov -0x10843000(,%edx,4),%edx
800021de: f6 c2 01 test $0x1,%dl
800021e1: 74 1f je 80002202 <fd_alloc+0x4c>
800021e3: 89 c2 mov %eax,%edx
800021e5: c1 ea 0c shr $0xc,%edx
800021e8: 8b 14 95 00 00 40 ef mov -0x10c00000(,%edx,4),%edx
800021ef: f6 c2 01 test $0x1,%dl
800021f2: 75 1a jne 8000220e <fd_alloc+0x58>
800021f4: eb 0c jmp 80002202 <fd_alloc+0x4c>
{
int i;
struct Fd *fd;
for (i = 0; i < MAXFD; i++) {
fd = INDEX2FD(i);
800021f6: b9 00 00 00 20 mov $0x20000000,%ecx
800021fb: eb 05 jmp 80002202 <fd_alloc+0x4c>
800021fd: b9 00 00 00 20 mov $0x20000000,%ecx
if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
*fd_store = fd;
80002202: 8b 45 08 mov 0x8(%ebp),%eax
80002205: 89 08 mov %ecx,(%eax)
return 0;
80002207: b8 00 00 00 00 mov $0x0,%eax
8000220c: eb 1a jmp 80002228 <fd_alloc+0x72>
8000220e: 05 00 10 00 00 add $0x1000,%eax
fd_alloc(struct Fd **fd_store)
{
int i;
struct Fd *fd;
for (i = 0; i < MAXFD; i++) {
80002213: 3d 00 00 02 20 cmp $0x20020000,%eax
80002218: 75 b6 jne 800021d0 <fd_alloc+0x1a>
if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
*fd_store = fd;
return 0;
}
}
*fd_store = 0;
8000221a: 8b 45 08 mov 0x8(%ebp),%eax
8000221d: c7 00 00 00 00 00 movl $0x0,(%eax)
return -E_MAX_OPEN;
80002223: b8 f5 ff ff ff mov $0xfffffff5,%eax
}
80002228: 5d pop %ebp
80002229: c3 ret
8000222a <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
// -E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
8000222a: 55 push %ebp
8000222b: 89 e5 mov %esp,%ebp
8000222d: 8b 45 08 mov 0x8(%ebp),%eax
struct Fd *fd;
if (fdnum < 0 || fdnum >= MAXFD) {
80002230: 83 f8 1f cmp $0x1f,%eax
80002233: 77 36 ja 8000226b <fd_lookup+0x41>
if (debug)
cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
return -E_INVAL;
}
fd = INDEX2FD(fdnum);
80002235: 05 00 00 02 00 add $0x20000,%eax
8000223a: c1 e0 0c shl $0xc,%eax
if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
8000223d: 89 c2 mov %eax,%edx
8000223f: c1 ea 16 shr $0x16,%edx
80002242: 8b 14 95 00 d0 7b ef mov -0x10843000(,%edx,4),%edx
80002249: f6 c2 01 test $0x1,%dl
8000224c: 74 24 je 80002272 <fd_lookup+0x48>
8000224e: 89 c2 mov %eax,%edx
80002250: c1 ea 0c shr $0xc,%edx
80002253: 8b 14 95 00 00 40 ef mov -0x10c00000(,%edx,4),%edx
8000225a: f6 c2 01 test $0x1,%dl
8000225d: 74 1a je 80002279 <fd_lookup+0x4f>
if (debug)
cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
return -E_INVAL;
}
*fd_store = fd;
8000225f: 8b 55 0c mov 0xc(%ebp),%edx
80002262: 89 02 mov %eax,(%edx)
return 0;
80002264: b8 00 00 00 00 mov $0x0,%eax
80002269: eb 13 jmp 8000227e <fd_lookup+0x54>
struct Fd *fd;
if (fdnum < 0 || fdnum >= MAXFD) {
if (debug)
cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
return -E_INVAL;
8000226b: b8 fd ff ff ff mov $0xfffffffd,%eax
80002270: eb 0c jmp 8000227e <fd_lookup+0x54>
}
fd = INDEX2FD(fdnum);
if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
if (debug)
cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
return -E_INVAL;
80002272: b8 fd ff ff ff mov $0xfffffffd,%eax
80002277: eb 05 jmp 8000227e <fd_lookup+0x54>
80002279: b8 fd ff ff ff mov $0xfffffffd,%eax
}
*fd_store = fd;
return 0;
}
8000227e: 5d pop %ebp
8000227f: c3 ret
80002280 <dev_lookup>:
0
};
int
dev_lookup(int dev_id, struct Dev **dev)
{
80002280: 55 push %ebp
80002281: 89 e5 mov %esp,%ebp
80002283: 53 push %ebx
80002284: 83 ec 04 sub $0x4,%esp
80002287: 8b 45 08 mov 0x8(%ebp),%eax
8000228a: 8b 5d 0c mov 0xc(%ebp),%ebx
int i;
for (i = 0; devtab[i]; i++)
if (devtab[i]->dev_id == dev_id) {
8000228d: 3b 05 20 50 00 80 cmp 0x80005020,%eax
80002293: 75 1e jne 800022b3 <dev_lookup+0x33>
80002295: eb 0e jmp 800022a5 <dev_lookup+0x25>
int
dev_lookup(int dev_id, struct Dev **dev)
{
int i;
for (i = 0; devtab[i]; i++)
80002297: b8 3c 50 00 80 mov $0x8000503c,%eax
8000229c: eb 0c jmp 800022aa <dev_lookup+0x2a>
8000229e: b8 04 50 00 80 mov $0x80005004,%eax
800022a3: eb 05 jmp 800022aa <dev_lookup+0x2a>
800022a5: b8 20 50 00 80 mov $0x80005020,%eax
if (devtab[i]->dev_id == dev_id) {
*dev = devtab[i];
800022aa: 89 03 mov %eax,(%ebx)
return 0;
800022ac: b8 00 00 00 00 mov $0x0,%eax
800022b1: eb 36 jmp 800022e9 <dev_lookup+0x69>
int
dev_lookup(int dev_id, struct Dev **dev)
{
int i;
for (i = 0; devtab[i]; i++)
if (devtab[i]->dev_id == dev_id) {
800022b3: 3b 05 3c 50 00 80 cmp 0x8000503c,%eax
800022b9: 74 dc je 80002297 <dev_lookup+0x17>
800022bb: 3b 05 04 50 00 80 cmp 0x80005004,%eax
800022c1: 74 db je 8000229e <dev_lookup+0x1e>
*dev = devtab[i];
return 0;
}
cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
800022c3: 8b 15 20 64 00 80 mov 0x80006420,%edx
800022c9: 8b 52 48 mov 0x48(%edx),%edx
800022cc: 83 ec 04 sub $0x4,%esp
800022cf: 50 push %eax
800022d0: 52 push %edx
800022d1: 68 58 44 00 80 push $0x80004458
800022d6: e8 74 1c 00 00 call 80003f4f <cprintf>
*dev = 0;
800022db: c7 03 00 00 00 00 movl $0x0,(%ebx)
return -E_INVAL;
800022e1: 83 c4 10 add $0x10,%esp
800022e4: b8 fd ff ff ff mov $0xfffffffd,%eax
}
800022e9: 8b 5d fc mov -0x4(%ebp),%ebx
800022ec: c9 leave
800022ed: c3 ret
800022ee <fd_close>:
// If 'must_exist' is 1, then fd_close returns -E_INVAL when passed a
// closed or nonexistent file descriptor.
// Returns 0 on success, < 0 on error.
int
fd_close(struct Fd *fd, bool must_exist)
{
800022ee: 55 push %ebp
800022ef: 89 e5 mov %esp,%ebp
800022f1: 56 push %esi
800022f2: 53 push %ebx
800022f3: 83 ec 10 sub $0x10,%esp
800022f6: 8b 75 08 mov 0x8(%ebp),%esi
800022f9: 8b 5d 0c mov 0xc(%ebp),%ebx
struct Fd *fd2;
struct Dev *dev;
int r;
if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
800022fc: 8d 45 f4 lea -0xc(%ebp),%eax
800022ff: 50 push %eax
80002300: 8d 86 00 00 00 e0 lea -0x20000000(%esi),%eax
80002306: c1 e8 0c shr $0xc,%eax
80002309: 50 push %eax
8000230a: e8 1b ff ff ff call 8000222a <fd_lookup>
8000230f: 83 c4 08 add $0x8,%esp
80002312: 85 c0 test %eax,%eax
80002314: 78 05 js 8000231b <fd_close+0x2d>
|| fd != fd2)
80002316: 3b 75 f4 cmp -0xc(%ebp),%esi
80002319: 74 0c je 80002327 <fd_close+0x39>
return (must_exist ? r : 0);
8000231b: 84 db test %bl,%bl
8000231d: ba 00 00 00 00 mov $0x0,%edx
80002322: 0f 44 c2 cmove %edx,%eax
80002325: eb 41 jmp 80002368 <fd_close+0x7a>
if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
80002327: 83 ec 08 sub $0x8,%esp
8000232a: 8d 45 f0 lea -0x10(%ebp),%eax
8000232d: 50 push %eax
8000232e: ff 36 pushl (%esi)
80002330: e8 4b ff ff ff call 80002280 <dev_lookup>
80002335: 89 c3 mov %eax,%ebx
80002337: 83 c4 10 add $0x10,%esp
8000233a: 85 c0 test %eax,%eax
8000233c: 78 1a js 80002358 <fd_close+0x6a>
if (dev->dev_close)
8000233e: 8b 45 f0 mov -0x10(%ebp),%eax
80002341: 8b 40 10 mov 0x10(%eax),%eax
r = (*dev->dev_close)(fd);
else
r = 0;
80002344: bb 00 00 00 00 mov $0x0,%ebx
int r;
if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
|| fd != fd2)
return (must_exist ? r : 0);
if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
if (dev->dev_close)
80002349: 85 c0 test %eax,%eax
8000234b: 74 0b je 80002358 <fd_close+0x6a>
r = (*dev->dev_close)(fd);
8000234d: 83 ec 0c sub $0xc,%esp
80002350: 56 push %esi
80002351: ff d0 call *%eax
80002353: 89 c3 mov %eax,%ebx
80002355: 83 c4 10 add $0x10,%esp
else
r = 0;
}
// Make sure fd is unmapped. Might be a no-op if
// (*dev->dev_close)(fd) already unmapped it.
(void) sys_page_unmap(0, fd);
80002358: 83 ec 08 sub $0x8,%esp
8000235b: 56 push %esi
8000235c: 6a 00 push $0x0
8000235e: e8 2a fb ff ff call 80001e8d <sys_page_unmap>
return r;
80002363: 83 c4 10 add $0x10,%esp
80002366: 89 d8 mov %ebx,%eax
}
80002368: 8d 65 f8 lea -0x8(%ebp),%esp
8000236b: 5b pop %ebx
8000236c: 5e pop %esi
8000236d: 5d pop %ebp
8000236e: c3 ret
8000236f <close>:
return -E_INVAL;
}
int
close(int fdnum)
{
8000236f: 55 push %ebp
80002370: 89 e5 mov %esp,%ebp
80002372: 83 ec 18 sub $0x18,%esp
struct Fd *fd;
int r;
if ((r = fd_lookup(fdnum, &fd)) < 0)
80002375: 8d 45 f4 lea -0xc(%ebp),%eax
80002378: 50 push %eax
80002379: ff 75 08 pushl 0x8(%ebp)
8000237c: e8 a9 fe ff ff call 8000222a <fd_lookup>
80002381: 83 c4 08 add $0x8,%esp
80002384: 85 c0 test %eax,%eax
80002386: 78 10 js 80002398 <close+0x29>
return r;
else
return fd_close(fd, 1);
80002388: 83 ec 08 sub $0x8,%esp
8000238b: 6a 01 push $0x1
8000238d: ff 75 f4 pushl -0xc(%ebp)
80002390: e8 59 ff ff ff call 800022ee <fd_close>
80002395: 83 c4 10 add $0x10,%esp
}
80002398: c9 leave
80002399: c3 ret
8000239a <close_all>:
void
close_all(void)
{
8000239a: 55 push %ebp
8000239b: 89 e5 mov %esp,%ebp
8000239d: 53 push %ebx
8000239e: 83 ec 04 sub $0x4,%esp
int i;
for (i = 0; i < MAXFD; i++)
800023a1: bb 00 00 00 00 mov $0x0,%ebx
close(i);
800023a6: 83 ec 0c sub $0xc,%esp
800023a9: 53 push %ebx
800023aa: e8 c0 ff ff ff call 8000236f <close>
void
close_all(void)
{
int i;
for (i = 0; i < MAXFD; i++)
800023af: 83 c3 01 add $0x1,%ebx
800023b2: 83 c4 10 add $0x10,%esp
800023b5: 83 fb 20 cmp $0x20,%ebx
800023b8: 75 ec jne 800023a6 <close_all+0xc>
close(i);
}
800023ba: 8b 5d fc mov -0x4(%ebp),%ebx
800023bd: c9 leave
800023be: c3 ret
800023bf <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
800023bf: 55 push %ebp
800023c0: 89 e5 mov %esp,%ebp
800023c2: 57 push %edi
800023c3: 56 push %esi
800023c4: 53 push %ebx
800023c5: 83 ec 2c sub $0x2c,%esp
800023c8: 8b 75 0c mov 0xc(%ebp),%esi
int r;
char *ova, *nva;
struct Fd *oldfd, *newfd;
if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
800023cb: 8d 45 e4 lea -0x1c(%ebp),%eax
800023ce: 50 push %eax
800023cf: ff 75 08 pushl 0x8(%ebp)
800023d2: e8 53 fe ff ff call 8000222a <fd_lookup>
800023d7: 83 c4 08 add $0x8,%esp
800023da: 85 c0 test %eax,%eax
800023dc: 0f 88 bf 00 00 00 js 800024a1 <dup+0xe2>
return r;
close(newfdnum);
800023e2: 83 ec 0c sub $0xc,%esp
800023e5: 56 push %esi
800023e6: e8 84 ff ff ff call 8000236f <close>
newfd = INDEX2FD(newfdnum);
800023eb: 8d 9e 00 00 02 00 lea 0x20000(%esi),%ebx
800023f1: c1 e3 0c shl $0xc,%ebx
ova = fd2data(oldfd);
800023f4: 83 c4 04 add $0x4,%esp
800023f7: ff 75 e4 pushl -0x1c(%ebp)
800023fa: e8 9f fd ff ff call 8000219e <fd2data>
800023ff: 89 c7 mov %eax,%edi
nva = fd2data(newfd);
80002401: 89 1c 24 mov %ebx,(%esp)
80002404: e8 95 fd ff ff call 8000219e <fd2data>
80002409: 83 c4 10 add $0x10,%esp
8000240c: 89 45 d4 mov %eax,-0x2c(%ebp)
if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
8000240f: 89 f8 mov %edi,%eax
80002411: c1 e8 16 shr $0x16,%eax
80002414: 8b 04 85 00 d0 7b ef mov -0x10843000(,%eax,4),%eax
8000241b: a8 01 test $0x1,%al
8000241d: 74 37 je 80002456 <dup+0x97>
8000241f: 89 f8 mov %edi,%eax
80002421: c1 e8 0c shr $0xc,%eax
80002424: 8b 14 85 00 00 40 ef mov -0x10c00000(,%eax,4),%edx
8000242b: f6 c2 01 test $0x1,%dl
8000242e: 74 26 je 80002456 <dup+0x97>
if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
80002430: 8b 04 85 00 00 40 ef mov -0x10c00000(,%eax,4),%eax
80002437: 83 ec 0c sub $0xc,%esp
8000243a: 25 07 0e 00 00 and $0xe07,%eax
8000243f: 50 push %eax
80002440: ff 75 d4 pushl -0x2c(%ebp)
80002443: 6a 00 push $0x0
80002445: 57 push %edi
80002446: 6a 00 push $0x0
80002448: e8 fe f9 ff ff call 80001e4b <sys_page_map>
8000244d: 89 c7 mov %eax,%edi
8000244f: 83 c4 20 add $0x20,%esp
80002452: 85 c0 test %eax,%eax
80002454: 78 2e js 80002484 <dup+0xc5>
goto err;
if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
80002456: 8b 55 e4 mov -0x1c(%ebp),%edx
80002459: 89 d0 mov %edx,%eax
8000245b: c1 e8 0c shr $0xc,%eax
8000245e: 8b 04 85 00 00 40 ef mov -0x10c00000(,%eax,4),%eax
80002465: 83 ec 0c sub $0xc,%esp
80002468: 25 07 0e 00 00 and $0xe07,%eax
8000246d: 50 push %eax
8000246e: 53 push %ebx
8000246f: 6a 00 push $0x0
80002471: 52 push %edx
80002472: 6a 00 push $0x0
80002474: e8 d2 f9 ff ff call 80001e4b <sys_page_map>
80002479: 89 c7 mov %eax,%edi
8000247b: 83 c4 20 add $0x20,%esp
goto err;
return newfdnum;
8000247e: 89 f0 mov %esi,%eax
nva = fd2data(newfd);
if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
goto err;
if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
80002480: 85 ff test %edi,%edi
80002482: 79 1d jns 800024a1 <dup+0xe2>
goto err;
return newfdnum;
err:
sys_page_unmap(0, newfd);
80002484: 83 ec 08 sub $0x8,%esp
80002487: 53 push %ebx
80002488: 6a 00 push $0x0
8000248a: e8 fe f9 ff ff call 80001e8d <sys_page_unmap>
sys_page_unmap(0, nva);
8000248f: 83 c4 08 add $0x8,%esp
80002492: ff 75 d4 pushl -0x2c(%ebp)
80002495: 6a 00 push $0x0
80002497: e8 f1 f9 ff ff call 80001e8d <sys_page_unmap>
return r;
8000249c: 83 c4 10 add $0x10,%esp
8000249f: 89 f8 mov %edi,%eax
}
800024a1: 8d 65 f4 lea -0xc(%ebp),%esp
800024a4: 5b pop %ebx
800024a5: 5e pop %esi
800024a6: 5f pop %edi
800024a7: 5d pop %ebp
800024a8: c3 ret
800024a9 <read>:
ssize_t
read(int fdnum, void *buf, size_t n)
{
800024a9: 55 push %ebp
800024aa: 89 e5 mov %esp,%ebp
800024ac: 53 push %ebx
800024ad: 83 ec 14 sub $0x14,%esp
800024b0: 8b 5d 08 mov 0x8(%ebp),%ebx
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
800024b3: 8d 45 f0 lea -0x10(%ebp),%eax
800024b6: 50 push %eax
800024b7: 53 push %ebx
800024b8: e8 6d fd ff ff call 8000222a <fd_lookup>
800024bd: 83 c4 08 add $0x8,%esp
800024c0: 89 c2 mov %eax,%edx
800024c2: 85 c0 test %eax,%eax
800024c4: 78 6d js 80002533 <read+0x8a>
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
800024c6: 83 ec 08 sub $0x8,%esp
800024c9: 8d 45 f4 lea -0xc(%ebp),%eax
800024cc: 50 push %eax
800024cd: 8b 45 f0 mov -0x10(%ebp),%eax
800024d0: ff 30 pushl (%eax)
800024d2: e8 a9 fd ff ff call 80002280 <dev_lookup>
800024d7: 83 c4 10 add $0x10,%esp
800024da: 85 c0 test %eax,%eax
800024dc: 78 4c js 8000252a <read+0x81>
return r;
if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
800024de: 8b 55 f0 mov -0x10(%ebp),%edx
800024e1: 8b 42 08 mov 0x8(%edx),%eax
800024e4: 83 e0 03 and $0x3,%eax
800024e7: 83 f8 01 cmp $0x1,%eax
800024ea: 75 21 jne 8000250d <read+0x64>
cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
800024ec: a1 20 64 00 80 mov 0x80006420,%eax
800024f1: 8b 40 48 mov 0x48(%eax),%eax
800024f4: 83 ec 04 sub $0x4,%esp
800024f7: 53 push %ebx
800024f8: 50 push %eax
800024f9: 68 99 44 00 80 push $0x80004499
800024fe: e8 4c 1a 00 00 call 80003f4f <cprintf>
return -E_INVAL;
80002503: 83 c4 10 add $0x10,%esp
80002506: ba fd ff ff ff mov $0xfffffffd,%edx
8000250b: eb 26 jmp 80002533 <read+0x8a>
}
if (!dev->dev_read)
8000250d: 8b 45 f4 mov -0xc(%ebp),%eax
80002510: 8b 40 08 mov 0x8(%eax),%eax
80002513: 85 c0 test %eax,%eax
80002515: 74 17 je 8000252e <read+0x85>
return -E_NOT_SUPP;
return (*dev->dev_read)(fd, buf, n);
80002517: 83 ec 04 sub $0x4,%esp
8000251a: ff 75 10 pushl 0x10(%ebp)
8000251d: ff 75 0c pushl 0xc(%ebp)
80002520: 52 push %edx
80002521: ff d0 call *%eax
80002523: 89 c2 mov %eax,%edx
80002525: 83 c4 10 add $0x10,%esp
80002528: eb 09 jmp 80002533 <read+0x8a>
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
8000252a: 89 c2 mov %eax,%edx
8000252c: eb 05 jmp 80002533 <read+0x8a>
if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
return -E_INVAL;
}
if (!dev->dev_read)
return -E_NOT_SUPP;
8000252e: ba ef ff ff ff mov $0xffffffef,%edx
return (*dev->dev_read)(fd, buf, n);
}
80002533: 89 d0 mov %edx,%eax
80002535: 8b 5d fc mov -0x4(%ebp),%ebx
80002538: c9 leave
80002539: c3 ret
8000253a <readn>:
ssize_t
readn(int fdnum, void *buf, size_t n)
{
8000253a: 55 push %ebp
8000253b: 89 e5 mov %esp,%ebp
8000253d: 57 push %edi
8000253e: 56 push %esi
8000253f: 53 push %ebx
80002540: 83 ec 0c sub $0xc,%esp
80002543: 8b 7d 08 mov 0x8(%ebp),%edi
80002546: 8b 75 10 mov 0x10(%ebp),%esi
int m, tot;
for (tot = 0; tot < n; tot += m) {
80002549: 85 f6 test %esi,%esi
8000254b: 74 31 je 8000257e <readn+0x44>
8000254d: b8 00 00 00 00 mov $0x0,%eax
80002552: bb 00 00 00 00 mov $0x0,%ebx
m = read(fdnum, (char*)buf + tot, n - tot);
80002557: 83 ec 04 sub $0x4,%esp
8000255a: 89 f2 mov %esi,%edx
8000255c: 29 c2 sub %eax,%edx
8000255e: 52 push %edx
8000255f: 03 45 0c add 0xc(%ebp),%eax
80002562: 50 push %eax
80002563: 57 push %edi
80002564: e8 40 ff ff ff call 800024a9 <read>
if (m < 0)
80002569: 83 c4 10 add $0x10,%esp
8000256c: 85 c0 test %eax,%eax
8000256e: 78 17 js 80002587 <readn+0x4d>
return m;
if (m == 0)
80002570: 85 c0 test %eax,%eax
80002572: 74 11 je 80002585 <readn+0x4b>
ssize_t
readn(int fdnum, void *buf, size_t n)
{
int m, tot;
for (tot = 0; tot < n; tot += m) {
80002574: 01 c3 add %eax,%ebx
80002576: 89 d8 mov %ebx,%eax
80002578: 39 f3 cmp %esi,%ebx
8000257a: 72 db jb 80002557 <readn+0x1d>
8000257c: eb 09 jmp 80002587 <readn+0x4d>
8000257e: b8 00 00 00 00 mov $0x0,%eax
80002583: eb 02 jmp 80002587 <readn+0x4d>
80002585: 89 d8 mov %ebx,%eax
return m;
if (m == 0)
break;
}
return tot;
}
80002587: 8d 65 f4 lea -0xc(%ebp),%esp
8000258a: 5b pop %ebx
8000258b: 5e pop %esi
8000258c: 5f pop %edi
8000258d: 5d pop %ebp
8000258e: c3 ret
8000258f <write>:
ssize_t
write(int fdnum, const void *buf, size_t n)
{
8000258f: 55 push %ebp
80002590: 89 e5 mov %esp,%ebp
80002592: 53 push %ebx
80002593: 83 ec 14 sub $0x14,%esp
80002596: 8b 5d 08 mov 0x8(%ebp),%ebx
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
80002599: 8d 45 f0 lea -0x10(%ebp),%eax
8000259c: 50 push %eax
8000259d: 53 push %ebx
8000259e: e8 87 fc ff ff call 8000222a <fd_lookup>
800025a3: 83 c4 08 add $0x8,%esp
800025a6: 89 c2 mov %eax,%edx
800025a8: 85 c0 test %eax,%eax
800025aa: 78 68 js 80002614 <write+0x85>
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
800025ac: 83 ec 08 sub $0x8,%esp
800025af: 8d 45 f4 lea -0xc(%ebp),%eax
800025b2: 50 push %eax
800025b3: 8b 45 f0 mov -0x10(%ebp),%eax
800025b6: ff 30 pushl (%eax)
800025b8: e8 c3 fc ff ff call 80002280 <dev_lookup>
800025bd: 83 c4 10 add $0x10,%esp
800025c0: 85 c0 test %eax,%eax
800025c2: 78 47 js 8000260b <write+0x7c>
return r;
if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
800025c4: 8b 45 f0 mov -0x10(%ebp),%eax
800025c7: f6 40 08 03 testb $0x3,0x8(%eax)
800025cb: 75 21 jne 800025ee <write+0x5f>
cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
800025cd: a1 20 64 00 80 mov 0x80006420,%eax
800025d2: 8b 40 48 mov 0x48(%eax),%eax
800025d5: 83 ec 04 sub $0x4,%esp
800025d8: 53 push %ebx
800025d9: 50 push %eax
800025da: 68 b5 44 00 80 push $0x800044b5
800025df: e8 6b 19 00 00 call 80003f4f <cprintf>
return -E_INVAL;
800025e4: 83 c4 10 add $0x10,%esp
800025e7: ba fd ff ff ff mov $0xfffffffd,%edx
800025ec: eb 26 jmp 80002614 <write+0x85>
}
if (debug)
cprintf("write %d %p %d via dev %s\n",
fdnum, buf, n, dev->dev_name);
if (!dev->dev_write)
800025ee: 8b 55 f4 mov -0xc(%ebp),%edx
800025f1: 8b 52 0c mov 0xc(%edx),%edx
800025f4: 85 d2 test %edx,%edx
800025f6: 74 17 je 8000260f <write+0x80>
return -E_NOT_SUPP;
return (*dev->dev_write)(fd, buf, n);
800025f8: 83 ec 04 sub $0x4,%esp
800025fb: ff 75 10 pushl 0x10(%ebp)
800025fe: ff 75 0c pushl 0xc(%ebp)
80002601: 50 push %eax
80002602: ff d2 call *%edx
80002604: 89 c2 mov %eax,%edx
80002606: 83 c4 10 add $0x10,%esp
80002609: eb 09 jmp 80002614 <write+0x85>
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
8000260b: 89 c2 mov %eax,%edx
8000260d: eb 05 jmp 80002614 <write+0x85>
}
if (debug)
cprintf("write %d %p %d via dev %s\n",
fdnum, buf, n, dev->dev_name);
if (!dev->dev_write)
return -E_NOT_SUPP;
8000260f: ba ef ff ff ff mov $0xffffffef,%edx
return (*dev->dev_write)(fd, buf, n);
}
80002614: 89 d0 mov %edx,%eax
80002616: 8b 5d fc mov -0x4(%ebp),%ebx
80002619: c9 leave
8000261a: c3 ret
8000261b <seek>:
int
seek(int fdnum, off_t offset)
{
8000261b: 55 push %ebp
8000261c: 89 e5 mov %esp,%ebp
8000261e: 83 ec 10 sub $0x10,%esp
int r;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0)
80002621: 8d 45 fc lea -0x4(%ebp),%eax
80002624: 50 push %eax
80002625: ff 75 08 pushl 0x8(%ebp)
80002628: e8 fd fb ff ff call 8000222a <fd_lookup>
8000262d: 83 c4 08 add $0x8,%esp
80002630: 85 c0 test %eax,%eax
80002632: 78 0e js 80002642 <seek+0x27>
return r;
fd->fd_offset = offset;
80002634: 8b 45 fc mov -0x4(%ebp),%eax
80002637: 8b 55 0c mov 0xc(%ebp),%edx
8000263a: 89 50 04 mov %edx,0x4(%eax)
return 0;
8000263d: b8 00 00 00 00 mov $0x0,%eax
}
80002642: c9 leave
80002643: c3 ret
80002644 <ftruncate>:
int
ftruncate(int fdnum, off_t newsize)
{
80002644: 55 push %ebp
80002645: 89 e5 mov %esp,%ebp
80002647: 53 push %ebx
80002648: 83 ec 14 sub $0x14,%esp
8000264b: 8b 5d 08 mov 0x8(%ebp),%ebx
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
8000264e: 8d 45 f0 lea -0x10(%ebp),%eax
80002651: 50 push %eax
80002652: 53 push %ebx
80002653: e8 d2 fb ff ff call 8000222a <fd_lookup>
80002658: 83 c4 08 add $0x8,%esp
8000265b: 89 c2 mov %eax,%edx
8000265d: 85 c0 test %eax,%eax
8000265f: 78 65 js 800026c6 <ftruncate+0x82>
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
80002661: 83 ec 08 sub $0x8,%esp
80002664: 8d 45 f4 lea -0xc(%ebp),%eax
80002667: 50 push %eax
80002668: 8b 45 f0 mov -0x10(%ebp),%eax
8000266b: ff 30 pushl (%eax)
8000266d: e8 0e fc ff ff call 80002280 <dev_lookup>
80002672: 83 c4 10 add $0x10,%esp
80002675: 85 c0 test %eax,%eax
80002677: 78 44 js 800026bd <ftruncate+0x79>
return r;
if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
80002679: 8b 45 f0 mov -0x10(%ebp),%eax
8000267c: f6 40 08 03 testb $0x3,0x8(%eax)
80002680: 75 21 jne 800026a3 <ftruncate+0x5f>
cprintf("[%08x] ftruncate %d -- bad mode\n",
thisenv->env_id, fdnum);
80002682: a1 20 64 00 80 mov 0x80006420,%eax
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
return r;
if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
cprintf("[%08x] ftruncate %d -- bad mode\n",
80002687: 8b 40 48 mov 0x48(%eax),%eax
8000268a: 83 ec 04 sub $0x4,%esp
8000268d: 53 push %ebx
8000268e: 50 push %eax
8000268f: 68 78 44 00 80 push $0x80004478
80002694: e8 b6 18 00 00 call 80003f4f <cprintf>
thisenv->env_id, fdnum);
return -E_INVAL;
80002699: 83 c4 10 add $0x10,%esp
8000269c: ba fd ff ff ff mov $0xfffffffd,%edx
800026a1: eb 23 jmp 800026c6 <ftruncate+0x82>
}
if (!dev->dev_trunc)
800026a3: 8b 55 f4 mov -0xc(%ebp),%edx
800026a6: 8b 52 18 mov 0x18(%edx),%edx
800026a9: 85 d2 test %edx,%edx
800026ab: 74 14 je 800026c1 <ftruncate+0x7d>
return -E_NOT_SUPP;
return (*dev->dev_trunc)(fd, newsize);
800026ad: 83 ec 08 sub $0x8,%esp
800026b0: ff 75 0c pushl 0xc(%ebp)
800026b3: 50 push %eax
800026b4: ff d2 call *%edx
800026b6: 89 c2 mov %eax,%edx
800026b8: 83 c4 10 add $0x10,%esp
800026bb: eb 09 jmp 800026c6 <ftruncate+0x82>
{
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
800026bd: 89 c2 mov %eax,%edx
800026bf: eb 05 jmp 800026c6 <ftruncate+0x82>
cprintf("[%08x] ftruncate %d -- bad mode\n",
thisenv->env_id, fdnum);
return -E_INVAL;
}
if (!dev->dev_trunc)
return -E_NOT_SUPP;
800026c1: ba ef ff ff ff mov $0xffffffef,%edx
return (*dev->dev_trunc)(fd, newsize);
}
800026c6: 89 d0 mov %edx,%eax
800026c8: 8b 5d fc mov -0x4(%ebp),%ebx
800026cb: c9 leave
800026cc: c3 ret
800026cd <fstat>:
int
fstat(int fdnum, struct Stat *stat)
{
800026cd: 55 push %ebp
800026ce: 89 e5 mov %esp,%ebp
800026d0: 53 push %ebx
800026d1: 83 ec 14 sub $0x14,%esp
800026d4: 8b 5d 0c mov 0xc(%ebp),%ebx
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
800026d7: 8d 45 f0 lea -0x10(%ebp),%eax
800026da: 50 push %eax
800026db: ff 75 08 pushl 0x8(%ebp)
800026de: e8 47 fb ff ff call 8000222a <fd_lookup>
800026e3: 83 c4 08 add $0x8,%esp
800026e6: 89 c2 mov %eax,%edx
800026e8: 85 c0 test %eax,%eax
800026ea: 78 4f js 8000273b <fstat+0x6e>
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
800026ec: 83 ec 08 sub $0x8,%esp
800026ef: 8d 45 f4 lea -0xc(%ebp),%eax
800026f2: 50 push %eax
800026f3: 8b 45 f0 mov -0x10(%ebp),%eax
800026f6: ff 30 pushl (%eax)
800026f8: e8 83 fb ff ff call 80002280 <dev_lookup>
800026fd: 83 c4 10 add $0x10,%esp
80002700: 85 c0 test %eax,%eax
80002702: 78 2e js 80002732 <fstat+0x65>
return r;
if (!dev->dev_stat)
80002704: 8b 45 f4 mov -0xc(%ebp),%eax
80002707: 83 78 14 00 cmpl $0x0,0x14(%eax)
8000270b: 74 29 je 80002736 <fstat+0x69>
return -E_NOT_SUPP;
stat->st_name[0] = 0;
8000270d: c6 03 00 movb $0x0,(%ebx)
stat->st_size = 0;
80002710: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx)
stat->st_isdir = 0;
80002717: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx)
stat->st_dev = dev;
8000271e: 89 43 18 mov %eax,0x18(%ebx)
return (*dev->dev_stat)(fd, stat);
80002721: 83 ec 08 sub $0x8,%esp
80002724: 53 push %ebx
80002725: ff 75 f0 pushl -0x10(%ebp)
80002728: ff 50 14 call *0x14(%eax)
8000272b: 89 c2 mov %eax,%edx
8000272d: 83 c4 10 add $0x10,%esp
80002730: eb 09 jmp 8000273b <fstat+0x6e>
int r;
struct Dev *dev;
struct Fd *fd;
if ((r = fd_lookup(fdnum, &fd)) < 0
|| (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
80002732: 89 c2 mov %eax,%edx
80002734: eb 05 jmp 8000273b <fstat+0x6e>
return r;
if (!dev->dev_stat)
return -E_NOT_SUPP;
80002736: ba ef ff ff ff mov $0xffffffef,%edx
stat->st_name[0] = 0;
stat->st_size = 0;
stat->st_isdir = 0;
stat->st_dev = dev;
return (*dev->dev_stat)(fd, stat);
}
8000273b: 89 d0 mov %edx,%eax
8000273d: 8b 5d fc mov -0x4(%ebp),%ebx
80002740: c9 leave
80002741: c3 ret
80002742 <stat>:
int
stat(const char *path, struct Stat *stat)
{
80002742: 55 push %ebp
80002743: 89 e5 mov %esp,%ebp
80002745: 56 push %esi
80002746: 53 push %ebx
int fd, r;
if ((fd = open(path, O_RDONLY)) < 0)
80002747: 83 ec 08 sub $0x8,%esp
8000274a: 6a 00 push $0x0
8000274c: ff 75 08 pushl 0x8(%ebp)
8000274f: e8 a5 01 00 00 call 800028f9 <open>
80002754: 89 c3 mov %eax,%ebx
80002756: 83 c4 10 add $0x10,%esp
80002759: 85 c0 test %eax,%eax
8000275b: 78 1b js 80002778 <stat+0x36>
return fd;
r = fstat(fd, stat);
8000275d: 83 ec 08 sub $0x8,%esp
80002760: ff 75 0c pushl 0xc(%ebp)
80002763: 50 push %eax
80002764: e8 64 ff ff ff call 800026cd <fstat>
80002769: 89 c6 mov %eax,%esi
close(fd);
8000276b: 89 1c 24 mov %ebx,(%esp)
8000276e: e8 fc fb ff ff call 8000236f <close>
return r;
80002773: 83 c4 10 add $0x10,%esp
80002776: 89 f0 mov %esi,%eax
}
80002778: 8d 65 f8 lea -0x8(%ebp),%esp
8000277b: 5b pop %ebx
8000277c: 5e pop %esi
8000277d: 5d pop %ebp
8000277e: c3 ret
8000277f <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
8000277f: 55 push %ebp
80002780: 89 e5 mov %esp,%ebp
80002782: 56 push %esi
80002783: 53 push %ebx
80002784: 89 c6 mov %eax,%esi
80002786: 89 d3 mov %edx,%ebx
static envid_t fsenv;
if (fsenv == 0)
80002788: 83 3d 14 60 00 80 00 cmpl $0x0,0x80006014
8000278f: 75 12 jne 800027a3 <fsipc+0x24>
fsenv = ipc_find_env(ENV_TYPE_FS);
80002791: 83 ec 0c sub $0xc,%esp
80002794: 6a 01 push $0x1
80002796: e8 4b 06 00 00 call 80002de6 <ipc_find_env>
8000279b: a3 14 60 00 80 mov %eax,0x80006014
800027a0: 83 c4 10 add $0x10,%esp
if (debug)
cprintf("[%08x] fsipc %d %08x\n",
thisenv->env_id, type, *(uint32_t *)&fsipcbuf);
ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
800027a3: 6a 07 push $0x7
800027a5: 68 00 70 00 80 push $0x80007000
800027aa: 56 push %esi
800027ab: ff 35 14 60 00 80 pushl 0x80006014
800027b1: e8 dc 05 00 00 call 80002d92 <ipc_send>
return ipc_recv(NULL, dstva, NULL);
800027b6: 83 c4 0c add $0xc,%esp
800027b9: 6a 00 push $0x0
800027bb: 53 push %ebx
800027bc: 6a 00 push $0x0
800027be: e8 4e 05 00 00 call 80002d11 <ipc_recv>
}
800027c3: 8d 65 f8 lea -0x8(%ebp),%esp
800027c6: 5b pop %ebx
800027c7: 5e pop %esi
800027c8: 5d pop %ebp
800027c9: c3 ret
800027ca <devfile_trunc>:
}
// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
800027ca: 55 push %ebp
800027cb: 89 e5 mov %esp,%ebp
800027cd: 83 ec 08 sub $0x8,%esp
fsipcbuf.set_size.req_fileid = fd->fd_file.id;
800027d0: 8b 45 08 mov 0x8(%ebp),%eax
800027d3: 8b 40 0c mov 0xc(%eax),%eax
800027d6: a3 00 70 00 80 mov %eax,0x80007000
fsipcbuf.set_size.req_size = newsize;
800027db: 8b 45 0c mov 0xc(%ebp),%eax
800027de: a3 04 70 00 80 mov %eax,0x80007004
return fsipc(FSREQ_SET_SIZE, NULL);
800027e3: ba 00 00 00 00 mov $0x0,%edx
800027e8: b8 02 00 00 00 mov $0x2,%eax
800027ed: e8 8d ff ff ff call 8000277f <fsipc>
}
800027f2: c9 leave
800027f3: c3 ret
800027f4 <devfile_flush>:
// open, unmapping it is enough to free up server-side resources.
// Other than that, we just have to make sure our changes are flushed
// to disk.
static int
devfile_flush(struct Fd *fd)
{
800027f4: 55 push %ebp
800027f5: 89 e5 mov %esp,%ebp
800027f7: 83 ec 08 sub $0x8,%esp
fsipcbuf.flush.req_fileid = fd->fd_file.id;
800027fa: 8b 45 08 mov 0x8(%ebp),%eax
800027fd: 8b 40 0c mov 0xc(%eax),%eax
80002800: a3 00 70 00 80 mov %eax,0x80007000
return fsipc(FSREQ_FLUSH, NULL);
80002805: ba 00 00 00 00 mov $0x0,%edx
8000280a: b8 06 00 00 00 mov $0x6,%eax
8000280f: e8 6b ff ff ff call 8000277f <fsipc>
}
80002814: c9 leave
80002815: c3 ret
80002816 <devfile_stat>:
return fsipc(FSREQ_WRITE, NULL);
}
static int
devfile_stat(struct Fd *fd, struct Stat *st)
{
80002816: 55 push %ebp
80002817: 89 e5 mov %esp,%ebp
80002819: 53 push %ebx
8000281a: 83 ec 04 sub $0x4,%esp
8000281d: 8b 5d 0c mov 0xc(%ebp),%ebx
int r;
fsipcbuf.stat.req_fileid = fd->fd_file.id;
80002820: 8b 45 08 mov 0x8(%ebp),%eax
80002823: 8b 40 0c mov 0xc(%eax),%eax
80002826: a3 00 70 00 80 mov %eax,0x80007000
if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
8000282b: ba 00 00 00 00 mov $0x0,%edx
80002830: b8 05 00 00 00 mov $0x5,%eax
80002835: e8 45 ff ff ff call 8000277f <fsipc>
8000283a: 85 c0 test %eax,%eax
8000283c: 78 26 js 80002864 <devfile_stat+0x4e>
return r;
strcpy(st->st_name, fsipcbuf.statRet.ret_name);
8000283e: 83 ec 08 sub $0x8,%esp
80002841: 68 00 70 00 80 push $0x80007000
80002846: 53 push %ebx
80002847: e8 d9 f0 ff ff call 80001925 <strcpy>
st->st_size = fsipcbuf.statRet.ret_size;
8000284c: a1 10 70 00 80 mov 0x80007010,%eax
80002851: 89 43 10 mov %eax,0x10(%ebx)
st->st_isdir = fsipcbuf.statRet.ret_isdir;
80002854: a1 14 70 00 80 mov 0x80007014,%eax
80002859: 89 43 14 mov %eax,0x14(%ebx)
return 0;
8000285c: 83 c4 10 add $0x10,%esp
8000285f: b8 00 00 00 00 mov $0x0,%eax
}
80002864: 8b 5d fc mov -0x4(%ebp),%ebx
80002867: c9 leave
80002868: c3 ret
80002869 <devfile_write>:
// Returns:
// The number of bytes successfully written.
// < 0 on error.
static ssize_t
devfile_write(struct Fd *fd, const void *buf, size_t n)
{
80002869: 55 push %ebp
8000286a: 89 e5 mov %esp,%ebp
8000286c: 83 ec 0c sub $0xc,%esp
8000286f: 8b 45 10 mov 0x10(%ebp),%eax
// remember that write is always allowed to write *fewer*
// bytes than requested.
// LAB 5: Your code here
// panic("devfile_write not implemented");
int max = PGSIZE - (sizeof(int) + sizeof(size_t));
n = n > max ? max : n;
80002872: 3d f8 0f 00 00 cmp $0xff8,%eax
80002877: ba f8 0f 00 00 mov $0xff8,%edx
8000287c: 0f 47 c2 cmova %edx,%eax
fsipcbuf.write.req_fileid = fd->fd_file.id;
8000287f: 8b 55 08 mov 0x8(%ebp),%edx
80002882: 8b 52 0c mov 0xc(%edx),%edx
80002885: 89 15 00 70 00 80 mov %edx,0x80007000
fsipcbuf.write.req_n = n;
8000288b: a3 04 70 00 80 mov %eax,0x80007004
memmove(fsipcbuf.write.req_buf, buf, n);
80002890: 50 push %eax
80002891: ff 75 0c pushl 0xc(%ebp)
80002894: 68 08 70 00 80 push $0x80007008
80002899: e8 76 f2 ff ff call 80001b14 <memmove>
return fsipc(FSREQ_WRITE, NULL);
8000289e: ba 00 00 00 00 mov $0x0,%edx
800028a3: b8 04 00 00 00 mov $0x4,%eax
800028a8: e8 d2 fe ff ff call 8000277f <fsipc>
}
800028ad: c9 leave
800028ae: c3 ret
800028af <devfile_read>:
// Returns:
// The number of bytes successfully read.
// < 0 on error.
static ssize_t
devfile_read(struct Fd *fd, void *buf, size_t n)
{
800028af: 55 push %ebp
800028b0: 89 e5 mov %esp,%ebp
800028b2: 53 push %ebx
800028b3: 83 ec 04 sub $0x4,%esp
// filling fsipcbuf.read with the request arguments. The
// bytes read will be written back to fsipcbuf by the file
// system server.
int r;
fsipcbuf.read.req_fileid = fd->fd_file.id;
800028b6: 8b 45 08 mov 0x8(%ebp),%eax
800028b9: 8b 40 0c mov 0xc(%eax),%eax
800028bc: a3 00 70 00 80 mov %eax,0x80007000
fsipcbuf.read.req_n = n;
800028c1: 8b 45 10 mov 0x10(%ebp),%eax
800028c4: a3 04 70 00 80 mov %eax,0x80007004
if ((r = fsipc(FSREQ_READ, NULL)) < 0)
800028c9: ba 00 00 00 00 mov $0x0,%edx
800028ce: b8 03 00 00 00 mov $0x3,%eax
800028d3: e8 a7 fe ff ff call 8000277f <fsipc>
800028d8: 89 c3 mov %eax,%ebx
800028da: 85 c0 test %eax,%eax
800028dc: 78 14 js 800028f2 <devfile_read+0x43>
return r;
memmove(buf, fsipcbuf.readRet.ret_buf, r);
800028de: 83 ec 04 sub $0x4,%esp
800028e1: 50 push %eax
800028e2: 68 00 70 00 80 push $0x80007000
800028e7: ff 75 0c pushl 0xc(%ebp)
800028ea: e8 25 f2 ff ff call 80001b14 <memmove>
return r;
800028ef: 83 c4 10 add $0x10,%esp
}
800028f2: 89 d8 mov %ebx,%eax
800028f4: 8b 5d fc mov -0x4(%ebp),%ebx
800028f7: c9 leave
800028f8: c3 ret
800028f9 <open>:
// The file descriptor index on success
// -E_BAD_PATH if the path is too long (>= MAXPATHLEN)
// < 0 for other errors.
int
open(const char *path, int mode)
{
800028f9: 55 push %ebp
800028fa: 89 e5 mov %esp,%ebp
800028fc: 53 push %ebx
800028fd: 83 ec 20 sub $0x20,%esp
80002900: 8b 5d 08 mov 0x8(%ebp),%ebx
// file descriptor.
int r;
struct Fd *fd;
if (strlen(path) >= MAXPATHLEN)
80002903: 53 push %ebx
80002904: e8 c1 ef ff ff call 800018ca <strlen>
80002909: 83 c4 10 add $0x10,%esp
8000290c: 83 f8 7f cmp $0x7f,%eax
8000290f: 7f 67 jg 80002978 <open+0x7f>
return -E_BAD_PATH;
if ((r = fd_alloc(&fd)) < 0)
80002911: 83 ec 0c sub $0xc,%esp
80002914: 8d 45 f4 lea -0xc(%ebp),%eax
80002917: 50 push %eax
80002918: e8 99 f8 ff ff call 800021b6 <fd_alloc>
8000291d: 83 c4 10 add $0x10,%esp
return r;
80002920: 89 c2 mov %eax,%edx
struct Fd *fd;
if (strlen(path) >= MAXPATHLEN)
return -E_BAD_PATH;
if ((r = fd_alloc(&fd)) < 0)
80002922: 85 c0 test %eax,%eax
80002924: 78 57 js 8000297d <open+0x84>
return r;
strcpy(fsipcbuf.open.req_path, path);
80002926: 83 ec 08 sub $0x8,%esp
80002929: 53 push %ebx
8000292a: 68 00 70 00 80 push $0x80007000
8000292f: e8 f1 ef ff ff call 80001925 <strcpy>
fsipcbuf.open.req_omode = mode;
80002934: 8b 45 0c mov 0xc(%ebp),%eax
80002937: a3 80 70 00 80 mov %eax,0x80007080
if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
8000293c: 8b 55 f4 mov -0xc(%ebp),%edx
8000293f: b8 01 00 00 00 mov $0x1,%eax
80002944: e8 36 fe ff ff call 8000277f <fsipc>
80002949: 89 c3 mov %eax,%ebx
8000294b: 83 c4 10 add $0x10,%esp
8000294e: 85 c0 test %eax,%eax
80002950: 79 14 jns 80002966 <open+0x6d>
fd_close(fd, 0);
80002952: 83 ec 08 sub $0x8,%esp
80002955: 6a 00 push $0x0
80002957: ff 75 f4 pushl -0xc(%ebp)
8000295a: e8 8f f9 ff ff call 800022ee <fd_close>
return r;
8000295f: 83 c4 10 add $0x10,%esp
80002962: 89 da mov %ebx,%edx
80002964: eb 17 jmp 8000297d <open+0x84>
}
return fd2num(fd);
80002966: 83 ec 0c sub $0xc,%esp
80002969: ff 75 f4 pushl -0xc(%ebp)
8000296c: e8 1d f8 ff ff call 8000218e <fd2num>
80002971: 89 c2 mov %eax,%edx
80002973: 83 c4 10 add $0x10,%esp
80002976: eb 05 jmp 8000297d <open+0x84>
int r;
struct Fd *fd;
if (strlen(path) >= MAXPATHLEN)
return -E_BAD_PATH;
80002978: ba f3 ff ff ff mov $0xfffffff3,%edx
fd_close(fd, 0);
return r;
}
return fd2num(fd);
}
8000297d: 89 d0 mov %edx,%eax
8000297f: 8b 5d fc mov -0x4(%ebp),%ebx
80002982: c9 leave
80002983: c3 ret
80002984 <sync>:
// Synchronize disk with buffer cache
int
sync(void)
{
80002984: 55 push %ebp
80002985: 89 e5 mov %esp,%ebp
80002987: 83 ec 08 sub $0x8,%esp
// Ask the file server to update the disk
// by writing any dirty blocks in the buffer cache.
return fsipc(FSREQ_SYNC, NULL);
8000298a: ba 00 00 00 00 mov $0x0,%edx
8000298f: b8 09 00 00 00 mov $0x9,%eax
80002994: e8 e6 fd ff ff call 8000277f <fsipc>
}
80002999: c9 leave
8000299a: c3 ret
8000299b <devpipe_stat>:
return i;
}
static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
8000299b: 55 push %ebp
8000299c: 89 e5 mov %esp,%ebp
8000299e: 56 push %esi
8000299f: 53 push %ebx
800029a0: 8b 5d 0c mov 0xc(%ebp),%ebx
struct Pipe *p = (struct Pipe*) fd2data(fd);
800029a3: 83 ec 0c sub $0xc,%esp
800029a6: ff 75 08 pushl 0x8(%ebp)
800029a9: e8 f0 f7 ff ff call 8000219e <fd2data>
800029ae: 89 c6 mov %eax,%esi
strcpy(stat->st_name, "<pipe>");
800029b0: 83 c4 08 add $0x8,%esp
800029b3: 68 d2 44 00 80 push $0x800044d2
800029b8: 53 push %ebx
800029b9: e8 67 ef ff ff call 80001925 <strcpy>
stat->st_size = p->p_wpos - p->p_rpos;
800029be: 8b 46 04 mov 0x4(%esi),%eax
800029c1: 2b 06 sub (%esi),%eax
800029c3: 89 43 10 mov %eax,0x10(%ebx)
stat->st_isdir = 0;
800029c6: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx)
stat->st_dev = &devpipe;
800029cd: c7 43 18 3c 50 00 80 movl $0x8000503c,0x18(%ebx)
return 0;
}
800029d4: b8 00 00 00 00 mov $0x0,%eax
800029d9: 8d 65 f8 lea -0x8(%ebp),%esp
800029dc: 5b pop %ebx
800029dd: 5e pop %esi
800029de: 5d pop %ebp
800029df: c3 ret
800029e0 <devpipe_close>:
static int
devpipe_close(struct Fd *fd)
{
800029e0: 55 push %ebp
800029e1: 89 e5 mov %esp,%ebp
800029e3: 53 push %ebx
800029e4: 83 ec 0c sub $0xc,%esp
800029e7: 8b 5d 08 mov 0x8(%ebp),%ebx
(void) sys_page_unmap(0, fd);
800029ea: 53 push %ebx
800029eb: 6a 00 push $0x0
800029ed: e8 9b f4 ff ff call 80001e8d <sys_page_unmap>
return sys_page_unmap(0, fd2data(fd));
800029f2: 89 1c 24 mov %ebx,(%esp)
800029f5: e8 a4 f7 ff ff call 8000219e <fd2data>
800029fa: 83 c4 08 add $0x8,%esp
800029fd: 50 push %eax
800029fe: 6a 00 push $0x0
80002a00: e8 88 f4 ff ff call 80001e8d <sys_page_unmap>
}
80002a05: 8b 5d fc mov -0x4(%ebp),%ebx
80002a08: c9 leave
80002a09: c3 ret
80002a0a <_pipeisclosed>:
return r;
}
static int
_pipeisclosed(struct Fd *fd, struct Pipe *p)
{
80002a0a: 55 push %ebp
80002a0b: 89 e5 mov %esp,%ebp
80002a0d: 57 push %edi
80002a0e: 56 push %esi
80002a0f: 53 push %ebx
80002a10: 83 ec 1c sub $0x1c,%esp
80002a13: 89 45 e0 mov %eax,-0x20(%ebp)
80002a16: 89 d7 mov %edx,%edi
int n, nn, ret;
while (1) {
n = thisenv->env_runs;
80002a18: a1 20 64 00 80 mov 0x80006420,%eax
80002a1d: 8b 70 58 mov 0x58(%eax),%esi
ret = pageref(fd) == pageref(p);
80002a20: 83 ec 0c sub $0xc,%esp
80002a23: ff 75 e0 pushl -0x20(%ebp)
80002a26: e8 3b 0d 00 00 call 80003766 <pageref>
80002a2b: 89 c3 mov %eax,%ebx
80002a2d: 89 3c 24 mov %edi,(%esp)
80002a30: e8 31 0d 00 00 call 80003766 <pageref>
80002a35: 83 c4 10 add $0x10,%esp
80002a38: 39 c3 cmp %eax,%ebx
80002a3a: 0f 94 c1 sete %cl
80002a3d: 0f b6 c9 movzbl %cl,%ecx
80002a40: 89 4d e4 mov %ecx,-0x1c(%ebp)
nn = thisenv->env_runs;
80002a43: 8b 15 20 64 00 80 mov 0x80006420,%edx
80002a49: 8b 4a 58 mov 0x58(%edx),%ecx
if (n == nn)
80002a4c: 39 ce cmp %ecx,%esi
80002a4e: 74 1b je 80002a6b <_pipeisclosed+0x61>
return ret;
if (n != nn && ret == 1)
80002a50: 39 c3 cmp %eax,%ebx
80002a52: 75 c4 jne 80002a18 <_pipeisclosed+0xe>
cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
80002a54: 8b 42 58 mov 0x58(%edx),%eax
80002a57: ff 75 e4 pushl -0x1c(%ebp)
80002a5a: 50 push %eax
80002a5b: 56 push %esi
80002a5c: 68 d9 44 00 80 push $0x800044d9
80002a61: e8 e9 14 00 00 call 80003f4f <cprintf>
80002a66: 83 c4 10 add $0x10,%esp
80002a69: eb ad jmp 80002a18 <_pipeisclosed+0xe>
}
}
80002a6b: 8b 45 e4 mov -0x1c(%ebp),%eax
80002a6e: 8d 65 f4 lea -0xc(%ebp),%esp
80002a71: 5b pop %ebx
80002a72: 5e pop %esi
80002a73: 5f pop %edi
80002a74: 5d pop %ebp
80002a75: c3 ret
80002a76 <devpipe_write>:
return i;
}
static ssize_t
devpipe_write(struct Fd *fd, const void *vbuf, size_t n)
{
80002a76: 55 push %ebp
80002a77: 89 e5 mov %esp,%ebp
80002a79: 57 push %edi
80002a7a: 56 push %esi
80002a7b: 53 push %ebx
80002a7c: 83 ec 28 sub $0x28,%esp
80002a7f: 8b 75 08 mov 0x8(%ebp),%esi
const uint8_t *buf;
size_t i;
struct Pipe *p;
p = (struct Pipe*) fd2data(fd);
80002a82: 56 push %esi
80002a83: e8 16 f7 ff ff call 8000219e <fd2data>
80002a88: 89 c3 mov %eax,%ebx
if (debug)
cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
for (i = 0; i < n; i++) {
80002a8a: 83 c4 10 add $0x10,%esp
80002a8d: bf 00 00 00 00 mov $0x0,%edi
80002a92: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80002a96: 75 52 jne 80002aea <devpipe_write+0x74>
80002a98: eb 5e jmp 80002af8 <devpipe_write+0x82>
while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
// pipe is full
// if all the readers are gone
// (it's only writers like us now),
// note eof
if (_pipeisclosed(fd, p))
80002a9a: 89 da mov %ebx,%edx
80002a9c: 89 f0 mov %esi,%eax
80002a9e: e8 67 ff ff ff call 80002a0a <_pipeisclosed>
80002aa3: 85 c0 test %eax,%eax
80002aa5: 75 56 jne 80002afd <devpipe_write+0x87>
return 0;
// yield and see what happens
if (debug)
cprintf("devpipe_write yield\n");
sys_yield();
80002aa7: e8 3d f3 ff ff call 80001de9 <sys_yield>
cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
for (i = 0; i < n; i++) {
while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
80002aac: 8b 43 04 mov 0x4(%ebx),%eax
80002aaf: 8b 0b mov (%ebx),%ecx
80002ab1: 8d 51 20 lea 0x20(%ecx),%edx
80002ab4: 39 d0 cmp %edx,%eax
80002ab6: 73 e2 jae 80002a9a <devpipe_write+0x24>
cprintf("devpipe_write yield\n");
sys_yield();
}
// there's room for a byte. store it.
// wait to increment wpos until the byte is stored!
p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
80002ab8: 8b 4d 0c mov 0xc(%ebp),%ecx
80002abb: 0f b6 0c 39 movzbl (%ecx,%edi,1),%ecx
80002abf: 88 4d e7 mov %cl,-0x19(%ebp)
80002ac2: 89 c2 mov %eax,%edx
80002ac4: c1 fa 1f sar $0x1f,%edx
80002ac7: 89 d1 mov %edx,%ecx
80002ac9: c1 e9 1b shr $0x1b,%ecx
80002acc: 8d 14 08 lea (%eax,%ecx,1),%edx
80002acf: 83 e2 1f and $0x1f,%edx
80002ad2: 29 ca sub %ecx,%edx
80002ad4: 0f b6 4d e7 movzbl -0x19(%ebp),%ecx
80002ad8: 88 4c 13 08 mov %cl,0x8(%ebx,%edx,1)
p->p_wpos++;
80002adc: 83 c0 01 add $0x1,%eax
80002adf: 89 43 04 mov %eax,0x4(%ebx)
if (debug)
cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
for (i = 0; i < n; i++) {
80002ae2: 83 c7 01 add $0x1,%edi
80002ae5: 39 7d 10 cmp %edi,0x10(%ebp)
80002ae8: 74 0e je 80002af8 <devpipe_write+0x82>
while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
80002aea: 8b 43 04 mov 0x4(%ebx),%eax
80002aed: 8b 0b mov (%ebx),%ecx
80002aef: 8d 51 20 lea 0x20(%ecx),%edx
80002af2: 39 d0 cmp %edx,%eax
80002af4: 73 a4 jae 80002a9a <devpipe_write+0x24>
80002af6: eb c0 jmp 80002ab8 <devpipe_write+0x42>
// wait to increment wpos until the byte is stored!
p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
p->p_wpos++;
}
return i;
80002af8: 8b 45 10 mov 0x10(%ebp),%eax
80002afb: eb 05 jmp 80002b02 <devpipe_write+0x8c>
// pipe is full
// if all the readers are gone
// (it's only writers like us now),
// note eof
if (_pipeisclosed(fd, p))
return 0;
80002afd: b8 00 00 00 00 mov $0x0,%eax
p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
p->p_wpos++;
}
return i;
}
80002b02: 8d 65 f4 lea -0xc(%ebp),%esp
80002b05: 5b pop %ebx
80002b06: 5e pop %esi
80002b07: 5f pop %edi
80002b08: 5d pop %ebp
80002b09: c3 ret
80002b0a <devpipe_read>:
return _pipeisclosed(fd, p);
}
static ssize_t
devpipe_read(struct Fd *fd, void *vbuf, size_t n)
{
80002b0a: 55 push %ebp
80002b0b: 89 e5 mov %esp,%ebp
80002b0d: 57 push %edi
80002b0e: 56 push %esi
80002b0f: 53 push %ebx
80002b10: 83 ec 18 sub $0x18,%esp
80002b13: 8b 7d 08 mov 0x8(%ebp),%edi
uint8_t *buf;
size_t i;
struct Pipe *p;
p = (struct Pipe*)fd2data(fd);
80002b16: 57 push %edi
80002b17: e8 82 f6 ff ff call 8000219e <fd2data>
80002b1c: 89 c3 mov %eax,%ebx
if (debug)
cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
for (i = 0; i < n; i++) {
80002b1e: 83 c4 10 add $0x10,%esp
80002b21: be 00 00 00 00 mov $0x0,%esi
80002b26: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80002b2a: 75 40 jne 80002b6c <devpipe_read+0x62>
80002b2c: eb 4b jmp 80002b79 <devpipe_read+0x6f>
while (p->p_rpos == p->p_wpos) {
// pipe is empty
// if we got any data, return it
if (i > 0)
return i;
80002b2e: 89 f0 mov %esi,%eax
80002b30: eb 51 jmp 80002b83 <devpipe_read+0x79>
// if all the writers are gone, note eof
if (_pipeisclosed(fd, p))
80002b32: 89 da mov %ebx,%edx
80002b34: 89 f8 mov %edi,%eax
80002b36: e8 cf fe ff ff call 80002a0a <_pipeisclosed>
80002b3b: 85 c0 test %eax,%eax
80002b3d: 75 3f jne 80002b7e <devpipe_read+0x74>
return 0;
// yield and see what happens
if (debug)
cprintf("devpipe_read yield\n");
sys_yield();
80002b3f: e8 a5 f2 ff ff call 80001de9 <sys_yield>
cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
for (i = 0; i < n; i++) {
while (p->p_rpos == p->p_wpos) {
80002b44: 8b 03 mov (%ebx),%eax
80002b46: 3b 43 04 cmp 0x4(%ebx),%eax
80002b49: 74 e7 je 80002b32 <devpipe_read+0x28>
cprintf("devpipe_read yield\n");
sys_yield();
}
// there's a byte. take it.
// wait to increment rpos until the byte is taken!
buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
80002b4b: 99 cltd
80002b4c: c1 ea 1b shr $0x1b,%edx
80002b4f: 01 d0 add %edx,%eax
80002b51: 83 e0 1f and $0x1f,%eax
80002b54: 29 d0 sub %edx,%eax
80002b56: 0f b6 44 03 08 movzbl 0x8(%ebx,%eax,1),%eax
80002b5b: 8b 4d 0c mov 0xc(%ebp),%ecx
80002b5e: 88 04 31 mov %al,(%ecx,%esi,1)
p->p_rpos++;
80002b61: 83 03 01 addl $0x1,(%ebx)
if (debug)
cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n",
thisenv->env_id, uvpt[PGNUM(p)], n, p->p_rpos, p->p_wpos);
buf = vbuf;
for (i = 0; i < n; i++) {
80002b64: 83 c6 01 add $0x1,%esi
80002b67: 39 75 10 cmp %esi,0x10(%ebp)
80002b6a: 74 0d je 80002b79 <devpipe_read+0x6f>
while (p->p_rpos == p->p_wpos) {
80002b6c: 8b 03 mov (%ebx),%eax
80002b6e: 3b 43 04 cmp 0x4(%ebx),%eax
80002b71: 75 d8 jne 80002b4b <devpipe_read+0x41>
// pipe is empty
// if we got any data, return it
if (i > 0)
80002b73: 85 f6 test %esi,%esi
80002b75: 75 b7 jne 80002b2e <devpipe_read+0x24>
80002b77: eb b9 jmp 80002b32 <devpipe_read+0x28>
// there's a byte. take it.
// wait to increment rpos until the byte is taken!
buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
p->p_rpos++;
}
return i;
80002b79: 8b 45 10 mov 0x10(%ebp),%eax
80002b7c: eb 05 jmp 80002b83 <devpipe_read+0x79>
// if we got any data, return it
if (i > 0)
return i;
// if all the writers are gone, note eof
if (_pipeisclosed(fd, p))
return 0;
80002b7e: b8 00 00 00 00 mov $0x0,%eax
// wait to increment rpos until the byte is taken!
buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
p->p_rpos++;
}
return i;
}
80002b83: 8d 65 f4 lea -0xc(%ebp),%esp
80002b86: 5b pop %ebx
80002b87: 5e pop %esi
80002b88: 5f pop %edi
80002b89: 5d pop %ebp
80002b8a: c3 ret
80002b8b <pipe>:
uint8_t p_buf[PIPEBUFSIZ]; // data buffer
};
int
pipe(int pfd[2])
{
80002b8b: 55 push %ebp
80002b8c: 89 e5 mov %esp,%ebp
80002b8e: 56 push %esi
80002b8f: 53 push %ebx
80002b90: 83 ec 1c sub $0x1c,%esp
int r;
struct Fd *fd0, *fd1;
void *va;
// allocate the file descriptor table entries
if ((r = fd_alloc(&fd0)) < 0
80002b93: 8d 45 f4 lea -0xc(%ebp),%eax
80002b96: 50 push %eax
80002b97: e8 1a f6 ff ff call 800021b6 <fd_alloc>
80002b9c: 83 c4 10 add $0x10,%esp
80002b9f: 89 c2 mov %eax,%edx
80002ba1: 85 c0 test %eax,%eax
80002ba3: 0f 88 2c 01 00 00 js 80002cd5 <pipe+0x14a>
|| (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
80002ba9: 83 ec 04 sub $0x4,%esp
80002bac: 68 07 04 00 00 push $0x407
80002bb1: ff 75 f4 pushl -0xc(%ebp)
80002bb4: 6a 00 push $0x0
80002bb6: e8 4d f2 ff ff call 80001e08 <sys_page_alloc>
80002bbb: 83 c4 10 add $0x10,%esp
80002bbe: 89 c2 mov %eax,%edx
80002bc0: 85 c0 test %eax,%eax
80002bc2: 0f 88 0d 01 00 00 js 80002cd5 <pipe+0x14a>
goto err;
if ((r = fd_alloc(&fd1)) < 0
80002bc8: 83 ec 0c sub $0xc,%esp
80002bcb: 8d 45 f0 lea -0x10(%ebp),%eax
80002bce: 50 push %eax
80002bcf: e8 e2 f5 ff ff call 800021b6 <fd_alloc>
80002bd4: 89 c3 mov %eax,%ebx
80002bd6: 83 c4 10 add $0x10,%esp
80002bd9: 85 c0 test %eax,%eax
80002bdb: 0f 88 e2 00 00 00 js 80002cc3 <pipe+0x138>
|| (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
80002be1: 83 ec 04 sub $0x4,%esp
80002be4: 68 07 04 00 00 push $0x407
80002be9: ff 75 f0 pushl -0x10(%ebp)
80002bec: 6a 00 push $0x0
80002bee: e8 15 f2 ff ff call 80001e08 <sys_page_alloc>
80002bf3: 89 c3 mov %eax,%ebx
80002bf5: 83 c4 10 add $0x10,%esp
80002bf8: 85 c0 test %eax,%eax
80002bfa: 0f 88 c3 00 00 00 js 80002cc3 <pipe+0x138>
goto err1;
// allocate the pipe structure as first data page in both
va = fd2data(fd0);
80002c00: 83 ec 0c sub $0xc,%esp
80002c03: ff 75 f4 pushl -0xc(%ebp)
80002c06: e8 93 f5 ff ff call 8000219e <fd2data>
80002c0b: 89 c6 mov %eax,%esi
if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
80002c0d: 83 c4 0c add $0xc,%esp
80002c10: 68 07 04 00 00 push $0x407
80002c15: 50 push %eax
80002c16: 6a 00 push $0x0
80002c18: e8 eb f1 ff ff call 80001e08 <sys_page_alloc>
80002c1d: 89 c3 mov %eax,%ebx
80002c1f: 83 c4 10 add $0x10,%esp
80002c22: 85 c0 test %eax,%eax
80002c24: 0f 88 89 00 00 00 js 80002cb3 <pipe+0x128>
goto err2;
if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
80002c2a: 83 ec 0c sub $0xc,%esp
80002c2d: ff 75 f0 pushl -0x10(%ebp)
80002c30: e8 69 f5 ff ff call 8000219e <fd2data>
80002c35: c7 04 24 07 04 00 00 movl $0x407,(%esp)
80002c3c: 50 push %eax
80002c3d: 6a 00 push $0x0
80002c3f: 56 push %esi
80002c40: 6a 00 push $0x0
80002c42: e8 04 f2 ff ff call 80001e4b <sys_page_map>
80002c47: 89 c3 mov %eax,%ebx
80002c49: 83 c4 20 add $0x20,%esp
80002c4c: 85 c0 test %eax,%eax
80002c4e: 78 55 js 80002ca5 <pipe+0x11a>
goto err3;
// set up fd structures
fd0->fd_dev_id = devpipe.dev_id;
80002c50: 8b 15 3c 50 00 80 mov 0x8000503c,%edx
80002c56: 8b 45 f4 mov -0xc(%ebp),%eax
80002c59: 89 10 mov %edx,(%eax)
fd0->fd_omode = O_RDONLY;
80002c5b: 8b 45 f4 mov -0xc(%ebp),%eax
80002c5e: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
fd1->fd_dev_id = devpipe.dev_id;
80002c65: 8b 15 3c 50 00 80 mov 0x8000503c,%edx
80002c6b: 8b 45 f0 mov -0x10(%ebp),%eax
80002c6e: 89 10 mov %edx,(%eax)
fd1->fd_omode = O_WRONLY;
80002c70: 8b 45 f0 mov -0x10(%ebp),%eax
80002c73: c7 40 08 01 00 00 00 movl $0x1,0x8(%eax)
if (debug)
cprintf("[%08x] pipecreate %08x\n", thisenv->env_id, uvpt[PGNUM(va)]);
pfd[0] = fd2num(fd0);
80002c7a: 83 ec 0c sub $0xc,%esp
80002c7d: ff 75 f4 pushl -0xc(%ebp)
80002c80: e8 09 f5 ff ff call 8000218e <fd2num>
80002c85: 8b 4d 08 mov 0x8(%ebp),%ecx
80002c88: 89 01 mov %eax,(%ecx)
pfd[1] = fd2num(fd1);
80002c8a: 83 c4 04 add $0x4,%esp
80002c8d: ff 75 f0 pushl -0x10(%ebp)
80002c90: e8 f9 f4 ff ff call 8000218e <fd2num>
80002c95: 8b 4d 08 mov 0x8(%ebp),%ecx
80002c98: 89 41 04 mov %eax,0x4(%ecx)
return 0;
80002c9b: 83 c4 10 add $0x10,%esp
80002c9e: ba 00 00 00 00 mov $0x0,%edx
80002ca3: eb 30 jmp 80002cd5 <pipe+0x14a>
err3:
sys_page_unmap(0, va);
80002ca5: 83 ec 08 sub $0x8,%esp
80002ca8: 56 push %esi
80002ca9: 6a 00 push $0x0
80002cab: e8 dd f1 ff ff call 80001e8d <sys_page_unmap>
80002cb0: 83 c4 10 add $0x10,%esp
err2:
sys_page_unmap(0, fd1);
80002cb3: 83 ec 08 sub $0x8,%esp
80002cb6: ff 75 f0 pushl -0x10(%ebp)
80002cb9: 6a 00 push $0x0
80002cbb: e8 cd f1 ff ff call 80001e8d <sys_page_unmap>
80002cc0: 83 c4 10 add $0x10,%esp
err1:
sys_page_unmap(0, fd0);
80002cc3: 83 ec 08 sub $0x8,%esp
80002cc6: ff 75 f4 pushl -0xc(%ebp)
80002cc9: 6a 00 push $0x0
80002ccb: e8 bd f1 ff ff call 80001e8d <sys_page_unmap>
80002cd0: 83 c4 10 add $0x10,%esp
80002cd3: 89 da mov %ebx,%edx
err:
return r;
}
80002cd5: 89 d0 mov %edx,%eax
80002cd7: 8d 65 f8 lea -0x8(%ebp),%esp
80002cda: 5b pop %ebx
80002cdb: 5e pop %esi
80002cdc: 5d pop %ebp
80002cdd: c3 ret
80002cde <pipeisclosed>:
}
}
int
pipeisclosed(int fdnum)
{
80002cde: 55 push %ebp
80002cdf: 89 e5 mov %esp,%ebp
80002ce1: 83 ec 20 sub $0x20,%esp
struct Fd *fd;
struct Pipe *p;
int r;
if ((r = fd_lookup(fdnum, &fd)) < 0)
80002ce4: 8d 45 f4 lea -0xc(%ebp),%eax
80002ce7: 50 push %eax
80002ce8: ff 75 08 pushl 0x8(%ebp)
80002ceb: e8 3a f5 ff ff call 8000222a <fd_lookup>
80002cf0: 83 c4 10 add $0x10,%esp
80002cf3: 85 c0 test %eax,%eax
80002cf5: 78 18 js 80002d0f <pipeisclosed+0x31>
return r;
p = (struct Pipe*) fd2data(fd);
80002cf7: 83 ec 0c sub $0xc,%esp
80002cfa: ff 75 f4 pushl -0xc(%ebp)
80002cfd: e8 9c f4 ff ff call 8000219e <fd2data>
return _pipeisclosed(fd, p);
80002d02: 89 c2 mov %eax,%edx
80002d04: 8b 45 f4 mov -0xc(%ebp),%eax
80002d07: e8 fe fc ff ff call 80002a0a <_pipeisclosed>
80002d0c: 83 c4 10 add $0x10,%esp
}
80002d0f: c9 leave
80002d10: c3 ret
80002d11 <ipc_recv>:
// If 'pg' is null, pass sys_ipc_recv a value that it will understand
// as meaning "no page". (Zero is not the right value, since that's
// a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
80002d11: 55 push %ebp
80002d12: 89 e5 mov %esp,%ebp
80002d14: 56 push %esi
80002d15: 53 push %ebx
80002d16: 8b 75 08 mov 0x8(%ebp),%esi
80002d19: 8b 45 0c mov 0xc(%ebp),%eax
80002d1c: 8b 5d 10 mov 0x10(%ebp),%ebx
// LAB 4: Your code here.
// panic("ipc_recv not implemented");
int r;
if(!pg)
80002d1f: 85 c0 test %eax,%eax
pg = (void *)-1; // all 1
80002d21: ba ff ff ff ff mov $0xffffffff,%edx
80002d26: 0f 44 c2 cmove %edx,%eax
if((r = sys_ipc_recv(pg)) < 0)
80002d29: 83 ec 0c sub $0xc,%esp
80002d2c: 50 push %eax
80002d2d: e8 86 f2 ff ff call 80001fb8 <sys_ipc_recv>
80002d32: 83 c4 10 add $0x10,%esp
80002d35: 85 c0 test %eax,%eax
80002d37: 79 10 jns 80002d49 <ipc_recv+0x38>
{
if(from_env_store)
80002d39: 85 f6 test %esi,%esi
80002d3b: 74 40 je 80002d7d <ipc_recv+0x6c>
*from_env_store = 0;
80002d3d: c7 06 00 00 00 00 movl $0x0,(%esi)
if(perm_store)
80002d43: 85 db test %ebx,%ebx
80002d45: 74 20 je 80002d67 <ipc_recv+0x56>
80002d47: eb 24 jmp 80002d6d <ipc_recv+0x5c>
*perm_store = 0;
}
if(from_env_store)
80002d49: 85 f6 test %esi,%esi
80002d4b: 74 0a je 80002d57 <ipc_recv+0x46>
*from_env_store = thisenv->env_ipc_from;
80002d4d: a1 20 64 00 80 mov 0x80006420,%eax
80002d52: 8b 40 74 mov 0x74(%eax),%eax
80002d55: 89 06 mov %eax,(%esi)
if(perm_store)
80002d57: 85 db test %ebx,%ebx
80002d59: 74 28 je 80002d83 <ipc_recv+0x72>
*perm_store = thisenv->env_ipc_perm;
80002d5b: a1 20 64 00 80 mov 0x80006420,%eax
80002d60: 8b 40 78 mov 0x78(%eax),%eax
80002d63: 89 03 mov %eax,(%ebx)
80002d65: eb 1c jmp 80002d83 <ipc_recv+0x72>
if(from_env_store)
*from_env_store = 0;
if(perm_store)
*perm_store = 0;
}
if(from_env_store)
80002d67: 85 f6 test %esi,%esi
80002d69: 75 e2 jne 80002d4d <ipc_recv+0x3c>
80002d6b: eb 16 jmp 80002d83 <ipc_recv+0x72>
if((r = sys_ipc_recv(pg)) < 0)
{
if(from_env_store)
*from_env_store = 0;
if(perm_store)
*perm_store = 0;
80002d6d: c7 03 00 00 00 00 movl $0x0,(%ebx)
80002d73: eb d8 jmp 80002d4d <ipc_recv+0x3c>
80002d75: c7 03 00 00 00 00 movl $0x0,(%ebx)
80002d7b: eb de jmp 80002d5b <ipc_recv+0x4a>
pg = (void *)-1; // all 1
if((r = sys_ipc_recv(pg)) < 0)
{
if(from_env_store)
*from_env_store = 0;
if(perm_store)
80002d7d: 85 db test %ebx,%ebx
80002d7f: 75 f4 jne 80002d75 <ipc_recv+0x64>
80002d81: eb e4 jmp 80002d67 <ipc_recv+0x56>
}
if(from_env_store)
*from_env_store = thisenv->env_ipc_from;
if(perm_store)
*perm_store = thisenv->env_ipc_perm;
return thisenv->env_ipc_value;
80002d83: a1 20 64 00 80 mov 0x80006420,%eax
80002d88: 8b 40 70 mov 0x70(%eax),%eax
}
80002d8b: 8d 65 f8 lea -0x8(%ebp),%esp
80002d8e: 5b pop %ebx
80002d8f: 5e pop %esi
80002d90: 5d pop %ebp
80002d91: c3 ret
80002d92 <ipc_send>:
// Use sys_yield() to be CPU-friendly.
// If 'pg' is null, pass sys_ipc_try_send a value that it will understand
// as meaning "no page". (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
80002d92: 55 push %ebp
80002d93: 89 e5 mov %esp,%ebp
80002d95: 57 push %edi
80002d96: 56 push %esi
80002d97: 53 push %ebx
80002d98: 83 ec 0c sub $0xc,%esp
80002d9b: 8b 7d 08 mov 0x8(%ebp),%edi
80002d9e: 8b 75 0c mov 0xc(%ebp),%esi
80002da1: 8b 5d 10 mov 0x10(%ebp),%ebx
// LAB 4: Your code here.
// panic("ipc_send not implemented");
int r;
if(!pg)
80002da4: 85 db test %ebx,%ebx
pg = (void *)-1; // all 1
80002da6: b8 ff ff ff ff mov $0xffffffff,%eax
80002dab: 0f 44 d8 cmove %eax,%ebx
80002dae: eb 1c jmp 80002dcc <ipc_send+0x3a>
while((r = sys_ipc_try_send(to_env, val, pg, perm)))
{
if(r == 0)
break;
if(r != -E_IPC_NOT_RECV)
80002db0: 83 f8 f9 cmp $0xfffffff9,%eax
80002db3: 74 12 je 80002dc7 <ipc_send+0x35>
panic("ipc_send : %e", r);
80002db5: 50 push %eax
80002db6: 68 f1 44 00 80 push $0x800044f1
80002dbb: 6a 41 push $0x41
80002dbd: 68 ff 44 00 80 push $0x800044ff
80002dc2: e8 b0 13 00 00 call 80004177 <_panic>
sys_yield();
80002dc7: e8 1d f0 ff ff call 80001de9 <sys_yield>
// LAB 4: Your code here.
// panic("ipc_send not implemented");
int r;
if(!pg)
pg = (void *)-1; // all 1
while((r = sys_ipc_try_send(to_env, val, pg, perm)))
80002dcc: ff 75 14 pushl 0x14(%ebp)
80002dcf: 53 push %ebx
80002dd0: 56 push %esi
80002dd1: 57 push %edi
80002dd2: e8 be f1 ff ff call 80001f95 <sys_ipc_try_send>
{
if(r == 0)
80002dd7: 83 c4 10 add $0x10,%esp
80002dda: 85 c0 test %eax,%eax
80002ddc: 75 d2 jne 80002db0 <ipc_send+0x1e>
break;
if(r != -E_IPC_NOT_RECV)
panic("ipc_send : %e", r);
sys_yield();
}
}
80002dde: 8d 65 f4 lea -0xc(%ebp),%esp
80002de1: 5b pop %ebx
80002de2: 5e pop %esi
80002de3: 5f pop %edi
80002de4: 5d pop %ebp
80002de5: c3 ret
80002de6 <ipc_find_env>:
// Find the first environment of the given type. We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
80002de6: 55 push %ebp
80002de7: 89 e5 mov %esp,%ebp
80002de9: 8b 4d 08 mov 0x8(%ebp),%ecx
int i;
for (i = 0; i < NENV; i++)
if (envs[i].env_type == type)
80002dec: a1 50 00 c0 ee mov 0xeec00050,%eax
80002df1: 39 c1 cmp %eax,%ecx
80002df3: 74 17 je 80002e0c <ipc_find_env+0x26>
80002df5: b8 01 00 00 00 mov $0x1,%eax
80002dfa: 6b d0 7c imul $0x7c,%eax,%edx
80002dfd: 81 c2 00 00 c0 ee add $0xeec00000,%edx
80002e03: 8b 52 50 mov 0x50(%edx),%edx
80002e06: 39 ca cmp %ecx,%edx
80002e08: 75 14 jne 80002e1e <ipc_find_env+0x38>
80002e0a: eb 05 jmp 80002e11 <ipc_find_env+0x2b>
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
int i;
for (i = 0; i < NENV; i++)
80002e0c: b8 00 00 00 00 mov $0x0,%eax
if (envs[i].env_type == type)
return envs[i].env_id;
80002e11: 6b c0 7c imul $0x7c,%eax,%eax
80002e14: 05 00 00 c0 ee add $0xeec00000,%eax
80002e19: 8b 40 48 mov 0x48(%eax),%eax
80002e1c: eb 0f jmp 80002e2d <ipc_find_env+0x47>
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
int i;
for (i = 0; i < NENV; i++)
80002e1e: 83 c0 01 add $0x1,%eax
80002e21: 3d 00 04 00 00 cmp $0x400,%eax
80002e26: 75 d2 jne 80002dfa <ipc_find_env+0x14>
if (envs[i].env_type == type)
return envs[i].env_id;
return 0;
80002e28: b8 00 00 00 00 mov $0x0,%eax
}
80002e2d: 5d pop %ebp
80002e2e: c3 ret
80002e2f <pgfault>:
// Custom page fault handler - if faulting page is copy-on-write,
// map in our own private writable copy.
//
static void
pgfault(struct UTrapframe *utf)
{
80002e2f: 55 push %ebp
80002e30: 89 e5 mov %esp,%ebp
80002e32: 53 push %ebx
80002e33: 83 ec 04 sub $0x4,%esp
80002e36: 8b 55 08 mov 0x8(%ebp),%edx
void *addr = ROUNDDOWN((void *) utf->utf_fault_va, PGSIZE);
80002e39: 8b 02 mov (%edx),%eax
80002e3b: 89 c3 mov %eax,%ebx
80002e3d: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
// copy-on-write page. If not, panic.
// Hint:
// Use the read-only page table mappings at uvpt
// (see <inc/memlayout.h>).
// LAB 4: Your code here.
if(!(utf->utf_err & FEC_WR) && !(uvpt[PGNUM(utf->utf_fault_va)] & PTE_COW))
80002e43: f6 42 04 02 testb $0x2,0x4(%edx)
80002e47: 75 23 jne 80002e6c <pgfault+0x3d>
80002e49: c1 e8 0c shr $0xc,%eax
80002e4c: 8b 04 85 00 00 40 ef mov -0x10c00000(,%eax,4),%eax
80002e53: f6 c4 08 test $0x8,%ah
80002e56: 75 14 jne 80002e6c <pgfault+0x3d>
panic("pgfault check access fails");
80002e58: 83 ec 04 sub $0x4,%esp
80002e5b: 68 05 45 00 80 push $0x80004505
80002e60: 6a 1c push $0x1c
80002e62: 68 20 45 00 80 push $0x80004520
80002e67: e8 0b 13 00 00 call 80004177 <_panic>
// Allocate a new page, map it at a temporary location (PFTEMP),
// copy the data from the old page to the new page, then move the new
// page to the old page's address.
// Hint:
// You should make three system calls.
if((r = sys_page_alloc(0, PFTEMP, PTE_W|PTE_U|PTE_P)) < 0)
80002e6c: 83 ec 04 sub $0x4,%esp
80002e6f: 6a 07 push $0x7
80002e71: 68 00 f0 7f 00 push $0x7ff000
80002e76: 6a 00 push $0x0
80002e78: e8 8b ef ff ff call 80001e08 <sys_page_alloc>
80002e7d: 83 c4 10 add $0x10,%esp
80002e80: 85 c0 test %eax,%eax
80002e82: 79 12 jns 80002e96 <pgfault+0x67>
panic("pgfault : sys_page_alloc : %e" ,r);
80002e84: 50 push %eax
80002e85: 68 27 45 00 80 push $0x80004527
80002e8a: 6a 24 push $0x24
80002e8c: 68 20 45 00 80 push $0x80004520
80002e91: e8 e1 12 00 00 call 80004177 <_panic>
memcpy(PFTEMP, addr, PGSIZE);
80002e96: 83 ec 04 sub $0x4,%esp
80002e99: 68 00 10 00 00 push $0x1000
80002e9e: 53 push %ebx
80002e9f: 68 00 f0 7f 00 push $0x7ff000
80002ea4: e8 d3 ec ff ff call 80001b7c <memcpy>
if((r = sys_page_map(0, PFTEMP, 0, addr, PTE_W|PTE_U|PTE_P)) < 0)
80002ea9: c7 04 24 07 00 00 00 movl $0x7,(%esp)
80002eb0: 53 push %ebx
80002eb1: 6a 00 push $0x0
80002eb3: 68 00 f0 7f 00 push $0x7ff000
80002eb8: 6a 00 push $0x0
80002eba: e8 8c ef ff ff call 80001e4b <sys_page_map>
80002ebf: 83 c4 20 add $0x20,%esp
80002ec2: 85 c0 test %eax,%eax
80002ec4: 79 12 jns 80002ed8 <pgfault+0xa9>
panic("pgfault : sys_page_map : %e" ,r);
80002ec6: 50 push %eax
80002ec7: 68 45 45 00 80 push $0x80004545
80002ecc: 6a 27 push $0x27
80002ece: 68 20 45 00 80 push $0x80004520
80002ed3: e8 9f 12 00 00 call 80004177 <_panic>
if((r = sys_page_unmap(0, PFTEMP)) < 0)
80002ed8: 83 ec 08 sub $0x8,%esp
80002edb: 68 00 f0 7f 00 push $0x7ff000
80002ee0: 6a 00 push $0x0
80002ee2: e8 a6 ef ff ff call 80001e8d <sys_page_unmap>
80002ee7: 83 c4 10 add $0x10,%esp
80002eea: 85 c0 test %eax,%eax
80002eec: 79 12 jns 80002f00 <pgfault+0xd1>
panic("pgfault : sys_page_unmap : %e" ,r);
80002eee: 50 push %eax
80002eef: 68 61 45 00 80 push $0x80004561
80002ef4: 6a 29 push $0x29
80002ef6: 68 20 45 00 80 push $0x80004520
80002efb: e8 77 12 00 00 call 80004177 <_panic>
}
80002f00: 8b 5d fc mov -0x4(%ebp),%ebx
80002f03: c9 leave
80002f04: c3 ret
80002f05 <fork>:
// Neither user exception stack should ever be marked copy-on-write,
// so you must allocate a new page for the child's user exception stack.
//
envid_t
fork(void)
{
80002f05: 55 push %ebp
80002f06: 89 e5 mov %esp,%ebp
80002f08: 57 push %edi
80002f09: 56 push %esi
80002f0a: 53 push %ebx
80002f0b: 83 ec 28 sub $0x28,%esp
int r;
// LAB 4: Your code here.
// panic("fork not implemented");
set_pgfault_handler(pgfault);
80002f0e: 68 2f 2e 00 80 push $0x80002e2f
80002f13: e8 02 0a 00 00 call 8000391a <set_pgfault_handler>
// This must be inlined. Exercise for reader: why?
static __inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
envid_t ret;
__asm __volatile("int %2"
80002f18: b8 07 00 00 00 mov $0x7,%eax
80002f1d: cd 30 int $0x30
80002f1f: 89 45 e4 mov %eax,-0x1c(%ebp)
80002f22: 89 c7 mov %eax,%edi
envid_t child = sys_exofork();
if(child == 0)
80002f24: 83 c4 10 add $0x10,%esp
80002f27: bb 00 00 00 00 mov $0x0,%ebx
80002f2c: 85 c0 test %eax,%eax
80002f2e: 75 21 jne 80002f51 <fork+0x4c>
{
// i'm the child
thisenv = &envs[ENVX(sys_getenvid())];
80002f30: e8 95 ee ff ff call 80001dca <sys_getenvid>
80002f35: 25 ff 03 00 00 and $0x3ff,%eax
80002f3a: 6b c0 7c imul $0x7c,%eax,%eax
80002f3d: 05 00 00 c0 ee add $0xeec00000,%eax
80002f42: a3 20 64 00 80 mov %eax,0x80006420
return 0;
80002f47: b8 00 00 00 00 mov $0x0,%eax
80002f4c: e9 a8 01 00 00 jmp 800030f9 <fork+0x1f4>
}
uint32_t i;
for(i = 0; i < USTACKTOP; i += PGSIZE)
{
if((uvpd[PDX(i)] & PTE_P) &&
80002f51: 89 d8 mov %ebx,%eax
80002f53: c1 e8 16 shr $0x16,%eax
80002f56: 8b 04 85 00 d0 7b ef mov -0x10843000(,%eax,4),%eax
80002f5d: a8 01 test $0x1,%al
80002f5f: 0f 84 fc 00 00 00 je 80003061 <fork+0x15c>
(uvpt[PGNUM(i)] & PTE_P) &&
80002f65: 89 d8 mov %ebx,%eax
80002f67: c1 e8 0c shr $0xc,%eax
80002f6a: 8b 14 85 00 00 40 ef mov -0x10c00000(,%eax,4),%edx
}
uint32_t i;
for(i = 0; i < USTACKTOP; i += PGSIZE)
{
if((uvpd[PDX(i)] & PTE_P) &&
80002f71: f6 c2 01 test $0x1,%dl
80002f74: 0f 84 e7 00 00 00 je 80003061 <fork+0x15c>
(uvpt[PGNUM(i)] & PTE_P) &&
(uvpt[PGNUM(i)] & PTE_U))
80002f7a: 8b 14 85 00 00 40 ef mov -0x10c00000(,%eax,4),%edx
uint32_t i;
for(i = 0; i < USTACKTOP; i += PGSIZE)
{
if((uvpd[PDX(i)] & PTE_P) &&
(uvpt[PGNUM(i)] & PTE_P) &&
80002f81: f6 c2 04 test $0x4,%dl
80002f84: 0f 84 d7 00 00 00 je 80003061 <fork+0x15c>
duppage(envid_t envid, unsigned pn)
{
int r;
// LAB 4: Your code here.
void * addr = (void *)(pn * PGSIZE);
80002f8a: 89 c6 mov %eax,%esi
80002f8c: c1 e6 0c shl $0xc,%esi
if(uvpt[pn] & PTE_SHARE)
80002f8f: 8b 14 85 00 00 40 ef mov -0x10c00000(,%eax,4),%edx
80002f96: f6 c6 04 test $0x4,%dh
80002f99: 74 2f je 80002fca <fork+0xc5>
{
if((r = sys_page_map(0, addr, envid, addr,
80002f9b: 83 ec 0c sub $0xc,%esp
80002f9e: 68 07 0e 00 00 push $0xe07
80002fa3: 56 push %esi
80002fa4: 57 push %edi
80002fa5: 56 push %esi
80002fa6: 6a 00 push $0x0
80002fa8: e8 9e ee ff ff call 80001e4b <sys_page_map>
80002fad: 83 c4 20 add $0x20,%esp
80002fb0: 85 c0 test %eax,%eax
80002fb2: 0f 89 a9 00 00 00 jns 80003061 <fork+0x15c>
PTE_SHARE | PTE_SYSCALL)) < 0)
panic("duppage : sys_page_map : %e", r);
80002fb8: 50 push %eax
80002fb9: 68 7f 45 00 80 push $0x8000457f
80002fbe: 6a 42 push $0x42
80002fc0: 68 20 45 00 80 push $0x80004520
80002fc5: e8 ad 11 00 00 call 80004177 <_panic>
}
else if((uvpt[pn] & PTE_W) || (uvpt[pn] & PTE_COW))
80002fca: 8b 14 85 00 00 40 ef mov -0x10c00000(,%eax,4),%edx
80002fd1: f6 c2 02 test $0x2,%dl
80002fd4: 75 0c jne 80002fe2 <fork+0xdd>
80002fd6: 8b 04 85 00 00 40 ef mov -0x10c00000(,%eax,4),%eax
80002fdd: f6 c4 08 test $0x8,%ah
80002fe0: 74 57 je 80003039 <fork+0x134>
{
if((r = sys_page_map(0, addr, envid, addr, PTE_COW|PTE_U|PTE_P)) < 0)
80002fe2: 83 ec 0c sub $0xc,%esp
80002fe5: 68 05 08 00 00 push $0x805
80002fea: 56 push %esi
80002feb: 57 push %edi
80002fec: 56 push %esi
80002fed: 6a 00 push $0x0
80002fef: e8 57 ee ff ff call 80001e4b <sys_page_map>
80002ff4: 83 c4 20 add $0x20,%esp
80002ff7: 85 c0 test %eax,%eax
80002ff9: 79 12 jns 8000300d <fork+0x108>
panic("duppage : sys_page_map : %e", r);
80002ffb: 50 push %eax
80002ffc: 68 7f 45 00 80 push $0x8000457f
80003001: 6a 47 push $0x47
80003003: 68 20 45 00 80 push $0x80004520
80003008: e8 6a 11 00 00 call 80004177 <_panic>
if((r = sys_page_map(0, addr, 0, addr, PTE_COW|PTE_U|PTE_P)) < 0)
8000300d: 83 ec 0c sub $0xc,%esp
80003010: 68 05 08 00 00 push $0x805
80003015: 56 push %esi
80003016: 6a 00 push $0x0
80003018: 56 push %esi
80003019: 6a 00 push $0x0
8000301b: e8 2b ee ff ff call 80001e4b <sys_page_map>
80003020: 83 c4 20 add $0x20,%esp
80003023: 85 c0 test %eax,%eax
80003025: 79 3a jns 80003061 <fork+0x15c>
panic("duppage : sys_page_map : %e", r);
80003027: 50 push %eax
80003028: 68 7f 45 00 80 push $0x8000457f
8000302d: 6a 49 push $0x49
8000302f: 68 20 45 00 80 push $0x80004520
80003034: e8 3e 11 00 00 call 80004177 <_panic>
}
else
{
if((r = sys_page_map(0, addr, envid, addr, PTE_U|PTE_P)) < 0)
80003039: 83 ec 0c sub $0xc,%esp
8000303c: 6a 05 push $0x5
8000303e: 56 push %esi
8000303f: 57 push %edi
80003040: 56 push %esi
80003041: 6a 00 push $0x0
80003043: e8 03 ee ff ff call 80001e4b <sys_page_map>
80003048: 83 c4 20 add $0x20,%esp
8000304b: 85 c0 test %eax,%eax
8000304d: 79 12 jns 80003061 <fork+0x15c>
panic("duppage : sys_page_map : %e", r);
8000304f: 50 push %eax
80003050: 68 7f 45 00 80 push $0x8000457f
80003055: 6a 4e push $0x4e
80003057: 68 20 45 00 80 push $0x80004520
8000305c: e8 16 11 00 00 call 80004177 <_panic>
thisenv = &envs[ENVX(sys_getenvid())];
return 0;
}
uint32_t i;
for(i = 0; i < USTACKTOP; i += PGSIZE)
80003061: 81 c3 00 10 00 00 add $0x1000,%ebx
80003067: 81 fb 00 e0 bf ee cmp $0xeebfe000,%ebx
8000306d: 0f 85 de fe ff ff jne 80002f51 <fork+0x4c>
(uvpt[PGNUM(i)] & PTE_U))
duppage(child, PGNUM(i));
}
if((r = sys_page_alloc(child, (void *)(UXSTACKTOP - PGSIZE),
80003073: 83 ec 04 sub $0x4,%esp
80003076: 6a 07 push $0x7
80003078: 68 00 f0 bf ee push $0xeebff000
8000307d: ff 75 e4 pushl -0x1c(%ebp)
80003080: e8 83 ed ff ff call 80001e08 <sys_page_alloc>
80003085: 83 c4 10 add $0x10,%esp
80003088: 85 c0 test %eax,%eax
8000308a: 79 15 jns 800030a1 <fork+0x19c>
PTE_W|PTE_U|PTE_P)) < 0)
panic("fork : sys_page_alloc : %e", r);
8000308c: 50 push %eax
8000308d: 68 9b 45 00 80 push $0x8000459b
80003092: 68 84 00 00 00 push $0x84
80003097: 68 20 45 00 80 push $0x80004520
8000309c: e8 d6 10 00 00 call 80004177 <_panic>
// sets the user page fault entrypoint for the child
extern void _pgfault_upcall(void);
if((r = sys_env_set_pgfault_upcall(child, _pgfault_upcall)) < 0)
800030a1: 83 ec 08 sub $0x8,%esp
800030a4: 68 f5 38 00 80 push $0x800038f5
800030a9: ff 75 e4 pushl -0x1c(%ebp)
800030ac: e8 a2 ee ff ff call 80001f53 <sys_env_set_pgfault_upcall>
800030b1: 83 c4 10 add $0x10,%esp
800030b4: 85 c0 test %eax,%eax
800030b6: 79 15 jns 800030cd <fork+0x1c8>
panic("fork : sys_env_set_pgfault_upcall : %e", r);
800030b8: 50 push %eax
800030b9: 68 e4 45 00 80 push $0x800045e4
800030be: 68 89 00 00 00 push $0x89
800030c3: 68 20 45 00 80 push $0x80004520
800030c8: e8 aa 10 00 00 call 80004177 <_panic>
// mark the child as runable
if ((r = sys_env_set_status(child, ENV_RUNNABLE)) < 0)
800030cd: 83 ec 08 sub $0x8,%esp
800030d0: 6a 02 push $0x2
800030d2: ff 75 e4 pushl -0x1c(%ebp)
800030d5: e8 f5 ed ff ff call 80001ecf <sys_env_set_status>
800030da: 83 c4 10 add $0x10,%esp
800030dd: 85 c0 test %eax,%eax
800030df: 79 15 jns 800030f6 <fork+0x1f1>
panic("sys_env_set_status: %e", r);
800030e1: 50 push %eax
800030e2: 68 b6 45 00 80 push $0x800045b6
800030e7: 68 8d 00 00 00 push $0x8d
800030ec: 68 20 45 00 80 push $0x80004520
800030f1: e8 81 10 00 00 call 80004177 <_panic>
return child;
800030f6: 8b 45 e4 mov -0x1c(%ebp),%eax
}
800030f9: 8d 65 f4 lea -0xc(%ebp),%esp
800030fc: 5b pop %ebx
800030fd: 5e pop %esi
800030fe: 5f pop %edi
800030ff: 5d pop %ebp
80003100: c3 ret
80003101 <sfork>:
// Challenge!
int
sfork(void)
{
80003101: 55 push %ebp
80003102: 89 e5 mov %esp,%ebp
80003104: 83 ec 0c sub $0xc,%esp
panic("sfork not implemented");
80003107: 68 cd 45 00 80 push $0x800045cd
8000310c: 68 96 00 00 00 push $0x96
80003111: 68 20 45 00 80 push $0x80004520
80003116: e8 5c 10 00 00 call 80004177 <_panic>
8000311b <wait>:
#include <syslib.h>
// Waits until 'envid' exits.
void
wait(envid_t envid)
{
8000311b: 55 push %ebp
8000311c: 89 e5 mov %esp,%ebp
8000311e: 56 push %esi
8000311f: 53 push %ebx
80003120: 8b 75 08 mov 0x8(%ebp),%esi
const volatile struct Env *e;
e = &envs[ENVX(envid)];
80003123: 89 f3 mov %esi,%ebx
80003125: 81 e3 ff 03 00 00 and $0x3ff,%ebx
while (e->env_id == envid && e->env_status != ENV_FREE)
8000312b: 6b c3 7c imul $0x7c,%ebx,%eax
8000312e: 05 00 00 c0 ee add $0xeec00000,%eax
80003133: 8b 40 48 mov 0x48(%eax),%eax
80003136: 39 c6 cmp %eax,%esi
80003138: 75 2b jne 80003165 <wait+0x4a>
8000313a: 6b c3 7c imul $0x7c,%ebx,%eax
8000313d: 05 00 00 c0 ee add $0xeec00000,%eax
80003142: 8b 40 54 mov 0x54(%eax),%eax
80003145: 85 c0 test %eax,%eax
80003147: 74 1c je 80003165 <wait+0x4a>
80003149: 6b db 7c imul $0x7c,%ebx,%ebx
8000314c: 81 c3 00 00 c0 ee add $0xeec00000,%ebx
sys_yield();
80003152: e8 92 ec ff ff call 80001de9 <sys_yield>
wait(envid_t envid)
{
const volatile struct Env *e;
e = &envs[ENVX(envid)];
while (e->env_id == envid && e->env_status != ENV_FREE)
80003157: 8b 43 48 mov 0x48(%ebx),%eax
8000315a: 39 c6 cmp %eax,%esi
8000315c: 75 07 jne 80003165 <wait+0x4a>
8000315e: 8b 43 54 mov 0x54(%ebx),%eax
80003161: 85 c0 test %eax,%eax
80003163: 75 ed jne 80003152 <wait+0x37>
sys_yield();
}
80003165: 5b pop %ebx
80003166: 5e pop %esi
80003167: 5d pop %ebp
80003168: c3 ret
80003169 <spawn>:
// argv: pointer to null-terminated array of pointers to strings,
// which will be passed to the child as its command-line arguments.
// Returns child envid on success, < 0 on failure.
int
spawn(const char *prog, const char **argv)
{
80003169: 55 push %ebp
8000316a: 89 e5 mov %esp,%ebp
8000316c: 57 push %edi
8000316d: 56 push %esi
8000316e: 53 push %ebx
8000316f: 81 ec 94 02 00 00 sub $0x294,%esp
// - Call sys_env_set_trapframe(child, &child_tf) to set up the
// correct initial eip and esp values in the child.
//
// - Start the child process running with sys_env_set_status().
if ((r = open(prog, O_RDONLY)) < 0)
80003175: 6a 00 push $0x0
80003177: ff 75 08 pushl 0x8(%ebp)
8000317a: e8 7a f7 ff ff call 800028f9 <open>
8000317f: 89 c7 mov %eax,%edi
80003181: 89 85 8c fd ff ff mov %eax,-0x274(%ebp)
80003187: 83 c4 10 add $0x10,%esp
8000318a: 85 c0 test %eax,%eax
8000318c: 0f 88 9b 04 00 00 js 8000362d <spawn+0x4c4>
return r;
fd = r;
// Read elf header
elf = (struct Elf*) elf_buf;
if (readn(fd, elf_buf, sizeof(elf_buf)) != sizeof(elf_buf)
80003192: 83 ec 04 sub $0x4,%esp
80003195: 68 00 02 00 00 push $0x200
8000319a: 8d 85 e8 fd ff ff lea -0x218(%ebp),%eax
800031a0: 50 push %eax
800031a1: 57 push %edi
800031a2: e8 93 f3 ff ff call 8000253a <readn>
800031a7: 83 c4 10 add $0x10,%esp
800031aa: 3d 00 02 00 00 cmp $0x200,%eax
800031af: 75 0c jne 800031bd <spawn+0x54>
|| elf->e_magic != ELF_MAGIC) {
800031b1: 81 bd e8 fd ff ff 7f cmpl $0x464c457f,-0x218(%ebp)
800031b8: 45 4c 46
800031bb: 74 33 je 800031f0 <spawn+0x87>
close(fd);
800031bd: 83 ec 0c sub $0xc,%esp
800031c0: ff b5 8c fd ff ff pushl -0x274(%ebp)
800031c6: e8 a4 f1 ff ff call 8000236f <close>
cprintf("elf magic %08x want %08x\n", elf->e_magic, ELF_MAGIC);
800031cb: 83 c4 0c add $0xc,%esp
800031ce: 68 7f 45 4c 46 push $0x464c457f
800031d3: ff b5 e8 fd ff ff pushl -0x218(%ebp)
800031d9: 68 0b 46 00 80 push $0x8000460b
800031de: e8 6c 0d 00 00 call 80003f4f <cprintf>
return -E_NOT_EXEC;
800031e3: 83 c4 10 add $0x10,%esp
800031e6: bb f0 ff ff ff mov $0xfffffff0,%ebx
800031eb: e9 be 04 00 00 jmp 800036ae <spawn+0x545>
800031f0: b8 07 00 00 00 mov $0x7,%eax
800031f5: cd 30 int $0x30
800031f7: 89 85 74 fd ff ff mov %eax,-0x28c(%ebp)
800031fd: 89 85 84 fd ff ff mov %eax,-0x27c(%ebp)
}
// Create new child environment
if ((r = sys_exofork()) < 0)
80003203: 85 c0 test %eax,%eax
80003205: 0f 88 2a 04 00 00 js 80003635 <spawn+0x4cc>
return r;
child = r;
// Set up trap frame, including initial stack.
child_tf = envs[ENVX(child)].env_tf;
8000320b: 89 c6 mov %eax,%esi
8000320d: 81 e6 ff 03 00 00 and $0x3ff,%esi
80003213: 6b f6 7c imul $0x7c,%esi,%esi
80003216: 81 c6 00 00 c0 ee add $0xeec00000,%esi
8000321c: 8d bd a4 fd ff ff lea -0x25c(%ebp),%edi
80003222: b9 11 00 00 00 mov $0x11,%ecx
80003227: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
child_tf.tf_eip = elf->e_entry;
80003229: 8b 85 00 fe ff ff mov -0x200(%ebp),%eax
8000322f: 89 85 d4 fd ff ff mov %eax,-0x22c(%ebp)
uintptr_t *argv_store;
// Count the number of arguments (argc)
// and the total amount of space needed for strings (string_size).
string_size = 0;
for (argc = 0; argv[argc] != 0; argc++)
80003235: 8b 45 0c mov 0xc(%ebp),%eax
80003238: 8b 00 mov (%eax),%eax
8000323a: 85 c0 test %eax,%eax
8000323c: 74 3c je 8000327a <spawn+0x111>
8000323e: bb 00 00 00 00 mov $0x0,%ebx
80003243: be 00 00 00 00 mov $0x0,%esi
80003248: 8b 7d 0c mov 0xc(%ebp),%edi
string_size += strlen(argv[argc]) + 1;
8000324b: 83 ec 0c sub $0xc,%esp
8000324e: 50 push %eax
8000324f: e8 76 e6 ff ff call 800018ca <strlen>
80003254: 8d 74 30 01 lea 0x1(%eax,%esi,1),%esi
uintptr_t *argv_store;
// Count the number of arguments (argc)
// and the total amount of space needed for strings (string_size).
string_size = 0;
for (argc = 0; argv[argc] != 0; argc++)
80003258: 83 c3 01 add $0x1,%ebx
8000325b: 8d 0c 9d 00 00 00 00 lea 0x0(,%ebx,4),%ecx
80003262: 8b 04 9f mov (%edi,%ebx,4),%eax
80003265: 83 c4 10 add $0x10,%esp
80003268: 85 c0 test %eax,%eax
8000326a: 75 df jne 8000324b <spawn+0xe2>
8000326c: 89 9d 88 fd ff ff mov %ebx,-0x278(%ebp)
80003272: 89 8d 80 fd ff ff mov %ecx,-0x280(%ebp)
80003278: eb 1e jmp 80003298 <spawn+0x12f>
8000327a: c7 85 80 fd ff ff 00 movl $0x0,-0x280(%ebp)
80003281: 00 00 00
80003284: c7 85 88 fd ff ff 00 movl $0x0,-0x278(%ebp)
8000328b: 00 00 00
8000328e: bb 00 00 00 00 mov $0x0,%ebx
char *string_store;
uintptr_t *argv_store;
// Count the number of arguments (argc)
// and the total amount of space needed for strings (string_size).
string_size = 0;
80003293: be 00 00 00 00 mov $0x0,%esi
// Determine where to place the strings and the argv array.
// Set up pointers into the temporary page 'UTEMP'; we'll map a page
// there later, then remap that page into the child environment
// at (USTACKTOP - PGSIZE).
// strings is the topmost thing on the stack.
string_store = (char*) UTEMP + PGSIZE - string_size;
80003298: bf 00 10 40 00 mov $0x401000,%edi
8000329d: 29 f7 sub %esi,%edi
// argv is below that. There's one argument pointer per argument, plus
// a null pointer.
argv_store = (uintptr_t*) (ROUNDDOWN(string_store, 4) - 4 * (argc + 1));
8000329f: 89 fa mov %edi,%edx
800032a1: 83 e2 fc and $0xfffffffc,%edx
800032a4: 8d 04 9d 04 00 00 00 lea 0x4(,%ebx,4),%eax
800032ab: 29 c2 sub %eax,%edx
800032ad: 89 95 94 fd ff ff mov %edx,-0x26c(%ebp)
// Make sure that argv, strings, and the 2 words that hold 'argc'
// and 'argv' themselves will all fit in a single stack page.
if ((void*) (argv_store - 2) < (void*) UTEMP)
800032b3: 8d 42 f8 lea -0x8(%edx),%eax
800032b6: 3d ff ff 3f 00 cmp $0x3fffff,%eax
800032bb: 0f 86 84 03 00 00 jbe 80003645 <spawn+0x4dc>
return -E_NO_MEM;
// Allocate the single stack page at UTEMP.
if ((r = sys_page_alloc(0, (void*) UTEMP, PTE_P|PTE_U|PTE_W)) < 0)
800032c1: 83 ec 04 sub $0x4,%esp
800032c4: 6a 07 push $0x7
800032c6: 68 00 00 40 00 push $0x400000
800032cb: 6a 00 push $0x0
800032cd: e8 36 eb ff ff call 80001e08 <sys_page_alloc>
800032d2: 83 c4 10 add $0x10,%esp
800032d5: 85 c0 test %eax,%eax
800032d7: 0f 88 6f 03 00 00 js 8000364c <spawn+0x4e3>
// (Again, argv should use an address valid in the child's
// environment.)
//
// * Set *init_esp to the initial stack pointer for the child,
// (Again, use an address valid in the child's environment.)
for (i = 0; i < argc; i++) {
800032dd: 85 db test %ebx,%ebx
800032df: 7e 46 jle 80003327 <spawn+0x1be>
800032e1: be 00 00 00 00 mov $0x0,%esi
800032e6: 89 9d 90 fd ff ff mov %ebx,-0x270(%ebp)
800032ec: 8b 5d 0c mov 0xc(%ebp),%ebx
argv_store[i] = UTEMP2USTACK(string_store);
800032ef: 8d 87 00 d0 7f ee lea -0x11803000(%edi),%eax
800032f5: 8b 95 94 fd ff ff mov -0x26c(%ebp),%edx
800032fb: 89 04 b2 mov %eax,(%edx,%esi,4)
strcpy(string_store, argv[i]);
800032fe: 83 ec 08 sub $0x8,%esp
80003301: ff 34 b3 pushl (%ebx,%esi,4)
80003304: 57 push %edi
80003305: e8 1b e6 ff ff call 80001925 <strcpy>
string_store += strlen(argv[i]) + 1;
8000330a: 83 c4 04 add $0x4,%esp
8000330d: ff 34 b3 pushl (%ebx,%esi,4)
80003310: e8 b5 e5 ff ff call 800018ca <strlen>
80003315: 8d 7c 07 01 lea 0x1(%edi,%eax,1),%edi
// (Again, argv should use an address valid in the child's
// environment.)
//
// * Set *init_esp to the initial stack pointer for the child,
// (Again, use an address valid in the child's environment.)
for (i = 0; i < argc; i++) {
80003319: 83 c6 01 add $0x1,%esi
8000331c: 83 c4 10 add $0x10,%esp
8000331f: 3b b5 90 fd ff ff cmp -0x270(%ebp),%esi
80003325: 75 c8 jne 800032ef <spawn+0x186>
argv_store[i] = UTEMP2USTACK(string_store);
strcpy(string_store, argv[i]);
string_store += strlen(argv[i]) + 1;
}
argv_store[argc] = 0;
80003327: 8b 85 94 fd ff ff mov -0x26c(%ebp),%eax
8000332d: 8b bd 80 fd ff ff mov -0x280(%ebp),%edi
80003333: c7 04 38 00 00 00 00 movl $0x0,(%eax,%edi,1)
argv_store[-1] = UTEMP2USTACK(argv_store);
8000333a: 89 c7 mov %eax,%edi
8000333c: 2d 00 30 80 11 sub $0x11803000,%eax
80003341: 89 47 fc mov %eax,-0x4(%edi)
argv_store[-2] = argc;
80003344: 89 f8 mov %edi,%eax
80003346: 8b bd 88 fd ff ff mov -0x278(%ebp),%edi
8000334c: 89 78 f8 mov %edi,-0x8(%eax)
*init_esp = UTEMP2USTACK(&argv_store[-2]);
8000334f: 2d 08 30 80 11 sub $0x11803008,%eax
80003354: 89 85 e0 fd ff ff mov %eax,-0x220(%ebp)
// After completing the stack, map it into the child's address space
// and unmap it from ours!
if ((r = sys_page_map(0, UTEMP, child, (void*) (USTACKTOP - PGSIZE), PTE_P | PTE_U | PTE_W)) < 0)
8000335a: 83 ec 0c sub $0xc,%esp
8000335d: 6a 07 push $0x7
8000335f: 68 00 d0 bf ee push $0xeebfd000
80003364: ff b5 74 fd ff ff pushl -0x28c(%ebp)
8000336a: 68 00 00 40 00 push $0x400000
8000336f: 6a 00 push $0x0
80003371: e8 d5 ea ff ff call 80001e4b <sys_page_map>
80003376: 89 c3 mov %eax,%ebx
80003378: 83 c4 20 add $0x20,%esp
8000337b: 85 c0 test %eax,%eax
8000337d: 0f 88 19 03 00 00 js 8000369c <spawn+0x533>
goto error;
if ((r = sys_page_unmap(0, UTEMP)) < 0)
80003383: 83 ec 08 sub $0x8,%esp
80003386: 68 00 00 40 00 push $0x400000
8000338b: 6a 00 push $0x0
8000338d: e8 fb ea ff ff call 80001e8d <sys_page_unmap>
80003392: 89 c3 mov %eax,%ebx
80003394: 83 c4 10 add $0x10,%esp
80003397: 85 c0 test %eax,%eax
80003399: 0f 88 fd 02 00 00 js 8000369c <spawn+0x533>
if ((r = init_stack(child, argv, &child_tf.tf_esp)) < 0)
return r;
// Set up program segments as defined in ELF header.
ph = (struct Proghdr*) (elf_buf + elf->e_phoff);
8000339f: 8b 85 04 fe ff ff mov -0x1fc(%ebp),%eax
800033a5: 8d 84 05 e8 fd ff ff lea -0x218(%ebp,%eax,1),%eax
800033ac: 89 85 78 fd ff ff mov %eax,-0x288(%ebp)
for (i = 0; i < elf->e_phnum; i++, ph++) {
800033b2: 66 83 bd 14 fe ff ff cmpw $0x0,-0x1ec(%ebp)
800033b9: 00
800033ba: 0f 84 bb 02 00 00 je 8000367b <spawn+0x512>
800033c0: c7 85 80 fd ff ff 00 movl $0x0,-0x280(%ebp)
800033c7: 00 00 00
if (ph->p_type != ELF_PROG_LOAD)
800033ca: 8b 85 78 fd ff ff mov -0x288(%ebp),%eax
800033d0: 83 38 01 cmpl $0x1,(%eax)
800033d3: 0f 85 73 01 00 00 jne 8000354c <spawn+0x3e3>
continue;
perm = PTE_P | PTE_U;
if (ph->p_flags & ELF_PROG_FLAG_WRITE)
800033d9: 89 c7 mov %eax,%edi
800033db: 8b 40 18 mov 0x18(%eax),%eax
800033de: 89 85 94 fd ff ff mov %eax,-0x26c(%ebp)
800033e4: 83 e0 02 and $0x2,%eax
perm |= PTE_W;
800033e7: 83 f8 01 cmp $0x1,%eax
800033ea: 19 c0 sbb %eax,%eax
800033ec: 83 e0 fe and $0xfffffffe,%eax
800033ef: 83 c0 07 add $0x7,%eax
800033f2: 89 85 88 fd ff ff mov %eax,-0x278(%ebp)
if ((r = map_segment(child, ph->p_va, ph->p_memsz,
800033f8: 89 f8 mov %edi,%eax
800033fa: 8b 7f 04 mov 0x4(%edi),%edi
800033fd: 89 fa mov %edi,%edx
800033ff: 89 bd 7c fd ff ff mov %edi,-0x284(%ebp)
80003405: 8b 78 10 mov 0x10(%eax),%edi
80003408: 8b 48 14 mov 0x14(%eax),%ecx
8000340b: 89 8d 90 fd ff ff mov %ecx,-0x270(%ebp)
80003411: 8b 70 08 mov 0x8(%eax),%esi
int i, r;
void *blk;
//cprintf("map_segment %x+%x\n", va, memsz);
if ((i = PGOFF(va))) {
80003414: 89 f0 mov %esi,%eax
80003416: 25 ff 0f 00 00 and $0xfff,%eax
8000341b: 74 14 je 80003431 <spawn+0x2c8>
va -= i;
8000341d: 29 c6 sub %eax,%esi
memsz += i;
8000341f: 01 c1 add %eax,%ecx
80003421: 89 8d 90 fd ff ff mov %ecx,-0x270(%ebp)
filesz += i;
80003427: 01 c7 add %eax,%edi
fileoffset -= i;
80003429: 29 c2 sub %eax,%edx
8000342b: 89 95 7c fd ff ff mov %edx,-0x284(%ebp)
}
for (i = 0; i < memsz; i += PGSIZE) {
80003431: 83 bd 90 fd ff ff 00 cmpl $0x0,-0x270(%ebp)
80003438: 0f 84 0e 01 00 00 je 8000354c <spawn+0x3e3>
8000343e: bb 00 00 00 00 mov $0x0,%ebx
80003443: 89 9d 94 fd ff ff mov %ebx,-0x26c(%ebp)
if (i >= filesz) {
80003449: 39 df cmp %ebx,%edi
8000344b: 77 27 ja 80003474 <spawn+0x30b>
// allocate a blank page
if ((r = sys_page_alloc(child, (void*) (va + i), perm)) < 0)
8000344d: 83 ec 04 sub $0x4,%esp
80003450: ff b5 88 fd ff ff pushl -0x278(%ebp)
80003456: 56 push %esi
80003457: ff b5 84 fd ff ff pushl -0x27c(%ebp)
8000345d: e8 a6 e9 ff ff call 80001e08 <sys_page_alloc>
80003462: 83 c4 10 add $0x10,%esp
80003465: 85 c0 test %eax,%eax
80003467: 0f 89 c7 00 00 00 jns 80003534 <spawn+0x3cb>
8000346d: 89 c3 mov %eax,%ebx
8000346f: e9 e6 01 00 00 jmp 8000365a <spawn+0x4f1>
return r;
} else {
// from file
if ((r = sys_page_alloc(0, UTEMP, PTE_P|PTE_U|PTE_W)) < 0)
80003474: 83 ec 04 sub $0x4,%esp
80003477: 6a 07 push $0x7
80003479: 68 00 00 40 00 push $0x400000
8000347e: 6a 00 push $0x0
80003480: e8 83 e9 ff ff call 80001e08 <sys_page_alloc>
80003485: 83 c4 10 add $0x10,%esp
80003488: 85 c0 test %eax,%eax
8000348a: 0f 88 c0 01 00 00 js 80003650 <spawn+0x4e7>
return r;
if ((r = seek(fd, fileoffset + i)) < 0)
80003490: 83 ec 08 sub $0x8,%esp
80003493: 8b 85 7c fd ff ff mov -0x284(%ebp),%eax
80003499: 03 85 94 fd ff ff add -0x26c(%ebp),%eax
8000349f: 50 push %eax
800034a0: ff b5 8c fd ff ff pushl -0x274(%ebp)
800034a6: e8 70 f1 ff ff call 8000261b <seek>
800034ab: 83 c4 10 add $0x10,%esp
800034ae: 85 c0 test %eax,%eax
800034b0: 0f 88 9e 01 00 00 js 80003654 <spawn+0x4eb>
return r;
if ((r = readn(fd, UTEMP, MIN(PGSIZE, filesz-i))) < 0)
800034b6: 83 ec 04 sub $0x4,%esp
800034b9: 89 f8 mov %edi,%eax
800034bb: 2b 85 94 fd ff ff sub -0x26c(%ebp),%eax
800034c1: 3d 00 10 00 00 cmp $0x1000,%eax
800034c6: ba 00 10 00 00 mov $0x1000,%edx
800034cb: 0f 47 c2 cmova %edx,%eax
800034ce: 50 push %eax
800034cf: 68 00 00 40 00 push $0x400000
800034d4: ff b5 8c fd ff ff pushl -0x274(%ebp)
800034da: e8 5b f0 ff ff call 8000253a <readn>
800034df: 83 c4 10 add $0x10,%esp
800034e2: 85 c0 test %eax,%eax
800034e4: 0f 88 6e 01 00 00 js 80003658 <spawn+0x4ef>
return r;
if ((r = sys_page_map(0, UTEMP, child, (void*) (va + i), perm)) < 0)
800034ea: 83 ec 0c sub $0xc,%esp
800034ed: ff b5 88 fd ff ff pushl -0x278(%ebp)
800034f3: 56 push %esi
800034f4: ff b5 84 fd ff ff pushl -0x27c(%ebp)
800034fa: 68 00 00 40 00 push $0x400000
800034ff: 6a 00 push $0x0
80003501: e8 45 e9 ff ff call 80001e4b <sys_page_map>
80003506: 83 c4 20 add $0x20,%esp
80003509: 85 c0 test %eax,%eax
8000350b: 79 15 jns 80003522 <spawn+0x3b9>
panic("spawn: sys_page_map data: %e", r);
8000350d: 50 push %eax
8000350e: 68 25 46 00 80 push $0x80004625
80003513: 68 23 01 00 00 push $0x123
80003518: 68 42 46 00 80 push $0x80004642
8000351d: e8 55 0c 00 00 call 80004177 <_panic>
sys_page_unmap(0, UTEMP);
80003522: 83 ec 08 sub $0x8,%esp
80003525: 68 00 00 40 00 push $0x400000
8000352a: 6a 00 push $0x0
8000352c: e8 5c e9 ff ff call 80001e8d <sys_page_unmap>
80003531: 83 c4 10 add $0x10,%esp
memsz += i;
filesz += i;
fileoffset -= i;
}
for (i = 0; i < memsz; i += PGSIZE) {
80003534: 81 c3 00 10 00 00 add $0x1000,%ebx
8000353a: 81 c6 00 10 00 00 add $0x1000,%esi
80003540: 39 9d 90 fd ff ff cmp %ebx,-0x270(%ebp)
80003546: 0f 87 f7 fe ff ff ja 80003443 <spawn+0x2da>
if ((r = init_stack(child, argv, &child_tf.tf_esp)) < 0)
return r;
// Set up program segments as defined in ELF header.
ph = (struct Proghdr*) (elf_buf + elf->e_phoff);
for (i = 0; i < elf->e_phnum; i++, ph++) {
8000354c: 83 85 80 fd ff ff 01 addl $0x1,-0x280(%ebp)
80003553: 8b 8d 80 fd ff ff mov -0x280(%ebp),%ecx
80003559: 83 85 78 fd ff ff 20 addl $0x20,-0x288(%ebp)
80003560: 0f b7 85 14 fe ff ff movzwl -0x1ec(%ebp),%eax
80003567: 39 c8 cmp %ecx,%eax
80003569: 0f 8f 5b fe ff ff jg 800033ca <spawn+0x261>
8000356f: e9 07 01 00 00 jmp 8000367b <spawn+0x512>
{
// LAB 5: Your code here.
int i;
for(i = 0; i < UTOP; i += PGSIZE)
{
if((uvpd[PDX(i)] & PTE_P) &&
80003574: 89 d8 mov %ebx,%eax
80003576: c1 e8 16 shr $0x16,%eax
80003579: 8b 04 85 00 d0 7b ef mov -0x10843000(,%eax,4),%eax
80003580: a8 01 test $0x1,%al
80003582: 74 3e je 800035c2 <spawn+0x459>
(uvpt[PGNUM(i)] & PTE_P) &&
80003584: 89 d8 mov %ebx,%eax
80003586: c1 e8 0c shr $0xc,%eax
80003589: 8b 14 85 00 00 40 ef mov -0x10c00000(,%eax,4),%edx
{
// LAB 5: Your code here.
int i;
for(i = 0; i < UTOP; i += PGSIZE)
{
if((uvpd[PDX(i)] & PTE_P) &&
80003590: f6 c2 01 test $0x1,%dl
80003593: 74 2d je 800035c2 <spawn+0x459>
(uvpt[PGNUM(i)] & PTE_P) &&
(uvpt[PGNUM(i)] & PTE_U) &&
80003595: 8b 14 85 00 00 40 ef mov -0x10c00000(,%eax,4),%edx
// LAB 5: Your code here.
int i;
for(i = 0; i < UTOP; i += PGSIZE)
{
if((uvpd[PDX(i)] & PTE_P) &&
(uvpt[PGNUM(i)] & PTE_P) &&
8000359c: f6 c2 04 test $0x4,%dl
8000359f: 74 21 je 800035c2 <spawn+0x459>
(uvpt[PGNUM(i)] & PTE_U) &&
(uvpt[PGNUM(i)] & PTE_SHARE))
800035a1: 8b 04 85 00 00 40 ef mov -0x10c00000(,%eax,4),%eax
int i;
for(i = 0; i < UTOP; i += PGSIZE)
{
if((uvpd[PDX(i)] & PTE_P) &&
(uvpt[PGNUM(i)] & PTE_P) &&
(uvpt[PGNUM(i)] & PTE_U) &&
800035a8: f6 c4 04 test $0x4,%ah
800035ab: 74 15 je 800035c2 <spawn+0x459>
(uvpt[PGNUM(i)] & PTE_SHARE))
sys_page_map(0, (void *)i, child, (void *)i,
800035ad: 83 ec 0c sub $0xc,%esp
800035b0: 68 07 0e 00 00 push $0xe07
800035b5: 53 push %ebx
800035b6: 56 push %esi
800035b7: 53 push %ebx
800035b8: 6a 00 push $0x0
800035ba: e8 8c e8 ff ff call 80001e4b <sys_page_map>
800035bf: 83 c4 20 add $0x20,%esp
static int
copy_shared_pages(envid_t child)
{
// LAB 5: Your code here.
int i;
for(i = 0; i < UTOP; i += PGSIZE)
800035c2: 81 c3 00 10 00 00 add $0x1000,%ebx
800035c8: 81 fb 00 00 c0 ee cmp $0xeec00000,%ebx
800035ce: 75 a4 jne 80003574 <spawn+0x40b>
// Copy shared library state.
if ((r = copy_shared_pages(child)) < 0)
panic("copy_shared_pages: %e", r);
if ((r = sys_env_set_trapframe(child, &child_tf)) < 0)
800035d0: 83 ec 08 sub $0x8,%esp
800035d3: 8d 85 a4 fd ff ff lea -0x25c(%ebp),%eax
800035d9: 50 push %eax
800035da: ff b5 74 fd ff ff pushl -0x28c(%ebp)
800035e0: e8 2c e9 ff ff call 80001f11 <sys_env_set_trapframe>
800035e5: 83 c4 10 add $0x10,%esp
800035e8: 85 c0 test %eax,%eax
800035ea: 79 15 jns 80003601 <spawn+0x498>
panic("sys_env_set_trapframe: %e", r);
800035ec: 50 push %eax
800035ed: 68 4a 46 00 80 push $0x8000464a
800035f2: 68 85 00 00 00 push $0x85
800035f7: 68 42 46 00 80 push $0x80004642
800035fc: e8 76 0b 00 00 call 80004177 <_panic>
if ((r = sys_env_set_status(child, ENV_RUNNABLE)) < 0)
80003601: 83 ec 08 sub $0x8,%esp
80003604: 6a 02 push $0x2
80003606: ff b5 74 fd ff ff pushl -0x28c(%ebp)
8000360c: e8 be e8 ff ff call 80001ecf <sys_env_set_status>
80003611: 83 c4 10 add $0x10,%esp
80003614: 85 c0 test %eax,%eax
80003616: 79 25 jns 8000363d <spawn+0x4d4>
panic("sys_env_set_status: %e", r);
80003618: 50 push %eax
80003619: 68 b6 45 00 80 push $0x800045b6
8000361e: 68 88 00 00 00 push $0x88
80003623: 68 42 46 00 80 push $0x80004642
80003628: e8 4a 0b 00 00 call 80004177 <_panic>
// correct initial eip and esp values in the child.
//
// - Start the child process running with sys_env_set_status().
if ((r = open(prog, O_RDONLY)) < 0)
return r;
8000362d: 8b 9d 8c fd ff ff mov -0x274(%ebp),%ebx
80003633: eb 79 jmp 800036ae <spawn+0x545>
return -E_NOT_EXEC;
}
// Create new child environment
if ((r = sys_exofork()) < 0)
return r;
80003635: 8b 9d 74 fd ff ff mov -0x28c(%ebp),%ebx
8000363b: eb 71 jmp 800036ae <spawn+0x545>
panic("sys_env_set_trapframe: %e", r);
if ((r = sys_env_set_status(child, ENV_RUNNABLE)) < 0)
panic("sys_env_set_status: %e", r);
return child;
8000363d: 8b 9d 74 fd ff ff mov -0x28c(%ebp),%ebx
80003643: eb 69 jmp 800036ae <spawn+0x545>
argv_store = (uintptr_t*) (ROUNDDOWN(string_store, 4) - 4 * (argc + 1));
// Make sure that argv, strings, and the 2 words that hold 'argc'
// and 'argv' themselves will all fit in a single stack page.
if ((void*) (argv_store - 2) < (void*) UTEMP)
return -E_NO_MEM;
80003645: bb fc ff ff ff mov $0xfffffffc,%ebx
8000364a: eb 62 jmp 800036ae <spawn+0x545>
// Allocate the single stack page at UTEMP.
if ((r = sys_page_alloc(0, (void*) UTEMP, PTE_P|PTE_U|PTE_W)) < 0)
return r;
8000364c: 89 c3 mov %eax,%ebx
8000364e: eb 5e jmp 800036ae <spawn+0x545>
// allocate a blank page
if ((r = sys_page_alloc(child, (void*) (va + i), perm)) < 0)
return r;
} else {
// from file
if ((r = sys_page_alloc(0, UTEMP, PTE_P|PTE_U|PTE_W)) < 0)
80003650: 89 c3 mov %eax,%ebx
80003652: eb 06 jmp 8000365a <spawn+0x4f1>
return r;
if ((r = seek(fd, fileoffset + i)) < 0)
80003654: 89 c3 mov %eax,%ebx
80003656: eb 02 jmp 8000365a <spawn+0x4f1>
return r;
if ((r = readn(fd, UTEMP, MIN(PGSIZE, filesz-i))) < 0)
80003658: 89 c3 mov %eax,%ebx
panic("sys_env_set_status: %e", r);
return child;
error:
sys_env_destroy(child);
8000365a: 83 ec 0c sub $0xc,%esp
8000365d: ff b5 74 fd ff ff pushl -0x28c(%ebp)
80003663: e8 21 e7 ff ff call 80001d89 <sys_env_destroy>
close(fd);
80003668: 83 c4 04 add $0x4,%esp
8000366b: ff b5 8c fd ff ff pushl -0x274(%ebp)
80003671: e8 f9 ec ff ff call 8000236f <close>
return r;
80003676: 83 c4 10 add $0x10,%esp
80003679: eb 33 jmp 800036ae <spawn+0x545>
perm |= PTE_W;
if ((r = map_segment(child, ph->p_va, ph->p_memsz,
fd, ph->p_filesz, ph->p_offset, perm)) < 0)
goto error;
}
close(fd);
8000367b: 83 ec 0c sub $0xc,%esp
8000367e: ff b5 8c fd ff ff pushl -0x274(%ebp)
80003684: e8 e6 ec ff ff call 8000236f <close>
80003689: 83 c4 10 add $0x10,%esp
8000368c: bb 00 00 00 00 mov $0x0,%ebx
80003691: 8b b5 84 fd ff ff mov -0x27c(%ebp),%esi
80003697: e9 d8 fe ff ff jmp 80003574 <spawn+0x40b>
goto error;
return 0;
error:
sys_page_unmap(0, UTEMP);
8000369c: 83 ec 08 sub $0x8,%esp
8000369f: 68 00 00 40 00 push $0x400000
800036a4: 6a 00 push $0x0
800036a6: e8 e2 e7 ff ff call 80001e8d <sys_page_unmap>
800036ab: 83 c4 10 add $0x10,%esp
error:
sys_env_destroy(child);
close(fd);
return r;
}
800036ae: 89 d8 mov %ebx,%eax
800036b0: 8d 65 f4 lea -0xc(%ebp),%esp
800036b3: 5b pop %ebx
800036b4: 5e pop %esi
800036b5: 5f pop %edi
800036b6: 5d pop %ebp
800036b7: c3 ret
800036b8 <spawnl>:
// Spawn, taking command-line arguments array directly on the stack.
// NOTE: Must have a sentinal of NULL at the end of the args
// (none of the args may be NULL).
int
spawnl(const char *prog, const char *arg0, ...)
{
800036b8: 55 push %ebp
800036b9: 89 e5 mov %esp,%ebp
800036bb: 57 push %edi
800036bc: 56 push %esi
800036bd: 53 push %ebx
800036be: 83 ec 1c sub $0x1c,%esp
// argument will always be NULL, and that none of the other
// arguments will be NULL.
int argc=0;
va_list vl;
va_start(vl, arg0);
while(va_arg(vl, void *) != NULL)
800036c1: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
800036c5: 74 61 je 80003728 <spawnl+0x70>
800036c7: 8d 45 14 lea 0x14(%ebp),%eax
800036ca: ba 00 00 00 00 mov $0x0,%edx
800036cf: eb 02 jmp 800036d3 <spawnl+0x1b>
argc++;
800036d1: 89 ca mov %ecx,%edx
800036d3: 8d 4a 01 lea 0x1(%edx),%ecx
// argument will always be NULL, and that none of the other
// arguments will be NULL.
int argc=0;
va_list vl;
va_start(vl, arg0);
while(va_arg(vl, void *) != NULL)
800036d6: 83 c0 04 add $0x4,%eax
800036d9: 83 78 fc 00 cmpl $0x0,-0x4(%eax)
800036dd: 75 f2 jne 800036d1 <spawnl+0x19>
argc++;
va_end(vl);
// Now that we have the size of the args, do a second pass
// and store the values in a VLA, which has the format of argv
const char *argv[argc+2];
800036df: 8d 04 95 1e 00 00 00 lea 0x1e(,%edx,4),%eax
800036e6: 83 e0 f0 and $0xfffffff0,%eax
800036e9: 29 c4 sub %eax,%esp
800036eb: 8d 44 24 03 lea 0x3(%esp),%eax
800036ef: c1 e8 02 shr $0x2,%eax
800036f2: 8d 34 85 00 00 00 00 lea 0x0(,%eax,4),%esi
800036f9: 89 f3 mov %esi,%ebx
argv[0] = arg0;
800036fb: 8b 7d 0c mov 0xc(%ebp),%edi
800036fe: 89 3c 85 00 00 00 00 mov %edi,0x0(,%eax,4)
argv[argc+1] = NULL;
80003705: c7 44 96 08 00 00 00 movl $0x0,0x8(%esi,%edx,4)
8000370c: 00
va_start(vl, arg0);
unsigned i;
for(i=0;i<argc;i++)
8000370d: 89 ce mov %ecx,%esi
8000370f: 85 c9 test %ecx,%ecx
80003711: 74 25 je 80003738 <spawnl+0x80>
80003713: b8 00 00 00 00 mov $0x0,%eax
argv[i+1] = va_arg(vl, const char *);
80003718: 83 c0 01 add $0x1,%eax
8000371b: 8b 54 85 0c mov 0xc(%ebp,%eax,4),%edx
8000371f: 89 14 83 mov %edx,(%ebx,%eax,4)
argv[0] = arg0;
argv[argc+1] = NULL;
va_start(vl, arg0);
unsigned i;
for(i=0;i<argc;i++)
80003722: 39 f0 cmp %esi,%eax
80003724: 75 f2 jne 80003718 <spawnl+0x60>
80003726: eb 10 jmp 80003738 <spawnl+0x80>
va_end(vl);
// Now that we have the size of the args, do a second pass
// and store the values in a VLA, which has the format of argv
const char *argv[argc+2];
argv[0] = arg0;
80003728: 8b 45 0c mov 0xc(%ebp),%eax
8000372b: 89 45 e0 mov %eax,-0x20(%ebp)
argv[argc+1] = NULL;
8000372e: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
argc++;
va_end(vl);
// Now that we have the size of the args, do a second pass
// and store the values in a VLA, which has the format of argv
const char *argv[argc+2];
80003735: 8d 5d e0 lea -0x20(%ebp),%ebx
va_start(vl, arg0);
unsigned i;
for(i=0;i<argc;i++)
argv[i+1] = va_arg(vl, const char *);
va_end(vl);
return spawn(prog, argv);
80003738: 83 ec 08 sub $0x8,%esp
8000373b: 53 push %ebx
8000373c: ff 75 08 pushl 0x8(%ebp)
8000373f: e8 25 fa ff ff call 80003169 <spawn>
}
80003744: 8d 65 f4 lea -0xc(%ebp),%esp
80003747: 5b pop %ebx
80003748: 5e pop %esi
80003749: 5f pop %edi
8000374a: 5d pop %ebp
8000374b: c3 ret
8000374c <exit>:
#include <syslib.h>
void
exit(void)
{
8000374c: 55 push %ebp
8000374d: 89 e5 mov %esp,%ebp
8000374f: 83 ec 08 sub $0x8,%esp
close_all();
80003752: e8 43 ec ff ff call 8000239a <close_all>
sys_env_destroy(0);
80003757: 83 ec 0c sub $0xc,%esp
8000375a: 6a 00 push $0x0
8000375c: e8 28 e6 ff ff call 80001d89 <sys_env_destroy>
}
80003761: 83 c4 10 add $0x10,%esp
80003764: c9 leave
80003765: c3 ret
80003766 <pageref>:
#include <syslib.h>
int
pageref(void *v)
{
80003766: 55 push %ebp
80003767: 89 e5 mov %esp,%ebp
80003769: 8b 55 08 mov 0x8(%ebp),%edx
pte_t pte;
if (!(uvpd[PDX(v)] & PTE_P))
8000376c: 89 d0 mov %edx,%eax
8000376e: c1 e8 16 shr $0x16,%eax
80003771: 8b 0c 85 00 d0 7b ef mov -0x10843000(,%eax,4),%ecx
return 0;
80003778: b8 00 00 00 00 mov $0x0,%eax
int
pageref(void *v)
{
pte_t pte;
if (!(uvpd[PDX(v)] & PTE_P))
8000377d: f6 c1 01 test $0x1,%cl
80003780: 74 1d je 8000379f <pageref+0x39>
return 0;
pte = uvpt[PGNUM(v)];
80003782: c1 ea 0c shr $0xc,%edx
80003785: 8b 14 95 00 00 40 ef mov -0x10c00000(,%edx,4),%edx
// cprintf("pageref pte:0x%08x\n", pte);
if (!(pte & PTE_P))
8000378c: f6 c2 01 test $0x1,%dl
8000378f: 74 0e je 8000379f <pageref+0x39>
return 0;
// cprintf("pageref 0x%08x: %d\n", v, pages[PGNUM(pte)].pp_ref);
return pages[PGNUM(pte)].pp_ref;
80003791: c1 ea 0c shr $0xc,%edx
80003794: 0f b7 04 d5 04 00 00 movzwl -0x10fffffc(,%edx,8),%eax
8000379b: ef
8000379c: 0f b7 c0 movzwl %ax,%eax
}
8000379f: 5d pop %ebp
800037a0: c3 ret
800037a1 <argstart>:
#include <args.h>
#include <string.h>
void
argstart(int *argc, char **argv, struct Argstate *args)
{
800037a1: 55 push %ebp
800037a2: 89 e5 mov %esp,%ebp
800037a4: 8b 55 08 mov 0x8(%ebp),%edx
800037a7: 8b 4d 0c mov 0xc(%ebp),%ecx
800037aa: 8b 45 10 mov 0x10(%ebp),%eax
args->argc = argc;
800037ad: 89 10 mov %edx,(%eax)
args->argv = (const char **) argv;
800037af: 89 48 04 mov %ecx,0x4(%eax)
args->curarg = (*argc > 1 && argv ? "" : 0);
800037b2: 83 3a 01 cmpl $0x1,(%edx)
800037b5: 7e 09 jle 800037c0 <argstart+0x1f>
800037b7: ba e1 41 00 80 mov $0x800041e1,%edx
800037bc: 85 c9 test %ecx,%ecx
800037be: 75 05 jne 800037c5 <argstart+0x24>
800037c0: ba 00 00 00 00 mov $0x0,%edx
800037c5: 89 50 08 mov %edx,0x8(%eax)
args->argvalue = 0;
800037c8: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
}
800037cf: 5d pop %ebp
800037d0: c3 ret
800037d1 <argnext>:
int
argnext(struct Argstate *args)
{
800037d1: 55 push %ebp
800037d2: 89 e5 mov %esp,%ebp
800037d4: 53 push %ebx
800037d5: 83 ec 04 sub $0x4,%esp
800037d8: 8b 5d 08 mov 0x8(%ebp),%ebx
int arg;
args->argvalue = 0;
800037db: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
// Done processing arguments if args->curarg == 0
if (args->curarg == 0)
800037e2: 8b 43 08 mov 0x8(%ebx),%eax
800037e5: 85 c0 test %eax,%eax
800037e7: 74 6f je 80003858 <argnext+0x87>
return -1;
if (!*args->curarg) {
800037e9: 80 38 00 cmpb $0x0,(%eax)
800037ec: 75 4e jne 8000383c <argnext+0x6b>
// Need to process the next argument
// Check for end of argument list
if (*args->argc == 1
800037ee: 8b 0b mov (%ebx),%ecx
800037f0: 83 39 01 cmpl $0x1,(%ecx)
800037f3: 74 55 je 8000384a <argnext+0x79>
|| args->argv[1][0] != '-'
800037f5: 8b 53 04 mov 0x4(%ebx),%edx
800037f8: 8b 42 04 mov 0x4(%edx),%eax
800037fb: 80 38 2d cmpb $0x2d,(%eax)
800037fe: 75 4a jne 8000384a <argnext+0x79>
|| args->argv[1][1] == '\0')
80003800: 80 78 01 00 cmpb $0x0,0x1(%eax)
80003804: 74 44 je 8000384a <argnext+0x79>
goto endofargs;
// Shift arguments down one
args->curarg = args->argv[1] + 1;
80003806: 83 c0 01 add $0x1,%eax
80003809: 89 43 08 mov %eax,0x8(%ebx)
memmove(args->argv + 1, args->argv + 2, sizeof(const char *) * (*args->argc - 1));
8000380c: 83 ec 04 sub $0x4,%esp
8000380f: 8b 01 mov (%ecx),%eax
80003811: 8d 04 85 fc ff ff ff lea -0x4(,%eax,4),%eax
80003818: 50 push %eax
80003819: 8d 42 08 lea 0x8(%edx),%eax
8000381c: 50 push %eax
8000381d: 83 c2 04 add $0x4,%edx
80003820: 52 push %edx
80003821: e8 ee e2 ff ff call 80001b14 <memmove>
(*args->argc)--;
80003826: 8b 03 mov (%ebx),%eax
80003828: 83 28 01 subl $0x1,(%eax)
// Check for "--": end of argument list
if (args->curarg[0] == '-' && args->curarg[1] == '\0')
8000382b: 8b 43 08 mov 0x8(%ebx),%eax
8000382e: 83 c4 10 add $0x10,%esp
80003831: 80 38 2d cmpb $0x2d,(%eax)
80003834: 75 06 jne 8000383c <argnext+0x6b>
80003836: 80 78 01 00 cmpb $0x0,0x1(%eax)
8000383a: 74 0e je 8000384a <argnext+0x79>
goto endofargs;
}
arg = (unsigned char) *args->curarg;
8000383c: 8b 53 08 mov 0x8(%ebx),%edx
8000383f: 0f b6 02 movzbl (%edx),%eax
args->curarg++;
80003842: 83 c2 01 add $0x1,%edx
80003845: 89 53 08 mov %edx,0x8(%ebx)
return arg;
80003848: eb 13 jmp 8000385d <argnext+0x8c>
endofargs:
args->curarg = 0;
8000384a: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
return -1;
80003851: b8 ff ff ff ff mov $0xffffffff,%eax
80003856: eb 05 jmp 8000385d <argnext+0x8c>
args->argvalue = 0;
// Done processing arguments if args->curarg == 0
if (args->curarg == 0)
return -1;
80003858: b8 ff ff ff ff mov $0xffffffff,%eax
return arg;
endofargs:
args->curarg = 0;
return -1;
}
8000385d: 8b 5d fc mov -0x4(%ebp),%ebx
80003860: c9 leave
80003861: c3 ret
80003862 <argnextvalue>:
return (char*) (args->argvalue ? args->argvalue : argnextvalue(args));
}
char *
argnextvalue(struct Argstate *args)
{
80003862: 55 push %ebp
80003863: 89 e5 mov %esp,%ebp
80003865: 53 push %ebx
80003866: 83 ec 04 sub $0x4,%esp
80003869: 8b 5d 08 mov 0x8(%ebp),%ebx
if (!args->curarg)
8000386c: 8b 43 08 mov 0x8(%ebx),%eax
8000386f: 85 c0 test %eax,%eax
80003871: 74 58 je 800038cb <argnextvalue+0x69>
return 0;
if (*args->curarg) {
80003873: 80 38 00 cmpb $0x0,(%eax)
80003876: 74 0c je 80003884 <argnextvalue+0x22>
args->argvalue = args->curarg;
80003878: 89 43 0c mov %eax,0xc(%ebx)
args->curarg = "";
8000387b: c7 43 08 e1 41 00 80 movl $0x800041e1,0x8(%ebx)
80003882: eb 42 jmp 800038c6 <argnextvalue+0x64>
} else if (*args->argc > 1) {
80003884: 8b 13 mov (%ebx),%edx
80003886: 83 3a 01 cmpl $0x1,(%edx)
80003889: 7e 2d jle 800038b8 <argnextvalue+0x56>
args->argvalue = args->argv[1];
8000388b: 8b 43 04 mov 0x4(%ebx),%eax
8000388e: 8b 48 04 mov 0x4(%eax),%ecx
80003891: 89 4b 0c mov %ecx,0xc(%ebx)
memmove(args->argv + 1, args->argv + 2, sizeof(const char *) * (*args->argc - 1));
80003894: 83 ec 04 sub $0x4,%esp
80003897: 8b 12 mov (%edx),%edx
80003899: 8d 14 95 fc ff ff ff lea -0x4(,%edx,4),%edx
800038a0: 52 push %edx
800038a1: 8d 50 08 lea 0x8(%eax),%edx
800038a4: 52 push %edx
800038a5: 83 c0 04 add $0x4,%eax
800038a8: 50 push %eax
800038a9: e8 66 e2 ff ff call 80001b14 <memmove>
(*args->argc)--;
800038ae: 8b 03 mov (%ebx),%eax
800038b0: 83 28 01 subl $0x1,(%eax)
800038b3: 83 c4 10 add $0x10,%esp
800038b6: eb 0e jmp 800038c6 <argnextvalue+0x64>
} else {
args->argvalue = 0;
800038b8: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
args->curarg = 0;
800038bf: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
}
return (char*) args->argvalue;
800038c6: 8b 43 0c mov 0xc(%ebx),%eax
800038c9: eb 05 jmp 800038d0 <argnextvalue+0x6e>
char *
argnextvalue(struct Argstate *args)
{
if (!args->curarg)
return 0;
800038cb: b8 00 00 00 00 mov $0x0,%eax
} else {
args->argvalue = 0;
args->curarg = 0;
}
return (char*) args->argvalue;
}
800038d0: 8b 5d fc mov -0x4(%ebp),%ebx
800038d3: c9 leave
800038d4: c3 ret
800038d5 <argvalue>:
return -1;
}
char *
argvalue(struct Argstate *args)
{
800038d5: 55 push %ebp
800038d6: 89 e5 mov %esp,%ebp
800038d8: 83 ec 08 sub $0x8,%esp
800038db: 8b 4d 08 mov 0x8(%ebp),%ecx
return (char*) (args->argvalue ? args->argvalue : argnextvalue(args));
800038de: 8b 51 0c mov 0xc(%ecx),%edx
800038e1: 89 d0 mov %edx,%eax
800038e3: 85 d2 test %edx,%edx
800038e5: 75 0c jne 800038f3 <argvalue+0x1e>
800038e7: 83 ec 0c sub $0xc,%esp
800038ea: 51 push %ecx
800038eb: e8 72 ff ff ff call 80003862 <argnextvalue>
800038f0: 83 c4 10 add $0x10,%esp
}
800038f3: c9 leave
800038f4: c3 ret
800038f5 <_pgfault_upcall>:
.text
.globl _pgfault_upcall
_pgfault_upcall:
// Call the C page fault handler.
pushl %esp // function argument: pointer to UTF
800038f5: 54 push %esp
movl _pgfault_handler, %eax
800038f6: a1 00 80 00 80 mov 0x80008000,%eax
call *%eax
800038fb: ff d0 call *%eax
addl $4, %esp // pop function argument
800038fd: 83 c4 04 add $0x4,%esp
// may find that you have to rearrange your code in non-obvious
// ways as registers become unavailable as scratch space.
//
// LAB 4: Your code here.
addl $8, %esp
80003900: 83 c4 08 add $0x8,%esp
movl 32(%esp), %eax
80003903: 8b 44 24 20 mov 0x20(%esp),%eax
movl 40(%esp), %edx
80003907: 8b 54 24 28 mov 0x28(%esp),%edx
movl %eax, -4(%edx)
8000390b: 89 42 fc mov %eax,-0x4(%edx)
subl $4, 40(%esp)
8000390e: 83 6c 24 28 04 subl $0x4,0x28(%esp)
// Restore the trap-time registers. After you do this, you
// can no longer modify any general-purpose registers.
// LAB 4: Your code here.
popal
80003913: 61 popa
// Restore eflags from the stack. After you do this, you can
// no longer use arithmetic operations or anything else that
// modifies eflags.
// LAB 4: Your code here.
addl $4, %esp
80003914: 83 c4 04 add $0x4,%esp
popfl
80003917: 9d popf
// Switch back to the adjusted trap-time stack.
// LAB 4: Your code here.
pop %esp
80003918: 5c pop %esp
// Return to re-execute the instruction that faulted.
// LAB 4: Your code here.
ret
80003919: c3 ret
8000391a <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
8000391a: 55 push %ebp
8000391b: 89 e5 mov %esp,%ebp
8000391d: 83 ec 08 sub $0x8,%esp
int r;
if (_pgfault_handler == 0) {
80003920: 83 3d 00 80 00 80 00 cmpl $0x0,0x80008000
80003927: 75 52 jne 8000397b <set_pgfault_handler+0x61>
// First time through!
if((r = sys_page_alloc(0, (void *)(UXSTACKTOP - PGSIZE), PTE_P|PTE_U|PTE_W)) < 0)
80003929: 83 ec 04 sub $0x4,%esp
8000392c: 6a 07 push $0x7
8000392e: 68 00 f0 bf ee push $0xeebff000
80003933: 6a 00 push $0x0
80003935: e8 ce e4 ff ff call 80001e08 <sys_page_alloc>
8000393a: 83 c4 10 add $0x10,%esp
8000393d: 85 c0 test %eax,%eax
8000393f: 79 12 jns 80003953 <set_pgfault_handler+0x39>
panic("set_pgfault_handler : %e", r);
80003941: 50 push %eax
80003942: 68 64 46 00 80 push $0x80004664
80003947: 6a 1f push $0x1f
80003949: 68 7d 46 00 80 push $0x8000467d
8000394e: e8 24 08 00 00 call 80004177 <_panic>
if((r = sys_env_set_pgfault_upcall(0, _pgfault_upcall)) < 0)
80003953: 83 ec 08 sub $0x8,%esp
80003956: 68 f5 38 00 80 push $0x800038f5
8000395b: 6a 00 push $0x0
8000395d: e8 f1 e5 ff ff call 80001f53 <sys_env_set_pgfault_upcall>
80003962: 83 c4 10 add $0x10,%esp
80003965: 85 c0 test %eax,%eax
80003967: 79 12 jns 8000397b <set_pgfault_handler+0x61>
panic("set_pgfault_handler : %e", r);
80003969: 50 push %eax
8000396a: 68 64 46 00 80 push $0x80004664
8000396f: 6a 21 push $0x21
80003971: 68 7d 46 00 80 push $0x8000467d
80003976: e8 fc 07 00 00 call 80004177 <_panic>
}
// Save handler pointer for assembly to call.
_pgfault_handler = handler;
8000397b: 8b 45 08 mov 0x8(%ebp),%eax
8000397e: a3 00 80 00 80 mov %eax,0x80008000
}
80003983: c9 leave
80003984: c3 ret
80003985 <getuint>:
// Get an unsigned int of various possible sizes from a varargs list,
// depending on the lflag parameter.
static unsigned long long
getuint(va_list *ap, int lflag)
{
80003985: 55 push %ebp
80003986: 89 e5 mov %esp,%ebp
if (lflag >= 2)
80003988: 83 fa 01 cmp $0x1,%edx
8000398b: 7e 0e jle 8000399b <getuint+0x16>
return va_arg(*ap, unsigned long long);
8000398d: 8b 10 mov (%eax),%edx
8000398f: 8d 4a 08 lea 0x8(%edx),%ecx
80003992: 89 08 mov %ecx,(%eax)
80003994: 8b 02 mov (%edx),%eax
80003996: 8b 52 04 mov 0x4(%edx),%edx
80003999: eb 22 jmp 800039bd <getuint+0x38>
else if (lflag)
8000399b: 85 d2 test %edx,%edx
8000399d: 74 10 je 800039af <getuint+0x2a>
return va_arg(*ap, unsigned long);
8000399f: 8b 10 mov (%eax),%edx
800039a1: 8d 4a 04 lea 0x4(%edx),%ecx
800039a4: 89 08 mov %ecx,(%eax)
800039a6: 8b 02 mov (%edx),%eax
800039a8: ba 00 00 00 00 mov $0x0,%edx
800039ad: eb 0e jmp 800039bd <getuint+0x38>
else
return va_arg(*ap, unsigned int);
800039af: 8b 10 mov (%eax),%edx
800039b1: 8d 4a 04 lea 0x4(%edx),%ecx
800039b4: 89 08 mov %ecx,(%eax)
800039b6: 8b 02 mov (%edx),%eax
800039b8: ba 00 00 00 00 mov $0x0,%edx
}
800039bd: 5d pop %ebp
800039be: c3 ret
800039bf <printnum>:
}
static void
printnum(void (*putch)(int, void*), void *putdat,
unsigned long num, unsigned base, int width, int padc)
{
800039bf: 55 push %ebp
800039c0: 89 e5 mov %esp,%ebp
800039c2: 57 push %edi
800039c3: 56 push %esi
800039c4: 53 push %ebx
800039c5: 83 ec 1c sub $0x1c,%esp
800039c8: 89 c7 mov %eax,%edi
800039ca: 89 d6 mov %edx,%esi
800039cc: 89 4d e4 mov %ecx,-0x1c(%ebp)
// first recursively print all preceding (more significant) digits
if (num >= base) {
800039cf: 3b 4d 08 cmp 0x8(%ebp),%ecx
800039d2: 73 0c jae 800039e0 <printnum+0x21>
printnum(putch, putdat, num / base, base, width - 1, padc);
} else {
// print any needed pad characters before first digit
while (--width > 0)
800039d4: 8b 45 0c mov 0xc(%ebp),%eax
800039d7: 8d 58 ff lea -0x1(%eax),%ebx
800039da: 85 db test %ebx,%ebx
800039dc: 7f 2d jg 80003a0b <printnum+0x4c>
800039de: eb 3c jmp 80003a1c <printnum+0x5d>
printnum(void (*putch)(int, void*), void *putdat,
unsigned long num, unsigned base, int width, int padc)
{
// first recursively print all preceding (more significant) digits
if (num >= base) {
printnum(putch, putdat, num / base, base, width - 1, padc);
800039e0: 8b 45 e4 mov -0x1c(%ebp),%eax
800039e3: ba 00 00 00 00 mov $0x0,%edx
800039e8: f7 75 08 divl 0x8(%ebp)
800039eb: 89 c1 mov %eax,%ecx
800039ed: 83 ec 04 sub $0x4,%esp
800039f0: ff 75 10 pushl 0x10(%ebp)
800039f3: 8b 45 0c mov 0xc(%ebp),%eax
800039f6: 8d 50 ff lea -0x1(%eax),%edx
800039f9: 52 push %edx
800039fa: ff 75 08 pushl 0x8(%ebp)
800039fd: 89 f2 mov %esi,%edx
800039ff: 89 f8 mov %edi,%eax
80003a01: e8 b9 ff ff ff call 800039bf <printnum>
80003a06: 83 c4 10 add $0x10,%esp
80003a09: eb 11 jmp 80003a1c <printnum+0x5d>
} else {
// print any needed pad characters before first digit
while (--width > 0)
putch(padc, putdat);
80003a0b: 83 ec 08 sub $0x8,%esp
80003a0e: 56 push %esi
80003a0f: ff 75 10 pushl 0x10(%ebp)
80003a12: ff d7 call *%edi
// first recursively print all preceding (more significant) digits
if (num >= base) {
printnum(putch, putdat, num / base, base, width - 1, padc);
} else {
// print any needed pad characters before first digit
while (--width > 0)
80003a14: 83 c4 10 add $0x10,%esp
80003a17: 83 eb 01 sub $0x1,%ebx
80003a1a: 75 ef jne 80003a0b <printnum+0x4c>
putch(padc, putdat);
}
// then print this (the least significant) digit
putch("0123456789abcdef"[num % base], putdat);
80003a1c: 83 ec 08 sub $0x8,%esp
80003a1f: 56 push %esi
80003a20: 8b 45 e4 mov -0x1c(%ebp),%eax
80003a23: ba 00 00 00 00 mov $0x0,%edx
80003a28: f7 75 08 divl 0x8(%ebp)
80003a2b: 0f be 82 87 46 00 80 movsbl -0x7fffb979(%edx),%eax
80003a32: 50 push %eax
80003a33: ff d7 call *%edi
}
80003a35: 83 c4 10 add $0x10,%esp
80003a38: 8d 65 f4 lea -0xc(%ebp),%esp
80003a3b: 5b pop %ebx
80003a3c: 5e pop %esi
80003a3d: 5f pop %edi
80003a3e: 5d pop %ebp
80003a3f: c3 ret
80003a40 <sprintputch>:
int cnt;
};
static void
sprintputch(int ch, struct sprintbuf *b)
{
80003a40: 55 push %ebp
80003a41: 89 e5 mov %esp,%ebp
80003a43: 8b 45 0c mov 0xc(%ebp),%eax
b->cnt++;
80003a46: 83 40 08 01 addl $0x1,0x8(%eax)
if (b->buf < b->ebuf)
80003a4a: 8b 10 mov (%eax),%edx
80003a4c: 3b 50 04 cmp 0x4(%eax),%edx
80003a4f: 73 0a jae 80003a5b <sprintputch+0x1b>
*b->buf++ = ch;
80003a51: 8d 4a 01 lea 0x1(%edx),%ecx
80003a54: 89 08 mov %ecx,(%eax)
80003a56: 8b 45 08 mov 0x8(%ebp),%eax
80003a59: 88 02 mov %al,(%edx)
}
80003a5b: 5d pop %ebp
80003a5c: c3 ret
80003a5d <putch>:
};
static void
putch(int ch, struct printbuf *b)
{
80003a5d: 55 push %ebp
80003a5e: 89 e5 mov %esp,%ebp
80003a60: 53 push %ebx
80003a61: 83 ec 04 sub $0x4,%esp
80003a64: 8b 5d 0c mov 0xc(%ebp),%ebx
b->buf[b->idx++] = ch;
80003a67: 8b 13 mov (%ebx),%edx
80003a69: 8d 42 01 lea 0x1(%edx),%eax
80003a6c: 89 03 mov %eax,(%ebx)
80003a6e: 8b 4d 08 mov 0x8(%ebp),%ecx
80003a71: 88 4c 13 08 mov %cl,0x8(%ebx,%edx,1)
if (b->idx == 256-1) {
80003a75: 3d ff 00 00 00 cmp $0xff,%eax
80003a7a: 75 1a jne 80003a96 <putch+0x39>
sys_cputs(b->buf, b->idx);
80003a7c: 83 ec 08 sub $0x8,%esp
80003a7f: 68 ff 00 00 00 push $0xff
80003a84: 8d 43 08 lea 0x8(%ebx),%eax
80003a87: 50 push %eax
80003a88: e8 bf e2 ff ff call 80001d4c <sys_cputs>
b->idx = 0;
80003a8d: c7 03 00 00 00 00 movl $0x0,(%ebx)
80003a93: 83 c4 10 add $0x10,%esp
}
b->cnt++;
80003a96: 83 43 04 01 addl $0x1,0x4(%ebx)
}
80003a9a: 8b 5d fc mov -0x4(%ebp),%ebx
80003a9d: c9 leave
80003a9e: c3 ret
80003a9f <writebuf>:
static void
writebuf(struct fprintbuf *b)
{
if (b->error > 0) {
80003a9f: 83 78 0c 00 cmpl $0x0,0xc(%eax)
80003aa3: 7e 37 jle 80003adc <writebuf+0x3d>
};
static void
writebuf(struct fprintbuf *b)
{
80003aa5: 55 push %ebp
80003aa6: 89 e5 mov %esp,%ebp
80003aa8: 53 push %ebx
80003aa9: 83 ec 08 sub $0x8,%esp
80003aac: 89 c3 mov %eax,%ebx
if (b->error > 0) {
ssize_t result = write(b->fd, b->buf, b->idx);
80003aae: ff 70 04 pushl 0x4(%eax)
80003ab1: 8d 40 10 lea 0x10(%eax),%eax
80003ab4: 50 push %eax
80003ab5: ff 33 pushl (%ebx)
80003ab7: e8 d3 ea ff ff call 8000258f <write>
if (result > 0)
80003abc: 83 c4 10 add $0x10,%esp
80003abf: 85 c0 test %eax,%eax
80003ac1: 7e 03 jle 80003ac6 <writebuf+0x27>
b->result += result;
80003ac3: 01 43 08 add %eax,0x8(%ebx)
if (result != b->idx) // error, or wrote less than supplied
80003ac6: 3b 43 04 cmp 0x4(%ebx),%eax
80003ac9: 74 0d je 80003ad8 <writebuf+0x39>
b->error = (result < 0 ? result : 0);
80003acb: 85 c0 test %eax,%eax
80003acd: ba 00 00 00 00 mov $0x0,%edx
80003ad2: 0f 4f c2 cmovg %edx,%eax
80003ad5: 89 43 0c mov %eax,0xc(%ebx)
}
}
80003ad8: 8b 5d fc mov -0x4(%ebp),%ebx
80003adb: c9 leave
80003adc: f3 c3 repz ret
80003ade <fputch>:
static void
fputch(int ch, void *thunk)
{
80003ade: 55 push %ebp
80003adf: 89 e5 mov %esp,%ebp
80003ae1: 53 push %ebx
80003ae2: 83 ec 04 sub $0x4,%esp
80003ae5: 8b 5d 0c mov 0xc(%ebp),%ebx
struct fprintbuf *b = (struct fprintbuf *) thunk;
b->buf[b->idx++] = ch;
80003ae8: 8b 53 04 mov 0x4(%ebx),%edx
80003aeb: 8d 42 01 lea 0x1(%edx),%eax
80003aee: 89 43 04 mov %eax,0x4(%ebx)
80003af1: 8b 4d 08 mov 0x8(%ebp),%ecx
80003af4: 88 4c 13 10 mov %cl,0x10(%ebx,%edx,1)
if (b->idx == 256) {
80003af8: 3d 00 01 00 00 cmp $0x100,%eax
80003afd: 75 0e jne 80003b0d <fputch+0x2f>
writebuf(b);
80003aff: 89 d8 mov %ebx,%eax
80003b01: e8 99 ff ff ff call 80003a9f <writebuf>
b->idx = 0;
80003b06: c7 43 04 00 00 00 00 movl $0x0,0x4(%ebx)
}
}
80003b0d: 83 c4 04 add $0x4,%esp
80003b10: 5b pop %ebx
80003b11: 5d pop %ebp
80003b12: c3 ret
80003b13 <vprintfmt>:
va_end(ap);
}
void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap)
{
80003b13: 55 push %ebp
80003b14: 89 e5 mov %esp,%ebp
80003b16: 57 push %edi
80003b17: 56 push %esi
80003b18: 53 push %ebx
80003b19: 83 ec 2c sub $0x2c,%esp
80003b1c: 8b 7d 0c mov 0xc(%ebp),%edi
80003b1f: eb 03 jmp 80003b24 <vprintfmt+0x11>
break;
// unrecognized escape sequence - just print it literally
default:
putch('%', putdat);
for (fmt--; fmt[-1] != '%'; fmt--)
80003b21: 89 75 10 mov %esi,0x10(%ebp)
unsigned long long num;
int base, lflag, width, precision, altflag;
char padc;
while (1) {
while ((ch = *(unsigned char *) fmt++) != '%') {
80003b24: 8b 45 10 mov 0x10(%ebp),%eax
80003b27: 8d 70 01 lea 0x1(%eax),%esi
80003b2a: 0f b6 00 movzbl (%eax),%eax
80003b2d: 83 f8 25 cmp $0x25,%eax
80003b30: 74 2c je 80003b5e <vprintfmt+0x4b>
if (ch == '\0')
80003b32: 85 c0 test %eax,%eax
80003b34: 75 0f jne 80003b45 <vprintfmt+0x32>
80003b36: e9 bb 03 00 00 jmp 80003ef6 <vprintfmt+0x3e3>
80003b3b: 85 c0 test %eax,%eax
80003b3d: 0f 84 b3 03 00 00 je 80003ef6 <vprintfmt+0x3e3>
80003b43: eb 03 jmp 80003b48 <vprintfmt+0x35>
80003b45: 8b 5d 08 mov 0x8(%ebp),%ebx
return;
putch(ch, putdat);
80003b48: 83 ec 08 sub $0x8,%esp
80003b4b: 57 push %edi
80003b4c: 50 push %eax
80003b4d: ff d3 call *%ebx
unsigned long long num;
int base, lflag, width, precision, altflag;
char padc;
while (1) {
while ((ch = *(unsigned char *) fmt++) != '%') {
80003b4f: 83 c6 01 add $0x1,%esi
80003b52: 0f b6 46 ff movzbl -0x1(%esi),%eax
80003b56: 83 c4 10 add $0x10,%esp
80003b59: 83 f8 25 cmp $0x25,%eax
80003b5c: 75 dd jne 80003b3b <vprintfmt+0x28>
if (width < 0)
width = 0;
goto reswitch;
case '#':
altflag = 1;
80003b5e: c6 45 e3 20 movb $0x20,-0x1d(%ebp)
80003b62: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp)
80003b69: c7 45 d4 ff ff ff ff movl $0xffffffff,-0x2c(%ebp)
80003b70: c7 45 e4 ff ff ff ff movl $0xffffffff,-0x1c(%ebp)
80003b77: ba 00 00 00 00 mov $0x0,%edx
80003b7c: bb 00 00 00 00 mov $0x0,%ebx
80003b81: eb 07 jmp 80003b8a <vprintfmt+0x77>
width = -1;
precision = -1;
lflag = 0;
altflag = 0;
reswitch:
switch (ch = *(unsigned char *) fmt++) {
80003b83: 8b 75 10 mov 0x10(%ebp),%esi
// flag to pad on the right
case '-':
padc = '-';
80003b86: c6 45 e3 2d movb $0x2d,-0x1d(%ebp)
width = -1;
precision = -1;
lflag = 0;
altflag = 0;
reswitch:
switch (ch = *(unsigned char *) fmt++) {
80003b8a: 8d 46 01 lea 0x1(%esi),%eax
80003b8d: 89 45 10 mov %eax,0x10(%ebp)
80003b90: 0f b6 06 movzbl (%esi),%eax
80003b93: 0f b6 c8 movzbl %al,%ecx
80003b96: 83 e8 23 sub $0x23,%eax
80003b99: 3c 55 cmp $0x55,%al
80003b9b: 0f 87 15 03 00 00 ja 80003eb6 <vprintfmt+0x3a3>
80003ba1: 0f b6 c0 movzbl %al,%eax
80003ba4: ff 24 85 e0 47 00 80 jmp *-0x7fffb820(,%eax,4)
80003bab: 8b 75 10 mov 0x10(%ebp),%esi
padc = '-';
goto reswitch;
// flag to pad with 0's instead of spaces
case '0':
padc = '0';
80003bae: c6 45 e3 30 movb $0x30,-0x1d(%ebp)
80003bb2: eb d6 jmp 80003b8a <vprintfmt+0x77>
case '6':
case '7':
case '8':
case '9':
for (precision = 0; ; ++fmt) {
precision = precision * 10 + ch - '0';
80003bb4: 8d 41 d0 lea -0x30(%ecx),%eax
80003bb7: 89 45 d4 mov %eax,-0x2c(%ebp)
ch = *fmt;
80003bba: 0f be 46 01 movsbl 0x1(%esi),%eax
if (ch < '0' || ch > '9')
80003bbe: 8d 48 d0 lea -0x30(%eax),%ecx
80003bc1: 83 f9 09 cmp $0x9,%ecx
80003bc4: 77 5b ja 80003c21 <vprintfmt+0x10e>
80003bc6: 8b 75 10 mov 0x10(%ebp),%esi
80003bc9: 89 55 d0 mov %edx,-0x30(%ebp)
80003bcc: 8b 55 d4 mov -0x2c(%ebp),%edx
case '5':
case '6':
case '7':
case '8':
case '9':
for (precision = 0; ; ++fmt) {
80003bcf: 83 c6 01 add $0x1,%esi
precision = precision * 10 + ch - '0';
80003bd2: 8d 14 92 lea (%edx,%edx,4),%edx
80003bd5: 8d 54 50 d0 lea -0x30(%eax,%edx,2),%edx
ch = *fmt;
80003bd9: 0f be 06 movsbl (%esi),%eax
if (ch < '0' || ch > '9')
80003bdc: 8d 48 d0 lea -0x30(%eax),%ecx
80003bdf: 83 f9 09 cmp $0x9,%ecx
80003be2: 76 eb jbe 80003bcf <vprintfmt+0xbc>
80003be4: 89 55 d4 mov %edx,-0x2c(%ebp)
80003be7: 8b 55 d0 mov -0x30(%ebp),%edx
80003bea: eb 38 jmp 80003c24 <vprintfmt+0x111>
break;
}
goto process_precision;
case '*':
precision = va_arg(ap, int);
80003bec: 8b 45 14 mov 0x14(%ebp),%eax
80003bef: 8d 48 04 lea 0x4(%eax),%ecx
80003bf2: 89 4d 14 mov %ecx,0x14(%ebp)
80003bf5: 8b 00 mov (%eax),%eax
80003bf7: 89 45 d4 mov %eax,-0x2c(%ebp)
width = -1;
precision = -1;
lflag = 0;
altflag = 0;
reswitch:
switch (ch = *(unsigned char *) fmt++) {
80003bfa: 8b 75 10 mov 0x10(%ebp),%esi
}
goto process_precision;
case '*':
precision = va_arg(ap, int);
goto process_precision;
80003bfd: eb 25 jmp 80003c24 <vprintfmt+0x111>
80003bff: 8b 45 e4 mov -0x1c(%ebp),%eax
80003c02: 85 c0 test %eax,%eax
80003c04: 0f 48 c3 cmovs %ebx,%eax
80003c07: 89 45 e4 mov %eax,-0x1c(%ebp)
width = -1;
precision = -1;
lflag = 0;
altflag = 0;
reswitch:
switch (ch = *(unsigned char *) fmt++) {
80003c0a: 8b 75 10 mov 0x10(%ebp),%esi
80003c0d: e9 78 ff ff ff jmp 80003b8a <vprintfmt+0x77>
80003c12: 8b 75 10 mov 0x10(%ebp),%esi
if (width < 0)
width = 0;
goto reswitch;
case '#':
altflag = 1;
80003c15: c7 45 d8 01 00 00 00 movl $0x1,-0x28(%ebp)
goto reswitch;
80003c1c: e9 69 ff ff ff jmp 80003b8a <vprintfmt+0x77>
width = -1;
precision = -1;
lflag = 0;
altflag = 0;
reswitch:
switch (ch = *(unsigned char *) fmt++) {
80003c21: 8b 75 10 mov 0x10(%ebp),%esi
case '#':
altflag = 1;
goto reswitch;
process_precision:
if (width < 0)
80003c24: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
80003c28: 0f 89 5c ff ff ff jns 80003b8a <vprintfmt+0x77>
width = precision, precision = -1;
80003c2e: 8b 45 d4 mov -0x2c(%ebp),%eax
80003c31: 89 45 e4 mov %eax,-0x1c(%ebp)
80003c34: c7 45 d4 ff ff ff ff movl $0xffffffff,-0x2c(%ebp)
80003c3b: e9 4a ff ff ff jmp 80003b8a <vprintfmt+0x77>
goto reswitch;
// long flag (doubled for long long)
case 'l':
lflag++;
80003c40: 83 c2 01 add $0x1,%edx
width = -1;
precision = -1;
lflag = 0;
altflag = 0;
reswitch:
switch (ch = *(unsigned char *) fmt++) {
80003c43: 8b 75 10 mov 0x10(%ebp),%esi
goto reswitch;
// long flag (doubled for long long)
case 'l':
lflag++;
goto reswitch;
80003c46: e9 3f ff ff ff jmp 80003b8a <vprintfmt+0x77>
// character
case 'c':
putch(va_arg(ap, int), putdat);
80003c4b: 8b 45 14 mov 0x14(%ebp),%eax
80003c4e: 8d 50 04 lea 0x4(%eax),%edx
80003c51: 89 55 14 mov %edx,0x14(%ebp)
80003c54: 83 ec 08 sub $0x8,%esp
80003c57: 57 push %edi
80003c58: ff 30 pushl (%eax)
80003c5a: ff 55 08 call *0x8(%ebp)
break;
80003c5d: 83 c4 10 add $0x10,%esp
80003c60: e9 bf fe ff ff jmp 80003b24 <vprintfmt+0x11>
// error message
case 'e':
err = va_arg(ap, int);
80003c65: 8b 45 14 mov 0x14(%ebp),%eax
80003c68: 8d 50 04 lea 0x4(%eax),%edx
80003c6b: 89 55 14 mov %edx,0x14(%ebp)
80003c6e: 8b 00 mov (%eax),%eax
80003c70: 99 cltd
80003c71: 31 d0 xor %edx,%eax
80003c73: 29 d0 sub %edx,%eax
if (err < 0)
err = -err;
if (err >= MAXERROR || (p = error_string[err]) == NULL)
80003c75: 83 f8 11 cmp $0x11,%eax
80003c78: 7f 0b jg 80003c85 <vprintfmt+0x172>
80003c7a: 8b 14 85 40 49 00 80 mov -0x7fffb6c0(,%eax,4),%edx
80003c81: 85 d2 test %edx,%edx
80003c83: 75 17 jne 80003c9c <vprintfmt+0x189>
printfmt(putch, putdat, "error %d", err);
80003c85: 50 push %eax
80003c86: 68 9f 46 00 80 push $0x8000469f
80003c8b: 57 push %edi
80003c8c: ff 75 08 pushl 0x8(%ebp)
80003c8f: e8 6b 03 00 00 call 80003fff <printfmt>
80003c94: 83 c4 10 add $0x10,%esp
80003c97: e9 88 fe ff ff jmp 80003b24 <vprintfmt+0x11>
else
printfmt(putch, putdat, "%s", p);
80003c9c: 52 push %edx
80003c9d: 68 a2 42 00 80 push $0x800042a2
80003ca2: 57 push %edi
80003ca3: ff 75 08 pushl 0x8(%ebp)
80003ca6: e8 54 03 00 00 call 80003fff <printfmt>
80003cab: 83 c4 10 add $0x10,%esp
80003cae: e9 71 fe ff ff jmp 80003b24 <vprintfmt+0x11>
break;
// string
case 's':
if ((p = va_arg(ap, char *)) == NULL)
80003cb3: 8b 45 14 mov 0x14(%ebp),%eax
80003cb6: 8d 50 04 lea 0x4(%eax),%edx
80003cb9: 89 55 14 mov %edx,0x14(%ebp)
80003cbc: 8b 00 mov (%eax),%eax
p = "(null)";
80003cbe: 85 c0 test %eax,%eax
80003cc0: b9 98 46 00 80 mov $0x80004698,%ecx
80003cc5: 0f 45 c8 cmovne %eax,%ecx
80003cc8: 89 4d d0 mov %ecx,-0x30(%ebp)
if (width > 0 && padc != '-')
80003ccb: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
80003ccf: 7e 06 jle 80003cd7 <vprintfmt+0x1c4>
80003cd1: 80 7d e3 2d cmpb $0x2d,-0x1d(%ebp)
80003cd5: 75 19 jne 80003cf0 <vprintfmt+0x1dd>
for (width -= strnlen(p, precision); width > 0; width--)
putch(padc, putdat);
for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
80003cd7: 8b 45 d0 mov -0x30(%ebp),%eax
80003cda: 8d 70 01 lea 0x1(%eax),%esi
80003cdd: 0f b6 00 movzbl (%eax),%eax
80003ce0: 0f be d0 movsbl %al,%edx
80003ce3: 85 d2 test %edx,%edx
80003ce5: 0f 85 92 00 00 00 jne 80003d7d <vprintfmt+0x26a>
80003ceb: e9 82 00 00 00 jmp 80003d72 <vprintfmt+0x25f>
// string
case 's':
if ((p = va_arg(ap, char *)) == NULL)
p = "(null)";
if (width > 0 && padc != '-')
for (width -= strnlen(p, precision); width > 0; width--)
80003cf0: 83 ec 08 sub $0x8,%esp
80003cf3: ff 75 d4 pushl -0x2c(%ebp)
80003cf6: ff 75 d0 pushl -0x30(%ebp)
80003cf9: e8 ee db ff ff call 800018ec <strnlen>
80003cfe: 29 45 e4 sub %eax,-0x1c(%ebp)
80003d01: 8b 4d e4 mov -0x1c(%ebp),%ecx
80003d04: 83 c4 10 add $0x10,%esp
80003d07: 85 c9 test %ecx,%ecx
80003d09: 0f 8e ce 01 00 00 jle 80003edd <vprintfmt+0x3ca>
putch(padc, putdat);
80003d0f: 0f be 75 e3 movsbl -0x1d(%ebp),%esi
80003d13: 89 cb mov %ecx,%ebx
80003d15: 83 ec 08 sub $0x8,%esp
80003d18: 57 push %edi
80003d19: 56 push %esi
80003d1a: ff 55 08 call *0x8(%ebp)
// string
case 's':
if ((p = va_arg(ap, char *)) == NULL)
p = "(null)";
if (width > 0 && padc != '-')
for (width -= strnlen(p, precision); width > 0; width--)
80003d1d: 83 c4 10 add $0x10,%esp
80003d20: 83 eb 01 sub $0x1,%ebx
80003d23: 75 f0 jne 80003d15 <vprintfmt+0x202>
80003d25: 89 5d e4 mov %ebx,-0x1c(%ebp)
80003d28: e9 b0 01 00 00 jmp 80003edd <vprintfmt+0x3ca>
putch(padc, putdat);
for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
if (altflag && (ch < ' ' || ch > '~'))
80003d2d: 83 7d d8 00 cmpl $0x0,-0x28(%ebp)
80003d31: 74 1b je 80003d4e <vprintfmt+0x23b>
80003d33: 0f be c0 movsbl %al,%eax
80003d36: 83 e8 20 sub $0x20,%eax
80003d39: 83 f8 5e cmp $0x5e,%eax
80003d3c: 76 10 jbe 80003d4e <vprintfmt+0x23b>
putch('?', putdat);
80003d3e: 83 ec 08 sub $0x8,%esp
80003d41: ff 75 0c pushl 0xc(%ebp)
80003d44: 6a 3f push $0x3f
80003d46: ff 55 08 call *0x8(%ebp)
80003d49: 83 c4 10 add $0x10,%esp
80003d4c: eb 0d jmp 80003d5b <vprintfmt+0x248>
else
putch(ch, putdat);
80003d4e: 83 ec 08 sub $0x8,%esp
80003d51: ff 75 0c pushl 0xc(%ebp)
80003d54: 52 push %edx
80003d55: ff 55 08 call *0x8(%ebp)
80003d58: 83 c4 10 add $0x10,%esp
if ((p = va_arg(ap, char *)) == NULL)
p = "(null)";
if (width > 0 && padc != '-')
for (width -= strnlen(p, precision); width > 0; width--)
putch(padc, putdat);
for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
80003d5b: 83 ef 01 sub $0x1,%edi
80003d5e: 83 c6 01 add $0x1,%esi
80003d61: 0f b6 46 ff movzbl -0x1(%esi),%eax
80003d65: 0f be d0 movsbl %al,%edx
80003d68: 85 d2 test %edx,%edx
80003d6a: 75 25 jne 80003d91 <vprintfmt+0x27e>
80003d6c: 89 7d e4 mov %edi,-0x1c(%ebp)
80003d6f: 8b 7d 0c mov 0xc(%ebp),%edi
if (altflag && (ch < ' ' || ch > '~'))
putch('?', putdat);
else
putch(ch, putdat);
for (; width > 0; width--)
80003d72: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
80003d76: 7f 2a jg 80003da2 <vprintfmt+0x28f>
80003d78: e9 a7 fd ff ff jmp 80003b24 <vprintfmt+0x11>
80003d7d: 8b 5d d4 mov -0x2c(%ebp),%ebx
80003d80: 89 7d 0c mov %edi,0xc(%ebp)
80003d83: 8b 7d e4 mov -0x1c(%ebp),%edi
80003d86: eb 09 jmp 80003d91 <vprintfmt+0x27e>
80003d88: 8b 5d d4 mov -0x2c(%ebp),%ebx
80003d8b: 89 7d 0c mov %edi,0xc(%ebp)
80003d8e: 8b 7d e4 mov -0x1c(%ebp),%edi
if ((p = va_arg(ap, char *)) == NULL)
p = "(null)";
if (width > 0 && padc != '-')
for (width -= strnlen(p, precision); width > 0; width--)
putch(padc, putdat);
for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
80003d91: 85 db test %ebx,%ebx
80003d93: 78 98 js 80003d2d <vprintfmt+0x21a>
80003d95: 83 eb 01 sub $0x1,%ebx
80003d98: 79 93 jns 80003d2d <vprintfmt+0x21a>
80003d9a: 89 7d e4 mov %edi,-0x1c(%ebp)
80003d9d: 8b 7d 0c mov 0xc(%ebp),%edi
80003da0: eb d0 jmp 80003d72 <vprintfmt+0x25f>
80003da2: 8b 5d e4 mov -0x1c(%ebp),%ebx
80003da5: 8b 75 08 mov 0x8(%ebp),%esi
if (altflag && (ch < ' ' || ch > '~'))
putch('?', putdat);
else
putch(ch, putdat);
for (; width > 0; width--)
putch(' ', putdat);
80003da8: 83 ec 08 sub $0x8,%esp
80003dab: 57 push %edi
80003dac: 6a 20 push $0x20
80003dae: ff d6 call *%esi
for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
if (altflag && (ch < ' ' || ch > '~'))
putch('?', putdat);
else
putch(ch, putdat);
for (; width > 0; width--)
80003db0: 83 c4 10 add $0x10,%esp
80003db3: 83 eb 01 sub $0x1,%ebx
80003db6: 75 f0 jne 80003da8 <vprintfmt+0x295>
80003db8: e9 67 fd ff ff jmp 80003b24 <vprintfmt+0x11>
// Same as getuint but signed - can't use getuint
// because of sign extension
static long long
getint(va_list *ap, int lflag)
{
if (lflag >= 2)
80003dbd: 83 fa 01 cmp $0x1,%edx
80003dc0: 7e 16 jle 80003dd8 <vprintfmt+0x2c5>
return va_arg(*ap, long long);
80003dc2: 8b 45 14 mov 0x14(%ebp),%eax
80003dc5: 8d 50 08 lea 0x8(%eax),%edx
80003dc8: 89 55 14 mov %edx,0x14(%ebp)
80003dcb: 8b 50 04 mov 0x4(%eax),%edx
80003dce: 8b 00 mov (%eax),%eax
80003dd0: 89 45 d8 mov %eax,-0x28(%ebp)
80003dd3: 89 55 dc mov %edx,-0x24(%ebp)
80003dd6: eb 32 jmp 80003e0a <vprintfmt+0x2f7>
else if (lflag)
80003dd8: 85 d2 test %edx,%edx
80003dda: 74 18 je 80003df4 <vprintfmt+0x2e1>
return va_arg(*ap, long);
80003ddc: 8b 45 14 mov 0x14(%ebp),%eax
80003ddf: 8d 50 04 lea 0x4(%eax),%edx
80003de2: 89 55 14 mov %edx,0x14(%ebp)
80003de5: 8b 30 mov (%eax),%esi
80003de7: 89 75 d8 mov %esi,-0x28(%ebp)
80003dea: 89 f0 mov %esi,%eax
80003dec: c1 f8 1f sar $0x1f,%eax
80003def: 89 45 dc mov %eax,-0x24(%ebp)
80003df2: eb 16 jmp 80003e0a <vprintfmt+0x2f7>
else
return va_arg(*ap, int);
80003df4: 8b 45 14 mov 0x14(%ebp),%eax
80003df7: 8d 50 04 lea 0x4(%eax),%edx
80003dfa: 89 55 14 mov %edx,0x14(%ebp)
80003dfd: 8b 30 mov (%eax),%esi
80003dff: 89 75 d8 mov %esi,-0x28(%ebp)
80003e02: 89 f0 mov %esi,%eax
80003e04: c1 f8 1f sar $0x1f,%eax
80003e07: 89 45 dc mov %eax,-0x24(%ebp)
putch(' ', putdat);
break;
// (signed) decimal
case 'd':
num = getint(&ap, lflag);
80003e0a: 8b 4d d8 mov -0x28(%ebp),%ecx
if ((long long) num < 0) {
putch('-', putdat);
num = -(long long) num;
}
base = 10;
80003e0d: b8 0a 00 00 00 mov $0xa,%eax
break;
// (signed) decimal
case 'd':
num = getint(&ap, lflag);
if ((long long) num < 0) {
80003e12: 83 7d dc 00 cmpl $0x0,-0x24(%ebp)
80003e16: 79 70 jns 80003e88 <vprintfmt+0x375>
putch('-', putdat);
80003e18: 83 ec 08 sub $0x8,%esp
80003e1b: 57 push %edi
80003e1c: 6a 2d push $0x2d
80003e1e: ff 55 08 call *0x8(%ebp)
num = -(long long) num;
80003e21: 8b 4d d8 mov -0x28(%ebp),%ecx
80003e24: f7 d9 neg %ecx
80003e26: 83 c4 10 add $0x10,%esp
}
base = 10;
80003e29: b8 0a 00 00 00 mov $0xa,%eax
80003e2e: eb 58 jmp 80003e88 <vprintfmt+0x375>
goto number;
// unsigned decimal
case 'u':
num = getuint(&ap, lflag);
80003e30: 8d 45 14 lea 0x14(%ebp),%eax
80003e33: e8 4d fb ff ff call 80003985 <getuint>
80003e38: 89 c1 mov %eax,%ecx
base = 10;
80003e3a: b8 0a 00 00 00 mov $0xa,%eax
goto number;
80003e3f: eb 47 jmp 80003e88 <vprintfmt+0x375>
// (unsigned) octal
case 'o':
// Replace this with your code.
num = getuint(&ap, lflag);
80003e41: 8d 45 14 lea 0x14(%ebp),%eax
80003e44: e8 3c fb ff ff call 80003985 <getuint>
80003e49: 89 c1 mov %eax,%ecx
base = 8;
80003e4b: b8 08 00 00 00 mov $0x8,%eax
goto number;
80003e50: eb 36 jmp 80003e88 <vprintfmt+0x375>
// pointer
case 'p':
putch('0', putdat);
80003e52: 83 ec 08 sub $0x8,%esp
80003e55: 57 push %edi
80003e56: 6a 30 push $0x30
80003e58: ff 55 08 call *0x8(%ebp)
putch('x', putdat);
80003e5b: 83 c4 08 add $0x8,%esp
80003e5e: 57 push %edi
80003e5f: 6a 78 push $0x78
80003e61: ff 55 08 call *0x8(%ebp)
num = (unsigned long long)
(uintptr_t) va_arg(ap, void *);
80003e64: 8b 45 14 mov 0x14(%ebp),%eax
80003e67: 8d 50 04 lea 0x4(%eax),%edx
80003e6a: 89 55 14 mov %edx,0x14(%ebp)
// pointer
case 'p':
putch('0', putdat);
putch('x', putdat);
num = (unsigned long long)
80003e6d: 8b 08 mov (%eax),%ecx
(uintptr_t) va_arg(ap, void *);
base = 16;
goto number;
80003e6f: 83 c4 10 add $0x10,%esp
case 'p':
putch('0', putdat);
putch('x', putdat);
num = (unsigned long long)
(uintptr_t) va_arg(ap, void *);
base = 16;
80003e72: b8 10 00 00 00 mov $0x10,%eax
goto number;
80003e77: eb 0f jmp 80003e88 <vprintfmt+0x375>
// (unsigned) hexadecimal
case 'x':
num = getuint(&ap, lflag);
80003e79: 8d 45 14 lea 0x14(%ebp),%eax
80003e7c: e8 04 fb ff ff call 80003985 <getuint>
80003e81: 89 c1 mov %eax,%ecx
base = 16;
80003e83: b8 10 00 00 00 mov $0x10,%eax
number:
printnum(putch, putdat, num, base, width, padc);
80003e88: 83 ec 04 sub $0x4,%esp
80003e8b: 0f be 75 e3 movsbl -0x1d(%ebp),%esi
80003e8f: 56 push %esi
80003e90: ff 75 e4 pushl -0x1c(%ebp)
80003e93: 50 push %eax
80003e94: 89 fa mov %edi,%edx
80003e96: 8b 45 08 mov 0x8(%ebp),%eax
80003e99: e8 21 fb ff ff call 800039bf <printnum>
break;
80003e9e: 83 c4 10 add $0x10,%esp
80003ea1: e9 7e fc ff ff jmp 80003b24 <vprintfmt+0x11>
// escaped '%' character
case '%':
putch(ch, putdat);
80003ea6: 83 ec 08 sub $0x8,%esp
80003ea9: 57 push %edi
80003eaa: 51 push %ecx
80003eab: ff 55 08 call *0x8(%ebp)
break;
80003eae: 83 c4 10 add $0x10,%esp
80003eb1: e9 6e fc ff ff jmp 80003b24 <vprintfmt+0x11>
// unrecognized escape sequence - just print it literally
default:
putch('%', putdat);
80003eb6: 83 ec 08 sub $0x8,%esp
80003eb9: 57 push %edi
80003eba: 6a 25 push $0x25
80003ebc: ff 55 08 call *0x8(%ebp)
for (fmt--; fmt[-1] != '%'; fmt--)
80003ebf: 83 c4 10 add $0x10,%esp
80003ec2: 80 7e ff 25 cmpb $0x25,-0x1(%esi)
80003ec6: 0f 84 55 fc ff ff je 80003b21 <vprintfmt+0xe>
80003ecc: 83 ee 01 sub $0x1,%esi
80003ecf: 80 7e ff 25 cmpb $0x25,-0x1(%esi)
80003ed3: 75 f7 jne 80003ecc <vprintfmt+0x3b9>
80003ed5: 89 75 10 mov %esi,0x10(%ebp)
80003ed8: e9 47 fc ff ff jmp 80003b24 <vprintfmt+0x11>
if ((p = va_arg(ap, char *)) == NULL)
p = "(null)";
if (width > 0 && padc != '-')
for (width -= strnlen(p, precision); width > 0; width--)
putch(padc, putdat);
for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
80003edd: 8b 45 d0 mov -0x30(%ebp),%eax
80003ee0: 8d 70 01 lea 0x1(%eax),%esi
80003ee3: 0f b6 00 movzbl (%eax),%eax
80003ee6: 0f be d0 movsbl %al,%edx
80003ee9: 85 d2 test %edx,%edx
80003eeb: 0f 85 97 fe ff ff jne 80003d88 <vprintfmt+0x275>
80003ef1: e9 2e fc ff ff jmp 80003b24 <vprintfmt+0x11>
for (fmt--; fmt[-1] != '%'; fmt--)
/* do nothing */;
break;
}
}
}
80003ef6: 8d 65 f4 lea -0xc(%ebp),%esp
80003ef9: 5b pop %ebx
80003efa: 5e pop %esi
80003efb: 5f pop %edi
80003efc: 5d pop %ebp
80003efd: c3 ret
80003efe <vcprintf>:
b->cnt++;
}
int
vcprintf(const char *fmt, va_list ap)
{
80003efe: 55 push %ebp
80003eff: 89 e5 mov %esp,%ebp
80003f01: 81 ec 18 01 00 00 sub $0x118,%esp
struct printbuf b;
b.idx = 0;
80003f07: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp)
80003f0e: 00 00 00
b.cnt = 0;
80003f11: c7 85 f4 fe ff ff 00 movl $0x0,-0x10c(%ebp)
80003f18: 00 00 00
vprintfmt((void*)putch, &b, fmt, ap);
80003f1b: ff 75 0c pushl 0xc(%ebp)
80003f1e: ff 75 08 pushl 0x8(%ebp)
80003f21: 8d 85 f0 fe ff ff lea -0x110(%ebp),%eax
80003f27: 50 push %eax
80003f28: 68 5d 3a 00 80 push $0x80003a5d
80003f2d: e8 e1 fb ff ff call 80003b13 <vprintfmt>
sys_cputs(b.buf, b.idx);
80003f32: 83 c4 08 add $0x8,%esp
80003f35: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80003f3b: 8d 85 f8 fe ff ff lea -0x108(%ebp),%eax
80003f41: 50 push %eax
80003f42: e8 05 de ff ff call 80001d4c <sys_cputs>
return b.cnt;
}
80003f47: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80003f4d: c9 leave
80003f4e: c3 ret
80003f4f <cprintf>:
int
cprintf(const char *fmt, ...)
{
80003f4f: 55 push %ebp
80003f50: 89 e5 mov %esp,%ebp
80003f52: 83 ec 10 sub $0x10,%esp
va_list ap;
int cnt;
va_start(ap, fmt);
80003f55: 8d 45 0c lea 0xc(%ebp),%eax
cnt = vcprintf(fmt, ap);
80003f58: 50 push %eax
80003f59: ff 75 08 pushl 0x8(%ebp)
80003f5c: e8 9d ff ff ff call 80003efe <vcprintf>
va_end(ap);
return cnt;
}
80003f61: c9 leave
80003f62: c3 ret
80003f63 <vfprintf>:
}
}
int
vfprintf(int fd, const char *fmt, va_list ap)
{
80003f63: 55 push %ebp
80003f64: 89 e5 mov %esp,%ebp
80003f66: 81 ec 18 01 00 00 sub $0x118,%esp
struct fprintbuf b;
b.fd = fd;
80003f6c: 8b 45 08 mov 0x8(%ebp),%eax
80003f6f: 89 85 e8 fe ff ff mov %eax,-0x118(%ebp)
b.idx = 0;
80003f75: c7 85 ec fe ff ff 00 movl $0x0,-0x114(%ebp)
80003f7c: 00 00 00
b.result = 0;
80003f7f: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp)
80003f86: 00 00 00
b.error = 1;
80003f89: c7 85 f4 fe ff ff 01 movl $0x1,-0x10c(%ebp)
80003f90: 00 00 00
vprintfmt(fputch, &b, fmt, ap);
80003f93: ff 75 10 pushl 0x10(%ebp)
80003f96: ff 75 0c pushl 0xc(%ebp)
80003f99: 8d 85 e8 fe ff ff lea -0x118(%ebp),%eax
80003f9f: 50 push %eax
80003fa0: 68 de 3a 00 80 push $0x80003ade
80003fa5: e8 69 fb ff ff call 80003b13 <vprintfmt>
if (b.idx > 0)
80003faa: 83 c4 10 add $0x10,%esp
80003fad: 83 bd ec fe ff ff 00 cmpl $0x0,-0x114(%ebp)
80003fb4: 7e 0b jle 80003fc1 <vfprintf+0x5e>
writebuf(&b);
80003fb6: 8d 85 e8 fe ff ff lea -0x118(%ebp),%eax
80003fbc: e8 de fa ff ff call 80003a9f <writebuf>
return (b.result ? b.result : b.error);
80003fc1: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax
80003fc7: 85 c0 test %eax,%eax
80003fc9: 0f 44 85 f4 fe ff ff cmove -0x10c(%ebp),%eax
}
80003fd0: c9 leave
80003fd1: c3 ret
80003fd2 <fprintf>:
int
fprintf(int fd, const char *fmt, ...)
{
80003fd2: 55 push %ebp
80003fd3: 89 e5 mov %esp,%ebp
80003fd5: 83 ec 0c sub $0xc,%esp
va_list ap;
int cnt;
va_start(ap, fmt);
80003fd8: 8d 45 10 lea 0x10(%ebp),%eax
cnt = vfprintf(fd, fmt, ap);
80003fdb: 50 push %eax
80003fdc: ff 75 0c pushl 0xc(%ebp)
80003fdf: ff 75 08 pushl 0x8(%ebp)
80003fe2: e8 7c ff ff ff call 80003f63 <vfprintf>
va_end(ap);
return cnt;
}
80003fe7: c9 leave
80003fe8: c3 ret
80003fe9 <printf>:
int
printf(const char *fmt, ...)
{
80003fe9: 55 push %ebp
80003fea: 89 e5 mov %esp,%ebp
80003fec: 83 ec 0c sub $0xc,%esp
va_list ap;
int cnt;
va_start(ap, fmt);
80003fef: 8d 45 0c lea 0xc(%ebp),%eax
cnt = vfprintf(1, fmt, ap);
80003ff2: 50 push %eax
80003ff3: ff 75 08 pushl 0x8(%ebp)
80003ff6: 6a 01 push $0x1
80003ff8: e8 66 ff ff ff call 80003f63 <vfprintf>
va_end(ap);
return cnt;
}
80003ffd: c9 leave
80003ffe: c3 ret
80003fff <printfmt>:
putch("0123456789abcdef"[num % base], putdat);
}
void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...)
{
80003fff: 55 push %ebp
80004000: 89 e5 mov %esp,%ebp
80004002: 83 ec 08 sub $0x8,%esp
va_list ap;
va_start(ap, fmt);
80004005: 8d 45 14 lea 0x14(%ebp),%eax
vprintfmt(putch, putdat, fmt, ap);
80004008: 50 push %eax
80004009: ff 75 10 pushl 0x10(%ebp)
8000400c: ff 75 0c pushl 0xc(%ebp)
8000400f: ff 75 08 pushl 0x8(%ebp)
80004012: e8 fc fa ff ff call 80003b13 <vprintfmt>
va_end(ap);
}
80004017: 83 c4 10 add $0x10,%esp
8000401a: c9 leave
8000401b: c3 ret
8000401c <vsnprintf>:
*b->buf++ = ch;
}
int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
8000401c: 55 push %ebp
8000401d: 89 e5 mov %esp,%ebp
8000401f: 83 ec 18 sub $0x18,%esp
80004022: 8b 45 08 mov 0x8(%ebp),%eax
80004025: 8b 55 0c mov 0xc(%ebp),%edx
struct sprintbuf b = {buf, buf+n-1, 0};
80004028: 89 45 ec mov %eax,-0x14(%ebp)
8000402b: 8d 4c 10 ff lea -0x1(%eax,%edx,1),%ecx
8000402f: 89 4d f0 mov %ecx,-0x10(%ebp)
80004032: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
if (buf == NULL || n < 1)
80004039: 85 c0 test %eax,%eax
8000403b: 74 26 je 80004063 <vsnprintf+0x47>
8000403d: 85 d2 test %edx,%edx
8000403f: 7e 22 jle 80004063 <vsnprintf+0x47>
return -E_INVAL;
// print the string to the buffer
vprintfmt((void*)sprintputch, &b, fmt, ap);
80004041: ff 75 14 pushl 0x14(%ebp)
80004044: ff 75 10 pushl 0x10(%ebp)
80004047: 8d 45 ec lea -0x14(%ebp),%eax
8000404a: 50 push %eax
8000404b: 68 40 3a 00 80 push $0x80003a40
80004050: e8 be fa ff ff call 80003b13 <vprintfmt>
// null terminate the buffer
*b.buf = '\0';
80004055: 8b 45 ec mov -0x14(%ebp),%eax
80004058: c6 00 00 movb $0x0,(%eax)
return b.cnt;
8000405b: 8b 45 f4 mov -0xc(%ebp),%eax
8000405e: 83 c4 10 add $0x10,%esp
80004061: eb 05 jmp 80004068 <vsnprintf+0x4c>
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
struct sprintbuf b = {buf, buf+n-1, 0};
if (buf == NULL || n < 1)
return -E_INVAL;
80004063: b8 fd ff ff ff mov $0xfffffffd,%eax
// null terminate the buffer
*b.buf = '\0';
return b.cnt;
}
80004068: c9 leave
80004069: c3 ret
8000406a <snprintf>:
int
snprintf(char *buf, int n, const char *fmt, ...)
{
8000406a: 55 push %ebp
8000406b: 89 e5 mov %esp,%ebp
8000406d: 83 ec 08 sub $0x8,%esp
va_list ap;
int rc;
va_start(ap, fmt);
80004070: 8d 45 14 lea 0x14(%ebp),%eax
rc = vsnprintf(buf, n, fmt, ap);
80004073: 50 push %eax
80004074: ff 75 10 pushl 0x10(%ebp)
80004077: ff 75 0c pushl 0xc(%ebp)
8000407a: ff 75 08 pushl 0x8(%ebp)
8000407d: e8 9a ff ff ff call 8000401c <vsnprintf>
va_end(ap);
return rc;
}
80004082: c9 leave
80004083: c3 ret
80004084 <readline>:
#define BUFLEN 1024
static char buf[BUFLEN];
char *
readline(const char *prompt)
{
80004084: 55 push %ebp
80004085: 89 e5 mov %esp,%ebp
80004087: 57 push %edi
80004088: 56 push %esi
80004089: 53 push %ebx
8000408a: 83 ec 0c sub $0xc,%esp
8000408d: 8b 45 08 mov 0x8(%ebp),%eax
#ifndef __FOR_USER__
if (prompt != NULL)
cprintf("%s", prompt);
#else
if (prompt != NULL)
80004090: 85 c0 test %eax,%eax
80004092: 74 13 je 800040a7 <readline+0x23>
fprintf(1, "%s", prompt);
80004094: 83 ec 04 sub $0x4,%esp
80004097: 50 push %eax
80004098: 68 a2 42 00 80 push $0x800042a2
8000409d: 6a 01 push $0x1
8000409f: e8 2e ff ff ff call 80003fd2 <fprintf>
800040a4: 83 c4 10 add $0x10,%esp
#endif
i = 0;
echoing = iscons(0);
800040a7: 83 ec 0c sub $0xc,%esp
800040aa: 6a 00 push $0x0
800040ac: e8 57 e0 ff ff call 80002108 <iscons>
800040b1: 89 c7 mov %eax,%edi
800040b3: 83 c4 10 add $0x10,%esp
#else
if (prompt != NULL)
fprintf(1, "%s", prompt);
#endif
i = 0;
800040b6: be 00 00 00 00 mov $0x0,%esi
echoing = iscons(0);
while (1) {
c = getchar();
800040bb: e8 1d e0 ff ff call 800020dd <getchar>
800040c0: 89 c3 mov %eax,%ebx
if (c < 0) {
800040c2: 85 c0 test %eax,%eax
800040c4: 79 29 jns 800040ef <readline+0x6b>
if (c != -E_EOF)
cprintf("read error: %e\n", c);
return NULL;
800040c6: b8 00 00 00 00 mov $0x0,%eax
i = 0;
echoing = iscons(0);
while (1) {
c = getchar();
if (c < 0) {
if (c != -E_EOF)
800040cb: 83 fb f8 cmp $0xfffffff8,%ebx
800040ce: 0f 84 9b 00 00 00 je 8000416f <readline+0xeb>
cprintf("read error: %e\n", c);
800040d4: 83 ec 08 sub $0x8,%esp
800040d7: 53 push %ebx
800040d8: 68 a8 46 00 80 push $0x800046a8
800040dd: e8 6d fe ff ff call 80003f4f <cprintf>
800040e2: 83 c4 10 add $0x10,%esp
return NULL;
800040e5: b8 00 00 00 00 mov $0x0,%eax
800040ea: e9 80 00 00 00 jmp 8000416f <readline+0xeb>
} else if ((c == '\b' || c == '\x7f') && i > 0) {
800040ef: 83 f8 08 cmp $0x8,%eax
800040f2: 0f 94 c2 sete %dl
800040f5: 83 f8 7f cmp $0x7f,%eax
800040f8: 0f 94 c0 sete %al
800040fb: 08 c2 or %al,%dl
800040fd: 74 1a je 80004119 <readline+0x95>
800040ff: 85 f6 test %esi,%esi
80004101: 7e 16 jle 80004119 <readline+0x95>
if (echoing)
80004103: 85 ff test %edi,%edi
80004105: 74 0d je 80004114 <readline+0x90>
cputchar('\b');
80004107: 83 ec 0c sub $0xc,%esp
8000410a: 6a 08 push $0x8
8000410c: e8 b0 df ff ff call 800020c1 <cputchar>
80004111: 83 c4 10 add $0x10,%esp
i--;
80004114: 83 ee 01 sub $0x1,%esi
80004117: eb a2 jmp 800040bb <readline+0x37>
} else if (c >= ' ' && i < BUFLEN-1) {
80004119: 83 fb 1f cmp $0x1f,%ebx
8000411c: 7e 26 jle 80004144 <readline+0xc0>
8000411e: 81 fe fe 03 00 00 cmp $0x3fe,%esi
80004124: 7f 1e jg 80004144 <readline+0xc0>
if (echoing)
80004126: 85 ff test %edi,%edi
80004128: 74 0c je 80004136 <readline+0xb2>
cputchar(c);
8000412a: 83 ec 0c sub $0xc,%esp
8000412d: 53 push %ebx
8000412e: e8 8e df ff ff call 800020c1 <cputchar>
80004133: 83 c4 10 add $0x10,%esp
buf[i++] = c;
80004136: 88 9e 20 60 00 80 mov %bl,-0x7fff9fe0(%esi)
8000413c: 8d 76 01 lea 0x1(%esi),%esi
8000413f: e9 77 ff ff ff jmp 800040bb <readline+0x37>
} else if (c == '\n' || c == '\r') {
80004144: 83 fb 0a cmp $0xa,%ebx
80004147: 74 09 je 80004152 <readline+0xce>
80004149: 83 fb 0d cmp $0xd,%ebx
8000414c: 0f 85 69 ff ff ff jne 800040bb <readline+0x37>
if (echoing)
80004152: 85 ff test %edi,%edi
80004154: 74 0d je 80004163 <readline+0xdf>
cputchar('\n');
80004156: 83 ec 0c sub $0xc,%esp
80004159: 6a 0a push $0xa
8000415b: e8 61 df ff ff call 800020c1 <cputchar>
80004160: 83 c4 10 add $0x10,%esp
buf[i] = 0;
80004163: c6 86 20 60 00 80 00 movb $0x0,-0x7fff9fe0(%esi)
return buf;
8000416a: b8 20 60 00 80 mov $0x80006020,%eax
}
}
}
8000416f: 8d 65 f4 lea -0xc(%ebp),%esp
80004172: 5b pop %ebx
80004173: 5e pop %esi
80004174: 5f pop %edi
80004175: 5d pop %ebp
80004176: c3 ret
80004177 <_panic>:
*/
#include <syslib.h>
void
_panic(const char *file, int line, const char *fmt, ...)
{
80004177: 55 push %ebp
80004178: 89 e5 mov %esp,%ebp
8000417a: 56 push %esi
8000417b: 53 push %ebx
va_list ap;
va_start(ap, fmt);
8000417c: 8d 5d 14 lea 0x14(%ebp),%ebx
// Print the panic message
cprintf("[%08x] user panic in %s at %s:%d: ",
8000417f: 8b 35 00 50 00 80 mov 0x80005000,%esi
80004185: e8 40 dc ff ff call 80001dca <sys_getenvid>
8000418a: 83 ec 0c sub $0xc,%esp
8000418d: ff 75 0c pushl 0xc(%ebp)
80004190: ff 75 08 pushl 0x8(%ebp)
80004193: 56 push %esi
80004194: 50 push %eax
80004195: 68 88 49 00 80 push $0x80004988
8000419a: e8 b0 fd ff ff call 80003f4f <cprintf>
sys_getenvid(), binaryname, file, line);
vcprintf(fmt, ap);
8000419f: 83 c4 18 add $0x18,%esp
800041a2: 53 push %ebx
800041a3: ff 75 10 pushl 0x10(%ebp)
800041a6: e8 53 fd ff ff call 80003efe <vcprintf>
cprintf("\n");
800041ab: c7 04 24 e0 41 00 80 movl $0x800041e0,(%esp)
800041b2: e8 98 fd ff ff call 80003f4f <cprintf>
800041b7: 83 c4 10 add $0x10,%esp
// Cause a breakpoint exception
while (1)
asm volatile("int3");
800041ba: cc int3
800041bb: eb fd jmp 800041ba <_panic+0x43>
| 37.414707
| 98
| 0.524819
|
eb6204f23301a7eb6230898c43bc93e43abb6750
| 2,397
|
css
|
CSS
|
example/style.css
|
dunckr/email-obfuscate
|
0df253cddeb4a7a05fc956e0d8d8e7e0f560920d
|
[
"MIT"
] | 25
|
2015-10-19T21:17:25.000Z
|
2021-08-20T08:26:01.000Z
|
example/style.css
|
dunckr/email-obfuscate
|
0df253cddeb4a7a05fc956e0d8d8e7e0f560920d
|
[
"MIT"
] | 2
|
2017-09-09T16:47:35.000Z
|
2017-09-09T18:08:25.000Z
|
example/style.css
|
dunckr/email-obfuscate
|
0df253cddeb4a7a05fc956e0d8d8e7e0f560920d
|
[
"MIT"
] | 2
|
2017-09-09T16:54:31.000Z
|
2018-06-29T09:34:26.000Z
|
html {
background-color: #E1EBF7;
-webkit-font-smoothing: antialiased;
}
body {
font: 100%/1.5 "Fira Sans", Verdana, sans-serif;
background-color: #FFFFFF;
color: #494949;
}
.row:after {
content: "";
display: table;
clear: both;
}
.columns {
width: 100%;
float: left;
}
.six.columns {
width: 48%;
}
@media (min-width: 800px) {
.two.columns {
width: 13.3333333333%;
}
}
@media (min-width: 800px) {
.ten.columns {
width: 82.6666666667%;
}
}
.title {
padding: 80px 40px 0;
}
.title .icon {
text-align: center;
}
.title h1 {
text-align: center;
text-transform: uppercase;
}
.title p {
text-align: center;
}
p,
span {
color: #A5A5A5;
}
a {
color: #94C8FF;
text-decoration: underline;
}
section {
padding: 5px;
}
@media (min-width: 800px) {
section {
padding: 40px;
}
}
form {
text-align: center;
}
@media (min-width: 800px) {
.control {
padding-left: 20%;
padding-right: 20%;
}
}
.control label {
line-height: 2;
}
.example {
background-color: #F8F9FA;
color: #4D4D4D;
}
@media (min-width: 800px) {
section {
padding-left: 20%;
padding-right: 20%;
}
}
.example span {
line-height: 4;
}
#clear,
#obfuscated {
font-size: 40px;
margin: 0;
}
h3 {
padding: 30px 0;
}
select {
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
background-color: #fff;
background-image: none;
border: 1px solid #F0F0F1;
border-radius: 4px;
}
option {
font-weight: normal;
display: block;
padding: 0px 2px 1px;
white-space: pre;
min-height: 1.2em;
}
pre {
background-color: #FFFFFF;
border: 1px solid #F0F0F1;
padding: 1em;
margin: .5em 0;
overflow: auto;
}
code {
text-shadow: 0 1px white;
font-family: 'Open Sans', Consolas, Monaco, 'Andale Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
}
footer {
background-color: #E1EBF7;
padding: 40px;
float: right;
}
.github-corner:hover .octo-arm {
animation: octocat-wave 560ms ease-in-out
}
@keyframes octocat-wave {
0%, 100% {
transform: rotate(0)
}
20%,
60% {
transform: rotate(-25deg)
}
40%,
80% {
transform: rotate(10deg)
}
}
@media (max-width:500px) {
.github-corner:hover .octo-arm {
animation: none
}
.github-corner .octo-arm {
animation: octocat-wave 560ms ease-in-out
}
}
| 12.956757
| 71
| 0.614101
|
c6555cefd62595ea073851119f88adbdb62c9718
| 142
|
swift
|
Swift
|
Tests/Day14LibTests/Day14LibTests.swift
|
bscothern/AdventOfCode2019
|
9423eacef967bd4890bbe10f51ff29519ab8c432
|
[
"MIT"
] | null | null | null |
Tests/Day14LibTests/Day14LibTests.swift
|
bscothern/AdventOfCode2019
|
9423eacef967bd4890bbe10f51ff29519ab8c432
|
[
"MIT"
] | null | null | null |
Tests/Day14LibTests/Day14LibTests.swift
|
bscothern/AdventOfCode2019
|
9423eacef967bd4890bbe10f51ff29519ab8c432
|
[
"MIT"
] | null | null | null |
import XCTest
@testable import Day14Lib
final class Day14LibTests: XCTestCase {
func testPart1() {
}
func testPart2() {
}
}
| 12.909091
| 39
| 0.65493
|
4cdec6144381fb60063a60930ad13fdfc457684a
| 790
|
py
|
Python
|
meshed/tests/test_makers.py
|
i2mint/meshed
|
4201f9efcce4f2859ffc8253811ac9335f21856b
|
[
"MIT"
] | 3
|
2021-06-30T08:40:50.000Z
|
2022-01-19T13:13:33.000Z
|
meshed/tests/test_makers.py
|
i2mint/meshed
|
4201f9efcce4f2859ffc8253811ac9335f21856b
|
[
"MIT"
] | 18
|
2020-10-15T19:58:42.000Z
|
2022-03-28T19:06:37.000Z
|
meshed/tests/test_makers.py
|
i2mint/meshed
|
4201f9efcce4f2859ffc8253811ac9335f21856b
|
[
"MIT"
] | 1
|
2021-09-14T19:24:36.000Z
|
2021-09-14T19:24:36.000Z
|
import meshed as ms
import pytest
@pytest.fixture
def simple_graph():
return dict(a='c', b='cd', c='abd', e='')
def test_edge_reversed_graph(simple_graph):
g = simple_graph
assert ms.makers.edge_reversed_graph(g) == {
'c': ['a', 'b'],
'd': ['b', 'c'],
'a': ['c'],
'b': ['c'],
'e': [],
}
reverse_g_with_sets = ms.makers.edge_reversed_graph(g, set, set.add)
assert reverse_g_with_sets == {
'c': {'a', 'b'},
'd': {'b', 'c'},
'a': {'c'},
'b': {'c'},
'e': set([]),
}
assert ms.makers.edge_reversed_graph(dict(e='', a='e')) == {
'e': ['a'],
'a': [],
}
assert ms.makers.edge_reversed_graph(dict(a='e', e='')) == {
'e': ['a'],
'a': [],
}
| 22.571429
| 72
| 0.448101
|
3bcb0cbe2a58d0171ff3d9ab1a75a4cc3322a089
| 229
|
swift
|
Swift
|
Sources/ADChronicle/OSLog+Convinience.swift
|
AllDmeat/ADChronicle
|
3c2246e881b21b1fd15ddcad8d89b58554206fca
|
[
"MIT"
] | null | null | null |
Sources/ADChronicle/OSLog+Convinience.swift
|
AllDmeat/ADChronicle
|
3c2246e881b21b1fd15ddcad8d89b58554206fca
|
[
"MIT"
] | null | null | null |
Sources/ADChronicle/OSLog+Convinience.swift
|
AllDmeat/ADChronicle
|
3c2246e881b21b1fd15ddcad8d89b58554206fca
|
[
"MIT"
] | null | null | null |
import Foundation
import os
@available(iOS 10.0, *)
extension OSLog {
convenience init<Subject>(subsystem: String, category: Subject) {
self.init(subsystem: subsystem, category: String(describing: category))
}
}
| 22.9
| 79
| 0.71179
|
7f7cd8c7b2eb73b868b1d81d64ed55e714e9191c
| 566
|
php
|
PHP
|
app/Book.php
|
hsuthinzarnyi/bookstore_laravel
|
11c6f3803dc68cd3ebf314efbbf6d962ec2bdd32
|
[
"MIT"
] | null | null | null |
app/Book.php
|
hsuthinzarnyi/bookstore_laravel
|
11c6f3803dc68cd3ebf314efbbf6d962ec2bdd32
|
[
"MIT"
] | null | null | null |
app/Book.php
|
hsuthinzarnyi/bookstore_laravel
|
11c6f3803dc68cd3ebf314efbbf6d962ec2bdd32
|
[
"MIT"
] | null | null | null |
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Book extends Model
{
use SoftDeletes;
protected $fillable = [
'b_name','photo','price','author_id','genre_id','publisher_id','created_at','updated_at','deleted_at'
];
public function authors()
{
return $this->belongsTo('App\Author','author_id');
}
public function genres()
{
return $this->belongsTo('App\Genre','genre_id');
}
public function publishers()
{
return $this->belongsTo('App\Publisher','publisher_id');
}
}
| 17.6875
| 103
| 0.699647
|
8db0c86e154577147a7ae35e4082abe142859164
| 670
|
js
|
JavaScript
|
src/components/Container.js
|
CannaShaq/shaq-practice
|
4ab2ab1208a222ec04308ef867ba9c658cc54e81
|
[
"MIT"
] | null | null | null |
src/components/Container.js
|
CannaShaq/shaq-practice
|
4ab2ab1208a222ec04308ef867ba9c658cc54e81
|
[
"MIT"
] | null | null | null |
src/components/Container.js
|
CannaShaq/shaq-practice
|
4ab2ab1208a222ec04308ef867ba9c658cc54e81
|
[
"MIT"
] | null | null | null |
import React, {useEffect} from 'react';
import { connect } from 'react-redux';
import { getData } from '../actions';
import Card from './Card'
const Container = ( {data, getData, isFetching, error}) => {
useEffect(() => {
getData()
}, [])
return (
<div>
{isFetching ? "Loading": error ? "Error": data.map(dog => (
<Card key={dog.id} dog={dog}/>
))}
</div>
)
}
const mapStateToProps = state => {
return {
isFetching: state.data.isFetching,
error: state.data.error,
data: state.data.data
}
}
export default connect(mapStateToProps, { getData })(Container);
| 23.928571
| 71
| 0.549254
|
d2f31c177d43d4955d940bfb1248262559f4854a
| 11,802
|
lua
|
Lua
|
generate.lua
|
illteteka/illteteka-website-builder
|
40d47c35e44f231a147ae3504e89877fc69ceeec
|
[
"MIT"
] | null | null | null |
generate.lua
|
illteteka/illteteka-website-builder
|
40d47c35e44f231a147ae3504e89877fc69ceeec
|
[
"MIT"
] | null | null | null |
generate.lua
|
illteteka/illteteka-website-builder
|
40d47c35e44f231a147ae3504e89877fc69ceeec
|
[
"MIT"
] | null | null | null |
local generate = {}
template = require 'html.template'
generate.navbar = ""
generate.template = ""
generate.br = '</p><div id="br"></div><p id="desc">'
function generate.setupFilesystem()
os.execute("rmdir /S /Q export")
os.execute("mkdir " .. "export")
end
function generate.makeNavbar()
local extra_tabs = "\t\t\t"
local navbar = ""
navbar = navbar .. '<div id="navbar">\n'
navbar = navbar .. extra_tabs .. '\t<a href="' .. _URL .. '"><img id="illteteka-logo" src="' .. _URL .. 'images/illteteka.svg" /></a>\n'
navbar = navbar .. extra_tabs .. '\t<div id="nav-items">\n'
local i = 1
while i <= #pages.navbar do
local link_text = pages.navbar[i].text
local link_url = ""
if pages.navbar[i].link ~= nil then
link_url = pages.navbar[i].link
else
if pages.navbar[i].url == "index" then
link_url = ""
else
link_url = pages.navbar[i].url .. "/"
end
end
local nav_element = '<a href="'
local use_url = string.find(link_url, "http") == nil
local url_block = ""
if use_url then
url_block = _URL
end
nav_element = nav_element .. url_block .. link_url .. '">'
nav_element = nav_element .. link_text .. '</a>'
navbar = navbar .. extra_tabs .. '\t' .. nav_element .. '\n'
if i + 1 <= #pages.navbar then
navbar = navbar .. extra_tabs .. '\t<p> | </p>\n'
end
i = i + 1
end
navbar = navbar .. extra_tabs .. '\t</div>\n'
navbar = navbar .. extra_tabs .. '</div>\n'
generate.navbar = navbar
end
function generate.makeTemplate()
local this_temp = "" .. template.html
this_temp = string.gsub(this_temp, "RP_NAVBAR", generate.navbar)
this_temp = string.gsub(this_temp, "RP_URL", _URL)
generate.template = this_temp
end
function quicksort(t, left, right)
if right < left then return end
local pivot = left
for i = left + 1, right do
if t[i].release_score >= t[pivot].release_score then
if i == pivot + 1 then
t[pivot],t[pivot+1] = t[pivot+1],t[pivot]
else
t[pivot],t[pivot+1],t[i] = t[i],t[pivot],t[pivot+1]
end
pivot = pivot + 1
end
end
quicksort(t, left, pivot - 1)
quicksort(t, pivot + 1, right)
end
function generate.makeGrids()
local extra_tabs = "\t\t\t"
-- Split content into arbitrary number of groups
local page_groups = {}
local i = 1
while i <= #pages.content do
local this_kind = pages.content[i].kind
if page_groups[this_kind] == nil then
page_groups[this_kind] = {}
end
table.insert(page_groups[this_kind], pages.content[i])
i = i + 1
end
-- TODO quick sort each of these based on release date
local sort = 1
while sort <= #page_groups do
quicksort(page_groups[sort], 1, #page_groups[sort])
sort = sort + 1
end
-- Loop through each group then each page
local this_content = ""
local group = 1
while group <= #page_groups do
local write_to = ""
local page = 1
while page <= #page_groups[group] do
local this_page = page_groups[group][page]
local modmod = #page_groups[group] % 3
local blank_pages = 3 - modmod
if modmod == 0 then
blank_pages = 0
end
-- Make grid for page
local url = this_page.url
local title = this_page.title
local logo = this_page.logo
local logo_hd = this_page.logo_hd
write_to = this_page.src
local write_page_to = "games/"
if write_to ~= "index" then
write_page_to = write_to .. "/"
end
generate.makeEntries(this_page)
if page % 3 == 1 then
this_content = this_content .. '<div id="items">\n'
end
this_content = this_content .. extra_tabs .. '\t<div id="menu-item">\n'
this_content = this_content .. extra_tabs .. '\t\t<a href="' .. _URL .. write_page_to .. url .. '.html">\n'
this_content = this_content .. extra_tabs .. '\t\t\t<img id="item-img" srcset="' .. _URL .. 'images/' .. logo .. ' 1x, ' .. _URL .. 'images/' .. logo_hd .. ' 2x" src="' .. _URL .. 'images/' .. logo .. '">\n' -- eventually add write_page_to here
this_content = this_content .. extra_tabs .. '\t\t\t<p id="item-name">' .. title .. '</p>\n'
this_content = this_content .. extra_tabs .. '\t\t</a>\n'
this_content = this_content .. extra_tabs .. '\t</div>\n'
-- Make blank pages
if page + 1 > #page_groups[group] then
local make_blanks = 1
while make_blanks <= blank_pages do
this_content = this_content .. extra_tabs .. '\t<div id="menu-blank">\n'
local blank_to_use = "rect"
if group == 2 then
blank_to_use = "square"
end
this_content = this_content .. extra_tabs .. '\t\t\t<img id="item-img-blank" src="' .. _URL .. 'images/blank-' .. blank_to_use .. '.png">\n'
this_content = this_content .. extra_tabs .. '\t</div>\n'
make_blanks = make_blanks + 1
end
this_content = this_content .. extra_tabs .. '</div>\n'
elseif page % 3 == 0 then
this_content = this_content .. extra_tabs .. '</div>\n'
end
page = page + 1
end
if i + 1 <= #page_groups[group] then
this_content = this_content .. extra_tabs .. '\t<div id="item-space"></div>\n'
else
-- Finish and write the page
local write_loc = "export" .. _SLASH .. "index.html"
if write_to ~= "index" then
os.execute("mkdir export" .. _SLASH .. write_to)
write_loc = "export" .. _SLASH .. write_to .. _SLASH .. "index.html"
else
write_to = "games"
os.execute("mkdir export" .. _SLASH .. "games")
end
write_to = generate.cap(write_to)
local file = io.open(write_loc, "w")
local this_temp2 = string.gsub(generate.template, "RP_CONTENT", this_content)
this_temp2 = string.gsub(this_temp2, "RP_TITLE", write_to)
this_temp2 = string.gsub(this_temp2, "RP_DATE", _DATE)
file:write(this_temp2)
file:close(file)
this_content = ""
write_to = ""
end
group = group + 1
end
end
function generate.cap(x)
local cap = string.upper(string.sub(x, 1, 1))
return cap .. string.sub(x, 2)
end
function generate.makeEntries(page)
local this_entry = ""
local has_screenshots = page.screenshots ~= nil
local has_screenshot_links = (page.screenshot_links ~= nil) and (#page.screenshot_links == #page.screenshots)
local has_links = page.links ~= nil
this_entry = this_entry .. '<div id="items">\n'
this_entry = this_entry .. '\t<div id="body">\n'
this_entry = this_entry .. '\t\t<div id="lr-content">\n'
-- make the page
if has_screenshots then
-- Make left side
this_entry = this_entry .. '\t\t\t<div id="body-left">\n'
end
--
-- actually make the page
this_entry = this_entry .. '\t\t\t\t<img id="body-img" srcset="' .. _URL .. 'images/' .. page.logo .. ' 1x, ' .. _URL .. 'images/' .. page.logo_hd .. ' 2x" src="' .. _URL .. 'images/' .. page.logo .. '">\n'
this_entry = this_entry .. '\t\t\t\t<p id="title">' .. page.title .. '</p>\n'
this_entry = this_entry .. '\t\t\t\t<p id="release">Released ' .. page.release_date .. '</p>\n'
local this_desc = string.gsub(page.desc, "RP_BR", generate.br)
this_entry = this_entry .. '\t\t\t\t<p id="desc">' .. this_desc .. '</p>\n'
if has_screenshots then
this_entry = this_entry .. '\t\t\t</div>\n'
this_entry = this_entry .. '\t\t\t<div id="body-right">\n'
this_entry = this_entry .. '\t\t\t\t<div id="top-space"></div>\n'
-- put screenshots here
local srn_start = '\t\t\t\t<a href="'
local srn_mid = '"><img id="screen-img" src="'
local srn_end = '"></a>\n'
local screen = 1
while screen <= #page.screenshots do
local this_screen = page.screenshots[screen]
local dir_link = _URL .. 'images/' .. this_screen
this_entry = this_entry .. srn_start
if has_screenshot_links then
this_entry = this_entry .. page.screenshot_links[screen]
else
this_entry = this_entry .. dir_link
end
this_entry = this_entry .. srn_mid
this_entry = this_entry .. dir_link
this_entry = this_entry .. srn_end
screen = screen + 1
end
-- end screenshots
this_entry = this_entry .. '\t\t\t</div>\n'
end
-- end content
this_entry = this_entry .. '\t\t</div>\n'
-- make the links
if has_links then
this_entry = this_entry .. '\t\t<div id="links">\n'
local these_links = generate.makeLinks(page)
this_entry = this_entry .. these_links
this_entry = this_entry .. '\t\t</div>\n'
end
-- end block
this_entry = this_entry .. '\t</div>\n'
this_entry = this_entry .. '</div>\n'
local write_loc2 = "export" .. _SLASH .. "games" .. _SLASH .. page.url .. ".html"
local write_to2 = page.src
if write_to2 ~= "index" then
write_loc2 = "export" .. _SLASH .. write_to2 .. _SLASH .. page.url .. ".html"
os.execute("mkdir export" .. _SLASH .. write_to2)
else
os.execute("mkdir export" .. _SLASH .. "games")
end
local file = io.open(write_loc2, "w")
local this_temp3 = string.gsub(generate.template, "RP_CONTENT", this_entry)
this_temp3 = string.gsub(this_temp3, "RP_TITLE", page.title)
this_temp3 = string.gsub(this_temp3, "RP_DATE", _DATE)
file:write(this_temp3)
file:close(file)
end
function generate.makeLinks(page)
local str = ""
local pre_link = '\t\t\t<a class="sp2" id="link" href="'
local mid_link = '">> '
local end_link = ' <</a>\n'
-- Direct Download
if page.links.direct ~= nil then
str = str .. pre_link
str = str .. page.links.direct
str = str .. mid_link
str = str .. "Direct Download"
str = str .. end_link
end
-- Play online on illteteka.com
if page.links.online ~= nil then
str = str .. pre_link
str = str .. page.links.online
str = str .. mid_link
str = str .. "Play online on illteteka.com"
str = str .. end_link
end
-- Download on Itch.io
if page.links.itch ~= nil then
str = str .. pre_link
str = str .. page.links.itch
str = str .. mid_link
str = str .. "Download on Itch.io"
str = str .. end_link
end
-- Download on Glorious Trainwrecks
if page.links.gt ~= nil then
str = str .. pre_link
str = str .. page.links.gt
str = str .. mid_link
str = str .. "Download on Glorious Trainwrecks"
str = str .. end_link
end
-- View source on GitHub
if page.links.github ~= nil then
str = str .. pre_link
str = str .. page.links.github
str = str .. mid_link
str = str .. "View source on GitHub"
str = str .. end_link
end
-- Stream X on Apple Music
if page.links.apple ~= nil then
str = str .. pre_link
str = str .. page.links.apple
str = str .. mid_link
str = str .. "Stream " .. page.title .. " on Apple Music"
str = str .. end_link
end
-- Stream X on Bandcamp
if page.links.bc ~= nil then
str = str .. pre_link
str = str .. page.links.bc
str = str .. mid_link
str = str .. "Stream " .. page.title .. " on Bandcamp"
str = str .. end_link
end
-- Stream X on Newgrounds
if page.links.ng ~= nil then
str = str .. pre_link
str = str .. page.links.ng
str = str .. mid_link
str = str .. "Stream " .. page.title .. " on Newgrounds"
str = str .. end_link
end
-- Stream X on SoundCloud
if page.links.sc ~= nil then
str = str .. pre_link
str = str .. page.links.sc
str = str .. mid_link
str = str .. "Stream " .. page.title .. " on SoundCloud"
str = str .. end_link
end
-- Stream X on Spotify
if page.links.spotify ~= nil then
str = str .. pre_link
str = str .. page.links.spotify
str = str .. mid_link
str = str .. "Stream " .. page.title .. " on Spotify"
str = str .. end_link
end
-- Stream X on YouTube
if page.links.yt ~= nil then
str = str .. pre_link
str = str .. page.links.yt
str = str .. mid_link
str = str .. "Stream " .. page.title .. " on YouTube"
str = str .. end_link
end
-- Custom 1
if page.links.custom1_text ~= nil then
str = str .. pre_link
str = str .. page.links.custom1_url
str = str .. mid_link
str = str .. page.links.custom1_text
str = str .. end_link
end
return str
end
return generate
| 27.382831
| 247
| 0.628622
|
af1ec2712f6075a432b33270dc5687d33bbef417
| 59
|
py
|
Python
|
tasks/components/dialogs.py
|
JuacyWillian/TasksApp
|
e9b1a492cc9ba6ee3bddff24aaa200de52464dc7
|
[
"MIT"
] | 1
|
2018-11-18T13:31:26.000Z
|
2018-11-18T13:31:26.000Z
|
tasks/components/dialogs.py
|
JuacyWillian/TasksApp
|
e9b1a492cc9ba6ee3bddff24aaa200de52464dc7
|
[
"MIT"
] | null | null | null |
tasks/components/dialogs.py
|
JuacyWillian/TasksApp
|
e9b1a492cc9ba6ee3bddff24aaa200de52464dc7
|
[
"MIT"
] | null | null | null |
from kivy.lang import Builder
Builder.load_string("""""")
| 14.75
| 29
| 0.728814
|
05fb3180ec49937e6c11c2883ff3ddfd9c392cd6
| 67
|
rb
|
Ruby
|
lib/redbeard.rb
|
liamja/redbeard
|
384afcf35f9037b98d8f9494e94d725634e72768
|
[
"MIT"
] | 2
|
2018-01-20T21:34:22.000Z
|
2019-01-09T11:36:42.000Z
|
lib/redbeard.rb
|
liamja/redbeard
|
384afcf35f9037b98d8f9494e94d725634e72768
|
[
"MIT"
] | null | null | null |
lib/redbeard.rb
|
liamja/redbeard
|
384afcf35f9037b98d8f9494e94d725634e72768
|
[
"MIT"
] | null | null | null |
require 'redbeard/http'
require 'bencode'
class Redbeard
end
| 9.571429
| 23
| 0.731343
|
b75e80dfc6b4645d842b4b4bce139b667dddd272
| 1,416
|
cpp
|
C++
|
VIIL/src/renderer/interface/Shader.cpp
|
Vixnil/VIIL
|
0057464a1bc6e938825cfdf59a977cbe53c03a00
|
[
"Apache-2.0"
] | null | null | null |
VIIL/src/renderer/interface/Shader.cpp
|
Vixnil/VIIL
|
0057464a1bc6e938825cfdf59a977cbe53c03a00
|
[
"Apache-2.0"
] | null | null | null |
VIIL/src/renderer/interface/Shader.cpp
|
Vixnil/VIIL
|
0057464a1bc6e938825cfdf59a977cbe53c03a00
|
[
"Apache-2.0"
] | null | null | null |
#include "core/standardUse.h"
#include "renderer/interface/Shader.h"
#include "renderer//interface/RendererLibrary.h"
#include "renderer/OpenGL/OpenGLShader.h"
namespace VIIL
{
std::shared_ptr<Shader> Shader::Create(const std::shared_ptr<File>& shaderSrc)
{
switch (RendererLibrary::getType())
{
case RendererLibrary::Type::OpenGL:
return std::shared_ptr<Shader>(new OpenGLShader(shaderSrc));
break;
default:
VL_ENGINE_FATAL("Unimplemented renderer type selected. Shader creation failed.");
}
return nullptr;
}
std::shared_ptr<Shader> Shader::Create(const std::string& name, const std::shared_ptr<File>& vertexFile, const std::shared_ptr<File>& fragmentFile)
{
switch (RendererLibrary::getType())
{
case RendererLibrary::Type::OpenGL:
return std::shared_ptr<Shader>(new OpenGLShader(name, vertexFile, fragmentFile));
break;
default:
VL_ENGINE_FATAL("Unimplemented renderer type selected. Shader creation failed.");
}
return nullptr;
}
std::shared_ptr<Shader> Shader::Create(const std::string& name, const std::string& vertexSrc, const std::string& fragmentSrc)
{
switch (RendererLibrary::getType())
{
case RendererLibrary::Type::OpenGL:
return std::shared_ptr<Shader>(new OpenGLShader(name, vertexSrc, fragmentSrc));
break;
default:
VL_ENGINE_FATAL("Unimplemented renderer type selected. Shader creation failed.");
}
return nullptr;
}
}
| 27.764706
| 148
| 0.737288
|
337060dde20ca48754f6b4ed6d2991e710109e4c
| 7,758
|
go
|
Go
|
pkg/db/postgresql/postgresql.go
|
stolostron/hub-of-hubs-nonk8s-gitops
|
5a0e1a0786b8613c5920daa44d4671050228492c
|
[
"Apache-2.0"
] | null | null | null |
pkg/db/postgresql/postgresql.go
|
stolostron/hub-of-hubs-nonk8s-gitops
|
5a0e1a0786b8613c5920daa44d4671050228492c
|
[
"Apache-2.0"
] | 2
|
2022-03-27T20:05:42.000Z
|
2022-03-28T07:26:23.000Z
|
pkg/db/postgresql/postgresql.go
|
stolostron/hub-of-hubs-hub-lifecycle-management
|
5a0e1a0786b8613c5920daa44d4671050228492c
|
[
"Apache-2.0"
] | null | null | null |
package postgresql
import (
"context"
"errors"
"fmt"
"os"
"time"
set "github.com/deckarep/golang-set"
"github.com/go-logr/logr"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/stolostron/hub-of-hubs-nonk8s-gitops/pkg/db"
"github.com/stolostron/hub-of-hubs-nonk8s-gitops/pkg/intervalpolicy"
ctrl "sigs.k8s.io/controller-runtime"
)
const (
envVarDatabaseURL = "DATABASE_URL"
optimisticConcurrencyRetriesCount = 5
retryInterval = 5 * time.Second
)
var (
errEnvVarNotFound = errors.New("not found environment variable")
errDidNotSyncAllEntries = errors.New("failed to sync all entries")
errOptimisticConcurrencyUpdateFailed = errors.New("zero rows were affected by an optimistic concurrency update")
)
// PostgreSQL abstracts PostgreSQL client.
type PostgreSQL struct {
log logr.Logger
conn *pgxpool.Pool
}
// NewPostgreSQL creates a new instance of PostgreSQL object.
func NewPostgreSQL() (*PostgreSQL, error) {
databaseURL, found := os.LookupEnv(envVarDatabaseURL)
if !found {
return nil, fmt.Errorf("%w: %s", errEnvVarNotFound, envVarDatabaseURL)
}
dbConnectionPool, err := pgxpool.Connect(context.Background(), databaseURL)
if err != nil {
return nil, fmt.Errorf("unable to connect to db: %w", err)
}
return &PostgreSQL{
log: ctrl.Log.WithName("git-storage-walker"),
conn: dbConnectionPool,
}, nil
}
// Stop stops PostgreSQL and closes the connection pool.
func (p *PostgreSQL) Stop() {
p.conn.Close()
}
// UpdateLabelForManagedClusters receives a map of hub -> set of managed clusters and updates their labels to be
// appended by the given label
//
// If the operation fails, hubToManagedClustersMap will contain un-synced entries only.
func (p *PostgreSQL) UpdateLabelForManagedClusters(ctx context.Context, tableName string, labelKey string,
labelValue string, hubToManagedClustersMap map[string]set.Set,
) error {
intervalPolicy := intervalpolicy.NewExponentialBackoffPolicy(retryInterval)
retryAttempts := optimisticConcurrencyRetriesCount
// update labels for each managed cluster separately under optimistic concurrency control with exponential backoff
// for retries
for retryAttempts > 0 {
for hubName, managedClustersSet := range hubToManagedClustersMap {
for _, managedClusterName := range managedClustersSet.ToSlice() {
clusterName, ok := managedClusterName.(string)
if !ok {
p.log.Info("bad cast", "cluster", managedClusterName)
continue
}
if err := p.updateLabels(ctx, hubName, clusterName, labelKey, labelValue); err != nil {
p.log.Error(err, "failed to update labels for cluster", "hub", hubName, "cluster", clusterName,
"label", labelKey)
continue
}
// succeeded with update, remove from set
managedClustersSet.Remove(managedClusterName)
// if set is empty then remove leaf hub from entry
if len(managedClustersSet.ToSlice()) == 0 {
delete(hubToManagedClustersMap, hubName)
}
}
}
if len(hubToManagedClustersMap) == 0 {
break // all synced
}
intervalPolicy.Evaluate()
time.Sleep(intervalPolicy.GetInterval())
retryAttempts--
}
if len(hubToManagedClustersMap) != 0 { // some failed
return errDidNotSyncAllEntries
}
return nil
}
// GetAccessibleManagedClusters gets a map of hub -> set { managed-clusters } that are accessible with the given
// filter clause (WHERE ...).
func (p *PostgreSQL) GetAccessibleManagedClusters(ctx context.Context, tableName string,
filterClause string,
) (map[string]set.Set, error) {
hubToManagedClustersMap := map[string]set.Set{}
rows, _ := p.conn.Query(ctx, fmt.Sprintf(`SELECT leaf_hub_name, payload->'metadata'->>'name' FROM status.%s WHERE
TRUE AND %s`, tableName, filterClause))
defer rows.Close()
for rows.Next() {
var (
hubName string
managedClusterName string
)
if err := rows.Scan(&hubName, &managedClusterName); err != nil {
return nil, fmt.Errorf("error reading from table status.%s - %w", tableName, err)
}
clustersSet, found := hubToManagedClustersMap[hubName]
if !found {
clustersSet = set.NewSet()
hubToManagedClustersMap[hubName] = clustersSet
}
clustersSet.Add(managedClusterName)
}
return hubToManagedClustersMap, nil
}
func (p *PostgreSQL) updateLabels(ctx context.Context, hubName string, cluster string, labelKey string,
labelValue string,
) error {
rows, err := p.conn.Query(ctx,
"SELECT labels, deleted_label_keys, version from spec.managed_clusters_labels WHERE leaf_hub_name = $1 AND "+
"managed_cluster_name = $2", hubName, cluster)
if err != nil {
return fmt.Errorf("failed to read from managed_clusters_labels: %w", err)
}
defer rows.Close()
if labelValue == "" {
labelValue = db.ManagedClusterSetDefaultTagValue
}
labelsToAdd := map[string]string{labelKey: labelValue}
if !rows.Next() { // insert the labels
_, err := p.conn.Exec(ctx,
`INSERT INTO spec.managed_clusters_labels (leaf_hub_name, managed_cluster_name, labels, version, updated_at)
values($1, $2, $3::jsonb, 0, now())`,
hubName, cluster, labelsToAdd)
if err != nil {
return fmt.Errorf("failed to insert into the managed_clusters_labels table: %w", err)
}
return nil
}
var (
currentLabelsToAdd map[string]string
currentLabelsToRemoveSlice []string
version int64
)
err = rows.Scan(¤tLabelsToAdd, ¤tLabelsToRemoveSlice, &version)
if err != nil {
return fmt.Errorf("failed to scan a row: %w", err)
}
// every label that is not prefixed by hohGroup should be dropped
labelsToRemove := map[string]struct{}{}
for key, value := range currentLabelsToAdd {
if labelKeyIsAllowed(key) {
labelsToAdd[key] = value // label should be retained
continue
}
labelsToRemove[key] = struct{}{}
}
err = p.putRow(ctx, cluster, labelsToAdd, currentLabelsToAdd, labelsToRemove, p.getMap(currentLabelsToRemoveSlice),
version)
if err != nil {
return fmt.Errorf("failed to update managed_clusters_labels table: %w", err)
}
return nil
}
func (p *PostgreSQL) putRow(ctx context.Context, cluster string, labelsToAdd map[string]string,
currentLabelsToAdd map[string]string, labelsToRemove map[string]struct{}, currentLabelsToRemove map[string]struct{},
version int64,
) error {
newLabelsToAdd := make(map[string]string)
newLabelsToRemove := make(map[string]struct{})
for key := range currentLabelsToRemove {
if _, keyToBeAdded := labelsToAdd[key]; !keyToBeAdded {
newLabelsToRemove[key] = struct{}{}
}
}
for key := range labelsToRemove {
newLabelsToRemove[key] = struct{}{}
}
for key, value := range currentLabelsToAdd {
if _, keyToBeRemoved := labelsToRemove[key]; !keyToBeRemoved {
newLabelsToAdd[key] = value
}
}
for key, value := range labelsToAdd {
newLabelsToAdd[key] = value
}
commandTag, err := p.conn.Exec(ctx,
`UPDATE spec.managed_clusters_labels SET
labels = $1::jsonb,
deleted_label_keys = $2::jsonb,
version = version + 1,
updated_at = now()
WHERE managed_cluster_name=$3 AND version=$4`,
newLabelsToAdd, p.getKeys(newLabelsToRemove), cluster, version)
if err != nil {
return fmt.Errorf("failed to insert a row: %w", err)
}
if commandTag.RowsAffected() == 0 {
return errOptimisticConcurrencyUpdateFailed
}
return nil
}
func (p *PostgreSQL) getMap(aSlice []string) map[string]struct{} {
mapToReturn := make(map[string]struct{}, len(aSlice))
for _, key := range aSlice {
mapToReturn[key] = struct{}{}
}
return mapToReturn
}
// from https://stackoverflow.com/q/21362950
func (p *PostgreSQL) getKeys(aMap map[string]struct{}) []string {
keys := make([]string, len(aMap))
index := 0
for key := range aMap {
keys[index] = key
index++
}
return keys
}
| 28.417582
| 117
| 0.714102
|
cd347031501dbe778d418c3d55ea12cce3e4dd76
| 299
|
sh
|
Shell
|
cypher/scripts/use-sample-data-set.sh
|
yczhang1017/ldbc_snb_bi
|
5b97da8b2596e88bc460d5568fc7b31587695b62
|
[
"Apache-2.0"
] | null | null | null |
cypher/scripts/use-sample-data-set.sh
|
yczhang1017/ldbc_snb_bi
|
5b97da8b2596e88bc460d5568fc7b31587695b62
|
[
"Apache-2.0"
] | null | null | null |
cypher/scripts/use-sample-data-set.sh
|
yczhang1017/ldbc_snb_bi
|
5b97da8b2596e88bc460d5568fc7b31587695b62
|
[
"Apache-2.0"
] | null | null | null |
#!/bin/bash
pushd . > /dev/null
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd ..
export NEO4J_CSV_DIR=`pwd`/social-network-sf0.003-bi-composite-projected-fk-neo4j-compressed/graphs/csv/bi/composite-projected-fk/
export NEO4J_CSV_FLAGS="--compressed"
popd > /dev/null
| 24.916667
| 130
| 0.692308
|