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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
414b16d544051d6fe4fcdc356b5d6bba888c23cc | 641 | h | C | hw/mcu/broadcom/broadcom/interrupts.h | bm16ton/portenta-tinyusb | 472ccb5bd6da5c3cf55210c28df72667c825152a | [
"MIT"
] | 3 | 2021-10-01T15:55:49.000Z | 2021-11-11T14:18:08.000Z | hw/mcu/broadcom/broadcom/interrupts.h | bm16ton/portenta-tinyusb | 472ccb5bd6da5c3cf55210c28df72667c825152a | [
"MIT"
] | null | null | null | hw/mcu/broadcom/broadcom/interrupts.h | bm16ton/portenta-tinyusb | 472ccb5bd6da5c3cf55210c28df72667c825152a | [
"MIT"
] | 2 | 2021-11-22T04:29:37.000Z | 2021-12-01T01:38:53.000Z | #pragma once
#include <stdbool.h>
#include "broadcom/defines.h"
void BP_EnableIRQs(void);
void BP_DisableIRQs(void);
// Minimum priority is the highest priority value. (0 is highest priority)
void BP_SetMinPriority(uint8_t priority);
// We mimic the NVIC used in Cortex M SoCs.
void BP_EnableIRQ(IRQn_Type IRQn);
bool BP_GetEnableIRQ(IRQn_Type IRQn);
void BP_DisableIRQ(IRQn_Type IRQn);
bool BP_GetPendingIRQ(IRQn_Type IRQn);
void BP_SetPendingIRQ(IRQn_Type IRQn);
void BP_ClearPendingIRQ(IRQn_Type IRQn);
bool BP_GetActive(IRQn_Type IRQn);
void BP_SetPriority(IRQn_Type IRQn, uint8_t priority);
uint8_t BP_GetPriority(IRQn_Type IRQn);
| 27.869565 | 74 | 0.806552 |
12e052e5ec70f5ee6aed53ca258bd0515f3e2aa5 | 1,705 | html | HTML | 404.html | oubihis/Viralebom | e175dc9bb545fac1965d5809022f26b4a86509eb | [
"MIT"
] | null | null | null | 404.html | oubihis/Viralebom | e175dc9bb545fac1965d5809022f26b4a86509eb | [
"MIT"
] | null | null | null | 404.html | oubihis/Viralebom | e175dc9bb545fac1965d5809022f26b4a86509eb | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<title>ViraleBom - 404</title>
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/style.css">
<link rel="icon" type="image/x-icon" href="assets/img/logo/favicon.ico" />
</head>
<body>
<div class="app mt-md-5 mt-sm-0">
<div class="layout">
<div class="container">
<div class="row full-height align-items-center">
<div class="col-12 d-flex justify-content-center">
<div class="text-center">
<h1 class="font-size-170 text-secondary font-weight-light text-opacity">404</h1>
<h2 class="font-weight-light font-size-30 ored">Whoops! Looks like you got lost</h2>
<p class="lead">We couldnt find what you were looking for.</p>
<a href="index.html" class="btn btn-gradient-success btn-lg m-t-30">Go Back</a>
</div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="container">
<div class="col-12 align-self-end ">
<div class="text-center pb-20 font-size-13">
<span>Copyright © 2018 <b class="text-dark">Theme_Name</b>. All rights reserved.</span>
</div>
</div>
</div>
</footer>
<script src="js/jquery-3.3.1.slim.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html> | 35.520833 | 113 | 0.493255 |
266159ed48ce8a48fa7a8502411babe790263e10 | 700 | java | Java | src/main/java/org/cvs/data/entities/QualificationType.java | yamiko/cv_service | b33fbecfac2f993880b55131e089fa6cce06ef3c | [
"MIT"
] | null | null | null | src/main/java/org/cvs/data/entities/QualificationType.java | yamiko/cv_service | b33fbecfac2f993880b55131e089fa6cce06ef3c | [
"MIT"
] | null | null | null | src/main/java/org/cvs/data/entities/QualificationType.java | yamiko/cv_service | b33fbecfac2f993880b55131e089fa6cce06ef3c | [
"MIT"
] | null | null | null | package org.cvs.data.entities;
import javax.persistence.Entity;
import javax.validation.constraints.NotBlank;
import lombok.NoArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
*
* Defines structure and relationship(s) for the <code>qualification_type</code>
* table.
*
* @author Yamiko J. Msosa
* @version 1.0
*
*/
@Entity
@Getter
@Setter
@ToString
@NoArgsConstructor
public class QualificationType extends AbstractRetirableEntity {
@NotBlank(message = "Name should not be blank")
private String name;
public QualificationType(String name) {
final int FALSE = 0;
this.name = name;
this.setRetired(FALSE);
this.setVoided(FALSE);
}
}
| 17.948718 | 80 | 0.747143 |
7295a5e5b687923da6ff73af54bc21602ad1fe88 | 2,012 | rs | Rust | src/if_.rs | vitorenesduarte/pluscal-rs | 63bec76c8ca8e335208de939d83236293fec2ed8 | [
"Apache-2.0",
"MIT"
] | 5 | 2020-07-19T15:55:54.000Z | 2021-03-22T20:38:09.000Z | src/if_.rs | vitorenesduarte/pluscal-rs | 63bec76c8ca8e335208de939d83236293fec2ed8 | [
"Apache-2.0",
"MIT"
] | null | null | null | src/if_.rs | vitorenesduarte/pluscal-rs | 63bec76c8ca8e335208de939d83236293fec2ed8 | [
"Apache-2.0",
"MIT"
] | null | null | null | use crate::cond::Cond;
use crate::label::Label;
use crate::{Instruction, ToPlusCal};
#[must_use]
pub struct IfBuilder<'a> {
parent: &'a mut Label,
cond: Cond,
then_label: Option<Label>,
else_label: Option<Label>,
}
impl<'a> IfBuilder<'a> {
pub(crate) fn new(parent: &'a mut Label, cond: Cond) -> Self {
Self {
parent,
cond,
then_label: None,
else_label: None,
}
}
pub fn then<F>(mut self, f: F) -> Self
where
F: Fn(&mut Label),
{
assert!(self.then_label.is_none());
let mut then_label = Label::unnamed();
f(&mut then_label);
self.then_label = Some(then_label);
self
}
pub fn end_if(self) {
let instr = If::new(self.cond, self.then_label, self.else_label);
self.parent
.instructions
.push((crate::label::InstructionType::If, Box::new(instr)));
}
}
#[derive(Debug)]
pub struct If {
cond: Cond,
then_label: Option<Label>,
else_label: Option<Label>,
}
impl If {
fn new(cond: Cond, then_label: Option<Label>, else_label: Option<Label>) -> Self {
Self {
cond,
then_label,
else_label,
}
}
}
impl Instruction for If {}
impl ToPlusCal for If {
fn to_pluscal(&self, indent: usize) -> String {
let mut s = String::new();
s.push_str(&format!("{}if ", Self::space(indent)));
s.push_str(&self.cond.to_pluscal(0));
s.push_str(" then");
s.push(crate::NEW_LINE);
if let Some(label) = &self.then_label {
s.push_str(&label.to_pluscal(indent + crate::TAB_SIZE));
}
if let Some(label) = &self.else_label {
s.push_str(&format!("{}else ", Self::space(indent)));
s.push(crate::NEW_LINE);
s.push_str(&label.to_pluscal(indent + crate::TAB_SIZE));
}
s.push_str(&format!("{}end if;", Self::space(indent)));
s
}
}
| 24.240964 | 86 | 0.542744 |
0ba9d7b223c8e242ba7b53673e8ddcaa9c5e834e | 2,192 | js | JavaScript | gsjson.js | ITarrio/google-spreadsheet-to-json-without-date-format | 0f4a8741ee42063249c0d683a4b667797993c1d8 | [
"Unlicense"
] | 1 | 2021-09-08T14:46:40.000Z | 2021-09-08T14:46:40.000Z | gsjson.js | zaimramlan/google-spreadsheet-to-json | 269163bb20b757f5dbd71eec5df71f6b336cefe0 | [
"Unlicense"
] | null | null | null | gsjson.js | zaimramlan/google-spreadsheet-to-json | 269163bb20b757f5dbd71eec5df71f6b336cefe0 | [
"Unlicense"
] | null | null | null | #!/usr/bin/env node
var fs = require('fs');
var program = require('commander');
var Promise = require('bluebird');
var helper = require('./helper');
var packageData = require('./package.json');
program
.version(packageData.version)
.usage('<spreadsheet-id> [file] [options]')
.option('-b, --beautify', 'Beautify final JSON')
.option('-u, --user <user>', 'User to login')
.option('-p, --password <password>', 'Password to login')
.option('-t, --token <token>', 'Auth token acquired externally')
.option('-y, --tokentype <tokentype>', 'Type of the informed token (defaults to Bearer)')
.option('-w, --worksheet <n>', 'Worksheet index or title (defaults to first worksheet, can be repeated)', handleWorksheetIdentifiers)
.option('-c, --hash <column>', 'Column to hash the final object')
.option('-m, --property-mode <mode>', 'How to handle property names: "camel" (default), "pascal", "nospace" or "none"', /^(camel|pascal|nospace|none)$/i, 'camel')
.option('-i, --vertical', 'Use the first column as header')
.option('-l, --list-only', 'Just list the values in arrays')
.option('-0, --include-header', 'Include header when using "list-only" option')
.parse(process.argv);
if (program.args.length < 1) {
program.help();
}
program.spreadsheetId = program.args[0] || program.spreadsheetId;
var filename = program.args[1];
helper.spreadsheetToJson(program)
.then(function(result) {
return JSON.stringify(result, null, program.beautify ? 4 : null);
})
.then(function(result) {
if (filename) {
return Promise.promisify(fs.writeFile)(filename, result, 'utf-8');
} else {
process.stdout.write(result);
}
})
.catch(function(err) {
throw err;
});
function handlePossibleIntValue(val) {
if (/^\d+$/.test(val))
return parseInt(val, 10);
return val;
}
function handleWorksheetIdentifiers(val, memo) {
var identifier = handlePossibleIntValue(val);
if (typeof memo !== "undefined") {
if (Array.isArray(memo)) {
memo.push(identifier);
return memo;
} else {
return [memo, identifier];
}
}
return identifier;
}
| 30.873239 | 166 | 0.633668 |
c73c8bce8d4d6e4be81952feedc718adc1f9ad07 | 373 | kt | Kotlin | app/src/main/java/com/wavesplatform/wallet/v2/data/model/local/WelcomeItem.kt | isabella232/WavesWallet-android | 5f4106576dc4fe377a355d045f638e7469cd6abe | [
"MIT"
] | 58 | 2017-07-26T16:49:17.000Z | 2021-07-19T03:42:37.000Z | app/src/main/java/com/wavesplatform/wallet/v2/data/model/local/WelcomeItem.kt | wavesplatform/WavesWallet-android | 5f4106576dc4fe377a355d045f638e7469cd6abe | [
"MIT"
] | 22 | 2017-12-24T07:01:17.000Z | 2021-05-26T17:57:14.000Z | app/src/main/java/com/wavesplatform/wallet/v2/data/model/local/WelcomeItem.kt | isabella232/WavesWallet-android | 5f4106576dc4fe377a355d045f638e7469cd6abe | [
"MIT"
] | 53 | 2017-11-14T21:25:23.000Z | 2022-03-07T11:04:07.000Z | /*
* Created by Eduard Zaydel on 1/4/2019
* Copyright © 2019 Waves Platform. All rights reserved.
*/
package com.wavesplatform.wallet.v2.data.model.local
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
data class WelcomeItem(
@DrawableRes val image: Int,
@StringRes val title: Int,
@StringRes val description: Int
) | 24.866667 | 56 | 0.731903 |
50cfcc11245dec844cdad297fc2299cdd0d9e734 | 4,886 | go | Go | resourcewatchers/metadata.go | guangbochen/scheduler | d9a8d0a5b624a47649df52c72e125f29d582f36f | [
"Apache-2.0"
] | 19 | 2016-06-17T06:30:04.000Z | 2020-08-09T21:29:56.000Z | resourcewatchers/metadata.go | guangbochen/scheduler | d9a8d0a5b624a47649df52c72e125f29d582f36f | [
"Apache-2.0"
] | 29 | 2016-10-26T16:48:21.000Z | 2019-01-22T00:10:39.000Z | resourcewatchers/metadata.go | guangbochen/scheduler | d9a8d0a5b624a47649df52c72e125f29d582f36f | [
"Apache-2.0"
] | 29 | 2016-05-27T22:14:59.000Z | 2021-01-23T09:52:14.000Z | package resourcewatchers
import (
"fmt"
"sync"
"github.com/rancher/go-rancher-metadata/metadata"
"github.com/rancher/go-rancher/v2"
"github.com/rancher/log"
"github.com/rancher/scheduler/scheduler"
)
func WatchMetadata(client metadata.Client, updater scheduler.ResourceUpdater, rclient *client.RancherClient) error {
log.Infof("Subscribing to metadata changes.")
watcher := &metadataWatcher{
resourceUpdater: updater,
client: client,
knownHosts: map[string]bool{},
previousIPs: map[string]string{},
rclient: rclient,
}
return client.OnChangeWithError(5, watcher.updateFromMetadata)
}
type metadataWatcher struct {
resourceUpdater scheduler.ResourceUpdater
client metadata.Client
consecutiveErrorCount int
initialized bool
knownHosts map[string]bool
mu sync.Mutex
previousIPs map[string]string
rclient *client.RancherClient
}
const (
instancePool string = "instanceReservation"
memoryPool string = "memoryReservation"
cpuPool string = "cpuReservation"
storageSize string = "storageSize"
totalAvailableInstances int64 = 1000000
hostLabels string = "hostLabels"
ipLabel string = "io.rancher.scheduler.ips"
schedulerUpdate string = "scheduler.update"
)
func (w *metadataWatcher) updateFromMetadata(mdVersion string) {
w.mu.Lock()
defer w.mu.Unlock()
hosts, err := w.client.GetHosts()
if err != nil {
w.checkError(err)
}
var usedResourcesByHost map[string]map[string]int64
if !w.initialized {
usedResourcesByHost, err = scheduler.GetUsedResourcesByHost(w.client)
if err != nil {
log.Errorf("Cannot get used resources for hosts. Error: %v", err)
panic(err)
}
}
newKnownHosts := map[string]bool{}
shouldSend := false
dif := w.resourceUpdater.CompareHostLabels(hosts)
if dif {
shouldSend = true
}
for _, h := range hosts {
newKnownHosts[h.UUID] = true
delete(w.knownHosts, h.UUID)
poolInits := map[string]int64{
instancePool: totalAvailableInstances,
cpuPool: h.MilliCPU,
memoryPool: h.Memory,
storageSize: h.LocalStorageMb,
}
for resourceKey, total := range poolInits {
// Update totals available, not amount used
poolDoesntExist := !w.resourceUpdater.UpdateResourcePool(h.UUID, &scheduler.ComputeResourcePool{
Resource: resourceKey,
Total: total,
})
if poolDoesntExist {
if usedResourcesByHost == nil {
usedResourcesByHost, err = scheduler.GetUsedResourcesByHost(w.client)
if err != nil {
log.Errorf("Cannot get used resources for hosts. Error: %v", err)
panic(err)
}
}
usedResource := usedResourcesByHost[h.UUID][resourceKey]
if err := w.resourceUpdater.CreateResourcePool(h.UUID, &scheduler.ComputeResourcePool{Resource: resourceKey, Total: total, Used: usedResource}); err != nil {
log.Errorf("Received an error creating resource pool. This shouldn't have happened. Error: %v.", err)
panic(err)
}
}
}
// port pool update logic
portPool, err := scheduler.GetPortPoolFromHost(h, w.client)
if err != nil {
w.checkError(err)
}
if portPool != nil {
poolDoesntExist := !w.resourceUpdater.UpdateResourcePool(h.UUID, portPool)
if poolDoesntExist {
w.resourceUpdater.CreateResourcePool(h.UUID, portPool)
} else if w.previousIPs[h.UUID] != h.Labels[ipLabel] {
portPool.ShouldUpdate = true
w.resourceUpdater.UpdateResourcePool(h.UUID, portPool)
}
w.previousIPs[h.UUID] = h.Labels[ipLabel]
}
// updating label pool
labelPool := &scheduler.LabelPool{
Resource: hostLabels,
Labels: h.Labels,
}
poolDoesntExist := !w.resourceUpdater.UpdateResourcePool(h.UUID, labelPool)
if poolDoesntExist {
w.resourceUpdater.CreateResourcePool(h.UUID, labelPool)
}
}
for uuid := range w.knownHosts {
w.resourceUpdater.RemoveHost(uuid)
}
// call reconcile hook after updating scheduler pool
if shouldSend {
err = sendExternalEvent(w.rclient)
if err != nil {
log.Warnf("Error in sending external host event. err: %+v", err)
}
}
w.knownHosts = newKnownHosts
w.initialized = true
}
func (w *metadataWatcher) checkError(err error) {
w.consecutiveErrorCount++
if w.consecutiveErrorCount > 5 {
panic(fmt.Sprintf("%v consecutive errors attempting to reach metadata. Panicing. Error: %v", w.consecutiveErrorCount, err))
}
log.Errorf("Error %v getting metadata: %v", w.consecutiveErrorCount, err)
}
func sendExternalEvent(rclient *client.RancherClient) error {
if rclient == nil {
return nil
}
externalHostEvent := &client.ExternalHostEvent{
EventType: schedulerUpdate,
}
if _, err := rclient.ExternalHostEvent.Create(externalHostEvent); err != nil {
return err
}
return nil
}
type poolInitializer struct {
total int64
}
| 28.08046 | 161 | 0.695661 |
5be7a3338b8f479adf12f25c57e9cabcbfcb59b4 | 2,704 | h | C | app/socket.h | gary109/udt4-appclient | 912f2402a77bdc6fa4107e3642bb27b2b7208e46 | [
"BSD-3-Clause"
] | null | null | null | app/socket.h | gary109/udt4-appclient | 912f2402a77bdc6fa4107e3642bb27b2b7208e46 | [
"BSD-3-Clause"
] | null | null | null | app/socket.h | gary109/udt4-appclient | 912f2402a77bdc6fa4107e3642bb27b2b7208e46 | [
"BSD-3-Clause"
] | null | null | null | /*
* Project: udptunnel
* File: socket.h
*
* Copyright (C) 2009 Daniel Meekins
* Contact: dmeekins - gmail
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOCKET_H
#define SOCKET_H
#ifndef WIN32
#include <inttypes.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#endif /*WIN32*/
#include <string.h>
#include "p2pcommon.h"
#define BACKLOG 10
#define ADDRSTRLEN (INET6_ADDRSTRLEN + 9)
#define SOCK_TYPE_TCP 1
#define SOCK_TYPE_UDP 2
#define SOCK_IPV4 3
#define SOCK_IPV6 4
#define SIN(sa) ((struct sockaddr_in *)sa)
#define SIN6(sa) ((struct sockaddr_in6 *)sa)
#define PADDR(a) ((struct sockaddr *)a)
typedef struct socket {
int fd; /* Socket file descriptor to send/recv on */
int type; /* SOCK_STREAM or SOCK_DGRAM */
struct sockaddr_storage addr; /* IP and port */
socklen_t addr_len; /* Length of sockaddr type */
} socket_t;
#define SOCK_FD(s) ((s)->fd)
#define SOCK_LEN(s) ((s)->addr_len)
#define SOCK_PADDR(s) ((struct sockaddr *)&(s)->addr)
#define SOCK_TYPE(s) ((s)->type)
socket_t *sock_create(char *host, char *port, int ipver, int sock_type,
int is_serv, int conn);
socket_t *sock_copy(socket_t *sock);
int sock_connect(socket_t *sock, int is_serv);
socket_t *sock_accept(socket_t *serv);
void sock_close(socket_t *s);
void sock_free(socket_t *s);
int sock_addr_equal(socket_t *s1, socket_t *s2);
int sock_ipaddr_cmp(socket_t *s1, socket_t *s2);
int sock_port_cmp(socket_t *s1, socket_t *s2);
int sock_isaddrany(socket_t *s);
char *sock_get_str(socket_t *s, char *buf, int len);
char *sock_get_addrstr(socket_t *s, char *buf, int len);
uint16_t sock_get_port(socket_t *s);
int sock_recv(socket_t *sock, socket_t *from, char *data, int len);
int sock_send(socket_t *to, char *data, int len);
int isipaddr(char *ip, int ipver);
static int _inline_ sock_get_ipver(socket_t *s)
{
return (s->addr.ss_family == AF_INET) ? SOCK_IPV4 :
((s->addr.ss_family == AF_INET6) ? SOCK_IPV6 : 0);
}
#endif /* SOCKET_H */
| 31.44186 | 78 | 0.699704 |
c96ad45290e23e5be4b3956c300012b812b63faf | 232 | kt | Kotlin | presentation/src/main/java/com/cheise_proj/presentation/model/people/People.kt | Bik-Krlvn/Nagies-Edu-Center | ce52e33fdf764530f84595042f3d23f3e5daaeb8 | [
"BSD-3-Clause"
] | 2 | 2020-03-17T14:22:19.000Z | 2020-06-29T02:04:41.000Z | presentation/src/main/java/com/cheise_proj/presentation/model/people/People.kt | Bik-Krlvn/Nagies-Edu-Center | ce52e33fdf764530f84595042f3d23f3e5daaeb8 | [
"BSD-3-Clause"
] | 1 | 2020-05-13T02:30:05.000Z | 2020-06-28T21:38:09.000Z | presentation/src/main/java/com/cheise_proj/presentation/model/people/People.kt | Bik-Krlvn/Nagies-Edu-Center | ce52e33fdf764530f84595042f3d23f3e5daaeb8 | [
"BSD-3-Clause"
] | 1 | 2020-03-25T02:40:09.000Z | 2020-03-25T02:40:09.000Z | package com.cheise_proj.presentation.model.people
data class People(
val id: Int,
val refNo: String,
val name: String,
val photo: String?,
val username: String,
val gender: String,
val contact: String?
) | 21.090909 | 49 | 0.672414 |
5c3da07e3337505f4ce494c39a48da02f6779229 | 98 | css | CSS | public/themes/foxes/styles/dropdown.css | acronamydesign/foxie | 9712aada8a5e934e84fbba59f254228a3c06a116 | [
"0BSD"
] | null | null | null | public/themes/foxes/styles/dropdown.css | acronamydesign/foxie | 9712aada8a5e934e84fbba59f254228a3c06a116 | [
"0BSD"
] | null | null | null | public/themes/foxes/styles/dropdown.css | acronamydesign/foxie | 9712aada8a5e934e84fbba59f254228a3c06a116 | [
"0BSD"
] | null | null | null | .navbar-default .navbar-nav>.open>a{background-color:#f7f7f7}.dropdown-menu>li>a{padding:9px 20px} | 98 | 98 | 0.785714 |
5a578a1bf85c5b657c460639c35ef9f335740b1b | 1,948 | swift | Swift | Sources/PerlCore/PerlScalarValue.swift | freyaariel/perl-core | 0777f2f5a9658e1b87c8db2ef1c87556918006d5 | [
"MIT"
] | null | null | null | Sources/PerlCore/PerlScalarValue.swift | freyaariel/perl-core | 0777f2f5a9658e1b87c8db2ef1c87556918006d5 | [
"MIT"
] | null | null | null | Sources/PerlCore/PerlScalarValue.swift | freyaariel/perl-core | 0777f2f5a9658e1b87c8db2ef1c87556918006d5 | [
"MIT"
] | null | null | null | import CPerlCore
/// A Perl scalar value.
///
/// You use the `PerlScalarValue` class to convert basic values, such as numbers and strings, between Perl and Swift representations to pass data between native code and Perl code.
@available(macOS 10.10, iOS 9, tvOS 9, watchOS 7, *)
public class PerlScalarValue: CustomStringConvertible {
let sv: UnsafeMutableRawPointer
init (_ sv: UnsafeMutableRawPointer) { self.sv = sv }
/// Whether the value is defined.
public var isDefined: Bool { perlcore_svok(sv) != 0 }
/// Undefines the value.
public func undefine() { perlcore_undef(sv) }
/// Converts the Perl value to a Boolean value.
public var asBool: Bool {
get { perlcore_svtrue(sv) != 0 }
set { perlcore_setiv(sv, newValue ? 1 : 0 ) }
}
/// Converts the Perl value to an unsigned integer value.
public var asUInt: UInt {
get { perlcore_svuv(sv) }
set { perlcore_setuv(sv, newValue) }
}
/// Converts the Perl value to an integer value.
public var asInt: Int {
get { perlcore_sviv(sv) }
set { perlcore_setiv(sv, newValue) }
}
/// Converts the Perl value to a floating-point value.
public var asDouble: Double {
get { perlcore_svnv(sv) }
set { perlcore_setnv(sv, newValue) }
}
/// Converts the Perl value to a string.
public var asString: String {
get { String(cString: perlcore_svpv(sv)) }
set { newValue.withCString { perlcore_setpv(self.sv, $0) } }
}
public var description: String { asString }
// MARK: - References
public var refType: String {
String(validatingUTF8: perlcore_reftype(sv))!
}
public func derefScalar() -> PerlScalarValue? {
refType == "SCALAR" ? PerlScalarValue(perlcore_deref(sv)) : nil
}
public func derefArray() -> PerlArrayValue? {
refType == "ARRAY" ? PerlArrayValue(perlcore_deref(sv)) : nil
}
public func derefHash() -> PerlHashValue? {
refType == "HASH" ? PerlHashValue(perlcore_deref(sv)) : nil
}
}
| 33.586207 | 180 | 0.681725 |
16ddc19c79f3737b6d4e4ae59629a94bbe87c296 | 457 | ts | TypeScript | api/plugin/Plugin.ts | joaomede/Auto-Deploy-Docker | 8bca0c77ea80056d3f6b86fe6302df34f2115c25 | [
"MIT"
] | 2 | 2020-02-20T13:21:56.000Z | 2020-02-20T13:23:24.000Z | api/plugin/Plugin.ts | joaomede/Auto-Deploy-Docker | 8bca0c77ea80056d3f6b86fe6302df34f2115c25 | [
"MIT"
] | null | null | null | api/plugin/Plugin.ts | joaomede/Auto-Deploy-Docker | 8bca0c77ea80056d3f6b86fe6302df34f2115c25 | [
"MIT"
] | null | null | null | import * as jwt from 'jsonwebtoken'
import * as dotenv from 'dotenv'
dotenv.config()
const secret = process.env.SECRET
class Plugin {
/**
*
* @param params Retorna o token decodificado com validade
* @param validade Validade do token, ex: 7d
*/
public async generateToken (params: string | object, validade: string): Promise<string> {
return jwt.sign(params, secret, {
expiresIn: validade
})
}
}
export default new Plugin()
| 24.052632 | 91 | 0.684902 |
e9235cdd91eff26b60f282545a745b9c849936aa | 1,082 | rake | Ruby | lib/tasks/bookmarklet.rake | BrettBukowski/CatchLater | f40f0d85b8ebe185eb1948f5ed31cf0bed67b7e8 | [
"MIT"
] | null | null | null | lib/tasks/bookmarklet.rake | BrettBukowski/CatchLater | f40f0d85b8ebe185eb1948f5ed31cf0bed67b7e8 | [
"MIT"
] | null | null | null | lib/tasks/bookmarklet.rake | BrettBukowski/CatchLater | f40f0d85b8ebe185eb1948f5ed31cf0bed67b7e8 | [
"MIT"
] | null | null | null | namespace :assets do
desc 'Include SnackJS within the bookmarklet module, minify, write to app.min.js'
task :bookmarklet do
require 'erb'
require 'uglifier'
env = ENV['RAILS_ENV'] || 'development'
javascript_path = File.expand_path('app/assets/javascripts') + '/'
write_to = (env == 'development') ? javascript_path : (File.expand_path('public/assets') + '/')
# Minify the bookmarklet loader
IO.write(javascript_path + 'bookmarklet.min.js',
Uglifier.compile(IO.read(javascript_path + 'bookmarklet.js'))
)
# Compile & minify the bookmarklet app
app = ERB.new(IO.read(javascript_path + 'app.js.erb'))
# Insert Snack into the bookmarklet app's source
snack = IO.read(File.expand_path('vendor/assets/javascripts/externals/snack/builds/snack-qwery.js'))
app = app.result(binding)
# Minify and write out the whole thing
IO.write(write_to + 'app.min.js', Uglifier.compile(app))
if env == 'development'
IO.write(javascript_path + 'app.debug.js', app.gsub(/catchlater\.com/, '127.0.0.1'))
end
end
end | 37.310345 | 104 | 0.68207 |
0b7d1c464ba5f7b2f25f469546bc0725ef4ae2f0 | 25,033 | py | Python | snlds/model_cavi_snlds.py | egonrian/google-research | 8177adbe9ca0d7e5a9463b54581fe6dd27be0974 | [
"Apache-2.0"
] | 3 | 2021-01-18T04:46:49.000Z | 2021-03-05T09:21:40.000Z | snlds/model_cavi_snlds.py | Alfaxad/google-research | 2c0043ecd507e75e2df9973a3015daf9253e1467 | [
"Apache-2.0"
] | 25 | 2020-07-25T08:53:09.000Z | 2022-03-12T00:43:02.000Z | snlds/model_cavi_snlds.py | Alfaxad/google-research | 2c0043ecd507e75e2df9973a3015daf9253e1467 | [
"Apache-2.0"
] | 4 | 2021-02-08T10:25:45.000Z | 2021-04-17T14:46:26.000Z | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# 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.
"""Collapsed Amortized Variational Inference for SNLDS.
This is a reasonable baseline model for switching non-linear dynamical system
with the following architecture:
1. an inference network, with Bidirectional-RNN for input embedding, and a
forward RNN to get the posterior distribution of `q(z[1:T] | x[1:T])`.
2. a continuous state transition network, `p(z[t] | z[t-1], s[t])`.
3. a discrete state transition network that conditioned on the input,
`p(s[t] | s[t-1], x[t-1])`.
4. an emission network conditioned on the continuous hidden dynamics,
`p(x[t] | z[t])`.
It also contains a function, `create_model()`, to help to create the SNLDS
model discribed in ``Collapsed Amortized Variational Inference for Switching
Nonlinear Dynamical Systems``. 2019. https://arxiv.org/abs/1910.09588.
All the networks are configurable through function arguments `network_*`.
"""
import collections
import tensorflow as tf
import tensorflow_probability as tfp
from snlds import model_base
from snlds import utils
namedtuple = collections.namedtuple
layers = tf.keras.layers
tfd = tfp.distributions
tfpl = tfp.layers
RANDOM_SEED = 131
def construct_initial_state_distribution(
latent_dim,
num_categ,
use_trainable_cov=False,
use_triangular_cov=False,
raw_sigma_bias=0.0,
sigma_min=1e-5,
sigma_scale=0.05,
dtype=tf.float32,
name="z0"):
"""Construct the initial state distribution, `p(z[0])`.
Args:
latent_dim: an `int` scalar for dimension of continuous hidden states, `z`.
num_categ: an `int` scalar for number of discrete states, `s`.
use_trainable_cov: a `bool` scalar indicating whether the scale of `p(z[0])`
is trainable. Default to False.
use_triangular_cov: a `bool` scalar indicating whether to use triangular
covariance matrices and `tfp.distributions.MultivariateNormalTriL` for
distribution. Otherwise, a diagonal covariance matrices and
`tfp.distributions.MultivariateNormalDiag` will be used.
raw_sigma_bias: a `float` scalar to be added to the raw sigma, which is
standard deviation of the distribution. Default to `0.`.
sigma_min: a `float` scalar for minimal level of sigma to prevent
underflow. Default to `1e-5`.
sigma_scale: a `float` scalar for scaling the sigma. Default to `0.05`.
The above three arguments are used as
`sigma_scale * max(softmax(raw_sigma + raw_sigma_bias), sigma_min))`.
dtype: data type for variables within the scope. Default to `tf.float32`.
name: a `str` to construct names of variables.
Returns:
return_dist: a `tfp.distributions` instance for the initial state
distribution, `p(z[0])`.
"""
glorot_initializer = tf.keras.initializers.GlorotUniform()
z0_mean = tf.Variable(
initial_value=glorot_initializer(shape=[num_categ, latent_dim],
dtype=dtype),
name="{}_mean".format(name))
if use_triangular_cov:
z0_scale = tfp.math.fill_triangular(
tf.Variable(
initial_value=glorot_initializer(
shape=[int(latent_dim * (latent_dim + 1) / 2)],
dtype=dtype),
name="{}_scale".format(name),
trainable=use_trainable_cov))
z0_scale = (tf.maximum(tf.nn.softmax(z0_scale + raw_sigma_bias),
sigma_min)
* sigma_scale)
return_dist = tfd.Independent(
distribution=tfd.MultivariateNormalTriL(
loc=z0_mean, scale_tril=z0_scale),
reinterpreted_batch_ndims=0)
else:
z0_scale = tf.Variable(
initial_value=glorot_initializer(
shape=[latent_dim],
dtype=dtype),
name="{}_scale".format(name),
trainable=use_trainable_cov)
z0_scale = (tf.maximum(tf.nn.softmax(z0_scale + raw_sigma_bias),
sigma_min)
* sigma_scale)
return_dist = tfd.Independent(
distribution=tfd.MultivariateNormalDiag(
loc=z0_mean, scale_diag=z0_scale),
reinterpreted_batch_ndims=0)
return tfp.experimental.as_composite(return_dist)
class ContinuousStateTransition(tf.keras.Model):
"""Transition for `p(z[t] | z[t-1], s[t])`."""
def __init__(self,
transition_mean_networks,
distribution_dim,
num_categories=1,
cov_mat=None,
use_triangular_cov=False,
use_trainable_cov=True,
raw_sigma_bias=0.0,
sigma_min=1e-5,
sigma_scale=0.05,
dtype=tf.float32,
name="ContinuousStateTransition"):
"""Construct a `ContinuousStateTransition` instance.
Args:
transition_mean_networks: a list of `callable` networks, with the length
of list same as `num_categories`. Each one of the networks will take
previous step hidden state, `z[t-1]`, and returns the mean of
transition distribution, `p(z[t] | z[t-1], s[t]=i)` for each
discrete state `i`.
distribution_dim: an `int` scalar for dimension of continuous hidden
states, `z`.
num_categories: an `int` scalar for number of discrete states, `s`.
cov_mat: an optional `float` Tensor for predefined covariance matrix.
Default to `None`, in which case, a `cov` variable will be created.
use_triangular_cov: a `bool` scalar indicating whether to use triangular
covariance matrices and `tfp.distributions.MultivariateNormalTriL` for
distribution. Otherwise, a diagonal covariance matrices and
`tfp.distributions.MultivariateNormalDiag` will be used.
use_trainable_cov: a `bool` scalar indicating whether the scale of
the distribution is trainable. Default to False.
raw_sigma_bias: a `float` scalar to be added to the raw sigma, which is
standard deviation of the distribution. Default to `0.`.
sigma_min: a `float` scalar for minimal level of sigma to prevent
underflow. Default to `1e-5`.
sigma_scale: a `float` scalar for scaling the sigma. Default to `0.05`.
The above three arguments are used as
`sigma_scale * max(softmax(raw_sigma + raw_sigma_bias), sigma_min))`.
dtype: data type for variables within the scope. Default to `tf.float32`.
name: a `str` to construct names of variables.
"""
super(ContinuousStateTransition, self).__init__()
assertion_str = (
"There has to be one transition mean networks for each discrete state")
assert len(transition_mean_networks) == num_categories, assertion_str
self.z_trans_networks = transition_mean_networks
self.num_categ = num_categories
self.use_triangular_cov = use_triangular_cov
self.distribution_dim = distribution_dim
if cov_mat:
self.cov_mat = cov_mat
elif self.use_triangular_cov:
self.cov_mat = tfp.math.fill_triangular(
tf.Variable(
tf.random.uniform(
shape=[
int(self.distribution_dim
* (self.distribution_dim + 1) / 2)],
minval=0., maxval=1.,
dtype=dtype),
name="{}_cov".format(name),
dtype=dtype,
trainable=use_trainable_cov))
self.cov_mat = tf.maximum(tf.nn.softmax(self.cov_mat + raw_sigma_bias),
sigma_min) * sigma_scale
else:
self.cov_mat = tf.Variable(
tf.random.uniform(shape=[self.distribution_dim],
minval=0.0, maxval=1.,
dtype=dtype),
name="{}_cov".format(name),
dtype=dtype,
trainable=use_trainable_cov)
self.cov_mat = tf.maximum(tf.nn.softmax(self.cov_mat + raw_sigma_bias),
sigma_min) * sigma_scale
def call(self, input_tensor, dtype=tf.float32):
input_tensor = tf.convert_to_tensor(input_tensor, dtype_hint=dtype)
batch_size, num_steps, distribution_dim = tf.unstack(tf.shape(input_tensor))
# The shape of the mean_tensor after tf.stack is [num_categ, batch_size,
# num_steps, distribution_dim].,
mean_tensor = tf.transpose(
tf.stack([
z_net(input_tensor) for z_net in self.z_trans_networks]),
[1, 2, 0, 3])
mean_tensor = tf.reshape(mean_tensor,
[batch_size, num_steps,
self.num_categ, distribution_dim])
if self.use_triangular_cov:
output_dist = tfd.MultivariateNormalTriL(
loc=mean_tensor,
scale_tril=self.cov_mat)
else:
output_dist = tfd.MultivariateNormalDiag(
loc=mean_tensor,
scale_diag=self.cov_mat)
return tfp.experimental.as_composite(output_dist)
@property
def output_event_dims(self):
return self.distribution_dim
class DiscreteStateTransition(tf.keras.Model):
"""Discrete state transition p(s[t] | s[t-1], x[t-1])."""
def __init__(self,
transition_network,
num_categories):
"""Construct a `DiscreteStateTransition` instance.
Args:
transition_network: a `callable` network taking batch conditional inputs,
`x[t-1]`, and returning the discrete state transition matrices,
`log p(s[t] |s[t-1], x[t-1])`.
num_categories: an `int` scalar for number of discrete states, `s`.
"""
super(DiscreteStateTransition, self).__init__()
self.dense_net = transition_network
self.num_categ = num_categories
def call(self, input_tensor, dtype=tf.float32):
input_tensor = tf.convert_to_tensor(input_tensor, dtype_hint=dtype)
batch_size, num_steps = tf.unstack(tf.shape(input_tensor)[:2])
transition_tensor = self.dense_net(input_tensor)
transition_tensor = tf.reshape(
transition_tensor,
[batch_size, num_steps, self.num_categ, self.num_categ])
return transition_tensor
@property
def output_event_dims(self):
return self.num_categ
class GaussianDistributionFromMean(tf.keras.Model):
"""Emission model p(x[t] | z[t])."""
def __init__(self,
emission_mean_network,
observation_dim,
cov_mat=None,
use_triangular_cov=False,
use_trainable_cov=True,
raw_sigma_bias=0.0,
sigma_min=1e-5,
sigma_scale=0.05,
dtype=tf.float32,
name="GaussianDistributionFromMean"):
"""Construct a `GaussianDistributionFromMean` instance.
Args:
emission_mean_network: a `callable` network taking continuous hidden
states, `z[t]`, and returning the mean of emission distribution,
`p(x[t] | z[t])`.
observation_dim: an `int` scalar for dimension of observations, `x`.
cov_mat: an optional `float` Tensor for predefined covariance matrix.
Default to `None`, in which case, a `cov` variable will be created.
use_triangular_cov: a `bool` scalar indicating whether to use triangular
covariance matrices and `tfp.distributions.MultivariateNormalTriL` for
distribution. Otherwise, a diagonal covariance matrices and
`tfp.distributions.MultivariateNormalDiag` will be used.
use_trainable_cov: a `bool` scalar indicating whether the scale of
the distribution is trainable. Default to False.
raw_sigma_bias: a `float` scalar to be added to the raw sigma, which is
standard deviation of the distribution. Default to `0.`.
sigma_min: a `float` scalar for minimal level of sigma to prevent
underflow. Default to `1e-5`.
sigma_scale: a `float` scalar for scaling the sigma. Default to `0.05`.
The above three arguments are used as
`sigma_scale * max(softmax(raw_sigma + raw_sigma_bias), sigma_min))`.
dtype: data type for variables within the scope. Default to `tf.float32`.
name: a `str` to construct names of variables.
"""
super(GaussianDistributionFromMean, self).__init__()
self.observation_dim = observation_dim
self.x_emission_net = emission_mean_network
self.use_triangular_cov = use_triangular_cov
if cov_mat:
self.cov_mat = cov_mat
elif self.use_triangular_cov:
local_variable = tf.Variable(
tf.random.uniform(
shape=[int(self.observation_dim*(self.observation_dim+1)/2)],
minval=0., maxval=1.,
dtype=dtype),
name="{}_cov".format(name),
dtype=dtype,
trainable=use_trainable_cov)
self.cov_mat = tfp.math.fill_triangular(
local_variable)
self.cov_mat = tf.maximum(tf.nn.softmax(self.cov_mat + raw_sigma_bias),
sigma_min) * sigma_scale
else:
self.cov_mat = tf.Variable(
initial_value=tf.random.uniform(shape=[self.observation_dim],
minval=0.0, maxval=1.,
dtype=dtype),
name="{}_cov".format(name),
dtype=dtype,
trainable=use_trainable_cov)
self.cov_mat = tf.maximum(tf.nn.softmax(self.cov_mat + raw_sigma_bias),
sigma_min) * sigma_scale
def call(self, input_tensor, dtype=tf.float32):
input_tensor = tf.convert_to_tensor(input_tensor, dtype_hint=dtype)
mean_tensor = self.x_emission_net(input_tensor)
if self.use_triangular_cov:
output_dist = tfd.MultivariateNormalTriL(
loc=mean_tensor,
scale_tril=self.cov_mat)
else:
output_dist = tfd.MultivariateNormalDiag(
loc=mean_tensor,
scale_diag=self.cov_mat)
return tfp.experimental.as_composite(output_dist)
@property
def output_event_dims(self):
return self.observation_dim
class RnnInferenceNetwork(tf.keras.Model):
"""Inference network for posterior q(z[1:T] | x[1:T])."""
def __init__(self,
posterior_rnn,
posterior_dist,
latent_dim,
embedding_network=None):
"""Construct a `RnnInferenceNetwork` instance.
Args:
posterior_rnn: a RNN cell, `h[t]=f_RNN(h[t-1], z[t-1], input[t])`,
which recursively takes previous step RNN states `h`, previous step
sampled dynamical state `z[t-1]`, and conditioned input `input[t]`.
posterior_dist: a distribution instance for `p(z[t] | h[t])`,
where h[t] is the output of `posterior_rnn`.
latent_dim: an `int` scalar for dimension of continuous hidden
states, `z`.
embedding_network: an optional network to embed the observations, `x[t]`.
Default to `None`, in which case, no embedding is applied.
"""
super(RnnInferenceNetwork, self).__init__()
self.latent_dim = latent_dim
self.posterior_rnn = posterior_rnn
self.posterior_dist = posterior_dist
if embedding_network is None:
self.embedding_network = lambda x: x
self.embedding_network = embedding_network
def call(self,
inputs,
num_samples=1,
dtype=tf.float32,
random_seed=RANDOM_SEED,
parallel_iterations=10):
"""Recursively sample z[t] ~ q(z[t]|h[t]=f_RNN(h[t-1], z[t-1], h[t]^b)).
Args:
inputs: a float `Tensor` of size [batch_size, num_steps, obs_dim], where
each observation should be flattened.
num_samples: an `int` scalar for number of samples per time-step, for
posterior inference networks, `z[i] ~ q(z[1:T] | x[1:T])`.
dtype: The data type of input data.
random_seed: an `Int` as the seed for random number generator.
parallel_iterations: a positive `Int` indicates the number of iterations
allowed to run in parallel in `tf.while_loop`, where `tf.while_loop`
defaults it to be 10.
Returns:
sampled_z: a float 3-D `Tensor` of size [num_samples, batch_size,
num_steps, latent_dim], which stores the z_t sampled from posterior.
entropies: a float 2-D `Tensor` of size [num_samples, batch_size,
num_steps], which stores the entropies of posterior distributions.
log_probs: a float 2-D `Tensor` of size [num_samples. batch_size,
num_steps], which stores the log posterior probabilities.
"""
inputs = tf.convert_to_tensor(inputs, dtype_hint=dtype)
batch_size, num_steps = tf.unstack(tf.shape(inputs)[:2])
latent_dim = self.latent_dim
## passing through embedding_network, e.g. bidirectional RNN
inputs = self.embedding_network(inputs)
## passing through forward RNN
ta_names = ["rnn_states", "latent_states", "entropies", "log_probs"]
tas = [tf.TensorArray(tf.float32, num_steps, name=n) for n in ta_names]
t0 = tf.constant(0, tf.int32)
loopstate = namedtuple("LoopState", "rnn_state latent_encoded")
initial_rnn_state = self.posterior_rnn.get_initial_state(
batch_size=batch_size * num_samples,
dtype=dtype)
if (isinstance(self.posterior_rnn, layers.GRUCell)
or isinstance(self.posterior_rnn, layers.SimpleRNNCell)):
initial_rnn_state = [initial_rnn_state]
init_state = (t0,
loopstate(
rnn_state=initial_rnn_state,
latent_encoded=tf.zeros(
[batch_size * num_samples, latent_dim],
dtype=tf.float32)), tas)
def _cond(t, *unused_args):
return t < num_steps
def _step(t, loop_state, tas):
"""One step in tf.while_loop."""
prev_latent_state = loop_state.latent_encoded
prev_rnn_state = loop_state.rnn_state
current_input = inputs[:, t, :]
# Duplicate current observation to sample multiple trajectories.
current_input = tf.tile(current_input, [num_samples, 1])
rnn_input = tf.concat([current_input, prev_latent_state],
axis=-1) # num_samples * BS, latent_dim+input_dim
rnn_out, rnn_state = self.posterior_rnn(
inputs=rnn_input,
states=prev_rnn_state)
dist = self.posterior_dist(rnn_out)
latent_state = dist.sample(seed=random_seed)
## rnn_state is a list of [batch_size, rnn_hidden_dim],
## after TA.stack(), the dimension will be
## [num_steps, 1 for GRU/2 for LSTM, batch, rnn_dim]
tas_updates = [rnn_state,
latent_state,
dist.entropy(),
dist.log_prob(latent_state)]
tas = utils.write_updates_to_tas(tas, t, tas_updates)
return (t+1,
loopstate(rnn_state=rnn_state,
latent_encoded=latent_state),
tas)
## end of _step function
_, _, tas_final = tf.while_loop(
_cond, _step, init_state, parallel_iterations=parallel_iterations)
sampled_z, entropies, log_probs = [
utils.tensor_for_ta(ta, swap_batch_time=True) for ta in tas_final[1:]
]
sampled_z = tf.reshape(sampled_z,
[num_samples, batch_size, num_steps, latent_dim])
entropies = tf.reshape(entropies, [num_samples, batch_size, num_steps])
log_probs = tf.reshape(log_probs, [num_samples, batch_size, num_steps])
return sampled_z, entropies, log_probs
def create_model(num_categ,
hidden_dim,
observation_dim,
config_emission,
config_inference,
config_z_initial,
config_z_transition,
network_emission,
network_input_embedding,
network_posterior_rnn,
network_s_transition,
networks_z_transition,
network_posterior_mlp=lambda x: x,
name="snlds"):
"""Construct SNLDS model.
Args:
num_categ: an `int` scalar for number of discrete states, `s`.
hidden_dim: an `int` scalar for dimension of continuous hidden states, `z`.
observation_dim: an `int` scalar for dimension of observations, `x`.
config_emission: a `dict` for configuring emission distribution,
`p(x[t] | z[t])`.
config_inference: a `dict` for configuring the posterior distribution,
`q(z[t]|h[t]=f_RNN(h[t-1], z[t-1], h[t]^b))`.
config_z_initial: a `dict` for configuring the initial distribution of
continuous hidden state, `p(z[0])`.
config_z_transition: a `dict` for configuring the transition distribution
`p(z[t] | z[t-1], s[t])`.
network_emission: a `callable` network taking continuous hidden
states, `z[t]`, and returning the mean of emission distribution,
`p(x[t] | z[t])`.
network_input_embedding: a `callable` network to embed the observations,
`x[t]`. E.g. a bidirectional RNN to embedding `x[1:T]`.
network_posterior_rnn: a RNN cell, `h[t]=f_RNN(h[t-1], z[t-1], input[t])`,
which recursively takes previous step RNN states `h`, previous step
sampled dynamical state `z[t-1]`, and conditioned input `input[t]`.
network_s_transition: a `callable` network taking batch conditional inputs,
`x[t-1]`, and returning the discrete state transition matrices,
`log p(s[t] |s[t-1], x[t-1])`.
networks_z_transition: a list of `callable` networks, with the length
of list same as `num_categories`. Each one of the networks will take
previous step hidden state, `z[t-1]`, and returns the mean of
transition distribution, `p(z[t] | z[t-1], s[t]=i)` for each
discrete state `i`.
network_posterior_mlp: an optional network to embedding the output of
inference RNN networks, before passing into the distribution as mean,
`q(z[t] | mlp( h[t] ))`. Default to identity mapping.
name: a `str` to construct names of variables.
Returns:
An instance of instantiated `model_base.SwitchingNLDS` model.
"""
z_transition = ContinuousStateTransition(
transition_mean_networks=networks_z_transition,
distribution_dim=hidden_dim,
num_categories=num_categ,
cov_mat=config_z_transition.cov_mat,
use_triangular_cov=config_z_transition.use_triangular_cov,
use_trainable_cov=config_z_transition.use_trainable_cov,
raw_sigma_bias=config_z_transition.raw_sigma_bias,
sigma_min=config_z_transition.sigma_min,
sigma_scale=config_z_transition.sigma_scale,
name=name+"_z_trans")
s_transition = DiscreteStateTransition(
transition_network=network_s_transition,
num_categories=num_categ)
emission_network = GaussianDistributionFromMean(
emission_mean_network=network_emission,
observation_dim=observation_dim,
cov_mat=config_emission.cov_mat,
use_triangular_cov=config_emission.use_triangular_cov,
use_trainable_cov=config_emission.use_trainable_cov,
raw_sigma_bias=config_emission.raw_sigma_bias,
sigma_min=config_emission.sigma_min,
sigma_scale=config_emission.sigma_scale,
name=name+"_x_emit")
posterior_distribution = GaussianDistributionFromMean(
emission_mean_network=network_posterior_mlp,
observation_dim=hidden_dim,
cov_mat=config_inference.cov_mat,
use_triangular_cov=config_inference.use_triangular_cov,
use_trainable_cov=config_inference.use_trainable_cov,
raw_sigma_bias=config_inference.raw_sigma_bias,
sigma_min=config_inference.sigma_min,
sigma_scale=config_inference.sigma_scale,
name=name+"_posterior")
posterior_network = RnnInferenceNetwork(
posterior_rnn=network_posterior_rnn,
posterior_dist=posterior_distribution,
latent_dim=hidden_dim,
embedding_network=network_input_embedding)
z_initial_distribution = construct_initial_state_distribution(
latent_dim=hidden_dim,
num_categ=num_categ,
use_trainable_cov=config_z_initial.use_trainable_cov,
use_triangular_cov=config_z_initial.use_triangular_cov,
raw_sigma_bias=config_z_initial.raw_sigma_bias,
sigma_min=config_z_initial.sigma_min,
sigma_scale=config_z_initial.sigma_scale,
name="init_dist")
snlds_model = model_base.SwitchingNLDS(
continuous_transition_network=z_transition,
discrete_transition_network=s_transition,
emission_network=emission_network,
inference_network=posterior_network,
initial_distribution=z_initial_distribution,
continuous_state_dim=None,
num_categories=None,
discrete_state_prior=None)
return snlds_model
| 40.770358 | 80 | 0.667878 |
0b0691f0be9f25d86b29ad84f617ff8d2bcf9148 | 184 | sql | SQL | src/sql/sample_data/favourites_tables_sample_data.sql | ScottGarland/MonteCarlo | 8d2a8026da8a0ce38e94c9e045820a6f55a46866 | [
"MIT"
] | null | null | null | src/sql/sample_data/favourites_tables_sample_data.sql | ScottGarland/MonteCarlo | 8d2a8026da8a0ce38e94c9e045820a6f55a46866 | [
"MIT"
] | 1 | 2020-11-16T18:56:13.000Z | 2020-11-16T18:56:13.000Z | src/sql/sample_data/favourites_tables_sample_data.sql | ScottGarland/MonteCarlo | 8d2a8026da8a0ce38e94c9e045820a6f55a46866 | [
"MIT"
] | 2 | 2020-11-17T02:54:07.000Z | 2021-04-10T19:42:48.000Z | INSERT INTO favourites (Username, Ticker)
VALUES
('A', 'AAPL'),
('S', 'FB'),
('A', 'GOOGL'),
('T', 'TSLA'),
('F', 'SNAP'),
('khalid', 'AAPL'),
('T', 'ZM'),
('F', 'TSLA'),
('A', 'ZM');
| 15.333333 | 41 | 0.461957 |
3315d3da5cb288937c32fd7b87ba8f28f91c0406 | 4,113 | lua | Lua | lua/map.lua | Itsnexn/nvim | 5967fe77f00d05fa9954c562f28ac305c710a093 | [
"MIT"
] | null | null | null | lua/map.lua | Itsnexn/nvim | 5967fe77f00d05fa9954c562f28ac305c710a093 | [
"MIT"
] | null | null | null | lua/map.lua | Itsnexn/nvim | 5967fe77f00d05fa9954c562f28ac305c710a093 | [
"MIT"
] | null | null | null | -- =============================================
-- -== Keyboard Cfg ==-
-- =============================================
local bind = vim.api.nvim_set_keymap
local default_opts = { noremap = true, silent = true }
local wk = require("which-key")
-- {{{ Better Movement
-- Move between windows
bind("n", "<c-h>", "<c-w>h", { silent = true })
bind("n", "<c-j>", "<c-w>j", { silent = true })
bind("n", "<c-k>", "<c-w>k", { silent = true })
bind("n", "<c-l>", "<c-w>l", { silent = true })
-- Window Resize
bind("n", "<C-Up>", ":resize -2<CR>", { silent = true })
bind("n", "<C-Down>", ":resize +2<CR>", { silent = true })
bind("n", "<C-Left>", ":vertical resize -2<CR>", { silent = true })
bind("n", "<C-Right>", ":vertical resize +2<CR>", { silent = true })
-- Keep it centered
bind("n", "n", "nzzzv", { noremap = true })
bind("n", "N", "Nzzzv", { noremap = true })
bind("n", "J", "mzJ`z", { noremap = true })
-- Buffers
bind("n", "<TAB>", ":BufferLineCycleNext<CR>", default_opts)
bind("n", "<S-TAB>", ":BufferLineCyclePrev<CR>", default_opts)
bind("n", "<S-x>", ":Bdelete this<CR>", default_opts)
-- }}}
-- {{{ Move Lines
-- Normal mode
bind("v", "<S-j>", ":m '>+1<CR>gv=gv", { noremap = true })
bind("v", "<S-k>", ":m '<-2<CR>gv=gv", { noremap = true })
-- Insert mode
bind("i", "<C-j>", "<esc>:m .+1<CR>==i", { noremap = true })
bind("i", "<C-k>", "<esc>:m .-2<CR>==i", { noremap = true })
-- }}}
-- {{{ Other
bind("n", "<C-u>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<cr>", {})
bind("n", "<C-d>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<cr>", {})
-- }}}
-- Normal mode
wk.register({
g = { -- LSP Actions
name = "LSP Actions",
d = { "<CMD>lua vim.lsp.buf.definition()<CR>", "Goto Defenition" },
D = { "<CMD>lua vim.lsp.buf.declaration()<CR>", "Goto Declaration" },
r = { "<CMD>Lspsaga rename<CR>", "Rename" },
["<leader>"] = { "<CMD>Lspsaga code_action<CR>", "Code Action" },
k = { "<CMD>Lspsaga hover_doc<CR>", "Hower Doc" },
g = { "<CMD>Lspsaga show_line_diagnostics<CR>", "Show Line Diagnostics" },
n = { "<CMD>Lspsaga diagnostic_jump_next<CR>", "Diagnostics Next" },
N = { "<cmd>Lspsaga diagnostic_jump_prev<cr>", "Diagnostics Perv" },
l = { "<CMD>Trouble lsp_document_diagnostics<CR>", "Diagnostics List" },
f = { "<CMD>lua vim.lsp.buf.formatting()<CR>", "Format Buffer" },
t = { "<CMD>LspStop<CR>", "LspStart" },
T = { "<CMD>LspStart<CR>", "LspStop" },
},
f = { -- File Action
name = "File Actions",
f = { "<CMD>lua Find_files()<CR>", "Find Files" },
e = { "<CMD>e ~/.config/nvim/init.lua<CR>", "Edit Config File" },
n = { "<CMD>ene!<CR>", "New File" },
h = { "<CMD>Telescope oldfiles<CR>", "Old Files" },
},
t = { -- ToggleTerm
name = "Terminal",
t = { "<CMD>ToggleTerm<CR>", "New Terminal" },
g = { "<CMD>lua _Lazygit_toggle()<CR>", "Open LazyGit" },
p = { "<CMD>lua _Python_toggle()<CR>", "Open Bpython" },
},
b = {
name = "Buffer Action",
n = { "<CMD>BufferLineCycleNext<CR>", "Next Buffer" },
N = { "<CMD>BufferLineCyclePrev<CR>", "Previous Buffer" },
m = { "<CMD>BufferLineMoveNext<CR>", "Move Buffer to Right" },
M = { "<CMD>BufferLineMovePrev<CR>", "Move Buffer to Left" },
d = { "<CMD>Bdelete this<CR>", "Close Buffer" },
},
["<C-j>"] = { "<Cmd>BufferLineMovePrev<CR>", "BufferLine move to Left" },
["<C-k>"] = { "<Cmd>BufferLineMoveNext<CR>", "BufferLine move to Right" },
["<leader>"] = { "<CMD>lua TrimWhitespaces()<CR>", "Trim Whitespaces" },
r = { "<CMD>lua _Run()<CR>", "Shell Run" },
h = { "<CMD>Telescope help_tags<CR>", "Help" },
e = { "<CMD>NvimTreeToggle<CR>", "File Tree Toggle" },
E = { "<CMD>Telescope symbols<CR>", "Emoji List" },
s = { "<CMD>lua require('spectre').open()<CR>", "Find & Replace" },
c = { "<CMD>Commentary<CR>", "Comment" },
}, { mode = "n", prefix = "<leader>", noremap = true, silent = true })
-- Visual mode
wk.register({
c = { ":Commentary<CR>", "Comment" },
g = {
name = "LSP Actions",
f = { ":lua vim.lsp.buf.formatting()<CR>", "Format" },
},
}, { mode = "x", prefix = "<leader>", noremap = true, silent = true })
| 39.932039 | 91 | 0.546803 |
3125908d8fd4e43737049d46d3e357017344ad38 | 4,143 | swift | Swift | Example/Tests/NavigatorControllerSpec.swift | oscarvgg/Sailor | 5807d1c8e1be41ac34ba9a29b14326ac40018c27 | [
"MIT"
] | null | null | null | Example/Tests/NavigatorControllerSpec.swift | oscarvgg/Sailor | 5807d1c8e1be41ac34ba9a29b14326ac40018c27 | [
"MIT"
] | null | null | null | Example/Tests/NavigatorControllerSpec.swift | oscarvgg/Sailor | 5807d1c8e1be41ac34ba9a29b14326ac40018c27 | [
"MIT"
] | null | null | null | //
// NavigatorControllerSpec.swift
// Sailor_Example
//
// Created by Oscar Gonzalez on 13/04/2018.
// Copyright © 2018 CocoaPods. All rights reserved.
//
import Quick
import Nimble
import Sailor
class NavigatorControllerSpec: QuickSpec {
override func spec() {
describe("A Navigator Controller") {
context("Navigating backwards and forward") {
let navigatorController = NavigatorController.instantiateViewController(
route: TestRoutes.root) as! NavigatorController
navigatorController.pathProvider = TestRoutes.self
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = navigatorController
window.isHidden = false
beforeEach {
navigatorController.viewControllers = []
navigatorController.routes = []
navigatorController.parentNavigator = nil
navigatorController.childNavigators = []
}
it("Should Navigate forward") {
expect {
try navigatorController.navigate(to: TestRoutes.login,
completion: nil)
}.notTo(throwError())
expect(navigatorController.viewControllers.count).to(equal(1))
expect(navigatorController.routes.first?.identifier)
.to(equal(TestRoutes.login.identifier))
}
it("Should go backwards") {
expect {
try navigatorController.navigate(to: TestRoutes.login,
completion: nil)
}.notTo(throwError())
expect {
try navigatorController.navigate(to: TestRoutes.main,
completion: nil)
}.notTo(throwError())
expect {
try navigatorController.navigate(to: TestRoutes.modal,
completion: nil)
}.notTo(throwError())
expect(navigatorController.viewControllers.count).to(equal(2))
expect(navigatorController.routes.first?.identifier)
.to(equal(TestRoutes.login.identifier))
expect(navigatorController.routes[1].identifier)
.to(equal(TestRoutes.main.identifier))
expect(navigatorController.routes[2].identifier)
.to(equal(TestRoutes.modal.identifier))
expect {
try navigatorController.navigate(to: TestRoutes.login,
completion: nil)
}.notTo(throwError())
expect(navigatorController.viewControllers.count).to(equal(1))
expect(navigatorController.routes.first?.identifier)
.to(equal(TestRoutes.login.identifier))
}
it("Should present modal") {
expect {
try navigatorController.navigate(to: TestRoutes.login,
completion: nil)
}.notTo(throwError())
expect {
try navigatorController.navigate(to: TestRoutes.modal,
completion: nil)
}.notTo(throwError())
expect(navigatorController.viewControllers.count).to(equal(1))
expect(navigatorController.routes.count).to(equal(2))
}
}
}
}
}
| 43.610526 | 88 | 0.464156 |
abd76095a0726c9fbefa9886b57dca1e9758755c | 1,848 | kt | Kotlin | Android/app/src/main/java/com/versilistyson/searchflix/presentation/adapters/MediaAdapter.kt | vdtyson/SearchFlix | 895bb09903d38952a4373bbe7dd413301771e6c9 | [
"MIT"
] | 1 | 2020-04-28T01:05:50.000Z | 2020-04-28T01:05:50.000Z | Android/app/src/main/java/com/versilistyson/searchflix/presentation/adapters/MediaAdapter.kt | vdtyson/SearchFlix | 895bb09903d38952a4373bbe7dd413301771e6c9 | [
"MIT"
] | null | null | null | Android/app/src/main/java/com/versilistyson/searchflix/presentation/adapters/MediaAdapter.kt | vdtyson/SearchFlix | 895bb09903d38952a4373bbe7dd413301771e6c9 | [
"MIT"
] | null | null | null | package com.versilistyson.searchflix.presentation.adapters
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.MutableLiveData
import com.squareup.picasso.Picasso
import com.versilistyson.searchflix.R
import com.versilistyson.searchflix.data.util.NetworkConstants
import com.versilistyson.searchflix.domain.entities.Media
import com.versilistyson.searchflix.presentation.adapters.common.BaseViewHolder
import com.versilistyson.searchflix.presentation.adapters.common.LiveDataAdapter
class MediaAdapter(
lifecycleOwner: LifecycleOwner,
liveDataMediaList: MutableLiveData<List<Media>> = MutableLiveData(),
private val onMediaItemClick: ((Media) -> Unit)? = null
) : LiveDataAdapter<Media, MediaAdapter.MediaHolder>(lifecycleOwner, liveDataMediaList) {
init {
observeListLiveData()
}
inner class MediaHolder(private val view: View) : BaseViewHolder<Media>(view) {
private val poster: ImageView = view.findViewById(R.id.imageViewMediaPoster)
private val title: TextView = view.findViewById(R.id.textViewMediaTitle)
override fun bindTo(obj: Media) {
Picasso.get().load(NetworkConstants.TMDB_DEFAULT_IMAGE_BASE_URL + obj.posterPath)
.into(poster)
title.text = obj.name
onMediaItemClick?.let { onMediaItemClick ->
view.setOnClickListener { onMediaItemClick(obj) }
}
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MediaHolder {
val inflatedView =
LayoutInflater.from(parent.context).inflate(R.layout.list_item_media, parent, false)
return MediaHolder(inflatedView)
}
} | 35.538462 | 96 | 0.745671 |
11bc83b6567f2bdb5322d1ec050d6988ef23c985 | 1,014 | swift | Swift | ToolBox/Classes/iOS/Views/TBGradientView.swift | sgigou/ToolBox | 06b788db23056eff47e7f09fd1e0eba39e0602ea | [
"MIT"
] | null | null | null | ToolBox/Classes/iOS/Views/TBGradientView.swift | sgigou/ToolBox | 06b788db23056eff47e7f09fd1e0eba39e0602ea | [
"MIT"
] | null | null | null | ToolBox/Classes/iOS/Views/TBGradientView.swift | sgigou/ToolBox | 06b788db23056eff47e7f09fd1e0eba39e0602ea | [
"MIT"
] | null | null | null | //
// GradientView.swift
// ToolBox
//
// Created by Nicolas Berthelot on 05/01/2017.
// Copyright © 2017 Berthelot Nicolas. All rights reserved.
//
import Foundation
public final class TBGradientView: UIView {
@IBInspectable public var startColor: UIColor = UIColor.clear {
didSet {
updateColor()
}
}
@IBInspectable public var endColor: UIColor = UIColor.clear {
didSet {
updateColor()
}
}
var gradientLayer: CAGradientLayer {
return layer as! CAGradientLayer
}
@IBInspectable public var isVertical: Bool = true
open override class var layerClass : AnyClass {
return CAGradientLayer.self
}
fileprivate func updateColor() {
gradientLayer.colors = [startColor.cgColor, endColor.cgColor]
if isVertical == false {
gradientLayer.startPoint = CGPoint(x: 0.0, y: 0.5)
gradientLayer.endPoint = CGPoint(x: 1.0, y: 0.5)
}
}
public override func awakeFromNib() {
super.awakeFromNib()
updateColor()
}
}
| 20.693878 | 65 | 0.66568 |
9635ac5df4dc2f8fb29b41012564f6e7f72a906a | 4,423 | ctp | PHP | app/views/casetas_pendings/view.ctp | ambagasdowa/kml | b56e9eb5671b5dd71485064f481b288c23384033 | [
"MIT"
] | null | null | null | app/views/casetas_pendings/view.ctp | ambagasdowa/kml | b56e9eb5671b5dd71485064f481b288c23384033 | [
"MIT"
] | 16 | 2020-04-30T02:17:12.000Z | 2021-08-07T19:59:38.000Z | cake/console/views/casetas_pendings/view.ctp | ambagasdowa/kml | b56e9eb5671b5dd71485064f481b288c23384033 | [
"MIT"
] | null | null | null |
<div class="casetasPendings view">
<h2><?php __('Casetas Pending');?></h2>
<dl><?php $i = 0; $class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $casetasPending['CasetasPending']['id']; ?>
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Casetas View'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $this->Html->link($casetasPending['CasetasView']['_filename'], array('controller' => 'casetas_views', 'action' => 'view', $casetasPending['CasetasView']['id'])); ?>
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Casetas Controls Files'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $this->Html->link($casetasPending['CasetasControlsFiles']['_filename'], array('controller' => 'casetas_controls_files', 'action' => 'view', $casetasPending['CasetasControlsFiles']['id'])); ?>
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Casetas Controls Events'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $this->Html->link($casetasPending['CasetasControlsEvents']['casetas_view_id'], array('controller' => 'casetas_controls_events', 'action' => 'view', $casetasPending['CasetasControlsEvents']['id'])); ?>
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Casetas Standings'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $this->Html->link($casetasPending['CasetasStandings']['casetas_standings_name'], array('controller' => 'casetas_standings', 'action' => 'view', $casetasPending['CasetasStandings']['id'])); ?>
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Casetas Parents'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $this->Html->link($casetasPending['CasetasParents']['casetas_parents_name'], array('controller' => 'casetas_parents', 'action' => 'view', $casetasPending['CasetasParents']['id'])); ?>
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __(' Status'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $casetasPending['CasetasPending']['_status']; ?>
</dd>
</dl>
</div>
<div class="actions">
<h3><?php __('Actions'); ?></h3>
<ul>
<li><?php echo $this->Html->link(__('Edit Casetas Pending', true), array('action' => 'edit', $casetasPending['CasetasPending']['id'])); ?> </li>
<li><?php echo $this->Html->link(__('Delete Casetas Pending', true), array('action' => 'delete', $casetasPending['CasetasPending']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $casetasPending['CasetasPending']['id'])); ?> </li>
<li><?php echo $this->Html->link(__('List Casetas Pendings', true), array('action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Casetas Pending', true), array('action' => 'add')); ?> </li>
<li><?php echo $this->Html->link(__('List Casetas Views', true), array('controller' => 'casetas_views', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Casetas View', true), array('controller' => 'casetas_views', 'action' => 'add')); ?> </li>
<li><?php echo $this->Html->link(__('List Casetas Controls Files', true), array('controller' => 'casetas_controls_files', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Casetas Controls Files', true), array('controller' => 'casetas_controls_files', 'action' => 'add')); ?> </li>
<li><?php echo $this->Html->link(__('List Casetas Controls Events', true), array('controller' => 'casetas_controls_events', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Casetas Controls Events', true), array('controller' => 'casetas_controls_events', 'action' => 'add')); ?> </li>
<li><?php echo $this->Html->link(__('List Casetas Standings', true), array('controller' => 'casetas_standings', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Casetas Standings', true), array('controller' => 'casetas_standings', 'action' => 'add')); ?> </li>
<li><?php echo $this->Html->link(__('List Casetas Parents', true), array('controller' => 'casetas_parents', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Casetas Parents', true), array('controller' => 'casetas_parents', 'action' => 'add')); ?> </li>
</ul>
</div>
| 72.508197 | 257 | 0.598236 |
b14e4578ec61a5f9c6dd3629e2c79ae11bb72108 | 7,573 | h | C | cpp/testing/verifier.h | breakds/monster-avengers | c24e32f45047c20c918e7905044a413d317d1d87 | [
"MIT"
] | 30 | 2015-01-25T06:13:44.000Z | 2020-08-04T09:03:01.000Z | cpp/testing/verifier.h | breakds/monster-avengers | c24e32f45047c20c918e7905044a413d317d1d87 | [
"MIT"
] | 10 | 2015-02-17T16:42:51.000Z | 2021-02-26T05:28:06.000Z | cpp/testing/verifier.h | breakds/monster-avengers | c24e32f45047c20c918e7905044a413d317d1d87 | [
"MIT"
] | 16 | 2015-01-26T02:16:55.000Z | 2019-10-25T15:50:21.000Z | // This is the library for verifying the search results.
#ifndef _MONSTER_AVENGERS_CORE_VERIFIER_
#define _MONSTER_AVENGERS_CORE_VERIFIER_
#include "dataset/dataset.h"
using namespace monster_avengers::dataset;
using monster_avengers::dataset::StringifyEnum;
namespace monster_avengers {
namespace testing {
struct VerificationMessage {
std::string tag;
std::wstring detail;
template <typename... AnyType>
VerificationMessage(const std::string &input_tag,
const wchar_t *format,
AnyType... any) {
Set(input_tag, format, any...);
}
void Set(const std::string &input_tag, const wchar_t *format, ...) {
static const int buffer_size = 255;
static wchar_t buffer[buffer_size];
tag = input_tag;
va_list argptr;
va_start(argptr, format);
vswprintf(buffer, buffer_size, format, argptr);
va_end(argptr);
detail = buffer;
}
void Print() const {
Log(FATAL, L"On [%s]: %ls\n", tag.c_str(), detail.c_str());
}
};
bool VerifySkillRequirement(const Arsenal &arsenal,
const Query &query,
const ArmorSet &armor_set,
std::vector<VerificationMessage> *messages) {
std::vector<Effect> stats = std::move(Data::GetSkillStats(
armor_set, arsenal));
bool pass = true;
for (const Effect &effect : query.effects) {
bool found = false;
for (const Effect &stat : stats) {
if (stat.id == effect.id) {
found = true;
if (stat.points >= effect.points) {
break;
}
// Fail Case 1: Cannot found the skill.
messages->emplace_back(
"SKILL", L"%ls(%d) is not fufilled (%d/%d).",
Data::GetSkillName(effect.id).c_str(),
effect.id, stat.points, effect.points);
pass = false;
}
}
if (!found) {
messages->emplace_back(
"SKILL", L"%ls(%d) is expected but not found in result.",
Data::GetSkillName(effect.id).c_str(), effect.id);
pass = false;
}
}
// Check negative skill
if (query.avoid_negative) {
for (const Effect &stat : stats) {
if (Data::NegativeActivated(stat)) {
messages->emplace_back(
"SKILL", L"%ls(%d) is negatively activated! (%d).",
Data::GetSkillName(stat.id).c_str(),
stat.id, stat.points);
pass = false;
}
}
}
return pass;
}
bool VerifyDefenseRequirement(const Arsenal &arsenal,
const Query &query,
const ArmorSet &armor_set,
std::vector<VerificationMessage> *messages) {
int defense = Data::GetTotalDefense(armor_set, arsenal);
if (defense < query.defense) {
messages->emplace_back(
"DEFENSE", L"Defense = %d which does not meet the target (%d).",
defense, query.defense);
return false;
}
return true;
}
bool VerifyWeaponTypeRequirement(const Arsenal &arsenal,
const Query &query,
const ArmorSet &armor_set,
std::vector<VerificationMessage> *messages) {
bool pass = true;
for (int i = 0; i < PART_NUM; ++i) {
const Armor &armor = arsenal[armor_set.ids[i]];
if (armor.weapon_type == (1 - query.armor_filter.weapon_type)) {
messages->emplace_back(
"WEAPON TYPE", L"Piece %ls(%d) is for %s, but %s is required.",
Data::GetArmorName(armor_set.ids[i]).c_str(), armor_set.ids[i],
StringifyEnum(armor.weapon_type).c_str(),
StringifyEnum(query.armor_filter.weapon_type).c_str());
pass = false;
}
}
return pass;
}
bool VerifyGenderRequirement(const Arsenal &arsenal,
const Query &query,
const ArmorSet &armor_set,
std::vector<VerificationMessage> *messages) {
bool pass = true;
for (int i = 0; i < PART_NUM; ++i) {
const Armor &armor = arsenal[armor_set.ids[i]];
if (armor.gender == (1 - query.armor_filter.gender)) {
messages->emplace_back(
"GENDER", L"Piece %ls(%d) is for %s, but %s is required.",
Data::GetArmorName(armor_set.ids[i]).c_str(), armor_set.ids[i],
StringifyEnum(armor.gender).c_str(),
StringifyEnum(query.armor_filter.gender).c_str());
pass = false;
}
}
return pass;
}
bool VerifyRareRequirement(const Arsenal &arsenal,
const Query &query,
const ArmorSet &armor_set,
std::vector<VerificationMessage> *messages) {
bool pass = true;
for (int i = 0; i < PART_NUM; ++i) {
if (GEAR == i || AMULET == i) continue;
const Armor &armor = arsenal[armor_set.ids[i]];
if (armor.rare < query.armor_filter.min_rare ||
armor.rare > query.armor_filter.max_rare) {
messages->emplace_back(
"RARE", L"Piece %ls(%d) has rare %d which does not fall in [%d, %d].",
Data::GetArmorName(armor_set.ids[i]).c_str(), armor_set.ids[i],
armor.rare, query.armor_filter.min_rare, query.armor_filter.max_rare);
pass = false;
}
}
return pass;
}
// Verify that armor blacklists and whitelists are respected.
bool VerifyArmorBlacklist(const Arsenal &arsenal,
const Query &query,
const ArmorSet &armor_set,
std::vector<VerificationMessage> *messages) {
bool pass = true;
for (int i = 0; i < PART_NUM; ++i) {
if (GEAR == i || AMULET == i) continue;
int id = armor_set.ids[i];
if (0 != query.armor_filter.blacklist.count(id) ||
(0 < query.armor_filter.whitelist.size() &&
0 == query.armor_filter.whitelist.count(id))) {
messages->emplace_back(
"BLACKLIST/WHITELIST",
L"Piece %ls(%d) is backlisted, or not whitelisted.",
Data::GetArmorName(id).c_str(), id);
pass = false;
}
}
return pass;
}
bool VerifyJewelBlacklist(const Arsenal &arsenal,
const Query &query,
const ArmorSet &armor_set,
std::vector<VerificationMessage> *messages) {
bool pass = true;
for (int i = 0; i < PART_NUM; ++i) {
for (const int jewel_id : armor_set.jewels[i]) {
if (0 != query.jewel_filter.blacklist.count(jewel_id)) {
messages->emplace_back(
"JEWEL BLACKLIST",
L"Jewel %ls(%d) is present, but should be blacklisted.",
Data::GetJewelName(jewel_id).c_str(), jewel_id);
pass = false;
}
}
}
return pass;
}
std::vector<VerificationMessage> VerifyArmorSet(const Arsenal &arsenal,
const Query &query,
const ArmorSet &armor_set) {
std::vector<VerificationMessage> messages;
VerifyWeaponTypeRequirement(arsenal, query, armor_set, &messages);
VerifyGenderRequirement(arsenal, query, armor_set, &messages);
VerifyArmorBlacklist(arsenal, query, armor_set, &messages);
VerifyJewelBlacklist(arsenal, query, armor_set, &messages);
VerifyRareRequirement(arsenal, query, armor_set, &messages);
VerifyDefenseRequirement(arsenal, query, armor_set, &messages);
VerifySkillRequirement(arsenal, query, armor_set, &messages);
return messages;
}
} // namespace testing
} // namespace monster_avengers
#endif // _MONSTER_AVENGERS_CORE_VERIFIER_
| 31.293388 | 80 | 0.587614 |
261c98da3d4c18e57793d7163f208fe704e2f2db | 4,398 | java | Java | litr-filters/src/main/java/com/linkedin/android/litr/filter/video/gl/ZoomBlurFilter.java | lu16j/LiTr | 1af0d696c806c4033c0950e2968881b606d76cc4 | [
"BSD-2-Clause"
] | 391 | 2019-10-18T18:19:26.000Z | 2022-03-31T18:30:44.000Z | litr-filters/src/main/java/com/linkedin/android/litr/filter/video/gl/ZoomBlurFilter.java | lu16j/LiTr | 1af0d696c806c4033c0950e2968881b606d76cc4 | [
"BSD-2-Clause"
] | 87 | 2019-12-05T15:25:15.000Z | 2022-03-30T12:28:01.000Z | litr-filters/src/main/java/com/linkedin/android/litr/filter/video/gl/ZoomBlurFilter.java | lu16j/LiTr | 1af0d696c806c4033c0950e2968881b606d76cc4 | [
"BSD-2-Clause"
] | 67 | 2019-10-21T02:04:06.000Z | 2022-03-30T09:35:09.000Z | /*
* Copyright 2018 Masayuki Suda
*
* The MIT License
*
* 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.
*/
package com.linkedin.android.litr.filter.video.gl;
import android.graphics.PointF;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.linkedin.android.litr.filter.Transform;
import com.linkedin.android.litr.filter.video.gl.parameter.ShaderParameter;
import com.linkedin.android.litr.filter.video.gl.parameter.Uniform1f;
import com.linkedin.android.litr.filter.video.gl.parameter.Uniform2f;
/**
* Frame render filter that applies a zoom distortion to video frame
*/
public class ZoomBlurFilter extends VideoFrameRenderFilter {
private static final String FRAGMENT_SHADER =
"#extension GL_OES_EGL_image_external : require\n" +
"precision mediump float;\n" +
"varying vec2 vTextureCoord;\n" +
"uniform samplerExternalOES sTexture;\n" +
"uniform highp vec2 blurCenter;\n" +
"uniform highp float blurSize;\n" +
"void main()\n" +
"{\n" +
"// TODO: Do a more intelligent scaling based on resolution here\n" +
"highp vec2 samplingOffset = 1.0/100.0 * (blurCenter - vTextureCoord) * blurSize;\n" +
"lowp vec4 fragmentColor = texture2D(sTexture, vTextureCoord) * 0.18;\n" +
"fragmentColor += texture2D(sTexture, vTextureCoord + samplingOffset) * 0.15;\n" +
"fragmentColor += texture2D(sTexture, vTextureCoord + (2.0 * samplingOffset)) * 0.12;\n" +
"fragmentColor += texture2D(sTexture, vTextureCoord + (3.0 * samplingOffset)) * 0.09;\n" +
"fragmentColor += texture2D(sTexture, vTextureCoord + (4.0 * samplingOffset)) * 0.05;\n" +
"fragmentColor += texture2D(sTexture, vTextureCoord - samplingOffset) * 0.15;\n" +
"fragmentColor += texture2D(sTexture, vTextureCoord - (2.0 * samplingOffset)) * 0.12;\n" +
"fragmentColor += texture2D(sTexture, vTextureCoord - (3.0 * samplingOffset)) * 0.09;\n" +
"fragmentColor += texture2D(sTexture, vTextureCoord - (4.0 * samplingOffset)) * 0.05;\n" +
"gl_FragColor = fragmentColor;\n" +
"}";
/**
* Create frame render filter
* @param blurCenter center of distortion, in relative coordinates in 0 - 1 range
* @param blurSize distortion size
*/
public ZoomBlurFilter(@NonNull PointF blurCenter, float blurSize) {
this(blurCenter, blurSize, null);
}
/**
* Create frame render filter with source video frame, then scale, then position and then rotate the bitmap around its center as specified.
* @param blurCenter center of distortion, in relative coordinates in 0 - 1 range
* @param blurSize distortion size
* @param transform {@link Transform} that defines positioning of source video frame within target video frame
*/
public ZoomBlurFilter(@NonNull PointF blurCenter, float blurSize, @Nullable Transform transform) {
super(DEFAULT_VERTEX_SHADER,
FRAGMENT_SHADER,
new ShaderParameter[] {
new Uniform2f("blurCenter", blurCenter.x, blurCenter.y),
new Uniform1f("blurSize", blurSize)
},
transform);
}
}
| 49.977273 | 143 | 0.672351 |
8e2d2e33449ae8ceb085acf525c2c9965fe420e5 | 1,173 | swift | Swift | ___BigMountainStudio-SwiftUI-Books-And-Tutorials/SwiftUI-Views-Mastery-Bundle/SwiftUI_Views/ImageModifiers/Interpolation/Interpolation_Intro.swift | luannguyen252/my-swift-journey | 788d66f256358dc5aefa2f3093ef74fd572e83b3 | [
"MIT"
] | 14 | 2020-12-09T08:53:39.000Z | 2021-12-07T09:15:44.000Z | ___BigMountainStudio-SwiftUI-Books-And-Tutorials/SwiftUI-Views-Mastery-Bundle/SwiftUI_Views/ImageModifiers/Interpolation/Interpolation_Intro.swift | luannguyen252/my-swift-journey | 788d66f256358dc5aefa2f3093ef74fd572e83b3 | [
"MIT"
] | null | null | null | ___BigMountainStudio-SwiftUI-Books-And-Tutorials/SwiftUI-Views-Mastery-Bundle/SwiftUI_Views/ImageModifiers/Interpolation/Interpolation_Intro.swift | luannguyen252/my-swift-journey | 788d66f256358dc5aefa2f3093ef74fd572e83b3 | [
"MIT"
] | 8 | 2020-12-10T05:59:26.000Z | 2022-01-03T07:49:21.000Z | //
// Interpolation_Intro.swift
// 100Views
//
// Created by Mark Moeykens on 9/16/19.
// Copyright © 2019 Mark Moeykens. All rights reserved.
//
import SwiftUI
struct Interpolation_Intro: View {
var body: some View {
VStack(spacing: 10) {
Text("Interpolation").font(.largeTitle)
Text("Introduction").font(.title).foregroundColor(.gray)
Text("Use interpolation to smooth out an image when it is resized.")
.frame(maxWidth: .infinity)
.font(.title).padding()
.background(Color.green)
.layoutPriority(1)
.foregroundColor(.white)
Text("Interpolation: None")
Image("yosemite")
.resizable()
.interpolation(Image.Interpolation.none)
Text("Interpolation: High")
Image("yosemite")
.resizable()
.interpolation(.high) // Smooth out to a high degree
}.font(.title)
}
}
struct Interpolation_Intro_Previews: PreviewProvider {
static var previews: some View {
Interpolation_Intro()
}
}
| 28.609756 | 80 | 0.55925 |
658be9dcfaa23140950c37a37f7f9426df3f251c | 1,221 | kt | Kotlin | src/main/kotlin/frc/robot/utils/Translation3d.kt | kobijones111529/RapidReact2022-Kotlin | 8895345d706260f725a837617f1035a79553adc9 | [
"BSD-3-Clause"
] | null | null | null | src/main/kotlin/frc/robot/utils/Translation3d.kt | kobijones111529/RapidReact2022-Kotlin | 8895345d706260f725a837617f1035a79553adc9 | [
"BSD-3-Clause"
] | null | null | null | src/main/kotlin/frc/robot/utils/Translation3d.kt | kobijones111529/RapidReact2022-Kotlin | 8895345d706260f725a837617f1035a79553adc9 | [
"BSD-3-Clause"
] | null | null | null | package frc.robot.utils
class Translation3d : Interpolable<Translation3d> {
private val v: Vector3
var x: Double
get() = v.x
set(value) {
v.x = value
}
var y: Double
get() = v.y
set(value) {
v.y = value
}
var z: Double
get() = v.z
set(value) {
v.z = value
}
val norm: Double
get() = v.magnitude
constructor(v: Vector3) {
this.v = v
}
operator fun plus(other: Translation3d): Translation3d {
return Translation3d(v + other.v)
}
operator fun minus(other: Translation3d): Translation3d {
return Translation3d(v - other.v)
}
operator fun unaryMinus(): Translation3d {
return Translation3d(-v)
}
operator fun times(scalar: Double): Translation3d {
return Translation3d(v * scalar)
}
operator fun div(scalar: Double): Translation3d {
return Translation3d(v / scalar)
}
fun getDistance(other: Translation3d): Double {
return (other.v - v).magnitude
}
fun rotateBy(other: Rotation3d): Translation3d {
return Translation3d(v.rotate(other.quaternion))
}
override fun interpolate(upper: Translation3d, t: Double): Translation3d {
return Translation3d(v.interpolate(upper.v, t))
}
} | 20.694915 | 76 | 0.64783 |
2a8faf4cb597e46530e95b1a2b61e5a92085c883 | 5,891 | java | Java | eu.indenica.config.runtime/src/eu/indenica/config/runtime/RuntimeRuntimeModule.java | inz/monina | 5cd441d3e68a17db0a018e7b8ae88347b80551b9 | [
"Apache-2.0"
] | 1 | 2015-01-09T08:34:03.000Z | 2015-01-09T08:34:03.000Z | eu.indenica.config.runtime/src/eu/indenica/config/runtime/RuntimeRuntimeModule.java | inz/monina | 5cd441d3e68a17db0a018e7b8ae88347b80551b9 | [
"Apache-2.0"
] | null | null | null | eu.indenica.config.runtime/src/eu/indenica/config/runtime/RuntimeRuntimeModule.java | inz/monina | 5cd441d3e68a17db0a018e7b8ae88347b80551b9 | [
"Apache-2.0"
] | null | null | null | /*
* generated by Xtext
*/
package eu.indenica.config.runtime;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.resource.containers.FlatResourceSetBasedAllContainersState;
import org.eclipse.xtext.resource.containers.IAllContainersState;
import org.eclipse.xtext.resource.containers.ResourceSetBasedAllContainersStateProvider;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.util.PolymorphicDispatcher.ErrorHandler;
import org.eclipse.xtext.util.PolymorphicDispatcher.WarningErrorHandler;
import org.eclipse.xtext.xbase.scoping.XbaseImportedNamespaceScopeProvider;
import com.google.common.collect.Lists;
import com.google.inject.Binder;
import com.google.inject.name.Names;
import eu.indenica.config.runtime.generator.RuntimeGenerator;
import eu.indenica.config.runtime.scoping.RuntimeDeclarativeScopeProvider;
/**
* Use this class to register components to be used at runtime / without the
* Equinox extension registry.
*/
@SuppressWarnings("restriction")
public class RuntimeRuntimeModule extends
eu.indenica.config.runtime.AbstractRuntimeRuntimeModule {
static {
Logger.getLogger("org.eclipse.xtext").setLevel(Level.INFO);
Logger.getLogger("eu.indenica").setLevel(Level.ALL);
}
/*
* (non-Javadoc)
*
* @see
* eu.indenica.config.runtime.AbstractRuntimeRuntimeModule#bindIScopeProvider
* ()
*/
// @Override
// public Class<? extends IScopeProvider> bindIScopeProvider() {
// return RuntimeXbaseScopeProvider.class;
// }
/*
* (non-Javadoc)
*
* @see eu.indenica.config.runtime.AbstractRuntimeRuntimeModule#
* configureIScopeProviderDelegate(com.google.inject.Binder)
*/
@Override
public void configureIScopeProviderDelegate(Binder binder) {
// super.configureIScopeProviderDelegate(binder);
// binder.bind(IScopeProvider.class)
// .annotatedWith(
// Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
// .to(XbaseImportedNamespaceScopeProvider.class);
// binder.bind(IScopeProvider.class)
// .annotatedWith(
// Names.named(RuntimeXbaseScopeProvider.NAMED_DELEGATE))
// .to(RuntimeDeclarativeScopeProvider.class);
// binder.bind(IScopeProvider.class)
// .annotatedWith(
// Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
// .to(RuntimeXbaseScopeProvider.class);
// binder.bind(IScopeProvider.class)
// .annotatedWith(
// Names.named(RuntimeXbaseScopeProvider.NAMED_DELEGATE))
// .to(RuntimeDeclarativeScopeProvider.class);
binder.bind(IScopeProvider.class)
.annotatedWith(
Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
.to(RuntimeDeclarativeScopeProvider.class);
binder.bind(IScopeProvider.class)
.annotatedWith(
Names.named(RuntimeDeclarativeScopeProvider.NAMED_DELEGATE))
.to(XbaseImportedNamespaceScopeProvider.class);
}
/*
* FIX bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=382555#c0
*/
public Class<? extends IAllContainersState.Provider>
bindIAllContainersState$Provider() {
return FixedResourceSetBasedAllContainersStateProvider.class;
}
public static class FixedResourceSetBasedAllContainersStateProvider extends
ResourceSetBasedAllContainersStateProvider {
@Override
protected IAllContainersState handleAdapterNotFound(
ResourceSet resourceSet) {
return new FixedFlatResourceSetBasedAllContainersState(resourceSet);
}
}
public static class FixedFlatResourceSetBasedAllContainersState extends
FlatResourceSetBasedAllContainersState {
public FixedFlatResourceSetBasedAllContainersState(ResourceSet rs) {
super(rs);
}
public Collection<URI> getContainedURIs(String containerHandle) {
if(!getHandle().equals(containerHandle))
return Collections.emptySet();
ResourceSet resourceSet = getResourceSet();
List<URI> uris =
Lists.newArrayListWithCapacity(resourceSet.getResources()
.size());
URIConverter uriConverter = resourceSet.getURIConverter();
for(Resource r : resourceSet.getResources())
uris.add(uriConverter.normalize(r.getURI()));
return uris;
}
}
/* ENDFIX */
/*
* (non-Javadoc)
*
* @see
* eu.indenica.config.runtime.AbstractRuntimeRuntimeModule#bindIGenerator()
*/
@Override
public Class<? extends IGenerator> bindIGenerator() {
return RuntimeGenerator.class;
}
/*
* (non-Javadoc)
*
* @see
* eu.indenica.config.runtime.AbstractRuntimeRuntimeModule#configure(com
* .google.inject.Binder)
*/
@Override
public void configure(Binder binder) {
super.configure(binder);
binder.bind(ErrorHandler.class)
.annotatedWith(
Names.named(AbstractDeclarativeScopeProvider.NAMED_ERROR_HANDLER))
.toInstance(
WarningErrorHandler.<IScope> get(Logger
.getLogger("SCOPE.ERROR")));
}
}
| 35.487952 | 90 | 0.68732 |
37997c90abb2af846af282412bed58d456ccf034 | 3,059 | kt | Kotlin | kert-http/src/test/kotlin/ws/leap/kert/http/VertxTestServer.kt | wsleap/kettle | 8333230ddef6e14278b5773193ae2c843ad39393 | [
"Apache-2.0"
] | 25 | 2021-03-23T04:41:15.000Z | 2022-02-04T09:15:51.000Z | kert-http/src/test/kotlin/ws/leap/kert/http/VertxTestServer.kt | wsleap/kettle | 8333230ddef6e14278b5773193ae2c843ad39393 | [
"Apache-2.0"
] | 8 | 2021-05-10T02:08:16.000Z | 2021-08-21T23:21:20.000Z | kert-http/src/test/kotlin/ws/leap/kert/http/VertxTestServer.kt | wsleap/kettle | 8333230ddef6e14278b5773193ae2c843ad39393 | [
"Apache-2.0"
] | 1 | 2021-11-05T00:02:20.000Z | 2021-11-05T00:02:20.000Z | package ws.leap.kert.http
import io.vertx.core.*
import io.vertx.core.http.HttpServer
import io.vertx.core.http.HttpServerOptions
import io.vertx.core.streams.Pump
import io.vertx.ext.web.Router
import io.vertx.kotlin.coroutines.await
import kotlinx.coroutines.runBlocking
import mu.KotlinLogging
// 500 loops with 8K for each message
const val streamSize = 4000 * 1024
private val logger = KotlinLogging.logger {}
private fun createHttpServer(vertx: Vertx): HttpServer {
val options = HttpServerOptions()
.setSsl(false)
.setUseAlpn(true)
val server = vertx.createHttpServer(options)
val router = Router.router(vertx)
router.get("/ping").handler { ctx ->
ctx.response().send("pong")
}
router.get("/server-stream").handler { ctx ->
val resp = ctx.response()
resp.isChunked = true
val stream = MockReadStream(vertx, streamSize)
stream.pipe().to(resp).onComplete { ar ->
if(!ar.succeeded()) {
resp.close()
}
}
}
router.post("/client-stream").handler { ctx ->
val req = ctx.request()
val resp = ctx.response()
var receivedTotal = 0L
req.exceptionHandler { e ->
logger.error(e) { "client-stream error" }
resp.statusCode = 500
resp.end(e.message)
}
req.endHandler {
logger.trace("received total $receivedTotal bytes")
resp.end("$receivedTotal")
}
req.handler { buf ->
logger.trace{ "received ${buf.length()} bytes" }
receivedTotal += buf.length()
// simulate a slow server
Thread.sleep(1)
}
}
router.post("/bidi-stream").handler { ctx ->
val resp = ctx.response()
resp.isChunked = true
ctx.request().endHandler {
resp.end()
}
val pump = Pump.pump(ctx.request(), resp)
pump.start()
}
server.requestHandler(router)
return server
}
fun createVertxServer(vertx: Vertx, port: Int): TestServer {
val server = createHttpServer(vertx)
return object: TestServer {
override fun start() {
server.listen(port)
}
override fun stop() {
server.close()
}
}
}
fun createVertxVerticleServer(vertx: Vertx, port: Int): TestServer {
class ServerVerticle: AbstractVerticle() {
private lateinit var server: HttpServer
override fun init(vertx: Vertx, context: Context) {
server = createHttpServer(vertx)
}
override fun start() {
server.listen(port)
}
override fun stop() {
server.close()
}
}
return object: TestServer {
private var deployId: String? = null
override fun start() {
if(deployId != null) return
runBlocking {
deployId = vertx.deployVerticle( { ServerVerticle() }, DeploymentOptions().setInstances(VertxOptions.DEFAULT_EVENT_LOOP_POOL_SIZE)).await()
}
}
override fun stop() {
if(deployId == null) return
runBlocking {
vertx.undeploy(deployId).await()
deployId = null
}
}
}
}
fun main() {
val vertx = Vertx.vertx()
val server = createVertxVerticleServer(vertx, 8000)
server.start()
}
| 23.174242 | 147 | 0.647924 |
b89d10715ed14b030e89924cba1028102441bede | 357 | html | HTML | src/pages/line-up/list/line-up-list.component.html | SamVerschueren/eurovision2017 | 86651baf3a3c913fee9981a0606cec6f2f4593d6 | [
"MIT"
] | null | null | null | src/pages/line-up/list/line-up-list.component.html | SamVerschueren/eurovision2017 | 86651baf3a3c913fee9981a0606cec6f2f4593d6 | [
"MIT"
] | null | null | null | src/pages/line-up/list/line-up-list.component.html | SamVerschueren/eurovision2017 | 86651baf3a3c913fee9981a0606cec6f2f4593d6 | [
"MIT"
] | null | null | null | <ion-spinner *ngIf="lineup === null" color="primary"></ion-spinner>
<ion-list *ngIf="lineup">
<line-up-item
*ngFor="let song of lineup"
[order]="song.order"
[title]="song.title"
[picture]="song.picture"
[userScore]="song.userScore"
[country]="song.country"
[artist]="song.artist"
(select)="select.emit(song)">
</line-up-item>
</ion-list>
| 23.8 | 67 | 0.64986 |
40503bb2cc991dc20d35bc01beade7749fc37ad1 | 883 | py | Python | bin/dumb_round.py | rherriman/Avara | eaa68133ac273796b60162673b8f240619cb35ed | [
"MIT"
] | 77 | 2016-10-30T18:37:14.000Z | 2022-02-13T05:02:55.000Z | bin/dumb_round.py | tra/Avara | 5a6b5a4f2cf29e8b2ddf7dd3f422579f37a14dab | [
"MIT"
] | 135 | 2018-09-09T06:46:04.000Z | 2022-01-29T19:33:12.000Z | bin/dumb_round.py | tra/Avara | 5a6b5a4f2cf29e8b2ddf7dd3f422579f37a14dab | [
"MIT"
] | 19 | 2018-09-09T02:02:46.000Z | 2022-03-16T08:21:08.000Z | #!/usr/bin/env python3
import argparse
def dumb_round(num, repeats=6):
s = str(num)
if "." not in s:
return s
if s.endswith(".0"):
return s[:-2]
zeros = "0" * repeats
nines = "9" * repeats
if zeros in s:
return s.split(zeros, 1)[0].rstrip(".")
if nines in s:
# How many digits before the nines is how many we want to round to.
places = len(s.split(nines, 1)[0].split(".")[1]) or None
return str(round(num, places))
return s
# How's this for continuous integration.
assert dumb_round(10.00000007) == "10"
assert dumb_round(4.500000022) == "4.5"
assert dumb_round(0.999999987) == "1"
assert dumb_round(0.049999999) == "0.05"
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('num', type=float)
args = parser.parse_args()
print(dumb_round(args.num))
| 24.527778 | 75 | 0.616082 |
29059de9a4aa8e993c70e1df238f3a6dcc31e238 | 1,405 | py | Python | psq/__init__.py | Tomesco/bookshelf-demo-project | 9d422f3aa04edbb3312d3e177caf699653ed6a73 | [
"Apache-2.0"
] | 210 | 2015-07-29T16:50:01.000Z | 2022-03-02T15:24:52.000Z | psq/__init__.py | Tomesco/bookshelf-demo-project | 9d422f3aa04edbb3312d3e177caf699653ed6a73 | [
"Apache-2.0"
] | 60 | 2015-12-03T23:15:57.000Z | 2021-01-21T09:25:42.000Z | psq/__init__.py | Tomesco/bookshelf-demo-project | 9d422f3aa04edbb3312d3e177caf699653ed6a73 | [
"Apache-2.0"
] | 47 | 2015-12-21T06:09:36.000Z | 2021-09-04T13:20:21.000Z | # Copyright 2015 Google 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.
"""
psq - a distributed task queue using Google Cloud Pubsub.
Homepage: https://github.com/GoogleCloudPlatform/psq
"""
from __future__ import absolute_import
import logging
from .broadcast_queue import BroadcastQueue
from .datastore_storage import DatastoreStorage
from .globals import current_queue, current_task, queue_context, task_context
from .queue import Queue
from .storage import Storage
from .task import Retry, Task, TaskResult
from .worker import Worker
__all__ = [
'Queue',
'BroadcastQueue',
'Task',
'TaskResult',
'Retry',
'Worker',
'Storage',
'DatastoreStorage',
'current_queue',
'queue_context',
'current_task',
'task_context'
]
# Set default logging handler to avoid "No handler found" warnings.
logging.getLogger(__name__).addHandler(logging.NullHandler())
| 27.54902 | 77 | 0.749466 |
53a9a0b20e86b2933c134100a0dc7dca49fd46b2 | 162 | java | Java | src/main/java8/net/finmath/montecarlo/hybridassetinterestrate/RiskFactorID.java | noittom/finmath-lib | 49e673ef1f38e4f011d7e4ab1f170fc5df6108e9 | [
"Apache-2.0"
] | 373 | 2015-01-01T11:27:51.000Z | 2022-03-29T21:51:49.000Z | src/main/java8/net/finmath/montecarlo/hybridassetinterestrate/RiskFactorID.java | noittom/finmath-lib | 49e673ef1f38e4f011d7e4ab1f170fc5df6108e9 | [
"Apache-2.0"
] | 67 | 2015-01-21T08:52:23.000Z | 2021-09-22T20:13:11.000Z | src/main/java8/net/finmath/montecarlo/hybridassetinterestrate/RiskFactorID.java | noittom/finmath-lib | 49e673ef1f38e4f011d7e4ab1f170fc5df6108e9 | [
"Apache-2.0"
] | 184 | 2015-01-05T17:30:18.000Z | 2022-03-28T10:55:29.000Z | package net.finmath.montecarlo.hybridassetinterestrate;
public interface RiskFactorID {
/**
* @return The name of the risk factor.
*/
String getName();
}
| 16.2 | 55 | 0.728395 |
ffdfd13a9d3d36ac38ea73964c3d36b92d7d1071 | 722 | html | HTML | html/fnm.html | slicer69/tldr | 8347a142e7e5722921e9011bd188ffa3a31495c1 | [
"MIT"
] | 1 | 2021-12-25T13:30:17.000Z | 2021-12-25T13:30:17.000Z | html/fnm.html | slicer69/tldr | 8347a142e7e5722921e9011bd188ffa3a31495c1 | [
"MIT"
] | null | null | null | html/fnm.html | slicer69/tldr | 8347a142e7e5722921e9011bd188ffa3a31495c1 | [
"MIT"
] | null | null | null | <b>fnm</b><br><br>
<b>Fast Node.js version manager.</b><br><br><b>Install, uninstall or switch between Node.js versions.</b><br><br><b>More information: <a href="https://github.com/Schniz/fnm">home page</a></b><br><br>
- Install a specific version of Node.js:
<blockquote>fnm install <i>node_version</i></blockquote>
- List all available Node.js versions and highlight the default one:
<blockquote>fnm ls</blockquote>
- Use a specific version of Node.js in the current shell:
<blockquote>fnm use <i>node_version</i></blockquote>
- Set the default Node.js version:
<blockquote>fnm default <i>node_version</i></blockquote>
- Uninstall a given Node.js version:
<blockquote>fnm uninstall <i>node_version</i></blockquote>
| 40.111111 | 199 | 0.735457 |
267f5acec54cc531532fcd72cf3bedc3fcde2a02 | 814 | swift | Swift | HelloLayout/ReloadableView.swift | HelloCore/HelloLayout | f32983e81a1727ee101d81b5c7f93de329a5d96e | [
"MIT"
] | null | null | null | HelloLayout/ReloadableView.swift | HelloCore/HelloLayout | f32983e81a1727ee101d81b5c7f93de329a5d96e | [
"MIT"
] | null | null | null | HelloLayout/ReloadableView.swift | HelloCore/HelloLayout | f32983e81a1727ee101d81b5c7f93de329a5d96e | [
"MIT"
] | null | null | null | //
// ReloadableView.swift
// HelloLayout
//
// Created by Akkharawat Chayapiwat on 14/6/2562 BE.
//
import UIKit
class ReloadableView: UIView {
init() {
super.init(frame: CGRect.zero)
on("INJECTION_BUNDLE_NOTIFICATION") { [weak self] in
self?.loadView()
}
self.loadView()
}
override public init(frame: CGRect) {
super.init(frame: frame)
on("INJECTION_BUNDLE_NOTIFICATION") { [weak self] in
self?.loadView()
}
self.loadView()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
on("INJECTION_BUNDLE_NOTIFICATION") { [weak self] in
self?.loadView()
}
self.loadView()
}
open func loadView() {
}
}
| 19.853659 | 60 | 0.54914 |
48f5902c2b97c61331b785c71e01040f4a384e05 | 5,133 | swift | Swift | Sources/DoggieMath/Accelerate/Radix2CooleyTukey/HalfRadix2CooleyTukey.swift | SusanDoggie/Doggie | e841261ec8e5db94a87c8b594844193d9e43e3aa | [
"MIT"
] | 116 | 2015-02-06T17:59:59.000Z | 2022-03-11T23:15:29.000Z | Sources/DoggieMath/Accelerate/Radix2CooleyTukey/HalfRadix2CooleyTukey.swift | SusanDoggie/Doggie | e841261ec8e5db94a87c8b594844193d9e43e3aa | [
"MIT"
] | 6 | 2016-12-02T03:47:13.000Z | 2020-09-30T14:42:06.000Z | Sources/DoggieMath/Accelerate/Radix2CooleyTukey/HalfRadix2CooleyTukey.swift | SusanDoggie/Doggie | e841261ec8e5db94a87c8b594844193d9e43e3aa | [
"MIT"
] | 9 | 2016-12-02T03:33:18.000Z | 2022-02-09T08:16:16.000Z | //
// HalfRadix2CooleyTukey.swift
//
// The MIT License
// Copyright (c) 2015 - 2021 Susan Cheng. All rights reserved.
//
// 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.
//
@inlinable
@inline(__always)
func cooleytukey_twiddling<T: BinaryFloatingPoint>(_ log2n: Int, _ real: UnsafeMutablePointer<T>, _ imag: UnsafeMutablePointer<T>, _ stride: Int) where T: ElementaryFunctions {
let length = 1 << log2n
let half = length >> 1
let fourth = length >> 2
let _stride = half * stride
var op_r = real
var op_i = imag
var oph_r = real + _stride
var oph_i = imag + _stride
let tr = op_r.pointee
let ti = op_i.pointee
op_r.pointee = tr + ti
op_i.pointee = tr - ti
let opf_i = imag + fourth * stride
opf_i.pointee = -opf_i.pointee
let angle = -T.pi / T(half)
let _cos = T.cos(angle)
let _sin = T.sin(angle)
var _cos1 = _cos
var _sin1 = _sin
for _ in 1..<fourth {
op_r += stride
op_i += stride
oph_r -= stride
oph_i -= stride
let or = op_r.pointee
let oi = op_i.pointee
let ohr = oph_r.pointee
let ohi = oph_i.pointee
let evenreal = or + ohr
let evenim = oi - ohi
let oddreal = oi + ohi
let oddim = ohr - or
let _r = oddreal * _cos1 - oddim * _sin1
let _i = oddreal * _sin1 + oddim * _cos1
op_r.pointee = 0.5 * (evenreal + _r)
op_i.pointee = 0.5 * (_i + evenim)
oph_r.pointee = 0.5 * (evenreal - _r)
oph_i.pointee = 0.5 * (_i - evenim)
let _c1 = _cos * _cos1 - _sin * _sin1
let _s1 = _cos * _sin1 + _sin * _cos1
_cos1 = _c1
_sin1 = _s1
}
}
@inlinable
@inline(__always)
public func HalfRadix2CooleyTukey<T: BinaryFloatingPoint>(_ log2n: Int, _ input: UnsafePointer<T>, _ in_stride: Int, _ in_count: Int, _ out_real: UnsafeMutablePointer<T>, _ out_imag: UnsafeMutablePointer<T>, _ out_stride: Int) where T: ElementaryFunctions {
let length = 1 << log2n
let half = length >> 1
if _slowPath(in_count == 0) {
var out_real = out_real
var out_imag = out_imag
for _ in 0..<half {
out_real.pointee = 0
out_imag.pointee = 0
out_real += out_stride
out_imag += out_stride
}
return
}
switch log2n {
case 0:
out_real.pointee = in_count == 0 ? 0 : input.pointee
out_imag.pointee = 0
case 1:
half_cooleytukey_forward_2(input, in_stride, in_count, out_real, out_imag)
case 2:
half_cooleytukey_forward_4(input, in_stride, in_count, out_real, out_imag, out_stride)
case 3:
half_cooleytukey_forward_8(input, in_stride, in_count, out_real, out_imag, out_stride)
case 4:
half_cooleytukey_forward_16(input, in_stride, in_count, out_real, out_imag, out_stride)
default:
let _in_count = in_count >> 1
cooleytukey_forward(log2n - 1, input, input + in_stride, in_stride << 1, (_in_count + in_count & 1, _in_count), out_real, out_imag, out_stride)
cooleytukey_twiddling(log2n, out_real, out_imag, out_stride)
}
}
@inlinable
@inline(__always)
public func HalfRadix2CooleyTukey<T: BinaryFloatingPoint>(_ log2n: Int, _ buffer: UnsafeMutablePointer<T>, _ stride: Int) where T: ElementaryFunctions {
switch log2n {
case 0: break
case 1:
half_cooleytukey_forward_2(buffer, stride, 1, buffer, buffer + stride)
case 2:
half_cooleytukey_forward_4(buffer, stride, 2, buffer, buffer + stride, stride << 1)
case 3:
half_cooleytukey_forward_8(buffer, stride, 4, buffer, buffer + stride, stride << 1)
case 4:
half_cooleytukey_forward_16(buffer, stride, 8, buffer, buffer + stride, stride << 1)
default:
Radix2CooleyTukey(log2n - 1, buffer, buffer + stride, stride << 1)
cooleytukey_twiddling(log2n, buffer, buffer + stride, stride << 1)
}
}
| 34.918367 | 257 | 0.638028 |
0cac9d083e4dfd2daccd29d3da4102e79f646255 | 1,919 | py | Python | neurovault/apps/statmaps/tests/test_qa.py | abitrolly/NeuroVault | e62bc65c8e0e58bff55bb9fa7cf11193dc54d734 | [
"MIT"
] | 68 | 2015-02-07T06:09:49.000Z | 2022-03-03T22:58:33.000Z | neurovault/apps/statmaps/tests/test_qa.py | abitrolly/NeuroVault | e62bc65c8e0e58bff55bb9fa7cf11193dc54d734 | [
"MIT"
] | 436 | 2015-01-01T01:01:13.000Z | 2021-11-07T18:24:00.000Z | neurovault/apps/statmaps/tests/test_qa.py | abitrolly/NeuroVault | e62bc65c8e0e58bff55bb9fa7cf11193dc54d734 | [
"MIT"
] | 60 | 2015-01-10T23:31:26.000Z | 2021-08-10T06:39:57.000Z | import os
import nibabel as nb
import numpy as np
from django.test import TestCase
from neurovault.apps.statmaps.models import BaseStatisticMap
from neurovault.apps.statmaps.utils import is_thresholded, infer_map_type
class QATest(TestCase):
def setUp(self):
this_path = os.path.abspath(os.path.dirname(__file__))
self.brain = nb.load(os.path.join(this_path, "../static", "anatomical", "MNI152.nii.gz"))
self.roi_map = nb.load(os.path.join(this_path, "test_data", "statmaps", "WA3.nii.gz"))
self.parcellation = nb.load(os.path.join(this_path, "test_data", "TTatlas.nii.gz"))
# We will fill in brain mask with this percentage of randomly placed values
self.ratios = [0.0,0.1,0.15,0.2,0.25,0.3,0.4,0.5,0.6,0.96, 0.98]
self.thresholded = [False,False,False,False,False,False,False,False,False,True,True]
def testThresholded(self):
for p,t in zip(self.ratios, self.thresholded):
empty_data = np.ones(self.brain.shape)
if p != 0.0:
number_voxels = int(np.floor(p * empty_data.size))
random_idx = np.random.choice(range(empty_data.size), number_voxels, replace=False)
empty_data[np.unravel_index(random_idx, empty_data.shape)] = 0
empty_nii = nb.Nifti1Image(empty_data,affine=self.brain.get_affine(),header=self.brain.get_header())
is_thr, ratio_bad = is_thresholded(nii_obj=empty_nii)
print "Zeroed %s of values, is_thresholded returns [%s:%s]" %(p,is_thr,ratio_bad)
self.assertAlmostEqual(p, ratio_bad, delta=0.001)
self.assertEquals(t, is_thr)
def testInferMapType(self):
self.assertEquals(infer_map_type(self.roi_map), BaseStatisticMap.R)
self.assertEquals(infer_map_type(self.parcellation), BaseStatisticMap.Pa)
self.assertEquals(infer_map_type(self.brain), BaseStatisticMap.OTHER) | 50.5 | 112 | 0.684211 |
ffec024ea62f7a2f33f638f30b1fb3ca3d0e90b4 | 1,111 | html | HTML | front-end/src/app/user/user-list/user-list.component.html | cismael/SpringBootAngularApp | 30bcf58b73cead0a1c5ebb0269f02d2f1ccbb4b5 | [
"MIT"
] | null | null | null | front-end/src/app/user/user-list/user-list.component.html | cismael/SpringBootAngularApp | 30bcf58b73cead0a1c5ebb0269f02d2f1ccbb4b5 | [
"MIT"
] | 37 | 2021-07-23T23:52:46.000Z | 2022-03-26T16:15:32.000Z | front-end/src/app/user/user-list/user-list.component.html | cismael/SpringBootAngularApp | 30bcf58b73cead0a1c5ebb0269f02d2f1ccbb4b5 | [
"MIT"
] | null | null | null | <div class="container">
<div class="row">
<div class="col">
<section>
<header class="header">
<div class="row">
<div class="col-md-4">
<h1>Users</h1>
</div>
<div class="col-md-6"></div>
<div class="col-md-2">
<button type="button" class="btn btn-primary" (click)="redirectNewUserPage()">New User</button>
</div>
</div>
</header>
</section>
<section class="main">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>email</th>
<th></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let user of users">
<th scope="row">{{user.id}}</th>
<td>{{user.firstName}}</td>
<td>{{user.lastName}}</td>
<td>{{user.email}}</td>
<td>
<button type="button" class="btn btn-success" (click)="editUserPage(user)">Edit</button>
<button type="button" class="btn btn-danger" (click)="deleteUser(user)">Delete</button>
</td>
</tr>
</tbody>
</table>
</section>
</div>
</div>
</div> | 23.638298 | 102 | 0.50315 |
40cd1a081ca325a5df2b21534eab530a41f3836a | 32,170 | html | HTML | docs/file/packages/core/src/temporal/TemporalQueries.js.html | leejaycoke/js-joda | ff835c3a96128d99f9b75b5a168039517090d89e | [
"BSD-3-Clause"
] | null | null | null | docs/file/packages/core/src/temporal/TemporalQueries.js.html | leejaycoke/js-joda | ff835c3a96128d99f9b75b5a168039517090d89e | [
"BSD-3-Clause"
] | 9 | 2021-09-02T19:41:49.000Z | 2022-03-02T10:26:23.000Z | docs/file/packages/core/src/temporal/TemporalQueries.js.html | leejaycoke/js-joda | ff835c3a96128d99f9b75b5a168039517090d89e | [
"BSD-3-Clause"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../../../">
<title data-ice="title">packages/core/src/temporal/TemporalQueries.js | js-joda</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="Immutable date and time library for JavaScript"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="js-joda"><meta property="twitter:description" content="Immutable date and time library for JavaScript"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./">Home</a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/js-joda/js-joda"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#core-src">core/src</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/Clock.js~Clock.html">Clock</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/DayOfWeek.js~DayOfWeek.html">DayOfWeek</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/Duration.js~Duration.html">Duration</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/Enum.js~Enum.html">Enum</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/Instant.js~Instant.html">Instant</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/LocalDate.js~LocalDate.html">LocalDate</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/LocalDateTime.js~LocalDateTime.html">LocalDateTime</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/LocalTime.js~LocalTime.html">LocalTime</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/MathUtil.js~MathUtil.html">MathUtil</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/Month.js~Month.html">Month</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/MonthDay.js~MonthDay.html">MonthDay</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/OffsetDateTime.js~OffsetDateTime.html">OffsetDateTime</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/OffsetTime.js~OffsetTime.html">OffsetTime</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/Period.js~Period.html">Period</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/Year.js~Year.html">Year</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/YearConstants.js~YearConstants.html">YearConstants</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/YearMonth.js~YearMonth.html">YearMonth</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/ZoneId.js~ZoneId.html">ZoneId</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/ZoneOffset.js~ZoneOffset.html">ZoneOffset</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/ZoneRegion.js~ZoneRegion.html">ZoneRegion</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/ZonedDateTime.js~ZonedDateTime.html">ZonedDateTime</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-abstractMethodFail">abstractMethodFail</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-assert">assert</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-requireInstance">requireInstance</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-requireNonNull">requireNonNull</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-convert">convert</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-bindUse">bindUse</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-MAX_SAFE_INTEGER">MAX_SAFE_INTEGER</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-MIN_SAFE_INTEGER">MIN_SAFE_INTEGER</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-ArithmeticException">ArithmeticException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-DateTimeException">DateTimeException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-DateTimeParseException">DateTimeParseException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-IllegalArgumentException">IllegalArgumentException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-IllegalStateException">IllegalStateException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-NullPointerException">NullPointerException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-UnsupportedTemporalTypeException">UnsupportedTemporalTypeException</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-use">use</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#core-src-chrono">core/src/chrono</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/chrono/ChronoLocalDate.js~ChronoLocalDate.html">ChronoLocalDate</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/chrono/ChronoLocalDateTime.js~ChronoLocalDateTime.html">ChronoLocalDateTime</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/chrono/ChronoZonedDateTime.js~ChronoZonedDateTime.html">ChronoZonedDateTime</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/chrono/IsoChronology.js~IsoChronology.html">IsoChronology</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#core-src-format">core/src/format</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/format/DateTimeFormatter.js~DateTimeFormatter.html">DateTimeFormatter</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/format/DateTimeFormatterBuilder.js~DateTimeFormatterBuilder.html">DateTimeFormatterBuilder</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/format/DecimalStyle.js~DecimalStyle.html">DecimalStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/format/ResolverStyle.js~ResolverStyle.html">ResolverStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/format/SignStyle.js~SignStyle.html">SignStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/format/TextStyle.js~TextStyle.html">TextStyle</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#core-src-temporal">core/src/temporal</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/ChronoField.js~ChronoField.html">ChronoField</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/ChronoUnit.js~ChronoUnit.html">ChronoUnit</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/DefaultInterfaceTemporal.js~DefaultInterfaceTemporal.html">DefaultInterfaceTemporal</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/TemporalAccessor.js~TemporalAccessor.html">TemporalAccessor</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/TemporalAdjusters.js~TemporalAdjusters.html">TemporalAdjusters</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/TemporalQueries.js~TemporalQueries.html">TemporalQueries</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/ValueRange.js~ValueRange.html">ValueRange</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-interface">I</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/Temporal.js~Temporal.html">Temporal</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-interface">I</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/TemporalAdjuster.js~TemporalAdjuster.html">TemporalAdjuster</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-interface">I</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/TemporalAmount.js~TemporalAmount.html">TemporalAmount</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-interface">I</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/TemporalField.js~TemporalField.html">TemporalField</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-interface">I</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/TemporalQuery.js~TemporalQuery.html">TemporalQuery</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-interface">I</span><span data-ice="name"><span><a href="class/packages/core/src/temporal/TemporalUnit.js~TemporalUnit.html">TemporalUnit</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-nativeJs">nativeJs</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createTemporalQuery">createTemporalQuery</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-IsoFields">IsoFields</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#core-src-zone">core/src/zone</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/zone/SystemDefaultZoneId.js~SystemDefaultZoneId.html">SystemDefaultZoneId</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/zone/SystemDefaultZoneRules.js~SystemDefaultZoneRules.html">SystemDefaultZoneRules</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/zone/ZoneOffsetTransition.js~ZoneOffsetTransition.html">ZoneOffsetTransition</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/zone/ZoneRules.js~ZoneRules.html">ZoneRules</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/core/src/zone/ZoneRulesProvider.js~ZoneRulesProvider.html">ZoneRulesProvider</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#extra-src">extra/src</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/extra/src/Interval.js~Interval.html">Interval</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-abstractMethodFail">abstractMethodFail</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-assert">assert</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-requireInstance">requireInstance</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-requireNonNull">requireNonNull</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-plug">plug</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#locale-src">locale/src</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/locale/src/Locale.js~Locale.html">Locale</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-plug">plug</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#locale-src-format">locale/src/format</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/locale/src/format/LocaleDateTimeFormatter.js~LocaleDateTimeFormatter.html">LocaleDateTimeFormatter</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/locale/src/format/LocaleStore.js~LocaleStore.html">LocaleStore</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createEntry">createEntry</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#locale-src-format-cldr">locale/src/format/cldr</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/locale/src/format/cldr/CldrDateTimeFormatterBuilder.js~CldrDateTimeFormatterBuilder.html">CldrDateTimeFormatterBuilder</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/locale/src/format/cldr/CldrZoneTextPrinterParser.js~CldrZoneTextPrinterParser.html">CldrZoneTextPrinterParser</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getOrCreateCldrInstance">getOrCreateCldrInstance</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getOrCreateMapZones">getOrCreateMapZones</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-loadCldrData">loadCldrData</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#locale-src-format-parser">locale/src/format/parser</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/locale/src/format/parser/WeekFieldsPrinterParser.js~WeekFieldsPrinterParser.html">WeekFieldsPrinterParser</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#locale-src-temporal">locale/src/temporal</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/locale/src/temporal/WeekFields.js~ComputedDayOfField.html">ComputedDayOfField</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/locale/src/temporal/WeekFields.js~WeekFields.html">WeekFields</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#timezone-src">timezone/src</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/timezone/src/MomentZoneRules.js~MomentZoneRules.html">MomentZoneRules</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/packages/timezone/src/MomentZoneRulesProvider.js~MomentZoneRulesProvider.html">MomentZoneRulesProvider</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-autoPlug">autoPlug</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-plug">plug</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-extendSystemDefaultZoneId">extendSystemDefaultZoneId</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-unpack">unpack</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">packages/core/src/temporal/TemporalQueries.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">/**
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
* @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
*/
/**
* Common implementations of {@link TemporalQuery}.
*
* This class provides common implementations of {@link TemporalQuery}.
* These queries are primarily used as optimizations, allowing the internals
* of other objects to be extracted effectively. Note that application code
* can also use the {@link from} method on most temporal
* objects as a method reference matching the query interface, such as
* {@link LocalDate::from} and {@link ZoneId::from}.
*
* There are two equivalent ways of using a {@link TemporalQuery}.
* The first is to invoke the method on the interface directly.
* The second is to use {@link TemporalAccessor#query}:
* <pre>
* // these two lines are equivalent, but the second approach is recommended
* dateTime = query.queryFrom(dateTime);
* dateTime = dateTime.query(query);
* </pre>
* It is recommended to use the second approach, {@link query},
* as it is a lot clearer to read in code.
*
*/
export class TemporalQueries {
/**
* A strict query for the {@link ZoneId}.
*
* This queries a {@link TemporalAccessor} for the zone.
* The zone is only returned if the date-time conceptually contains a {@link ZoneId}.
* It will not be returned if the date-time only conceptually has an {@link ZoneOffset}.
* Thus a {@link ZonedDateTime} will return the result of
* {@link getZone}, but an {@link OffsetDateTime} will
* return null.
*
* In most cases, applications should use {@link ZONE} as this query is too strict.
*
* The result from JDK classes implementing {@link TemporalAccessor} is as follows:
* * * {@link LocalDate} returns null
* * {@link LocalTime} returns null
* * {@link LocalDateTime} returns null
* * {@link ZonedDateTime} returns the associated zone
* * {@link OffsetTime} returns null
* * {@link OffsetDateTime} returns null
* * {@link ChronoLocalDate} returns null
* * {@link ChronoLocalDateTime} returns null
* * {@link ChronoZonedDateTime} returns the associated zone
* * {@link Era} returns null
* * {@link DayOfWeek} returns null
* * {@link Month} returns null
* * {@link Year} returns null
* * {@link YearMonth} returns null
* * {@link MonthDay} returns null
* * {@link ZoneOffset} returns null
* * {@link Instant} returns null
*
* @return a query that can obtain the zone ID of a temporal, not null
*/
static zoneId() {
return TemporalQueries.ZONE_ID;
}
/**
* A query for the {@link Chronology}.
*
* This queries a {@link TemporalAccessor} for the chronology.
* If the target {@link TemporalAccessor} represents a date, or part of a date,
* then it should return the chronology that the date is expressed in.
* As a result of this definition, objects only representing time, such as
* {@link LocalTime}, will return null.
*
* The result from js-joda classes implementing {@link TemporalAccessor} is as follows:
*
* * {@link LocalDate} returns * {@link IsoChronology.INSTANCE}
* * {@link LocalTime} returns null (does not represent a date)
* * {@link LocalDateTime} returns * {@link IsoChronology.INSTANCE}
* * {@link ZonedDateTime} returns * {@link IsoChronology.INSTANCE}
* * {@link OffsetTime} returns null (does not represent a date)
* * {@link OffsetDateTime} returns * {@link IsoChronology.INSTANCE}
* * {@link ChronoLocalDate} returns the associated chronology
* * {@link ChronoLocalDateTime} returns the associated chronology
* * {@link ChronoZonedDateTime} returns the associated chronology
* * {@link Era} returns the associated chronology
* * {@link DayOfWeek} returns null (shared across chronologies)
* * {@link Month} returns * {@link IsoChronology.INSTANCE}
* * {@link Year} returns * {@link IsoChronology.INSTANCE}
* * {@link YearMonth} returns * {@link IsoChronology.INSTANCE}
* * {@link MonthDay} returns null * {@link IsoChronology.INSTANCE}
* * {@link ZoneOffset} returns null (does not represent a date)
* * {@link Instant} returns null (does not represent a date)
*
* The method {@link Chronology#from} can be used as a
* {@link TemporalQuery}
* That method is equivalent to this query, except that it throws an
* exception if a chronology cannot be obtained.
*
* @return {TemporalQuery} a query that can obtain the chronology of a temporal, not null
*/
static chronology() {
return TemporalQueries.CHRONO;
}
/**
* A query for the smallest supported unit.
*
* This queries a {@link TemporalAccessor} for the time precision.
* If the target {@link TemporalAccessor} represents a consistent or complete date-time,
* date or time then this must return the smallest precision actually supported.
* Note that fields such as {@link NANO_OF_DAY} and {@link NANO_OF_SECOND}
* are defined to always return ignoring the precision, thus this is the only
* way to find the actual smallest supported unit.
* For example, were {@link GregorianCalendar} to implement {@link TemporalAccessor}
* it would return a precision of {@link MILLIS}.
*
* The result from js-joda classes implementing {@link TemporalAccessor} is as follows:
*
* {@link LocalDate} returns {@link DAYS}
* {@link LocalTime} returns {@link NANOS}
* {@link LocalDateTime} returns {@link NANOS}
* {@link ZonedDateTime} returns {@link NANOS}
* {@link OffsetTime} returns {@link NANOS}
* {@link OffsetDateTime} returns {@link NANOS}
* {@link ChronoLocalDate} returns {@link DAYS}
* {@link ChronoLocalDateTime} returns {@link NANOS}
* {@link ChronoZonedDateTime} returns {@link NANOS}
* {@link Era} returns {@link ERAS}
* {@link DayOfWeek} returns {@link DAYS}
* {@link Month} returns {@link MONTHS}
* {@link Year} returns {@link YEARS}
* {@link YearMonth} returns {@link MONTHS}
* {@link MonthDay} returns null (does not represent a complete date or time)
* {@link ZoneOffset} returns null (does not represent a date or time)
* {@link Instant} returns {@link NANOS}
*
* @return a query that can obtain the precision of a temporal, not null
*/
static precision() {
return TemporalQueries.PRECISION;
}
/**
* A lenient query for the {@link ZoneId}, falling back to the {@link ZoneOffset}.
*
* This queries a {@link TemporalAccessor} for the zone.
* It first tries to obtain the zone, using {@link zoneId}.
* If that is not found it tries to obtain the {@link offset}.
*
* In most cases, applications should use this query rather than {@link zoneId}.
*
* This query examines the {@link ChronoField#OFFSET_SECONDS}
* field and uses it to create a {@link ZoneOffset}.
*
* The method {@link ZoneId#from} can be used as a
* {@link TemporalQuery} via a method reference, {@link ZoneId::from}.
* That method is equivalent to this query, except that it throws an
* exception if a zone cannot be obtained.
*
* @return a query that can obtain the zone ID or offset of a temporal, not null
*/
static zone() {
return TemporalQueries.ZONE;
}
/**
* A query for {@link ZoneOffset} returning null if not found.
*
* This returns a {@link TemporalQuery} that can be used to query a temporal
* object for the offset. The query will return null if the temporal
* object cannot supply an offset.
*
* The query implementation examines the {@link ChronoField#OFFSET_SECONDS}
* field and uses it to create a {@link ZoneOffset}.
*
* The method {@link java.time.ZoneOffset#from} can be used as a
* {@link TemporalQuery} via a method reference, {@link ZoneOffset::from}.
* This query and {@link ZoneOffset::from} will return the same result if the
* temporal object contains an offset. If the temporal object does not contain
* an offset, then the method reference will throw an exception, whereas this
* query will return null.
*
* @return a query that can obtain the offset of a temporal, not null
*/
static offset() {
return TemporalQueries.OFFSET;
}
/**
* A query for {@link LocalDate} returning null if not found.
*
* This returns a {@link TemporalQuery} that can be used to query a temporal
* object for the local date. The query will return null if the temporal
* object cannot supply a local date.
*
* The query implementation examines the {@link ChronoField#EPOCH_DAY}
* field and uses it to create a {@link LocalDate}.
*
* @return a query that can obtain the date of a temporal, not null
*/
static localDate() {
return TemporalQueries.LOCAL_DATE;
}
/**
* A query for {@link LocalTime} returning null if not found.
*
* This returns a {@link TemporalQuery} that can be used to query a temporal
* object for the local time. The query will return null if the temporal
* object cannot supply a local time.
*
* The query implementation examines the {@link ChronoField#NANO_OF_DAY}
* field and uses it to create a {@link LocalTime}.
*
* @return a query that can obtain the time of a temporal, not null
*/
static localTime() {
return TemporalQueries.LOCAL_TIME;
}
}
</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
| 86.945946 | 377 | 0.703855 |
5f8e89c38bea8674633d47212c9659bbea313af6 | 11,321 | h | C | source/extensions/common/tap/tap_matcher.h | jaricftw/envoy | 766f3fb8dbdafce402631c43c16fda46ed003462 | [
"Apache-2.0"
] | 1 | 2021-12-10T23:58:57.000Z | 2021-12-10T23:58:57.000Z | source/extensions/common/tap/tap_matcher.h | jaricftw/envoy | 766f3fb8dbdafce402631c43c16fda46ed003462 | [
"Apache-2.0"
] | 30 | 2022-02-17T02:28:37.000Z | 2022-03-31T02:31:02.000Z | source/extensions/common/tap/tap_matcher.h | jaricftw/envoy | 766f3fb8dbdafce402631c43c16fda46ed003462 | [
"Apache-2.0"
] | 1 | 2020-03-28T12:23:29.000Z | 2020-03-28T12:23:29.000Z | #pragma once
#include "envoy/service/tap/v2alpha/common.pb.h"
#include "common/http/header_utility.h"
namespace Envoy {
namespace Extensions {
namespace Common {
namespace Tap {
class Matcher;
using MatcherPtr = std::unique_ptr<Matcher>;
/**
* Base class for all tap matchers.
*
* A high level note on the design of tap matching which is different from other matching in Envoy
* due to a requirement to support streaming matching (match as new data arrives versus
* calculating the match given all available data at once).
* - The matching system is composed of a constant matching configuration. This is essentially
* a tree of matchers given logical AND, OR, NOT, etc.
* - A per-stream/request matching status must be kept in order to compute interim match status.
* - In order to make this computationally efficient, the matching tree is kept in a vector, with
* all references to other matchers implemented using an index into the vector. The vector is
* effectively a preorder traversal flattened N-ary tree.
* - The previous point allows the creation of a per-stream/request vector of match statuses of
* the same size as the matcher vector. Then, when match status is updated given new
* information, the vector of match statuses can be easily updated using the same indexes as in
* the constant match configuration.
* - Finally, a matches() function can be trivially implemented by looking in the status vector at
* the index position that the current matcher is located in.
*/
class Matcher {
public:
struct MatchStatus {
bool operator==(const MatchStatus& rhs) const {
return matches_ == rhs.matches_ && might_change_status_ == rhs.might_change_status_;
}
bool matches_{false}; // Does the matcher currently match?
bool might_change_status_{true}; // Is it possible for matches_ to change in subsequent updates?
};
using MatchStatusVector = std::vector<MatchStatus>;
/**
* Base class constructor for a matcher.
* @param matchers supplies the match tree vector being built.
*/
Matcher(const std::vector<MatcherPtr>& matchers)
// NOTE: This code assumes that the index for the matcher being constructed has already been
// allocated, which is why my_index_ is set to size() - 1. See buildMatcher() in
// tap_matcher.cc.
: my_index_(matchers.size() - 1) {}
virtual ~Matcher() = default;
/**
* @return the matcher's index in the match tree vector (see above).
*/
size_t index() { return my_index_; }
/**
* Update match status when a stream is created. This might be an HTTP stream, a TCP connection,
* etc. This allows any matchers to flip to an initial state of true if applicable.
*/
virtual void onNewStream(MatchStatusVector& statuses) const PURE;
/**
* Update match status given HTTP request headers.
* @param request_headers supplies the request headers.
* @param statuses supplies the per-stream-request match status vector which must be the same
* size as the match tree vector (see above).
*/
virtual void onHttpRequestHeaders(const Http::HeaderMap& request_headers,
MatchStatusVector& statuses) const PURE;
/**
* Update match status given HTTP request trailers.
* @param request_trailers supplies the request trailers.
* @param statuses supplies the per-stream-request match status vector which must be the same
* size as the match tree vector (see above).
*/
virtual void onHttpRequestTrailers(const Http::HeaderMap& request_trailers,
MatchStatusVector& statuses) const PURE;
/**
* Update match status given HTTP response headers.
* @param response_headers supplies the response headers.
* @param statuses supplies the per-stream-request match status vector which must be the same
* size as the match tree vector (see above).
*/
virtual void onHttpResponseHeaders(const Http::HeaderMap& response_headers,
MatchStatusVector& statuses) const PURE;
/**
* Update match status given HTTP response trailers.
* @param response_headers supplies the response trailers.
* @param statuses supplies the per-stream-request match status vector which must be the same
* size as the match tree vector (see above).
*/
virtual void onHttpResponseTrailers(const Http::HeaderMap& response_trailers,
MatchStatusVector& statuses) const PURE;
/**
* @return whether given currently available information, the matcher matches.
* @param statuses supplies the per-stream-request match status vector which must be the same
* size as the match tree vector (see above).
*/
MatchStatus matchStatus(const MatchStatusVector& statuses) const { return statuses[my_index_]; }
protected:
const size_t my_index_;
};
/**
* Factory method to build a matcher given a match config. Calling this function may end
* up recursively building many matchers, which will all be added to the passed in vector
* of matchers. See the comments in tap.h for the general structure of how tap matchers work.
*/
void buildMatcher(const envoy::service::tap::v2alpha::MatchPredicate& match_config,
std::vector<MatcherPtr>& matchers);
/**
* Base class for logic matchers that need to forward update calls to child matchers.
*/
class LogicMatcherBase : public Matcher {
public:
using Matcher::Matcher;
// Extensions::Common::Tap::Matcher
void onNewStream(MatchStatusVector& statuses) const override {
updateLocalStatus(statuses,
[](Matcher& m, MatchStatusVector& statuses) { m.onNewStream(statuses); });
}
void onHttpRequestHeaders(const Http::HeaderMap& request_headers,
MatchStatusVector& statuses) const override {
updateLocalStatus(statuses, [&request_headers](Matcher& m, MatchStatusVector& statuses) {
m.onHttpRequestHeaders(request_headers, statuses);
});
}
void onHttpRequestTrailers(const Http::HeaderMap& request_trailers,
MatchStatusVector& statuses) const override {
updateLocalStatus(statuses, [&request_trailers](Matcher& m, MatchStatusVector& statuses) {
m.onHttpRequestTrailers(request_trailers, statuses);
});
}
void onHttpResponseHeaders(const Http::HeaderMap& response_headers,
MatchStatusVector& statuses) const override {
updateLocalStatus(statuses, [&response_headers](Matcher& m, MatchStatusVector& statuses) {
m.onHttpResponseHeaders(response_headers, statuses);
});
}
void onHttpResponseTrailers(const Http::HeaderMap& response_trailers,
MatchStatusVector& statuses) const override {
updateLocalStatus(statuses, [&response_trailers](Matcher& m, MatchStatusVector& statuses) {
m.onHttpResponseTrailers(response_trailers, statuses);
});
}
protected:
using UpdateFunctor = std::function<void(Matcher&, MatchStatusVector&)>;
virtual void updateLocalStatus(MatchStatusVector& statuses,
const UpdateFunctor& functor) const PURE;
};
/**
* Matcher for implementing set logic.
*/
class SetLogicMatcher : public LogicMatcherBase {
public:
enum class Type { And, Or };
SetLogicMatcher(const envoy::service::tap::v2alpha::MatchPredicate::MatchSet& configs,
std::vector<MatcherPtr>& matchers, Type type);
private:
void updateLocalStatus(MatchStatusVector& statuses, const UpdateFunctor& functor) const override;
std::vector<MatcherPtr>& matchers_;
std::vector<size_t> indexes_;
const Type type_;
};
/**
* Not matcher.
*/
class NotMatcher : public LogicMatcherBase {
public:
NotMatcher(const envoy::service::tap::v2alpha::MatchPredicate& config,
std::vector<MatcherPtr>& matchers);
private:
void updateLocalStatus(MatchStatusVector& statuses, const UpdateFunctor& functor) const override;
std::vector<MatcherPtr>& matchers_;
const size_t not_index_;
};
/**
* A base class for a matcher that generally wants to return default values, but might override
* a single update function.
*/
class SimpleMatcher : public Matcher {
public:
using Matcher::Matcher;
// Extensions::Common::Tap::Matcher
void onNewStream(MatchStatusVector&) const override {}
void onHttpRequestHeaders(const Http::HeaderMap&, MatchStatusVector&) const override {}
void onHttpRequestTrailers(const Http::HeaderMap&, MatchStatusVector&) const override {}
void onHttpResponseHeaders(const Http::HeaderMap&, MatchStatusVector&) const override {}
void onHttpResponseTrailers(const Http::HeaderMap&, MatchStatusVector&) const override {}
};
/**
* Any matcher (always matches).
*/
class AnyMatcher : public SimpleMatcher {
public:
using SimpleMatcher::SimpleMatcher;
// Extensions::Common::Tap::Matcher
void onNewStream(MatchStatusVector& statuses) const override {
statuses[my_index_].matches_ = true;
statuses[my_index_].might_change_status_ = false;
}
};
/**
* Base class for the various HTTP header matchers.
*/
class HttpHeaderMatcherBase : public SimpleMatcher {
public:
HttpHeaderMatcherBase(const envoy::service::tap::v2alpha::HttpHeadersMatch& config,
const std::vector<MatcherPtr>& matchers);
protected:
void matchHeaders(const Http::HeaderMap& headers, MatchStatusVector& statuses) const;
const std::vector<Http::HeaderUtility::HeaderDataPtr> headers_to_match_;
};
/**
* HTTP request headers matcher.
*/
class HttpRequestHeadersMatcher : public HttpHeaderMatcherBase {
public:
using HttpHeaderMatcherBase::HttpHeaderMatcherBase;
// Extensions::Common::Tap::Matcher
void onHttpRequestHeaders(const Http::HeaderMap& request_headers,
MatchStatusVector& statuses) const override {
matchHeaders(request_headers, statuses);
}
};
/**
* HTTP request trailers matcher.
*/
class HttpRequestTrailersMatcher : public HttpHeaderMatcherBase {
public:
using HttpHeaderMatcherBase::HttpHeaderMatcherBase;
// Extensions::Common::Tap::Matcher
void onHttpRequestTrailers(const Http::HeaderMap& request_trailers,
MatchStatusVector& statuses) const override {
matchHeaders(request_trailers, statuses);
}
};
/**
* HTTP response headers matcher.
*/
class HttpResponseHeadersMatcher : public HttpHeaderMatcherBase {
public:
using HttpHeaderMatcherBase::HttpHeaderMatcherBase;
// Extensions::Common::Tap::Matcher
void onHttpResponseHeaders(const Http::HeaderMap& response_headers,
MatchStatusVector& statuses) const override {
matchHeaders(response_headers, statuses);
}
};
/**
* HTTP response trailers matcher.
*/
class HttpResponseTrailersMatcher : public HttpHeaderMatcherBase {
public:
using HttpHeaderMatcherBase::HttpHeaderMatcherBase;
// Extensions::Common::Tap::Matcher
void onHttpResponseTrailers(const Http::HeaderMap& response_trailers,
MatchStatusVector& statuses) const override {
matchHeaders(response_trailers, statuses);
}
};
} // namespace Tap
} // namespace Common
} // namespace Extensions
} // namespace Envoy
| 37.118033 | 100 | 0.714336 |
3f58a6b173c58487b34faaafe5c19a619d3ed133 | 368 | sql | SQL | sql_templates/insert_genelist.sql | Duke-GCB/PredictionsDB | 066278425890288d9e430a46096a347453301b08 | [
"MIT"
] | null | null | null | sql_templates/insert_genelist.sql | Duke-GCB/PredictionsDB | 066278425890288d9e430a46096a347453301b08 | [
"MIT"
] | 57 | 2016-09-16T15:23:49.000Z | 2021-09-07T15:20:22.000Z | sql_templates/insert_genelist.sql | Duke-GCB/PredictionsDB | 066278425890288d9e430a46096a347453301b08 | [
"MIT"
] | 1 | 2016-09-09T20:03:48.000Z | 2016-09-09T20:03:48.000Z | {# fill gene table in a particular schema with data from another we downloaded #}
insert into {{schema_prefix}}.gene(gene_list, name, common_name, chrom, strand, txstart, txend, gene_begin)
select '{{source_table}}', name, {{common_name}}, chrom, strand, txstart, txend, case strand when '+' then txstart else txend end
from {{schema_prefix}}.{{source_table}};
| 61.333333 | 131 | 0.730978 |
d25bde476c8c2d672062cd1896546c950381f929 | 276 | php | PHP | app/Models/Contrat.php | awa98/gestion_cnee | 261c447aafc762777460d88377ce844ba3c635ae | [
"MIT"
] | null | null | null | app/Models/Contrat.php | awa98/gestion_cnee | 261c447aafc762777460d88377ce844ba3c635ae | [
"MIT"
] | null | null | null | app/Models/Contrat.php | awa98/gestion_cnee | 261c447aafc762777460d88377ce844ba3c635ae | [
"MIT"
] | null | null | null | <?php
namespace App\Models;
class Contrat extends Eloquent {
protected $table = 'contrats';
public $timestamps = true;
protected $fillable = array('duree', 'date_debut', 'date_fin');
public function entreprises()
{
return $this->hasMany('App\Models\Contrat');
}
} | 17.25 | 64 | 0.699275 |
bfd572ebc8821c6f6b780052980a6b1a9fe33875 | 915 | rs | Rust | common/examples/lowlevel_1.rs | RCasatta/rust-clightning-rpc | 491dca79871c7450d0dc0d4fbf35706f7f01a9d4 | [
"CC0-1.0"
] | null | null | null | common/examples/lowlevel_1.rs | RCasatta/rust-clightning-rpc | 491dca79871c7450d0dc0d4fbf35706f7f01a9d4 | [
"CC0-1.0"
] | null | null | null | common/examples/lowlevel_1.rs | RCasatta/rust-clightning-rpc | 491dca79871c7450d0dc0d4fbf35706f7f01a9d4 | [
"CC0-1.0"
] | null | null | null | extern crate clightningrpc_common;
use serde::{Deserialize, Serialize};
use std::env;
use clightningrpc_common::client;
use clightningrpc_common::types::Response;
/// Example of type definition
#[derive(Debug, Clone, Deserialize, Serialize)]
struct GetInfoResponse {
pub id: String,
}
/// Example of type definition
#[derive(Debug, Clone, Deserialize, Serialize)]
struct GetInfoRequest {}
fn main() {
let sock = env::home_dir().unwrap().join(".lightning/lightning-rpc");
println!("Using socket {}", sock.display());
let client = client::Client::new(&sock);
let method = "getinfo";
let params = GetInfoRequest {};
match client
.send_request(method, params)
.and_then(|res: Response<GetInfoResponse>| res.into_result())
{
Ok(d) => {
println!("Ok! {:?}", d);
}
Err(e) => {
println!("Error! {}", e);
}
}
}
| 24.72973 | 73 | 0.619672 |
da1858baeec95a8b92f5723caa971485eaaa5a1f | 83 | sql | SQL | fixtures/tests/backend/data/sql/mv_flood_event_world_pop_village_summary.sql | meomancer/inasafe-fba | 7a05cf09795c366afdc2885bcee5777a4a731cd8 | [
"MIT"
] | 1 | 2020-12-01T14:42:12.000Z | 2020-12-01T14:42:12.000Z | fixtures/tests/backend/data/sql/mv_flood_event_world_pop_village_summary.sql | meomancer/inasafe-fba | 7a05cf09795c366afdc2885bcee5777a4a731cd8 | [
"MIT"
] | 50 | 2020-01-10T07:44:34.000Z | 2020-05-27T12:00:52.000Z | fixtures/tests/backend/data/sql/mv_flood_event_world_pop_village_summary.sql | meomancer/inasafe-fba | 7a05cf09795c366afdc2885bcee5777a4a731cd8 | [
"MIT"
] | 7 | 2020-01-13T08:45:42.000Z | 2020-12-07T06:37:11.000Z | select * from mv_flood_event_world_pop_village_summary where flood_event_id = 257;
| 41.5 | 82 | 0.86747 |
74717299cfcca474a862b84c076a0eb0049fe611 | 21,653 | c | C | src/measure_seeing.c | marissakotze/timDIMM | dde00a3bb6ca7c3d9b71e24f9363350a0e2a323f | [
"BSD-3-Clause"
] | 1 | 2021-06-06T15:26:36.000Z | 2021-06-06T15:26:36.000Z | src/measure_seeing.c | marissakotze/timDIMM | dde00a3bb6ca7c3d9b71e24f9363350a0e2a323f | [
"BSD-3-Clause"
] | null | null | null | src/measure_seeing.c | marissakotze/timDIMM | dde00a3bb6ca7c3d9b71e24f9363350a0e2a323f | [
"BSD-3-Clause"
] | 3 | 2015-07-29T15:16:35.000Z | 2017-12-01T13:02:36.000Z | #include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <dc1394/dc1394.h>
#include <math.h>
#include <fitsio.h>
#include <gsl/gsl_statistics.h>
#include <xpa.h>
#include <time.h>
#include <sys/time.h>
#include <string.h>
#include <inttypes.h>
#define NXPA 10
typedef struct _Box {
double x;
double y;
double fwhm;
double cenx;
double ceny;
double counts;
double background;
double noise;
double sigmaxythresh;
double snr;
double sigmaxy;
double sigmafwhmthresh;
double sigmafwhm;
double strehl;
double max;
int r;
} Box;
typedef struct _Back {
double x;
double y;
double background;
double sigma;
int r;
int width;
} Back;
Box box[3];
Back back;
long nelements, naxes[2], fpixel;
int boxsize = 17;
/* MASSDIMM values */
/* 20101228: determined DIMM pixel scale to be 1.78"/pixel using HR1866
and HR8895 as astrometric double stars
*/
double pixel_scale = 1.78;
double d = 0.080;
double r = 0.170;
double lambda = 0.6e-6;
double stardist(int i, int j) {
return( sqrt( (box[i].cenx-box[j].cenx)*(box[i].cenx-box[j].cenx) +
(box[i].ceny-box[j].ceny)*(box[i].ceny-box[j].ceny) ) );
}
/* this routine uses a. tokovinin's modified equation given in
2002, PASP, 114, 1156
*/
double seeing(double var) {
double b, K, seeing;
b = r/d;
/* pixel scale in "/pixel, convert to rad */
var = var * pow(pixel_scale/206265.0, 2);
K = 0.364 * (1.0 - 0.532 * pow(b, -1/3) - 0.024 * pow(b, -7/3));
seeing = 206265.0 * 0.98 * pow(d/lambda, 0.2) * pow(var/K, 0.6);
return seeing;
}
/* this routine uses the classic DIMM equation */
double old_seeing(double var) {
double r0;
/* pixel scale in "/pixel, convert to rad */
var = var * pow(pixel_scale/206265.0, 2);
r0 = pow(2.0 * (lambda * lambda) * (
( 0.1790 * pow(d, -1.0/3.0) -
0.0968 * pow(r, -1.0/3.0) ) / var
), 0.6);
// return 206265.0*0.98*lambda/r0;
return r0;
}
/* measure the background in an annulus around the spot pattern */
int background(unsigned char *image, int imwidth, int imheight) {
int i, j, backpix;
int low_y, up_y, low_x, up_x;
double dist, sum, sumsq;
backpix = 0;
sum = 0.0;
sumsq = 0.0;
low_y = back.y - back.r - back.width;
up_y = back.y + back.r + back.width;
low_x = back.x - back.r - back.width;
up_x = back.x + back.r + back.width;
if (low_y < 0) {
low_y = 0;
}
if (up_y >= imheight) {
up_y = imheight;
}
if (low_x < 0) {
low_x = 0;
}
if (up_x >= imwidth) {
up_x = imwidth;
}
for (i=low_y; i<up_y; i++) {
for (j=low_x; j<up_x; j++) {
dist = sqrt(pow(back.x-j, 2) + pow(back.y-i, 2));
if (dist >= back.r && dist <= back.r+back.width) {
sum += image[i*naxes[0]+j];
backpix++;
}
}
}
back.background = sum/backpix;
//back.background = 0.0;
for (i=low_y; i<up_y; i++) {
for (j=low_x; j<up_x; j++) {
dist = sqrt(pow(back.x-j, 2) + pow(back.y-i, 2));
if (dist >= back.r && dist <= back.r+back.width) {
sumsq += (image[i*naxes[0]+j]-back.background)*
(image[i*naxes[0]+j]-back.background);
}
}
}
back.sigma = sqrt(sumsq/backpix);
//back.sigma = 1.0;
return 1;
}
/* measure centroid using center-of-mass algorithm */
int centroid(unsigned char *image, int imwidth, int imheight, int num) {
int i, j;
double max = 0.0;
double sum = 0.0;
double sumx = 0.0;
double sumxx = 0.0;
double sumy = 0.0;
double sumyy = 0.0;
double val = 0.0;
double gain = 0.9;
double rmom;
double dist, dx;
double nsigma = 3.0;
int low_y, up_y, low_x, up_x;
int sourcepix = 0;
dx = pixel_scale/206265.0;
low_y = box[num].y - box[num].r;
up_y = box[num].y + box[num].r;
low_x = box[num].x - box[num].r;
up_x = box[num].x + box[num].r;
if (low_y < 0) {
low_y = 0;
}
if (up_y >= imheight) {
up_y = imheight;
}
if (low_x < 0) {
low_x = 0;
}
if (up_x >= imwidth) {
up_x = imwidth;
}
for (i=low_y; i<up_y; i++) {
for (j=low_x; j<up_x; j++) {
dist = sqrt(pow(box[num].x-j, 2) + pow(box[num].y-i, 2));
if (dist <= box[num].r) {
val = image[i*naxes[0]+j] - back.background;
if (val >= nsigma*back.sigma) {
if (val > max) {
max = val;
}
sum += val;
sumx += val*j;
sumxx += val*j*j;
sumy += val*i;
sumyy += val*i*i;
sourcepix++;
}
}
}
}
if ( sum <= 0.0 ) {
box[num].sigmaxy = -1.0;
box[num].sigmafwhm = -1.0;
box[num].snr = 0.0;
box[num].fwhm = -1.0;
box[num].counts = 1.0;
box[num].strehl = 0.0;
} else {
box[num].max = max;
box[num].strehl = (max/sum)*(4.0/3.14159)*pow( lambda/(d*dx), 2);
rmom = ( sumxx - sumx * sumx / sum + sumyy - sumy * sumy / sum ) / sum;
if ( rmom <= 0 ) {
box[num].fwhm = -1.0;
} else {
box[num].fwhm = sqrt(rmom) * 2.354 / sqrt(2.0);
}
box[num].counts = sum;
box[num].cenx = sumx / sum;
box[num].ceny = sumy / sum;
box[num].noise = back.sigma*sourcepix;
box[num].x += gain*(box[num].cenx - box[num].x);
box[num].y += gain*(box[num].ceny - box[num].y);
box[num].snr = sum/sqrt(box[num].noise*box[num].noise + sum);
box[num].sigmaxy = 1.0 / box[num].snr / sqrt(6.0);
box[num].sigmafwhm = back.sigma * pow(sourcepix,1.5) / 10.
/ box[num].fwhm / box[num].counts
* 2.354 * 2.354 / 2.0;
}
return 1;
}
int grab_frame(dc1394camera_t *c, unsigned char *buf, int nbytes) {
dc1394video_frame_t *frame=NULL;
dc1394error_t err;
err = dc1394_capture_dequeue(c, DC1394_CAPTURE_POLICY_WAIT, &frame);
if (err != DC1394_SUCCESS) {
dc1394_log_error("Unable to capture.");
dc1394_capture_stop(c);
dc1394_camera_free(c);
exit(1);
}
memcpy(buf, frame->image, nbytes);
dc1394_capture_enqueue(c, frame);
return 1;
}
int add_gaussian(unsigned char *buffer, float cenx, float ceny, float a, float sigma) {
float gauss, rsq;
int i, j, low_x, up_x, low_y, up_y, size;
double xoff, yoff;
xoff = 2.0*drand48() - 1.0;
yoff = 2.0*drand48() - 1.0;
cenx += 0.5*xoff;
ceny += 0.5*yoff;
size = 30;
low_x = (int)(cenx-size);
up_x = (int)(cenx+size);
low_y = (int)(ceny-size);
up_y = (int)(ceny+size);
for (i=low_y; i<up_y; i++) {
for (j=low_x; j<up_x; j++) {
rsq = (cenx - j)*(cenx - j) + (ceny - i)*(ceny - i);
gauss = a*expf(-1.0*rsq/(sigma*sigma));
if (gauss > 255)
gauss = 255;
buffer[i*naxes[0]+j] += (unsigned char)gauss;
}
}
return 1;
}
int main(int argc, char *argv[]) {
dc1394_t * dc;
dc1394camera_t * camera;
dc1394camera_list_t * list;
dc1394error_t err;
dc1394video_mode_t mode;
unsigned int max_height, max_width, winleft, wintop;
uint64_t total_bytes = 0;
unsigned char *buffer, *buffer2, *average;
char *names[NXPA];
char *messages[NXPA];
char filename[256], xpastr[256];
char *froot;
fitsfile *fptr;
int i, j, f, fstatus, status, nimages, nboxes, test, xsize, ysize;
int nbad = 0, nbad_l = 0;
FILE *init, *out, *cenfile;
float xx = 0.0, yy = 0.0, xsum = 0.0, ysum = 0.0;
float elapsed_time, fps, avemax;
double *dist, *sig, *dist_l, *sig_l, *weight, *weight_l;
double mean, var, var_l, avesig, airmass, exptime;
double r0, seeing_short, seeing_long, seeing_ave;
struct timeval start_time, end_time;
struct tm ut;
time_t start_sec, end_sec;
suseconds_t start_usec, end_usec;
srand48((unsigned)time(NULL));
XPA xpa;
xpa = XPAOpen(NULL);
stderr = freopen("measure_seeing.log", "w", stderr);
if (argc <= 3) {
printf("Usage: measure_seeing <n> <airmass> <exptime>\n");
exit(-1);
}
nimages = atoi(argv[1]);
airmass = atof(argv[2]);
exptime = atof(argv[3]);
fstatus = 0;
status = 0;
xsize = 320;
ysize = 240;
naxes[0] = xsize;
naxes[1] = ysize;
fpixel = 1;
fps = 1.0/exptime;
if (fps > 330.0) {
fps = 330.0;
}
nelements = naxes[0]*naxes[1];
mode = DC1394_VIDEO_MODE_FORMAT7_1;
dc = dc1394_new();
if (!dc)
return -1;
err = dc1394_camera_enumerate(dc, &list);
DC1394_ERR_RTN(err, "Failed to enumerate cameras.");
if (list->num == 0) {
dc1394_log_error("No cameras found.");
return -1;
}
camera = dc1394_camera_new(dc, list->ids[0].guid);
if (!camera) {
dc1394_log_error("Failed to initialize camera with guid %"PRIx64".",
list->ids[0].guid);
return -1;
}
dc1394_camera_free_list(list);
printf("Using camera with GUID %"PRIx64"\n", camera->guid);
// need to use legacy firewire400 mode for now. 800 not quite reliable.
dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_400);
// configure camera for format7
err = dc1394_video_set_mode(camera, mode);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "Can't choose video mode.");
err = dc1394_format7_get_max_image_size(camera, mode, &max_width, &max_height);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "cannot get max image size.");
winleft = 0;
wintop = 0;
err = dc1394_format7_set_roi(camera,
mode,
DC1394_COLOR_CODING_MONO8,
DC1394_USE_MAX_AVAIL,
winleft, wintop, // left, top
xsize, ysize);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "Can't set ROI.");
// set the frame rate to absolute value in frames/sec
err = dc1394_feature_set_mode(camera, DC1394_FEATURE_FRAME_RATE,
DC1394_FEATURE_MODE_MANUAL);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free (camera), "cannot set framerate to manual");
err = dc1394_feature_set_absolute_control(camera,
DC1394_FEATURE_FRAME_RATE, DC1394_TRUE);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free (camera),
"cannot set framerate to absolute mode");
err = dc1394_feature_set_absolute_value(camera, DC1394_FEATURE_FRAME_RATE, fps);
DC1394_ERR_CLN_RTN(err,dc1394_camera_free (camera),"cannot set framerate");
printf("I: framerate is %f fps\n", fps);
// set the shutter speed to absolute value in seconds
err = dc1394_feature_set_mode(camera, DC1394_FEATURE_SHUTTER, DC1394_FEATURE_MODE_MANUAL);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "cannot set shutter to manual");
err = dc1394_feature_set_absolute_control(camera, DC1394_FEATURE_SHUTTER, DC1394_TRUE);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "cannot set shutter to absolute mode");
err = dc1394_feature_set_absolute_value(camera, DC1394_FEATURE_SHUTTER, exptime);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "cannot set shutter");
printf("I: exptime is %f s\n", exptime);
// set gain manually. use relative value here in range 48 to 730.
err = dc1394_feature_set_mode(camera, DC1394_FEATURE_GAIN, DC1394_FEATURE_MODE_MANUAL);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "cannot set gain to manual");
err = dc1394_feature_set_value(camera, DC1394_FEATURE_GAIN, 400);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "cannot set gain");
// set brightness manually. use relative value in range 0 to 1023.
err = dc1394_feature_set_mode(camera, DC1394_FEATURE_BRIGHTNESS, DC1394_FEATURE_MODE_MANUAL);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "cannot set brightness to manual");
err = dc1394_feature_set_value(camera, DC1394_FEATURE_BRIGHTNESS, 100);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "cannot set brightness");
err = dc1394_format7_get_total_bytes(camera, DC1394_VIDEO_MODE_FORMAT7_1, &total_bytes);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "Can't get total bytes.");
err = dc1394_capture_setup(camera, 16, DC1394_CAPTURE_FLAGS_DEFAULT);
DC1394_ERR_CLN_RTN(err, dc1394_camera_free(camera), "Error capturing.");
// start the camera up
err = dc1394_video_set_transmission(camera, DC1394_ON);
if (err != DC1394_SUCCESS) {
dc1394_log_error("Unable to start camera iso transmission.");
dc1394_capture_stop(camera);
dc1394_camera_free(camera);
return -1;
}
printf("Camera successfully initialized.\n");
out = fopen("seeing.dat", "a");
cenfile = fopen("centroids.dat", "w");
init = fopen("init_cen_all", "r");
i = 0;
while (fscanf(init, "%f %f\n", &xx, &yy) != EOF) {
box[i].x = xx;
box[i].cenx = xx;
box[i].y = yy;
box[i].ceny = yy;
box[i].r = boxsize/2.0;
i++;
}
nboxes = i;
fclose(init);
back.r = 60;
back.width = 10;
/* allocate the buffers */
if (!(dist = calloc(nimages, sizeof(double)))) {
printf("Couldn't allocate dist array.\n");
exit(-1);
}
if (!(sig = calloc(nimages, sizeof(double)))) {
printf("Couldn't allocate sig array.\n");
exit(-1);
}
if (!(weight = calloc(nimages, sizeof(double)))) {
printf("Couldn't allocate sig array.\n");
exit(-1);
}
if (!(weight_l = calloc(nimages, sizeof(double)))) {
printf("Couldn't allocate sig array.\n");
exit(-1);
}
if (!(dist_l = calloc(nimages, sizeof(double)))) {
printf("Couldn't allocate dist_l array.\n");
exit(-1);
}
if (!(sig_l = calloc(nimages, sizeof(double)))) {
printf("Couldn't allocate sig_l array.\n");
exit(-1);
}
if (!(buffer = malloc(nelements*sizeof(char)))) {
printf("Couldn't Allocate Image Buffer\n");
exit(-1);
}
if (!(buffer2 = malloc(nelements*sizeof(char)))) {
printf("Couldn't Allocate 2nd Image Buffer\n");
exit(-1);
}
if (!(average = malloc(nelements*sizeof(char)))) {
printf("Couldn't Allocate Average Image Buffer\n");
exit(-1);
}
froot = "seeing.fits";
avemax = 0.0;
/* get initial frame */
grab_frame(camera, buffer2, nelements*sizeof(char));
grab_frame(camera, buffer2, nelements*sizeof(char));
grab_frame(camera, buffer2, nelements*sizeof(char));
grab_frame(camera, buffer2, nelements*sizeof(char));
// add_gaussian(buffer2, 195.0, 130.0, 140.0, 1.5);
// add_gaussian(buffer2, 140.0, 115.0, 140.0, 1.5);
gettimeofday(&start_time, NULL);
for (f=0; f<nimages; f++) {
grab_frame(camera, buffer, nelements*sizeof(char));
// add_gaussian(buffer, 195.0, 130.0, 140.0, 1.5);
// add_gaussian(buffer, 140.0, 115.0, 140.0, 1.5);
// find center of star images and calculate background
xsum = 0.0;
ysum = 0.0;
for (i=0; i<nboxes; i++) {
xsum += box[i].cenx;
ysum += box[i].ceny;
}
back.x = xsum/nboxes;
back.y = ysum/nboxes;
background(buffer, naxes[0], naxes[1]);
for (i=0; i<nboxes; i++) {
box[i].r = boxsize/2.0;
centroid(buffer, naxes[0], naxes[1], i);
}
/* fix both boxes to the same Y */
ysum = (box[0].y + box[1].y)/2.0;
box[0].y = ysum;
box[1].y = ysum;
if (box[0].snr < box[1].snr) {
weight[f] = (box[0].snr/box[0].counts)*(box[0].snr/box[0].counts);
} else {
weight[f] = (box[1].snr/box[1].counts)*(box[1].snr/box[1].counts);
}
if (weight[f] == 0.0) {
nbad++;
}
dist[f] = stardist(0, 1);
if (dist[f] > 55.0 || dist[f] < 15.0) {
weight[f] = 0.0;
}
if (box[0].fwhm > 0.0 && box[1].fwhm > 0.0) {
for (i=0; i<nboxes; i++) {
fprintf(cenfile,
"%6.2f %6.2f %5.2f %9.4f %8.4f %7.4f %7.4f %8.4f %5.3f\t ",
box[i].cenx,
box[i].ceny,
box[i].fwhm,
box[i].counts,
back.background,
box[i].noise,
box[i].sigmaxy,
box[i].snr,
box[i].strehl
);
}
sig[f] = sqrt(box[0].sigmaxy*box[0].sigmaxy + box[1].sigmaxy*box[1].sigmaxy);
fprintf(cenfile, "%6.2f %6.2f %.1e\n", dist[f], sig[f], exptime);
if (box[0].max > box[1].max) {
avemax += box[0].max;
} else {
avemax += box[1].max;
}
}
/* now average two exposures */
for (j=0; j<nelements; j++) {
test = (int)buffer[j] + (int)buffer2[j];
if (test <= 254) {
average[j] = buffer[j]+buffer2[j];
} else {
average[j] = 254;
}
}
memcpy(buffer2, buffer, nelements*sizeof(char));
xsum = 0.0;
ysum = 0.0;
for (i=0; i<nboxes; i++) {
xsum += box[i].cenx;
ysum += box[i].ceny;
}
back.x = xsum/nboxes;
back.y = ysum/nboxes;
background(average, naxes[0], naxes[1]);
for (i=0; i<nboxes; i++) {
box[i].r = boxsize/2.0;
//centroid(average, i);
//box[i].r = boxsize/3.0;
//centroid(average, i);
//box[i].r = boxsize/4.0;
centroid(average, naxes[0], naxes[1], i);
}
if (box[0].snr < box[1].snr) {
weight_l[f] = (box[0].snr/box[0].counts)*(box[0].snr/box[0].counts);
} else {
weight_l[f] = (box[1].snr/box[1].counts)*(box[1].snr/box[1].counts);
}
if (weight_l[f] == 0.0) {
nbad_l++;
}
dist_l[f] = stardist(0, 1);
sig_l[f] = sqrt(box[0].sigmaxy*box[0].sigmaxy + box[1].sigmaxy*box[1].sigmaxy);
if (f % 160 == 0) {
sprintf(filename, "!%s", froot);
fits_create_file(&fptr, "!seeing.fits", &fstatus);
fits_create_img(fptr, BYTE_IMG, 2, naxes, &fstatus);
fits_write_img(fptr, TBYTE, fpixel, nelements, buffer, &fstatus);
fits_close_file(fptr, &fstatus);
fits_report_error(stdout, fstatus);
status = XPASet(xpa, "timDIMM", "array [xdim=320,ydim=240,bitpix=8]", "ack=false",
(char *)buffer, nelements, names, messages, NXPA);
sprintf(xpastr, "image; box %f %f %d %d 0.0",
box[0].x, box[0].y, boxsize, boxsize);
status = XPASet(xpa, "timDIMM", "regions", "ack=false",
xpastr, strlen(xpastr), names, messages, NXPA);
sprintf(xpastr, "image; box %f %f %d %d 0.0",
box[1].x, box[1].y, boxsize, boxsize);
status = XPASet(xpa, "timDIMM", "regions", "ack=false",
xpastr, strlen(xpastr), names, messages, NXPA);
}
}
gettimeofday(&end_time, NULL);
printf("End capture.\n");
/*-----------------------------------------------------------------------
* stop data transmission
*-----------------------------------------------------------------------*/
err = dc1394_video_set_transmission(camera, DC1394_OFF);
DC1394_ERR_RTN(err,"couldn't stop the camera?");
start_sec = start_time.tv_sec;
start_usec = start_time.tv_usec;
end_sec = end_time.tv_sec;
end_usec = end_time.tv_usec;
elapsed_time = (float)((end_sec + 1.0e-6*end_usec) - (start_sec + 1.0e-6*start_usec));
fps = nimages/elapsed_time;
printf("Elapsed time = %g seconds.\n", elapsed_time);
printf("Framerate = %g fps.\n", fps);
avemax /= nimages;
printf("Avemax is %.3f\n", avemax);
/* analyze short exposure */
printf("\t SHORT EXPOSURE\n");
mean = gsl_stats_wmean(weight, 1, dist, 1, nimages);
avesig = gsl_stats_wmean(weight, 1, sig, 1, nimages);
printf("mean = %f, avesig = %f\n", mean, avesig);
printf("\n");
var = gsl_stats_wvariance_m(weight, 1, dist, 1, nimages, mean);
var = var - avesig*avesig;
if (var < 0.0) {
var = 0.0;
}
seeing_short = seeing(var)/pow(airmass,0.6);
r0 = old_seeing(var);
printf("sigma = %f, seeing = %f\n", sqrt(var), seeing_short);
/* analyze long exposure */
printf("\t LONG EXPOSURE\n");
mean = gsl_stats_wmean(weight_l, 1, dist_l, 1, nimages);
avesig = gsl_stats_wmean(weight_l, 1, sig_l, 1, nimages);
printf("mean_l = %f, avesig_l = %f\n", mean, avesig);
printf("\n");
var_l = gsl_stats_wvariance_m(weight_l, 1, dist_l, 1, nimages, mean);
var_l = var_l - avesig*avesig;
if (var_l < 0.0) {
var_l = 0.0;
}
seeing_long = seeing(var_l)/pow(airmass,0.6);
printf("sigma_l = %f, seeing_l = %f\n", sqrt(var_l), seeing_long);
printf("Bad samples: %d for short, %d for long.\n", nbad, nbad_l);
/* reduce exposure when too bright */
if (avemax > 100.0) {
if (exptime > 1.0e-3) {
exptime -= 1.0e-3;
} else {
exptime /= 2.0;
}
printf("\033[0;33mStar too bright, reducing exposure time to %.1e seconds.\033[0;39m\n", exptime);
}
/* increase if too faint, but max out at 8 ms */
if (avemax < 25.0) {
if (exptime >= 1.0e-3) {
exptime += 1.0e-3;
} else {
exptime *= 2.0;
}
if (exptime > 8.0e-3) {
exptime = 8.0e-3;
printf("\033[0;33mStar too faint, but exposure time max'ed out at %.1e seconds.\033[0;39m\n",
exptime);
} else {
printf("\033[0;33mStar too faint, exposure time increased to %.1e seconds.\033[0;39m\n",
exptime);
}
}
init = fopen("exptime", "w");
fprintf(init, "%.2e\n", exptime);
fclose(init);
if (nbad < 30) {
seeing_ave = pow(seeing_short, 1.75)*pow(seeing_long,-0.75);
printf("\033[0;32mAirmass corrected seeing = %4.2f\"\033[0;39m\n\n", seeing_short);
printf("\033[0;32mFried Parameter, R0 = %.2f cm\033[0;39m\n\n", 100*r0);
gmtime_r(&end_sec, &ut);
fprintf(out, "%d-%02d-%02d %02d:%02d:%02d %f %f %f %f %f %f\n",
ut.tm_year+1900,
ut.tm_mon+1,
ut.tm_mday,
ut.tm_hour,
ut.tm_min,
ut.tm_sec,
var,
var_l,
seeing_short,
seeing_long,
seeing_ave,
airmass);
init = fopen("init_cen_all", "w");
for (i=0; i<nboxes; i++) {
fprintf(init, "%f %f\n", box[i].cenx, box[i].ceny);
}
fclose(init);
init = fopen("seeing.out", "w");
fprintf(init, "%.2f\n", seeing_short);
fclose(init);
init = fopen("r0.out", "w");
fprintf(init, "%.1f\n", 100*r0);
fclose(init);
} else {
printf("\n\n\033[0;31mABORTING measurement! Lost at least one box.\033[0;39m\n\n");
}
fclose(cenfile);
fclose(out);
return (status);
}
| 28.19401 | 104 | 0.596176 |
ddf10b6d969b297181e9507f67684ef2285d66b1 | 388 | php | PHP | app/Models/Society.php | RifkiNoviandra/vaccinify_lks | 52ae4abf74deeaf90bd72f77dd89cc578db585d4 | [
"MIT"
] | null | null | null | app/Models/Society.php | RifkiNoviandra/vaccinify_lks | 52ae4abf74deeaf90bd72f77dd89cc578db585d4 | [
"MIT"
] | null | null | null | app/Models/Society.php | RifkiNoviandra/vaccinify_lks | 52ae4abf74deeaf90bd72f77dd89cc578db585d4 | [
"MIT"
] | null | null | null | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Society extends Authenticatable
{
use HasFactory;
protected $guarded = [];
public $timestamps = false;
function regional(){
return $this->belongsTo(regional::class);
}
}
| 19.4 | 55 | 0.729381 |
396d09addf393c416a946b0c024c2dd6c3f085ee | 3,290 | html | HTML | about.html | CodeForChofu/brownbag | bc4422d47b6fc7b0bdbb577e86a0b3684e9dbe19 | [
"MIT"
] | null | null | null | about.html | CodeForChofu/brownbag | bc4422d47b6fc7b0bdbb577e86a0b3684e9dbe19 | [
"MIT"
] | 2 | 2021-05-11T09:20:29.000Z | 2022-02-13T10:00:55.000Z | about.html | CodeForChofu/brownbag | bc4422d47b6fc7b0bdbb577e86a0b3684e9dbe19 | [
"MIT"
] | 3 | 2020-04-07T15:45:13.000Z | 2020-04-15T15:42:17.000Z | <ons-page id="setting-page">
<ons-list>
<ons-list-header>投稿する</ons-list-header>
<ons-list-item expandable>
投稿されたお店をみる
<div class="expandable-content">
<ol style="list-style-type: upper-roman">
<li>お店を探す機能</li>
<ul>
<li>一覧からお店を探す</li>
<li>検索機能を探す</li>
</ul>
<li>マップ機能</li>
<ul>
<li>マークをクリックする</li>
</ul>
</ol>
</div>
</ons-list-item>
<ons-list-item expandable>
お店の登録方法
<div class="expandable-content">
画面右下の投稿する画面の(+)ボタンから、お店の情報が掲載できます!
</div>
</ons-list-item>
<ons-list-item expandable>
アプリの登録方法
<div class="expandable-content">
<div class="center">
<img src="info.png" width="30%">
</div>
</div>
</ons-list-item>
<ons-list-item expandable>
<利用に関する注意>
<div class="expandable-content">
<ul style="list-style-type: disc">
<li>最新のお店の情報は、ホームやSNSでが確認ください。</li>
<li>情報提供にご協力いただける場合は、掲載店から了承をいただくことが望ましいです。</li>
<li>本サイトの利用で被害等があった場合でも、運営主体および協力団体は責任を負えませんのでご了承ください。</li>
<li>無料ツールをしての運用のため、動作に関するサポートは行えません。</li>
<li>環境により動作しない場合も報告さてていますが、別のブラウザやスマートフォン等にてご確認ください。</li>
</ul>
</div>
</ons-list-item>
<ons-list-item expandable>
<目的>
<div class="expandable-content">
現在、新型コロナウィルス対策により不要不急の外出自粛となっています。<br>
それを受けて地域の飲食店では、お弁当やテイクアウトメニュー販売するところが増えています。<br>
その情報をみんなでシェアして地域応援、そして外出自粛のおうちの中で少しでも楽しくという思いを込めて、急いでアプリをつくって、みました。<br>
<br>
※この活動は市民有志ボランティアで行っています、
</div>
</ons-list-item>
<ons-list-item expandable>
<外出について>
<div class="expandable-content">
国、千葉県、流山市の外出に関する情報に則ってください。
</div>
</ons-list-item>
<ons-list-item expandable>
<よくある質問>
<div class="expandable-content">
<p>
Q.流山市内の店しかのせられないのですか?<br>
A.流山市民の方がアクセスしやすいお店ならどこでも結構です!(松戸、柏、野田など)
</p>
<p>
Q.記載内容を修正したい場合はどうすればよいですか?<br>
A.ありがとうございます、メールでご連絡ください。<br>
<a href="mailto:codefornagareyama@gmail.com?subject=流山テイクアウトマップ&body=修正依頼">お問合せ先: codefornagareyama@gmail.com</a>
</p>
<p>
Q.投稿した内容が反映されません。<br>
A.住所がきちんと反映されるかなどメンバーで確認をした後の上げております。1日程度お待ちください。
</p>
</div>
</ons-list-item>
<ons-list-item expandable>
■地図が海外の場所を表示する場合
<div class="expandable-content">
<div class="center">
<img src="map_error.png" width="30%">
</div>
</div>
</ons-list-item>
</ons-list>
</ons-page>
| 33.232323 | 137 | 0.459574 |
b7a665a865f6f28e0516f6f508ceb74e8df0d725 | 263 | kt | Kotlin | src/main/kotlin/com/github/wakingrufus/eloleague/data/GameData.kt | wakingrufus/elo-league-jfx | 49fdacf104b5bb42ea72ec72f6b36aab33b1b8f8 | [
"MIT"
] | 1 | 2019-03-01T14:11:28.000Z | 2019-03-01T14:11:28.000Z | src/main/kotlin/com/github/wakingrufus/eloleague/data/GameData.kt | wakingrufus/elo-league-jfx | 49fdacf104b5bb42ea72ec72f6b36aab33b1b8f8 | [
"MIT"
] | 9 | 2018-01-05T13:54:14.000Z | 2018-09-06T19:42:55.000Z | src/main/kotlin/com/github/wakingrufus/eloleague/data/GameData.kt | wakingrufus/elo-league-jfx | 49fdacf104b5bb42ea72ec72f6b36aab33b1b8f8 | [
"MIT"
] | 1 | 2020-08-06T20:25:47.000Z | 2020-08-06T20:25:47.000Z | package com.github.wakingrufus.eloleague.data
data class GameData(
val id: String,
val team1Score: Int,
val team2Score: Int,
val timestamp: Long,
val team1PlayerIds: List<String>,
val team2PlayerIds: List<String>
) | 26.3 | 45 | 0.646388 |
0efc7d1104bc3009d37af3da9e785236e395e98a | 782 | swift | Swift | Harvest-SwiftUI-Gallery/Screens/StateDiagram/StateDiagramExample.swift | ctalladen78/Harvest-SwiftUI-Gallery | 2627588b45b9c80e2a7b039403aac9147f213c3d | [
"MIT"
] | 160 | 2019-10-21T02:30:59.000Z | 2022-03-21T00:37:07.000Z | Harvest-SwiftUI-Gallery/Screens/StateDiagram/StateDiagramExample.swift | ctalladen78/Harvest-SwiftUI-Gallery | 2627588b45b9c80e2a7b039403aac9147f213c3d | [
"MIT"
] | 5 | 2019-10-25T00:05:05.000Z | 2020-07-28T09:53:18.000Z | Harvest-SwiftUI-Gallery/Screens/StateDiagram/StateDiagramExample.swift | ctalladen78/Harvest-SwiftUI-Gallery | 2627588b45b9c80e2a7b039403aac9147f213c3d | [
"MIT"
] | 15 | 2019-10-21T16:06:06.000Z | 2022-02-07T13:59:31.000Z | import SwiftUI
import HarvestStore
struct StateDiagramExample: Example
{
var exampleIcon: Image { Image(systemName: "arrow.3.trianglepath") }
var exampleInitialState: Root.State.Current
{
.stateDiagram(.loggedOut)
}
func exampleView(store: Store<Root.Input, Root.State>.Proxy) -> AnyView
{
guard let currentBinding = Binding(store.$state.current),
let stateBinding = Binding(currentBinding.stateDiagram) else
{
return EmptyView().toAnyView()
}
let substore = Store<StateDiagram.Input, StateDiagram.State>.Proxy(
state: stateBinding,
send: contramap(Root.Input.stateDiagram)(store.send)
)
return StateDiagramView(store: substore).toAnyView()
}
}
| 26.965517 | 75 | 0.652174 |
0f354997a6e054cf38993e59e04c3fb92ff246de | 590 | lua | Lua | lualib/base/common.lua | ChestnutGames/chestnut | 720cf88779f480191ae16fb1ba4da4597e5797d9 | [
"MIT"
] | null | null | null | lualib/base/common.lua | ChestnutGames/chestnut | 720cf88779f480191ae16fb1ba4da4597e5797d9 | [
"MIT"
] | null | null | null | lualib/base/common.lua | ChestnutGames/chestnut | 720cf88779f480191ae16fb1ba4da4597e5797d9 | [
"MIT"
] | 1 | 2019-11-07T16:06:03.000Z | 2019-11-07T16:06:03.000Z | function cc.genpk_1(_1, ... )
-- body
return _1
end
function cc.genpk_2(_1, _2, ... )
-- body
local pk = (~(1 << 33 -1) & _1)
pk = pk << 32
pk = (pk | (~(1 << 33 -1) & _2 ))
return pk
end
function cc.genpk_3(_1, _2, ...)
local pk = (~(1 << 9 - 1) & _1)
pk = pk << 24
pk = (pk | (~(1 << 25 - 1) & _2))
return pk
end
local idx = 0
local mechin = 0
local service = 0
function cc.key()
local r = 0
idx = idx + 1
local ti = os.time()
ti = ti << 41
local m = mechin << 15
local s = service << 9
r = r | ti
r = r | mechin
r = r | s
r = r | idx
return r
end | 15.945946 | 37 | 0.50339 |
a505aced90f23cc7bcb14e6a5b94d0a8041734e0 | 12,561 | swift | Swift | Source/Core/RXCDiffArray+Row.swift | ruixingchen/RXCDiffArray | cd532f1cda438c17002f5a19fc0a1eacb834d702 | [
"MIT"
] | 1 | 2019-09-20T04:51:51.000Z | 2019-09-20T04:51:51.000Z | Source/Core/RXCDiffArray+Row.swift | ruixingchen/RXCDiffArray | cd532f1cda438c17002f5a19fc0a1eacb834d702 | [
"MIT"
] | null | null | null | Source/Core/RXCDiffArray+Row.swift | ruixingchen/RXCDiffArray | cd532f1cda438c17002f5a19fc0a1eacb834d702 | [
"MIT"
] | null | null | null | //
// RXCDiffArray+Row.swift
// RXCDiffArray
//
// Created by ruixingchen on 12/3/19.
// Copyright © 2019 ruixingchen. All rights reserved.
//
import Foundation
extension RXCDiffArray where Element: RDASectionElementProtocol, Index==Int {
public typealias RowElement = Any
public typealias RowIndex = Int
@discardableResult
public func addRow(_ newElement: __owned RowElement, in s:Index, userInfo:[AnyHashable:Any]?=nil)->Difference {
var diff:Difference!
self.safeWriteExecute(userInfo: userInfo) {
var sectionElement = self.container[s]
let count = sectionElement.rda_elements.count
diff = Difference(changes: CollectionOfOne(Difference.Change.elementInsert(offset: count, section: s)))
sectionElement.rda_elements.append(newElement)
self.container.replaceSubrange(s..<s+1, with: CollectionOfOne(sectionElement))
}
self.notifyDelegate(diff: [diff], userInfo: userInfo)
return diff
}
@discardableResult
public func addRow<S>(contentsOf newElements: __owned S, in s:Index, userInfo:[AnyHashable:Any]?=nil)->Difference where S : Collection, S.Element==RowElement {
var diff:Difference!
self.safeWriteExecute(userInfo: userInfo) {
var sectionElement = self.container[s]
let count = sectionElement.rda_elements.count
diff = Difference(changes: newElements.enumerated().map({Difference.Change.elementInsert(offset: count+$0.offset, section: s)}))
sectionElement.rda_elements.append(contentsOf: newElements)
self.container.replaceSubrange(s..<s+1, with: CollectionOfOne(sectionElement))
}
self.notifyDelegate(diff: [diff], userInfo: userInfo)
return diff
}
@discardableResult
public func insertRow(_ newElement: __owned RowElement, at i: RowIndex, in s:Index, userInfo:[AnyHashable:Any]?=nil)->Difference {
var diff:Difference!
self.safeWriteExecute(userInfo: userInfo) {
diff = Difference(changes: CollectionOfOne(Difference.Change.elementInsert(offset: i, section: s)))
var sectionElement = self.container[s]
sectionElement.rda_elements.insert(newElement, at: i)
self.container.replaceSubrange(s..<s+1, with: CollectionOfOne(sectionElement))
}
self.notifyDelegate(diff: [diff], userInfo: userInfo)
return diff
}
@discardableResult
public func insertRow<C>(contentsOf newElements: __owned C, at i: RowIndex, in s:Index, userInfo:[AnyHashable:Any]?=nil)->Difference where C : Collection,C.Element==RowElement {
var diff:Difference!
self.safeWriteExecute(userInfo: userInfo) {
diff = Difference(changes: newElements.enumerated().map({Difference.Change.elementInsert(offset: i+$0.offset, section: s)}))
var sectionElement = self.container[s]
sectionElement.rda_elements.insert(contentsOf: newElements, at: i)
self.container.replaceSubrange(s..<s+1, with: CollectionOfOne(sectionElement))
}
self.notifyDelegate(diff: [diff], userInfo: userInfo)
return diff
}
//MARK: - 二维 更新
@discardableResult
public func replaceRow(at position: RowIndex, in s:Index, with newElement: RowElement, userInfo:[AnyHashable:Any]?=nil)->Difference {
var diff:Difference!
self.safeWriteExecute(userInfo: userInfo) {
diff = Difference(changes: CollectionOfOne(Difference.Change.elementUpdate(offset: position, section: s)))
var sectionElement = self.container[s]
sectionElement.rda_elements.replaceSubrange(position..<position+1, with: CollectionOfOne(newElement))
self.container.replaceSubrange(s..<s+1, with: CollectionOfOne(sectionElement))
}
self.notifyDelegate(diff: [diff], userInfo: userInfo)
return diff
}
/*
这个方法复杂度太高, 暂未测试
@discardableResult
public func replaceRow<C:Collection, R:RangeExpression>(_ subrange: R, with newElements: __owned C, in s:Index, userInfo:[AnyHashable:Any]?=nil)->Difference where C.Element==RowElement, R.Bound==RowIndex {
var diff:Difference!
self.safeWriteExecute(userInfo: userInfo) {
var section = self.container[s]
var elements = section.rda_elements
///传入的可能是一个含有无限的范围, 先获取真实的范围
let realSubrange:Range<R.Bound> = subrange.relative(to: elements)
///将range的index转换为新数据的index
// let rangeIndexToNewElementIndex:(_ index:Index)->C.Index = { (index) in
// let distance = realSubrange.distance(from: realSubrange.startIndex, to: index)
// return newElements.index(newElements.startIndex, offsetBy: distance)
// }
var changes:[Difference.Change] = []
//重合部分我们认为是更新数据, 之后的部分认为是删除或者新增数据
//重合部分的长度
let publicCount:Int = Swift.min(realSubrange.distance(from: realSubrange.startIndex, to: realSubrange.endIndex), newElements.distance(from: newElements.startIndex, to: newElements.endIndex))
if publicCount > 0 {
//将重合的部分转换成elementUpdate
let publicRange = realSubrange.startIndex..<realSubrange.index(realSubrange.startIndex, offsetBy: publicCount)
for i:Index in publicRange {
//公共部分为替换数据
// let oldElement = elements[i] as? RowElement
// let indexForNewElement = rangeIndexToNewElementIndex(i)
// let newElement = newElements[indexForNewElement]
let change = Difference.Change.elementUpdate(offset: i, section: s)
changes.append(change)
}
}
if newElements.count != realSubrange.count {
let maxLength = Swift.max(elements.distance(from: realSubrange.startIndex, to: realSubrange.endIndex), newElements.distance(from: newElements.startIndex, to: newElements.endIndex))
let unevenStart = elements.index(realSubrange.startIndex, offsetBy: publicCount)
let unevenEnd = realSubrange.startIndex + maxLength
let unevenRange:Range<R.Bound> = unevenStart..<unevenEnd
if newElements.count > realSubrange.count {
//新数据的长度大于原始片段长度, 超出的部分视为插入的数据
// ----
// ----------
for i in unevenRange {
// let newElementIndex = rangeIndexToNewElementIndex(i)
// let newElement = newElements[newElementIndex]
let change = Difference.Change.elementInsert(offset: i, section: s)
changes.append(change)
}
}else {
//新数据 < 原始片段, 超出的部分视为删除数据
// --------
// ----
for i in unevenRange {
// let element = elements[i] as! RowElement
let change = Difference.Change.elementRemove(offset: i, section: s)
changes.append(change)
}
}
}
elements.replaceSubrange(subrange, with: newElements.map({$0 as Any}))
section.rda_elements = elements
self.container.replaceSubrange(s..<self.container.index(after: s), with: CollectionOfOne(section))
diff = Difference(changes: changes)
}
self.notifyDelegate(diff: [diff], userInfo: userInfo)
return diff
}
*/
//MARK: - 二维 删除
@discardableResult
public func removeRow(at position: RowIndex, in s:Index,userInfo:[AnyHashable:Any]?=nil) -> Difference {
var diff:Difference!
self.safeWriteExecute(userInfo: userInfo) {
diff = Difference(changes: CollectionOfOne(Difference.Change.elementRemove(offset: position, section: s)))
var sectionElement = self.container[s]
sectionElement.rda_elements.remove(at: position)
self.container.replaceSubrange(s..<s+1, with: CollectionOfOne(sectionElement))
}
self.notifyDelegate(diff: [diff], userInfo: userInfo)
return diff
}
@discardableResult
public func removeRow<R:RangeExpression>(_ bounds: R, in s:Index, userInfo:[AnyHashable:Any]?=nil)->Difference where R.Bound==RowIndex {
var diff:Difference!
self.safeWriteExecute(userInfo: userInfo) {
var sectionElement = self.container[s]
let realBounds = bounds.relative(to: sectionElement.rda_elements)
diff = Difference(changes: realBounds.map({Difference.Change.elementRemove(offset: $0, section: s)}))
sectionElement.rda_elements.removeSubrange(realBounds)
self.container.replaceSubrange(s..<s+1, with: CollectionOfOne(sectionElement))
}
self.notifyDelegate(diff: [diff], userInfo: userInfo)
return diff
}
@discardableResult
public func removeAllRow(userInfo:[AnyHashable:Any]?=nil, where shouldBeRemoved:@escaping (RowElement, Int) -> Bool)->Difference {
var diff:Difference!
self.safeWriteExecute(userInfo: userInfo) {
let sections = Set<Int>.init((self.container.startIndex..<self.container.endIndex))
diff = self.removeAllRow(in: sections, userInfo: userInfo, where: shouldBeRemoved)
}
return diff
}
@discardableResult
public func removeAllRow(in sections:Swift.Set<Int>, userInfo:[AnyHashable:Any]?=nil, where shouldBeRemoved:@escaping (RowElement, Int) -> Bool)->Difference {
var diff:Difference!
self.safeWriteExecute(userInfo: userInfo) {
var changes:[Difference.Change] = []
for sectionIndex in sections.sorted(by: <) {
var sectionElement = self.container[sectionIndex]
var elements = sectionElement.rda_elements
if elements.isEmpty {continue}
var removeIndex:[RowIndex] = []
for i in elements.enumerated() {
if shouldBeRemoved(i.element, i.offset) {
removeIndex.append(i.offset)
}
}
for i in removeIndex.reversed() {
elements.remove(at: i)
}
if !removeIndex.isEmpty {
for i in removeIndex {
let change = Difference.Change.elementRemove(offset: i, section: sectionIndex)
changes.append(change)
}
sectionElement.rda_elements = elements
self.container.replaceSubrange(sectionIndex..<sectionIndex+1, with: CollectionOfOne(sectionElement))
}
}
//循环完毕
diff = Difference(changes: changes)
}
self.notifyDelegate(diff: [diff], userInfo: userInfo)
return diff
}
//MARK: - 二维 移动
///待测试
@discardableResult
public func moveRow(fromRow:RowIndex,fromSection:Index, toRow:RowIndex, toSection:Index, userInfo:[AnyHashable:Any]?=nil)->Difference {
var diff:Difference!
self.safeWriteExecute(userInfo: userInfo) {
//这里需要注意同一个Section里面进行移动的场景, 单步执行完毕后需要立刻将section设置回container中
var _fromSectionElement = self.container[fromSection]
var _fromElements = _fromSectionElement.rda_elements
let element = _fromElements.remove(at: fromRow)
_fromSectionElement.rda_elements = _fromElements
self.container.replaceSubrange(fromSection..<fromSection+1, with: CollectionOfOne(_fromSectionElement))
var _toSectionElement = self.container[toSection]
var _toElements = _toSectionElement.rda_elements
_toElements.insert(element, at: toRow)
_toSectionElement.rda_elements = _toElements
self.container.replaceSubrange(toSection..<toSection+1, with: CollectionOfOne(_toSectionElement))
let change = Difference.Change.elementMove(fromOffset: fromRow, fromSection: fromSection, toOffset: toRow, toSection: toSection)
diff = Difference(changes: CollectionOfOne(change))
}
self.notifyDelegate(diff: [diff], userInfo: userInfo)
return diff
}
}
| 47.760456 | 209 | 0.62304 |
6fd79f165250115a04c0e12a55f18f8f33b887c6 | 327 | asm | Assembly | non_regression/other_x86_linux_43.s.asm | LRGH/plasmasm | 4cd50546c3dc895763d72dd60b7c46179c1916bc | [
"Apache-2.0"
] | 1 | 2021-02-28T21:31:18.000Z | 2021-02-28T21:31:18.000Z | non_regression/other_x86_linux_43.s.asm | LRGH/plasmasm | 4cd50546c3dc895763d72dd60b7c46179c1916bc | [
"Apache-2.0"
] | null | null | null | non_regression/other_x86_linux_43.s.asm | LRGH/plasmasm | 4cd50546c3dc895763d72dd60b7c46179c1916bc | [
"Apache-2.0"
] | null | null | null | .file "common_test_3.c"
.text
.p2align 4,,15
# ----------------------
.globl c1_v1
.type c1_v1, @function
c1_v1:
.cfi_startproc
rep; ret
.cfi_endproc
.size c1_v1, .-c1_v1
# ----------------------
.symver c1_v1,c1@@VER1
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
.section .note.GNU-stack,"",@progbits
| 20.4375 | 51 | 0.568807 |
af45833b5c194f8538030bd8b126870462de5a47 | 411 | rb | Ruby | attributes/install.rb | Shcerbak/filebeat-cookbook | 06da0500e32746cec4d4ff69adf158378ddc82b3 | [
"Apache-2.0"
] | null | null | null | attributes/install.rb | Shcerbak/filebeat-cookbook | 06da0500e32746cec4d4ff69adf158378ddc82b3 | [
"Apache-2.0"
] | null | null | null | attributes/install.rb | Shcerbak/filebeat-cookbook | 06da0500e32746cec4d4ff69adf158378ddc82b3 | [
"Apache-2.0"
] | null | null | null | default['filebeat']['repository']['uri'] = 'https://packages.elastic.co/beats/apt'
default['filebeat']['repository']['dist'] = 'stable'
default['filebeat']['repository']['repo'] = ['main']
default['filebeat']['repository']['key'] = 'https://packages.elasticsearch.org/GPG-KEY-elasticsearch'
default['filebeat']['apt']['options'] = "-o Dpkg::Options::='--force-confnew'"
default['filebeat']['version'] = '1.3.1'
| 58.714286 | 101 | 0.671533 |
40562f9a5dfaaeecd2d4171a09b2cd5d966c4114 | 3,780 | swift | Swift | tests/FlatBuffers.Benchmarks.swift/Sources/FlatBuffers.Benchmarks.swift/main.swift | zxscn/flatbuffers | 431c96afa3611b191229bd5242fdc2291571b789 | [
"Apache-2.0"
] | 2 | 2021-01-26T07:10:40.000Z | 2022-03-30T18:22:19.000Z | tests/FlatBuffers.Benchmarks.swift/Sources/FlatBuffers.Benchmarks.swift/main.swift | zxscn/flatbuffers | 431c96afa3611b191229bd5242fdc2291571b789 | [
"Apache-2.0"
] | 8 | 2021-02-24T10:53:27.000Z | 2021-02-24T13:37:22.000Z | tests/FlatBuffers.Benchmarks.swift/Sources/FlatBuffers.Benchmarks.swift/main.swift | zxscn/flatbuffers | 431c96afa3611b191229bd5242fdc2291571b789 | [
"Apache-2.0"
] | 1 | 2021-01-29T09:52:20.000Z | 2021-01-29T09:52:20.000Z | /*
* Copyright 2021 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import CoreFoundation
import FlatBuffers
struct Benchmark {
var name: String
var value: Double
var description: String { "\(String(format: "|\t%@\t\t|\t\t%fs\t|", name, value))"}
}
func run(name: String, runs: Int, action: () -> Void) -> Benchmark {
action()
let start = CFAbsoluteTimeGetCurrent()
for _ in 0..<runs {
action()
}
let ends = CFAbsoluteTimeGetCurrent()
let value = Double(ends - start) / Double(runs)
print("done \(name): in \(value)")
return Benchmark(name: name, value: value)
}
func createDocument(Benchmarks: [Benchmark]) -> String {
let separator = "-------------------------------------"
var document = "\(separator)\n"
document += "\(String(format: "|\t%@\t\t|\t\t%@\t\t|", "Name", "Scores"))\n"
document += "\(separator)\n"
for i in Benchmarks {
document += "\(i.description) \n"
document += "\(separator)\n"
}
return document
}
@inlinable
func create10Strings() {
var fb = FlatBufferBuilder(initialSize: 1<<20)
for _ in 0..<10_000 {
_ = fb.create(string: "foobarbaz")
}
}
@inlinable
func create100Strings(str: String) {
var fb = FlatBufferBuilder(initialSize: 1<<20)
for _ in 0..<10_000 {
_ = fb.create(string: str)
}
}
@inlinable
func benchmarkFiveHundredAdds() {
var fb = FlatBufferBuilder(initialSize: 1024 * 1024 * 32)
for _ in 0..<500_000 {
let off = fb.create(string: "T")
let s = fb.startTable(with: 4)
fb.add(element: 3.2, def: 0, at: 2)
fb.add(element: 4.2, def: 0, at: 4)
fb.add(element: 5.2, def: 0, at: 6)
fb.add(offset: off, at: 8)
_ = fb.endTable(at: s)
}
}
@inlinable
func benchmarkThreeMillionStructs() {
let structCount = 3_000_000
let rawSize = ((16 * 5) * structCount) / 1024
var fb = FlatBufferBuilder(initialSize: Int32(rawSize * 1600))
var offsets: [Offset<UOffset>] = []
for _ in 0..<structCount {
fb.startVector(5 * MemoryLayout<AA>.size, elementSize: MemoryLayout<AA>.alignment)
for _ in 0..<5 {
_ = fb.create(struct: AA(a: 2.4, b: 2.4))
}
let vector = fb.endVector(len: 5)
let start = fb.startTable(with: 1)
fb.add(offset: vector, at: 4)
offsets.append(Offset<UOffset>(offset: fb.endTable(at: start)))
}
let vector = fb.createVector(ofOffsets: offsets)
let start = fb.startTable(with: 1)
fb.add(offset: vector, at: 4)
let root = Offset<UOffset>(offset: fb.endTable(at: start))
fb.finish(offset: root)
}
@usableFromInline
struct AA: NativeStruct {
public init(a: Double, b: Double) {
self.a = a
self.b = b
}
var a: Double
var b: Double
}
func benchmark(numberOfRuns runs: Int) {
var benchmarks: [Benchmark] = []
let str = (0...99).map { _ -> String in "x" }.joined()
benchmarks.append(run(name: "500_000", runs: runs, action: benchmarkFiveHundredAdds))
benchmarks.append(run(name: "10 str", runs: runs, action: create10Strings))
let hundredStr = run(name: "100 str", runs: runs) {
create100Strings(str: str)
}
benchmarks.append(run(name: "3M strc", runs: 1, action: benchmarkThreeMillionStructs))
benchmarks.append(hundredStr)
print(createDocument(Benchmarks: benchmarks))
}
benchmark(numberOfRuns: 20)
| 28.421053 | 88 | 0.658201 |
bcbb3149a9d6dcbccfae6a67398dacf223e47670 | 1,444 | js | JavaScript | src/components/Tours/single-tour.component.js | ChallaRavi/gatsby-img-component | b41ea7dbf1ce62f768e58dc5e00cfbf7e0ebebab | [
"MIT"
] | 1 | 2021-05-30T11:01:00.000Z | 2021-05-30T11:01:00.000Z | src/components/Tours/single-tour.component.js | ChallaRavi/gatsby-img-component | b41ea7dbf1ce62f768e58dc5e00cfbf7e0ebebab | [
"MIT"
] | 4 | 2021-03-10T02:01:10.000Z | 2022-02-18T16:58:20.000Z | src/components/Tours/single-tour.component.js | ChallaRavi/gatsby-img-component | b41ea7dbf1ce62f768e58dc5e00cfbf7e0ebebab | [
"MIT"
] | null | null | null | import React from "react"
import { FaMap } from "react-icons/fa"
import Image from 'gatsby-image'
import tourstyle from '../../css-modules/tour.module.css'
import { Link } from "gatsby"
import PropTypes from 'prop-types'
export const SingleTour = ({ tour }) => {
console.log(tour)
const { text, price, country, days, slug, images } = tour
const mainImage = images[1].fluid;
return (
<article className={tourstyle.tour}>
<div className={tourstyle.imgContainer}>
<Image fluid={mainImage} className={tourstyle.img} alt={text} />
<Link className={tourstyle.link} to={`/challadata/${slug}`}>
details
</Link>
</div>
<div className={tourstyle.footer}>
<h3>{text}</h3>
<div className={tourstyle.info}>
<h4 className={tourstyle.country}>
<FaMap className={tourstyle.icon}></FaMap>
{country}
</h4>
<div className={tourstyle.details}>
<h6>{days} days</h6>
<h6>from ${price}</h6>
</div>
</div>
</div>
</article>
)
}
SingleTour.propTypes = {
tour: PropTypes.shape({
text: PropTypes.string.isRequired,
country: PropTypes.string.isRequired,
price: PropTypes.number.isRequired,
slug: PropTypes.string.isRequired,
days: PropTypes.number.isRequired,
images: PropTypes.arrayOf(PropTypes.object).isRequired
}),
}
export default SingleTour
| 29.469388 | 72 | 0.617036 |
9640da37092add813a9c0e31d967b82902c896ca | 214 | php | PHP | app/General/Concretes/Repositories/TransactionRepository.php | Scalcar/MyOnlineBank | aeed09570f93e3b629f1866e3140d1cfe5883b43 | [
"MIT"
] | 1 | 2021-11-22T21:36:09.000Z | 2021-11-22T21:36:09.000Z | app/General/Concretes/Repositories/TransactionRepository.php | Scalcar/MyOnlineBank | aeed09570f93e3b629f1866e3140d1cfe5883b43 | [
"MIT"
] | null | null | null | app/General/Concretes/Repositories/TransactionRepository.php | Scalcar/MyOnlineBank | aeed09570f93e3b629f1866e3140d1cfe5883b43 | [
"MIT"
] | null | null | null | <?php
namespace App\General\Concretes\Repositories;
use App\General\Abstracts\Repository;
use App\Models\Transaction;
class TransactionRepository extends Repository
{
protected $model = Transaction::class;
} | 19.454545 | 46 | 0.799065 |
8e618df7b9c124959b7f628b0eb2ff5e87da7d84 | 6,263 | rb | Ruby | spec/controllers/participates_controller_spec.rb | muescha/website | f59d02d17aff4a12328be37e0d6ce6be7b2717cb | [
"MIT"
] | null | null | null | spec/controllers/participates_controller_spec.rb | muescha/website | f59d02d17aff4a12328be37e0d6ce6be7b2717cb | [
"MIT"
] | null | null | null | spec/controllers/participates_controller_spec.rb | muescha/website | f59d02d17aff4a12328be37e0d6ce6be7b2717cb | [
"MIT"
] | null | null | null | require 'spec_helper'
def assert_response_for single_event, format, query_params={}
assert_template(/single_events\/_participants|participates\/update/) if format == :js
assert_redirected_to event_single_event_path(single_event.event, single_event, query_params) if format == :html
end
describe ParticipatesController, type: :controller do
include Devise::TestHelpers
[:html, :js].each do |format|
it "should create participate with format #{format}" do
single_event = FactoryGirl.create(:single_event)
user = FactoryGirl.create(:bodo)
sign_in user
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :push
expect(single_event.users.first).to eq(user)
assert_response_for single_event, format
end
it "should delete participate with format #{format}" do
single_event = FactoryGirl.create(:single_event)
user = FactoryGirl.create(:bodo)
single_event.users << user
sign_in user
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :delete
single_event.reload
expect(single_event.users.length).to eq(0)
assert_response_for single_event, format
end
it "should not create external participation if no email provided with format #{format}" do
single_event = FactoryGirl.create(:single_event)
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :push, name: "Hans Wurst"
expect(single_event.external_users.length).to eq(0)
expect(flash[:error]).not_to be_nil
assert_response_for single_event, format, { name: "Hans Wurst" }
end
it "should not create external participation if invalid email provided with format #{format}" do
single_event = FactoryGirl.create(:single_event)
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :push, name: "Hans Wurst", email: "hans#wurst.de"
expect(single_event.external_users.length).to eq(0)
expect(flash[:error]).not_to be_nil
assert_response_for single_event, format, { name: "Hans Wurst", email: "hans#wurst.de" }
end
it "should create external participation if not logged in with format #{format}" do
single_event = FactoryGirl.create(:single_event)
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :push, name: "Hans Wurst", email: "hans@wurst.de"
expect(single_event.external_users.length).to eq(1)
expect(flash[:error]).to be_nil
assert_response_for single_event, format
end
it "should store a uuid in a permanent cookie when an external participation is saved with format #{format}" do
single_event = FactoryGirl.create(:single_event)
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :push, name: "Hans Wurst", email: "hans@wurst.de"
expect(cookies[:hacken_uuid]).not_to be_nil
end
it "should not generate a new uuid if one is already set with format #{format}" do
single_event = FactoryGirl.create(:single_event)
old_cookie_value = cookies[:hacken_uuid] = "ich_habe_schon_eine_id"
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :push, name: "Hans Wurst", email: "hans@wurst.de"
expect(cookies[:hacken_uuid]).to eq(old_cookie_value)
end
it "should store the participants data in a cookie, when the keep_data parameter is passed in with format #{format}" do
single_event = FactoryGirl.create(:single_event)
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :push, name: "Hans Wurst", email: "hans@wurst.de", keep_data: "1"
expect(JSON.parse(cookies.signed[:hacken_daten] || "{}", symbolize_names: true)).to eq({ email: "hans@wurst.de", name: "Hans Wurst" })
end
it "should not delete external participation if no uuid is present in cookie with format #{format}" do
single_event = FactoryGirl.create(:single_event)
single_event.external_users.create(name: "Hans Wurst", email:"hans@wurst.de", session_token: "abc123")
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :delete
single_event.reload
expect(single_event.external_users.length).to eq(1)
expect(flash[:error]).not_to be_nil
assert_response_for single_event, format
end
it "should delete external participation if uuid is present in cookie with format #{format}" do
single_event = FactoryGirl.create(:single_event)
single_event.external_users.create(name: "Hans Wurst", email:"hans@wurst.de", session_token: "abc123")
cookies[:hacken_uuid] = "abc123"
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :delete
single_event.reload
expect(single_event.external_users.length).to eq(0)
expect(flash[:error]).to be_nil
assert_response_for single_event, format
end
it "should not create participate two times for the same event with format #{format}" do
single_event = FactoryGirl.create(:single_event)
user = FactoryGirl.create(:bodo)
sign_in user
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :push
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :push
expect(single_event.users.length).to eq(1)
assert_response_for single_event, format
end
it "should not delete participate if not participant of event with format #{format}" do
single_event = FactoryGirl.create(:single_event)
FactoryGirl.create(:bodo)
post :update, single_event_id: single_event.id, event_id: single_event.event.id, format: format, state: :delete
single_event.reload
expect(single_event.users.length).to eq(0)
expect(flash[:error]).not_to be_nil
assert_response_for single_event, format
end
end
end
| 42.89726 | 175 | 0.723455 |
4748d12469f7a00c0905d8e3c025fa358f284ae0 | 476 | html | HTML | layouts/partials/related-posts.html | SeteMares/kinchaku_theme | ee9e37a5816fdf14a01cc9cc246161ae23e437f2 | [
"MIT"
] | null | null | null | layouts/partials/related-posts.html | SeteMares/kinchaku_theme | ee9e37a5816fdf14a01cc9cc246161ae23e437f2 | [
"MIT"
] | null | null | null | layouts/partials/related-posts.html | SeteMares/kinchaku_theme | ee9e37a5816fdf14a01cc9cc246161ae23e437f2 | [
"MIT"
] | null | null | null | <li class="media mb-3">
<a title="{{ .Title }}" href="{{ .RelPermalink }}" class="d-none d-sm-block">
<img class="mr-3 img-thumbnail img-fluid" width="200" alt="{{ .Title }}"
src="{{ with .Params.heroBackground }}{{ . | absURL }}{{ end }}" alt="{{ .Params.title }}">
</a>
<div class="media-body">
<h5 class="mt-0 mb-1">
<a title="{{ .Title }}" href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
</h5>
{{ .Description }}
</div>
</li>
| 36.615385 | 97 | 0.52521 |
5b2e4b9eba6a432e803957aa81ce39c917fe7db8 | 431 | h | C | src/svnrev.h | Lotharyx/kicad-librarian | 379e09c0c5113e75ac2ad2008b0e14b01daa831f | [
"Apache-2.0"
] | 41 | 2016-11-04T11:36:22.000Z | 2022-02-09T20:10:05.000Z | src/svnrev.h | Lotharyx/kicad-librarian | 379e09c0c5113e75ac2ad2008b0e14b01daa831f | [
"Apache-2.0"
] | 10 | 2016-11-04T09:53:58.000Z | 2022-02-23T15:49:03.000Z | src/svnrev.h | Lotharyx/kicad-librarian | 379e09c0c5113e75ac2ad2008b0e14b01daa831f | [
"Apache-2.0"
] | 15 | 2016-11-01T17:16:57.000Z | 2021-06-26T12:33:27.000Z | /* This file was generated by the "svnrev" utility
* (http://www.compuphase.com/svnrev.htm).
* You should not modify it manually, as it may be re-generated.
*
* $Revision: 5907$
* $Date: 2018-12-14$
*/
#ifndef SVN_REV_H
#define SVN_REV_H
#define SVN_REV 5907
#define SVN_REVSTR "1.4.5907"
#define SVN_REVDATE "2018-12-14"
#define SVN_REVSTAMP 20181214L
#define SVN_REVMODIFIED 0
#endif /* SVN_REV_H */
| 22.684211 | 65 | 0.686775 |
04b6f52dc49236eeafd94fb252ad3038cd6b5482 | 1,445 | html | HTML | zstack_dashboard/static/templates/cluster/attachPrimaryStorage.html | code1k/zstack-dashboard | 6f2e6db7f7734012be75fa3a3ba8f1c385826e75 | [
"Apache-2.0"
] | null | null | null | zstack_dashboard/static/templates/cluster/attachPrimaryStorage.html | code1k/zstack-dashboard | 6f2e6db7f7734012be75fa3a3ba8f1c385826e75 | [
"Apache-2.0"
] | null | null | null | zstack_dashboard/static/templates/cluster/attachPrimaryStorage.html | code1k/zstack-dashboard | 6f2e6db7f7734012be75fa3a3ba8f1c385826e75 | [
"Apache-2.0"
] | null | null | null | <div kendo-window="attachPrimaryStorage__" k-visible="false" k-options="attachPrimaryStorageOptions__">
<div>
<div class="alert alert-warning col-sm-21" ng-show="!hasPrimaryStorage()">
{{"cluster.attachPrimaryStorage.hasPrimaryStorage()" | translate}} <a href="/#/primaryStorage">{{"cluster.attachPrimaryStorage.primary storage" | translate}}</a> {{"cluster.attachPrimaryStorage.hasPrimaryStorage2()" | translate}}
</div>
<div class="clearfix"></div>
<h4 class="z-win-h4">{{"cluster.attachPrimaryStorage.ATTACH PRIMARY STORAGE" | translate}}</h4>
<form class="form">
<div class="form-group col-sm-18">
<label for="ps">{{"cluster.attachPrimaryStorage.PRIMARY STORAGE" | translate}}</label>
<select id="ps" kendo-multi-select="primaryStorageList__" k-options="primaryStorageListOptions__" class="z-win-dropdown"></select>
<p class="z-hint">{{"cluster.attachPrimaryStorage.HINT" | translate}}</p>
</div>
<div class="form-group col-lg-18">
<button type="button" class="btn btn-default" ng-click="cancel()">{{"cluster.attachPrimaryStorage.Cancel" | translate}}</button>
<button type="button" class="btn btn-primary" ng-disabled="!canProceed()" ng-click="done()">{{"cluster.attachPrimaryStorage.Attach" | translate}}</button>
</div>
</form>
</div>
</div>
| 68.809524 | 241 | 0.636678 |
4063d38eaf4852881f358cbea1fc33adfe640f68 | 3,071 | py | Python | openstack/tests/unit/csbs/v1/test_policy.py | wangrui1121/huaweicloud-sdk-python | 240abe00288760115d1791012d4e3c4592d77ad1 | [
"Apache-2.0"
] | 43 | 2018-12-19T08:39:15.000Z | 2021-07-21T02:45:43.000Z | openstack/tests/unit/csbs/v1/test_policy.py | wangrui1121/huaweicloud-sdk-python | 240abe00288760115d1791012d4e3c4592d77ad1 | [
"Apache-2.0"
] | 11 | 2019-03-17T13:28:56.000Z | 2020-09-23T23:57:50.000Z | openstack/tests/unit/csbs/v1/test_policy.py | wangrui1121/huaweicloud-sdk-python | 240abe00288760115d1791012d4e3c4592d77ad1 | [
"Apache-2.0"
] | 47 | 2018-12-19T05:14:25.000Z | 2022-03-19T15:28:30.000Z | # -*- coding:utf-8 -*-
# Copyright 2018 Huawei Technologies Co.,Ltd.
#
# 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 testtools
from openstack.csbs.v1 import policy as _policy
DATA = {
"project_id": "Test project_id for URI and Response",
"policy_id": "Test policy_id for URI",
"description": "Test description for Request and Response",
"name": "Test name for Request and Response",
"parameters": {
# Test parameters for Request and Response
},
"provider_id": "Test provider_id for Request and Response",
"resources": [
# Test resources for Request and Response
],
"scheduled_operations": [
# Test scheduled_operations for Request and Response
],
"created_at": "Test created_at for Response",
"id": "Test id for Response",
"status": "Test status for Response"
}
class TestPolicy(testtools.TestCase):
def setUp(self):
super(TestPolicy, self).setUp()
def test_basic(self):
policy = _policy.Policy()
self.assertEqual("policy", policy.resource_key)
self.assertEqual("policies", policy.resources_key)
self.assertEqual("/policies", policy.base_path)
self.assertEqual("data-protect", policy.service.service_type)
self.assertEqual(True, policy.service.requires_project_id)
self.assertTrue(policy.allow_create)
self.assertTrue(policy.allow_delete)
self.assertTrue(policy.allow_update)
self.assertTrue(policy.allow_get)
self.assertTrue(policy.allow_list)
self.assertDictEqual(
{
"limit": "limit",
"marker": "marker",
"sort": "sort",
"name": "name",
"all_tenants": "all_tenants",
"offset": "offset"
},
policy._query_mapping._mapping
)
def test_make_it(self):
policy = _policy.Policy(**DATA)
self.assertEqual(DATA["project_id"], policy.project_id)
self.assertEqual(DATA["description"], policy.description)
self.assertEqual(DATA["name"], policy.name)
self.assertEqual(DATA["parameters"], policy.parameters)
self.assertEqual(DATA["provider_id"], policy.provider_id)
self.assertEqual(DATA["resources"], policy.resources)
self.assertEqual(DATA["scheduled_operations"], policy.scheduled_operations)
self.assertEqual(DATA["created_at"], policy.created_at)
self.assertEqual(DATA["id"], policy.id)
self.assertEqual(DATA["status"], policy.status)
| 34.505618 | 83 | 0.660371 |
d952802c5956ff0e878f555080fee740876ca749 | 1,187 | rs | Rust | specifications/src/status.rs | onnovalkering/brane | e2a0e5a8659db6454fd73d8cd99bc610b84043ea | [
"Apache-2.0"
] | 5 | 2020-09-14T09:42:23.000Z | 2021-09-25T17:10:22.000Z | specifications/src/status.rs | onnovalkering/brane | e2a0e5a8659db6454fd73d8cd99bc610b84043ea | [
"Apache-2.0"
] | 20 | 2020-11-11T23:04:23.000Z | 2021-12-01T00:59:31.000Z | specifications/src/status.rs | onnovalkering/brane | e2a0e5a8659db6454fd73d8cd99bc610b84043ea | [
"Apache-2.0"
] | 2 | 2021-06-04T11:36:17.000Z | 2021-08-02T11:29:51.000Z | use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
#[skip_serializing_none]
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StatusInfo {
pub created: DateTime<Utc>,
pub instruction_id: i32,
pub invocation_id: i32,
pub status: Status,
}
impl StatusInfo {
pub fn new(
instruction_id: i32,
invocation_id: i32,
status: Status,
) -> Self {
let created = Utc::now();
StatusInfo {
created,
instruction_id,
invocation_id,
status,
}
}
}
#[skip_serializing_none]
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "variant", rename_all = "camelCase")]
pub enum Status {
Transfer(TransferStatus),
}
#[skip_serializing_none]
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TransferStatus {
pub geo_source: Option<(f32, f32)>,
pub geo_destination: Option<(f32, f32)>,
pub total_files: Option<i32>,
pub total_size: Option<i32>,
pub done_files: Option<i32>,
pub done_size: Option<i32>,
}
| 23.74 | 51 | 0.646167 |
48f1a1b4525ad00874cc334655bd9aa79431af47 | 449 | h | C | ios/bc3.1/Frameworks/AlibcTradeSDK.framework/Headers/AliJSBridgeDynamicHandler.h | RyanFu/DSJAPP | db6d8fa4719052dcb4de3557e966d633eeff8fcb | [
"BSD-3-Clause"
] | 1 | 2019-03-13T15:46:58.000Z | 2019-03-13T15:46:58.000Z | ios/bc3.1/Frameworks/AlibcTradeSDK.framework/Headers/AliJSBridgeDynamicHandler.h | RyanFu/DSJAPP | db6d8fa4719052dcb4de3557e966d633eeff8fcb | [
"BSD-3-Clause"
] | null | null | null | ios/bc3.1/Frameworks/AlibcTradeSDK.framework/Headers/AliJSBridgeDynamicHandler.h | RyanFu/DSJAPP | db6d8fa4719052dcb4de3557e966d633eeff8fcb | [
"BSD-3-Clause"
] | null | null | null | /*
* AliJSBridgeDynamicHandler.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeSDK
* 版本号:3.1.1.14
* 发布时间:2016-12-04
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "ALiHybridContext.h"
//继承该类,并且实现一个如下格式的函数即可
@interface AliJSBridgeDynamicHandler : NSObject
//+ (void)yourFun:(ALiHybridContext*)context param:(NSDictionary*)param;
@end
| 21.380952 | 72 | 0.741648 |
9e5bc04ed67dee27311d6dabf51cee0a124a5a5c | 688 | swift | Swift | Source/LinkedinSwiftConfiguration.swift | simformsolutions/SSLinkedIn | a2a7135e919209410ba075de663af52affc0308b | [
"MIT"
] | 3 | 2018-11-26T09:51:45.000Z | 2019-04-05T07:15:59.000Z | Source/LinkedinSwiftConfiguration.swift | simformsolutions/SSLinkedIn | a2a7135e919209410ba075de663af52affc0308b | [
"MIT"
] | null | null | null | Source/LinkedinSwiftConfiguration.swift | simformsolutions/SSLinkedIn | a2a7135e919209410ba075de663af52affc0308b | [
"MIT"
] | null | null | null | // LinkedinSwiftApplication.m
// LinkedinSwift
//
// Created by PranayPatel on 11/05/18.
// Copyright © 2018 Simform Solutions Pvt.Ltd. All rights reserved.
//
import UIKit
import Foundation
class LinkedinSwiftConfiguration {
let clientId: String?
let clientSecret: String?
let state: String?
let permissions: Array<Any>
let redirectUrl: String?
init(clientId: String?, clientSecret: String?, state: String?, permisssions: Array<Any>, redirectUrl: String? ) {
self.clientId = clientId
self.clientSecret = clientSecret
self.state = state
self.permissions = permisssions
self.redirectUrl = redirectUrl
}
}
| 25.481481 | 117 | 0.681686 |
4ed9aecf52b78e36522197d9ddd00809b1eb51d0 | 446 | kt | Kotlin | app/src/main/java/io/github/wulkanowy/data/db/dao/ConferenceDao.kt | MRmlik12/wulkanowy | 15280857aab83c0c8f270feaa9b8f322ddb150c2 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/io/github/wulkanowy/data/db/dao/ConferenceDao.kt | MRmlik12/wulkanowy | 15280857aab83c0c8f270feaa9b8f322ddb150c2 | [
"Apache-2.0"
] | 54 | 2021-06-12T06:45:25.000Z | 2022-03-28T00:37:04.000Z | app/src/main/java/io/github/wulkanowy/data/db/dao/ConferenceDao.kt | MRmlik12/wulkanowy | 15280857aab83c0c8f270feaa9b8f322ddb150c2 | [
"Apache-2.0"
] | null | null | null | package io.github.wulkanowy.data.db.dao
import androidx.room.Dao
import androidx.room.Query
import io.github.wulkanowy.data.db.entities.Conference
import kotlinx.coroutines.flow.Flow
import javax.inject.Singleton
@Dao
@Singleton
interface ConferenceDao : BaseDao<Conference> {
@Query("SELECT * FROM Conferences WHERE diary_id = :diaryId AND student_id = :studentId")
fun loadAll(diaryId: Int, studentId: Int): Flow<List<Conference>>
}
| 27.875 | 93 | 0.784753 |
76cb4db8b2a27517f39c441707740d5bf4577e25 | 1,842 | h | C | Applications/Podcasts/MTSetPlaybackQueueUtil.h | lechium/tvOS135Headers | 46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac | [
"MIT"
] | 2 | 2020-07-26T20:30:54.000Z | 2020-08-10T04:26:23.000Z | Applications/Podcasts/MTSetPlaybackQueueUtil.h | lechium/tvOS135Headers | 46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac | [
"MIT"
] | 1 | 2020-07-26T20:45:31.000Z | 2020-08-09T09:30:46.000Z | Applications/Podcasts/MTSetPlaybackQueueUtil.h | lechium/tvOS135Headers | 46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac | [
"MIT"
] | null | null | null | //
// Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Jun 10 2020 10:03:13).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <objc/NSObject.h>
@interface MTSetPlaybackQueueUtil : NSObject
{
}
+ (long long)_automaticCommandStatusForRequestStatus:(long long)arg1; // IMP=0x000000010007d678
+ (_Bool)_setPlaybackQueueForPodcastAdamId:(id)arg1 siriAssetInfo:(id)arg2 playbackOrder:(long long)arg3 startPlayback:(_Bool)arg4 reason:(unsigned long long)arg5 interactive:(_Bool)arg6 enqueuedByAnotherUser:(_Bool)arg7 completion:(CDUnknownBlockType)arg8; // IMP=0x000000010007d170
+ (_Bool)_setManifest:(id)arg1 queueType:(long long)arg2 startPlayback:(_Bool)arg3 forceLocal:(_Bool)arg4 reason:(unsigned long long)arg5 interactive:(_Bool)arg6 completion:(CDUnknownBlockType)arg7; // IMP=0x000000010007d024
+ (_Bool)_setPlaybackQueueForMyPodcastsWithOrder:(long long)arg1 startPlayback:(_Bool)arg2 forceLocal:(_Bool)arg3 reason:(unsigned long long)arg4 interactive:(_Bool)arg5 completion:(CDUnknownBlockType)arg6; // IMP=0x000000010007cd78
+ (long long)subscribeCommandStatusForErrorCode:(long long)arg1; // IMP=0x000000010007cd58
+ (long long)queueCommandStatusForRequestStatus:(long long)arg1 queueType:(long long)arg2; // IMP=0x000000010007cd38
+ (_Bool)setAutoResumePlaybackQueueAndStartPlayback:(_Bool)arg1 forceLocal:(_Bool)arg2 reason:(unsigned long long)arg3 interactive:(_Bool)arg4 completion:(CDUnknownBlockType)arg5; // IMP=0x000000010007cd14
+ (_Bool)subscribeWithCommandURL:(id)arg1 siriAssetInfo:(id)arg2 completion:(CDUnknownBlockType)arg3; // IMP=0x000000010007c85c
+ (_Bool)setPlaybackQueueForRequest:(id)arg1 siriAssetInfo:(id)arg2 enqueuerDSID:(id)arg3 startPlayback:(_Bool)arg4 isMagicMoment:(_Bool)arg5 completion:(CDUnknownBlockType)arg6; // IMP=0x000000010007b69c
@end
| 73.68 | 283 | 0.813246 |
8774ad14e503585cf3793c40d6efa69455490f45 | 11,605 | html | HTML | src/app/user-interviewer/home/home.component.html | praku12/angular | 8d9bbcef5a4a00825f001182a303c9179f2dc742 | [
"MIT"
] | null | null | null | src/app/user-interviewer/home/home.component.html | praku12/angular | 8d9bbcef5a4a00825f001182a303c9179f2dc742 | [
"MIT"
] | null | null | null | src/app/user-interviewer/home/home.component.html | praku12/angular | 8d9bbcef5a4a00825f001182a303c9179f2dc742 | [
"MIT"
] | null | null | null |
<!-- <div class="home">
<div class="container-fluid">
<mat-toolbar>
<h5 class="form-group walkintype" style="margin-left: 5px;">
ongoing-interview
</h5>
</mat-toolbar>
<mat-toolbar>
<div class="hiring_status ">
<img src="assets/img/Rectangle.png" style="width: 100%;">
<div class="text-block">
<p style="margin-bottom: 0px;text-align: center;"> Android Developer</p>
<small>Skills: Java, Android Studio..</small><br>
<small>Experience: 0-3 Years</small>
</div>
<div class="text-center">
<p style="margin-bottom: 0px;text-align: center;">Banglore</p>
</div>
<div class="text-right">
<p class="live" style="background-color: red;margin-bottom: 0px;text-align: center;">Live</p>
<small>Salary Package: NA.</small><br>
<small>Vacancies: 3</small>
</div>
<p class="alignleft"><strong>Hiring Status</strong></p>
<p class="alignright hide"><button class="downarrow" style="background: transparent;border: none !important;" (click)="view()" id="button"><i class="arrow up"></i></button></p>
<div style="display: none;" class="ongoing_content">
<p style="color: mediumblue;font-family: Avenir;font-weight:900px;font-size:25px;">0</p>
<small style="font-size: xx-small;"><strong>Total Candidates<br>
Selected in Screnning</strong></small>
</div>
<div style="display: none;" class="ongoing_content1">
<p style="color: rgb(211, 94, 166);font-family: Avenir;font-weight:900px;font-size:25px;" >0</p>
<small style="font-size: xx-small;"><strong>Total Candidates<br>Selected in Aptitude</strong></small>
</div>
<div style="display: none;" class="ongoing_content2">
<p style="color: rgb(153, 193, 226);font-family: Avenir;font-weight:900px;font-size:25px;">0</p>
<small style="font-size: xx-small;"><strong>Total Candidates<br>Selected in Face to Face</strong></small>
</div>
<div style="display: none;" class="ongoing_content3">
<p style="color: rgb(211, 137, 27);font-family: Avenir;font-weight:900px;font-size:25px;">0</p>
<small style="font-size: xx-small;"><strong>Total Candidates<br>Selected in HR Interview</strong></small>
</div>
<p style="display:none"class="alignright show"><button class="uparrow" style="background: transparent;border: none !important;" (click)="hide()" id="button"><i class="arrow down"></i></button></p>
</div>
</mat-toolbar>
<br>
<mat-toolbar>
<h5 class="walkintype" style="margin-left:5px;">
upcoming-interview
</h5>
</mat-toolbar>
<li *ngFor='let in of counter(2) ;let i = index'>
<mat-toolbar>
<div class="hiring_status">
<img src="assets/img/Rectangle.png" style="width: 100%;">
<div class="text-block">
<p style="margin-bottom: 0px;text-align: center;">Android Developer</p>
<small>Skills: Java, Android Studio..</small><br>
<small>Experience: 0-3 Years</small>
</div>
<div class="text-center">
<p style="margin-bottom: 0px;text-align: center;">Banglore</p>
</div>
<div class="text-right">
<p style="margin-bottom: 0px;text-align: center;">19th Oct, 2020, 10:30 am</p>
<small>Salary Package: NA.</small><br>
<small>Vacancies: 3</small>
</div>
<p class="alignleft"><strong>Hiring Status</strong></p>
<p class="alignright"><button style="background: transparent;border: none !important;" (click)="view1()"><i class="arrow up"></i></button></p>
</div>
</mat-toolbar>
</li>
<br>
</div>
</div> -->
<!-- Live -->
<mat-toolbar>
<h5 class="form-group walkintype" style="margin-left:9%;">
ongoing-interview
</h5>
</mat-toolbar>
<div class="container-fluid ">
<div style="background-image:url('assets/img/Rectangle.png');">
<div class="row m-0 p-2">
<div class="col-sm-4">
<p class="card-text" style="color: mintcream;"><img src="assets/img/case.png"> Android Developer</p>
<small class="card-text" style="color: mintcream;">Skills: Java, Android Studio..</small>
<p class="card-text" style="color: mintcream;">Experience: 0-3 Years</p>
</div>
<div class="col-sm-4" style="text-align: center">
<p class="card-text" style="color: mintcream;"><i class="fa fa-map-marker" aria-hidden="true"></i> banglore</p>
</div>
<div class="col-sm-4" style="text-align: right;">
<!-- <small class="live"><span >•</span>Live</small> -->
<p class="card-text1" style="color: mintcream;"><span class="live">•Live</span></p>
<p class="card-text1" style="color: mintcream;">Salary Package: NA.</p>
<small class="card-text1" style="color: mintcream;">Vacancies: 3</small>
</div>
</div>
<div style="background-color:white;" class="div_extra div_extra">
<h5 class="card-text">Hiring status</h5>
<div class="row m-0 ">
<div style="display: none;text-align: center;" class="ongoing_content col-sm-3 col-6 p-2">
<div>
<p style="color: rgb(82, 27, 211);font-family: Avenir;font-weight:900px;font-size:25px;">0</p>
<small style="font-size: xx-small;"><strong>Total Candidates<br> Selected in HR Interview </strong></small>
</div>
</div>
<div style="display: none; text-align: center;" class="ongoing_content1 col-sm-3 col-6 p-2">
<div>
<p style="color: rgb(211, 94, 166);font-family: Avenir;font-weight:900px;font-size:25px;" >0</p>
<small style="font-size: xx-small;"><strong>Total Candidates<br> Selected in Aptitude </strong></small>
</div>
</div>
<div style="display:none;text-align: center;" class="ongoing_content2 col-sm-3 col-6 p-2">
<div>
<p style="color: rgb(153, 193, 226);font-family: Avenir;font-weight:900px;font-size:25px;">0</p>
<small style="font-size: xx-small;"><strong>Total Candidates<br> Selected in Face to Face </strong></small>
</div>
</div>
<div style="display: none;text-align: center;" class="ongoing_content3 col-sm-3 col-6 p-2">
<div>
<p style="color: rgb(211, 137, 27);font-family: Avenir;font-weight:900px;font-size:25px;">0</p>
<small style="font-size: xx-small;"><strong>Total Candidates<br> Selected in HR Interview </strong></small>
</div></div>
<p style="display:none"class="alignright show"><button class="uparrow" style="background: transparent;border: none !important;" (click)="hide()" id="button"><i class="arrow down"></i></button></p>
</div>
<p class="alignright hide"><button class="downarrow" style="background: transparent;border: none !important;" (click)="view()" id="button"><i class="arrow up"></i></button></p>
</div>
</div>
</div>
<br>
<mat-toolbar>
<h5 class="form-group walkintype" style="margin-left:9%;">
upcoming-interview
</h5>
</mat-toolbar>
<li *ngFor='let in of counter(2) ;let i = index'>
<div class="container-fluid">
<div style="background-image:url('assets/img/Rectangle.png');">
<div class="row">
<div class="col-sm-4">
<p class="card-text" style="color: mintcream;"><img src="assets/img/case.png"> Android Developer</p>
<small class="card-text" style="color: mintcream;">Skills: Java, Android Studio..</small>
<p class="card-text" style="color: mintcream;">Experience: 0-3 Years</p>
</div>
<div class="col-sm-4" style="text-align: center">
<p class="card-text" style="color: mintcream;"><i class="fa fa-map-marker" aria-hidden="true"></i> banglore</p>
</div>
<div class="col-sm-4" style="text-align: right;">
<!-- <h5 class="live"><span style="font-size: large;">•</span>Live</h5> -->
<p class="card-text1" style="color: mintcream;">20th Oct, 2020, 10:30 am</p>
<p class="card-text1" style="color: mintcream;">Salary Package: NA.</p>
<small class="card-text1" style="color: mintcream;">Vacancies: 3</small>
</div>
</div>
<div style="background-color:white;" class="div_extra1" id="div_{{i}}">
<h5 class="card-text">Hiring status</h5>
<div class="row">
<div style="display: none;text-align: center;" class="col-sm-4 upgoing_content" id="upgoing_content_{{i}}">
<p style="color: rgb(82, 27, 211);font-family: Avenir;font-weight:900px;font-size:25px;">0</p>
<small style="font-size:10px;"><strong>Total Candidates<br>Selected in HR Interview</strong></small>
</div>
<div style="display: none; text-align: center;" class="col-sm-4 upgoing_content1" id="upgoing_content1_{{i}}">
<p style="color: rgb(211, 94, 166);font-family: Avenir;font-weight:900px;font-size:25px;" >0</p>
<small style="font-size: 10px;"><strong>Total Candidates<br> Selected in Aptitude</strong></small>
</div>
<div style="display:none;text-align: center;" class="col-sm-4 upgoing_content2" id="upgoing_content2_{{i}}">
<p style="color: rgb(153, 193, 226);font-family: Avenir;font-weight:900px;font-size:25px;">0</p>
<small style="font-size: 10px;"><strong>Total Candidates<br>Selected in Face to Face</strong></small>
</div>
<div style="display: none;text-align: center;" class="col-sm-4 upgoing_content3" id="upgoing_content3_{{i}}">
<p style="color: rgb(211, 137, 27);font-family: Avenir;font-weight:900px;font-size:25px;">0</p>
<small style="font-size:10px;"><strong>Total Candidates<br>Selected in HR Interview</strong></small>
</div>
</div>
<p class="alignright hide1" id="hide1_{{i}}"><button class="downarrow" style="background: transparent;border: none !important;" (click)="view1(i)" id="button"><i class="arrow up"></i></button></p>
<p style="display:none"class="alignright show1" id="show1_{{i}}"><button class="uparrow" style="background: transparent;border: none !important;" (click)="hide1(i)" id="button"><i class="arrow down"></i></button></p> <br>
<br>
</div>
</div>
</div>
</li>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<!--
<mat-toolbar>
<h5 class="form-group walkintype" style="margin-left:12%;">
upcoming-interview
</h5>
</mat-toolbar>
<li *ngFor='let in of counter(2) ;let i = index'>
<div class="card mb-3">
<img class="card-img-top" src="assets/img/Rectangle.png" alt="Card image cap" style="height: auto;">
<div class="card-img-overlay">
<p class="card-title" style="color: mintcream;">Android Developer</p>
<small class="card-text" style="color: mintcream;">Skills: Java, Android Studio..</small>
<p class="card-text" style="color: mintcream;">Experience: 0-3 Years</p>
</div>
<div class="card-img-overlay" style="text-align: right;">
<small class="card-text" style="background-color: rgb(247, 9, 9);">LIVE</small>
<p class="card-text" style="color: mintcream;">20th Oct, 2020, 10:30 am</p>
<p class="card-text" style="color: mintcream;">Salary Package: NA.</p>
<small class="card-text" style="color: mintcream;">Vacancies: 3</small>
</div>
<div class="card-body" >
<h5 class="card-text">Hiring status</h5>
<p class="card-text alignright"><button style="background: transparent;border: none !important;" (click)="view()"><i class="arrow up"></i></button></p>
</div>
</div> -->
| 42.509158 | 229 | 0.621025 |
be651f2ed1a787154081975638fa856bca437063 | 8,099 | rs | Rust | tests/src/lib.rs | casper-ecosystem/kv-storage-contract | 8eda3ae30c29f40bd7a0c1c7b4199fd49f6083b8 | [
"Apache-2.0"
] | 2 | 2021-09-06T04:24:24.000Z | 2021-09-22T02:11:55.000Z | tests/src/lib.rs | casper-ecosystem/kv-storage-contract | 8eda3ae30c29f40bd7a0c1c7b4199fd49f6083b8 | [
"Apache-2.0"
] | 5 | 2021-04-20T11:54:40.000Z | 2022-03-25T18:35:35.000Z | tests/src/lib.rs | casper-ecosystem/kv-storage-contract | 8eda3ae30c29f40bd7a0c1c7b4199fd49f6083b8 | [
"Apache-2.0"
] | 4 | 2021-01-23T18:24:11.000Z | 2021-09-26T12:26:00.000Z | #[cfg(test)]
mod kv_storage;
#[cfg(test)]
mod tests {
use super::kv_storage;
use casper_types::{
account::AccountHash,
bytesrepr::{Bytes, FromBytes, ToBytes},
AsymmetricType, CLTyped, Key, PublicKey, U128, U256, U512,
};
use kv_storage::KVstorageContract;
use std::collections::BTreeMap;
fn generic_test<T: CLTyped + FromBytes + ToBytes>(
fn_name: &str,
key_name: &str,
value1: T,
value2: T,
) -> (T, T) {
let mut kv_storage = KVstorageContract::deploy();
kv_storage.call_store_value(fn_name, key_name, value1);
let check1: T = kv_storage.query_contract(key_name).unwrap();
kv_storage.call_store_value(fn_name, key_name, value2);
let check2: T = kv_storage.query_contract(key_name).unwrap();
(check1, check2)
}
#[test]
fn should_store_bool() {
let (value1, value2): (bool, bool) = (true, false);
let (ret1, ret2) = generic_test::<bool>("store_bool", "test_bool", value1, value2);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_i32() {
let (value1, value2): (i32, i32) = (7i32, 9i32);
let (ret1, ret2) = generic_test::<i32>("store_i32", "test_i32", value1, value2);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_i64() {
let (value1, value2): (i64, i64) = (3i64, 5i64);
let (ret1, ret2) = generic_test::<i64>("store_i64", "test_i64", value1, value2);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_u8() {
let (value1, value2): (u8, u8) = (1u8, 3u8);
let (ret1, ret2) = generic_test::<u8>("store_u8", "test_u8", value1, value2);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_u32() {
let (value1, value2): (u32, u32) = (1u32, 3u32);
let (ret1, ret2) = generic_test::<u32>("store_u32", "test_u32", value1, value2);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_u64() {
let (value1, value2): (u64, u64) = (1u64, 3u64);
let (ret1, ret2) = generic_test::<u64>("store_u64", "test_u64", value1, value2);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_u128() {
let (value1, value2): (U128, U128) = (U128::from(1), U128::from(3));
let (ret1, ret2) = generic_test::<U128>("store_u128", "test_u128", value1, value2);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_u256() {
let (value1, value2): (U256, U256) = (U256::from(10), U256::from(30));
let (ret1, ret2) = generic_test::<U256>("store_u256", "test_u256", value1, value2);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_u512() {
let (value1, value2): (U512, U512) = (U512::from(100), U512::from(300));
let (ret1, ret2) = generic_test::<U512>("store_u512", "test_u512", value1, value2);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_string() {
let (value1, value2) = (String::from("hello"), String::from("world"));
let (ret1, ret2) = generic_test::<String>(
"store_string",
"test_string",
value1.clone(),
value2.clone(),
);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_key() {
let (value1, value2): (Key, Key) = (
Key::Account(AccountHash::new([7u8; 32])),
Key::Account(AccountHash::new([9u8; 32])),
);
let (ret1, ret2) = generic_test::<Key>("store_key", "test_key", value1, value2);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_public_key() {
let (value1, value2): (PublicKey, PublicKey) = (
PublicKey::ed25519_from_bytes([1u8; 32]).unwrap(),
PublicKey::ed25519_from_bytes([3u8; 32]).unwrap(),
);
let (ret1, ret2) = generic_test::<PublicKey>(
"store_public_key",
"test_PublicKey",
value1.clone(),
value2.clone(),
);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_option() {
let (value1, value2): (Option<String>, Option<String>) =
(Some(String::from("Hello")), None);
let (ret1, ret2) =
generic_test::<Option<String>>("store_option", "test_Option", value1.clone(), value2);
assert_eq!(value1.unwrap(), ret1.unwrap());
assert!(ret2.is_none());
}
#[test]
fn should_store_list_of_bytes() {
let (value1, value2): (Bytes, Bytes) = (
vec![0x41u8, 0x41u8, 0x42u8].into(),
vec![0x59u8, 0x59u8, 0x59u8].into(),
);
let (ret1, ret2) = generic_test::<Bytes>(
"store_list_of_bytes",
"test_list_of_bytes",
value1.clone(),
value2.clone(),
);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_byte_array() {
let (value1, value2): ([u8; 3], [u8; 3]) = ([1, 2, 3], [2, 4, 6]);
let (ret1, ret2) =
generic_test::<[u8; 3]>("store_byte_array", "test_ByteArray", value1, value2);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_result() {
let (value1, value2): (Result<String, String>, Result<String, String>) =
(Ok(String::from("Success")), Err(String::from("Fail")));
let (ret1, ret2) = generic_test::<Result<String, String>>(
"store_result",
"test_Result",
value1.clone(),
value2,
);
assert_eq!(value1, ret1);
assert!(ret2.is_err());
}
#[test]
fn should_store_map() {
let mut value1: BTreeMap<String, Option<String>> = BTreeMap::new();
value1.insert(String::from("alice"), Some(String::from("Purchased Milk")));
value1.insert(String::from("bob"), Some(String::from("Purchased Egg")));
let mut value2: BTreeMap<String, Option<String>> = BTreeMap::new();
value2.insert(String::from("alice"), Some(String::from("Sold Milk")));
value2.insert(String::from("jane"), Some(String::from("Purchased Cake")));
let (ret1, ret2) = generic_test::<BTreeMap<String, Option<String>>>(
"store_map",
"test_Map",
value1.clone(),
value2.clone(),
);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_tuple3() {
let value1: (PublicKey, Option<String>, U512) = (
PublicKey::ed25519_from_bytes([1u8; 32]).unwrap(),
Some(String::from("Original")),
U512::from(100),
);
let value2: (PublicKey, Option<String>, U512) = (
PublicKey::ed25519_from_bytes([3u8; 32]).unwrap(),
Some(String::from("Updated")),
U512::from(300),
);
let (ret1, ret2) = generic_test::<(PublicKey, Option<String>, U512)>(
"store_tuple3",
"test_Tuple3",
value1.clone(),
value2.clone(),
);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
#[test]
fn should_store_tuple2() {
let value1: (String, U512) = (String::from("Original"), U512::from(100));
let value2: (String, U512) = (String::from("Updated"), U512::from(300));
let (ret1, ret2) = generic_test::<(String, U512)>(
"store_tuple2",
"test_Tuple2",
value1.clone(),
value2.clone(),
);
assert_eq!(value1, ret1);
assert_eq!(value2, ret2);
}
}
| 33.192623 | 98 | 0.543647 |
af769dbb7663dc0e28e9b2bebb4a9deb128e36ab | 826 | rb | Ruby | spec/models/request_spec.rb | gferrarocamus/a-social-network | 3cf07614580726ea755c47fc6189da86a4681559 | [
"MIT"
] | 2 | 2019-10-07T12:53:29.000Z | 2020-01-31T17:17:05.000Z | spec/models/request_spec.rb | jeton-th/travelers-network | 334bc2c9842a51e13e162f08b0d072a356b0bc66 | [
"Ruby",
"MIT"
] | 13 | 2019-05-13T14:34:46.000Z | 2022-03-30T23:08:26.000Z | spec/models/request_spec.rb | jeton-th/travelers-network | 334bc2c9842a51e13e162f08b0d072a356b0bc66 | [
"Ruby",
"MIT"
] | 1 | 2019-08-29T13:32:46.000Z | 2019-08-29T13:32:46.000Z | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Request, type: :model do
let(:user) { create(:user) }
let(:friend) { create(:user) }
let(:request) { create(:request, sender: user, receiver: friend) }
it 'should be a valid request' do
expect(request).to be_valid
end
it 'should not be a valid request' do
invalid_request = request.dup
expect(invalid_request).not_to be_valid
end
it 'should not allow duplicate requests' do
request1 = request
request2 = build(:request, sender: request1.sender, receiver: request1.receiver)
expect(request2).not_to be_valid
end
it 'should not allow inverse requests' do
request1 = request
request2 = build(:request, sender: request1.receiver, receiver: request1.sender)
expect(request2).not_to be_valid
end
end
| 26.645161 | 84 | 0.715496 |
dfdf313dd6b6fd1f6b652ace14cf6f32eae60134 | 3,377 | tsx | TypeScript | src/components/parts/_legacy/publishing-calendar/PublishingCalendar.tsx | navikt/nav-enonicxp-frontend | acc589af3614209c20cf552a5483e9fbafb05abb | [
"MIT"
] | 3 | 2021-05-26T07:12:29.000Z | 2022-01-25T19:55:28.000Z | src/components/parts/_legacy/publishing-calendar/PublishingCalendar.tsx | navikt/nav-enonicxp-frontend | acc589af3614209c20cf552a5483e9fbafb05abb | [
"MIT"
] | 113 | 2021-04-06T08:55:38.000Z | 2022-03-31T10:12:01.000Z | src/components/parts/_legacy/publishing-calendar/PublishingCalendar.tsx | navikt/nav-enonicxp-frontend | acc589af3614209c20cf552a5483e9fbafb05abb | [
"MIT"
] | null | null | null | import * as React from 'react';
import { Heading, BodyLong, Ingress } from '@navikt/ds-react';
import { BEM } from '../../../../utils/classnames';
import { translator } from '../../../../translations';
import './PublishingCalendar.less';
import {
PublishingCalendarChildren,
PublishingCalendarEntries,
PublishingCalendarProps,
} from '../../../../types/content-props/publishing-calendar-props';
const monthShortName = [
'JAN',
'FEB',
'MAR',
'APR',
'MAI',
'JUN',
'JUL',
'AUG',
'SEP',
'OKT',
'NOV',
'DES',
];
const processEntries = (
children: PublishingCalendarChildren[]
): PublishingCalendarEntries[] => {
return children
.map((item) => {
const publDate = new Date(item.data.date);
return {
displayName: item.displayName,
period: item.data.period,
publDate,
day: publDate.getDate().toString() + '.',
month: monthShortName[publDate.getMonth()],
};
})
.sort((a, b) => a.publDate.getTime() - b.publDate.getTime()); // Dato for publisering: stigende
};
const PublishingCalendar = (props: PublishingCalendarProps) => {
const bem = BEM('publishing-calendar');
const getLabel = translator('publishingCalendar', props.language);
const items = processEntries(props.children);
return (
<div className={bem()}>
<header>
<Heading level="1" size="xlarge">
{props.displayName}
</Heading>
{props.data.ingress && (
<Ingress className={bem('preface')}>
{props.data.ingress}
</Ingress>
)}
</header>
<table className="tabell">
<thead>
<tr>
<th scope="col">
<span className="visuallyhidden">
{getLabel('publishdate')}
</span>
</th>
<th scope="col">
<span className="visuallyhidden">
{getLabel('event')}
</span>
</th>
</tr>
</thead>
<tbody>
{items.map((item, index) => {
return (
<tr key={`${item.displayName}_${index}`}>
<td>
<time>
<div>{item.day}</div>
<div>{item.month}</div>
</time>
</td>
<td className="eventInfo">
<BodyLong className="dateInfo">
{item.period}
</BodyLong>
<BodyLong>{item.displayName}</BodyLong>
</td>
</tr>
);
})}
</tbody>
</table>
</div>
);
};
export default PublishingCalendar;
| 33.107843 | 103 | 0.400651 |
39df88644a75896ea182b2d7fcf54c2a3170d3d5 | 602 | java | Java | src/main/java/com/github/minyk/morphlinesmr/shaded/com/googlecode/jcsv/writer/CSVColumnJoiner.java | chenxubai/morphline-mr-hfile | 1d17c69c6c56e4dd2d78398550d3ead0524a74d0 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/github/minyk/morphlinesmr/shaded/com/googlecode/jcsv/writer/CSVColumnJoiner.java | chenxubai/morphline-mr-hfile | 1d17c69c6c56e4dd2d78398550d3ead0524a74d0 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/github/minyk/morphlinesmr/shaded/com/googlecode/jcsv/writer/CSVColumnJoiner.java | chenxubai/morphline-mr-hfile | 1d17c69c6c56e4dd2d78398550d3ead0524a74d0 | [
"Apache-2.0"
] | null | null | null | package com.github.minyk.morphlinesmr.shaded.com.googlecode.jcsv.writer;
import com.github.minyk.morphlinesmr.shaded.com.googlecode.jcsv.CSVStrategy;
/**
* The csv column joiner receives an array of strings and joines it
* to a single string that represents a line of the csv file.
*
*/
public interface CSVColumnJoiner {
/**
* Converts a String[] array into a single string, using the
* given csv strategy.
*
* @param data incoming data
* @param strategy the csv format descriptor
* @return the joined columns
*/
public String joinColumns(String[] data, CSVStrategy strategy);
}
| 28.666667 | 76 | 0.744186 |
5bc913d54db98ffd385d4bf51bea060f22cf2107 | 3,571 | h | C | Gossip/GSCall.h | isabella232/aircall-gossip | f5fb40ee1797656b363a4d341e00417483d442a2 | [
"Unlicense"
] | 2 | 2016-11-09T15:48:01.000Z | 2017-05-17T19:22:37.000Z | Gossip/GSCall.h | aircall/aircall-gossip | f5fb40ee1797656b363a4d341e00417483d442a2 | [
"Unlicense"
] | 1 | 2021-02-23T13:47:49.000Z | 2021-02-23T13:47:49.000Z | Gossip/GSCall.h | isabella232/aircall-gossip | f5fb40ee1797656b363a4d341e00417483d442a2 | [
"Unlicense"
] | 1 | 2020-11-11T17:32:32.000Z | 2020-11-11T17:32:32.000Z | //
// GSCall.h
// Gossip
//
// Created by Chakrit Wichian on 7/9/12.
//
#import <Foundation/Foundation.h>
#import "GSAccount.h"
#import "GSRingback.h"
/// Call session states.
typedef enum {
GSCallStatusReady = 0, ///< Call is ready to be made/pickup.
GSCallStatusCalling = 1, ///< Call is ringing.
GSCallStatusConnecting = 2, ///< User or other party has pick up the call.
GSCallStatusConnected = 3, ///< Call has connected and sound is now coming through.
GSCallStatusDisconnected = 4, ///< Call has been disconnected (user hangup/other party hangup.)
} GSCallStatus;
@protocol CallsCallbackDelegate <NSObject>
@optional
-(void)callStatusChanged:(GSCallStatus)status withCallId:(int) callId;
@end
// TODO: Video call support?
/// Represents a single calling session (either incoming or outgoing.)
@interface GSCall : NSObject
@property (nonatomic, strong) id delegate;
@property (nonatomic, unsafe_unretained, readonly) GSAccount *account; ///< An account this call is being made from.
@property (nonatomic, readonly) GSRingback *ringback; ///< Returns the current GSRingback instance used to play the call's ringback.
@property (nonatomic, readonly) int callId; ///< Call id. Autogenerated from PJSIP.
@property (nonatomic, readonly) GSCallStatus status; ///< Call status. Supports KVO notification.
@property (nonatomic, readonly) float volume; ///< Call volume. Set to 0 to mute.
@property (nonatomic, readonly) float micVolume; ///< Call microphone volume. i.e. the volume to transmit sound from the mic. Set to 0 to mute.
@property(nonatomic, assign, getter=isMicrophoneMuted) BOOL microphoneMuted; // A Boolean value indicating whether microphone is muted.
// A Boolean value indicating whether the call is active, i.e. it has active
// INVITE session and the INVITE session has not been disconnected.
@property(nonatomic, readonly, assign, getter=isActive) BOOL active;
/// Creats a new outgoing call to the specified remoteUri.
/** Use begin() to begin calling. */
+ (id)outgoingCallToUri:(NSString *)remoteUri
fromAccount:(GSAccount *)account
withCallerId:(NSString *)callerId
withUserId:(NSString *)userId
withInternalToUserId:(NSString *)internalToUserId
withAppToApp:(NSString *)appToApp;
/// Creates a new incoming call from the specified PJSIP call id. And associate it with the speicifed account.
/** Do not call this method directly, implement GSAccountDelegate and listen to the
* GSAccountDelegate::account:didReceiveIncomingCall: message instead. */
+ (id)incomingCallWithId:(int)callId toAccount:(GSAccount *)account withMsg:(NSString *)msg;
/// Initialize a new call with the specified account.
/** Do not initialize a GSCall instance directly, instead use one of the provided static methods.
* This method is only inteded to be used by child classes. */
- (id)initWithAccount:(GSAccount *)account;
- (BOOL)setVolume:(float)volume; ///< Sets the call volume. Returns YES if successful.
- (BOOL)setMicVolume:(float)volume; ///< Sets the microphone volume. Returns YES if successful.
- (BOOL)begin; ///< Begins calling for outgoing call or answer incoming call.
- (BOOL)end; ///< Stop calling and/or hangup call.
- (BOOL)sendDTMFDigits:(NSString *)digits; ///< Sends DTMF digits over the call.
- (NSString *)getCustomHeader:(NSString *)key;
- (float)getCurrentMicVolume;
- (NSString *)getFrom;
- (void)holdCall;
- (void)removeHoldCall;
- (BOOL)muteMicrophone;
- (BOOL)unmuteMicrophone;
- (BOOL)openAudioSession;
- (void)closeAudioSession;
@end
| 39.241758 | 143 | 0.735928 |
015a51b52b9c178f77876882ea72af7820cf5967 | 359 | swift | Swift | Sources/Graphaello/Processing/Code Generstion/CodeTransformable/String+CodeTransformable.swift | eliperkins/Graphaello | a74aa71f194b45c6df56d6855649a088f6793523 | [
"MIT"
] | null | null | null | Sources/Graphaello/Processing/Code Generstion/CodeTransformable/String+CodeTransformable.swift | eliperkins/Graphaello | a74aa71f194b45c6df56d6855649a088f6793523 | [
"MIT"
] | null | null | null | Sources/Graphaello/Processing/Code Generstion/CodeTransformable/String+CodeTransformable.swift | eliperkins/Graphaello | a74aa71f194b45c6df56d6855649a088f6793523 | [
"MIT"
] | null | null | null | //
// String+CodeTransformable.swift
// Graphaello
//
// Created by Mathias Quintero on 11.12.19.
// Copyright © 2019 Mathias Quintero. All rights reserved.
//
import Foundation
import Stencil
extension String: CodeTransformable {
func code(using context: Stencil.Context, arguments: [Any?]) throws -> String {
return self
}
}
| 18.894737 | 83 | 0.679666 |
92232ab5dd4c9d05ab14075287a7fcaad7d99e87 | 966 | ddl | SQL | oracle_script/SCHEMA/BASE_SCRIPTS/role.ddl | BrettPWRE/HDB | be7cd4f20064f3f0599810ebf4c6fe85e67ccfac | [
"Apache-2.0"
] | null | null | null | oracle_script/SCHEMA/BASE_SCRIPTS/role.ddl | BrettPWRE/HDB | be7cd4f20064f3f0599810ebf4c6fe85e67ccfac | [
"Apache-2.0"
] | null | null | null | oracle_script/SCHEMA/BASE_SCRIPTS/role.ddl | BrettPWRE/HDB | be7cd4f20064f3f0599810ebf4c6fe85e67ccfac | [
"Apache-2.0"
] | null | null | null | set echo on
set feedback on
spool hdb_roles.out
-- ALL ROLE PASSWORDS REMOVED By M. Bogner SUtron Corporation
-- June 2011 due to issues passworded roles have with ORACLE 11g
--create role app_role identified by PASSWD;
-- create role derivation_role identified by PASSWD; removed by CP project
--create role hdb_meta_role identified by PASSWD;
--create role ref_meta_role identified by PASSWD;
--create role monthly identified by PASSWD;
--create role savoir_faire identified by PASSWD;
--create role model_priv_role identified by PASSWD;
create role app_role;
-- create role derivation_role
create role hdb_meta_role;
create role ref_meta_role;
create role monthly;
create role savoir_faire;
create role model_priv_role;
-- new roles for computation processor
create role decodes_role;
grant decodes_role to ref_meta_role;
grant app_role to decodes_role;
create role calc_definition_role;
spool off
exit;
| 30.1875 | 79 | 0.769151 |
94c98f244fe31bfac51455209d4c7dd6c063c254 | 3,322 | swift | Swift | ReactiveCocoaCatalog/Catalog.swift | inamiy/ReactiveCocoaCatalog | b630267ea2f22f30883606bff9e1789e25f7cc08 | [
"MIT"
] | 62 | 2015-09-17T08:38:47.000Z | 2021-03-21T10:11:47.000Z | ReactiveCocoaCatalog/Catalog.swift | inamiy/ReactiveCocoaCatalog | b630267ea2f22f30883606bff9e1789e25f7cc08 | [
"MIT"
] | 1 | 2016-08-17T12:46:05.000Z | 2016-08-17T12:46:05.000Z | ReactiveCocoaCatalog/Catalog.swift | inamiy/ReactiveCocoaCatalog | b630267ea2f22f30883606bff9e1789e25f7cc08 | [
"MIT"
] | 3 | 2016-04-13T11:41:02.000Z | 2018-07-18T10:40:51.000Z | //
// Catalog.swift
// ReactiveCocoaCatalog
//
// Created by Yasuhiro Inami on 2015-09-16.
// Copyright © 2015 Yasuhiro Inami. All rights reserved.
//
import UIKit
struct Catalog
{
let title: String?
let description: String?
let scene: AnyScene
let selected: Bool
static func allCatalogs() -> [Catalog]
{
return [
Catalog(
title: "UITextField",
description: "throttle()",
scene: *TextFieldViewController.nibScene
),
Catalog(
title: "UITextField (Multiple)",
description: "Login example",
scene: *MultipleTextFieldViewController.nibScene
),
Catalog(
title: "Color Slider",
description: "RGB Slider example",
scene: *ColorSliderViewController.nibScene
),
Catalog(
title: "Who To Follow",
description: "Suggestion box",
scene: *WhoToFollowViewController.nibScene
),
Catalog(
title: "Incremental Search",
description: "throttle + flatten(.latest)",
scene: *IncrementalSearchViewController.nibScene
),
Catalog(
title: "Action",
description: "Action (CocoaAction & RACCommand) Example",
scene: *ActionViewController.nibScene
),
Catalog(
title: "ZunDoko",
description: "Zun, Zun Zun, Zun Doko, Kiyoshi!",
scene: *ZundokoViewController.nibScene
),
Catalog(
title: "GameCommand",
description: "⬇️↘️➡️👊 → Hadouken!!💥",
scene: *GameCommandViewController.storyboardScene
),
Catalog(
title: "Pagination",
description: "Pagination",
scene: *PaginationViewController.storyboardScene
),
Catalog(
title: "ReactiveArray (TableView)",
description: "ReactiveArray + TableView",
scene: *ReactiveTableViewController.storyboardScene
),
Catalog(
title: "ReactiveArray (CollectionView)",
description: "ReactiveArray + CollectionView",
scene: *ReactiveCollectionViewController.storyboardScene
),
Catalog(
title: "MenuBadge",
description: "Tab + Badge",
scene: *MenuTabBarController.storyboardScene
),
Catalog(
title: "PhotosLike",
description: "Photo Gallery + Like buttons",
scene: *PhotosViewController.storyboardScene
),
Catalog(
title: "Automaton (StateMachine)",
description: "State machine example",
scene: *AutomatonViewController.storyboardScene
)
]
}
init(title: String?, description: String?, scene: AnyScene, selected: Bool = false)
{
self.title = title
self.description = description
self.scene = scene
self.selected = selected
}
}
| 32.568627 | 87 | 0.512342 |
996357a7e02bbfba90ce6e738a1c37f7b9876d22 | 1,651 | c | C | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.target/i386/avx-vzeroall-1.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.target/i386/avx-vzeroall-1.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.target/i386/avx-vzeroall-1.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | /* { dg-do run } */
/* { dg-require-effective-target avx } */
/* { dg-options "-O2 -mavx" } */
#include "avx-check.h"
static void
avx_test (void)
{
__m256i src;
#ifdef __x86_64__
char reg_save[16][32];
char d[16][32];
#else
char reg_save[8][32];
char d[8][32];
#endif
int s[8] = {1, 2, 3, 4, 5, 6, 7, 8};
__builtin_memset (d, 0, sizeof d);
__builtin_memset (reg_save, -1, sizeof reg_save);
src = _mm256_loadu_si256 ((__m256i*) s);
_mm256_zeroall ();
__asm__ __volatile__ ("vmovdqu %%ymm0,%0":"=m"(reg_save[0]));
__asm__ __volatile__ ("vmovdqu %%ymm1,%0":"=m"(reg_save[1]));
__asm__ __volatile__ ("vmovdqu %%ymm2,%0":"=m"(reg_save[2]));
__asm__ __volatile__ ("vmovdqu %%ymm3,%0":"=m"(reg_save[3]));
__asm__ __volatile__ ("vmovdqu %%ymm4,%0":"=m"(reg_save[4]));
__asm__ __volatile__ ("vmovdqu %%ymm5,%0":"=m"(reg_save[5]));
__asm__ __volatile__ ("vmovdqu %%ymm6,%0":"=m"(reg_save[6]));
__asm__ __volatile__ ("vmovdqu %%ymm7,%0":"=m"(reg_save[7]));
#ifdef __x86_64__
__asm__ __volatile__ ("vmovdqu %%ymm8,%0":"=m"(reg_save[8]));
__asm__ __volatile__ ("vmovdqu %%ymm9,%0":"=m"(reg_save[9]));
__asm__ __volatile__ ("vmovdqu %%ymm10,%0":"=m"(reg_save[10]));
__asm__ __volatile__ ("vmovdqu %%ymm11,%0":"=m"(reg_save[11]));
__asm__ __volatile__ ("vmovdqu %%ymm12,%0":"=m"(reg_save[12]));
__asm__ __volatile__ ("vmovdqu %%ymm13,%0":"=m"(reg_save[13]));
__asm__ __volatile__ ("vmovdqu %%ymm14,%0":"=m"(reg_save[14]));
__asm__ __volatile__ ("vmovdqu %%ymm15,%0":"=m"(reg_save[15]));
#endif
if (__builtin_memcmp (reg_save, d, sizeof d))
abort ();
_mm256_storeu_si256 ((__m256i*) d, src);
}
| 31.150943 | 65 | 0.633555 |
263f32ccc7c7ef3aae99ee5f3221843848abd941 | 5,273 | java | Java | namesrv/src/main/java/remote/NameSrvRemotingHandler.java | zexho994/Jinx | 3c5e7018aaab4b147f27b82dc8c5c45d19a8a5b6 | [
"Apache-2.0"
] | 1 | 2022-03-12T01:36:33.000Z | 2022-03-12T01:36:33.000Z | namesrv/src/main/java/remote/NameSrvRemotingHandler.java | zexho994/Jinx | 3c5e7018aaab4b147f27b82dc8c5c45d19a8a5b6 | [
"Apache-2.0"
] | 1 | 2022-03-11T14:34:49.000Z | 2022-03-12T01:35:00.000Z | namesrv/src/main/java/remote/NameSrvRemotingHandler.java | zexho994/Jinx | 3c5e7018aaab4b147f27b82dc8c5c45d19a8a5b6 | [
"Apache-2.0"
] | 1 | 2022-03-08T04:56:11.000Z | 2022-03-08T04:56:11.000Z | package remote;
import enums.MessageType;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.log4j.Log4j2;
import manager.BrokerManager;
import manager.TopicManager;
import message.*;
import model.BrokerData;
import netty.protocal.RemotingCommand;
import netty.server.NettyServerHandler;
import utils.Broker;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author Zexho
* @date 2021/12/15 3:59 PM
*/
@Log4j2
public class NameSrvRemotingHandler extends NettyServerHandler {
private final BrokerManager brokerManager = BrokerManager.getInstance();
private final TopicManager topicManager = TopicManager.getInstance();
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
RemotingCommand cmd = (RemotingCommand) msg;
RemotingCommand response = this.processCommand(cmd);
ctx.writeAndFlush(response);
}
private RemotingCommand processCommand(RemotingCommand command) {
log.debug("nameserver process command. cmd = {}", command);
MessageType messageType = MessageType.get(command.getProperty(PropertiesKeys.MESSAGE_TYPE));
assert messageType != null;
RemotingCommand resp = new RemotingCommand();
Message respMessage = new Message(command.getBody().getMsgId());
switch (messageType) {
case Register_Broker:
log.info("[NameServer] broker register => {}", command.getBody());
this.doRegisterBroker(command);
int brokerId = Integer.parseInt(command.getProperty(PropertiesKeys.BROKER_ID));
if (Broker.isMaster(brokerId)) {
respMessage.setBody(true);
} else {
// broker为slave,返回master的路由信息
String clusterName = command.getProperty(PropertiesKeys.CLUSTER_NAME);
String brokerName = command.getProperty(PropertiesKeys.BROKER_NAME);
BrokerData masterData = brokerManager.getMasterData(clusterName, brokerName);
respMessage.setBody(masterData);
}
resp.addProperties(PropertiesKeys.MESSAGE_TYPE, MessageType.Register_Broker_Resp.type);
resp.setBody(respMessage);
break;
case Get_Topic_Route:
String topic = command.getProperty(PropertiesKeys.TOPIC);
log.info("[NameServer] get topic route info => {}", topic);
TopicRouteInfos topicRouteInfos = this.doGetTopicRouteData(topic);
resp.addProperties(PropertiesKeys.MESSAGE_TYPE, MessageType.Get_Topic_Route.type);
respMessage.setBody(topicRouteInfos);
resp.setBody(respMessage);
break;
default:
throw new RuntimeException("message type error: " + messageType);
}
return resp;
}
private void doRegisterBroker(RemotingCommand command) {
String clusterName = command.getProperty(PropertiesKeys.CLUSTER_NAME);
String brokerName = command.getProperty(PropertiesKeys.BROKER_NAME);
String brokerHost = command.getProperty(PropertiesKeys.BROKER_HOST);
int brokerId = Integer.parseInt(command.getProperty(PropertiesKeys.BROKER_ID));
int brokerPort = Integer.parseInt(command.getProperty(PropertiesKeys.BROKER_PORT));
brokerManager.addBroker(brokerName, brokerHost, brokerPort, brokerId, clusterName);
// master要保存topic的消息,slave不用
if (Broker.isMaster(brokerId)) {
Message message = command.getBody();
ConfigBody body = (ConfigBody) message.getBody();
List<TopicUnit> topics = body.getTopics();
topicManager.addTopic(clusterName, brokerName, topics);
}
}
private TopicRouteInfos doGetTopicRouteData(String topic) {
log.info("Get topic:{} route data", topic);
Map<String, Set<String>> clusterBrokerMap = this.topicManager.getBrokerNameByTopic(topic);
List<TopicRouteInfo> topicRouteInfoList = new LinkedList<>();
clusterBrokerMap.forEach((clusterName, set) -> {
set.forEach((brokerName) -> {
BrokerData brokerData = this.brokerManager.getMasterData(clusterName, brokerName);
this.topicManager.getTopicsByBrokerName(clusterName, brokerName).stream()
.filter(tu -> tu.getTopic().equals(topic))
.forEach(tu -> {
TopicRouteInfo tri = new TopicRouteInfo();
tri.setBrokerName(brokerData.getBrokerName());
tri.setClusterName(brokerData.getClusterName());
tri.setBrokerHost(brokerData.getBrokerHost());
tri.setBrokerPort(brokerData.getBrokerPort());
tri.setBrokerId(brokerData.getBrokerId());
tri.setTopic(tu.getTopic());
tri.setQueueNum(tu.getQueue());
topicRouteInfoList.add(tri);
});
});
});
return new TopicRouteInfos(topicRouteInfoList);
}
}
| 45.068376 | 103 | 0.636639 |
fed22f3bee802d251c5bf49e586e443db614f196 | 457 | asm | Assembly | Tejas-Simulator/PIN/pin-2.14/source/tools/ToolUnitTests/inline_opt_test_df_ia32.asm | markoshorro/tejas_knl | 5e772aef46362d8bec8ad6d5427b9bcff9be5cfe | [
"Apache-2.0"
] | 17 | 2021-07-10T13:22:26.000Z | 2022-02-09T20:11:39.000Z | pin_kit/source/tools/ToolUnitTests/inline_opt_test_df_ia32.asm | sawansib/SNIPER | 45ec1eeb09b81a7250bc1a1aaa452f16b2b7f497 | [
"MIT"
] | 4 | 2021-08-18T14:07:24.000Z | 2022-01-24T16:38:06.000Z | pin_kit/source/tools/ToolUnitTests/inline_opt_test_df_ia32.asm | sawansib/SNIPER | 45ec1eeb09b81a7250bc1a1aaa452f16b2b7f497 | [
"MIT"
] | 11 | 2016-07-01T02:21:06.000Z | 2020-11-23T08:29:22.000Z | PUBLIC SetDf
.686
.XMM
.model flat, c
.code
SetDf PROC
std
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
lea eax, [eax + edx]
ret
SetDf ENDP
end
| 10.880952 | 24 | 0.49453 |
229f5620d224525da732c7eb06a16d722db23812 | 64 | html | HTML | old-photos/skanepask-2003/dest/pic_1021.html | bagder/daniel.haxx.se | c031f3e8f2d6ee726b62f290c3c932ee28b6808a | [
"CC0-1.0"
] | 4 | 2021-09-03T15:25:17.000Z | 2022-01-03T07:50:22.000Z | old-photos/skanepask-2003/dest/pic_1021.html | bagder/daniel.haxx.se | c031f3e8f2d6ee726b62f290c3c932ee28b6808a | [
"CC0-1.0"
] | 1 | 2022-02-02T18:18:41.000Z | 2022-02-02T22:19:39.000Z | old-photos/skanepask-2003/dest/pic_1021.html | bagder/daniel.haxx.se | c031f3e8f2d6ee726b62f290c3c932ee28b6808a | [
"CC0-1.0"
] | 1 | 2022-02-02T18:04:51.000Z | 2022-02-02T18:04:51.000Z | <a href="../IMG_1021.JPG"><img border=0 src="1021-big.jpg"></a>
| 32 | 63 | 0.625 |
997800c188883065e0794539092c3a27c34d6aa9 | 515 | c | C | 006/005/first_drv/first_drv_test.c | rjm5678/arm-linux | 287abf4d0f9190cb8e916b4313dc504d23d0b56f | [
"MIT"
] | null | null | null | 006/005/first_drv/first_drv_test.c | rjm5678/arm-linux | 287abf4d0f9190cb8e916b4313dc504d23d0b56f | [
"MIT"
] | null | null | null | 006/005/first_drv/first_drv_test.c | rjm5678/arm-linux | 287abf4d0f9190cb8e916b4313dc504d23d0b56f | [
"MIT"
] | null | null | null |
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv)
{
int val = 1;
int fd = 0;
fd = open("/dev/first_drv", O_RDWR);
if (fd<0) printf("can't open file first_drv\n");
if (argc!=2)
{
printf("Usage: first_drv <on/off>\n");
}
else
{
if (strcmp(argv[1], "on") == 0)
{
val = 1;
}
else
{
val = 0;
}
write(fd, &val, 4);
}
return 0;
}
| 13.205128 | 50 | 0.504854 |
0baf24ee5d1b26effaaf32a63a0631c55fec4a7f | 16,201 | swift | Swift | Carthage/Checkouts/judokit/Source/Session.swift | Ryce/flickrpickr | aa5137f36e48931fd3259789404c57b2c4d09c7f | [
"MIT"
] | null | null | null | Carthage/Checkouts/judokit/Source/Session.swift | Ryce/flickrpickr | aa5137f36e48931fd3259789404c57b2c4d09c7f | [
"MIT"
] | null | null | null | Carthage/Checkouts/judokit/Source/Session.swift | Ryce/flickrpickr | aa5137f36e48931fd3259789404c57b2c4d09c7f | [
"MIT"
] | null | null | null | //
// Session.swift
// Judo
//
// Copyright (c) 2016 Alternative Payments Ltd
//
// 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.
import Foundation
import CoreLocation
import PassKit
/// The valid lengths of any judo Id
internal let kJudoIDLenght = (6...10)
/// Typealias for any Key value storage type objects
public typealias JSONDictionary = [String : AnyObject]
public typealias JudoCompletionBlock = (Response?, JudoError?) -> ()
/// The Session struct is a wrapper for the REST API calls
public class Session : NSObject {
/// The endpoint for REST API calls to the judo API
fileprivate (set) var endpoint = "https://gw1.judopay.com/"
fileprivate let judoBundleId = "com.judo.JudoKit"
/// identifying whether developers are using their own UI or the Judo Out of the box UI
public var uiClientMode = false
/// Set the app to sandboxed mode
public var sandboxed: Bool = false {
didSet {
if sandboxed {
endpoint = "https://gw1.judopay-sandbox.com/"
} else {
endpoint = "https://gw1.judopay.com/"
}
}
}
public func certPath()->String{
if sandboxed {
return "judopay-sandbox.com"
} else {
return "gw1.judopay.com"
}
}
/// Token and secret are saved in the authorizationHeader for authentication of REST API calls
var authorizationHeader: String?
/**
POST Helper Method for accessing the judo REST API
- Parameter path: the path
- Parameter parameters: information that is set in the HTTP Body
- Parameter completion: completion callblack block with the results
*/
public func POST(_ path: String, parameters: JSONDictionary, completion: @escaping JudoCompletionBlock) {
// Create request
let request = self.judoRequest(endpoint + path)
// Rquest method
request.httpMethod = "POST"
// Safely create request body for the request
let requestBody: Data?
do {
requestBody = try JSONSerialization.data(withJSONObject: parameters, options: JSONSerialization.WritingOptions.prettyPrinted)
} catch {
print("body serialization failed")
DispatchQueue.main.async(execute: { () -> Void in
completion(nil, JudoError(.serializationError))
})
return // BAIL
}
request.httpBody = requestBody
// Create a data task
let task = self.task(request as URLRequest, completion: completion)
// Initiate the request
task.resume()
}
/**
GET Helper Method for accessing the judo REST API
- Parameter path: the path
- Parameter parameters: information that is set in the HTTP Body
- Parameter completion: completion callblack block with the results
*/
func GET(_ path: String, parameters: JSONDictionary?, completion: @escaping JudoCompletionBlock) {
// Create request
let request = self.judoRequest(endpoint + path)
request.httpMethod = "GET"
if let params = parameters {
let requestBody: Data?
do {
requestBody = try JSONSerialization.data(withJSONObject: params, options: JSONSerialization.WritingOptions.prettyPrinted)
} catch {
print("body serialization failed")
DispatchQueue.main.async(execute: { () -> Void in
completion(nil, JudoError(.serializationError))
})
return
}
request.httpBody = requestBody
}
let task = self.task(request as URLRequest, completion: completion)
// Initiate the request
task.resume()
}
/**
PUT Helper Method for accessing the judo REST API - PUT should only be accessed for 3DS transactions to fulfill the transaction
- Parameter path: the path
- Parameter parameters: information that is set in the HTTP Body
- Parameter completion: completion callblack block with the results
*/
func PUT(_ path: String, parameters: JSONDictionary, completion: @escaping JudoCompletionBlock) {
// Create request
let request = self.judoRequest(endpoint + path)
// Request method
request.httpMethod = "PUT"
// Safely create request body for the request
let requestBody: Data?
do {
requestBody = try JSONSerialization.data(withJSONObject: parameters, options: JSONSerialization.WritingOptions.prettyPrinted)
} catch {
print("body serialization failed")
DispatchQueue.main.async(execute: { () -> Void in
completion(nil, JudoError(.serializationError))
})
return // BAIL
}
request.httpBody = requestBody
// Create a data task
let task = self.task(request as URLRequest, completion: completion)
// Initiate the request
task.resume()
}
// MARK: Helpers
/**
Helper Method to create a JSON HTTP request with authentication
- Parameter url: the url for the request
- Returns: a JSON HTTP request with authorization set
*/
public func judoRequest(_ url: String) -> NSMutableURLRequest {
let request = NSMutableURLRequest(url: URL(string: url)!)
// json configuration header
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("application/json", forHTTPHeaderField: "Accept")
request.addValue("5.0.0", forHTTPHeaderField: "API-Version")
// Adds the version and lang of the SDK to the header
request.addValue(self.getUserAgent(), forHTTPHeaderField: "User-Agent")
var uiClientModeString = "Judo-SDK"
if uiClientMode {
uiClientModeString = "Custom-UI"
}
request.addValue(uiClientModeString, forHTTPHeaderField: "UI-Client-Mode")
// Check if token and secret have been set
guard let authHeader = self.authorizationHeader else {
print("token and secret not set")
assertionFailure("token and secret not set")
return request
}
// Set auth header
request.addValue(authHeader, forHTTPHeaderField: "Authorization")
return request
}
private func getUserAgent() -> String {
let device = UIDevice()
let mainBundle = Bundle.main
var userAgentParts = [String]()
//Base user agent
userAgentParts.append("iOS-Swift/\(JudoKitVersion)")
//Model
userAgentParts.append(device.model)
//Operating system
userAgentParts.append("\(device.systemName)/\(device.systemVersion)")
//App Name and version
if let appName = mainBundle.object(forInfoDictionaryKey: "CFBundleName") as? String, let appVersion = mainBundle.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String {
userAgentParts.append("\(appName.replacingOccurrences(of: " ", with: ""))/\(appVersion)")
}
//Platform running on (simulator or device)
if let platformName = mainBundle.object(forInfoDictionaryKey: "DTPlatformName") as? String {
userAgentParts.append(platformName)
}
return userAgentParts.joined(separator: " ")
}
/**
Helper Method to create a JSON HTTP request with authentication
- Parameter request: the request that is accessed
- Parameter completion: a block that gets called when the call finishes, it carries two objects that indicate whether the call was a success or a failure
- Returns: a NSURLSessionDataTask that can be used to manipulate the call
*/
public func task(_ request: URLRequest, completion: @escaping JudoCompletionBlock) -> URLSessionDataTask {
let urlSession = URLSession(configuration: URLSessionConfiguration.default, delegate: self, delegateQueue: nil)
return urlSession.dataTask(with: request, completionHandler: { (data, resp, err) -> Void in
// Error handling
if data == nil, let error = err {
DispatchQueue.main.async(execute: { () -> Void in
completion(nil, JudoError.fromNSError(error as NSError))
})
return // BAIL
}
// Unwrap response data
guard let upData = data else {
DispatchQueue.main.async(execute: { () -> Void in
completion(nil, JudoError(.requestError))
})
return // BAIL
}
// Serialize JSON Dictionary
let json: JSONDictionary?
do {
json = try JSONSerialization.jsonObject(with: upData, options: JSONSerialization.ReadingOptions.allowFragments) as? JSONDictionary
} catch {
print(error)
DispatchQueue.main.async(execute: { () -> Void in
completion(nil, JudoError(.serializationError))
})
return // BAIL
}
// Unwrap optional dictionary
guard let upJSON = json else {
DispatchQueue.main.async(execute: { () -> Void in
completion(nil, JudoError(.serializationError))
})
return
}
// If an error occur
if let errorCode = upJSON["code"] as? Int, let judoErrorCode = JudoErrorCode(rawValue: errorCode) {
DispatchQueue.main.async(execute: { () -> Void in
completion(nil, JudoError(judoErrorCode, dict: upJSON))
})
return // BAIL
}
// Check if 3DS was requested
if upJSON["acsUrl"] != nil && upJSON["paReq"] != nil {
DispatchQueue.main.async(execute: { () -> Void in
completion(nil, JudoError(.threeDSAuthRequest, payload: upJSON))
})
return // BAIL
}
// Create pagination object
var paginationResponse: Pagination?
if let offset = upJSON["offset"] as? NSNumber, let pageSize = upJSON["pageSize"] as? NSNumber, let sort = upJSON["sort"] as? String {
paginationResponse = Pagination(pageSize: pageSize.intValue, offset: offset.intValue, sort: Sort(rawValue: sort)!)
}
var result = Response(paginationResponse)
do {
if let results = upJSON["results"] as? Array<JSONDictionary> {
for item in results {
let transaction = try TransactionData(item)
result.append(transaction)
}
} else {
let transaction = try TransactionData(upJSON)
result.append(transaction)
}
} catch {
print(error)
DispatchQueue.main.async(execute: { () -> Void in
completion(nil, JudoError(.responseParseError))
})
return // BAIL
}
DispatchQueue.main.async(execute: { () -> Void in
completion(result, nil)
})
})
}
/**
Helper method to create a dictionary of all the parameters necessary for a refund or a collection
- parameter receiptId: The receipt ID for a refund or a collection
- parameter amount: The amount to process
- parameter paymentReference: the payment reference
- returns: a Dictionary containing all the information to submit for a refund or a collection
*/
func progressionParameters(_ receiptId: String, amount: Amount, paymentReference: String, deviceSignal: JSONDictionary?) -> JSONDictionary {
var dictionary = ["receiptId":receiptId, "amount": amount.amount, "yourPaymentReference": paymentReference] as [String : Any]
if let deviceSignal = deviceSignal {
dictionary["clientDetails"] = deviceSignal
}
return dictionary as JSONDictionary
}
}
// MARK: Pagination
/**
**Pagination**
Struct to save state of a paginated response
*/
public struct Pagination {
var pageSize: Int = 10
var offset: Int = 0
var sort: Sort = .Descending
}
/**
Enum to identify sorting direction
- Descending: Descended Sorting
- Ascending: Ascended Sorting
*/
public enum Sort: String {
/// Descended Sorting
case Descending = "time-descending"
/// Ascended Sorting
case Ascending = "time-ascending"
}
extension Session: URLSessionDelegate {
public func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
let serverTrust = challenge.protectionSpace.serverTrust
let certificate = SecTrustGetCertificateAtIndex(serverTrust!, 0)
// Set SSL policies for domain name check
let policies = NSMutableArray();
policies.add(SecPolicyCreateSSL(true, (challenge.protectionSpace.host as CFString?)))
SecTrustSetPolicies(serverTrust!, policies);
// Evaluate server certificate
var result: SecTrustResultType = SecTrustResultType(rawValue: 0)!
let status = SecTrustEvaluate(serverTrust!, &result)
var isServerTrusted:Bool = false
if status == errSecSuccess {
let unspecified = SecTrustResultType(rawValue: SecTrustResultType.unspecified.rawValue)
let proceed = SecTrustResultType(rawValue: SecTrustResultType.proceed.rawValue)
isServerTrusted = result == unspecified || result == proceed
}
// Get local and remote cert data
let remoteCertificateData:NSData = SecCertificateCopyData(certificate!)
let bundle = Bundle.init(identifier: judoBundleId)
let pathToCert = bundle?.path(forResource: certPath(), ofType: "cer")
let localCertificate:NSData = NSData(contentsOfFile: pathToCert!)!
if (isServerTrusted && remoteCertificateData.isEqual(to: localCertificate as Data)) {
let credential:URLCredential = URLCredential(trust: serverTrust!)
completionHandler(.useCredential, credential)
} else {
completionHandler(.cancelAuthenticationChallenge, nil)
}
}
}
| 37.073227 | 193 | 0.603666 |
53e984ba296fcf683faa9eaba5518ec27b9dc44a | 837 | java | Java | src/main/java/com/qs/core/parser/QSToken.java | qianshui423/qs | ba59805799f7381f05712c1f7e0828550e0a80b2 | [
"Apache-2.0"
] | 8 | 2019-09-23T11:29:25.000Z | 2022-02-18T10:41:02.000Z | src/main/java/com/qs/core/parser/QSToken.java | qianshui423/qs | ba59805799f7381f05712c1f7e0828550e0a80b2 | [
"Apache-2.0"
] | 1 | 2022-02-18T11:44:15.000Z | 2022-02-18T11:44:15.000Z | src/main/java/com/qs/core/parser/QSToken.java | qianshui423/qs | ba59805799f7381f05712c1f7e0828550e0a80b2 | [
"Apache-2.0"
] | 1 | 2021-02-05T21:50:54.000Z | 2021-02-05T21:50:54.000Z | package com.qs.core.parser;
public class QSToken {
public static final int TYPE_VALUE = 1; // QSExample primitive value: string
public static final int TYPE_AND = 2; // &
public static final int TYPE_EOF = -1; // end of file
public int type;
public String value;
public QSToken(int type, String value) {
this.type = type;
this.value = value;
}
public String toString() {
StringBuilder sb = new StringBuilder();
switch (type) {
case TYPE_VALUE:
sb.append("VALUE(").append(value).append(")");
break;
case TYPE_AND:
sb.append("AND(&)");
break;
case TYPE_EOF:
sb.append("END OF FILE");
break;
}
return sb.toString();
}
}
| 26.15625 | 80 | 0.528076 |
5f475403e1db3ef5f56ffbe50e7dbbf1619476ed | 5,060 | ts | TypeScript | packages/schema/test/properties.test.ts | wesselvdv/schema | b8a5860a1104e625180bd4d2731888a421b4423a | [
"MIT"
] | 16 | 2021-05-12T23:38:35.000Z | 2022-03-08T19:03:24.000Z | packages/schema/test/properties.test.ts | wesselvdv/schema | b8a5860a1104e625180bd4d2731888a421b4423a | [
"MIT"
] | 195 | 2021-05-07T08:25:03.000Z | 2022-03-29T01:33:54.000Z | packages/schema/test/properties.test.ts | wesselvdv/schema | b8a5860a1104e625180bd4d2731888a421b4423a | [
"MIT"
] | 3 | 2021-06-01T08:21:31.000Z | 2022-01-07T12:12:45.000Z | import * as T from "@effect-ts/core/Effect"
import * as Ex from "@effect-ts/core/Effect/Exit"
import * as O from "@effect-ts/core/Option"
import * as fc from "fast-check"
import * as S from "../src"
import { number, string } from "../src"
import * as Arbitrary from "../src/Arbitrary"
import * as Encoder from "../src/Encoder"
import * as Guard from "../src/Guard"
import * as Parser from "../src/Parser"
const fieldDoc = S.makeAnnotation<string>()
const Identified = S.props({
id: S.prop(S.string).from("sub").annotate(fieldDoc, "id field"),
name: S.prop(S.string).opt()
})
const Person = S.props({
_tag: S.prop(S.literal("Person")),
...Identified.props,
age: S.prop(S.number).def(() => 30),
birthDate: S.prop(S.date).opt().from("bd")
})
const Animal = S.props({
_tag: S.prop(S.literal("Animal")),
...Identified.props,
age: S.prop(S.number).opt(),
birthDate: S.prop(S.date).opt().from("bd"),
color: S.prop(S.string)
})
export const PersonOrAnimal = S.union({ Person, Animal })
export const StringOrNumber = S.union({ string, number })
export const parsePersonOrAnimal = Parser.for(PersonOrAnimal)["|>"](S.condemnFail)
export const parseStringOrNumber = Parser.for(StringOrNumber)["|>"](S.condemnFail)
export const isStringOrNumber = Guard.for(StringOrNumber)
export const encodeStringOrNumber = Encoder.for(StringOrNumber)
export const isPersonOrAnimal = Guard.for(PersonOrAnimal)
export const encodePersonOrAnimal = Encoder.for(PersonOrAnimal)
export const arbStringOrNumber = Arbitrary.for(StringOrNumber)(fc)
export const arbPersonOrAnimal = Arbitrary.for(PersonOrAnimal)(fc)
describe("Props", () => {
it("union", async () => {
const dt = new Date().toISOString()
const res = await T.runPromiseExit(
parsePersonOrAnimal({ _tag: "Person", sub: "ok", bd: dt })
)
expect(res).toEqual(
Ex.succeed({
_tag: "Person",
id: "ok",
age: 30,
birthDate: new Date(Date.parse(dt))
})
)
const res2 = await T.runPromiseExit(parseStringOrNumber("ok"))
expect(res2).toEqual(Ex.succeed("ok"))
expect(isStringOrNumber(0)).toEqual(true)
expect(isPersonOrAnimal({})).toEqual(false)
if (res._tag === "Success") {
expect(isPersonOrAnimal(res.value)).toEqual(true)
expect(
PersonOrAnimal.matchW({
Animal: (_) => `got animal: ${_.id}`,
Person: (_) => `got person: ${_.id}`
})(res.value)
).toEqual("got person: ok")
expect(encodePersonOrAnimal(res.value)).toEqual({
_tag: "Person",
sub: "ok",
age: 30,
bd: dt
})
}
const matchStringOrNumber = StringOrNumber.matchS({
number: (_) => `got number: ${_}`,
string: (_) => `got string: ${_}`
})
expect(matchStringOrNumber(0)).toEqual("got number: 0")
expect(matchStringOrNumber("ok")).toEqual("got string: ok")
expect(encodeStringOrNumber("ok")).toEqual("ok")
fc.assert(fc.property(arbStringOrNumber, isStringOrNumber))
fc.assert(fc.property(arbPersonOrAnimal, isPersonOrAnimal))
expect(Person.props.id.getAnnotation(fieldDoc)).toEqual(O.some("id field"))
const matchStringOrNumberDef = StringOrNumber.matchS(
{
number: () => T.succeed({ a: 0 })
},
(_) => T.succeed({ a: 1 })
)
const matchStringOrNumberWDef = StringOrNumber.matchW(
{
number: () => T.succeed({ a: 0 })
},
(_) => T.succeed({ b: 1 })
)
expect(await T.runPromise(matchStringOrNumberDef("ok"))).toEqual({ a: 1 })
expect(await T.runPromise(matchStringOrNumberWDef("ok"))).toEqual({ b: 1 })
})
it("optional", async () => {
const A = S.props({
name: S.prop(string),
opt: S.prop(string).opt()
})
class A2 extends S.Model<A2>()(
S.props({
name: S.prop(string),
opt: S.prop(string).opt()
})
) {}
const parse = A.Parser["|>"](S.condemnFail)
const construct = A.Constructor["|>"](S.condemnFail)
expect(await T.runPromiseExit(parse({ name: "abc" }))).toEqual(
Ex.succeed({ name: "abc" })
)
expect(
await T.runPromiseExit(
parse({ name: "abc", opt: undefined }["|>"](JSON.stringify)["|>"](JSON.parse))
)
).toEqual(
Ex.succeed({
name: "abc"
})
)
expect(await T.runPromiseExit(parse({ name: "abc", opt: undefined }))).toEqual(
Ex.succeed({
name: "abc"
})
)
expect(await T.runPromiseExit(construct({ name: "abc" }))).toEqual(
Ex.succeed({ name: "abc" })
)
expect(await T.runPromiseExit(construct({ name: "abc", opt: undefined }))).toEqual(
Ex.succeed({
name: "abc"
})
)
expect(
A.Encoder(await T.runPromise(construct({ name: "abc", opt: undefined })))
).toEqual({
name: "abc"
})
expect(new A2({ name: "abc", opt: undefined })).toEqual({
name: "abc",
opt: undefined
})
expect(A2.Encoder(new A2({ name: "abc", opt: undefined }))).toEqual({
name: "abc"
})
})
})
| 27.955801 | 87 | 0.604348 |
92e1b523f627b060c2a04f9167f8af03045c75e7 | 1,238 | h | C | include/tvision/internal/stdioctl.h | GerHobbelt/tvision | b5eb6be607707eaad1b4687926cbf99175fc26b9 | [
"MIT"
] | null | null | null | include/tvision/internal/stdioctl.h | GerHobbelt/tvision | b5eb6be607707eaad1b4687926cbf99175fc26b9 | [
"MIT"
] | null | null | null | include/tvision/internal/stdioctl.h | GerHobbelt/tvision | b5eb6be607707eaad1b4687926cbf99175fc26b9 | [
"MIT"
] | null | null | null | #ifndef TVISION_STDIOCTL_H
#define TVISION_STDIOCTL_H
#include <tvision/tv.h>
#include <cstdio>
#ifdef _TV_UNIX
class StdioCtl {
int fds[3];
FILE *files[3];
int ttyfd;
FILE *infile, *outfile;
StdioCtl() { setUp(); }
~StdioCtl() { tearDown(); }
void setUp();
void tearDown();
static StdioCtl instance;
public:
static int in() { return instance.fds[0]; }
static int out() { return instance.fds[1]; }
static int err() { return instance.fds[2]; }
static FILE *fin() { return instance.files[0]; }
static FILE *fout() { return instance.files[1]; }
static FILE *ferr() { return instance.files[2]; }
};
#elif defined(_WIN32)
#include <tvision/compat/win.h>
class StdioCtl
{
friend class Win32ConsoleStrategy;
enum { input = 0, activeOutput = 1, startupOutput = 2 };
struct
{
HANDLE handle {INVALID_HANDLE_VALUE};
bool owning {false};
} cn[3];
bool ownsConsole {};
void setUp();
void tearDown();
static StdioCtl instance;
public:
static HANDLE in() { return instance.cn[input].handle; }
static HANDLE out() { return instance.cn[activeOutput].handle; }
};
#endif // _TV_UNIX
#endif // TVISION_STDIOCTL_H
| 17.942029 | 68 | 0.631664 |
2a059939b6e8aabccdedb25d6fc1ae4da695f8c5 | 4,586 | swift | Swift | Sources/WallpapperExif/Program.swift | luciascarlet/wallpapper | bfc034cd1f12015efd2395e757fd1db4f94bf307 | [
"MIT"
] | 1 | 2021-03-30T07:44:49.000Z | 2021-03-30T07:44:49.000Z | Sources/WallpapperExif/Program.swift | luciascarlet/wallpapper | bfc034cd1f12015efd2395e757fd1db4f94bf307 | [
"MIT"
] | null | null | null | Sources/WallpapperExif/Program.swift | luciascarlet/wallpapper | bfc034cd1f12015efd2395e757fd1db4f94bf307 | [
"MIT"
] | null | null | null | //
// Program.swift
// wallpapper-exif
//
// Created by Marcin Czachurski on 21/10/2021.
// Copyright © 2021 Marcin Czachurski. All rights reserved.
//
import Foundation
import WallpapperLib
class Program {
let consoleIO = ConsoleIO()
var inputFileNames: [String] = []
var wallpapperItems: [WallpapperItem] = []
func run() -> Bool {
let (shouldBreak, resultCode) = self.proceedCommandLineArguments()
if shouldBreak {
return resultCode
}
return self.generateSunPositions()
}
private func generateSunPositions() -> Bool {
do {
for inputFileName in inputFileNames {
let fileURL = try getPathToInputFile(inputFileName: inputFileName)
self.consoleIO.writeMessage("Reading file: '\(fileURL.absoluteString)'...", to: .debug)
let inputFileContents = try Data(contentsOf: fileURL)
self.consoleIO.writeMessage("OK.\n", to: .debug)
self.consoleIO.writeMessage("Extracting Exif information...", to: .debug)
let locationExtractor = LocationExtractor()
let imageLocation = try locationExtractor.extract(imageData: inputFileContents)
self.consoleIO.writeMessage("OK.\n", to: .debug)
self.consoleIO.writeMessage("Calculating Sun position...", to: .debug)
let sunCalculations = SunCalculations(imageLocation: imageLocation)
let position = sunCalculations.getSunPosition()
self.consoleIO.writeMessage("OK.\n", to: .debug)
let wallpapperItem = WallpapperItem(fileName: inputFileName, altitude: position.altitude, azimuth: position.azimuth)
wallpapperItems.append(wallpapperItem)
}
return try self.printJsonString(wallpapperItems: wallpapperItems)
} catch (let error as WallpapperError) {
self.consoleIO.writeMessage("Unexpected error occurs: \(error.message)", to: .error)
return false
} catch {
self.consoleIO.writeMessage("Unexpected error occurs: \(error)", to: .error)
return false
}
}
private func printJsonString(wallpapperItems: [WallpapperItem]) throws -> Bool {
let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted
let jsonData = try encoder.encode(wallpapperItems)
let jsonOptionslString = String(bytes: jsonData, encoding: .utf8)
guard let jsonString = jsonOptionslString else {
self.consoleIO.writeMessage("Error during converting object into string", to: .error)
return false
}
self.consoleIO.writeMessage("Output:", to: .standard)
self.consoleIO.writeMessage(jsonString, to: .standard)
return true
}
private func getPathToInputFile(inputFileName: String) throws -> URL {
return URL(fileURLWithPath: inputFileName)
}
private func proceedCommandLineArguments() -> (Bool, Bool) {
if CommandLine.arguments.count == 1 {
self.printUsage()
return (true, false)
}
var optionIndex = 1
while optionIndex < CommandLine.arguments.count {
let option = CommandLine.arguments[optionIndex]
let optionType = OptionType(value: option)
switch optionType {
case .help:
self.printUsage()
return (true, true)
case .version:
self.printVersion()
return (true, true)
default:
let fileName = CommandLine.arguments[optionIndex]
inputFileNames.append(fileName)
break;
}
optionIndex = optionIndex + 1
}
if self.inputFileNames.count == 0 {
self.consoleIO.writeMessage("unknown input file names.", to: .error)
return (true, false)
}
return (false, false)
}
private func printVersion() {
self.consoleIO.writeMessage("1.7.1")
}
private func printUsage() {
let executableName = (CommandLine.arguments[0] as NSString).lastPathComponent
self.consoleIO.writeMessage("\(executableName): [file1] [file2]")
self.consoleIO.writeMessage("Command options are:")
self.consoleIO.writeMessage(" -h\t\t\tshow this message and exit")
self.consoleIO.writeMessage(" -v\t\t\tshow program version and exit")
}
}
| 35.276923 | 132 | 0.606411 |
7a4b8dcfcfc3fe13c722371f8e074ace5a726457 | 1,437 | rb | Ruby | spec/unit/resource/api200/logical_switch_group_spec.rb | nabhajit-ray/oneview-sdk-ruby | ea698d9fe0bb61f4499792946b2788eca8272a8f | [
"Apache-2.0"
] | 15 | 2016-07-11T15:57:00.000Z | 2022-02-21T09:17:49.000Z | spec/unit/resource/api200/logical_switch_group_spec.rb | nabhajit-ray/oneview-sdk-ruby | ea698d9fe0bb61f4499792946b2788eca8272a8f | [
"Apache-2.0"
] | 218 | 2016-05-02T15:12:28.000Z | 2021-07-01T15:21:13.000Z | spec/unit/resource/api200/logical_switch_group_spec.rb | nabhajit-ray/oneview-sdk-ruby | ea698d9fe0bb61f4499792946b2788eca8272a8f | [
"Apache-2.0"
] | 29 | 2016-05-10T15:22:57.000Z | 2022-02-18T07:10:17.000Z | require 'spec_helper'
RSpec.describe OneviewSDK::LogicalSwitchGroup do
include_context 'shared context'
describe '#initialize' do
it 'sets the defaults correctly' do
item = OneviewSDK::LogicalSwitchGroup.new(@client_200)
expect(item['category']).to eq('logical-switch-groups')
expect(item['state']).to eq('Active')
expect(item['type']).to eq('logical-switch-group')
expect(item['switchMapTemplate']).to be
end
end
describe '#set_grouping_parameters' do
before :each do
@item = OneviewSDK::LogicalSwitchGroup.new(@client_200)
@type = 'Cisco Nexus 55xx'
end
it 'defines a valid siwtch group' do
expect(OneviewSDK::Switch).to receive(:get_type).with(@client_200, @type)
.and_return('uri' => '/rest/fake')
@item.set_grouping_parameters(1, @type)
expect(@item['switchMapTemplate']['switchMapEntryTemplates'].first['permittedSwitchTypeUri'])
.to eq('/rest/fake')
end
it 'raises an error if the switch is not found' do
expect(OneviewSDK::Switch).to receive(:get_type).with(@client_200, @type)
.and_return([])
expect(OneviewSDK::Switch).to receive(:get_types).and_return([{ 'name' => '1' }, { 'name' => '2' }])
expect { @item.set_grouping_parameters(1, @type) }.to raise_error(/not found!/)
end
end
end
| 36.846154 | 106 | 0.622825 |
b295b548fdf4ca5ce983c90c7c2a5b0d7cf15ccd | 866 | swift | Swift | Example/UncommonCrypto/AppDelegate.swift | lionheart/UncommonCrypto | 5426b352b4278b5cb6bdc4d453c9c32ab7984c26 | [
"Apache-2.0"
] | 1 | 2020-09-17T16:09:12.000Z | 2020-09-17T16:09:12.000Z | Example/UncommonCrypto/AppDelegate.swift | lionheart/UncommonCrypto | 5426b352b4278b5cb6bdc4d453c9c32ab7984c26 | [
"Apache-2.0"
] | null | null | null | Example/UncommonCrypto/AppDelegate.swift | lionheart/UncommonCrypto | 5426b352b4278b5cb6bdc4d453c9c32ab7984c26 | [
"Apache-2.0"
] | null | null | null | //
// AppDelegate.swift
// UncommonCrypto
//
// Created by Dan Loewenherz on 06/25/2016.
// Copyright (c) 2016 Dan Loewenherz. All rights reserved.
//
import UIKit
import UncommonCrypto
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
// Override point for customization after application launch.
let hash = Hmac<MD5>(key: "", message: "")
print(hash.base64)
// let data: (Data, Data) = try! PBKDF2<DES, SHA1>.key(password: "test", saltLength: 8, keySize: .Default) { $0 }
Hash<MD5>("hey").hexdigest
for i in 0..<100 {
print(Random<Int>.generate(0..<1))
}
return true
}
}
| 27.0625 | 151 | 0.652425 |
6d12ad6b8f9818aea2e6136853e392a4e8453568 | 120 | sql | SQL | services/stats-api/src/main/resources/io/github/oasis/db/scripts/players/updateTeam.sql | erenerdemli/oasis | 2cfb0297756c6c1421c9b2732f5ef5c5712eb525 | [
"Apache-2.0"
] | 16 | 2019-11-25T18:56:21.000Z | 2022-03-18T12:38:36.000Z | services/stats-api/src/main/resources/io/github/oasis/db/scripts/players/updateTeam.sql | erenerdemli/oasis | 2cfb0297756c6c1421c9b2732f5ef5c5712eb525 | [
"Apache-2.0"
] | 99 | 2018-08-21T03:40:43.000Z | 2022-03-08T21:31:45.000Z | services/stats-api/src/main/resources/io/github/oasis/db/scripts/players/updateTeam.sql | erenerdemli/oasis | 2cfb0297756c6c1421c9b2732f5ef5c5712eb525 | [
"Apache-2.0"
] | 5 | 2020-10-27T21:16:28.000Z | 2021-04-15T11:36:04.000Z | UPDATE
OA_TEAM
SET
avatar_ref = :avatarRef,
color_code = :colorCode,
updated_at = :ts
WHERE
id = :id | 15 | 28 | 0.625 |
76d3a58a5e03e1e8d412656805739b58341aaaf9 | 156 | h | C | samples/TTCatalog/Classes/TabBarTestController.h | yiutsunchan/three20 | 4cd5ff62d155b8a3f66ce87dfef036bc30a673b9 | [
"Apache-2.0"
] | 18 | 2015-02-09T00:10:04.000Z | 2020-01-25T23:26:56.000Z | samples/TTCatalog/Classes/TabBarTestController.h | sco/three20 | d031df354d144ee0dea7688c3e402548a7622516 | [
"Apache-2.0"
] | 2 | 2015-01-21T03:37:48.000Z | 2020-02-29T06:48:20.000Z | samples/TTCatalog/Classes/TabBarTestController.h | sco/three20 | d031df354d144ee0dea7688c3e402548a7622516 | [
"Apache-2.0"
] | 3 | 2016-09-20T08:17:27.000Z | 2019-12-28T14:08:14.000Z | #import <Three20/Three20.h>
@interface TabBarTestController : TTViewController {
TTTabBar* _tabBar1;
TTTabBar* _tabBar2;
TTTabBar* _tabBar3;
}
@end
| 15.6 | 52 | 0.75 |
39fffde458bb59416bdf30dfde0388c9f5ce0667 | 9,193 | java | Java | src/main/java/net/starlark/java/eval/StarlarkSemantics.java | kjlubick/bazel | 6f0913e6e75477ec297430102a8213333a12967e | [
"Apache-2.0"
] | 1 | 2022-03-21T20:45:53.000Z | 2022-03-21T20:45:53.000Z | src/main/java/net/starlark/java/eval/StarlarkSemantics.java | kjlubick/bazel | 6f0913e6e75477ec297430102a8213333a12967e | [
"Apache-2.0"
] | 8 | 2017-07-11T15:39:02.000Z | 2017-07-21T16:09:02.000Z | src/main/java/net/starlark/java/eval/StarlarkSemantics.java | kjlubick/bazel | 6f0913e6e75477ec297430102a8213333a12967e | [
"Apache-2.0"
] | 1 | 2022-01-12T18:08:14.000Z | 2022-01-12T18:08:14.000Z | // Copyright 2019 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package net.starlark.java.eval;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
import java.util.TreeMap;
/**
* A StarlarkSemantics is an immutable set of optional name/value pairs that affect the dynamic
* behavior of Starlark operators and built-in functions, both core and application-defined.
*
* <p>For extensibility, a StarlarkSemantics only records a name/value pair when the value differs
* from the default value appropriate to that name. Values of most types are accessed using a {@link
* Key}, which defines the name, type, and default value for an entry. Boolean values are accessed
* using a string key; the string must have the prefix "+" or "-", indicating the default value: +
* for true, - for false. The reason for the special treatment of boolean entries is that they may
* enable or disable methods and parameters in the StarlarkMethod annotation system, and it is not
* possible to refer to a Key from a Java annotation, only a string.
*
* <p>It is the client's responsibility to ensure that a StarlarkSemantics does not encounter
* multiple Keys of the same name but different value types.
*
* <p>For Bazel's semantics options, see {@link packages.semantics.BuildLanguageOptions}.
*
* <p>For options that affect the static behavior of the Starlark frontend (lexer, parser,
* validator, compiler), see {@link FileOptions}.
*/
public final class StarlarkSemantics {
/**
* Returns the empty semantics, in which every option has its default value.
*
* <p><i>Usage note:</i> Usually all Starlark evaluation contexts (i.e., {@link StarlarkThread}s
* or other interpreter APIs that accept a {@code StarlarkSemantics}) within the same application
* should use the same semantics. Otherwise, different pieces of code -- or even the same code
* when executed in different capacities -- could produce diverging results. It is therefore
* generally a code smell to use the {@code DEFAULT} semantics rather than propagating a {@code
* StarlarkSemantics} from another context.
*/
public static final StarlarkSemantics DEFAULT = new StarlarkSemantics(ImmutableMap.of());
// A map entry must be accessed by Key iff its name has no [+-] prefix.
// Key<Boolean> is permitted too.
// The map keys are sorted but we avoid ImmutableSortedMap due to observed inefficiency.
private final ImmutableMap<String, Object> map;
private final int hashCode;
private StarlarkSemantics(ImmutableMap<String, Object> map) {
this.map = map;
this.hashCode = map.hashCode();
}
/** Returns the value of a boolean option, which must have a [+-] prefix. */
public boolean getBool(String name) {
char prefix = name.charAt(0);
Preconditions.checkArgument(prefix == '+' || prefix == '-');
boolean defaultValue = prefix == '+';
Boolean v = (Boolean) map.get(name); // prefix => cast cannot fail
return v != null ? v : defaultValue;
}
/** Returns the value of the option denoted by {@code key}. */
public <T> T get(Key<T> key) {
@SuppressWarnings("unchecked") // safe, if Key.names are unique
T v = (T) map.get(key.name);
return v != null ? v : key.defaultValue;
}
// TODO(bazel-team): This exists solely for BuiltinsInternalModule#getFlag, which allows a
// (privileged) Starlark caller to programmatically retrieve a flag's value without knowing its
// schema and default value. Reconsider whether we should support that use case from this class.
/**
* Returns the value of the option with the given name, or the default value if it is not set or
* does not exist.
*/
public Object getGeneric(String name, Object defaultValue) {
Object v = map.get(name);
// Try boolean prefixes if that didn't work.
if (v == null) {
v = map.get("+" + name);
}
if (v == null) {
v = map.get("-" + name);
}
return v != null ? v : defaultValue;
}
/** A Key identifies an option, providing its name, type, and default value. */
public static class Key<T> {
public final String name;
public final T defaultValue;
/**
* Constructs a key. The name must not start with [+-]. The value must not be subsequently
* modified.
*/
public Key(String name, T defaultValue) {
char prefix = name.charAt(0);
Preconditions.checkArgument(prefix != '-' && prefix != '+');
this.name = name;
this.defaultValue = Preconditions.checkNotNull(defaultValue);
}
@Override
public String toString() {
return this.name;
}
}
/**
* Returns a new builder that initially holds the same key/value pairs as this StarlarkSemantics.
*/
public Builder toBuilder() {
return new Builder(new TreeMap<>(map));
}
/** Returns a new empty builder. */
public static Builder builder() {
return new Builder(new TreeMap<>());
}
/** A Builder is a mutable container used to construct an immutable StarlarkSemantics. */
public static final class Builder {
private final TreeMap<String, Object> map;
private Builder(TreeMap<String, Object> map) {
this.map = map;
}
/** Sets the value for the specified key. */
public <T> Builder set(Key<T> key, T value) {
if (!value.equals(key.defaultValue)) {
map.put(key.name, value);
} else {
map.remove(key.name);
}
return this;
}
/** Sets the value for the boolean key, which must have a [+-] prefix. */
public Builder setBool(String name, boolean value) {
char prefix = name.charAt(0);
Preconditions.checkArgument(prefix == '+' || prefix == '-');
boolean defaultValue = prefix == '+';
if (value != defaultValue) {
map.put(name, value);
} else {
map.remove(name);
}
return this;
}
/** Returns an immutable StarlarkSemantics. */
public StarlarkSemantics build() {
return new StarlarkSemantics(ImmutableMap.copyOf(map));
}
}
/**
* Returns true if a feature attached to the given toggling flags should be enabled.
*
* <ul>
* <li>If both parameters are empty, this indicates the feature is not controlled by flags, and
* should thus be enabled.
* <li>If the {@code enablingFlag} parameter is non-empty, this returns true if and only if that
* flag is true. (This represents a feature that is only on if a given flag is *on*).
* <li>If the {@code disablingFlag} parameter is non-empty, this returns true if and only if
* that flag is false. (This represents a feature that is only on if a given flag is *off*).
* <li>It is illegal to pass both parameters as non-empty.
* </ul>
*/
boolean isFeatureEnabledBasedOnTogglingFlags(String enablingFlag, String disablingFlag) {
Preconditions.checkArgument(
enablingFlag.isEmpty() || disablingFlag.isEmpty(),
"at least one of 'enablingFlag' or 'disablingFlag' must be empty");
if (!enablingFlag.isEmpty()) {
return this.getBool(enablingFlag);
} else if (!disablingFlag.isEmpty()) {
return !this.getBool(disablingFlag);
} else {
return true;
}
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public boolean equals(Object that) {
return this == that
|| (that instanceof StarlarkSemantics && this.map.equals(((StarlarkSemantics) that).map));
}
/**
* Returns a representation of this StarlarkSemantics' non-default key/value pairs in key order.
*/
@Override
public String toString() {
// Print "StarlarkSemantics{k=v, ...}", without +/- prefixes.
StringBuilder buf = new StringBuilder();
buf.append("StarlarkSemantics{");
String sep = "";
for (Map.Entry<String, Object> e : map.entrySet()) {
String key = e.getKey();
buf.append(sep);
sep = ", ";
if (key.charAt(0) == '+' || key.charAt(0) == '-') {
buf.append(key, 1, key.length());
} else {
buf.append(key);
}
buf.append('=').append(e.getValue());
}
return buf.append('}').toString();
}
// -- semantics options affecting the Starlark interpreter itself --
/** Change the behavior of 'print' statements. Used in tests to verify flag propagation. */
public static final String PRINT_TEST_MARKER = "-print_test_marker";
/**
* Whether recursive function calls are allowed. This option is not exposed to Bazel, which
* unconditionally prohibits recursion.
*/
public static final String ALLOW_RECURSION = "-allow_recursion";
}
| 37.522449 | 100 | 0.675079 |
fddef8c025462248f6db115ee861330c6cc799fb | 1,699 | kt | Kotlin | src/main/kotlin/no/skatteetaten/aurora/boober/feature/CommonLabelFeature.kt | furode/boober | ccd89bc227d44f2fe3ad8a64224ac8dd19175289 | [
"Apache-2.0"
] | 21 | 2017-06-01T09:33:38.000Z | 2022-01-04T07:52:38.000Z | src/main/kotlin/no/skatteetaten/aurora/boober/feature/CommonLabelFeature.kt | furode/boober | ccd89bc227d44f2fe3ad8a64224ac8dd19175289 | [
"Apache-2.0"
] | 112 | 2017-06-01T20:02:04.000Z | 2022-03-29T21:26:08.000Z | src/main/kotlin/no/skatteetaten/aurora/boober/feature/CommonLabelFeature.kt | furode/boober | ccd89bc227d44f2fe3ad8a64224ac8dd19175289 | [
"Apache-2.0"
] | 8 | 2017-06-01T14:23:03.000Z | 2022-01-04T07:52:41.000Z | package no.skatteetaten.aurora.boober.feature
import no.skatteetaten.aurora.boober.model.AuroraConfigFieldHandler
import no.skatteetaten.aurora.boober.model.AuroraContextCommand
import no.skatteetaten.aurora.boober.model.AuroraDeploymentSpec
import no.skatteetaten.aurora.boober.model.AuroraResource
import no.skatteetaten.aurora.boober.model.addLabels
import no.skatteetaten.aurora.boober.service.UserDetailsProvider
import no.skatteetaten.aurora.boober.utils.Instants
import no.skatteetaten.aurora.boober.utils.normalizeLabels
import org.springframework.stereotype.Service
import java.time.ZoneId
@Service
class CommonLabelFeature(val userDetailsProvider: UserDetailsProvider) : Feature {
// all handlers are in header
override fun handlers(header: AuroraDeploymentSpec, cmd: AuroraContextCommand): Set<AuroraConfigFieldHandler> {
return emptySet()
}
fun createCommonLabels(adc: AuroraDeploymentSpec): Map<String, String> {
val now = Instants.now
val labels = mapOf(
"app" to adc.name,
"updatedBy" to userDetailsProvider.getAuthenticatedUser().username.replace(":", "-"),
"updatedAt" to now.epochSecond.toString(),
"lastUpdatedYear" to now.atZone(ZoneId.systemDefault()).year.toString(),
"affiliation" to adc.affiliation,
"name" to adc.name
)
return labels.normalizeLabels()
}
override fun modify(
adc: AuroraDeploymentSpec,
resources: Set<AuroraResource>,
context: FeatureContext
) {
val commonLabels = createCommonLabels(adc)
resources.addLabels(commonLabels, "Added commonLabels", this::class.java)
}
}
| 37.755556 | 115 | 0.732195 |
052add7587fa8107fa4cd273e6cf063f77f32746 | 292,299 | asm | Assembly | usertests.asm | Nehoray-Marziano/XV6-Scheduling-Policies | 70b706d3c974853acfffa9adaefbaa8ab5da5890 | [
"MIT-0"
] | null | null | null | usertests.asm | Nehoray-Marziano/XV6-Scheduling-Policies | 70b706d3c974853acfffa9adaefbaa8ab5da5890 | [
"MIT-0"
] | null | null | null | usertests.asm | Nehoray-Marziano/XV6-Scheduling-Policies | 70b706d3c974853acfffa9adaefbaa8ab5da5890 | [
"MIT-0"
] | null | null | null |
_usertests: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
return randstate;
}
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 51 push %ecx
e: 83 ec 0c sub $0xc,%esp
printf(1, "usertests starting\n");
11: 68 26 53 00 00 push $0x5326
16: 6a 01 push $0x1
18: e8 c3 3f 00 00 call 3fe0 <printf>
if(open("usertests.ran", 0) >= 0){
1d: 59 pop %ecx
1e: 58 pop %eax
1f: 6a 00 push $0x0
21: 68 3a 53 00 00 push $0x533a
26: e8 87 3e 00 00 call 3eb2 <open>
2b: 83 c4 10 add $0x10,%esp
2e: 85 c0 test %eax,%eax
30: 78 1a js 4c <main+0x4c>
printf(1, "already ran user tests -- rebuild fs.img\n");
32: 52 push %edx
33: 52 push %edx
34: 68 a4 5a 00 00 push $0x5aa4
39: 6a 01 push $0x1
3b: e8 a0 3f 00 00 call 3fe0 <printf>
exit(0);
40: c7 04 24 00 00 00 00 movl $0x0,(%esp)
47: e8 26 3e 00 00 call 3e72 <exit>
}
close(open("usertests.ran", O_CREATE));
4c: 50 push %eax
4d: 50 push %eax
4e: 68 00 02 00 00 push $0x200
53: 68 3a 53 00 00 push $0x533a
58: e8 55 3e 00 00 call 3eb2 <open>
5d: 89 04 24 mov %eax,(%esp)
60: e8 35 3e 00 00 call 3e9a <close>
argptest();
65: e8 26 3b 00 00 call 3b90 <argptest>
createdelete();
6a: e8 81 13 00 00 call 13f0 <createdelete>
linkunlink();
6f: e8 2c 1d 00 00 call 1da0 <linkunlink>
concreate();
74: e8 e7 19 00 00 call 1a60 <concreate>
fourfiles();
79: e8 32 11 00 00 call 11b0 <fourfiles>
sharedfd();
7e: e8 4d 0f 00 00 call fd0 <sharedfd>
bigargtest();
83: e8 88 37 00 00 call 3810 <bigargtest>
bigwrite();
88: e8 53 27 00 00 call 27e0 <bigwrite>
bigargtest();
8d: e8 7e 37 00 00 call 3810 <bigargtest>
bsstest();
92: e8 f9 36 00 00 call 3790 <bsstest>
sbrktest();
97: e8 94 31 00 00 call 3230 <sbrktest>
validatetest();
9c: e8 2f 36 00 00 call 36d0 <validatetest>
opentest();
a1: e8 ea 03 00 00 call 490 <opentest>
writetest();
a6: e8 85 04 00 00 call 530 <writetest>
writetest1();
ab: e8 90 06 00 00 call 740 <writetest1>
createtest();
b0: e8 8b 08 00 00 call 940 <createtest>
openiputtest();
b5: e8 a6 02 00 00 call 360 <openiputtest>
exitiputtest();
ba: e8 71 01 00 00 call 230 <exitiputtest>
iputtest();
bf: e8 6c 00 00 00 call 130 <iputtest>
mem();
c4: e8 27 0e 00 00 call ef0 <mem>
pipe1();
c9: e8 72 0a 00 00 call b40 <pipe1>
preempt();
ce: e8 2d 0c 00 00 call d00 <preempt>
exitwait(null);
d3: c7 04 24 00 00 00 00 movl $0x0,(%esp)
da: e8 71 0d 00 00 call e50 <exitwait>
rmdot();
df: e8 4c 2b 00 00 call 2c30 <rmdot>
fourteen();
e4: e8 e7 29 00 00 call 2ad0 <fourteen>
bigfile();
e9: e8 e2 27 00 00 call 28d0 <bigfile>
subdir();
ee: e8 0d 1f 00 00 call 2000 <subdir>
linktest();
f3: e8 18 17 00 00 call 1810 <linktest>
unlinkread();
f8: e8 53 15 00 00 call 1650 <unlinkread>
dirfile();
fd: e8 de 2c 00 00 call 2de0 <dirfile>
iref();
102: e8 19 2f 00 00 call 3020 <iref>
forktest();
107: e8 44 30 00 00 call 3150 <forktest>
bigdir(); // slow
10c: e8 9f 1d 00 00 call 1eb0 <bigdir>
uio();
111: e8 ea 39 00 00 call 3b00 <uio>
exectest();
116: e8 d5 09 00 00 call af0 <exectest>
exit(0);
11b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
122: e8 4b 3d 00 00 call 3e72 <exit>
127: 66 90 xchg %ax,%ax
129: 66 90 xchg %ax,%ax
12b: 66 90 xchg %ax,%ax
12d: 66 90 xchg %ax,%ax
12f: 90 nop
00000130 <iputtest>:
{
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 83 ec 10 sub $0x10,%esp
printf(stdout, "iput test\n");
136: 68 cc 43 00 00 push $0x43cc
13b: ff 35 e8 63 00 00 pushl 0x63e8
141: e8 9a 3e 00 00 call 3fe0 <printf>
if(mkdir("iputdir") < 0){
146: c7 04 24 5f 43 00 00 movl $0x435f,(%esp)
14d: e8 88 3d 00 00 call 3eda <mkdir>
152: 83 c4 10 add $0x10,%esp
155: 85 c0 test %eax,%eax
157: 78 58 js 1b1 <iputtest+0x81>
if(chdir("iputdir") < 0){
159: 83 ec 0c sub $0xc,%esp
15c: 68 5f 43 00 00 push $0x435f
161: e8 7c 3d 00 00 call 3ee2 <chdir>
166: 83 c4 10 add $0x10,%esp
169: 85 c0 test %eax,%eax
16b: 0f 88 9a 00 00 00 js 20b <iputtest+0xdb>
if(unlink("../iputdir") < 0){
171: 83 ec 0c sub $0xc,%esp
174: 68 5c 43 00 00 push $0x435c
179: e8 44 3d 00 00 call 3ec2 <unlink>
17e: 83 c4 10 add $0x10,%esp
181: 85 c0 test %eax,%eax
183: 78 68 js 1ed <iputtest+0xbd>
if(chdir("/") < 0){
185: 83 ec 0c sub $0xc,%esp
188: 68 81 43 00 00 push $0x4381
18d: e8 50 3d 00 00 call 3ee2 <chdir>
192: 83 c4 10 add $0x10,%esp
195: 85 c0 test %eax,%eax
197: 78 36 js 1cf <iputtest+0x9f>
printf(stdout, "iput test ok\n");
199: 83 ec 08 sub $0x8,%esp
19c: 68 04 44 00 00 push $0x4404
1a1: ff 35 e8 63 00 00 pushl 0x63e8
1a7: e8 34 3e 00 00 call 3fe0 <printf>
}
1ac: 83 c4 10 add $0x10,%esp
1af: c9 leave
1b0: c3 ret
printf(stdout, "mkdir failed\n");
1b1: 50 push %eax
1b2: 50 push %eax
1b3: 68 38 43 00 00 push $0x4338
1b8: ff 35 e8 63 00 00 pushl 0x63e8
1be: e8 1d 3e 00 00 call 3fe0 <printf>
exit(0);
1c3: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1ca: e8 a3 3c 00 00 call 3e72 <exit>
printf(stdout, "chdir / failed\n");
1cf: 50 push %eax
1d0: 50 push %eax
1d1: 68 83 43 00 00 push $0x4383
1d6: ff 35 e8 63 00 00 pushl 0x63e8
1dc: e8 ff 3d 00 00 call 3fe0 <printf>
exit(0);
1e1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1e8: e8 85 3c 00 00 call 3e72 <exit>
printf(stdout, "unlink ../iputdir failed\n");
1ed: 52 push %edx
1ee: 52 push %edx
1ef: 68 67 43 00 00 push $0x4367
1f4: ff 35 e8 63 00 00 pushl 0x63e8
1fa: e8 e1 3d 00 00 call 3fe0 <printf>
exit(0);
1ff: c7 04 24 00 00 00 00 movl $0x0,(%esp)
206: e8 67 3c 00 00 call 3e72 <exit>
printf(stdout, "chdir iputdir failed\n");
20b: 51 push %ecx
20c: 51 push %ecx
20d: 68 46 43 00 00 push $0x4346
212: ff 35 e8 63 00 00 pushl 0x63e8
218: e8 c3 3d 00 00 call 3fe0 <printf>
exit(0);
21d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
224: e8 49 3c 00 00 call 3e72 <exit>
229: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000230 <exitiputtest>:
{
230: 55 push %ebp
231: 89 e5 mov %esp,%ebp
233: 83 ec 10 sub $0x10,%esp
printf(stdout, "exitiput test\n");
236: 68 93 43 00 00 push $0x4393
23b: ff 35 e8 63 00 00 pushl 0x63e8
241: e8 9a 3d 00 00 call 3fe0 <printf>
pid = fork();
246: e8 1f 3c 00 00 call 3e6a <fork>
if(pid < 0){
24b: 83 c4 10 add $0x10,%esp
24e: 85 c0 test %eax,%eax
250: 0f 88 a1 00 00 00 js 2f7 <exitiputtest+0xc7>
if(pid == 0){
256: 75 58 jne 2b0 <exitiputtest+0x80>
if(mkdir("iputdir") < 0){
258: 83 ec 0c sub $0xc,%esp
25b: 68 5f 43 00 00 push $0x435f
260: e8 75 3c 00 00 call 3eda <mkdir>
265: 83 c4 10 add $0x10,%esp
268: 85 c0 test %eax,%eax
26a: 0f 88 c3 00 00 00 js 333 <exitiputtest+0x103>
if(chdir("iputdir") < 0){
270: 83 ec 0c sub $0xc,%esp
273: 68 5f 43 00 00 push $0x435f
278: e8 65 3c 00 00 call 3ee2 <chdir>
27d: 83 c4 10 add $0x10,%esp
280: 85 c0 test %eax,%eax
282: 0f 88 8d 00 00 00 js 315 <exitiputtest+0xe5>
if(unlink("../iputdir") < 0){
288: 83 ec 0c sub $0xc,%esp
28b: 68 5c 43 00 00 push $0x435c
290: e8 2d 3c 00 00 call 3ec2 <unlink>
295: 83 c4 10 add $0x10,%esp
298: 85 c0 test %eax,%eax
29a: 78 3c js 2d8 <exitiputtest+0xa8>
exit(0);
29c: 83 ec 0c sub $0xc,%esp
29f: 6a 00 push $0x0
2a1: e8 cc 3b 00 00 call 3e72 <exit>
2a6: 8d 76 00 lea 0x0(%esi),%esi
2a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
wait(null);
2b0: 83 ec 0c sub $0xc,%esp
2b3: 6a 00 push $0x0
2b5: e8 c0 3b 00 00 call 3e7a <wait>
printf(stdout, "exitiput test ok\n");
2ba: 58 pop %eax
2bb: 5a pop %edx
2bc: 68 b6 43 00 00 push $0x43b6
2c1: ff 35 e8 63 00 00 pushl 0x63e8
2c7: e8 14 3d 00 00 call 3fe0 <printf>
}
2cc: 83 c4 10 add $0x10,%esp
2cf: c9 leave
2d0: c3 ret
2d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printf(stdout, "unlink ../iputdir failed\n");
2d8: 83 ec 08 sub $0x8,%esp
2db: 68 67 43 00 00 push $0x4367
2e0: ff 35 e8 63 00 00 pushl 0x63e8
2e6: e8 f5 3c 00 00 call 3fe0 <printf>
exit(0);
2eb: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2f2: e8 7b 3b 00 00 call 3e72 <exit>
printf(stdout, "fork failed\n");
2f7: 50 push %eax
2f8: 50 push %eax
2f9: 68 79 52 00 00 push $0x5279
2fe: ff 35 e8 63 00 00 pushl 0x63e8
304: e8 d7 3c 00 00 call 3fe0 <printf>
exit(0);
309: c7 04 24 00 00 00 00 movl $0x0,(%esp)
310: e8 5d 3b 00 00 call 3e72 <exit>
printf(stdout, "child chdir failed\n");
315: 51 push %ecx
316: 51 push %ecx
317: 68 a2 43 00 00 push $0x43a2
31c: ff 35 e8 63 00 00 pushl 0x63e8
322: e8 b9 3c 00 00 call 3fe0 <printf>
exit(0);
327: c7 04 24 00 00 00 00 movl $0x0,(%esp)
32e: e8 3f 3b 00 00 call 3e72 <exit>
printf(stdout, "mkdir failed\n");
333: 50 push %eax
334: 50 push %eax
335: 68 38 43 00 00 push $0x4338
33a: ff 35 e8 63 00 00 pushl 0x63e8
340: e8 9b 3c 00 00 call 3fe0 <printf>
exit(0);
345: c7 04 24 00 00 00 00 movl $0x0,(%esp)
34c: e8 21 3b 00 00 call 3e72 <exit>
351: eb 0d jmp 360 <openiputtest>
353: 90 nop
354: 90 nop
355: 90 nop
356: 90 nop
357: 90 nop
358: 90 nop
359: 90 nop
35a: 90 nop
35b: 90 nop
35c: 90 nop
35d: 90 nop
35e: 90 nop
35f: 90 nop
00000360 <openiputtest>:
{
360: 55 push %ebp
361: 89 e5 mov %esp,%ebp
363: 83 ec 10 sub $0x10,%esp
printf(stdout, "openiput test\n");
366: 68 c8 43 00 00 push $0x43c8
36b: ff 35 e8 63 00 00 pushl 0x63e8
371: e8 6a 3c 00 00 call 3fe0 <printf>
if(mkdir("oidir") < 0){
376: c7 04 24 d7 43 00 00 movl $0x43d7,(%esp)
37d: e8 58 3b 00 00 call 3eda <mkdir>
382: 83 c4 10 add $0x10,%esp
385: 85 c0 test %eax,%eax
387: 0f 88 9d 00 00 00 js 42a <openiputtest+0xca>
pid = fork();
38d: e8 d8 3a 00 00 call 3e6a <fork>
if(pid < 0){
392: 85 c0 test %eax,%eax
394: 0f 88 ae 00 00 00 js 448 <openiputtest+0xe8>
if(pid == 0){
39a: 75 3c jne 3d8 <openiputtest+0x78>
int fd = open("oidir", O_RDWR);
39c: 83 ec 08 sub $0x8,%esp
39f: 6a 02 push $0x2
3a1: 68 d7 43 00 00 push $0x43d7
3a6: e8 07 3b 00 00 call 3eb2 <open>
if(fd >= 0){
3ab: 83 c4 10 add $0x10,%esp
3ae: 85 c0 test %eax,%eax
3b0: 78 6e js 420 <openiputtest+0xc0>
printf(stdout, "open directory for write succeeded\n");
3b2: 83 ec 08 sub $0x8,%esp
3b5: 68 5c 53 00 00 push $0x535c
3ba: ff 35 e8 63 00 00 pushl 0x63e8
3c0: e8 1b 3c 00 00 call 3fe0 <printf>
exit(0);
3c5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3cc: e8 a1 3a 00 00 call 3e72 <exit>
3d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
sleep(1);
3d8: 83 ec 0c sub $0xc,%esp
3db: 6a 01 push $0x1
3dd: e8 20 3b 00 00 call 3f02 <sleep>
if(unlink("oidir") != 0){
3e2: c7 04 24 d7 43 00 00 movl $0x43d7,(%esp)
3e9: e8 d4 3a 00 00 call 3ec2 <unlink>
3ee: 83 c4 10 add $0x10,%esp
3f1: 85 c0 test %eax,%eax
3f3: 75 71 jne 466 <openiputtest+0x106>
wait(null);
3f5: 83 ec 0c sub $0xc,%esp
3f8: 6a 00 push $0x0
3fa: e8 7b 3a 00 00 call 3e7a <wait>
printf(stdout, "openiput test ok\n");
3ff: 58 pop %eax
400: 5a pop %edx
401: 68 00 44 00 00 push $0x4400
406: ff 35 e8 63 00 00 pushl 0x63e8
40c: e8 cf 3b 00 00 call 3fe0 <printf>
}
411: 83 c4 10 add $0x10,%esp
414: c9 leave
415: c3 ret
416: 8d 76 00 lea 0x0(%esi),%esi
419: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
exit(0);
420: 83 ec 0c sub $0xc,%esp
423: 6a 00 push $0x0
425: e8 48 3a 00 00 call 3e72 <exit>
printf(stdout, "mkdir oidir failed\n");
42a: 50 push %eax
42b: 50 push %eax
42c: 68 dd 43 00 00 push $0x43dd
431: ff 35 e8 63 00 00 pushl 0x63e8
437: e8 a4 3b 00 00 call 3fe0 <printf>
exit(0);
43c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
443: e8 2a 3a 00 00 call 3e72 <exit>
printf(stdout, "fork failed\n");
448: 50 push %eax
449: 50 push %eax
44a: 68 79 52 00 00 push $0x5279
44f: ff 35 e8 63 00 00 pushl 0x63e8
455: e8 86 3b 00 00 call 3fe0 <printf>
exit(0);
45a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
461: e8 0c 3a 00 00 call 3e72 <exit>
printf(stdout, "unlink failed\n");
466: 51 push %ecx
467: 51 push %ecx
468: 68 f1 43 00 00 push $0x43f1
46d: ff 35 e8 63 00 00 pushl 0x63e8
473: e8 68 3b 00 00 call 3fe0 <printf>
exit(0);
478: c7 04 24 00 00 00 00 movl $0x0,(%esp)
47f: e8 ee 39 00 00 call 3e72 <exit>
484: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
48a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000490 <opentest>:
{
490: 55 push %ebp
491: 89 e5 mov %esp,%ebp
493: 83 ec 10 sub $0x10,%esp
printf(stdout, "open test\n");
496: 68 12 44 00 00 push $0x4412
49b: ff 35 e8 63 00 00 pushl 0x63e8
4a1: e8 3a 3b 00 00 call 3fe0 <printf>
fd = open("echo", 0);
4a6: 58 pop %eax
4a7: 5a pop %edx
4a8: 6a 00 push $0x0
4aa: 68 1d 44 00 00 push $0x441d
4af: e8 fe 39 00 00 call 3eb2 <open>
if(fd < 0){
4b4: 83 c4 10 add $0x10,%esp
4b7: 85 c0 test %eax,%eax
4b9: 78 36 js 4f1 <opentest+0x61>
close(fd);
4bb: 83 ec 0c sub $0xc,%esp
4be: 50 push %eax
4bf: e8 d6 39 00 00 call 3e9a <close>
fd = open("doesnotexist", 0);
4c4: 5a pop %edx
4c5: 59 pop %ecx
4c6: 6a 00 push $0x0
4c8: 68 35 44 00 00 push $0x4435
4cd: e8 e0 39 00 00 call 3eb2 <open>
if(fd >= 0){
4d2: 83 c4 10 add $0x10,%esp
4d5: 85 c0 test %eax,%eax
4d7: 79 36 jns 50f <opentest+0x7f>
printf(stdout, "open test ok\n");
4d9: 83 ec 08 sub $0x8,%esp
4dc: 68 60 44 00 00 push $0x4460
4e1: ff 35 e8 63 00 00 pushl 0x63e8
4e7: e8 f4 3a 00 00 call 3fe0 <printf>
}
4ec: 83 c4 10 add $0x10,%esp
4ef: c9 leave
4f0: c3 ret
printf(stdout, "open echo failed!\n");
4f1: 50 push %eax
4f2: 50 push %eax
4f3: 68 22 44 00 00 push $0x4422
4f8: ff 35 e8 63 00 00 pushl 0x63e8
4fe: e8 dd 3a 00 00 call 3fe0 <printf>
exit(0);
503: c7 04 24 00 00 00 00 movl $0x0,(%esp)
50a: e8 63 39 00 00 call 3e72 <exit>
printf(stdout, "open doesnotexist succeeded!\n");
50f: 50 push %eax
510: 50 push %eax
511: 68 42 44 00 00 push $0x4442
516: ff 35 e8 63 00 00 pushl 0x63e8
51c: e8 bf 3a 00 00 call 3fe0 <printf>
exit(0);
521: c7 04 24 00 00 00 00 movl $0x0,(%esp)
528: e8 45 39 00 00 call 3e72 <exit>
52d: 8d 76 00 lea 0x0(%esi),%esi
00000530 <writetest>:
{
530: 55 push %ebp
531: 89 e5 mov %esp,%ebp
533: 56 push %esi
534: 53 push %ebx
printf(stdout, "small file test\n");
535: 83 ec 08 sub $0x8,%esp
538: 68 6e 44 00 00 push $0x446e
53d: ff 35 e8 63 00 00 pushl 0x63e8
543: e8 98 3a 00 00 call 3fe0 <printf>
fd = open("small", O_CREATE|O_RDWR);
548: 58 pop %eax
549: 5a pop %edx
54a: 68 02 02 00 00 push $0x202
54f: 68 7f 44 00 00 push $0x447f
554: e8 59 39 00 00 call 3eb2 <open>
if(fd >= 0){
559: 83 c4 10 add $0x10,%esp
55c: 85 c0 test %eax,%eax
55e: 0f 88 af 01 00 00 js 713 <writetest+0x1e3>
printf(stdout, "creat small succeeded; ok\n");
564: 83 ec 08 sub $0x8,%esp
567: 89 c6 mov %eax,%esi
for(i = 0; i < 100; i++){
569: 31 db xor %ebx,%ebx
printf(stdout, "creat small succeeded; ok\n");
56b: 68 85 44 00 00 push $0x4485
570: ff 35 e8 63 00 00 pushl 0x63e8
576: e8 65 3a 00 00 call 3fe0 <printf>
57b: 83 c4 10 add $0x10,%esp
57e: 66 90 xchg %ax,%ax
if(write(fd, "aaaaaaaaaa", 10) != 10){
580: 83 ec 04 sub $0x4,%esp
583: 6a 0a push $0xa
585: 68 bc 44 00 00 push $0x44bc
58a: 56 push %esi
58b: e8 02 39 00 00 call 3e92 <write>
590: 83 c4 10 add $0x10,%esp
593: 83 f8 0a cmp $0xa,%eax
596: 0f 85 dd 00 00 00 jne 679 <writetest+0x149>
if(write(fd, "bbbbbbbbbb", 10) != 10){
59c: 83 ec 04 sub $0x4,%esp
59f: 6a 0a push $0xa
5a1: 68 c7 44 00 00 push $0x44c7
5a6: 56 push %esi
5a7: e8 e6 38 00 00 call 3e92 <write>
5ac: 83 c4 10 add $0x10,%esp
5af: 83 f8 0a cmp $0xa,%eax
5b2: 0f 85 e1 00 00 00 jne 699 <writetest+0x169>
for(i = 0; i < 100; i++){
5b8: 83 c3 01 add $0x1,%ebx
5bb: 83 fb 64 cmp $0x64,%ebx
5be: 75 c0 jne 580 <writetest+0x50>
printf(stdout, "writes ok\n");
5c0: 83 ec 08 sub $0x8,%esp
5c3: 68 d2 44 00 00 push $0x44d2
5c8: ff 35 e8 63 00 00 pushl 0x63e8
5ce: e8 0d 3a 00 00 call 3fe0 <printf>
close(fd);
5d3: 89 34 24 mov %esi,(%esp)
5d6: e8 bf 38 00 00 call 3e9a <close>
fd = open("small", O_RDONLY);
5db: 5b pop %ebx
5dc: 5e pop %esi
5dd: 6a 00 push $0x0
5df: 68 7f 44 00 00 push $0x447f
5e4: e8 c9 38 00 00 call 3eb2 <open>
if(fd >= 0){
5e9: 83 c4 10 add $0x10,%esp
5ec: 85 c0 test %eax,%eax
fd = open("small", O_RDONLY);
5ee: 89 c3 mov %eax,%ebx
if(fd >= 0){
5f0: 0f 88 c3 00 00 00 js 6b9 <writetest+0x189>
printf(stdout, "open small succeeded ok\n");
5f6: 83 ec 08 sub $0x8,%esp
5f9: 68 dd 44 00 00 push $0x44dd
5fe: ff 35 e8 63 00 00 pushl 0x63e8
604: e8 d7 39 00 00 call 3fe0 <printf>
i = read(fd, buf, 2000);
609: 83 c4 0c add $0xc,%esp
60c: 68 d0 07 00 00 push $0x7d0
611: 68 c0 8b 00 00 push $0x8bc0
616: 53 push %ebx
617: e8 6e 38 00 00 call 3e8a <read>
if(i == 2000){
61c: 83 c4 10 add $0x10,%esp
61f: 3d d0 07 00 00 cmp $0x7d0,%eax
624: 0f 85 ad 00 00 00 jne 6d7 <writetest+0x1a7>
printf(stdout, "read succeeded ok\n");
62a: 83 ec 08 sub $0x8,%esp
62d: 68 11 45 00 00 push $0x4511
632: ff 35 e8 63 00 00 pushl 0x63e8
638: e8 a3 39 00 00 call 3fe0 <printf>
close(fd);
63d: 89 1c 24 mov %ebx,(%esp)
640: e8 55 38 00 00 call 3e9a <close>
if(unlink("small") < 0){
645: c7 04 24 7f 44 00 00 movl $0x447f,(%esp)
64c: e8 71 38 00 00 call 3ec2 <unlink>
651: 83 c4 10 add $0x10,%esp
654: 85 c0 test %eax,%eax
656: 0f 88 99 00 00 00 js 6f5 <writetest+0x1c5>
printf(stdout, "small file test ok\n");
65c: 83 ec 08 sub $0x8,%esp
65f: 68 39 45 00 00 push $0x4539
664: ff 35 e8 63 00 00 pushl 0x63e8
66a: e8 71 39 00 00 call 3fe0 <printf>
}
66f: 83 c4 10 add $0x10,%esp
672: 8d 65 f8 lea -0x8(%ebp),%esp
675: 5b pop %ebx
676: 5e pop %esi
677: 5d pop %ebp
678: c3 ret
printf(stdout, "error: write aa %d new file failed\n", i);
679: 83 ec 04 sub $0x4,%esp
67c: 53 push %ebx
67d: 68 80 53 00 00 push $0x5380
682: ff 35 e8 63 00 00 pushl 0x63e8
688: e8 53 39 00 00 call 3fe0 <printf>
exit(0);
68d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
694: e8 d9 37 00 00 call 3e72 <exit>
printf(stdout, "error: write bb %d new file failed\n", i);
699: 83 ec 04 sub $0x4,%esp
69c: 53 push %ebx
69d: 68 a4 53 00 00 push $0x53a4
6a2: ff 35 e8 63 00 00 pushl 0x63e8
6a8: e8 33 39 00 00 call 3fe0 <printf>
exit(0);
6ad: c7 04 24 00 00 00 00 movl $0x0,(%esp)
6b4: e8 b9 37 00 00 call 3e72 <exit>
printf(stdout, "error: open small failed!\n");
6b9: 51 push %ecx
6ba: 51 push %ecx
6bb: 68 f6 44 00 00 push $0x44f6
6c0: ff 35 e8 63 00 00 pushl 0x63e8
6c6: e8 15 39 00 00 call 3fe0 <printf>
exit(0);
6cb: c7 04 24 00 00 00 00 movl $0x0,(%esp)
6d2: e8 9b 37 00 00 call 3e72 <exit>
printf(stdout, "read failed\n");
6d7: 52 push %edx
6d8: 52 push %edx
6d9: 68 3d 48 00 00 push $0x483d
6de: ff 35 e8 63 00 00 pushl 0x63e8
6e4: e8 f7 38 00 00 call 3fe0 <printf>
exit(0);
6e9: c7 04 24 00 00 00 00 movl $0x0,(%esp)
6f0: e8 7d 37 00 00 call 3e72 <exit>
printf(stdout, "unlink small failed\n");
6f5: 50 push %eax
6f6: 50 push %eax
6f7: 68 24 45 00 00 push $0x4524
6fc: ff 35 e8 63 00 00 pushl 0x63e8
702: e8 d9 38 00 00 call 3fe0 <printf>
exit(0);
707: c7 04 24 00 00 00 00 movl $0x0,(%esp)
70e: e8 5f 37 00 00 call 3e72 <exit>
printf(stdout, "error: creat small failed!\n");
713: 50 push %eax
714: 50 push %eax
715: 68 a0 44 00 00 push $0x44a0
71a: ff 35 e8 63 00 00 pushl 0x63e8
720: e8 bb 38 00 00 call 3fe0 <printf>
exit(0);
725: c7 04 24 00 00 00 00 movl $0x0,(%esp)
72c: e8 41 37 00 00 call 3e72 <exit>
731: eb 0d jmp 740 <writetest1>
733: 90 nop
734: 90 nop
735: 90 nop
736: 90 nop
737: 90 nop
738: 90 nop
739: 90 nop
73a: 90 nop
73b: 90 nop
73c: 90 nop
73d: 90 nop
73e: 90 nop
73f: 90 nop
00000740 <writetest1>:
{
740: 55 push %ebp
741: 89 e5 mov %esp,%ebp
743: 56 push %esi
744: 53 push %ebx
printf(stdout, "big files test\n");
745: 83 ec 08 sub $0x8,%esp
748: 68 4d 45 00 00 push $0x454d
74d: ff 35 e8 63 00 00 pushl 0x63e8
753: e8 88 38 00 00 call 3fe0 <printf>
fd = open("big", O_CREATE|O_RDWR);
758: 58 pop %eax
759: 5a pop %edx
75a: 68 02 02 00 00 push $0x202
75f: 68 c7 45 00 00 push $0x45c7
764: e8 49 37 00 00 call 3eb2 <open>
if(fd < 0){
769: 83 c4 10 add $0x10,%esp
76c: 85 c0 test %eax,%eax
76e: 0f 88 88 01 00 00 js 8fc <writetest1+0x1bc>
774: 89 c6 mov %eax,%esi
for(i = 0; i < MAXFILE; i++){
776: 31 db xor %ebx,%ebx
778: 90 nop
779: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(write(fd, buf, 512) != 512){
780: 83 ec 04 sub $0x4,%esp
((int*)buf)[0] = i;
783: 89 1d c0 8b 00 00 mov %ebx,0x8bc0
if(write(fd, buf, 512) != 512){
789: 68 00 02 00 00 push $0x200
78e: 68 c0 8b 00 00 push $0x8bc0
793: 56 push %esi
794: e8 f9 36 00 00 call 3e92 <write>
799: 83 c4 10 add $0x10,%esp
79c: 3d 00 02 00 00 cmp $0x200,%eax
7a1: 0f 85 b7 00 00 00 jne 85e <writetest1+0x11e>
for(i = 0; i < MAXFILE; i++){
7a7: 83 c3 01 add $0x1,%ebx
7aa: 81 fb 8c 00 00 00 cmp $0x8c,%ebx
7b0: 75 ce jne 780 <writetest1+0x40>
close(fd);
7b2: 83 ec 0c sub $0xc,%esp
7b5: 56 push %esi
7b6: e8 df 36 00 00 call 3e9a <close>
fd = open("big", O_RDONLY);
7bb: 5b pop %ebx
7bc: 5e pop %esi
7bd: 6a 00 push $0x0
7bf: 68 c7 45 00 00 push $0x45c7
7c4: e8 e9 36 00 00 call 3eb2 <open>
if(fd < 0){
7c9: 83 c4 10 add $0x10,%esp
7cc: 85 c0 test %eax,%eax
fd = open("big", O_RDONLY);
7ce: 89 c6 mov %eax,%esi
if(fd < 0){
7d0: 0f 88 08 01 00 00 js 8de <writetest1+0x19e>
n = 0;
7d6: 31 db xor %ebx,%ebx
7d8: eb 21 jmp 7fb <writetest1+0xbb>
7da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(i != 512){
7e0: 3d 00 02 00 00 cmp $0x200,%eax
7e5: 0f 85 b1 00 00 00 jne 89c <writetest1+0x15c>
if(((int*)buf)[0] != n){
7eb: a1 c0 8b 00 00 mov 0x8bc0,%eax
7f0: 39 d8 cmp %ebx,%eax
7f2: 0f 85 86 00 00 00 jne 87e <writetest1+0x13e>
n++;
7f8: 83 c3 01 add $0x1,%ebx
i = read(fd, buf, 512);
7fb: 83 ec 04 sub $0x4,%esp
7fe: 68 00 02 00 00 push $0x200
803: 68 c0 8b 00 00 push $0x8bc0
808: 56 push %esi
809: e8 7c 36 00 00 call 3e8a <read>
if(i == 0){
80e: 83 c4 10 add $0x10,%esp
811: 85 c0 test %eax,%eax
813: 75 cb jne 7e0 <writetest1+0xa0>
if(n == MAXFILE - 1){
815: 81 fb 8b 00 00 00 cmp $0x8b,%ebx
81b: 0f 84 9b 00 00 00 je 8bc <writetest1+0x17c>
close(fd);
821: 83 ec 0c sub $0xc,%esp
824: 56 push %esi
825: e8 70 36 00 00 call 3e9a <close>
if(unlink("big") < 0){
82a: c7 04 24 c7 45 00 00 movl $0x45c7,(%esp)
831: e8 8c 36 00 00 call 3ec2 <unlink>
836: 83 c4 10 add $0x10,%esp
839: 85 c0 test %eax,%eax
83b: 0f 88 d9 00 00 00 js 91a <writetest1+0x1da>
printf(stdout, "big files ok\n");
841: 83 ec 08 sub $0x8,%esp
844: 68 ee 45 00 00 push $0x45ee
849: ff 35 e8 63 00 00 pushl 0x63e8
84f: e8 8c 37 00 00 call 3fe0 <printf>
}
854: 83 c4 10 add $0x10,%esp
857: 8d 65 f8 lea -0x8(%ebp),%esp
85a: 5b pop %ebx
85b: 5e pop %esi
85c: 5d pop %ebp
85d: c3 ret
printf(stdout, "error: write big file failed\n", i);
85e: 83 ec 04 sub $0x4,%esp
861: 53 push %ebx
862: 68 77 45 00 00 push $0x4577
867: ff 35 e8 63 00 00 pushl 0x63e8
86d: e8 6e 37 00 00 call 3fe0 <printf>
exit(0);
872: c7 04 24 00 00 00 00 movl $0x0,(%esp)
879: e8 f4 35 00 00 call 3e72 <exit>
printf(stdout, "read content of block %d is %d\n",
87e: 50 push %eax
87f: 53 push %ebx
880: 68 c8 53 00 00 push $0x53c8
885: ff 35 e8 63 00 00 pushl 0x63e8
88b: e8 50 37 00 00 call 3fe0 <printf>
exit(0);
890: c7 04 24 00 00 00 00 movl $0x0,(%esp)
897: e8 d6 35 00 00 call 3e72 <exit>
printf(stdout, "read failed %d\n", i);
89c: 83 ec 04 sub $0x4,%esp
89f: 50 push %eax
8a0: 68 cb 45 00 00 push $0x45cb
8a5: ff 35 e8 63 00 00 pushl 0x63e8
8ab: e8 30 37 00 00 call 3fe0 <printf>
exit(0);
8b0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8b7: e8 b6 35 00 00 call 3e72 <exit>
printf(stdout, "read only %d blocks from big", n);
8bc: 52 push %edx
8bd: 68 8b 00 00 00 push $0x8b
8c2: 68 ae 45 00 00 push $0x45ae
8c7: ff 35 e8 63 00 00 pushl 0x63e8
8cd: e8 0e 37 00 00 call 3fe0 <printf>
exit(0);
8d2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8d9: e8 94 35 00 00 call 3e72 <exit>
printf(stdout, "error: open big failed!\n");
8de: 51 push %ecx
8df: 51 push %ecx
8e0: 68 95 45 00 00 push $0x4595
8e5: ff 35 e8 63 00 00 pushl 0x63e8
8eb: e8 f0 36 00 00 call 3fe0 <printf>
exit(0);
8f0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8f7: e8 76 35 00 00 call 3e72 <exit>
printf(stdout, "error: creat big failed!\n");
8fc: 50 push %eax
8fd: 50 push %eax
8fe: 68 5d 45 00 00 push $0x455d
903: ff 35 e8 63 00 00 pushl 0x63e8
909: e8 d2 36 00 00 call 3fe0 <printf>
exit(0);
90e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
915: e8 58 35 00 00 call 3e72 <exit>
printf(stdout, "unlink big failed\n");
91a: 50 push %eax
91b: 50 push %eax
91c: 68 db 45 00 00 push $0x45db
921: ff 35 e8 63 00 00 pushl 0x63e8
927: e8 b4 36 00 00 call 3fe0 <printf>
exit(0);
92c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
933: e8 3a 35 00 00 call 3e72 <exit>
938: 90 nop
939: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000940 <createtest>:
{
940: 55 push %ebp
941: 89 e5 mov %esp,%ebp
943: 53 push %ebx
name[2] = '\0';
944: bb 30 00 00 00 mov $0x30,%ebx
{
949: 83 ec 0c sub $0xc,%esp
printf(stdout, "many creates, followed by unlink test\n");
94c: 68 e8 53 00 00 push $0x53e8
951: ff 35 e8 63 00 00 pushl 0x63e8
957: e8 84 36 00 00 call 3fe0 <printf>
name[0] = 'a';
95c: c6 05 c0 ab 00 00 61 movb $0x61,0xabc0
name[2] = '\0';
963: c6 05 c2 ab 00 00 00 movb $0x0,0xabc2
96a: 83 c4 10 add $0x10,%esp
96d: 8d 76 00 lea 0x0(%esi),%esi
fd = open(name, O_CREATE|O_RDWR);
970: 83 ec 08 sub $0x8,%esp
name[1] = '0' + i;
973: 88 1d c1 ab 00 00 mov %bl,0xabc1
979: 83 c3 01 add $0x1,%ebx
fd = open(name, O_CREATE|O_RDWR);
97c: 68 02 02 00 00 push $0x202
981: 68 c0 ab 00 00 push $0xabc0
986: e8 27 35 00 00 call 3eb2 <open>
close(fd);
98b: 89 04 24 mov %eax,(%esp)
98e: e8 07 35 00 00 call 3e9a <close>
for(i = 0; i < 52; i++){
993: 83 c4 10 add $0x10,%esp
996: 80 fb 64 cmp $0x64,%bl
999: 75 d5 jne 970 <createtest+0x30>
name[0] = 'a';
99b: c6 05 c0 ab 00 00 61 movb $0x61,0xabc0
name[2] = '\0';
9a2: c6 05 c2 ab 00 00 00 movb $0x0,0xabc2
9a9: bb 30 00 00 00 mov $0x30,%ebx
9ae: 66 90 xchg %ax,%ax
unlink(name);
9b0: 83 ec 0c sub $0xc,%esp
name[1] = '0' + i;
9b3: 88 1d c1 ab 00 00 mov %bl,0xabc1
9b9: 83 c3 01 add $0x1,%ebx
unlink(name);
9bc: 68 c0 ab 00 00 push $0xabc0
9c1: e8 fc 34 00 00 call 3ec2 <unlink>
for(i = 0; i < 52; i++){
9c6: 83 c4 10 add $0x10,%esp
9c9: 80 fb 64 cmp $0x64,%bl
9cc: 75 e2 jne 9b0 <createtest+0x70>
printf(stdout, "many creates, followed by unlink; ok\n");
9ce: 83 ec 08 sub $0x8,%esp
9d1: 68 10 54 00 00 push $0x5410
9d6: ff 35 e8 63 00 00 pushl 0x63e8
9dc: e8 ff 35 00 00 call 3fe0 <printf>
}
9e1: 83 c4 10 add $0x10,%esp
9e4: 8b 5d fc mov -0x4(%ebp),%ebx
9e7: c9 leave
9e8: c3 ret
9e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000009f0 <dirtest>:
{
9f0: 55 push %ebp
9f1: 89 e5 mov %esp,%ebp
9f3: 83 ec 10 sub $0x10,%esp
printf(stdout, "mkdir test\n");
9f6: 68 fc 45 00 00 push $0x45fc
9fb: ff 35 e8 63 00 00 pushl 0x63e8
a01: e8 da 35 00 00 call 3fe0 <printf>
if(mkdir("dir0") < 0){
a06: c7 04 24 08 46 00 00 movl $0x4608,(%esp)
a0d: e8 c8 34 00 00 call 3eda <mkdir>
a12: 83 c4 10 add $0x10,%esp
a15: 85 c0 test %eax,%eax
a17: 78 58 js a71 <dirtest+0x81>
if(chdir("dir0") < 0){
a19: 83 ec 0c sub $0xc,%esp
a1c: 68 08 46 00 00 push $0x4608
a21: e8 bc 34 00 00 call 3ee2 <chdir>
a26: 83 c4 10 add $0x10,%esp
a29: 85 c0 test %eax,%eax
a2b: 0f 88 9a 00 00 00 js acb <dirtest+0xdb>
if(chdir("..") < 0){
a31: 83 ec 0c sub $0xc,%esp
a34: 68 ad 4b 00 00 push $0x4bad
a39: e8 a4 34 00 00 call 3ee2 <chdir>
a3e: 83 c4 10 add $0x10,%esp
a41: 85 c0 test %eax,%eax
a43: 78 68 js aad <dirtest+0xbd>
if(unlink("dir0") < 0){
a45: 83 ec 0c sub $0xc,%esp
a48: 68 08 46 00 00 push $0x4608
a4d: e8 70 34 00 00 call 3ec2 <unlink>
a52: 83 c4 10 add $0x10,%esp
a55: 85 c0 test %eax,%eax
a57: 78 36 js a8f <dirtest+0x9f>
printf(stdout, "mkdir test ok\n");
a59: 83 ec 08 sub $0x8,%esp
a5c: 68 45 46 00 00 push $0x4645
a61: ff 35 e8 63 00 00 pushl 0x63e8
a67: e8 74 35 00 00 call 3fe0 <printf>
}
a6c: 83 c4 10 add $0x10,%esp
a6f: c9 leave
a70: c3 ret
printf(stdout, "mkdir failed\n");
a71: 50 push %eax
a72: 50 push %eax
a73: 68 38 43 00 00 push $0x4338
a78: ff 35 e8 63 00 00 pushl 0x63e8
a7e: e8 5d 35 00 00 call 3fe0 <printf>
exit(0);
a83: c7 04 24 00 00 00 00 movl $0x0,(%esp)
a8a: e8 e3 33 00 00 call 3e72 <exit>
printf(stdout, "unlink dir0 failed\n");
a8f: 50 push %eax
a90: 50 push %eax
a91: 68 31 46 00 00 push $0x4631
a96: ff 35 e8 63 00 00 pushl 0x63e8
a9c: e8 3f 35 00 00 call 3fe0 <printf>
exit(0);
aa1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
aa8: e8 c5 33 00 00 call 3e72 <exit>
printf(stdout, "chdir .. failed\n");
aad: 52 push %edx
aae: 52 push %edx
aaf: 68 20 46 00 00 push $0x4620
ab4: ff 35 e8 63 00 00 pushl 0x63e8
aba: e8 21 35 00 00 call 3fe0 <printf>
exit(0);
abf: c7 04 24 00 00 00 00 movl $0x0,(%esp)
ac6: e8 a7 33 00 00 call 3e72 <exit>
printf(stdout, "chdir dir0 failed\n");
acb: 51 push %ecx
acc: 51 push %ecx
acd: 68 0d 46 00 00 push $0x460d
ad2: ff 35 e8 63 00 00 pushl 0x63e8
ad8: e8 03 35 00 00 call 3fe0 <printf>
exit(0);
add: c7 04 24 00 00 00 00 movl $0x0,(%esp)
ae4: e8 89 33 00 00 call 3e72 <exit>
ae9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000af0 <exectest>:
{
af0: 55 push %ebp
af1: 89 e5 mov %esp,%ebp
af3: 83 ec 10 sub $0x10,%esp
printf(stdout, "exec test\n");
af6: 68 54 46 00 00 push $0x4654
afb: ff 35 e8 63 00 00 pushl 0x63e8
b01: e8 da 34 00 00 call 3fe0 <printf>
if(exec("echo", echoargv) < 0){
b06: 5a pop %edx
b07: 59 pop %ecx
b08: 68 ec 63 00 00 push $0x63ec
b0d: 68 1d 44 00 00 push $0x441d
b12: e8 93 33 00 00 call 3eaa <exec>
b17: 83 c4 10 add $0x10,%esp
b1a: 85 c0 test %eax,%eax
b1c: 78 02 js b20 <exectest+0x30>
}
b1e: c9 leave
b1f: c3 ret
printf(stdout, "exec echo failed\n");
b20: 50 push %eax
b21: 50 push %eax
b22: 68 5f 46 00 00 push $0x465f
b27: ff 35 e8 63 00 00 pushl 0x63e8
b2d: e8 ae 34 00 00 call 3fe0 <printf>
exit(0);
b32: c7 04 24 00 00 00 00 movl $0x0,(%esp)
b39: e8 34 33 00 00 call 3e72 <exit>
b3e: 66 90 xchg %ax,%ax
00000b40 <pipe1>:
{
b40: 55 push %ebp
b41: 89 e5 mov %esp,%ebp
b43: 57 push %edi
b44: 56 push %esi
b45: 53 push %ebx
if(pipe(fds) != 0){
b46: 8d 45 e0 lea -0x20(%ebp),%eax
{
b49: 83 ec 38 sub $0x38,%esp
if(pipe(fds) != 0){
b4c: 50 push %eax
b4d: e8 30 33 00 00 call 3e82 <pipe>
b52: 83 c4 10 add $0x10,%esp
b55: 85 c0 test %eax,%eax
b57: 0f 85 51 01 00 00 jne cae <pipe1+0x16e>
b5d: 89 c3 mov %eax,%ebx
pid = fork();
b5f: e8 06 33 00 00 call 3e6a <fork>
if(pid == 0){
b64: 83 f8 00 cmp $0x0,%eax
b67: 0f 84 84 00 00 00 je bf1 <pipe1+0xb1>
} else if(pid > 0){
b6d: 0f 8e 55 01 00 00 jle cc8 <pipe1+0x188>
close(fds[1]);
b73: 83 ec 0c sub $0xc,%esp
b76: ff 75 e4 pushl -0x1c(%ebp)
cc = 1;
b79: bf 01 00 00 00 mov $0x1,%edi
close(fds[1]);
b7e: e8 17 33 00 00 call 3e9a <close>
while((n = read(fds[0], buf, cc)) > 0){
b83: 83 c4 10 add $0x10,%esp
total = 0;
b86: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
while((n = read(fds[0], buf, cc)) > 0){
b8d: 83 ec 04 sub $0x4,%esp
b90: 57 push %edi
b91: 68 c0 8b 00 00 push $0x8bc0
b96: ff 75 e0 pushl -0x20(%ebp)
b99: e8 ec 32 00 00 call 3e8a <read>
b9e: 83 c4 10 add $0x10,%esp
ba1: 85 c0 test %eax,%eax
ba3: 0f 8e b0 00 00 00 jle c59 <pipe1+0x119>
if((buf[i] & 0xff) != (seq++ & 0xff)){
ba9: 89 d9 mov %ebx,%ecx
bab: 8d 34 18 lea (%eax,%ebx,1),%esi
bae: f7 d9 neg %ecx
bb0: 38 9c 0b c0 8b 00 00 cmp %bl,0x8bc0(%ebx,%ecx,1)
bb7: 8d 53 01 lea 0x1(%ebx),%edx
bba: 75 1b jne bd7 <pipe1+0x97>
for(i = 0; i < n; i++){
bbc: 39 f2 cmp %esi,%edx
bbe: 89 d3 mov %edx,%ebx
bc0: 75 ee jne bb0 <pipe1+0x70>
cc = cc * 2;
bc2: 01 ff add %edi,%edi
total += n;
bc4: 01 45 d4 add %eax,-0x2c(%ebp)
bc7: b8 00 20 00 00 mov $0x2000,%eax
bcc: 81 ff 00 20 00 00 cmp $0x2000,%edi
bd2: 0f 4f f8 cmovg %eax,%edi
bd5: eb b6 jmp b8d <pipe1+0x4d>
printf(1, "pipe1 oops 2\n");
bd7: 83 ec 08 sub $0x8,%esp
bda: 68 8e 46 00 00 push $0x468e
bdf: 6a 01 push $0x1
be1: e8 fa 33 00 00 call 3fe0 <printf>
return;
be6: 83 c4 10 add $0x10,%esp
}
be9: 8d 65 f4 lea -0xc(%ebp),%esp
bec: 5b pop %ebx
bed: 5e pop %esi
bee: 5f pop %edi
bef: 5d pop %ebp
bf0: c3 ret
close(fds[0]);
bf1: 83 ec 0c sub $0xc,%esp
bf4: ff 75 e0 pushl -0x20(%ebp)
bf7: 31 db xor %ebx,%ebx
bf9: be 09 04 00 00 mov $0x409,%esi
bfe: e8 97 32 00 00 call 3e9a <close>
c03: 83 c4 10 add $0x10,%esp
c06: 89 d8 mov %ebx,%eax
c08: 89 f2 mov %esi,%edx
c0a: f7 d8 neg %eax
c0c: 29 da sub %ebx,%edx
c0e: 66 90 xchg %ax,%ax
buf[i] = seq++;
c10: 88 84 03 c0 8b 00 00 mov %al,0x8bc0(%ebx,%eax,1)
c17: 83 c0 01 add $0x1,%eax
for(i = 0; i < 1033; i++)
c1a: 39 d0 cmp %edx,%eax
c1c: 75 f2 jne c10 <pipe1+0xd0>
if(write(fds[1], buf, 1033) != 1033){
c1e: 83 ec 04 sub $0x4,%esp
c21: 68 09 04 00 00 push $0x409
c26: 68 c0 8b 00 00 push $0x8bc0
c2b: ff 75 e4 pushl -0x1c(%ebp)
c2e: e8 5f 32 00 00 call 3e92 <write>
c33: 83 c4 10 add $0x10,%esp
c36: 3d 09 04 00 00 cmp $0x409,%eax
c3b: 0f 85 a1 00 00 00 jne ce2 <pipe1+0x1a2>
c41: 81 eb 09 04 00 00 sub $0x409,%ebx
for(n = 0; n < 5; n++){
c47: 81 fb d3 eb ff ff cmp $0xffffebd3,%ebx
c4d: 75 b7 jne c06 <pipe1+0xc6>
exit(0);
c4f: 83 ec 0c sub $0xc,%esp
c52: 6a 00 push $0x0
c54: e8 19 32 00 00 call 3e72 <exit>
if(total != 5 * 1033){
c59: 81 7d d4 2d 14 00 00 cmpl $0x142d,-0x2c(%ebp)
c60: 75 30 jne c92 <pipe1+0x152>
close(fds[0]);
c62: 83 ec 0c sub $0xc,%esp
c65: ff 75 e0 pushl -0x20(%ebp)
c68: e8 2d 32 00 00 call 3e9a <close>
wait(null);
c6d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
c74: e8 01 32 00 00 call 3e7a <wait>
printf(1, "pipe1 ok\n");
c79: 5a pop %edx
c7a: 59 pop %ecx
c7b: 68 b3 46 00 00 push $0x46b3
c80: 6a 01 push $0x1
c82: e8 59 33 00 00 call 3fe0 <printf>
c87: 83 c4 10 add $0x10,%esp
}
c8a: 8d 65 f4 lea -0xc(%ebp),%esp
c8d: 5b pop %ebx
c8e: 5e pop %esi
c8f: 5f pop %edi
c90: 5d pop %ebp
c91: c3 ret
printf(1, "pipe1 oops 3 total %d\n", total);
c92: 53 push %ebx
c93: ff 75 d4 pushl -0x2c(%ebp)
c96: 68 9c 46 00 00 push $0x469c
c9b: 6a 01 push $0x1
c9d: e8 3e 33 00 00 call 3fe0 <printf>
exit(0);
ca2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
ca9: e8 c4 31 00 00 call 3e72 <exit>
printf(1, "pipe() failed\n");
cae: 57 push %edi
caf: 57 push %edi
cb0: 68 71 46 00 00 push $0x4671
cb5: 6a 01 push $0x1
cb7: e8 24 33 00 00 call 3fe0 <printf>
exit(0);
cbc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
cc3: e8 aa 31 00 00 call 3e72 <exit>
printf(1, "fork() failed\n");
cc8: 50 push %eax
cc9: 50 push %eax
cca: 68 bd 46 00 00 push $0x46bd
ccf: 6a 01 push $0x1
cd1: e8 0a 33 00 00 call 3fe0 <printf>
exit(0);
cd6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
cdd: e8 90 31 00 00 call 3e72 <exit>
printf(1, "pipe1 oops 1\n");
ce2: 56 push %esi
ce3: 56 push %esi
ce4: 68 80 46 00 00 push $0x4680
ce9: 6a 01 push $0x1
ceb: e8 f0 32 00 00 call 3fe0 <printf>
exit(0);
cf0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
cf7: e8 76 31 00 00 call 3e72 <exit>
cfc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000d00 <preempt>:
{
d00: 55 push %ebp
d01: 89 e5 mov %esp,%ebp
d03: 57 push %edi
d04: 56 push %esi
d05: 53 push %ebx
d06: 83 ec 24 sub $0x24,%esp
printf(1, "preempt: ");
d09: 68 cc 46 00 00 push $0x46cc
d0e: 6a 01 push $0x1
d10: e8 cb 32 00 00 call 3fe0 <printf>
pid1 = fork();
d15: e8 50 31 00 00 call 3e6a <fork>
if(pid1 == 0)
d1a: 83 c4 10 add $0x10,%esp
d1d: 85 c0 test %eax,%eax
d1f: 75 02 jne d23 <preempt+0x23>
d21: eb fe jmp d21 <preempt+0x21>
d23: 89 c7 mov %eax,%edi
pid2 = fork();
d25: e8 40 31 00 00 call 3e6a <fork>
if(pid2 == 0)
d2a: 85 c0 test %eax,%eax
pid2 = fork();
d2c: 89 c6 mov %eax,%esi
if(pid2 == 0)
d2e: 75 02 jne d32 <preempt+0x32>
d30: eb fe jmp d30 <preempt+0x30>
pipe(pfds);
d32: 8d 45 e0 lea -0x20(%ebp),%eax
d35: 83 ec 0c sub $0xc,%esp
d38: 50 push %eax
d39: e8 44 31 00 00 call 3e82 <pipe>
pid3 = fork();
d3e: e8 27 31 00 00 call 3e6a <fork>
if(pid3 == 0){
d43: 83 c4 10 add $0x10,%esp
d46: 85 c0 test %eax,%eax
pid3 = fork();
d48: 89 c3 mov %eax,%ebx
if(pid3 == 0){
d4a: 75 46 jne d92 <preempt+0x92>
close(pfds[0]);
d4c: 83 ec 0c sub $0xc,%esp
d4f: ff 75 e0 pushl -0x20(%ebp)
d52: e8 43 31 00 00 call 3e9a <close>
if(write(pfds[1], "x", 1) != 1)
d57: 83 c4 0c add $0xc,%esp
d5a: 6a 01 push $0x1
d5c: 68 91 4c 00 00 push $0x4c91
d61: ff 75 e4 pushl -0x1c(%ebp)
d64: e8 29 31 00 00 call 3e92 <write>
d69: 83 c4 10 add $0x10,%esp
d6c: 83 e8 01 sub $0x1,%eax
d6f: 74 11 je d82 <preempt+0x82>
printf(1, "preempt write error");
d71: 50 push %eax
d72: 50 push %eax
d73: 68 d6 46 00 00 push $0x46d6
d78: 6a 01 push $0x1
d7a: e8 61 32 00 00 call 3fe0 <printf>
d7f: 83 c4 10 add $0x10,%esp
close(pfds[1]);
d82: 83 ec 0c sub $0xc,%esp
d85: ff 75 e4 pushl -0x1c(%ebp)
d88: e8 0d 31 00 00 call 3e9a <close>
d8d: 83 c4 10 add $0x10,%esp
d90: eb fe jmp d90 <preempt+0x90>
close(pfds[1]);
d92: 83 ec 0c sub $0xc,%esp
d95: ff 75 e4 pushl -0x1c(%ebp)
d98: e8 fd 30 00 00 call 3e9a <close>
if(read(pfds[0], buf, sizeof(buf)) != 1){
d9d: 83 c4 0c add $0xc,%esp
da0: 68 00 20 00 00 push $0x2000
da5: 68 c0 8b 00 00 push $0x8bc0
daa: ff 75 e0 pushl -0x20(%ebp)
dad: e8 d8 30 00 00 call 3e8a <read>
db2: 83 c4 10 add $0x10,%esp
db5: 83 e8 01 sub $0x1,%eax
db8: 74 19 je dd3 <preempt+0xd3>
printf(1, "preempt read error");
dba: 50 push %eax
dbb: 50 push %eax
dbc: 68 ea 46 00 00 push $0x46ea
dc1: 6a 01 push $0x1
dc3: e8 18 32 00 00 call 3fe0 <printf>
return;
dc8: 83 c4 10 add $0x10,%esp
}
dcb: 8d 65 f4 lea -0xc(%ebp),%esp
dce: 5b pop %ebx
dcf: 5e pop %esi
dd0: 5f pop %edi
dd1: 5d pop %ebp
dd2: c3 ret
close(pfds[0]);
dd3: 83 ec 0c sub $0xc,%esp
dd6: ff 75 e0 pushl -0x20(%ebp)
dd9: e8 bc 30 00 00 call 3e9a <close>
printf(1, "kill... ");
dde: 58 pop %eax
ddf: 5a pop %edx
de0: 68 fd 46 00 00 push $0x46fd
de5: 6a 01 push $0x1
de7: e8 f4 31 00 00 call 3fe0 <printf>
kill(pid1);
dec: 89 3c 24 mov %edi,(%esp)
def: e8 ae 30 00 00 call 3ea2 <kill>
kill(pid2);
df4: 89 34 24 mov %esi,(%esp)
df7: e8 a6 30 00 00 call 3ea2 <kill>
kill(pid3);
dfc: 89 1c 24 mov %ebx,(%esp)
dff: e8 9e 30 00 00 call 3ea2 <kill>
printf(1, "wait... ");
e04: 59 pop %ecx
e05: 5b pop %ebx
e06: 68 06 47 00 00 push $0x4706
e0b: 6a 01 push $0x1
e0d: e8 ce 31 00 00 call 3fe0 <printf>
wait(null);
e12: c7 04 24 00 00 00 00 movl $0x0,(%esp)
e19: e8 5c 30 00 00 call 3e7a <wait>
wait(null);
e1e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
e25: e8 50 30 00 00 call 3e7a <wait>
wait(null);
e2a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
e31: e8 44 30 00 00 call 3e7a <wait>
printf(1, "preempt ok\n");
e36: 5e pop %esi
e37: 5f pop %edi
e38: 68 0f 47 00 00 push $0x470f
e3d: 6a 01 push $0x1
e3f: e8 9c 31 00 00 call 3fe0 <printf>
e44: 83 c4 10 add $0x10,%esp
e47: eb 82 jmp dcb <preempt+0xcb>
e49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000e50 <exitwait>:
{
e50: 55 push %ebp
e51: 89 e5 mov %esp,%ebp
e53: 56 push %esi
e54: be 64 00 00 00 mov $0x64,%esi
e59: 53 push %ebx
e5a: eb 1c jmp e78 <exitwait+0x28>
e5c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(pid){
e60: 74 77 je ed9 <exitwait+0x89>
if(wait(null) != pid){
e62: 83 ec 0c sub $0xc,%esp
e65: 6a 00 push $0x0
e67: e8 0e 30 00 00 call 3e7a <wait>
e6c: 83 c4 10 add $0x10,%esp
e6f: 39 d8 cmp %ebx,%eax
e71: 75 2d jne ea0 <exitwait+0x50>
for(i = 0; i < 100; i++){
e73: 83 ee 01 sub $0x1,%esi
e76: 74 48 je ec0 <exitwait+0x70>
pid = fork();
e78: e8 ed 2f 00 00 call 3e6a <fork>
if(pid < 0){
e7d: 85 c0 test %eax,%eax
pid = fork();
e7f: 89 c3 mov %eax,%ebx
if(pid < 0){
e81: 79 dd jns e60 <exitwait+0x10>
printf(1, "fork failed\n");
e83: 83 ec 08 sub $0x8,%esp
e86: 68 79 52 00 00 push $0x5279
e8b: 6a 01 push $0x1
e8d: e8 4e 31 00 00 call 3fe0 <printf>
return;
e92: 83 c4 10 add $0x10,%esp
}
e95: 8d 65 f8 lea -0x8(%ebp),%esp
e98: 5b pop %ebx
e99: 5e pop %esi
e9a: 5d pop %ebp
e9b: c3 ret
e9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "wait wrong pid\n");
ea0: 83 ec 08 sub $0x8,%esp
ea3: 68 1b 47 00 00 push $0x471b
ea8: 6a 01 push $0x1
eaa: e8 31 31 00 00 call 3fe0 <printf>
return;
eaf: 83 c4 10 add $0x10,%esp
}
eb2: 8d 65 f8 lea -0x8(%ebp),%esp
eb5: 5b pop %ebx
eb6: 5e pop %esi
eb7: 5d pop %ebp
eb8: c3 ret
eb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "exitwait ok\n");
ec0: 83 ec 08 sub $0x8,%esp
ec3: 68 2b 47 00 00 push $0x472b
ec8: 6a 01 push $0x1
eca: e8 11 31 00 00 call 3fe0 <printf>
ecf: 83 c4 10 add $0x10,%esp
}
ed2: 8d 65 f8 lea -0x8(%ebp),%esp
ed5: 5b pop %ebx
ed6: 5e pop %esi
ed7: 5d pop %ebp
ed8: c3 ret
exit(0);
ed9: 83 ec 0c sub $0xc,%esp
edc: 6a 00 push $0x0
ede: e8 8f 2f 00 00 call 3e72 <exit>
ee3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
ee9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000ef0 <mem>:
{
ef0: 55 push %ebp
ef1: 89 e5 mov %esp,%ebp
ef3: 57 push %edi
ef4: 56 push %esi
ef5: 53 push %ebx
ef6: 31 db xor %ebx,%ebx
ef8: 83 ec 14 sub $0x14,%esp
printf(1, "mem test\n");
efb: 68 38 47 00 00 push $0x4738
f00: 6a 01 push $0x1
f02: e8 d9 30 00 00 call 3fe0 <printf>
ppid = getpid();
f07: e8 e6 2f 00 00 call 3ef2 <getpid>
f0c: 89 c6 mov %eax,%esi
if((pid = fork()) == 0){
f0e: e8 57 2f 00 00 call 3e6a <fork>
f13: 83 c4 10 add $0x10,%esp
f16: 85 c0 test %eax,%eax
f18: 74 0a je f24 <mem+0x34>
f1a: e9 99 00 00 00 jmp fb8 <mem+0xc8>
f1f: 90 nop
*(char**)m2 = m1;
f20: 89 18 mov %ebx,(%eax)
f22: 89 c3 mov %eax,%ebx
while((m2 = malloc(10001)) != 0){
f24: 83 ec 0c sub $0xc,%esp
f27: 68 11 27 00 00 push $0x2711
f2c: e8 0f 33 00 00 call 4240 <malloc>
f31: 83 c4 10 add $0x10,%esp
f34: 85 c0 test %eax,%eax
f36: 75 e8 jne f20 <mem+0x30>
while(m1){
f38: 85 db test %ebx,%ebx
f3a: 74 18 je f54 <mem+0x64>
f3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
m2 = *(char**)m1;
f40: 8b 3b mov (%ebx),%edi
free(m1);
f42: 83 ec 0c sub $0xc,%esp
f45: 53 push %ebx
f46: 89 fb mov %edi,%ebx
f48: e8 63 32 00 00 call 41b0 <free>
while(m1){
f4d: 83 c4 10 add $0x10,%esp
f50: 85 db test %ebx,%ebx
f52: 75 ec jne f40 <mem+0x50>
m1 = malloc(1024*20);
f54: 83 ec 0c sub $0xc,%esp
f57: 68 00 50 00 00 push $0x5000
f5c: e8 df 32 00 00 call 4240 <malloc>
if(m1 == 0){
f61: 83 c4 10 add $0x10,%esp
f64: 85 c0 test %eax,%eax
f66: 74 28 je f90 <mem+0xa0>
free(m1);
f68: 83 ec 0c sub $0xc,%esp
f6b: 50 push %eax
f6c: e8 3f 32 00 00 call 41b0 <free>
printf(1, "mem ok\n");
f71: 58 pop %eax
f72: 5a pop %edx
f73: 68 5c 47 00 00 push $0x475c
f78: 6a 01 push $0x1
f7a: e8 61 30 00 00 call 3fe0 <printf>
exit(0);
f7f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
f86: e8 e7 2e 00 00 call 3e72 <exit>
f8b: 90 nop
f8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "couldn't allocate mem?!!\n");
f90: 83 ec 08 sub $0x8,%esp
f93: 68 42 47 00 00 push $0x4742
f98: 6a 01 push $0x1
f9a: e8 41 30 00 00 call 3fe0 <printf>
kill(ppid);
f9f: 89 34 24 mov %esi,(%esp)
fa2: e8 fb 2e 00 00 call 3ea2 <kill>
exit(0);
fa7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
fae: e8 bf 2e 00 00 call 3e72 <exit>
fb3: 90 nop
fb4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
wait(null);
fb8: 83 ec 0c sub $0xc,%esp
fbb: 6a 00 push $0x0
fbd: e8 b8 2e 00 00 call 3e7a <wait>
}
fc2: 83 c4 10 add $0x10,%esp
fc5: 8d 65 f4 lea -0xc(%ebp),%esp
fc8: 5b pop %ebx
fc9: 5e pop %esi
fca: 5f pop %edi
fcb: 5d pop %ebp
fcc: c3 ret
fcd: 8d 76 00 lea 0x0(%esi),%esi
00000fd0 <sharedfd>:
{
fd0: 55 push %ebp
fd1: 89 e5 mov %esp,%ebp
fd3: 57 push %edi
fd4: 56 push %esi
fd5: 53 push %ebx
fd6: 83 ec 34 sub $0x34,%esp
printf(1, "sharedfd test\n");
fd9: 68 64 47 00 00 push $0x4764
fde: 6a 01 push $0x1
fe0: e8 fb 2f 00 00 call 3fe0 <printf>
unlink("sharedfd");
fe5: c7 04 24 73 47 00 00 movl $0x4773,(%esp)
fec: e8 d1 2e 00 00 call 3ec2 <unlink>
fd = open("sharedfd", O_CREATE|O_RDWR);
ff1: 59 pop %ecx
ff2: 5b pop %ebx
ff3: 68 02 02 00 00 push $0x202
ff8: 68 73 47 00 00 push $0x4773
ffd: e8 b0 2e 00 00 call 3eb2 <open>
if(fd < 0){
1002: 83 c4 10 add $0x10,%esp
1005: 85 c0 test %eax,%eax
1007: 0f 88 43 01 00 00 js 1150 <sharedfd+0x180>
100d: 89 c6 mov %eax,%esi
memset(buf, pid==0?'c':'p', sizeof(buf));
100f: bb e8 03 00 00 mov $0x3e8,%ebx
pid = fork();
1014: e8 51 2e 00 00 call 3e6a <fork>
memset(buf, pid==0?'c':'p', sizeof(buf));
1019: 83 f8 01 cmp $0x1,%eax
pid = fork();
101c: 89 c7 mov %eax,%edi
memset(buf, pid==0?'c':'p', sizeof(buf));
101e: 19 c0 sbb %eax,%eax
1020: 83 ec 04 sub $0x4,%esp
1023: 83 e0 f3 and $0xfffffff3,%eax
1026: 6a 0a push $0xa
1028: 83 c0 70 add $0x70,%eax
102b: 50 push %eax
102c: 8d 45 de lea -0x22(%ebp),%eax
102f: 50 push %eax
1030: e8 9b 2c 00 00 call 3cd0 <memset>
1035: 83 c4 10 add $0x10,%esp
1038: eb 0b jmp 1045 <sharedfd+0x75>
103a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(i = 0; i < 1000; i++){
1040: 83 eb 01 sub $0x1,%ebx
1043: 74 29 je 106e <sharedfd+0x9e>
if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
1045: 8d 45 de lea -0x22(%ebp),%eax
1048: 83 ec 04 sub $0x4,%esp
104b: 6a 0a push $0xa
104d: 50 push %eax
104e: 56 push %esi
104f: e8 3e 2e 00 00 call 3e92 <write>
1054: 83 c4 10 add $0x10,%esp
1057: 83 f8 0a cmp $0xa,%eax
105a: 74 e4 je 1040 <sharedfd+0x70>
printf(1, "fstests: write sharedfd failed\n");
105c: 83 ec 08 sub $0x8,%esp
105f: 68 64 54 00 00 push $0x5464
1064: 6a 01 push $0x1
1066: e8 75 2f 00 00 call 3fe0 <printf>
break;
106b: 83 c4 10 add $0x10,%esp
if(pid == 0)
106e: 85 ff test %edi,%edi
1070: 0f 84 0e 01 00 00 je 1184 <sharedfd+0x1b4>
wait(null);
1076: 83 ec 0c sub $0xc,%esp
nc = np = 0;
1079: 31 db xor %ebx,%ebx
107b: 31 ff xor %edi,%edi
wait(null);
107d: 6a 00 push $0x0
107f: e8 f6 2d 00 00 call 3e7a <wait>
close(fd);
1084: 89 34 24 mov %esi,(%esp)
1087: 8d 75 e8 lea -0x18(%ebp),%esi
108a: e8 0b 2e 00 00 call 3e9a <close>
fd = open("sharedfd", 0);
108f: 58 pop %eax
1090: 5a pop %edx
1091: 6a 00 push $0x0
1093: 68 73 47 00 00 push $0x4773
1098: e8 15 2e 00 00 call 3eb2 <open>
if(fd < 0){
109d: 83 c4 10 add $0x10,%esp
10a0: 85 c0 test %eax,%eax
fd = open("sharedfd", 0);
10a2: 89 45 d4 mov %eax,-0x2c(%ebp)
if(fd < 0){
10a5: 0f 88 bf 00 00 00 js 116a <sharedfd+0x19a>
10ab: 89 f8 mov %edi,%eax
10ad: 89 df mov %ebx,%edi
10af: 89 c3 mov %eax,%ebx
10b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
while((n = read(fd, buf, sizeof(buf))) > 0){
10b8: 8d 45 de lea -0x22(%ebp),%eax
10bb: 83 ec 04 sub $0x4,%esp
10be: 6a 0a push $0xa
10c0: 50 push %eax
10c1: ff 75 d4 pushl -0x2c(%ebp)
10c4: e8 c1 2d 00 00 call 3e8a <read>
10c9: 83 c4 10 add $0x10,%esp
10cc: 85 c0 test %eax,%eax
10ce: 7e 30 jle 1100 <sharedfd+0x130>
10d0: 8d 45 de lea -0x22(%ebp),%eax
10d3: eb 15 jmp 10ea <sharedfd+0x11a>
10d5: 8d 76 00 lea 0x0(%esi),%esi
np++;
10d8: 80 fa 70 cmp $0x70,%dl
10db: 0f 94 c2 sete %dl
10de: 0f b6 d2 movzbl %dl,%edx
10e1: 01 d7 add %edx,%edi
10e3: 83 c0 01 add $0x1,%eax
for(i = 0; i < sizeof(buf); i++){
10e6: 39 f0 cmp %esi,%eax
10e8: 74 ce je 10b8 <sharedfd+0xe8>
if(buf[i] == 'c')
10ea: 0f b6 10 movzbl (%eax),%edx
10ed: 80 fa 63 cmp $0x63,%dl
10f0: 75 e6 jne 10d8 <sharedfd+0x108>
nc++;
10f2: 83 c3 01 add $0x1,%ebx
10f5: eb ec jmp 10e3 <sharedfd+0x113>
10f7: 89 f6 mov %esi,%esi
10f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
close(fd);
1100: 83 ec 0c sub $0xc,%esp
1103: 89 d8 mov %ebx,%eax
1105: ff 75 d4 pushl -0x2c(%ebp)
1108: 89 fb mov %edi,%ebx
110a: 89 c7 mov %eax,%edi
110c: e8 89 2d 00 00 call 3e9a <close>
unlink("sharedfd");
1111: c7 04 24 73 47 00 00 movl $0x4773,(%esp)
1118: e8 a5 2d 00 00 call 3ec2 <unlink>
if(nc == 10000 && np == 10000){
111d: 83 c4 10 add $0x10,%esp
1120: 81 ff 10 27 00 00 cmp $0x2710,%edi
1126: 75 66 jne 118e <sharedfd+0x1be>
1128: 81 fb 10 27 00 00 cmp $0x2710,%ebx
112e: 75 5e jne 118e <sharedfd+0x1be>
printf(1, "sharedfd ok\n");
1130: 83 ec 08 sub $0x8,%esp
1133: 68 7c 47 00 00 push $0x477c
1138: 6a 01 push $0x1
113a: e8 a1 2e 00 00 call 3fe0 <printf>
113f: 83 c4 10 add $0x10,%esp
}
1142: 8d 65 f4 lea -0xc(%ebp),%esp
1145: 5b pop %ebx
1146: 5e pop %esi
1147: 5f pop %edi
1148: 5d pop %ebp
1149: c3 ret
114a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "fstests: cannot open sharedfd for writing");
1150: 83 ec 08 sub $0x8,%esp
1153: 68 38 54 00 00 push $0x5438
1158: 6a 01 push $0x1
115a: e8 81 2e 00 00 call 3fe0 <printf>
return;
115f: 83 c4 10 add $0x10,%esp
}
1162: 8d 65 f4 lea -0xc(%ebp),%esp
1165: 5b pop %ebx
1166: 5e pop %esi
1167: 5f pop %edi
1168: 5d pop %ebp
1169: c3 ret
printf(1, "fstests: cannot open sharedfd for reading\n");
116a: 83 ec 08 sub $0x8,%esp
116d: 68 84 54 00 00 push $0x5484
1172: 6a 01 push $0x1
1174: e8 67 2e 00 00 call 3fe0 <printf>
return;
1179: 83 c4 10 add $0x10,%esp
}
117c: 8d 65 f4 lea -0xc(%ebp),%esp
117f: 5b pop %ebx
1180: 5e pop %esi
1181: 5f pop %edi
1182: 5d pop %ebp
1183: c3 ret
exit(0);
1184: 83 ec 0c sub $0xc,%esp
1187: 6a 00 push $0x0
1189: e8 e4 2c 00 00 call 3e72 <exit>
printf(1, "sharedfd oops %d %d\n", nc, np);
118e: 53 push %ebx
118f: 57 push %edi
1190: 68 89 47 00 00 push $0x4789
1195: 6a 01 push $0x1
1197: e8 44 2e 00 00 call 3fe0 <printf>
exit(0);
119c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
11a3: e8 ca 2c 00 00 call 3e72 <exit>
11a8: 90 nop
11a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000011b0 <fourfiles>:
{
11b0: 55 push %ebp
11b1: 89 e5 mov %esp,%ebp
11b3: 57 push %edi
11b4: 56 push %esi
11b5: 53 push %ebx
printf(1, "fourfiles test\n");
11b6: be 9e 47 00 00 mov $0x479e,%esi
for(pi = 0; pi < 4; pi++){
11bb: 31 db xor %ebx,%ebx
{
11bd: 83 ec 34 sub $0x34,%esp
char *names[] = { "f0", "f1", "f2", "f3" };
11c0: c7 45 d8 9e 47 00 00 movl $0x479e,-0x28(%ebp)
11c7: c7 45 dc e7 48 00 00 movl $0x48e7,-0x24(%ebp)
printf(1, "fourfiles test\n");
11ce: 68 a4 47 00 00 push $0x47a4
11d3: 6a 01 push $0x1
char *names[] = { "f0", "f1", "f2", "f3" };
11d5: c7 45 e0 eb 48 00 00 movl $0x48eb,-0x20(%ebp)
11dc: c7 45 e4 a1 47 00 00 movl $0x47a1,-0x1c(%ebp)
printf(1, "fourfiles test\n");
11e3: e8 f8 2d 00 00 call 3fe0 <printf>
11e8: 83 c4 10 add $0x10,%esp
unlink(fname);
11eb: 83 ec 0c sub $0xc,%esp
11ee: 56 push %esi
11ef: e8 ce 2c 00 00 call 3ec2 <unlink>
pid = fork();
11f4: e8 71 2c 00 00 call 3e6a <fork>
if(pid < 0){
11f9: 83 c4 10 add $0x10,%esp
11fc: 85 c0 test %eax,%eax
11fe: 0f 88 9b 01 00 00 js 139f <fourfiles+0x1ef>
if(pid == 0){
1204: 0f 84 ff 00 00 00 je 1309 <fourfiles+0x159>
for(pi = 0; pi < 4; pi++){
120a: 83 c3 01 add $0x1,%ebx
120d: 83 fb 04 cmp $0x4,%ebx
1210: 74 06 je 1218 <fourfiles+0x68>
1212: 8b 74 9d d8 mov -0x28(%ebp,%ebx,4),%esi
1216: eb d3 jmp 11eb <fourfiles+0x3b>
wait(null);
1218: 83 ec 0c sub $0xc,%esp
for(i = 0; i < 2; i++){
121b: 31 ff xor %edi,%edi
wait(null);
121d: 6a 00 push $0x0
121f: e8 56 2c 00 00 call 3e7a <wait>
1224: c7 04 24 00 00 00 00 movl $0x0,(%esp)
122b: e8 4a 2c 00 00 call 3e7a <wait>
1230: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1237: e8 3e 2c 00 00 call 3e7a <wait>
123c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1243: e8 32 2c 00 00 call 3e7a <wait>
1248: 83 c4 10 add $0x10,%esp
124b: c7 45 d0 9e 47 00 00 movl $0x479e,-0x30(%ebp)
fd = open(fname, 0);
1252: 83 ec 08 sub $0x8,%esp
total = 0;
1255: 31 db xor %ebx,%ebx
fd = open(fname, 0);
1257: 6a 00 push $0x0
1259: ff 75 d0 pushl -0x30(%ebp)
125c: e8 51 2c 00 00 call 3eb2 <open>
while((n = read(fd, buf, sizeof(buf))) > 0){
1261: 83 c4 10 add $0x10,%esp
fd = open(fname, 0);
1264: 89 45 d4 mov %eax,-0x2c(%ebp)
1267: 89 f6 mov %esi,%esi
1269: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
while((n = read(fd, buf, sizeof(buf))) > 0){
1270: 83 ec 04 sub $0x4,%esp
1273: 68 00 20 00 00 push $0x2000
1278: 68 c0 8b 00 00 push $0x8bc0
127d: ff 75 d4 pushl -0x2c(%ebp)
1280: e8 05 2c 00 00 call 3e8a <read>
1285: 83 c4 10 add $0x10,%esp
1288: 85 c0 test %eax,%eax
128a: 7e 26 jle 12b2 <fourfiles+0x102>
for(j = 0; j < n; j++){
128c: 31 d2 xor %edx,%edx
128e: 66 90 xchg %ax,%ax
if(buf[j] != '0'+i){
1290: 0f be b2 c0 8b 00 00 movsbl 0x8bc0(%edx),%esi
1297: 83 ff 01 cmp $0x1,%edi
129a: 19 c9 sbb %ecx,%ecx
129c: 83 c1 31 add $0x31,%ecx
129f: 39 ce cmp %ecx,%esi
12a1: 0f 85 c3 00 00 00 jne 136a <fourfiles+0x1ba>
for(j = 0; j < n; j++){
12a7: 83 c2 01 add $0x1,%edx
12aa: 39 d0 cmp %edx,%eax
12ac: 75 e2 jne 1290 <fourfiles+0xe0>
total += n;
12ae: 01 c3 add %eax,%ebx
12b0: eb be jmp 1270 <fourfiles+0xc0>
close(fd);
12b2: 83 ec 0c sub $0xc,%esp
12b5: ff 75 d4 pushl -0x2c(%ebp)
12b8: e8 dd 2b 00 00 call 3e9a <close>
if(total != 12*500){
12bd: 83 c4 10 add $0x10,%esp
12c0: 81 fb 70 17 00 00 cmp $0x1770,%ebx
12c6: 0f 85 ed 00 00 00 jne 13b9 <fourfiles+0x209>
unlink(fname);
12cc: 83 ec 0c sub $0xc,%esp
12cf: ff 75 d0 pushl -0x30(%ebp)
12d2: e8 eb 2b 00 00 call 3ec2 <unlink>
for(i = 0; i < 2; i++){
12d7: 83 c4 10 add $0x10,%esp
12da: 83 ff 01 cmp $0x1,%edi
12dd: 75 1a jne 12f9 <fourfiles+0x149>
printf(1, "fourfiles ok\n");
12df: 83 ec 08 sub $0x8,%esp
12e2: 68 e2 47 00 00 push $0x47e2
12e7: 6a 01 push $0x1
12e9: e8 f2 2c 00 00 call 3fe0 <printf>
}
12ee: 83 c4 10 add $0x10,%esp
12f1: 8d 65 f4 lea -0xc(%ebp),%esp
12f4: 5b pop %ebx
12f5: 5e pop %esi
12f6: 5f pop %edi
12f7: 5d pop %ebp
12f8: c3 ret
12f9: 8b 45 dc mov -0x24(%ebp),%eax
12fc: bf 01 00 00 00 mov $0x1,%edi
1301: 89 45 d0 mov %eax,-0x30(%ebp)
1304: e9 49 ff ff ff jmp 1252 <fourfiles+0xa2>
fd = open(fname, O_CREATE | O_RDWR);
1309: 83 ec 08 sub $0x8,%esp
130c: 68 02 02 00 00 push $0x202
1311: 56 push %esi
1312: e8 9b 2b 00 00 call 3eb2 <open>
if(fd < 0){
1317: 83 c4 10 add $0x10,%esp
131a: 85 c0 test %eax,%eax
fd = open(fname, O_CREATE | O_RDWR);
131c: 89 c6 mov %eax,%esi
if(fd < 0){
131e: 78 65 js 1385 <fourfiles+0x1d5>
memset(buf, '0'+pi, 512);
1320: 83 ec 04 sub $0x4,%esp
1323: 83 c3 30 add $0x30,%ebx
1326: 68 00 02 00 00 push $0x200
132b: 53 push %ebx
132c: bb 0c 00 00 00 mov $0xc,%ebx
1331: 68 c0 8b 00 00 push $0x8bc0
1336: e8 95 29 00 00 call 3cd0 <memset>
133b: 83 c4 10 add $0x10,%esp
if((n = write(fd, buf, 500)) != 500){
133e: 83 ec 04 sub $0x4,%esp
1341: 68 f4 01 00 00 push $0x1f4
1346: 68 c0 8b 00 00 push $0x8bc0
134b: 56 push %esi
134c: e8 41 2b 00 00 call 3e92 <write>
1351: 83 c4 10 add $0x10,%esp
1354: 3d f4 01 00 00 cmp $0x1f4,%eax
1359: 75 78 jne 13d3 <fourfiles+0x223>
for(i = 0; i < 12; i++){
135b: 83 eb 01 sub $0x1,%ebx
135e: 75 de jne 133e <fourfiles+0x18e>
exit(0);
1360: 83 ec 0c sub $0xc,%esp
1363: 6a 00 push $0x0
1365: e8 08 2b 00 00 call 3e72 <exit>
printf(1, "wrong char\n");
136a: 83 ec 08 sub $0x8,%esp
136d: 68 c5 47 00 00 push $0x47c5
1372: 6a 01 push $0x1
1374: e8 67 2c 00 00 call 3fe0 <printf>
exit(0);
1379: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1380: e8 ed 2a 00 00 call 3e72 <exit>
printf(1, "create failed\n");
1385: 51 push %ecx
1386: 51 push %ecx
1387: 68 3f 4a 00 00 push $0x4a3f
138c: 6a 01 push $0x1
138e: e8 4d 2c 00 00 call 3fe0 <printf>
exit(0);
1393: c7 04 24 00 00 00 00 movl $0x0,(%esp)
139a: e8 d3 2a 00 00 call 3e72 <exit>
printf(1, "fork failed\n");
139f: 53 push %ebx
13a0: 53 push %ebx
13a1: 68 79 52 00 00 push $0x5279
13a6: 6a 01 push $0x1
13a8: e8 33 2c 00 00 call 3fe0 <printf>
exit(0);
13ad: c7 04 24 00 00 00 00 movl $0x0,(%esp)
13b4: e8 b9 2a 00 00 call 3e72 <exit>
printf(1, "wrong length %d\n", total);
13b9: 50 push %eax
13ba: 53 push %ebx
13bb: 68 d1 47 00 00 push $0x47d1
13c0: 6a 01 push $0x1
13c2: e8 19 2c 00 00 call 3fe0 <printf>
exit(0);
13c7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
13ce: e8 9f 2a 00 00 call 3e72 <exit>
printf(1, "write failed %d\n", n);
13d3: 52 push %edx
13d4: 50 push %eax
13d5: 68 b4 47 00 00 push $0x47b4
13da: 6a 01 push $0x1
13dc: e8 ff 2b 00 00 call 3fe0 <printf>
exit(0);
13e1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
13e8: e8 85 2a 00 00 call 3e72 <exit>
13ed: 8d 76 00 lea 0x0(%esi),%esi
000013f0 <createdelete>:
{
13f0: 55 push %ebp
13f1: 89 e5 mov %esp,%ebp
13f3: 57 push %edi
13f4: 56 push %esi
13f5: 53 push %ebx
for(pi = 0; pi < 4; pi++){
13f6: 31 db xor %ebx,%ebx
{
13f8: 83 ec 44 sub $0x44,%esp
printf(1, "createdelete test\n");
13fb: 68 f0 47 00 00 push $0x47f0
1400: 6a 01 push $0x1
1402: e8 d9 2b 00 00 call 3fe0 <printf>
1407: 83 c4 10 add $0x10,%esp
pid = fork();
140a: e8 5b 2a 00 00 call 3e6a <fork>
if(pid < 0){
140f: 85 c0 test %eax,%eax
1411: 0f 88 f9 01 00 00 js 1610 <createdelete+0x220>
if(pid == 0){
1417: 0f 84 2b 01 00 00 je 1548 <createdelete+0x158>
for(pi = 0; pi < 4; pi++){
141d: 83 c3 01 add $0x1,%ebx
1420: 83 fb 04 cmp $0x4,%ebx
1423: 75 e5 jne 140a <createdelete+0x1a>
wait(null);
1425: 83 ec 0c sub $0xc,%esp
1428: 8d 7d c8 lea -0x38(%ebp),%edi
name[0] = name[1] = name[2] = 0;
142b: be ff ff ff ff mov $0xffffffff,%esi
wait(null);
1430: 6a 00 push $0x0
1432: e8 43 2a 00 00 call 3e7a <wait>
1437: c7 04 24 00 00 00 00 movl $0x0,(%esp)
143e: e8 37 2a 00 00 call 3e7a <wait>
1443: c7 04 24 00 00 00 00 movl $0x0,(%esp)
144a: e8 2b 2a 00 00 call 3e7a <wait>
144f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1456: e8 1f 2a 00 00 call 3e7a <wait>
name[0] = name[1] = name[2] = 0;
145b: c6 45 ca 00 movb $0x0,-0x36(%ebp)
145f: 83 c4 10 add $0x10,%esp
1462: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1468: 8d 46 31 lea 0x31(%esi),%eax
146b: 88 45 c7 mov %al,-0x39(%ebp)
146e: 8d 46 01 lea 0x1(%esi),%eax
1471: 83 f8 09 cmp $0x9,%eax
1474: 89 45 c0 mov %eax,-0x40(%ebp)
1477: 0f 9f c3 setg %bl
147a: 85 c0 test %eax,%eax
147c: 0f 94 c0 sete %al
147f: 09 c3 or %eax,%ebx
1481: 88 5d c6 mov %bl,-0x3a(%ebp)
name[2] = '\0';
1484: bb 70 00 00 00 mov $0x70,%ebx
name[1] = '0' + i;
1489: 0f b6 45 c7 movzbl -0x39(%ebp),%eax
fd = open(name, 0);
148d: 83 ec 08 sub $0x8,%esp
name[0] = 'p' + pi;
1490: 88 5d c8 mov %bl,-0x38(%ebp)
fd = open(name, 0);
1493: 6a 00 push $0x0
1495: 57 push %edi
name[1] = '0' + i;
1496: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, 0);
1499: e8 14 2a 00 00 call 3eb2 <open>
if((i == 0 || i >= N/2) && fd < 0){
149e: 83 c4 10 add $0x10,%esp
14a1: 80 7d c6 00 cmpb $0x0,-0x3a(%ebp)
14a5: 0f 84 85 00 00 00 je 1530 <createdelete+0x140>
14ab: 85 c0 test %eax,%eax
14ad: 0f 88 27 01 00 00 js 15da <createdelete+0x1ea>
} else if((i >= 1 && i < N/2) && fd >= 0){
14b3: 83 fe 08 cmp $0x8,%esi
14b6: 0f 86 76 01 00 00 jbe 1632 <createdelete+0x242>
close(fd);
14bc: 83 ec 0c sub $0xc,%esp
14bf: 50 push %eax
14c0: e8 d5 29 00 00 call 3e9a <close>
14c5: 83 c4 10 add $0x10,%esp
14c8: 83 c3 01 add $0x1,%ebx
for(pi = 0; pi < 4; pi++){
14cb: 80 fb 74 cmp $0x74,%bl
14ce: 75 b9 jne 1489 <createdelete+0x99>
14d0: 8b 75 c0 mov -0x40(%ebp),%esi
for(i = 0; i < N; i++){
14d3: 83 fe 13 cmp $0x13,%esi
14d6: 75 90 jne 1468 <createdelete+0x78>
14d8: be 70 00 00 00 mov $0x70,%esi
14dd: 8d 76 00 lea 0x0(%esi),%esi
14e0: 8d 46 c0 lea -0x40(%esi),%eax
name[0] = name[1] = name[2] = 0;
14e3: bb 04 00 00 00 mov $0x4,%ebx
14e8: 88 45 c7 mov %al,-0x39(%ebp)
name[0] = 'p' + i;
14eb: 89 f0 mov %esi,%eax
unlink(name);
14ed: 83 ec 0c sub $0xc,%esp
name[0] = 'p' + i;
14f0: 88 45 c8 mov %al,-0x38(%ebp)
name[1] = '0' + i;
14f3: 0f b6 45 c7 movzbl -0x39(%ebp),%eax
unlink(name);
14f7: 57 push %edi
name[1] = '0' + i;
14f8: 88 45 c9 mov %al,-0x37(%ebp)
unlink(name);
14fb: e8 c2 29 00 00 call 3ec2 <unlink>
for(pi = 0; pi < 4; pi++){
1500: 83 c4 10 add $0x10,%esp
1503: 83 eb 01 sub $0x1,%ebx
1506: 75 e3 jne 14eb <createdelete+0xfb>
1508: 83 c6 01 add $0x1,%esi
for(i = 0; i < N; i++){
150b: 89 f0 mov %esi,%eax
150d: 3c 84 cmp $0x84,%al
150f: 75 cf jne 14e0 <createdelete+0xf0>
printf(1, "createdelete ok\n");
1511: 83 ec 08 sub $0x8,%esp
1514: 68 03 48 00 00 push $0x4803
1519: 6a 01 push $0x1
151b: e8 c0 2a 00 00 call 3fe0 <printf>
}
1520: 8d 65 f4 lea -0xc(%ebp),%esp
1523: 5b pop %ebx
1524: 5e pop %esi
1525: 5f pop %edi
1526: 5d pop %ebp
1527: c3 ret
1528: 90 nop
1529: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if((i >= 1 && i < N/2) && fd >= 0){
1530: 83 fe 08 cmp $0x8,%esi
1533: 0f 86 f1 00 00 00 jbe 162a <createdelete+0x23a>
if(fd >= 0)
1539: 85 c0 test %eax,%eax
153b: 78 8b js 14c8 <createdelete+0xd8>
153d: e9 7a ff ff ff jmp 14bc <createdelete+0xcc>
1542: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
name[0] = 'p' + pi;
1548: 83 c3 70 add $0x70,%ebx
name[2] = '\0';
154b: c6 45 ca 00 movb $0x0,-0x36(%ebp)
154f: 8d 7d c8 lea -0x38(%ebp),%edi
name[0] = 'p' + pi;
1552: 88 5d c8 mov %bl,-0x38(%ebp)
name[2] = '\0';
1555: 31 db xor %ebx,%ebx
1557: eb 0f jmp 1568 <createdelete+0x178>
1559: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < N; i++){
1560: 83 fb 13 cmp $0x13,%ebx
1563: 74 6b je 15d0 <createdelete+0x1e0>
1565: 83 c3 01 add $0x1,%ebx
fd = open(name, O_CREATE | O_RDWR);
1568: 83 ec 08 sub $0x8,%esp
name[1] = '0' + i;
156b: 8d 43 30 lea 0x30(%ebx),%eax
fd = open(name, O_CREATE | O_RDWR);
156e: 68 02 02 00 00 push $0x202
1573: 57 push %edi
name[1] = '0' + i;
1574: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, O_CREATE | O_RDWR);
1577: e8 36 29 00 00 call 3eb2 <open>
if(fd < 0){
157c: 83 c4 10 add $0x10,%esp
157f: 85 c0 test %eax,%eax
1581: 78 73 js 15f6 <createdelete+0x206>
close(fd);
1583: 83 ec 0c sub $0xc,%esp
1586: 50 push %eax
1587: e8 0e 29 00 00 call 3e9a <close>
if(i > 0 && (i % 2 ) == 0){
158c: 83 c4 10 add $0x10,%esp
158f: 85 db test %ebx,%ebx
1591: 74 d2 je 1565 <createdelete+0x175>
1593: f6 c3 01 test $0x1,%bl
1596: 75 c8 jne 1560 <createdelete+0x170>
if(unlink(name) < 0){
1598: 83 ec 0c sub $0xc,%esp
name[1] = '0' + (i / 2);
159b: 89 d8 mov %ebx,%eax
159d: d1 f8 sar %eax
if(unlink(name) < 0){
159f: 57 push %edi
name[1] = '0' + (i / 2);
15a0: 83 c0 30 add $0x30,%eax
15a3: 88 45 c9 mov %al,-0x37(%ebp)
if(unlink(name) < 0){
15a6: e8 17 29 00 00 call 3ec2 <unlink>
15ab: 83 c4 10 add $0x10,%esp
15ae: 85 c0 test %eax,%eax
15b0: 79 ae jns 1560 <createdelete+0x170>
printf(1, "unlink failed\n");
15b2: 52 push %edx
15b3: 52 push %edx
15b4: 68 f1 43 00 00 push $0x43f1
15b9: 6a 01 push $0x1
15bb: e8 20 2a 00 00 call 3fe0 <printf>
exit(0);
15c0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
15c7: e8 a6 28 00 00 call 3e72 <exit>
15cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
exit(0);
15d0: 83 ec 0c sub $0xc,%esp
15d3: 6a 00 push $0x0
15d5: e8 98 28 00 00 call 3e72 <exit>
printf(1, "oops createdelete %s didn't exist\n", name);
15da: 83 ec 04 sub $0x4,%esp
15dd: 57 push %edi
15de: 68 b0 54 00 00 push $0x54b0
15e3: 6a 01 push $0x1
15e5: e8 f6 29 00 00 call 3fe0 <printf>
exit(0);
15ea: c7 04 24 00 00 00 00 movl $0x0,(%esp)
15f1: e8 7c 28 00 00 call 3e72 <exit>
printf(1, "create failed\n");
15f6: 51 push %ecx
15f7: 51 push %ecx
15f8: 68 3f 4a 00 00 push $0x4a3f
15fd: 6a 01 push $0x1
15ff: e8 dc 29 00 00 call 3fe0 <printf>
exit(0);
1604: c7 04 24 00 00 00 00 movl $0x0,(%esp)
160b: e8 62 28 00 00 call 3e72 <exit>
printf(1, "fork failed\n");
1610: 53 push %ebx
1611: 53 push %ebx
1612: 68 79 52 00 00 push $0x5279
1617: 6a 01 push $0x1
1619: e8 c2 29 00 00 call 3fe0 <printf>
exit(0);
161e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1625: e8 48 28 00 00 call 3e72 <exit>
} else if((i >= 1 && i < N/2) && fd >= 0){
162a: 85 c0 test %eax,%eax
162c: 0f 88 96 fe ff ff js 14c8 <createdelete+0xd8>
printf(1, "oops createdelete %s did exist\n", name);
1632: 50 push %eax
1633: 57 push %edi
1634: 68 d4 54 00 00 push $0x54d4
1639: 6a 01 push $0x1
163b: e8 a0 29 00 00 call 3fe0 <printf>
exit(0);
1640: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1647: e8 26 28 00 00 call 3e72 <exit>
164c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00001650 <unlinkread>:
{
1650: 55 push %ebp
1651: 89 e5 mov %esp,%ebp
1653: 56 push %esi
1654: 53 push %ebx
printf(1, "unlinkread test\n");
1655: 83 ec 08 sub $0x8,%esp
1658: 68 14 48 00 00 push $0x4814
165d: 6a 01 push $0x1
165f: e8 7c 29 00 00 call 3fe0 <printf>
fd = open("unlinkread", O_CREATE | O_RDWR);
1664: 5b pop %ebx
1665: 5e pop %esi
1666: 68 02 02 00 00 push $0x202
166b: 68 25 48 00 00 push $0x4825
1670: e8 3d 28 00 00 call 3eb2 <open>
if(fd < 0){
1675: 83 c4 10 add $0x10,%esp
1678: 85 c0 test %eax,%eax
167a: 0f 88 e6 00 00 00 js 1766 <unlinkread+0x116>
write(fd, "hello", 5);
1680: 83 ec 04 sub $0x4,%esp
1683: 89 c3 mov %eax,%ebx
1685: 6a 05 push $0x5
1687: 68 4a 48 00 00 push $0x484a
168c: 50 push %eax
168d: e8 00 28 00 00 call 3e92 <write>
close(fd);
1692: 89 1c 24 mov %ebx,(%esp)
1695: e8 00 28 00 00 call 3e9a <close>
fd = open("unlinkread", O_RDWR);
169a: 58 pop %eax
169b: 5a pop %edx
169c: 6a 02 push $0x2
169e: 68 25 48 00 00 push $0x4825
16a3: e8 0a 28 00 00 call 3eb2 <open>
if(fd < 0){
16a8: 83 c4 10 add $0x10,%esp
16ab: 85 c0 test %eax,%eax
fd = open("unlinkread", O_RDWR);
16ad: 89 c3 mov %eax,%ebx
if(fd < 0){
16af: 0f 88 33 01 00 00 js 17e8 <unlinkread+0x198>
if(unlink("unlinkread") != 0){
16b5: 83 ec 0c sub $0xc,%esp
16b8: 68 25 48 00 00 push $0x4825
16bd: e8 00 28 00 00 call 3ec2 <unlink>
16c2: 83 c4 10 add $0x10,%esp
16c5: 85 c0 test %eax,%eax
16c7: 0f 85 01 01 00 00 jne 17ce <unlinkread+0x17e>
fd1 = open("unlinkread", O_CREATE | O_RDWR);
16cd: 83 ec 08 sub $0x8,%esp
16d0: 68 02 02 00 00 push $0x202
16d5: 68 25 48 00 00 push $0x4825
16da: e8 d3 27 00 00 call 3eb2 <open>
write(fd1, "yyy", 3);
16df: 83 c4 0c add $0xc,%esp
fd1 = open("unlinkread", O_CREATE | O_RDWR);
16e2: 89 c6 mov %eax,%esi
write(fd1, "yyy", 3);
16e4: 6a 03 push $0x3
16e6: 68 82 48 00 00 push $0x4882
16eb: 50 push %eax
16ec: e8 a1 27 00 00 call 3e92 <write>
close(fd1);
16f1: 89 34 24 mov %esi,(%esp)
16f4: e8 a1 27 00 00 call 3e9a <close>
if(read(fd, buf, sizeof(buf)) != 5){
16f9: 83 c4 0c add $0xc,%esp
16fc: 68 00 20 00 00 push $0x2000
1701: 68 c0 8b 00 00 push $0x8bc0
1706: 53 push %ebx
1707: e8 7e 27 00 00 call 3e8a <read>
170c: 83 c4 10 add $0x10,%esp
170f: 83 f8 05 cmp $0x5,%eax
1712: 0f 85 9c 00 00 00 jne 17b4 <unlinkread+0x164>
if(buf[0] != 'h'){
1718: 80 3d c0 8b 00 00 68 cmpb $0x68,0x8bc0
171f: 75 79 jne 179a <unlinkread+0x14a>
if(write(fd, buf, 10) != 10){
1721: 83 ec 04 sub $0x4,%esp
1724: 6a 0a push $0xa
1726: 68 c0 8b 00 00 push $0x8bc0
172b: 53 push %ebx
172c: e8 61 27 00 00 call 3e92 <write>
1731: 83 c4 10 add $0x10,%esp
1734: 83 f8 0a cmp $0xa,%eax
1737: 75 47 jne 1780 <unlinkread+0x130>
close(fd);
1739: 83 ec 0c sub $0xc,%esp
173c: 53 push %ebx
173d: e8 58 27 00 00 call 3e9a <close>
unlink("unlinkread");
1742: c7 04 24 25 48 00 00 movl $0x4825,(%esp)
1749: e8 74 27 00 00 call 3ec2 <unlink>
printf(1, "unlinkread ok\n");
174e: 58 pop %eax
174f: 5a pop %edx
1750: 68 cd 48 00 00 push $0x48cd
1755: 6a 01 push $0x1
1757: e8 84 28 00 00 call 3fe0 <printf>
}
175c: 83 c4 10 add $0x10,%esp
175f: 8d 65 f8 lea -0x8(%ebp),%esp
1762: 5b pop %ebx
1763: 5e pop %esi
1764: 5d pop %ebp
1765: c3 ret
printf(1, "create unlinkread failed\n");
1766: 51 push %ecx
1767: 51 push %ecx
1768: 68 30 48 00 00 push $0x4830
176d: 6a 01 push $0x1
176f: e8 6c 28 00 00 call 3fe0 <printf>
exit(0);
1774: c7 04 24 00 00 00 00 movl $0x0,(%esp)
177b: e8 f2 26 00 00 call 3e72 <exit>
printf(1, "unlinkread write failed\n");
1780: 51 push %ecx
1781: 51 push %ecx
1782: 68 b4 48 00 00 push $0x48b4
1787: 6a 01 push $0x1
1789: e8 52 28 00 00 call 3fe0 <printf>
exit(0);
178e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1795: e8 d8 26 00 00 call 3e72 <exit>
printf(1, "unlinkread wrong data\n");
179a: 53 push %ebx
179b: 53 push %ebx
179c: 68 9d 48 00 00 push $0x489d
17a1: 6a 01 push $0x1
17a3: e8 38 28 00 00 call 3fe0 <printf>
exit(0);
17a8: c7 04 24 00 00 00 00 movl $0x0,(%esp)
17af: e8 be 26 00 00 call 3e72 <exit>
printf(1, "unlinkread read failed");
17b4: 56 push %esi
17b5: 56 push %esi
17b6: 68 86 48 00 00 push $0x4886
17bb: 6a 01 push $0x1
17bd: e8 1e 28 00 00 call 3fe0 <printf>
exit(0);
17c2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
17c9: e8 a4 26 00 00 call 3e72 <exit>
printf(1, "unlink unlinkread failed\n");
17ce: 50 push %eax
17cf: 50 push %eax
17d0: 68 68 48 00 00 push $0x4868
17d5: 6a 01 push $0x1
17d7: e8 04 28 00 00 call 3fe0 <printf>
exit(0);
17dc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
17e3: e8 8a 26 00 00 call 3e72 <exit>
printf(1, "open unlinkread failed\n");
17e8: 50 push %eax
17e9: 50 push %eax
17ea: 68 50 48 00 00 push $0x4850
17ef: 6a 01 push $0x1
17f1: e8 ea 27 00 00 call 3fe0 <printf>
exit(0);
17f6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
17fd: e8 70 26 00 00 call 3e72 <exit>
1802: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1809: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00001810 <linktest>:
{
1810: 55 push %ebp
1811: 89 e5 mov %esp,%ebp
1813: 53 push %ebx
1814: 83 ec 0c sub $0xc,%esp
printf(1, "linktest\n");
1817: 68 dc 48 00 00 push $0x48dc
181c: 6a 01 push $0x1
181e: e8 bd 27 00 00 call 3fe0 <printf>
unlink("lf1");
1823: c7 04 24 e6 48 00 00 movl $0x48e6,(%esp)
182a: e8 93 26 00 00 call 3ec2 <unlink>
unlink("lf2");
182f: c7 04 24 ea 48 00 00 movl $0x48ea,(%esp)
1836: e8 87 26 00 00 call 3ec2 <unlink>
fd = open("lf1", O_CREATE|O_RDWR);
183b: 58 pop %eax
183c: 5a pop %edx
183d: 68 02 02 00 00 push $0x202
1842: 68 e6 48 00 00 push $0x48e6
1847: e8 66 26 00 00 call 3eb2 <open>
if(fd < 0){
184c: 83 c4 10 add $0x10,%esp
184f: 85 c0 test %eax,%eax
1851: 0f 88 1e 01 00 00 js 1975 <linktest+0x165>
if(write(fd, "hello", 5) != 5){
1857: 83 ec 04 sub $0x4,%esp
185a: 89 c3 mov %eax,%ebx
185c: 6a 05 push $0x5
185e: 68 4a 48 00 00 push $0x484a
1863: 50 push %eax
1864: e8 29 26 00 00 call 3e92 <write>
1869: 83 c4 10 add $0x10,%esp
186c: 83 f8 05 cmp $0x5,%eax
186f: 0f 85 d0 01 00 00 jne 1a45 <linktest+0x235>
close(fd);
1875: 83 ec 0c sub $0xc,%esp
1878: 53 push %ebx
1879: e8 1c 26 00 00 call 3e9a <close>
if(link("lf1", "lf2") < 0){
187e: 5b pop %ebx
187f: 58 pop %eax
1880: 68 ea 48 00 00 push $0x48ea
1885: 68 e6 48 00 00 push $0x48e6
188a: e8 43 26 00 00 call 3ed2 <link>
188f: 83 c4 10 add $0x10,%esp
1892: 85 c0 test %eax,%eax
1894: 0f 88 91 01 00 00 js 1a2b <linktest+0x21b>
unlink("lf1");
189a: 83 ec 0c sub $0xc,%esp
189d: 68 e6 48 00 00 push $0x48e6
18a2: e8 1b 26 00 00 call 3ec2 <unlink>
if(open("lf1", 0) >= 0){
18a7: 58 pop %eax
18a8: 5a pop %edx
18a9: 6a 00 push $0x0
18ab: 68 e6 48 00 00 push $0x48e6
18b0: e8 fd 25 00 00 call 3eb2 <open>
18b5: 83 c4 10 add $0x10,%esp
18b8: 85 c0 test %eax,%eax
18ba: 0f 89 51 01 00 00 jns 1a11 <linktest+0x201>
fd = open("lf2", 0);
18c0: 83 ec 08 sub $0x8,%esp
18c3: 6a 00 push $0x0
18c5: 68 ea 48 00 00 push $0x48ea
18ca: e8 e3 25 00 00 call 3eb2 <open>
if(fd < 0){
18cf: 83 c4 10 add $0x10,%esp
18d2: 85 c0 test %eax,%eax
fd = open("lf2", 0);
18d4: 89 c3 mov %eax,%ebx
if(fd < 0){
18d6: 0f 88 1b 01 00 00 js 19f7 <linktest+0x1e7>
if(read(fd, buf, sizeof(buf)) != 5){
18dc: 83 ec 04 sub $0x4,%esp
18df: 68 00 20 00 00 push $0x2000
18e4: 68 c0 8b 00 00 push $0x8bc0
18e9: 50 push %eax
18ea: e8 9b 25 00 00 call 3e8a <read>
18ef: 83 c4 10 add $0x10,%esp
18f2: 83 f8 05 cmp $0x5,%eax
18f5: 0f 85 e2 00 00 00 jne 19dd <linktest+0x1cd>
close(fd);
18fb: 83 ec 0c sub $0xc,%esp
18fe: 53 push %ebx
18ff: e8 96 25 00 00 call 3e9a <close>
if(link("lf2", "lf2") >= 0){
1904: 58 pop %eax
1905: 5a pop %edx
1906: 68 ea 48 00 00 push $0x48ea
190b: 68 ea 48 00 00 push $0x48ea
1910: e8 bd 25 00 00 call 3ed2 <link>
1915: 83 c4 10 add $0x10,%esp
1918: 85 c0 test %eax,%eax
191a: 0f 89 a3 00 00 00 jns 19c3 <linktest+0x1b3>
unlink("lf2");
1920: 83 ec 0c sub $0xc,%esp
1923: 68 ea 48 00 00 push $0x48ea
1928: e8 95 25 00 00 call 3ec2 <unlink>
if(link("lf2", "lf1") >= 0){
192d: 59 pop %ecx
192e: 5b pop %ebx
192f: 68 e6 48 00 00 push $0x48e6
1934: 68 ea 48 00 00 push $0x48ea
1939: e8 94 25 00 00 call 3ed2 <link>
193e: 83 c4 10 add $0x10,%esp
1941: 85 c0 test %eax,%eax
1943: 79 64 jns 19a9 <linktest+0x199>
if(link(".", "lf1") >= 0){
1945: 83 ec 08 sub $0x8,%esp
1948: 68 e6 48 00 00 push $0x48e6
194d: 68 ae 4b 00 00 push $0x4bae
1952: e8 7b 25 00 00 call 3ed2 <link>
1957: 83 c4 10 add $0x10,%esp
195a: 85 c0 test %eax,%eax
195c: 79 31 jns 198f <linktest+0x17f>
printf(1, "linktest ok\n");
195e: 83 ec 08 sub $0x8,%esp
1961: 68 84 49 00 00 push $0x4984
1966: 6a 01 push $0x1
1968: e8 73 26 00 00 call 3fe0 <printf>
}
196d: 83 c4 10 add $0x10,%esp
1970: 8b 5d fc mov -0x4(%ebp),%ebx
1973: c9 leave
1974: c3 ret
printf(1, "create lf1 failed\n");
1975: 50 push %eax
1976: 50 push %eax
1977: 68 ee 48 00 00 push $0x48ee
197c: 6a 01 push $0x1
197e: e8 5d 26 00 00 call 3fe0 <printf>
exit(0);
1983: c7 04 24 00 00 00 00 movl $0x0,(%esp)
198a: e8 e3 24 00 00 call 3e72 <exit>
printf(1, "link . lf1 succeeded! oops\n");
198f: 50 push %eax
1990: 50 push %eax
1991: 68 68 49 00 00 push $0x4968
1996: 6a 01 push $0x1
1998: e8 43 26 00 00 call 3fe0 <printf>
exit(0);
199d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
19a4: e8 c9 24 00 00 call 3e72 <exit>
printf(1, "link non-existant succeeded! oops\n");
19a9: 52 push %edx
19aa: 52 push %edx
19ab: 68 1c 55 00 00 push $0x551c
19b0: 6a 01 push $0x1
19b2: e8 29 26 00 00 call 3fe0 <printf>
exit(0);
19b7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
19be: e8 af 24 00 00 call 3e72 <exit>
printf(1, "link lf2 lf2 succeeded! oops\n");
19c3: 50 push %eax
19c4: 50 push %eax
19c5: 68 4a 49 00 00 push $0x494a
19ca: 6a 01 push $0x1
19cc: e8 0f 26 00 00 call 3fe0 <printf>
exit(0);
19d1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
19d8: e8 95 24 00 00 call 3e72 <exit>
printf(1, "read lf2 failed\n");
19dd: 51 push %ecx
19de: 51 push %ecx
19df: 68 39 49 00 00 push $0x4939
19e4: 6a 01 push $0x1
19e6: e8 f5 25 00 00 call 3fe0 <printf>
exit(0);
19eb: c7 04 24 00 00 00 00 movl $0x0,(%esp)
19f2: e8 7b 24 00 00 call 3e72 <exit>
printf(1, "open lf2 failed\n");
19f7: 53 push %ebx
19f8: 53 push %ebx
19f9: 68 28 49 00 00 push $0x4928
19fe: 6a 01 push $0x1
1a00: e8 db 25 00 00 call 3fe0 <printf>
exit(0);
1a05: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1a0c: e8 61 24 00 00 call 3e72 <exit>
printf(1, "unlinked lf1 but it is still there!\n");
1a11: 50 push %eax
1a12: 50 push %eax
1a13: 68 f4 54 00 00 push $0x54f4
1a18: 6a 01 push $0x1
1a1a: e8 c1 25 00 00 call 3fe0 <printf>
exit(0);
1a1f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1a26: e8 47 24 00 00 call 3e72 <exit>
printf(1, "link lf1 lf2 failed\n");
1a2b: 51 push %ecx
1a2c: 51 push %ecx
1a2d: 68 13 49 00 00 push $0x4913
1a32: 6a 01 push $0x1
1a34: e8 a7 25 00 00 call 3fe0 <printf>
exit(0);
1a39: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1a40: e8 2d 24 00 00 call 3e72 <exit>
printf(1, "write lf1 failed\n");
1a45: 50 push %eax
1a46: 50 push %eax
1a47: 68 01 49 00 00 push $0x4901
1a4c: 6a 01 push $0x1
1a4e: e8 8d 25 00 00 call 3fe0 <printf>
exit(0);
1a53: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1a5a: e8 13 24 00 00 call 3e72 <exit>
1a5f: 90 nop
00001a60 <concreate>:
{
1a60: 55 push %ebp
1a61: 89 e5 mov %esp,%ebp
1a63: 57 push %edi
1a64: 56 push %esi
1a65: 53 push %ebx
for(i = 0; i < 40; i++){
1a66: 31 f6 xor %esi,%esi
1a68: 8d 5d ad lea -0x53(%ebp),%ebx
if(pid && (i % 3) == 1){
1a6b: bf ab aa aa aa mov $0xaaaaaaab,%edi
{
1a70: 83 ec 64 sub $0x64,%esp
printf(1, "concreate test\n");
1a73: 68 91 49 00 00 push $0x4991
1a78: 6a 01 push $0x1
1a7a: e8 61 25 00 00 call 3fe0 <printf>
file[0] = 'C';
1a7f: c6 45 ad 43 movb $0x43,-0x53(%ebp)
file[2] = '\0';
1a83: c6 45 af 00 movb $0x0,-0x51(%ebp)
1a87: 83 c4 10 add $0x10,%esp
1a8a: eb 54 jmp 1ae0 <concreate+0x80>
1a8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(pid && (i % 3) == 1){
1a90: 89 f0 mov %esi,%eax
1a92: 89 f1 mov %esi,%ecx
1a94: f7 e7 mul %edi
1a96: d1 ea shr %edx
1a98: 8d 04 52 lea (%edx,%edx,2),%eax
1a9b: 29 c1 sub %eax,%ecx
1a9d: 83 f9 01 cmp $0x1,%ecx
1aa0: 0f 84 ca 00 00 00 je 1b70 <concreate+0x110>
fd = open(file, O_CREATE | O_RDWR);
1aa6: 83 ec 08 sub $0x8,%esp
1aa9: 68 02 02 00 00 push $0x202
1aae: 53 push %ebx
1aaf: e8 fe 23 00 00 call 3eb2 <open>
if(fd < 0){
1ab4: 83 c4 10 add $0x10,%esp
1ab7: 85 c0 test %eax,%eax
1ab9: 78 6f js 1b2a <concreate+0xca>
close(fd);
1abb: 83 ec 0c sub $0xc,%esp
1abe: 50 push %eax
1abf: e8 d6 23 00 00 call 3e9a <close>
1ac4: 83 c4 10 add $0x10,%esp
wait(null);
1ac7: 83 ec 0c sub $0xc,%esp
for(i = 0; i < 40; i++){
1aca: 83 c6 01 add $0x1,%esi
wait(null);
1acd: 6a 00 push $0x0
1acf: e8 a6 23 00 00 call 3e7a <wait>
for(i = 0; i < 40; i++){
1ad4: 83 c4 10 add $0x10,%esp
1ad7: 83 fe 28 cmp $0x28,%esi
1ada: 0f 84 b0 00 00 00 je 1b90 <concreate+0x130>
unlink(file);
1ae0: 83 ec 0c sub $0xc,%esp
file[1] = '0' + i;
1ae3: 8d 46 30 lea 0x30(%esi),%eax
unlink(file);
1ae6: 53 push %ebx
file[1] = '0' + i;
1ae7: 88 45 ae mov %al,-0x52(%ebp)
unlink(file);
1aea: e8 d3 23 00 00 call 3ec2 <unlink>
pid = fork();
1aef: e8 76 23 00 00 call 3e6a <fork>
if(pid && (i % 3) == 1){
1af4: 83 c4 10 add $0x10,%esp
1af7: 85 c0 test %eax,%eax
1af9: 75 95 jne 1a90 <concreate+0x30>
} else if(pid == 0 && (i % 5) == 1){
1afb: 89 f0 mov %esi,%eax
1afd: ba cd cc cc cc mov $0xcccccccd,%edx
1b02: f7 e2 mul %edx
1b04: c1 ea 02 shr $0x2,%edx
1b07: 8d 04 92 lea (%edx,%edx,4),%eax
1b0a: 29 c6 sub %eax,%esi
1b0c: 83 fe 01 cmp $0x1,%esi
1b0f: 74 3f je 1b50 <concreate+0xf0>
fd = open(file, O_CREATE | O_RDWR);
1b11: 83 ec 08 sub $0x8,%esp
1b14: 68 02 02 00 00 push $0x202
1b19: 53 push %ebx
1b1a: e8 93 23 00 00 call 3eb2 <open>
if(fd < 0){
1b1f: 83 c4 10 add $0x10,%esp
1b22: 85 c0 test %eax,%eax
1b24: 0f 89 5c 02 00 00 jns 1d86 <concreate+0x326>
printf(1, "concreate create %s failed\n", file);
1b2a: 83 ec 04 sub $0x4,%esp
1b2d: 53 push %ebx
1b2e: 68 a4 49 00 00 push $0x49a4
1b33: 6a 01 push $0x1
1b35: e8 a6 24 00 00 call 3fe0 <printf>
exit(0);
1b3a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1b41: e8 2c 23 00 00 call 3e72 <exit>
1b46: 8d 76 00 lea 0x0(%esi),%esi
1b49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
link("C0", file);
1b50: 83 ec 08 sub $0x8,%esp
1b53: 53 push %ebx
1b54: 68 a1 49 00 00 push $0x49a1
1b59: e8 74 23 00 00 call 3ed2 <link>
1b5e: 83 c4 10 add $0x10,%esp
exit(0);
1b61: 83 ec 0c sub $0xc,%esp
1b64: 6a 00 push $0x0
1b66: e8 07 23 00 00 call 3e72 <exit>
1b6b: 90 nop
1b6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
link("C0", file);
1b70: 83 ec 08 sub $0x8,%esp
1b73: 53 push %ebx
1b74: 68 a1 49 00 00 push $0x49a1
1b79: e8 54 23 00 00 call 3ed2 <link>
1b7e: 83 c4 10 add $0x10,%esp
1b81: e9 41 ff ff ff jmp 1ac7 <concreate+0x67>
1b86: 8d 76 00 lea 0x0(%esi),%esi
1b89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
memset(fa, 0, sizeof(fa));
1b90: 8d 45 c0 lea -0x40(%ebp),%eax
1b93: 83 ec 04 sub $0x4,%esp
1b96: 6a 28 push $0x28
1b98: 6a 00 push $0x0
1b9a: 50 push %eax
1b9b: e8 30 21 00 00 call 3cd0 <memset>
fd = open(".", 0);
1ba0: 5f pop %edi
1ba1: 58 pop %eax
1ba2: 6a 00 push $0x0
1ba4: 68 ae 4b 00 00 push $0x4bae
1ba9: 8d 7d b0 lea -0x50(%ebp),%edi
1bac: e8 01 23 00 00 call 3eb2 <open>
while(read(fd, &de, sizeof(de)) > 0){
1bb1: 83 c4 10 add $0x10,%esp
fd = open(".", 0);
1bb4: 89 c6 mov %eax,%esi
n = 0;
1bb6: c7 45 a4 00 00 00 00 movl $0x0,-0x5c(%ebp)
1bbd: 8d 76 00 lea 0x0(%esi),%esi
while(read(fd, &de, sizeof(de)) > 0){
1bc0: 83 ec 04 sub $0x4,%esp
1bc3: 6a 10 push $0x10
1bc5: 57 push %edi
1bc6: 56 push %esi
1bc7: e8 be 22 00 00 call 3e8a <read>
1bcc: 83 c4 10 add $0x10,%esp
1bcf: 85 c0 test %eax,%eax
1bd1: 7e 3d jle 1c10 <concreate+0x1b0>
if(de.inum == 0)
1bd3: 66 83 7d b0 00 cmpw $0x0,-0x50(%ebp)
1bd8: 74 e6 je 1bc0 <concreate+0x160>
if(de.name[0] == 'C' && de.name[2] == '\0'){
1bda: 80 7d b2 43 cmpb $0x43,-0x4e(%ebp)
1bde: 75 e0 jne 1bc0 <concreate+0x160>
1be0: 80 7d b4 00 cmpb $0x0,-0x4c(%ebp)
1be4: 75 da jne 1bc0 <concreate+0x160>
i = de.name[1] - '0';
1be6: 0f be 45 b3 movsbl -0x4d(%ebp),%eax
1bea: 83 e8 30 sub $0x30,%eax
if(i < 0 || i >= sizeof(fa)){
1bed: 83 f8 27 cmp $0x27,%eax
1bf0: 0f 87 73 01 00 00 ja 1d69 <concreate+0x309>
if(fa[i]){
1bf6: 80 7c 05 c0 00 cmpb $0x0,-0x40(%ebp,%eax,1)
1bfb: 0f 85 4b 01 00 00 jne 1d4c <concreate+0x2ec>
fa[i] = 1;
1c01: c6 44 05 c0 01 movb $0x1,-0x40(%ebp,%eax,1)
n++;
1c06: 83 45 a4 01 addl $0x1,-0x5c(%ebp)
1c0a: eb b4 jmp 1bc0 <concreate+0x160>
1c0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
close(fd);
1c10: 83 ec 0c sub $0xc,%esp
1c13: 56 push %esi
1c14: e8 81 22 00 00 call 3e9a <close>
if(n != 40){
1c19: 83 c4 10 add $0x10,%esp
1c1c: 83 7d a4 28 cmpl $0x28,-0x5c(%ebp)
1c20: 0f 85 0c 01 00 00 jne 1d32 <concreate+0x2d2>
for(i = 0; i < 40; i++){
1c26: 31 f6 xor %esi,%esi
1c28: eb 54 jmp 1c7e <concreate+0x21e>
1c2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
((i % 3) == 1 && pid != 0)){
1c30: 85 ff test %edi,%edi
1c32: 74 05 je 1c39 <concreate+0x1d9>
1c34: 83 fa 01 cmp $0x1,%edx
1c37: 74 70 je 1ca9 <concreate+0x249>
unlink(file);
1c39: 83 ec 0c sub $0xc,%esp
1c3c: 53 push %ebx
1c3d: e8 80 22 00 00 call 3ec2 <unlink>
unlink(file);
1c42: 89 1c 24 mov %ebx,(%esp)
1c45: e8 78 22 00 00 call 3ec2 <unlink>
unlink(file);
1c4a: 89 1c 24 mov %ebx,(%esp)
1c4d: e8 70 22 00 00 call 3ec2 <unlink>
unlink(file);
1c52: 89 1c 24 mov %ebx,(%esp)
1c55: e8 68 22 00 00 call 3ec2 <unlink>
1c5a: 83 c4 10 add $0x10,%esp
if(pid == 0)
1c5d: 85 ff test %edi,%edi
1c5f: 0f 84 fc fe ff ff je 1b61 <concreate+0x101>
wait(null);
1c65: 83 ec 0c sub $0xc,%esp
for(i = 0; i < 40; i++){
1c68: 83 c6 01 add $0x1,%esi
wait(null);
1c6b: 6a 00 push $0x0
1c6d: e8 08 22 00 00 call 3e7a <wait>
for(i = 0; i < 40; i++){
1c72: 83 c4 10 add $0x10,%esp
1c75: 83 fe 28 cmp $0x28,%esi
1c78: 0f 84 82 00 00 00 je 1d00 <concreate+0x2a0>
file[1] = '0' + i;
1c7e: 8d 46 30 lea 0x30(%esi),%eax
1c81: 88 45 ae mov %al,-0x52(%ebp)
pid = fork();
1c84: e8 e1 21 00 00 call 3e6a <fork>
if(pid < 0){
1c89: 85 c0 test %eax,%eax
pid = fork();
1c8b: 89 c7 mov %eax,%edi
if(pid < 0){
1c8d: 0f 88 84 00 00 00 js 1d17 <concreate+0x2b7>
if(((i % 3) == 0 && pid == 0) ||
1c93: b8 ab aa aa aa mov $0xaaaaaaab,%eax
1c98: f7 e6 mul %esi
1c9a: d1 ea shr %edx
1c9c: 8d 04 52 lea (%edx,%edx,2),%eax
1c9f: 89 f2 mov %esi,%edx
1ca1: 29 c2 sub %eax,%edx
1ca3: 89 d0 mov %edx,%eax
1ca5: 09 f8 or %edi,%eax
1ca7: 75 87 jne 1c30 <concreate+0x1d0>
close(open(file, 0));
1ca9: 83 ec 08 sub $0x8,%esp
1cac: 6a 00 push $0x0
1cae: 53 push %ebx
1caf: e8 fe 21 00 00 call 3eb2 <open>
1cb4: 89 04 24 mov %eax,(%esp)
1cb7: e8 de 21 00 00 call 3e9a <close>
close(open(file, 0));
1cbc: 58 pop %eax
1cbd: 5a pop %edx
1cbe: 6a 00 push $0x0
1cc0: 53 push %ebx
1cc1: e8 ec 21 00 00 call 3eb2 <open>
1cc6: 89 04 24 mov %eax,(%esp)
1cc9: e8 cc 21 00 00 call 3e9a <close>
close(open(file, 0));
1cce: 59 pop %ecx
1ccf: 58 pop %eax
1cd0: 6a 00 push $0x0
1cd2: 53 push %ebx
1cd3: e8 da 21 00 00 call 3eb2 <open>
1cd8: 89 04 24 mov %eax,(%esp)
1cdb: e8 ba 21 00 00 call 3e9a <close>
close(open(file, 0));
1ce0: 58 pop %eax
1ce1: 5a pop %edx
1ce2: 6a 00 push $0x0
1ce4: 53 push %ebx
1ce5: e8 c8 21 00 00 call 3eb2 <open>
1cea: 89 04 24 mov %eax,(%esp)
1ced: e8 a8 21 00 00 call 3e9a <close>
1cf2: 83 c4 10 add $0x10,%esp
1cf5: e9 63 ff ff ff jmp 1c5d <concreate+0x1fd>
1cfa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "concreate ok\n");
1d00: 83 ec 08 sub $0x8,%esp
1d03: 68 f6 49 00 00 push $0x49f6
1d08: 6a 01 push $0x1
1d0a: e8 d1 22 00 00 call 3fe0 <printf>
}
1d0f: 8d 65 f4 lea -0xc(%ebp),%esp
1d12: 5b pop %ebx
1d13: 5e pop %esi
1d14: 5f pop %edi
1d15: 5d pop %ebp
1d16: c3 ret
printf(1, "fork failed\n");
1d17: 83 ec 08 sub $0x8,%esp
1d1a: 68 79 52 00 00 push $0x5279
1d1f: 6a 01 push $0x1
1d21: e8 ba 22 00 00 call 3fe0 <printf>
exit(0);
1d26: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1d2d: e8 40 21 00 00 call 3e72 <exit>
printf(1, "concreate not enough files in directory listing\n");
1d32: 51 push %ecx
1d33: 51 push %ecx
1d34: 68 40 55 00 00 push $0x5540
1d39: 6a 01 push $0x1
1d3b: e8 a0 22 00 00 call 3fe0 <printf>
exit(0);
1d40: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1d47: e8 26 21 00 00 call 3e72 <exit>
printf(1, "concreate duplicate file %s\n", de.name);
1d4c: 8d 45 b2 lea -0x4e(%ebp),%eax
1d4f: 53 push %ebx
1d50: 50 push %eax
1d51: 68 d9 49 00 00 push $0x49d9
1d56: 6a 01 push $0x1
1d58: e8 83 22 00 00 call 3fe0 <printf>
exit(0);
1d5d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1d64: e8 09 21 00 00 call 3e72 <exit>
printf(1, "concreate weird file %s\n", de.name);
1d69: 8d 45 b2 lea -0x4e(%ebp),%eax
1d6c: 56 push %esi
1d6d: 50 push %eax
1d6e: 68 c0 49 00 00 push $0x49c0
1d73: 6a 01 push $0x1
1d75: e8 66 22 00 00 call 3fe0 <printf>
exit(0);
1d7a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1d81: e8 ec 20 00 00 call 3e72 <exit>
close(fd);
1d86: 83 ec 0c sub $0xc,%esp
1d89: 50 push %eax
1d8a: e8 0b 21 00 00 call 3e9a <close>
1d8f: 83 c4 10 add $0x10,%esp
1d92: e9 ca fd ff ff jmp 1b61 <concreate+0x101>
1d97: 89 f6 mov %esi,%esi
1d99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00001da0 <linkunlink>:
{
1da0: 55 push %ebp
1da1: 89 e5 mov %esp,%ebp
1da3: 57 push %edi
1da4: 56 push %esi
1da5: 53 push %ebx
1da6: 83 ec 24 sub $0x24,%esp
printf(1, "linkunlink test\n");
1da9: 68 04 4a 00 00 push $0x4a04
1dae: 6a 01 push $0x1
1db0: e8 2b 22 00 00 call 3fe0 <printf>
unlink("x");
1db5: c7 04 24 91 4c 00 00 movl $0x4c91,(%esp)
1dbc: e8 01 21 00 00 call 3ec2 <unlink>
pid = fork();
1dc1: e8 a4 20 00 00 call 3e6a <fork>
if(pid < 0){
1dc6: 83 c4 10 add $0x10,%esp
1dc9: 85 c0 test %eax,%eax
pid = fork();
1dcb: 89 45 e4 mov %eax,-0x1c(%ebp)
if(pid < 0){
1dce: 0f 88 b6 00 00 00 js 1e8a <linkunlink+0xea>
unsigned int x = (pid ? 1 : 97);
1dd4: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp)
1dd8: bb 64 00 00 00 mov $0x64,%ebx
if((x % 3) == 0){
1ddd: be ab aa aa aa mov $0xaaaaaaab,%esi
unsigned int x = (pid ? 1 : 97);
1de2: 19 ff sbb %edi,%edi
1de4: 83 e7 60 and $0x60,%edi
1de7: 83 c7 01 add $0x1,%edi
1dea: eb 1e jmp 1e0a <linkunlink+0x6a>
1dec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if((x % 3) == 1){
1df0: 83 fa 01 cmp $0x1,%edx
1df3: 74 7b je 1e70 <linkunlink+0xd0>
unlink("x");
1df5: 83 ec 0c sub $0xc,%esp
1df8: 68 91 4c 00 00 push $0x4c91
1dfd: e8 c0 20 00 00 call 3ec2 <unlink>
1e02: 83 c4 10 add $0x10,%esp
for(i = 0; i < 100; i++){
1e05: 83 eb 01 sub $0x1,%ebx
1e08: 74 3d je 1e47 <linkunlink+0xa7>
x = x * 1103515245 + 12345;
1e0a: 69 cf 6d 4e c6 41 imul $0x41c64e6d,%edi,%ecx
1e10: 8d b9 39 30 00 00 lea 0x3039(%ecx),%edi
if((x % 3) == 0){
1e16: 89 f8 mov %edi,%eax
1e18: f7 e6 mul %esi
1e1a: d1 ea shr %edx
1e1c: 8d 04 52 lea (%edx,%edx,2),%eax
1e1f: 89 fa mov %edi,%edx
1e21: 29 c2 sub %eax,%edx
1e23: 75 cb jne 1df0 <linkunlink+0x50>
close(open("x", O_RDWR | O_CREATE));
1e25: 83 ec 08 sub $0x8,%esp
1e28: 68 02 02 00 00 push $0x202
1e2d: 68 91 4c 00 00 push $0x4c91
1e32: e8 7b 20 00 00 call 3eb2 <open>
1e37: 89 04 24 mov %eax,(%esp)
1e3a: e8 5b 20 00 00 call 3e9a <close>
1e3f: 83 c4 10 add $0x10,%esp
for(i = 0; i < 100; i++){
1e42: 83 eb 01 sub $0x1,%ebx
1e45: 75 c3 jne 1e0a <linkunlink+0x6a>
if(pid)
1e47: 8b 4d e4 mov -0x1c(%ebp),%ecx
1e4a: 85 c9 test %ecx,%ecx
1e4c: 74 56 je 1ea4 <linkunlink+0x104>
wait(null);
1e4e: 83 ec 0c sub $0xc,%esp
1e51: 6a 00 push $0x0
1e53: e8 22 20 00 00 call 3e7a <wait>
printf(1, "linkunlink ok\n");
1e58: 58 pop %eax
1e59: 5a pop %edx
1e5a: 68 19 4a 00 00 push $0x4a19
1e5f: 6a 01 push $0x1
1e61: e8 7a 21 00 00 call 3fe0 <printf>
}
1e66: 8d 65 f4 lea -0xc(%ebp),%esp
1e69: 5b pop %ebx
1e6a: 5e pop %esi
1e6b: 5f pop %edi
1e6c: 5d pop %ebp
1e6d: c3 ret
1e6e: 66 90 xchg %ax,%ax
link("cat", "x");
1e70: 83 ec 08 sub $0x8,%esp
1e73: 68 91 4c 00 00 push $0x4c91
1e78: 68 15 4a 00 00 push $0x4a15
1e7d: e8 50 20 00 00 call 3ed2 <link>
1e82: 83 c4 10 add $0x10,%esp
1e85: e9 7b ff ff ff jmp 1e05 <linkunlink+0x65>
printf(1, "fork failed\n");
1e8a: 53 push %ebx
1e8b: 53 push %ebx
1e8c: 68 79 52 00 00 push $0x5279
1e91: 6a 01 push $0x1
1e93: e8 48 21 00 00 call 3fe0 <printf>
exit(0);
1e98: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1e9f: e8 ce 1f 00 00 call 3e72 <exit>
exit(0);
1ea4: 83 ec 0c sub $0xc,%esp
1ea7: 6a 00 push $0x0
1ea9: e8 c4 1f 00 00 call 3e72 <exit>
1eae: 66 90 xchg %ax,%ax
00001eb0 <bigdir>:
{
1eb0: 55 push %ebp
1eb1: 89 e5 mov %esp,%ebp
1eb3: 57 push %edi
1eb4: 56 push %esi
1eb5: 53 push %ebx
1eb6: 83 ec 24 sub $0x24,%esp
printf(1, "bigdir test\n");
1eb9: 68 28 4a 00 00 push $0x4a28
1ebe: 6a 01 push $0x1
1ec0: e8 1b 21 00 00 call 3fe0 <printf>
unlink("bd");
1ec5: c7 04 24 35 4a 00 00 movl $0x4a35,(%esp)
1ecc: e8 f1 1f 00 00 call 3ec2 <unlink>
fd = open("bd", O_CREATE);
1ed1: 5a pop %edx
1ed2: 59 pop %ecx
1ed3: 68 00 02 00 00 push $0x200
1ed8: 68 35 4a 00 00 push $0x4a35
1edd: e8 d0 1f 00 00 call 3eb2 <open>
if(fd < 0){
1ee2: 83 c4 10 add $0x10,%esp
1ee5: 85 c0 test %eax,%eax
1ee7: 0f 88 ec 00 00 00 js 1fd9 <bigdir+0x129>
close(fd);
1eed: 83 ec 0c sub $0xc,%esp
1ef0: 8d 7d de lea -0x22(%ebp),%edi
for(i = 0; i < 500; i++){
1ef3: 31 f6 xor %esi,%esi
close(fd);
1ef5: 50 push %eax
1ef6: e8 9f 1f 00 00 call 3e9a <close>
1efb: 83 c4 10 add $0x10,%esp
1efe: 66 90 xchg %ax,%ax
name[1] = '0' + (i / 64);
1f00: 89 f0 mov %esi,%eax
if(link("bd", name) != 0){
1f02: 83 ec 08 sub $0x8,%esp
name[0] = 'x';
1f05: c6 45 de 78 movb $0x78,-0x22(%ebp)
name[1] = '0' + (i / 64);
1f09: c1 f8 06 sar $0x6,%eax
if(link("bd", name) != 0){
1f0c: 57 push %edi
1f0d: 68 35 4a 00 00 push $0x4a35
name[1] = '0' + (i / 64);
1f12: 83 c0 30 add $0x30,%eax
name[3] = '\0';
1f15: c6 45 e1 00 movb $0x0,-0x1f(%ebp)
name[1] = '0' + (i / 64);
1f19: 88 45 df mov %al,-0x21(%ebp)
name[2] = '0' + (i % 64);
1f1c: 89 f0 mov %esi,%eax
1f1e: 83 e0 3f and $0x3f,%eax
1f21: 83 c0 30 add $0x30,%eax
1f24: 88 45 e0 mov %al,-0x20(%ebp)
if(link("bd", name) != 0){
1f27: e8 a6 1f 00 00 call 3ed2 <link>
1f2c: 83 c4 10 add $0x10,%esp
1f2f: 85 c0 test %eax,%eax
1f31: 89 c3 mov %eax,%ebx
1f33: 75 6e jne 1fa3 <bigdir+0xf3>
for(i = 0; i < 500; i++){
1f35: 83 c6 01 add $0x1,%esi
1f38: 81 fe f4 01 00 00 cmp $0x1f4,%esi
1f3e: 75 c0 jne 1f00 <bigdir+0x50>
unlink("bd");
1f40: 83 ec 0c sub $0xc,%esp
1f43: 68 35 4a 00 00 push $0x4a35
1f48: e8 75 1f 00 00 call 3ec2 <unlink>
1f4d: 83 c4 10 add $0x10,%esp
name[1] = '0' + (i / 64);
1f50: 89 d8 mov %ebx,%eax
if(unlink(name) != 0){
1f52: 83 ec 0c sub $0xc,%esp
name[0] = 'x';
1f55: c6 45 de 78 movb $0x78,-0x22(%ebp)
name[1] = '0' + (i / 64);
1f59: c1 f8 06 sar $0x6,%eax
if(unlink(name) != 0){
1f5c: 57 push %edi
name[3] = '\0';
1f5d: c6 45 e1 00 movb $0x0,-0x1f(%ebp)
name[1] = '0' + (i / 64);
1f61: 83 c0 30 add $0x30,%eax
1f64: 88 45 df mov %al,-0x21(%ebp)
name[2] = '0' + (i % 64);
1f67: 89 d8 mov %ebx,%eax
1f69: 83 e0 3f and $0x3f,%eax
1f6c: 83 c0 30 add $0x30,%eax
1f6f: 88 45 e0 mov %al,-0x20(%ebp)
if(unlink(name) != 0){
1f72: e8 4b 1f 00 00 call 3ec2 <unlink>
1f77: 83 c4 10 add $0x10,%esp
1f7a: 85 c0 test %eax,%eax
1f7c: 75 40 jne 1fbe <bigdir+0x10e>
for(i = 0; i < 500; i++){
1f7e: 83 c3 01 add $0x1,%ebx
1f81: 81 fb f4 01 00 00 cmp $0x1f4,%ebx
1f87: 75 c7 jne 1f50 <bigdir+0xa0>
printf(1, "bigdir ok\n");
1f89: 83 ec 08 sub $0x8,%esp
1f8c: 68 77 4a 00 00 push $0x4a77
1f91: 6a 01 push $0x1
1f93: e8 48 20 00 00 call 3fe0 <printf>
}
1f98: 83 c4 10 add $0x10,%esp
1f9b: 8d 65 f4 lea -0xc(%ebp),%esp
1f9e: 5b pop %ebx
1f9f: 5e pop %esi
1fa0: 5f pop %edi
1fa1: 5d pop %ebp
1fa2: c3 ret
printf(1, "bigdir link failed\n");
1fa3: 83 ec 08 sub $0x8,%esp
1fa6: 68 4e 4a 00 00 push $0x4a4e
1fab: 6a 01 push $0x1
1fad: e8 2e 20 00 00 call 3fe0 <printf>
exit(0);
1fb2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1fb9: e8 b4 1e 00 00 call 3e72 <exit>
printf(1, "bigdir unlink failed");
1fbe: 83 ec 08 sub $0x8,%esp
1fc1: 68 62 4a 00 00 push $0x4a62
1fc6: 6a 01 push $0x1
1fc8: e8 13 20 00 00 call 3fe0 <printf>
exit(0);
1fcd: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1fd4: e8 99 1e 00 00 call 3e72 <exit>
printf(1, "bigdir create failed\n");
1fd9: 50 push %eax
1fda: 50 push %eax
1fdb: 68 38 4a 00 00 push $0x4a38
1fe0: 6a 01 push $0x1
1fe2: e8 f9 1f 00 00 call 3fe0 <printf>
exit(0);
1fe7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1fee: e8 7f 1e 00 00 call 3e72 <exit>
1ff3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1ff9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00002000 <subdir>:
{
2000: 55 push %ebp
2001: 89 e5 mov %esp,%ebp
2003: 53 push %ebx
2004: 83 ec 0c sub $0xc,%esp
printf(1, "subdir test\n");
2007: 68 82 4a 00 00 push $0x4a82
200c: 6a 01 push $0x1
200e: e8 cd 1f 00 00 call 3fe0 <printf>
unlink("ff");
2013: c7 04 24 0b 4b 00 00 movl $0x4b0b,(%esp)
201a: e8 a3 1e 00 00 call 3ec2 <unlink>
if(mkdir("dd") != 0){
201f: c7 04 24 a8 4b 00 00 movl $0x4ba8,(%esp)
2026: e8 af 1e 00 00 call 3eda <mkdir>
202b: 83 c4 10 add $0x10,%esp
202e: 85 c0 test %eax,%eax
2030: 0f 85 4d 06 00 00 jne 2683 <subdir+0x683>
fd = open("dd/ff", O_CREATE | O_RDWR);
2036: 83 ec 08 sub $0x8,%esp
2039: 68 02 02 00 00 push $0x202
203e: 68 e1 4a 00 00 push $0x4ae1
2043: e8 6a 1e 00 00 call 3eb2 <open>
if(fd < 0){
2048: 83 c4 10 add $0x10,%esp
204b: 85 c0 test %eax,%eax
fd = open("dd/ff", O_CREATE | O_RDWR);
204d: 89 c3 mov %eax,%ebx
if(fd < 0){
204f: 0f 88 14 06 00 00 js 2669 <subdir+0x669>
write(fd, "ff", 2);
2055: 83 ec 04 sub $0x4,%esp
2058: 6a 02 push $0x2
205a: 68 0b 4b 00 00 push $0x4b0b
205f: 50 push %eax
2060: e8 2d 1e 00 00 call 3e92 <write>
close(fd);
2065: 89 1c 24 mov %ebx,(%esp)
2068: e8 2d 1e 00 00 call 3e9a <close>
if(unlink("dd") >= 0){
206d: c7 04 24 a8 4b 00 00 movl $0x4ba8,(%esp)
2074: e8 49 1e 00 00 call 3ec2 <unlink>
2079: 83 c4 10 add $0x10,%esp
207c: 85 c0 test %eax,%eax
207e: 0f 89 cb 05 00 00 jns 264f <subdir+0x64f>
if(mkdir("/dd/dd") != 0){
2084: 83 ec 0c sub $0xc,%esp
2087: 68 bc 4a 00 00 push $0x4abc
208c: e8 49 1e 00 00 call 3eda <mkdir>
2091: 83 c4 10 add $0x10,%esp
2094: 85 c0 test %eax,%eax
2096: 0f 85 99 05 00 00 jne 2635 <subdir+0x635>
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
209c: 83 ec 08 sub $0x8,%esp
209f: 68 02 02 00 00 push $0x202
20a4: 68 de 4a 00 00 push $0x4ade
20a9: e8 04 1e 00 00 call 3eb2 <open>
if(fd < 0){
20ae: 83 c4 10 add $0x10,%esp
20b1: 85 c0 test %eax,%eax
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
20b3: 89 c3 mov %eax,%ebx
if(fd < 0){
20b5: 0f 88 5c 04 00 00 js 2517 <subdir+0x517>
write(fd, "FF", 2);
20bb: 83 ec 04 sub $0x4,%esp
20be: 6a 02 push $0x2
20c0: 68 ff 4a 00 00 push $0x4aff
20c5: 50 push %eax
20c6: e8 c7 1d 00 00 call 3e92 <write>
close(fd);
20cb: 89 1c 24 mov %ebx,(%esp)
20ce: e8 c7 1d 00 00 call 3e9a <close>
fd = open("dd/dd/../ff", 0);
20d3: 58 pop %eax
20d4: 5a pop %edx
20d5: 6a 00 push $0x0
20d7: 68 02 4b 00 00 push $0x4b02
20dc: e8 d1 1d 00 00 call 3eb2 <open>
if(fd < 0){
20e1: 83 c4 10 add $0x10,%esp
20e4: 85 c0 test %eax,%eax
fd = open("dd/dd/../ff", 0);
20e6: 89 c3 mov %eax,%ebx
if(fd < 0){
20e8: 0f 88 0f 04 00 00 js 24fd <subdir+0x4fd>
cc = read(fd, buf, sizeof(buf));
20ee: 83 ec 04 sub $0x4,%esp
20f1: 68 00 20 00 00 push $0x2000
20f6: 68 c0 8b 00 00 push $0x8bc0
20fb: 50 push %eax
20fc: e8 89 1d 00 00 call 3e8a <read>
if(cc != 2 || buf[0] != 'f'){
2101: 83 c4 10 add $0x10,%esp
2104: 83 f8 02 cmp $0x2,%eax
2107: 0f 85 3a 03 00 00 jne 2447 <subdir+0x447>
210d: 80 3d c0 8b 00 00 66 cmpb $0x66,0x8bc0
2114: 0f 85 2d 03 00 00 jne 2447 <subdir+0x447>
close(fd);
211a: 83 ec 0c sub $0xc,%esp
211d: 53 push %ebx
211e: e8 77 1d 00 00 call 3e9a <close>
if(link("dd/dd/ff", "dd/dd/ffff") != 0){
2123: 5b pop %ebx
2124: 58 pop %eax
2125: 68 42 4b 00 00 push $0x4b42
212a: 68 de 4a 00 00 push $0x4ade
212f: e8 9e 1d 00 00 call 3ed2 <link>
2134: 83 c4 10 add $0x10,%esp
2137: 85 c0 test %eax,%eax
2139: 0f 85 0c 04 00 00 jne 254b <subdir+0x54b>
if(unlink("dd/dd/ff") != 0){
213f: 83 ec 0c sub $0xc,%esp
2142: 68 de 4a 00 00 push $0x4ade
2147: e8 76 1d 00 00 call 3ec2 <unlink>
214c: 83 c4 10 add $0x10,%esp
214f: 85 c0 test %eax,%eax
2151: 0f 85 24 03 00 00 jne 247b <subdir+0x47b>
if(open("dd/dd/ff", O_RDONLY) >= 0){
2157: 83 ec 08 sub $0x8,%esp
215a: 6a 00 push $0x0
215c: 68 de 4a 00 00 push $0x4ade
2161: e8 4c 1d 00 00 call 3eb2 <open>
2166: 83 c4 10 add $0x10,%esp
2169: 85 c0 test %eax,%eax
216b: 0f 89 aa 04 00 00 jns 261b <subdir+0x61b>
if(chdir("dd") != 0){
2171: 83 ec 0c sub $0xc,%esp
2174: 68 a8 4b 00 00 push $0x4ba8
2179: e8 64 1d 00 00 call 3ee2 <chdir>
217e: 83 c4 10 add $0x10,%esp
2181: 85 c0 test %eax,%eax
2183: 0f 85 78 04 00 00 jne 2601 <subdir+0x601>
if(chdir("dd/../../dd") != 0){
2189: 83 ec 0c sub $0xc,%esp
218c: 68 76 4b 00 00 push $0x4b76
2191: e8 4c 1d 00 00 call 3ee2 <chdir>
2196: 83 c4 10 add $0x10,%esp
2199: 85 c0 test %eax,%eax
219b: 0f 85 c0 02 00 00 jne 2461 <subdir+0x461>
if(chdir("dd/../../../dd") != 0){
21a1: 83 ec 0c sub $0xc,%esp
21a4: 68 9c 4b 00 00 push $0x4b9c
21a9: e8 34 1d 00 00 call 3ee2 <chdir>
21ae: 83 c4 10 add $0x10,%esp
21b1: 85 c0 test %eax,%eax
21b3: 0f 85 a8 02 00 00 jne 2461 <subdir+0x461>
if(chdir("./..") != 0){
21b9: 83 ec 0c sub $0xc,%esp
21bc: 68 ab 4b 00 00 push $0x4bab
21c1: e8 1c 1d 00 00 call 3ee2 <chdir>
21c6: 83 c4 10 add $0x10,%esp
21c9: 85 c0 test %eax,%eax
21cb: 0f 85 60 03 00 00 jne 2531 <subdir+0x531>
fd = open("dd/dd/ffff", 0);
21d1: 83 ec 08 sub $0x8,%esp
21d4: 6a 00 push $0x0
21d6: 68 42 4b 00 00 push $0x4b42
21db: e8 d2 1c 00 00 call 3eb2 <open>
if(fd < 0){
21e0: 83 c4 10 add $0x10,%esp
21e3: 85 c0 test %eax,%eax
fd = open("dd/dd/ffff", 0);
21e5: 89 c3 mov %eax,%ebx
if(fd < 0){
21e7: 0f 88 ce 05 00 00 js 27bb <subdir+0x7bb>
if(read(fd, buf, sizeof(buf)) != 2){
21ed: 83 ec 04 sub $0x4,%esp
21f0: 68 00 20 00 00 push $0x2000
21f5: 68 c0 8b 00 00 push $0x8bc0
21fa: 50 push %eax
21fb: e8 8a 1c 00 00 call 3e8a <read>
2200: 83 c4 10 add $0x10,%esp
2203: 83 f8 02 cmp $0x2,%eax
2206: 0f 85 95 05 00 00 jne 27a1 <subdir+0x7a1>
close(fd);
220c: 83 ec 0c sub $0xc,%esp
220f: 53 push %ebx
2210: e8 85 1c 00 00 call 3e9a <close>
if(open("dd/dd/ff", O_RDONLY) >= 0){
2215: 59 pop %ecx
2216: 5b pop %ebx
2217: 6a 00 push $0x0
2219: 68 de 4a 00 00 push $0x4ade
221e: e8 8f 1c 00 00 call 3eb2 <open>
2223: 83 c4 10 add $0x10,%esp
2226: 85 c0 test %eax,%eax
2228: 0f 89 81 02 00 00 jns 24af <subdir+0x4af>
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
222e: 83 ec 08 sub $0x8,%esp
2231: 68 02 02 00 00 push $0x202
2236: 68 f6 4b 00 00 push $0x4bf6
223b: e8 72 1c 00 00 call 3eb2 <open>
2240: 83 c4 10 add $0x10,%esp
2243: 85 c0 test %eax,%eax
2245: 0f 89 4a 02 00 00 jns 2495 <subdir+0x495>
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
224b: 83 ec 08 sub $0x8,%esp
224e: 68 02 02 00 00 push $0x202
2253: 68 1b 4c 00 00 push $0x4c1b
2258: e8 55 1c 00 00 call 3eb2 <open>
225d: 83 c4 10 add $0x10,%esp
2260: 85 c0 test %eax,%eax
2262: 0f 89 7f 03 00 00 jns 25e7 <subdir+0x5e7>
if(open("dd", O_CREATE) >= 0){
2268: 83 ec 08 sub $0x8,%esp
226b: 68 00 02 00 00 push $0x200
2270: 68 a8 4b 00 00 push $0x4ba8
2275: e8 38 1c 00 00 call 3eb2 <open>
227a: 83 c4 10 add $0x10,%esp
227d: 85 c0 test %eax,%eax
227f: 0f 89 48 03 00 00 jns 25cd <subdir+0x5cd>
if(open("dd", O_RDWR) >= 0){
2285: 83 ec 08 sub $0x8,%esp
2288: 6a 02 push $0x2
228a: 68 a8 4b 00 00 push $0x4ba8
228f: e8 1e 1c 00 00 call 3eb2 <open>
2294: 83 c4 10 add $0x10,%esp
2297: 85 c0 test %eax,%eax
2299: 0f 89 14 03 00 00 jns 25b3 <subdir+0x5b3>
if(open("dd", O_WRONLY) >= 0){
229f: 83 ec 08 sub $0x8,%esp
22a2: 6a 01 push $0x1
22a4: 68 a8 4b 00 00 push $0x4ba8
22a9: e8 04 1c 00 00 call 3eb2 <open>
22ae: 83 c4 10 add $0x10,%esp
22b1: 85 c0 test %eax,%eax
22b3: 0f 89 e0 02 00 00 jns 2599 <subdir+0x599>
if(link("dd/ff/ff", "dd/dd/xx") == 0){
22b9: 83 ec 08 sub $0x8,%esp
22bc: 68 8a 4c 00 00 push $0x4c8a
22c1: 68 f6 4b 00 00 push $0x4bf6
22c6: e8 07 1c 00 00 call 3ed2 <link>
22cb: 83 c4 10 add $0x10,%esp
22ce: 85 c0 test %eax,%eax
22d0: 0f 84 a9 02 00 00 je 257f <subdir+0x57f>
if(link("dd/xx/ff", "dd/dd/xx") == 0){
22d6: 83 ec 08 sub $0x8,%esp
22d9: 68 8a 4c 00 00 push $0x4c8a
22de: 68 1b 4c 00 00 push $0x4c1b
22e3: e8 ea 1b 00 00 call 3ed2 <link>
22e8: 83 c4 10 add $0x10,%esp
22eb: 85 c0 test %eax,%eax
22ed: 0f 84 72 02 00 00 je 2565 <subdir+0x565>
if(link("dd/ff", "dd/dd/ffff") == 0){
22f3: 83 ec 08 sub $0x8,%esp
22f6: 68 42 4b 00 00 push $0x4b42
22fb: 68 e1 4a 00 00 push $0x4ae1
2300: e8 cd 1b 00 00 call 3ed2 <link>
2305: 83 c4 10 add $0x10,%esp
2308: 85 c0 test %eax,%eax
230a: 0f 84 d3 01 00 00 je 24e3 <subdir+0x4e3>
if(mkdir("dd/ff/ff") == 0){
2310: 83 ec 0c sub $0xc,%esp
2313: 68 f6 4b 00 00 push $0x4bf6
2318: e8 bd 1b 00 00 call 3eda <mkdir>
231d: 83 c4 10 add $0x10,%esp
2320: 85 c0 test %eax,%eax
2322: 0f 84 a1 01 00 00 je 24c9 <subdir+0x4c9>
if(mkdir("dd/xx/ff") == 0){
2328: 83 ec 0c sub $0xc,%esp
232b: 68 1b 4c 00 00 push $0x4c1b
2330: e8 a5 1b 00 00 call 3eda <mkdir>
2335: 83 c4 10 add $0x10,%esp
2338: 85 c0 test %eax,%eax
233a: 0f 84 47 04 00 00 je 2787 <subdir+0x787>
if(mkdir("dd/dd/ffff") == 0){
2340: 83 ec 0c sub $0xc,%esp
2343: 68 42 4b 00 00 push $0x4b42
2348: e8 8d 1b 00 00 call 3eda <mkdir>
234d: 83 c4 10 add $0x10,%esp
2350: 85 c0 test %eax,%eax
2352: 0f 84 15 04 00 00 je 276d <subdir+0x76d>
if(unlink("dd/xx/ff") == 0){
2358: 83 ec 0c sub $0xc,%esp
235b: 68 1b 4c 00 00 push $0x4c1b
2360: e8 5d 1b 00 00 call 3ec2 <unlink>
2365: 83 c4 10 add $0x10,%esp
2368: 85 c0 test %eax,%eax
236a: 0f 84 e3 03 00 00 je 2753 <subdir+0x753>
if(unlink("dd/ff/ff") == 0){
2370: 83 ec 0c sub $0xc,%esp
2373: 68 f6 4b 00 00 push $0x4bf6
2378: e8 45 1b 00 00 call 3ec2 <unlink>
237d: 83 c4 10 add $0x10,%esp
2380: 85 c0 test %eax,%eax
2382: 0f 84 b1 03 00 00 je 2739 <subdir+0x739>
if(chdir("dd/ff") == 0){
2388: 83 ec 0c sub $0xc,%esp
238b: 68 e1 4a 00 00 push $0x4ae1
2390: e8 4d 1b 00 00 call 3ee2 <chdir>
2395: 83 c4 10 add $0x10,%esp
2398: 85 c0 test %eax,%eax
239a: 0f 84 7f 03 00 00 je 271f <subdir+0x71f>
if(chdir("dd/xx") == 0){
23a0: 83 ec 0c sub $0xc,%esp
23a3: 68 8d 4c 00 00 push $0x4c8d
23a8: e8 35 1b 00 00 call 3ee2 <chdir>
23ad: 83 c4 10 add $0x10,%esp
23b0: 85 c0 test %eax,%eax
23b2: 0f 84 4d 03 00 00 je 2705 <subdir+0x705>
if(unlink("dd/dd/ffff") != 0){
23b8: 83 ec 0c sub $0xc,%esp
23bb: 68 42 4b 00 00 push $0x4b42
23c0: e8 fd 1a 00 00 call 3ec2 <unlink>
23c5: 83 c4 10 add $0x10,%esp
23c8: 85 c0 test %eax,%eax
23ca: 0f 85 ab 00 00 00 jne 247b <subdir+0x47b>
if(unlink("dd/ff") != 0){
23d0: 83 ec 0c sub $0xc,%esp
23d3: 68 e1 4a 00 00 push $0x4ae1
23d8: e8 e5 1a 00 00 call 3ec2 <unlink>
23dd: 83 c4 10 add $0x10,%esp
23e0: 85 c0 test %eax,%eax
23e2: 0f 85 03 03 00 00 jne 26eb <subdir+0x6eb>
if(unlink("dd") == 0){
23e8: 83 ec 0c sub $0xc,%esp
23eb: 68 a8 4b 00 00 push $0x4ba8
23f0: e8 cd 1a 00 00 call 3ec2 <unlink>
23f5: 83 c4 10 add $0x10,%esp
23f8: 85 c0 test %eax,%eax
23fa: 0f 84 d1 02 00 00 je 26d1 <subdir+0x6d1>
if(unlink("dd/dd") < 0){
2400: 83 ec 0c sub $0xc,%esp
2403: 68 bd 4a 00 00 push $0x4abd
2408: e8 b5 1a 00 00 call 3ec2 <unlink>
240d: 83 c4 10 add $0x10,%esp
2410: 85 c0 test %eax,%eax
2412: 0f 88 9f 02 00 00 js 26b7 <subdir+0x6b7>
if(unlink("dd") < 0){
2418: 83 ec 0c sub $0xc,%esp
241b: 68 a8 4b 00 00 push $0x4ba8
2420: e8 9d 1a 00 00 call 3ec2 <unlink>
2425: 83 c4 10 add $0x10,%esp
2428: 85 c0 test %eax,%eax
242a: 0f 88 6d 02 00 00 js 269d <subdir+0x69d>
printf(1, "subdir ok\n");
2430: 83 ec 08 sub $0x8,%esp
2433: 68 8a 4d 00 00 push $0x4d8a
2438: 6a 01 push $0x1
243a: e8 a1 1b 00 00 call 3fe0 <printf>
}
243f: 83 c4 10 add $0x10,%esp
2442: 8b 5d fc mov -0x4(%ebp),%ebx
2445: c9 leave
2446: c3 ret
printf(1, "dd/dd/../ff wrong content\n");
2447: 50 push %eax
2448: 50 push %eax
2449: 68 27 4b 00 00 push $0x4b27
244e: 6a 01 push $0x1
2450: e8 8b 1b 00 00 call 3fe0 <printf>
exit(0);
2455: c7 04 24 00 00 00 00 movl $0x0,(%esp)
245c: e8 11 1a 00 00 call 3e72 <exit>
printf(1, "chdir dd/../../dd failed\n");
2461: 50 push %eax
2462: 50 push %eax
2463: 68 82 4b 00 00 push $0x4b82
2468: 6a 01 push $0x1
246a: e8 71 1b 00 00 call 3fe0 <printf>
exit(0);
246f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2476: e8 f7 19 00 00 call 3e72 <exit>
printf(1, "unlink dd/dd/ff failed\n");
247b: 52 push %edx
247c: 52 push %edx
247d: 68 4d 4b 00 00 push $0x4b4d
2482: 6a 01 push $0x1
2484: e8 57 1b 00 00 call 3fe0 <printf>
exit(0);
2489: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2490: e8 dd 19 00 00 call 3e72 <exit>
printf(1, "create dd/ff/ff succeeded!\n");
2495: 50 push %eax
2496: 50 push %eax
2497: 68 ff 4b 00 00 push $0x4bff
249c: 6a 01 push $0x1
249e: e8 3d 1b 00 00 call 3fe0 <printf>
exit(0);
24a3: c7 04 24 00 00 00 00 movl $0x0,(%esp)
24aa: e8 c3 19 00 00 call 3e72 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
24af: 52 push %edx
24b0: 52 push %edx
24b1: 68 e4 55 00 00 push $0x55e4
24b6: 6a 01 push $0x1
24b8: e8 23 1b 00 00 call 3fe0 <printf>
exit(0);
24bd: c7 04 24 00 00 00 00 movl $0x0,(%esp)
24c4: e8 a9 19 00 00 call 3e72 <exit>
printf(1, "mkdir dd/ff/ff succeeded!\n");
24c9: 52 push %edx
24ca: 52 push %edx
24cb: 68 93 4c 00 00 push $0x4c93
24d0: 6a 01 push $0x1
24d2: e8 09 1b 00 00 call 3fe0 <printf>
exit(0);
24d7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
24de: e8 8f 19 00 00 call 3e72 <exit>
printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
24e3: 51 push %ecx
24e4: 51 push %ecx
24e5: 68 54 56 00 00 push $0x5654
24ea: 6a 01 push $0x1
24ec: e8 ef 1a 00 00 call 3fe0 <printf>
exit(0);
24f1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
24f8: e8 75 19 00 00 call 3e72 <exit>
printf(1, "open dd/dd/../ff failed\n");
24fd: 50 push %eax
24fe: 50 push %eax
24ff: 68 0e 4b 00 00 push $0x4b0e
2504: 6a 01 push $0x1
2506: e8 d5 1a 00 00 call 3fe0 <printf>
exit(0);
250b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2512: e8 5b 19 00 00 call 3e72 <exit>
printf(1, "create dd/dd/ff failed\n");
2517: 51 push %ecx
2518: 51 push %ecx
2519: 68 e7 4a 00 00 push $0x4ae7
251e: 6a 01 push $0x1
2520: e8 bb 1a 00 00 call 3fe0 <printf>
exit(0);
2525: c7 04 24 00 00 00 00 movl $0x0,(%esp)
252c: e8 41 19 00 00 call 3e72 <exit>
printf(1, "chdir ./.. failed\n");
2531: 50 push %eax
2532: 50 push %eax
2533: 68 b0 4b 00 00 push $0x4bb0
2538: 6a 01 push $0x1
253a: e8 a1 1a 00 00 call 3fe0 <printf>
exit(0);
253f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2546: e8 27 19 00 00 call 3e72 <exit>
printf(1, "link dd/dd/ff dd/dd/ffff failed\n");
254b: 51 push %ecx
254c: 51 push %ecx
254d: 68 9c 55 00 00 push $0x559c
2552: 6a 01 push $0x1
2554: e8 87 1a 00 00 call 3fe0 <printf>
exit(0);
2559: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2560: e8 0d 19 00 00 call 3e72 <exit>
printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
2565: 53 push %ebx
2566: 53 push %ebx
2567: 68 30 56 00 00 push $0x5630
256c: 6a 01 push $0x1
256e: e8 6d 1a 00 00 call 3fe0 <printf>
exit(0);
2573: c7 04 24 00 00 00 00 movl $0x0,(%esp)
257a: e8 f3 18 00 00 call 3e72 <exit>
printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
257f: 50 push %eax
2580: 50 push %eax
2581: 68 0c 56 00 00 push $0x560c
2586: 6a 01 push $0x1
2588: e8 53 1a 00 00 call 3fe0 <printf>
exit(0);
258d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2594: e8 d9 18 00 00 call 3e72 <exit>
printf(1, "open dd wronly succeeded!\n");
2599: 50 push %eax
259a: 50 push %eax
259b: 68 6f 4c 00 00 push $0x4c6f
25a0: 6a 01 push $0x1
25a2: e8 39 1a 00 00 call 3fe0 <printf>
exit(0);
25a7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
25ae: e8 bf 18 00 00 call 3e72 <exit>
printf(1, "open dd rdwr succeeded!\n");
25b3: 50 push %eax
25b4: 50 push %eax
25b5: 68 56 4c 00 00 push $0x4c56
25ba: 6a 01 push $0x1
25bc: e8 1f 1a 00 00 call 3fe0 <printf>
exit(0);
25c1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
25c8: e8 a5 18 00 00 call 3e72 <exit>
printf(1, "create dd succeeded!\n");
25cd: 50 push %eax
25ce: 50 push %eax
25cf: 68 40 4c 00 00 push $0x4c40
25d4: 6a 01 push $0x1
25d6: e8 05 1a 00 00 call 3fe0 <printf>
exit(0);
25db: c7 04 24 00 00 00 00 movl $0x0,(%esp)
25e2: e8 8b 18 00 00 call 3e72 <exit>
printf(1, "create dd/xx/ff succeeded!\n");
25e7: 50 push %eax
25e8: 50 push %eax
25e9: 68 24 4c 00 00 push $0x4c24
25ee: 6a 01 push $0x1
25f0: e8 eb 19 00 00 call 3fe0 <printf>
exit(0);
25f5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
25fc: e8 71 18 00 00 call 3e72 <exit>
printf(1, "chdir dd failed\n");
2601: 50 push %eax
2602: 50 push %eax
2603: 68 65 4b 00 00 push $0x4b65
2608: 6a 01 push $0x1
260a: e8 d1 19 00 00 call 3fe0 <printf>
exit(0);
260f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2616: e8 57 18 00 00 call 3e72 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded\n");
261b: 50 push %eax
261c: 50 push %eax
261d: 68 c0 55 00 00 push $0x55c0
2622: 6a 01 push $0x1
2624: e8 b7 19 00 00 call 3fe0 <printf>
exit(0);
2629: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2630: e8 3d 18 00 00 call 3e72 <exit>
printf(1, "subdir mkdir dd/dd failed\n");
2635: 53 push %ebx
2636: 53 push %ebx
2637: 68 c3 4a 00 00 push $0x4ac3
263c: 6a 01 push $0x1
263e: e8 9d 19 00 00 call 3fe0 <printf>
exit(0);
2643: c7 04 24 00 00 00 00 movl $0x0,(%esp)
264a: e8 23 18 00 00 call 3e72 <exit>
printf(1, "unlink dd (non-empty dir) succeeded!\n");
264f: 50 push %eax
2650: 50 push %eax
2651: 68 74 55 00 00 push $0x5574
2656: 6a 01 push $0x1
2658: e8 83 19 00 00 call 3fe0 <printf>
exit(0);
265d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2664: e8 09 18 00 00 call 3e72 <exit>
printf(1, "create dd/ff failed\n");
2669: 50 push %eax
266a: 50 push %eax
266b: 68 a7 4a 00 00 push $0x4aa7
2670: 6a 01 push $0x1
2672: e8 69 19 00 00 call 3fe0 <printf>
exit(0);
2677: c7 04 24 00 00 00 00 movl $0x0,(%esp)
267e: e8 ef 17 00 00 call 3e72 <exit>
printf(1, "subdir mkdir dd failed\n");
2683: 50 push %eax
2684: 50 push %eax
2685: 68 8f 4a 00 00 push $0x4a8f
268a: 6a 01 push $0x1
268c: e8 4f 19 00 00 call 3fe0 <printf>
exit(0);
2691: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2698: e8 d5 17 00 00 call 3e72 <exit>
printf(1, "unlink dd failed\n");
269d: 50 push %eax
269e: 50 push %eax
269f: 68 78 4d 00 00 push $0x4d78
26a4: 6a 01 push $0x1
26a6: e8 35 19 00 00 call 3fe0 <printf>
exit(0);
26ab: c7 04 24 00 00 00 00 movl $0x0,(%esp)
26b2: e8 bb 17 00 00 call 3e72 <exit>
printf(1, "unlink dd/dd failed\n");
26b7: 52 push %edx
26b8: 52 push %edx
26b9: 68 63 4d 00 00 push $0x4d63
26be: 6a 01 push $0x1
26c0: e8 1b 19 00 00 call 3fe0 <printf>
exit(0);
26c5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
26cc: e8 a1 17 00 00 call 3e72 <exit>
printf(1, "unlink non-empty dd succeeded!\n");
26d1: 51 push %ecx
26d2: 51 push %ecx
26d3: 68 78 56 00 00 push $0x5678
26d8: 6a 01 push $0x1
26da: e8 01 19 00 00 call 3fe0 <printf>
exit(0);
26df: c7 04 24 00 00 00 00 movl $0x0,(%esp)
26e6: e8 87 17 00 00 call 3e72 <exit>
printf(1, "unlink dd/ff failed\n");
26eb: 53 push %ebx
26ec: 53 push %ebx
26ed: 68 4e 4d 00 00 push $0x4d4e
26f2: 6a 01 push $0x1
26f4: e8 e7 18 00 00 call 3fe0 <printf>
exit(0);
26f9: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2700: e8 6d 17 00 00 call 3e72 <exit>
printf(1, "chdir dd/xx succeeded!\n");
2705: 50 push %eax
2706: 50 push %eax
2707: 68 36 4d 00 00 push $0x4d36
270c: 6a 01 push $0x1
270e: e8 cd 18 00 00 call 3fe0 <printf>
exit(0);
2713: c7 04 24 00 00 00 00 movl $0x0,(%esp)
271a: e8 53 17 00 00 call 3e72 <exit>
printf(1, "chdir dd/ff succeeded!\n");
271f: 50 push %eax
2720: 50 push %eax
2721: 68 1e 4d 00 00 push $0x4d1e
2726: 6a 01 push $0x1
2728: e8 b3 18 00 00 call 3fe0 <printf>
exit(0);
272d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2734: e8 39 17 00 00 call 3e72 <exit>
printf(1, "unlink dd/ff/ff succeeded!\n");
2739: 50 push %eax
273a: 50 push %eax
273b: 68 02 4d 00 00 push $0x4d02
2740: 6a 01 push $0x1
2742: e8 99 18 00 00 call 3fe0 <printf>
exit(0);
2747: c7 04 24 00 00 00 00 movl $0x0,(%esp)
274e: e8 1f 17 00 00 call 3e72 <exit>
printf(1, "unlink dd/xx/ff succeeded!\n");
2753: 50 push %eax
2754: 50 push %eax
2755: 68 e6 4c 00 00 push $0x4ce6
275a: 6a 01 push $0x1
275c: e8 7f 18 00 00 call 3fe0 <printf>
exit(0);
2761: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2768: e8 05 17 00 00 call 3e72 <exit>
printf(1, "mkdir dd/dd/ffff succeeded!\n");
276d: 50 push %eax
276e: 50 push %eax
276f: 68 c9 4c 00 00 push $0x4cc9
2774: 6a 01 push $0x1
2776: e8 65 18 00 00 call 3fe0 <printf>
exit(0);
277b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2782: e8 eb 16 00 00 call 3e72 <exit>
printf(1, "mkdir dd/xx/ff succeeded!\n");
2787: 50 push %eax
2788: 50 push %eax
2789: 68 ae 4c 00 00 push $0x4cae
278e: 6a 01 push $0x1
2790: e8 4b 18 00 00 call 3fe0 <printf>
exit(0);
2795: c7 04 24 00 00 00 00 movl $0x0,(%esp)
279c: e8 d1 16 00 00 call 3e72 <exit>
printf(1, "read dd/dd/ffff wrong len\n");
27a1: 50 push %eax
27a2: 50 push %eax
27a3: 68 db 4b 00 00 push $0x4bdb
27a8: 6a 01 push $0x1
27aa: e8 31 18 00 00 call 3fe0 <printf>
exit(0);
27af: c7 04 24 00 00 00 00 movl $0x0,(%esp)
27b6: e8 b7 16 00 00 call 3e72 <exit>
printf(1, "open dd/dd/ffff failed\n");
27bb: 50 push %eax
27bc: 50 push %eax
27bd: 68 c3 4b 00 00 push $0x4bc3
27c2: 6a 01 push $0x1
27c4: e8 17 18 00 00 call 3fe0 <printf>
exit(0);
27c9: c7 04 24 00 00 00 00 movl $0x0,(%esp)
27d0: e8 9d 16 00 00 call 3e72 <exit>
27d5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
27d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000027e0 <bigwrite>:
{
27e0: 55 push %ebp
27e1: 89 e5 mov %esp,%ebp
27e3: 56 push %esi
27e4: 53 push %ebx
for(sz = 499; sz < 12*512; sz += 471){
27e5: bb f3 01 00 00 mov $0x1f3,%ebx
printf(1, "bigwrite test\n");
27ea: 83 ec 08 sub $0x8,%esp
27ed: 68 95 4d 00 00 push $0x4d95
27f2: 6a 01 push $0x1
27f4: e8 e7 17 00 00 call 3fe0 <printf>
unlink("bigwrite");
27f9: c7 04 24 a4 4d 00 00 movl $0x4da4,(%esp)
2800: e8 bd 16 00 00 call 3ec2 <unlink>
2805: 83 c4 10 add $0x10,%esp
2808: 90 nop
2809: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
fd = open("bigwrite", O_CREATE | O_RDWR);
2810: 83 ec 08 sub $0x8,%esp
2813: 68 02 02 00 00 push $0x202
2818: 68 a4 4d 00 00 push $0x4da4
281d: e8 90 16 00 00 call 3eb2 <open>
if(fd < 0){
2822: 83 c4 10 add $0x10,%esp
2825: 85 c0 test %eax,%eax
fd = open("bigwrite", O_CREATE | O_RDWR);
2827: 89 c6 mov %eax,%esi
if(fd < 0){
2829: 0f 88 85 00 00 00 js 28b4 <bigwrite+0xd4>
int cc = write(fd, buf, sz);
282f: 83 ec 04 sub $0x4,%esp
2832: 53 push %ebx
2833: 68 c0 8b 00 00 push $0x8bc0
2838: 50 push %eax
2839: e8 54 16 00 00 call 3e92 <write>
if(cc != sz){
283e: 83 c4 10 add $0x10,%esp
2841: 39 d8 cmp %ebx,%eax
2843: 75 55 jne 289a <bigwrite+0xba>
int cc = write(fd, buf, sz);
2845: 83 ec 04 sub $0x4,%esp
2848: 53 push %ebx
2849: 68 c0 8b 00 00 push $0x8bc0
284e: 56 push %esi
284f: e8 3e 16 00 00 call 3e92 <write>
if(cc != sz){
2854: 83 c4 10 add $0x10,%esp
2857: 39 d8 cmp %ebx,%eax
2859: 75 3f jne 289a <bigwrite+0xba>
close(fd);
285b: 83 ec 0c sub $0xc,%esp
for(sz = 499; sz < 12*512; sz += 471){
285e: 81 c3 d7 01 00 00 add $0x1d7,%ebx
close(fd);
2864: 56 push %esi
2865: e8 30 16 00 00 call 3e9a <close>
unlink("bigwrite");
286a: c7 04 24 a4 4d 00 00 movl $0x4da4,(%esp)
2871: e8 4c 16 00 00 call 3ec2 <unlink>
for(sz = 499; sz < 12*512; sz += 471){
2876: 83 c4 10 add $0x10,%esp
2879: 81 fb 07 18 00 00 cmp $0x1807,%ebx
287f: 75 8f jne 2810 <bigwrite+0x30>
printf(1, "bigwrite ok\n");
2881: 83 ec 08 sub $0x8,%esp
2884: 68 d7 4d 00 00 push $0x4dd7
2889: 6a 01 push $0x1
288b: e8 50 17 00 00 call 3fe0 <printf>
}
2890: 83 c4 10 add $0x10,%esp
2893: 8d 65 f8 lea -0x8(%ebp),%esp
2896: 5b pop %ebx
2897: 5e pop %esi
2898: 5d pop %ebp
2899: c3 ret
printf(1, "write(%d) ret %d\n", sz, cc);
289a: 50 push %eax
289b: 53 push %ebx
289c: 68 c5 4d 00 00 push $0x4dc5
28a1: 6a 01 push $0x1
28a3: e8 38 17 00 00 call 3fe0 <printf>
exit(0);
28a8: c7 04 24 00 00 00 00 movl $0x0,(%esp)
28af: e8 be 15 00 00 call 3e72 <exit>
printf(1, "cannot create bigwrite\n");
28b4: 83 ec 08 sub $0x8,%esp
28b7: 68 ad 4d 00 00 push $0x4dad
28bc: 6a 01 push $0x1
28be: e8 1d 17 00 00 call 3fe0 <printf>
exit(0);
28c3: c7 04 24 00 00 00 00 movl $0x0,(%esp)
28ca: e8 a3 15 00 00 call 3e72 <exit>
28cf: 90 nop
000028d0 <bigfile>:
{
28d0: 55 push %ebp
28d1: 89 e5 mov %esp,%ebp
28d3: 57 push %edi
28d4: 56 push %esi
28d5: 53 push %ebx
28d6: 83 ec 14 sub $0x14,%esp
printf(1, "bigfile test\n");
28d9: 68 e4 4d 00 00 push $0x4de4
28de: 6a 01 push $0x1
28e0: e8 fb 16 00 00 call 3fe0 <printf>
unlink("bigfile");
28e5: c7 04 24 00 4e 00 00 movl $0x4e00,(%esp)
28ec: e8 d1 15 00 00 call 3ec2 <unlink>
fd = open("bigfile", O_CREATE | O_RDWR);
28f1: 58 pop %eax
28f2: 5a pop %edx
28f3: 68 02 02 00 00 push $0x202
28f8: 68 00 4e 00 00 push $0x4e00
28fd: e8 b0 15 00 00 call 3eb2 <open>
if(fd < 0){
2902: 83 c4 10 add $0x10,%esp
2905: 85 c0 test %eax,%eax
2907: 0f 88 81 01 00 00 js 2a8e <bigfile+0x1be>
290d: 89 c6 mov %eax,%esi
for(i = 0; i < 20; i++){
290f: 31 db xor %ebx,%ebx
2911: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
memset(buf, i, 600);
2918: 83 ec 04 sub $0x4,%esp
291b: 68 58 02 00 00 push $0x258
2920: 53 push %ebx
2921: 68 c0 8b 00 00 push $0x8bc0
2926: e8 a5 13 00 00 call 3cd0 <memset>
if(write(fd, buf, 600) != 600){
292b: 83 c4 0c add $0xc,%esp
292e: 68 58 02 00 00 push $0x258
2933: 68 c0 8b 00 00 push $0x8bc0
2938: 56 push %esi
2939: e8 54 15 00 00 call 3e92 <write>
293e: 83 c4 10 add $0x10,%esp
2941: 3d 58 02 00 00 cmp $0x258,%eax
2946: 0f 85 0d 01 00 00 jne 2a59 <bigfile+0x189>
for(i = 0; i < 20; i++){
294c: 83 c3 01 add $0x1,%ebx
294f: 83 fb 14 cmp $0x14,%ebx
2952: 75 c4 jne 2918 <bigfile+0x48>
close(fd);
2954: 83 ec 0c sub $0xc,%esp
2957: 56 push %esi
2958: e8 3d 15 00 00 call 3e9a <close>
fd = open("bigfile", 0);
295d: 5e pop %esi
295e: 5f pop %edi
295f: 6a 00 push $0x0
2961: 68 00 4e 00 00 push $0x4e00
2966: e8 47 15 00 00 call 3eb2 <open>
if(fd < 0){
296b: 83 c4 10 add $0x10,%esp
296e: 85 c0 test %eax,%eax
fd = open("bigfile", 0);
2970: 89 c6 mov %eax,%esi
if(fd < 0){
2972: 0f 88 fc 00 00 00 js 2a74 <bigfile+0x1a4>
total = 0;
2978: 31 db xor %ebx,%ebx
for(i = 0; ; i++){
297a: 31 ff xor %edi,%edi
297c: eb 30 jmp 29ae <bigfile+0xde>
297e: 66 90 xchg %ax,%ax
if(cc != 300){
2980: 3d 2c 01 00 00 cmp $0x12c,%eax
2985: 0f 85 98 00 00 00 jne 2a23 <bigfile+0x153>
if(buf[0] != i/2 || buf[299] != i/2){
298b: 0f be 05 c0 8b 00 00 movsbl 0x8bc0,%eax
2992: 89 fa mov %edi,%edx
2994: d1 fa sar %edx
2996: 39 d0 cmp %edx,%eax
2998: 75 6e jne 2a08 <bigfile+0x138>
299a: 0f be 15 eb 8c 00 00 movsbl 0x8ceb,%edx
29a1: 39 d0 cmp %edx,%eax
29a3: 75 63 jne 2a08 <bigfile+0x138>
total += cc;
29a5: 81 c3 2c 01 00 00 add $0x12c,%ebx
for(i = 0; ; i++){
29ab: 83 c7 01 add $0x1,%edi
cc = read(fd, buf, 300);
29ae: 83 ec 04 sub $0x4,%esp
29b1: 68 2c 01 00 00 push $0x12c
29b6: 68 c0 8b 00 00 push $0x8bc0
29bb: 56 push %esi
29bc: e8 c9 14 00 00 call 3e8a <read>
if(cc < 0){
29c1: 83 c4 10 add $0x10,%esp
29c4: 85 c0 test %eax,%eax
29c6: 78 76 js 2a3e <bigfile+0x16e>
if(cc == 0)
29c8: 75 b6 jne 2980 <bigfile+0xb0>
close(fd);
29ca: 83 ec 0c sub $0xc,%esp
29cd: 56 push %esi
29ce: e8 c7 14 00 00 call 3e9a <close>
if(total != 20*600){
29d3: 83 c4 10 add $0x10,%esp
29d6: 81 fb e0 2e 00 00 cmp $0x2ee0,%ebx
29dc: 0f 85 c6 00 00 00 jne 2aa8 <bigfile+0x1d8>
unlink("bigfile");
29e2: 83 ec 0c sub $0xc,%esp
29e5: 68 00 4e 00 00 push $0x4e00
29ea: e8 d3 14 00 00 call 3ec2 <unlink>
printf(1, "bigfile test ok\n");
29ef: 58 pop %eax
29f0: 5a pop %edx
29f1: 68 8f 4e 00 00 push $0x4e8f
29f6: 6a 01 push $0x1
29f8: e8 e3 15 00 00 call 3fe0 <printf>
}
29fd: 83 c4 10 add $0x10,%esp
2a00: 8d 65 f4 lea -0xc(%ebp),%esp
2a03: 5b pop %ebx
2a04: 5e pop %esi
2a05: 5f pop %edi
2a06: 5d pop %ebp
2a07: c3 ret
printf(1, "read bigfile wrong data\n");
2a08: 83 ec 08 sub $0x8,%esp
2a0b: 68 5c 4e 00 00 push $0x4e5c
2a10: 6a 01 push $0x1
2a12: e8 c9 15 00 00 call 3fe0 <printf>
exit(0);
2a17: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2a1e: e8 4f 14 00 00 call 3e72 <exit>
printf(1, "short read bigfile\n");
2a23: 83 ec 08 sub $0x8,%esp
2a26: 68 48 4e 00 00 push $0x4e48
2a2b: 6a 01 push $0x1
2a2d: e8 ae 15 00 00 call 3fe0 <printf>
exit(0);
2a32: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2a39: e8 34 14 00 00 call 3e72 <exit>
printf(1, "read bigfile failed\n");
2a3e: 83 ec 08 sub $0x8,%esp
2a41: 68 33 4e 00 00 push $0x4e33
2a46: 6a 01 push $0x1
2a48: e8 93 15 00 00 call 3fe0 <printf>
exit(0);
2a4d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2a54: e8 19 14 00 00 call 3e72 <exit>
printf(1, "write bigfile failed\n");
2a59: 83 ec 08 sub $0x8,%esp
2a5c: 68 08 4e 00 00 push $0x4e08
2a61: 6a 01 push $0x1
2a63: e8 78 15 00 00 call 3fe0 <printf>
exit(0);
2a68: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2a6f: e8 fe 13 00 00 call 3e72 <exit>
printf(1, "cannot open bigfile\n");
2a74: 53 push %ebx
2a75: 53 push %ebx
2a76: 68 1e 4e 00 00 push $0x4e1e
2a7b: 6a 01 push $0x1
2a7d: e8 5e 15 00 00 call 3fe0 <printf>
exit(0);
2a82: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2a89: e8 e4 13 00 00 call 3e72 <exit>
printf(1, "cannot create bigfile");
2a8e: 50 push %eax
2a8f: 50 push %eax
2a90: 68 f2 4d 00 00 push $0x4df2
2a95: 6a 01 push $0x1
2a97: e8 44 15 00 00 call 3fe0 <printf>
exit(0);
2a9c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2aa3: e8 ca 13 00 00 call 3e72 <exit>
printf(1, "read bigfile wrong total\n");
2aa8: 51 push %ecx
2aa9: 51 push %ecx
2aaa: 68 75 4e 00 00 push $0x4e75
2aaf: 6a 01 push $0x1
2ab1: e8 2a 15 00 00 call 3fe0 <printf>
exit(0);
2ab6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2abd: e8 b0 13 00 00 call 3e72 <exit>
2ac2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2ac9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00002ad0 <fourteen>:
{
2ad0: 55 push %ebp
2ad1: 89 e5 mov %esp,%ebp
2ad3: 83 ec 10 sub $0x10,%esp
printf(1, "fourteen test\n");
2ad6: 68 a0 4e 00 00 push $0x4ea0
2adb: 6a 01 push $0x1
2add: e8 fe 14 00 00 call 3fe0 <printf>
if(mkdir("12345678901234") != 0){
2ae2: c7 04 24 db 4e 00 00 movl $0x4edb,(%esp)
2ae9: e8 ec 13 00 00 call 3eda <mkdir>
2aee: 83 c4 10 add $0x10,%esp
2af1: 85 c0 test %eax,%eax
2af3: 0f 85 9b 00 00 00 jne 2b94 <fourteen+0xc4>
if(mkdir("12345678901234/123456789012345") != 0){
2af9: 83 ec 0c sub $0xc,%esp
2afc: 68 98 56 00 00 push $0x5698
2b01: e8 d4 13 00 00 call 3eda <mkdir>
2b06: 83 c4 10 add $0x10,%esp
2b09: 85 c0 test %eax,%eax
2b0b: 0f 85 05 01 00 00 jne 2c16 <fourteen+0x146>
fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
2b11: 83 ec 08 sub $0x8,%esp
2b14: 68 00 02 00 00 push $0x200
2b19: 68 e8 56 00 00 push $0x56e8
2b1e: e8 8f 13 00 00 call 3eb2 <open>
if(fd < 0){
2b23: 83 c4 10 add $0x10,%esp
2b26: 85 c0 test %eax,%eax
2b28: 0f 88 ce 00 00 00 js 2bfc <fourteen+0x12c>
close(fd);
2b2e: 83 ec 0c sub $0xc,%esp
2b31: 50 push %eax
2b32: e8 63 13 00 00 call 3e9a <close>
fd = open("12345678901234/12345678901234/12345678901234", 0);
2b37: 58 pop %eax
2b38: 5a pop %edx
2b39: 6a 00 push $0x0
2b3b: 68 58 57 00 00 push $0x5758
2b40: e8 6d 13 00 00 call 3eb2 <open>
if(fd < 0){
2b45: 83 c4 10 add $0x10,%esp
2b48: 85 c0 test %eax,%eax
2b4a: 0f 88 92 00 00 00 js 2be2 <fourteen+0x112>
close(fd);
2b50: 83 ec 0c sub $0xc,%esp
2b53: 50 push %eax
2b54: e8 41 13 00 00 call 3e9a <close>
if(mkdir("12345678901234/12345678901234") == 0){
2b59: c7 04 24 cc 4e 00 00 movl $0x4ecc,(%esp)
2b60: e8 75 13 00 00 call 3eda <mkdir>
2b65: 83 c4 10 add $0x10,%esp
2b68: 85 c0 test %eax,%eax
2b6a: 74 5c je 2bc8 <fourteen+0xf8>
if(mkdir("123456789012345/12345678901234") == 0){
2b6c: 83 ec 0c sub $0xc,%esp
2b6f: 68 f4 57 00 00 push $0x57f4
2b74: e8 61 13 00 00 call 3eda <mkdir>
2b79: 83 c4 10 add $0x10,%esp
2b7c: 85 c0 test %eax,%eax
2b7e: 74 2e je 2bae <fourteen+0xde>
printf(1, "fourteen ok\n");
2b80: 83 ec 08 sub $0x8,%esp
2b83: 68 ea 4e 00 00 push $0x4eea
2b88: 6a 01 push $0x1
2b8a: e8 51 14 00 00 call 3fe0 <printf>
}
2b8f: 83 c4 10 add $0x10,%esp
2b92: c9 leave
2b93: c3 ret
printf(1, "mkdir 12345678901234 failed\n");
2b94: 50 push %eax
2b95: 50 push %eax
2b96: 68 af 4e 00 00 push $0x4eaf
2b9b: 6a 01 push $0x1
2b9d: e8 3e 14 00 00 call 3fe0 <printf>
exit(0);
2ba2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2ba9: e8 c4 12 00 00 call 3e72 <exit>
printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n");
2bae: 50 push %eax
2baf: 50 push %eax
2bb0: 68 14 58 00 00 push $0x5814
2bb5: 6a 01 push $0x1
2bb7: e8 24 14 00 00 call 3fe0 <printf>
exit(0);
2bbc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2bc3: e8 aa 12 00 00 call 3e72 <exit>
printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
2bc8: 52 push %edx
2bc9: 52 push %edx
2bca: 68 c4 57 00 00 push $0x57c4
2bcf: 6a 01 push $0x1
2bd1: e8 0a 14 00 00 call 3fe0 <printf>
exit(0);
2bd6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2bdd: e8 90 12 00 00 call 3e72 <exit>
printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n");
2be2: 51 push %ecx
2be3: 51 push %ecx
2be4: 68 88 57 00 00 push $0x5788
2be9: 6a 01 push $0x1
2beb: e8 f0 13 00 00 call 3fe0 <printf>
exit(0);
2bf0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2bf7: e8 76 12 00 00 call 3e72 <exit>
printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n");
2bfc: 51 push %ecx
2bfd: 51 push %ecx
2bfe: 68 18 57 00 00 push $0x5718
2c03: 6a 01 push $0x1
2c05: e8 d6 13 00 00 call 3fe0 <printf>
exit(0);
2c0a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2c11: e8 5c 12 00 00 call 3e72 <exit>
printf(1, "mkdir 12345678901234/123456789012345 failed\n");
2c16: 50 push %eax
2c17: 50 push %eax
2c18: 68 b8 56 00 00 push $0x56b8
2c1d: 6a 01 push $0x1
2c1f: e8 bc 13 00 00 call 3fe0 <printf>
exit(0);
2c24: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2c2b: e8 42 12 00 00 call 3e72 <exit>
00002c30 <rmdot>:
{
2c30: 55 push %ebp
2c31: 89 e5 mov %esp,%ebp
2c33: 83 ec 10 sub $0x10,%esp
printf(1, "rmdot test\n");
2c36: 68 f7 4e 00 00 push $0x4ef7
2c3b: 6a 01 push $0x1
2c3d: e8 9e 13 00 00 call 3fe0 <printf>
if(mkdir("dots") != 0){
2c42: c7 04 24 03 4f 00 00 movl $0x4f03,(%esp)
2c49: e8 8c 12 00 00 call 3eda <mkdir>
2c4e: 83 c4 10 add $0x10,%esp
2c51: 85 c0 test %eax,%eax
2c53: 0f 85 b4 00 00 00 jne 2d0d <rmdot+0xdd>
if(chdir("dots") != 0){
2c59: 83 ec 0c sub $0xc,%esp
2c5c: 68 03 4f 00 00 push $0x4f03
2c61: e8 7c 12 00 00 call 3ee2 <chdir>
2c66: 83 c4 10 add $0x10,%esp
2c69: 85 c0 test %eax,%eax
2c6b: 0f 85 52 01 00 00 jne 2dc3 <rmdot+0x193>
if(unlink(".") == 0){
2c71: 83 ec 0c sub $0xc,%esp
2c74: 68 ae 4b 00 00 push $0x4bae
2c79: e8 44 12 00 00 call 3ec2 <unlink>
2c7e: 83 c4 10 add $0x10,%esp
2c81: 85 c0 test %eax,%eax
2c83: 0f 84 20 01 00 00 je 2da9 <rmdot+0x179>
if(unlink("..") == 0){
2c89: 83 ec 0c sub $0xc,%esp
2c8c: 68 ad 4b 00 00 push $0x4bad
2c91: e8 2c 12 00 00 call 3ec2 <unlink>
2c96: 83 c4 10 add $0x10,%esp
2c99: 85 c0 test %eax,%eax
2c9b: 0f 84 ee 00 00 00 je 2d8f <rmdot+0x15f>
if(chdir("/") != 0){
2ca1: 83 ec 0c sub $0xc,%esp
2ca4: 68 81 43 00 00 push $0x4381
2ca9: e8 34 12 00 00 call 3ee2 <chdir>
2cae: 83 c4 10 add $0x10,%esp
2cb1: 85 c0 test %eax,%eax
2cb3: 0f 85 bc 00 00 00 jne 2d75 <rmdot+0x145>
if(unlink("dots/.") == 0){
2cb9: 83 ec 0c sub $0xc,%esp
2cbc: 68 4b 4f 00 00 push $0x4f4b
2cc1: e8 fc 11 00 00 call 3ec2 <unlink>
2cc6: 83 c4 10 add $0x10,%esp
2cc9: 85 c0 test %eax,%eax
2ccb: 0f 84 8a 00 00 00 je 2d5b <rmdot+0x12b>
if(unlink("dots/..") == 0){
2cd1: 83 ec 0c sub $0xc,%esp
2cd4: 68 69 4f 00 00 push $0x4f69
2cd9: e8 e4 11 00 00 call 3ec2 <unlink>
2cde: 83 c4 10 add $0x10,%esp
2ce1: 85 c0 test %eax,%eax
2ce3: 74 5c je 2d41 <rmdot+0x111>
if(unlink("dots") != 0){
2ce5: 83 ec 0c sub $0xc,%esp
2ce8: 68 03 4f 00 00 push $0x4f03
2ced: e8 d0 11 00 00 call 3ec2 <unlink>
2cf2: 83 c4 10 add $0x10,%esp
2cf5: 85 c0 test %eax,%eax
2cf7: 75 2e jne 2d27 <rmdot+0xf7>
printf(1, "rmdot ok\n");
2cf9: 83 ec 08 sub $0x8,%esp
2cfc: 68 9e 4f 00 00 push $0x4f9e
2d01: 6a 01 push $0x1
2d03: e8 d8 12 00 00 call 3fe0 <printf>
}
2d08: 83 c4 10 add $0x10,%esp
2d0b: c9 leave
2d0c: c3 ret
printf(1, "mkdir dots failed\n");
2d0d: 50 push %eax
2d0e: 50 push %eax
2d0f: 68 08 4f 00 00 push $0x4f08
2d14: 6a 01 push $0x1
2d16: e8 c5 12 00 00 call 3fe0 <printf>
exit(0);
2d1b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d22: e8 4b 11 00 00 call 3e72 <exit>
printf(1, "unlink dots failed!\n");
2d27: 50 push %eax
2d28: 50 push %eax
2d29: 68 89 4f 00 00 push $0x4f89
2d2e: 6a 01 push $0x1
2d30: e8 ab 12 00 00 call 3fe0 <printf>
exit(0);
2d35: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d3c: e8 31 11 00 00 call 3e72 <exit>
printf(1, "unlink dots/.. worked!\n");
2d41: 52 push %edx
2d42: 52 push %edx
2d43: 68 71 4f 00 00 push $0x4f71
2d48: 6a 01 push $0x1
2d4a: e8 91 12 00 00 call 3fe0 <printf>
exit(0);
2d4f: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d56: e8 17 11 00 00 call 3e72 <exit>
printf(1, "unlink dots/. worked!\n");
2d5b: 51 push %ecx
2d5c: 51 push %ecx
2d5d: 68 52 4f 00 00 push $0x4f52
2d62: 6a 01 push $0x1
2d64: e8 77 12 00 00 call 3fe0 <printf>
exit(0);
2d69: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d70: e8 fd 10 00 00 call 3e72 <exit>
printf(1, "chdir / failed\n");
2d75: 50 push %eax
2d76: 50 push %eax
2d77: 68 83 43 00 00 push $0x4383
2d7c: 6a 01 push $0x1
2d7e: e8 5d 12 00 00 call 3fe0 <printf>
exit(0);
2d83: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2d8a: e8 e3 10 00 00 call 3e72 <exit>
printf(1, "rm .. worked!\n");
2d8f: 50 push %eax
2d90: 50 push %eax
2d91: 68 3c 4f 00 00 push $0x4f3c
2d96: 6a 01 push $0x1
2d98: e8 43 12 00 00 call 3fe0 <printf>
exit(0);
2d9d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2da4: e8 c9 10 00 00 call 3e72 <exit>
printf(1, "rm . worked!\n");
2da9: 50 push %eax
2daa: 50 push %eax
2dab: 68 2e 4f 00 00 push $0x4f2e
2db0: 6a 01 push $0x1
2db2: e8 29 12 00 00 call 3fe0 <printf>
exit(0);
2db7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2dbe: e8 af 10 00 00 call 3e72 <exit>
printf(1, "chdir dots failed\n");
2dc3: 50 push %eax
2dc4: 50 push %eax
2dc5: 68 1b 4f 00 00 push $0x4f1b
2dca: 6a 01 push $0x1
2dcc: e8 0f 12 00 00 call 3fe0 <printf>
exit(0);
2dd1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2dd8: e8 95 10 00 00 call 3e72 <exit>
2ddd: 8d 76 00 lea 0x0(%esi),%esi
00002de0 <dirfile>:
{
2de0: 55 push %ebp
2de1: 89 e5 mov %esp,%ebp
2de3: 53 push %ebx
2de4: 83 ec 0c sub $0xc,%esp
printf(1, "dir vs file\n");
2de7: 68 a8 4f 00 00 push $0x4fa8
2dec: 6a 01 push $0x1
2dee: e8 ed 11 00 00 call 3fe0 <printf>
fd = open("dirfile", O_CREATE);
2df3: 59 pop %ecx
2df4: 5b pop %ebx
2df5: 68 00 02 00 00 push $0x200
2dfa: 68 b5 4f 00 00 push $0x4fb5
2dff: e8 ae 10 00 00 call 3eb2 <open>
if(fd < 0){
2e04: 83 c4 10 add $0x10,%esp
2e07: 85 c0 test %eax,%eax
2e09: 0f 88 51 01 00 00 js 2f60 <dirfile+0x180>
close(fd);
2e0f: 83 ec 0c sub $0xc,%esp
2e12: 50 push %eax
2e13: e8 82 10 00 00 call 3e9a <close>
if(chdir("dirfile") == 0){
2e18: c7 04 24 b5 4f 00 00 movl $0x4fb5,(%esp)
2e1f: e8 be 10 00 00 call 3ee2 <chdir>
2e24: 83 c4 10 add $0x10,%esp
2e27: 85 c0 test %eax,%eax
2e29: 0f 84 17 01 00 00 je 2f46 <dirfile+0x166>
fd = open("dirfile/xx", 0);
2e2f: 83 ec 08 sub $0x8,%esp
2e32: 6a 00 push $0x0
2e34: 68 ee 4f 00 00 push $0x4fee
2e39: e8 74 10 00 00 call 3eb2 <open>
if(fd >= 0){
2e3e: 83 c4 10 add $0x10,%esp
2e41: 85 c0 test %eax,%eax
2e43: 0f 89 e3 00 00 00 jns 2f2c <dirfile+0x14c>
fd = open("dirfile/xx", O_CREATE);
2e49: 83 ec 08 sub $0x8,%esp
2e4c: 68 00 02 00 00 push $0x200
2e51: 68 ee 4f 00 00 push $0x4fee
2e56: e8 57 10 00 00 call 3eb2 <open>
if(fd >= 0){
2e5b: 83 c4 10 add $0x10,%esp
2e5e: 85 c0 test %eax,%eax
2e60: 0f 89 c6 00 00 00 jns 2f2c <dirfile+0x14c>
if(mkdir("dirfile/xx") == 0){
2e66: 83 ec 0c sub $0xc,%esp
2e69: 68 ee 4f 00 00 push $0x4fee
2e6e: e8 67 10 00 00 call 3eda <mkdir>
2e73: 83 c4 10 add $0x10,%esp
2e76: 85 c0 test %eax,%eax
2e78: 0f 84 7e 01 00 00 je 2ffc <dirfile+0x21c>
if(unlink("dirfile/xx") == 0){
2e7e: 83 ec 0c sub $0xc,%esp
2e81: 68 ee 4f 00 00 push $0x4fee
2e86: e8 37 10 00 00 call 3ec2 <unlink>
2e8b: 83 c4 10 add $0x10,%esp
2e8e: 85 c0 test %eax,%eax
2e90: 0f 84 4c 01 00 00 je 2fe2 <dirfile+0x202>
if(link("README", "dirfile/xx") == 0){
2e96: 83 ec 08 sub $0x8,%esp
2e99: 68 ee 4f 00 00 push $0x4fee
2e9e: 68 52 50 00 00 push $0x5052
2ea3: e8 2a 10 00 00 call 3ed2 <link>
2ea8: 83 c4 10 add $0x10,%esp
2eab: 85 c0 test %eax,%eax
2ead: 0f 84 15 01 00 00 je 2fc8 <dirfile+0x1e8>
if(unlink("dirfile") != 0){
2eb3: 83 ec 0c sub $0xc,%esp
2eb6: 68 b5 4f 00 00 push $0x4fb5
2ebb: e8 02 10 00 00 call 3ec2 <unlink>
2ec0: 83 c4 10 add $0x10,%esp
2ec3: 85 c0 test %eax,%eax
2ec5: 0f 85 e3 00 00 00 jne 2fae <dirfile+0x1ce>
fd = open(".", O_RDWR);
2ecb: 83 ec 08 sub $0x8,%esp
2ece: 6a 02 push $0x2
2ed0: 68 ae 4b 00 00 push $0x4bae
2ed5: e8 d8 0f 00 00 call 3eb2 <open>
if(fd >= 0){
2eda: 83 c4 10 add $0x10,%esp
2edd: 85 c0 test %eax,%eax
2edf: 0f 89 af 00 00 00 jns 2f94 <dirfile+0x1b4>
fd = open(".", 0);
2ee5: 83 ec 08 sub $0x8,%esp
2ee8: 6a 00 push $0x0
2eea: 68 ae 4b 00 00 push $0x4bae
2eef: e8 be 0f 00 00 call 3eb2 <open>
if(write(fd, "x", 1) > 0){
2ef4: 83 c4 0c add $0xc,%esp
fd = open(".", 0);
2ef7: 89 c3 mov %eax,%ebx
if(write(fd, "x", 1) > 0){
2ef9: 6a 01 push $0x1
2efb: 68 91 4c 00 00 push $0x4c91
2f00: 50 push %eax
2f01: e8 8c 0f 00 00 call 3e92 <write>
2f06: 83 c4 10 add $0x10,%esp
2f09: 85 c0 test %eax,%eax
2f0b: 7f 6d jg 2f7a <dirfile+0x19a>
close(fd);
2f0d: 83 ec 0c sub $0xc,%esp
2f10: 53 push %ebx
2f11: e8 84 0f 00 00 call 3e9a <close>
printf(1, "dir vs file OK\n");
2f16: 58 pop %eax
2f17: 5a pop %edx
2f18: 68 85 50 00 00 push $0x5085
2f1d: 6a 01 push $0x1
2f1f: e8 bc 10 00 00 call 3fe0 <printf>
}
2f24: 83 c4 10 add $0x10,%esp
2f27: 8b 5d fc mov -0x4(%ebp),%ebx
2f2a: c9 leave
2f2b: c3 ret
printf(1, "create dirfile/xx succeeded!\n");
2f2c: 50 push %eax
2f2d: 50 push %eax
2f2e: 68 f9 4f 00 00 push $0x4ff9
2f33: 6a 01 push $0x1
2f35: e8 a6 10 00 00 call 3fe0 <printf>
exit(0);
2f3a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2f41: e8 2c 0f 00 00 call 3e72 <exit>
printf(1, "chdir dirfile succeeded!\n");
2f46: 50 push %eax
2f47: 50 push %eax
2f48: 68 d4 4f 00 00 push $0x4fd4
2f4d: 6a 01 push $0x1
2f4f: e8 8c 10 00 00 call 3fe0 <printf>
exit(0);
2f54: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2f5b: e8 12 0f 00 00 call 3e72 <exit>
printf(1, "create dirfile failed\n");
2f60: 52 push %edx
2f61: 52 push %edx
2f62: 68 bd 4f 00 00 push $0x4fbd
2f67: 6a 01 push $0x1
2f69: e8 72 10 00 00 call 3fe0 <printf>
exit(0);
2f6e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2f75: e8 f8 0e 00 00 call 3e72 <exit>
printf(1, "write . succeeded!\n");
2f7a: 51 push %ecx
2f7b: 51 push %ecx
2f7c: 68 71 50 00 00 push $0x5071
2f81: 6a 01 push $0x1
2f83: e8 58 10 00 00 call 3fe0 <printf>
exit(0);
2f88: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2f8f: e8 de 0e 00 00 call 3e72 <exit>
printf(1, "open . for writing succeeded!\n");
2f94: 53 push %ebx
2f95: 53 push %ebx
2f96: 68 68 58 00 00 push $0x5868
2f9b: 6a 01 push $0x1
2f9d: e8 3e 10 00 00 call 3fe0 <printf>
exit(0);
2fa2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2fa9: e8 c4 0e 00 00 call 3e72 <exit>
printf(1, "unlink dirfile failed!\n");
2fae: 50 push %eax
2faf: 50 push %eax
2fb0: 68 59 50 00 00 push $0x5059
2fb5: 6a 01 push $0x1
2fb7: e8 24 10 00 00 call 3fe0 <printf>
exit(0);
2fbc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2fc3: e8 aa 0e 00 00 call 3e72 <exit>
printf(1, "link to dirfile/xx succeeded!\n");
2fc8: 50 push %eax
2fc9: 50 push %eax
2fca: 68 48 58 00 00 push $0x5848
2fcf: 6a 01 push $0x1
2fd1: e8 0a 10 00 00 call 3fe0 <printf>
exit(0);
2fd6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2fdd: e8 90 0e 00 00 call 3e72 <exit>
printf(1, "unlink dirfile/xx succeeded!\n");
2fe2: 50 push %eax
2fe3: 50 push %eax
2fe4: 68 34 50 00 00 push $0x5034
2fe9: 6a 01 push $0x1
2feb: e8 f0 0f 00 00 call 3fe0 <printf>
exit(0);
2ff0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2ff7: e8 76 0e 00 00 call 3e72 <exit>
printf(1, "mkdir dirfile/xx succeeded!\n");
2ffc: 50 push %eax
2ffd: 50 push %eax
2ffe: 68 17 50 00 00 push $0x5017
3003: 6a 01 push $0x1
3005: e8 d6 0f 00 00 call 3fe0 <printf>
exit(0);
300a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3011: e8 5c 0e 00 00 call 3e72 <exit>
3016: 8d 76 00 lea 0x0(%esi),%esi
3019: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003020 <iref>:
{
3020: 55 push %ebp
3021: 89 e5 mov %esp,%ebp
3023: 53 push %ebx
printf(1, "empty file name\n");
3024: bb 33 00 00 00 mov $0x33,%ebx
{
3029: 83 ec 0c sub $0xc,%esp
printf(1, "empty file name\n");
302c: 68 95 50 00 00 push $0x5095
3031: 6a 01 push $0x1
3033: e8 a8 0f 00 00 call 3fe0 <printf>
3038: 83 c4 10 add $0x10,%esp
303b: 90 nop
303c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(mkdir("irefd") != 0){
3040: 83 ec 0c sub $0xc,%esp
3043: 68 a6 50 00 00 push $0x50a6
3048: e8 8d 0e 00 00 call 3eda <mkdir>
304d: 83 c4 10 add $0x10,%esp
3050: 85 c0 test %eax,%eax
3052: 0f 85 bb 00 00 00 jne 3113 <iref+0xf3>
if(chdir("irefd") != 0){
3058: 83 ec 0c sub $0xc,%esp
305b: 68 a6 50 00 00 push $0x50a6
3060: e8 7d 0e 00 00 call 3ee2 <chdir>
3065: 83 c4 10 add $0x10,%esp
3068: 85 c0 test %eax,%eax
306a: 0f 85 be 00 00 00 jne 312e <iref+0x10e>
mkdir("");
3070: 83 ec 0c sub $0xc,%esp
3073: 68 5b 47 00 00 push $0x475b
3078: e8 5d 0e 00 00 call 3eda <mkdir>
link("README", "");
307d: 59 pop %ecx
307e: 58 pop %eax
307f: 68 5b 47 00 00 push $0x475b
3084: 68 52 50 00 00 push $0x5052
3089: e8 44 0e 00 00 call 3ed2 <link>
fd = open("", O_CREATE);
308e: 58 pop %eax
308f: 5a pop %edx
3090: 68 00 02 00 00 push $0x200
3095: 68 5b 47 00 00 push $0x475b
309a: e8 13 0e 00 00 call 3eb2 <open>
if(fd >= 0)
309f: 83 c4 10 add $0x10,%esp
30a2: 85 c0 test %eax,%eax
30a4: 78 0c js 30b2 <iref+0x92>
close(fd);
30a6: 83 ec 0c sub $0xc,%esp
30a9: 50 push %eax
30aa: e8 eb 0d 00 00 call 3e9a <close>
30af: 83 c4 10 add $0x10,%esp
fd = open("xx", O_CREATE);
30b2: 83 ec 08 sub $0x8,%esp
30b5: 68 00 02 00 00 push $0x200
30ba: 68 90 4c 00 00 push $0x4c90
30bf: e8 ee 0d 00 00 call 3eb2 <open>
if(fd >= 0)
30c4: 83 c4 10 add $0x10,%esp
30c7: 85 c0 test %eax,%eax
30c9: 78 0c js 30d7 <iref+0xb7>
close(fd);
30cb: 83 ec 0c sub $0xc,%esp
30ce: 50 push %eax
30cf: e8 c6 0d 00 00 call 3e9a <close>
30d4: 83 c4 10 add $0x10,%esp
unlink("xx");
30d7: 83 ec 0c sub $0xc,%esp
30da: 68 90 4c 00 00 push $0x4c90
30df: e8 de 0d 00 00 call 3ec2 <unlink>
for(i = 0; i < 50 + 1; i++){
30e4: 83 c4 10 add $0x10,%esp
30e7: 83 eb 01 sub $0x1,%ebx
30ea: 0f 85 50 ff ff ff jne 3040 <iref+0x20>
chdir("/");
30f0: 83 ec 0c sub $0xc,%esp
30f3: 68 81 43 00 00 push $0x4381
30f8: e8 e5 0d 00 00 call 3ee2 <chdir>
printf(1, "empty file name OK\n");
30fd: 58 pop %eax
30fe: 5a pop %edx
30ff: 68 d4 50 00 00 push $0x50d4
3104: 6a 01 push $0x1
3106: e8 d5 0e 00 00 call 3fe0 <printf>
}
310b: 83 c4 10 add $0x10,%esp
310e: 8b 5d fc mov -0x4(%ebp),%ebx
3111: c9 leave
3112: c3 ret
printf(1, "mkdir irefd failed\n");
3113: 83 ec 08 sub $0x8,%esp
3116: 68 ac 50 00 00 push $0x50ac
311b: 6a 01 push $0x1
311d: e8 be 0e 00 00 call 3fe0 <printf>
exit(0);
3122: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3129: e8 44 0d 00 00 call 3e72 <exit>
printf(1, "chdir irefd failed\n");
312e: 83 ec 08 sub $0x8,%esp
3131: 68 c0 50 00 00 push $0x50c0
3136: 6a 01 push $0x1
3138: e8 a3 0e 00 00 call 3fe0 <printf>
exit(0);
313d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3144: e8 29 0d 00 00 call 3e72 <exit>
3149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003150 <forktest>:
{
3150: 55 push %ebp
3151: 89 e5 mov %esp,%ebp
3153: 53 push %ebx
for(n=0; n<1000; n++){
3154: 31 db xor %ebx,%ebx
{
3156: 83 ec 0c sub $0xc,%esp
printf(1, "fork test\n");
3159: 68 e8 50 00 00 push $0x50e8
315e: 6a 01 push $0x1
3160: e8 7b 0e 00 00 call 3fe0 <printf>
3165: 83 c4 10 add $0x10,%esp
3168: eb 13 jmp 317d <forktest+0x2d>
316a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(pid == 0)
3170: 74 79 je 31eb <forktest+0x9b>
for(n=0; n<1000; n++){
3172: 83 c3 01 add $0x1,%ebx
3175: 81 fb e8 03 00 00 cmp $0x3e8,%ebx
317b: 74 53 je 31d0 <forktest+0x80>
pid = fork();
317d: e8 e8 0c 00 00 call 3e6a <fork>
if(pid < 0)
3182: 85 c0 test %eax,%eax
3184: 79 ea jns 3170 <forktest+0x20>
for(; n > 0; n--){
3186: 85 db test %ebx,%ebx
3188: 74 1c je 31a6 <forktest+0x56>
318a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(wait(null) < 0){
3190: 83 ec 0c sub $0xc,%esp
3193: 6a 00 push $0x0
3195: e8 e0 0c 00 00 call 3e7a <wait>
319a: 83 c4 10 add $0x10,%esp
319d: 85 c0 test %eax,%eax
319f: 78 54 js 31f5 <forktest+0xa5>
for(; n > 0; n--){
31a1: 83 eb 01 sub $0x1,%ebx
31a4: 75 ea jne 3190 <forktest+0x40>
if(wait(null) != -1){
31a6: 83 ec 0c sub $0xc,%esp
31a9: 6a 00 push $0x0
31ab: e8 ca 0c 00 00 call 3e7a <wait>
31b0: 83 c4 10 add $0x10,%esp
31b3: 83 f8 ff cmp $0xffffffff,%eax
31b6: 75 58 jne 3210 <forktest+0xc0>
printf(1, "fork test OK\n");
31b8: 83 ec 08 sub $0x8,%esp
31bb: 68 1a 51 00 00 push $0x511a
31c0: 6a 01 push $0x1
31c2: e8 19 0e 00 00 call 3fe0 <printf>
}
31c7: 8b 5d fc mov -0x4(%ebp),%ebx
31ca: c9 leave
31cb: c3 ret
31cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "fork claimed to work 1000 times!\n");
31d0: 83 ec 08 sub $0x8,%esp
31d3: 68 88 58 00 00 push $0x5888
31d8: 6a 01 push $0x1
31da: e8 01 0e 00 00 call 3fe0 <printf>
exit(0);
31df: c7 04 24 00 00 00 00 movl $0x0,(%esp)
31e6: e8 87 0c 00 00 call 3e72 <exit>
exit(0);
31eb: 83 ec 0c sub $0xc,%esp
31ee: 6a 00 push $0x0
31f0: e8 7d 0c 00 00 call 3e72 <exit>
printf(1, "wait stopped early\n");
31f5: 83 ec 08 sub $0x8,%esp
31f8: 68 f3 50 00 00 push $0x50f3
31fd: 6a 01 push $0x1
31ff: e8 dc 0d 00 00 call 3fe0 <printf>
exit(0);
3204: c7 04 24 00 00 00 00 movl $0x0,(%esp)
320b: e8 62 0c 00 00 call 3e72 <exit>
printf(1, "wait got too many\n");
3210: 50 push %eax
3211: 50 push %eax
3212: 68 07 51 00 00 push $0x5107
3217: 6a 01 push $0x1
3219: e8 c2 0d 00 00 call 3fe0 <printf>
exit(0);
321e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3225: e8 48 0c 00 00 call 3e72 <exit>
322a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00003230 <sbrktest>:
{
3230: 55 push %ebp
3231: 89 e5 mov %esp,%ebp
3233: 57 push %edi
3234: 56 push %esi
3235: 53 push %ebx
for(i = 0; i < 5000; i++){
3236: 31 ff xor %edi,%edi
{
3238: 83 ec 64 sub $0x64,%esp
printf(stdout, "sbrk test\n");
323b: 68 28 51 00 00 push $0x5128
3240: ff 35 e8 63 00 00 pushl 0x63e8
3246: e8 95 0d 00 00 call 3fe0 <printf>
oldbrk = sbrk(0);
324b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3252: e8 a3 0c 00 00 call 3efa <sbrk>
a = sbrk(0);
3257: c7 04 24 00 00 00 00 movl $0x0,(%esp)
oldbrk = sbrk(0);
325e: 89 c3 mov %eax,%ebx
a = sbrk(0);
3260: e8 95 0c 00 00 call 3efa <sbrk>
3265: 83 c4 10 add $0x10,%esp
3268: 89 c6 mov %eax,%esi
326a: eb 06 jmp 3272 <sbrktest+0x42>
326c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
a = b + 1;
3270: 89 c6 mov %eax,%esi
b = sbrk(1);
3272: 83 ec 0c sub $0xc,%esp
3275: 6a 01 push $0x1
3277: e8 7e 0c 00 00 call 3efa <sbrk>
if(b != a){
327c: 83 c4 10 add $0x10,%esp
327f: 39 f0 cmp %esi,%eax
3281: 0f 85 79 02 00 00 jne 3500 <sbrktest+0x2d0>
for(i = 0; i < 5000; i++){
3287: 83 c7 01 add $0x1,%edi
*b = 1;
328a: c6 06 01 movb $0x1,(%esi)
a = b + 1;
328d: 8d 46 01 lea 0x1(%esi),%eax
for(i = 0; i < 5000; i++){
3290: 81 ff 88 13 00 00 cmp $0x1388,%edi
3296: 75 d8 jne 3270 <sbrktest+0x40>
pid = fork();
3298: e8 cd 0b 00 00 call 3e6a <fork>
if(pid < 0){
329d: 85 c0 test %eax,%eax
pid = fork();
329f: 89 c7 mov %eax,%edi
if(pid < 0){
32a1: 0f 88 ed 03 00 00 js 3694 <sbrktest+0x464>
c = sbrk(1);
32a7: 83 ec 0c sub $0xc,%esp
if(c != a + 1){
32aa: 83 c6 02 add $0x2,%esi
c = sbrk(1);
32ad: 6a 01 push $0x1
32af: e8 46 0c 00 00 call 3efa <sbrk>
c = sbrk(1);
32b4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
32bb: e8 3a 0c 00 00 call 3efa <sbrk>
if(c != a + 1){
32c0: 83 c4 10 add $0x10,%esp
32c3: 39 f0 cmp %esi,%eax
32c5: 0f 85 ab 03 00 00 jne 3676 <sbrktest+0x446>
if(pid == 0)
32cb: 85 ff test %edi,%edi
32cd: 0f 84 99 03 00 00 je 366c <sbrktest+0x43c>
wait(null);
32d3: 83 ec 0c sub $0xc,%esp
32d6: 6a 00 push $0x0
32d8: e8 9d 0b 00 00 call 3e7a <wait>
a = sbrk(0);
32dd: c7 04 24 00 00 00 00 movl $0x0,(%esp)
32e4: e8 11 0c 00 00 call 3efa <sbrk>
32e9: 89 c6 mov %eax,%esi
amt = (BIG) - (uint)a;
32eb: b8 00 00 40 06 mov $0x6400000,%eax
32f0: 29 f0 sub %esi,%eax
p = sbrk(amt);
32f2: 89 04 24 mov %eax,(%esp)
32f5: e8 00 0c 00 00 call 3efa <sbrk>
if (p != a) {
32fa: 83 c4 10 add $0x10,%esp
32fd: 39 c6 cmp %eax,%esi
32ff: 0f 85 49 03 00 00 jne 364e <sbrktest+0x41e>
a = sbrk(0);
3305: 83 ec 0c sub $0xc,%esp
*lastaddr = 99;
3308: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff
a = sbrk(0);
330f: 6a 00 push $0x0
3311: e8 e4 0b 00 00 call 3efa <sbrk>
c = sbrk(-4096);
3316: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp)
a = sbrk(0);
331d: 89 c6 mov %eax,%esi
c = sbrk(-4096);
331f: e8 d6 0b 00 00 call 3efa <sbrk>
if(c == (char*)0xffffffff){
3324: 83 c4 10 add $0x10,%esp
3327: 83 f8 ff cmp $0xffffffff,%eax
332a: 0f 84 00 03 00 00 je 3630 <sbrktest+0x400>
c = sbrk(0);
3330: 83 ec 0c sub $0xc,%esp
3333: 6a 00 push $0x0
3335: e8 c0 0b 00 00 call 3efa <sbrk>
if(c != a - 4096){
333a: 8d 96 00 f0 ff ff lea -0x1000(%esi),%edx
3340: 83 c4 10 add $0x10,%esp
3343: 39 d0 cmp %edx,%eax
3345: 0f 85 c7 02 00 00 jne 3612 <sbrktest+0x3e2>
a = sbrk(0);
334b: 83 ec 0c sub $0xc,%esp
334e: 6a 00 push $0x0
3350: e8 a5 0b 00 00 call 3efa <sbrk>
3355: 89 c6 mov %eax,%esi
c = sbrk(4096);
3357: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
335e: e8 97 0b 00 00 call 3efa <sbrk>
if(c != a || sbrk(0) != a + 4096){
3363: 83 c4 10 add $0x10,%esp
3366: 39 c6 cmp %eax,%esi
c = sbrk(4096);
3368: 89 c7 mov %eax,%edi
if(c != a || sbrk(0) != a + 4096){
336a: 0f 85 84 02 00 00 jne 35f4 <sbrktest+0x3c4>
3370: 83 ec 0c sub $0xc,%esp
3373: 6a 00 push $0x0
3375: e8 80 0b 00 00 call 3efa <sbrk>
337a: 8d 96 00 10 00 00 lea 0x1000(%esi),%edx
3380: 83 c4 10 add $0x10,%esp
3383: 39 d0 cmp %edx,%eax
3385: 0f 85 69 02 00 00 jne 35f4 <sbrktest+0x3c4>
if(*lastaddr == 99){
338b: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff
3392: 0f 84 3e 02 00 00 je 35d6 <sbrktest+0x3a6>
a = sbrk(0);
3398: 83 ec 0c sub $0xc,%esp
339b: 6a 00 push $0x0
339d: e8 58 0b 00 00 call 3efa <sbrk>
c = sbrk(-(sbrk(0) - oldbrk));
33a2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
a = sbrk(0);
33a9: 89 c6 mov %eax,%esi
c = sbrk(-(sbrk(0) - oldbrk));
33ab: e8 4a 0b 00 00 call 3efa <sbrk>
33b0: 89 d9 mov %ebx,%ecx
33b2: 29 c1 sub %eax,%ecx
33b4: 89 0c 24 mov %ecx,(%esp)
33b7: e8 3e 0b 00 00 call 3efa <sbrk>
if(c != a){
33bc: 83 c4 10 add $0x10,%esp
33bf: 39 c6 cmp %eax,%esi
33c1: 0f 85 f1 01 00 00 jne 35b8 <sbrktest+0x388>
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
33c7: be 00 00 00 80 mov $0x80000000,%esi
ppid = getpid();
33cc: e8 21 0b 00 00 call 3ef2 <getpid>
33d1: 89 c7 mov %eax,%edi
pid = fork();
33d3: e8 92 0a 00 00 call 3e6a <fork>
if(pid < 0){
33d8: 85 c0 test %eax,%eax
33da: 0f 88 ba 01 00 00 js 359a <sbrktest+0x36a>
if(pid == 0){
33e0: 0f 84 8b 01 00 00 je 3571 <sbrktest+0x341>
wait(null);
33e6: 83 ec 0c sub $0xc,%esp
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
33e9: 81 c6 50 c3 00 00 add $0xc350,%esi
wait(null);
33ef: 6a 00 push $0x0
33f1: e8 84 0a 00 00 call 3e7a <wait>
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
33f6: 83 c4 10 add $0x10,%esp
33f9: 81 fe 80 84 1e 80 cmp $0x801e8480,%esi
33ff: 75 cb jne 33cc <sbrktest+0x19c>
if(pipe(fds) != 0){
3401: 8d 45 b8 lea -0x48(%ebp),%eax
3404: 83 ec 0c sub $0xc,%esp
3407: 50 push %eax
3408: e8 75 0a 00 00 call 3e82 <pipe>
340d: 83 c4 10 add $0x10,%esp
3410: 85 c0 test %eax,%eax
3412: 0f 85 3f 01 00 00 jne 3557 <sbrktest+0x327>
3418: 8d 7d c0 lea -0x40(%ebp),%edi
341b: 89 fe mov %edi,%esi
341d: eb 23 jmp 3442 <sbrktest+0x212>
if(pids[i] != -1)
341f: 83 f8 ff cmp $0xffffffff,%eax
3422: 74 14 je 3438 <sbrktest+0x208>
read(fds[0], &scratch, 1);
3424: 8d 45 b7 lea -0x49(%ebp),%eax
3427: 83 ec 04 sub $0x4,%esp
342a: 6a 01 push $0x1
342c: 50 push %eax
342d: ff 75 b8 pushl -0x48(%ebp)
3430: e8 55 0a 00 00 call 3e8a <read>
3435: 83 c4 10 add $0x10,%esp
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
3438: 8d 45 e8 lea -0x18(%ebp),%eax
343b: 83 c6 04 add $0x4,%esi
343e: 39 c6 cmp %eax,%esi
3440: 74 50 je 3492 <sbrktest+0x262>
if((pids[i] = fork()) == 0){
3442: e8 23 0a 00 00 call 3e6a <fork>
3447: 85 c0 test %eax,%eax
3449: 89 06 mov %eax,(%esi)
344b: 75 d2 jne 341f <sbrktest+0x1ef>
sbrk(BIG - (uint)sbrk(0));
344d: 83 ec 0c sub $0xc,%esp
3450: 6a 00 push $0x0
3452: e8 a3 0a 00 00 call 3efa <sbrk>
3457: ba 00 00 40 06 mov $0x6400000,%edx
345c: 29 c2 sub %eax,%edx
345e: 89 14 24 mov %edx,(%esp)
3461: e8 94 0a 00 00 call 3efa <sbrk>
write(fds[1], "x", 1);
3466: 83 c4 0c add $0xc,%esp
3469: 6a 01 push $0x1
346b: 68 91 4c 00 00 push $0x4c91
3470: ff 75 bc pushl -0x44(%ebp)
3473: e8 1a 0a 00 00 call 3e92 <write>
3478: 83 c4 10 add $0x10,%esp
347b: 90 nop
347c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(;;) sleep(1000);
3480: 83 ec 0c sub $0xc,%esp
3483: 68 e8 03 00 00 push $0x3e8
3488: e8 75 0a 00 00 call 3f02 <sleep>
348d: 83 c4 10 add $0x10,%esp
3490: eb ee jmp 3480 <sbrktest+0x250>
c = sbrk(4096);
3492: 83 ec 0c sub $0xc,%esp
3495: 68 00 10 00 00 push $0x1000
349a: e8 5b 0a 00 00 call 3efa <sbrk>
349f: 83 c4 10 add $0x10,%esp
34a2: 89 45 a4 mov %eax,-0x5c(%ebp)
if(pids[i] == -1)
34a5: 8b 07 mov (%edi),%eax
34a7: 83 f8 ff cmp $0xffffffff,%eax
34aa: 74 18 je 34c4 <sbrktest+0x294>
kill(pids[i]);
34ac: 83 ec 0c sub $0xc,%esp
34af: 50 push %eax
34b0: e8 ed 09 00 00 call 3ea2 <kill>
wait(null);
34b5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
34bc: e8 b9 09 00 00 call 3e7a <wait>
34c1: 83 c4 10 add $0x10,%esp
34c4: 83 c7 04 add $0x4,%edi
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
34c7: 39 fe cmp %edi,%esi
34c9: 75 da jne 34a5 <sbrktest+0x275>
if(c == (char*)0xffffffff){
34cb: 83 7d a4 ff cmpl $0xffffffff,-0x5c(%ebp)
34cf: 74 68 je 3539 <sbrktest+0x309>
if(sbrk(0) > oldbrk)
34d1: 83 ec 0c sub $0xc,%esp
34d4: 6a 00 push $0x0
34d6: e8 1f 0a 00 00 call 3efa <sbrk>
34db: 83 c4 10 add $0x10,%esp
34de: 39 d8 cmp %ebx,%eax
34e0: 77 3e ja 3520 <sbrktest+0x2f0>
printf(stdout, "sbrk test OK\n");
34e2: 83 ec 08 sub $0x8,%esp
34e5: 68 d0 51 00 00 push $0x51d0
34ea: ff 35 e8 63 00 00 pushl 0x63e8
34f0: e8 eb 0a 00 00 call 3fe0 <printf>
}
34f5: 83 c4 10 add $0x10,%esp
34f8: 8d 65 f4 lea -0xc(%ebp),%esp
34fb: 5b pop %ebx
34fc: 5e pop %esi
34fd: 5f pop %edi
34fe: 5d pop %ebp
34ff: c3 ret
printf(stdout, "sbrk test failed %d %x %x\n", i, a, b);
3500: 83 ec 0c sub $0xc,%esp
3503: 50 push %eax
3504: 56 push %esi
3505: 57 push %edi
3506: 68 33 51 00 00 push $0x5133
350b: ff 35 e8 63 00 00 pushl 0x63e8
3511: e8 ca 0a 00 00 call 3fe0 <printf>
exit(0);
3516: 83 c4 14 add $0x14,%esp
3519: 6a 00 push $0x0
351b: e8 52 09 00 00 call 3e72 <exit>
sbrk(-(sbrk(0) - oldbrk));
3520: 83 ec 0c sub $0xc,%esp
3523: 6a 00 push $0x0
3525: e8 d0 09 00 00 call 3efa <sbrk>
352a: 29 c3 sub %eax,%ebx
352c: 89 1c 24 mov %ebx,(%esp)
352f: e8 c6 09 00 00 call 3efa <sbrk>
3534: 83 c4 10 add $0x10,%esp
3537: eb a9 jmp 34e2 <sbrktest+0x2b2>
printf(stdout, "failed sbrk leaked memory\n");
3539: 50 push %eax
353a: 50 push %eax
353b: 68 b5 51 00 00 push $0x51b5
3540: ff 35 e8 63 00 00 pushl 0x63e8
3546: e8 95 0a 00 00 call 3fe0 <printf>
exit(0);
354b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3552: e8 1b 09 00 00 call 3e72 <exit>
printf(1, "pipe() failed\n");
3557: 52 push %edx
3558: 52 push %edx
3559: 68 71 46 00 00 push $0x4671
355e: 6a 01 push $0x1
3560: e8 7b 0a 00 00 call 3fe0 <printf>
exit(0);
3565: c7 04 24 00 00 00 00 movl $0x0,(%esp)
356c: e8 01 09 00 00 call 3e72 <exit>
printf(stdout, "oops could read %x = %x\n", a, *a);
3571: 0f be 06 movsbl (%esi),%eax
3574: 50 push %eax
3575: 56 push %esi
3576: 68 9c 51 00 00 push $0x519c
357b: ff 35 e8 63 00 00 pushl 0x63e8
3581: e8 5a 0a 00 00 call 3fe0 <printf>
kill(ppid);
3586: 89 3c 24 mov %edi,(%esp)
3589: e8 14 09 00 00 call 3ea2 <kill>
exit(0);
358e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3595: e8 d8 08 00 00 call 3e72 <exit>
printf(stdout, "fork failed\n");
359a: 51 push %ecx
359b: 51 push %ecx
359c: 68 79 52 00 00 push $0x5279
35a1: ff 35 e8 63 00 00 pushl 0x63e8
35a7: e8 34 0a 00 00 call 3fe0 <printf>
exit(0);
35ac: c7 04 24 00 00 00 00 movl $0x0,(%esp)
35b3: e8 ba 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
35b8: 50 push %eax
35b9: 56 push %esi
35ba: 68 7c 59 00 00 push $0x597c
35bf: ff 35 e8 63 00 00 pushl 0x63e8
35c5: e8 16 0a 00 00 call 3fe0 <printf>
exit(0);
35ca: c7 04 24 00 00 00 00 movl $0x0,(%esp)
35d1: e8 9c 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
35d6: 53 push %ebx
35d7: 53 push %ebx
35d8: 68 4c 59 00 00 push $0x594c
35dd: ff 35 e8 63 00 00 pushl 0x63e8
35e3: e8 f8 09 00 00 call 3fe0 <printf>
exit(0);
35e8: c7 04 24 00 00 00 00 movl $0x0,(%esp)
35ef: e8 7e 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c);
35f4: 57 push %edi
35f5: 56 push %esi
35f6: 68 24 59 00 00 push $0x5924
35fb: ff 35 e8 63 00 00 pushl 0x63e8
3601: e8 da 09 00 00 call 3fe0 <printf>
exit(0);
3606: c7 04 24 00 00 00 00 movl $0x0,(%esp)
360d: e8 60 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
3612: 50 push %eax
3613: 56 push %esi
3614: 68 ec 58 00 00 push $0x58ec
3619: ff 35 e8 63 00 00 pushl 0x63e8
361f: e8 bc 09 00 00 call 3fe0 <printf>
exit(0);
3624: c7 04 24 00 00 00 00 movl $0x0,(%esp)
362b: e8 42 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk could not deallocate\n");
3630: 56 push %esi
3631: 56 push %esi
3632: 68 81 51 00 00 push $0x5181
3637: ff 35 e8 63 00 00 pushl 0x63e8
363d: e8 9e 09 00 00 call 3fe0 <printf>
exit(0);
3642: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3649: e8 24 08 00 00 call 3e72 <exit>
printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n");
364e: 57 push %edi
364f: 57 push %edi
3650: 68 ac 58 00 00 push $0x58ac
3655: ff 35 e8 63 00 00 pushl 0x63e8
365b: e8 80 09 00 00 call 3fe0 <printf>
exit(0);
3660: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3667: e8 06 08 00 00 call 3e72 <exit>
exit(0);
366c: 83 ec 0c sub $0xc,%esp
366f: 6a 00 push $0x0
3671: e8 fc 07 00 00 call 3e72 <exit>
printf(stdout, "sbrk test failed post-fork\n");
3676: 50 push %eax
3677: 50 push %eax
3678: 68 65 51 00 00 push $0x5165
367d: ff 35 e8 63 00 00 pushl 0x63e8
3683: e8 58 09 00 00 call 3fe0 <printf>
exit(0);
3688: c7 04 24 00 00 00 00 movl $0x0,(%esp)
368f: e8 de 07 00 00 call 3e72 <exit>
printf(stdout, "sbrk test fork failed\n");
3694: 50 push %eax
3695: 50 push %eax
3696: 68 4e 51 00 00 push $0x514e
369b: ff 35 e8 63 00 00 pushl 0x63e8
36a1: e8 3a 09 00 00 call 3fe0 <printf>
exit(0);
36a6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
36ad: e8 c0 07 00 00 call 3e72 <exit>
36b2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
36b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000036c0 <validateint>:
{
36c0: 55 push %ebp
36c1: 89 e5 mov %esp,%ebp
}
36c3: 5d pop %ebp
36c4: c3 ret
36c5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
36c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000036d0 <validatetest>:
{
36d0: 55 push %ebp
36d1: 89 e5 mov %esp,%ebp
36d3: 56 push %esi
36d4: 53 push %ebx
for(p = 0; p <= (uint)hi; p += 4096){
36d5: 31 db xor %ebx,%ebx
printf(stdout, "validate test\n");
36d7: 83 ec 08 sub $0x8,%esp
36da: 68 de 51 00 00 push $0x51de
36df: ff 35 e8 63 00 00 pushl 0x63e8
36e5: e8 f6 08 00 00 call 3fe0 <printf>
36ea: 83 c4 10 add $0x10,%esp
36ed: 8d 76 00 lea 0x0(%esi),%esi
if((pid = fork()) == 0){
36f0: e8 75 07 00 00 call 3e6a <fork>
36f5: 85 c0 test %eax,%eax
36f7: 89 c6 mov %eax,%esi
36f9: 74 6a je 3765 <validatetest+0x95>
sleep(0);
36fb: 83 ec 0c sub $0xc,%esp
36fe: 6a 00 push $0x0
3700: e8 fd 07 00 00 call 3f02 <sleep>
sleep(0);
3705: c7 04 24 00 00 00 00 movl $0x0,(%esp)
370c: e8 f1 07 00 00 call 3f02 <sleep>
kill(pid);
3711: 89 34 24 mov %esi,(%esp)
3714: e8 89 07 00 00 call 3ea2 <kill>
wait(null);
3719: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3720: e8 55 07 00 00 call 3e7a <wait>
if(link("nosuchfile", (char*)p) != -1){
3725: 58 pop %eax
3726: 5a pop %edx
3727: 53 push %ebx
3728: 68 ed 51 00 00 push $0x51ed
372d: e8 a0 07 00 00 call 3ed2 <link>
3732: 83 c4 10 add $0x10,%esp
3735: 83 f8 ff cmp $0xffffffff,%eax
3738: 75 35 jne 376f <validatetest+0x9f>
for(p = 0; p <= (uint)hi; p += 4096){
373a: 81 c3 00 10 00 00 add $0x1000,%ebx
3740: 81 fb 00 40 11 00 cmp $0x114000,%ebx
3746: 75 a8 jne 36f0 <validatetest+0x20>
printf(stdout, "validate ok\n");
3748: 83 ec 08 sub $0x8,%esp
374b: 68 11 52 00 00 push $0x5211
3750: ff 35 e8 63 00 00 pushl 0x63e8
3756: e8 85 08 00 00 call 3fe0 <printf>
}
375b: 83 c4 10 add $0x10,%esp
375e: 8d 65 f8 lea -0x8(%ebp),%esp
3761: 5b pop %ebx
3762: 5e pop %esi
3763: 5d pop %ebp
3764: c3 ret
exit(0);
3765: 83 ec 0c sub $0xc,%esp
3768: 6a 00 push $0x0
376a: e8 03 07 00 00 call 3e72 <exit>
printf(stdout, "link should not succeed\n");
376f: 83 ec 08 sub $0x8,%esp
3772: 68 f8 51 00 00 push $0x51f8
3777: ff 35 e8 63 00 00 pushl 0x63e8
377d: e8 5e 08 00 00 call 3fe0 <printf>
exit(0);
3782: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3789: e8 e4 06 00 00 call 3e72 <exit>
378e: 66 90 xchg %ax,%ax
00003790 <bsstest>:
{
3790: 55 push %ebp
3791: 89 e5 mov %esp,%ebp
3793: 83 ec 10 sub $0x10,%esp
printf(stdout, "bss test\n");
3796: 68 1e 52 00 00 push $0x521e
379b: ff 35 e8 63 00 00 pushl 0x63e8
37a1: e8 3a 08 00 00 call 3fe0 <printf>
if(uninit[i] != '\0'){
37a6: 83 c4 10 add $0x10,%esp
37a9: 80 3d a0 64 00 00 00 cmpb $0x0,0x64a0
37b0: 75 39 jne 37eb <bsstest+0x5b>
for(i = 0; i < sizeof(uninit); i++){
37b2: b8 01 00 00 00 mov $0x1,%eax
37b7: 89 f6 mov %esi,%esi
37b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if(uninit[i] != '\0'){
37c0: 80 b8 a0 64 00 00 00 cmpb $0x0,0x64a0(%eax)
37c7: 75 22 jne 37eb <bsstest+0x5b>
for(i = 0; i < sizeof(uninit); i++){
37c9: 83 c0 01 add $0x1,%eax
37cc: 3d 10 27 00 00 cmp $0x2710,%eax
37d1: 75 ed jne 37c0 <bsstest+0x30>
printf(stdout, "bss test ok\n");
37d3: 83 ec 08 sub $0x8,%esp
37d6: 68 39 52 00 00 push $0x5239
37db: ff 35 e8 63 00 00 pushl 0x63e8
37e1: e8 fa 07 00 00 call 3fe0 <printf>
}
37e6: 83 c4 10 add $0x10,%esp
37e9: c9 leave
37ea: c3 ret
printf(stdout, "bss test failed\n");
37eb: 83 ec 08 sub $0x8,%esp
37ee: 68 28 52 00 00 push $0x5228
37f3: ff 35 e8 63 00 00 pushl 0x63e8
37f9: e8 e2 07 00 00 call 3fe0 <printf>
exit(0);
37fe: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3805: e8 68 06 00 00 call 3e72 <exit>
380a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00003810 <bigargtest>:
{
3810: 55 push %ebp
3811: 89 e5 mov %esp,%ebp
3813: 83 ec 14 sub $0x14,%esp
unlink("bigarg-ok");
3816: 68 46 52 00 00 push $0x5246
381b: e8 a2 06 00 00 call 3ec2 <unlink>
pid = fork();
3820: e8 45 06 00 00 call 3e6a <fork>
if(pid == 0){
3825: 83 c4 10 add $0x10,%esp
3828: 85 c0 test %eax,%eax
382a: 74 43 je 386f <bigargtest+0x5f>
} else if(pid < 0){
382c: 0f 88 d8 00 00 00 js 390a <bigargtest+0xfa>
wait(null);
3832: 83 ec 0c sub $0xc,%esp
3835: 6a 00 push $0x0
3837: e8 3e 06 00 00 call 3e7a <wait>
fd = open("bigarg-ok", 0);
383c: 5a pop %edx
383d: 59 pop %ecx
383e: 6a 00 push $0x0
3840: 68 46 52 00 00 push $0x5246
3845: e8 68 06 00 00 call 3eb2 <open>
if(fd < 0){
384a: 83 c4 10 add $0x10,%esp
384d: 85 c0 test %eax,%eax
384f: 0f 88 97 00 00 00 js 38ec <bigargtest+0xdc>
close(fd);
3855: 83 ec 0c sub $0xc,%esp
3858: 50 push %eax
3859: e8 3c 06 00 00 call 3e9a <close>
unlink("bigarg-ok");
385e: c7 04 24 46 52 00 00 movl $0x5246,(%esp)
3865: e8 58 06 00 00 call 3ec2 <unlink>
}
386a: 83 c4 10 add $0x10,%esp
386d: c9 leave
386e: c3 ret
386f: b8 00 64 00 00 mov $0x6400,%eax
3874: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
args[i] = "bigargs test: failed\n ";
3878: c7 00 a0 59 00 00 movl $0x59a0,(%eax)
387e: 83 c0 04 add $0x4,%eax
for(i = 0; i < MAXARG-1; i++)
3881: 3d 7c 64 00 00 cmp $0x647c,%eax
3886: 75 f0 jne 3878 <bigargtest+0x68>
printf(stdout, "bigarg test\n");
3888: 50 push %eax
3889: 50 push %eax
388a: 68 50 52 00 00 push $0x5250
388f: ff 35 e8 63 00 00 pushl 0x63e8
args[MAXARG-1] = 0;
3895: c7 05 7c 64 00 00 00 movl $0x0,0x647c
389c: 00 00 00
printf(stdout, "bigarg test\n");
389f: e8 3c 07 00 00 call 3fe0 <printf>
exec("echo", args);
38a4: 58 pop %eax
38a5: 5a pop %edx
38a6: 68 00 64 00 00 push $0x6400
38ab: 68 1d 44 00 00 push $0x441d
38b0: e8 f5 05 00 00 call 3eaa <exec>
printf(stdout, "bigarg test ok\n");
38b5: 59 pop %ecx
38b6: 58 pop %eax
38b7: 68 5d 52 00 00 push $0x525d
38bc: ff 35 e8 63 00 00 pushl 0x63e8
38c2: e8 19 07 00 00 call 3fe0 <printf>
fd = open("bigarg-ok", O_CREATE);
38c7: 58 pop %eax
38c8: 5a pop %edx
38c9: 68 00 02 00 00 push $0x200
38ce: 68 46 52 00 00 push $0x5246
38d3: e8 da 05 00 00 call 3eb2 <open>
close(fd);
38d8: 89 04 24 mov %eax,(%esp)
38db: e8 ba 05 00 00 call 3e9a <close>
exit(0);
38e0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
38e7: e8 86 05 00 00 call 3e72 <exit>
printf(stdout, "bigarg test failed!\n");
38ec: 50 push %eax
38ed: 50 push %eax
38ee: 68 86 52 00 00 push $0x5286
38f3: ff 35 e8 63 00 00 pushl 0x63e8
38f9: e8 e2 06 00 00 call 3fe0 <printf>
exit(0);
38fe: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3905: e8 68 05 00 00 call 3e72 <exit>
printf(stdout, "bigargtest: fork failed\n");
390a: 50 push %eax
390b: 50 push %eax
390c: 68 6d 52 00 00 push $0x526d
3911: ff 35 e8 63 00 00 pushl 0x63e8
3917: e8 c4 06 00 00 call 3fe0 <printf>
exit(0);
391c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3923: e8 4a 05 00 00 call 3e72 <exit>
3928: 90 nop
3929: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003930 <fsfull>:
{
3930: 55 push %ebp
3931: 89 e5 mov %esp,%ebp
3933: 57 push %edi
3934: 56 push %esi
3935: 53 push %ebx
for(nfiles = 0; ; nfiles++){
3936: 31 db xor %ebx,%ebx
{
3938: 83 ec 54 sub $0x54,%esp
printf(1, "fsfull test\n");
393b: 68 9b 52 00 00 push $0x529b
3940: 6a 01 push $0x1
3942: e8 99 06 00 00 call 3fe0 <printf>
3947: 83 c4 10 add $0x10,%esp
394a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
name[1] = '0' + nfiles / 1000;
3950: b8 d3 4d 62 10 mov $0x10624dd3,%eax
name[3] = '0' + (nfiles % 100) / 10;
3955: b9 cd cc cc cc mov $0xcccccccd,%ecx
printf(1, "writing %s\n", name);
395a: 83 ec 04 sub $0x4,%esp
name[1] = '0' + nfiles / 1000;
395d: f7 e3 mul %ebx
name[0] = 'f';
395f: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[5] = '\0';
3963: c6 45 ad 00 movb $0x0,-0x53(%ebp)
name[1] = '0' + nfiles / 1000;
3967: c1 ea 06 shr $0x6,%edx
396a: 8d 42 30 lea 0x30(%edx),%eax
name[2] = '0' + (nfiles % 1000) / 100;
396d: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx
name[1] = '0' + nfiles / 1000;
3973: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
3976: 89 d8 mov %ebx,%eax
3978: 29 d0 sub %edx,%eax
397a: 89 c2 mov %eax,%edx
397c: b8 1f 85 eb 51 mov $0x51eb851f,%eax
3981: f7 e2 mul %edx
name[3] = '0' + (nfiles % 100) / 10;
3983: b8 1f 85 eb 51 mov $0x51eb851f,%eax
name[2] = '0' + (nfiles % 1000) / 100;
3988: c1 ea 05 shr $0x5,%edx
398b: 83 c2 30 add $0x30,%edx
398e: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
3991: f7 e3 mul %ebx
3993: 89 d8 mov %ebx,%eax
3995: c1 ea 05 shr $0x5,%edx
3998: 6b d2 64 imul $0x64,%edx,%edx
399b: 29 d0 sub %edx,%eax
399d: f7 e1 mul %ecx
name[4] = '0' + (nfiles % 10);
399f: 89 d8 mov %ebx,%eax
name[3] = '0' + (nfiles % 100) / 10;
39a1: c1 ea 03 shr $0x3,%edx
39a4: 83 c2 30 add $0x30,%edx
39a7: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
39aa: f7 e1 mul %ecx
39ac: 89 d9 mov %ebx,%ecx
39ae: c1 ea 03 shr $0x3,%edx
39b1: 8d 04 92 lea (%edx,%edx,4),%eax
39b4: 01 c0 add %eax,%eax
39b6: 29 c1 sub %eax,%ecx
39b8: 89 c8 mov %ecx,%eax
39ba: 83 c0 30 add $0x30,%eax
39bd: 88 45 ac mov %al,-0x54(%ebp)
printf(1, "writing %s\n", name);
39c0: 8d 45 a8 lea -0x58(%ebp),%eax
39c3: 50 push %eax
39c4: 68 a8 52 00 00 push $0x52a8
39c9: 6a 01 push $0x1
39cb: e8 10 06 00 00 call 3fe0 <printf>
int fd = open(name, O_CREATE|O_RDWR);
39d0: 58 pop %eax
39d1: 8d 45 a8 lea -0x58(%ebp),%eax
39d4: 5a pop %edx
39d5: 68 02 02 00 00 push $0x202
39da: 50 push %eax
39db: e8 d2 04 00 00 call 3eb2 <open>
if(fd < 0){
39e0: 83 c4 10 add $0x10,%esp
39e3: 85 c0 test %eax,%eax
int fd = open(name, O_CREATE|O_RDWR);
39e5: 89 c7 mov %eax,%edi
if(fd < 0){
39e7: 78 57 js 3a40 <fsfull+0x110>
int total = 0;
39e9: 31 f6 xor %esi,%esi
39eb: eb 05 jmp 39f2 <fsfull+0xc2>
39ed: 8d 76 00 lea 0x0(%esi),%esi
total += cc;
39f0: 01 c6 add %eax,%esi
int cc = write(fd, buf, 512);
39f2: 83 ec 04 sub $0x4,%esp
39f5: 68 00 02 00 00 push $0x200
39fa: 68 c0 8b 00 00 push $0x8bc0
39ff: 57 push %edi
3a00: e8 8d 04 00 00 call 3e92 <write>
if(cc < 512)
3a05: 83 c4 10 add $0x10,%esp
3a08: 3d ff 01 00 00 cmp $0x1ff,%eax
3a0d: 7f e1 jg 39f0 <fsfull+0xc0>
printf(1, "wrote %d bytes\n", total);
3a0f: 83 ec 04 sub $0x4,%esp
3a12: 56 push %esi
3a13: 68 c4 52 00 00 push $0x52c4
3a18: 6a 01 push $0x1
3a1a: e8 c1 05 00 00 call 3fe0 <printf>
close(fd);
3a1f: 89 3c 24 mov %edi,(%esp)
3a22: e8 73 04 00 00 call 3e9a <close>
if(total == 0)
3a27: 83 c4 10 add $0x10,%esp
3a2a: 85 f6 test %esi,%esi
3a2c: 74 28 je 3a56 <fsfull+0x126>
for(nfiles = 0; ; nfiles++){
3a2e: 83 c3 01 add $0x1,%ebx
3a31: e9 1a ff ff ff jmp 3950 <fsfull+0x20>
3a36: 8d 76 00 lea 0x0(%esi),%esi
3a39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
printf(1, "open %s failed\n", name);
3a40: 8d 45 a8 lea -0x58(%ebp),%eax
3a43: 83 ec 04 sub $0x4,%esp
3a46: 50 push %eax
3a47: 68 b4 52 00 00 push $0x52b4
3a4c: 6a 01 push $0x1
3a4e: e8 8d 05 00 00 call 3fe0 <printf>
break;
3a53: 83 c4 10 add $0x10,%esp
name[1] = '0' + nfiles / 1000;
3a56: bf d3 4d 62 10 mov $0x10624dd3,%edi
name[2] = '0' + (nfiles % 1000) / 100;
3a5b: be 1f 85 eb 51 mov $0x51eb851f,%esi
name[1] = '0' + nfiles / 1000;
3a60: 89 d8 mov %ebx,%eax
name[3] = '0' + (nfiles % 100) / 10;
3a62: b9 cd cc cc cc mov $0xcccccccd,%ecx
unlink(name);
3a67: 83 ec 0c sub $0xc,%esp
name[1] = '0' + nfiles / 1000;
3a6a: f7 e7 mul %edi
name[0] = 'f';
3a6c: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[5] = '\0';
3a70: c6 45 ad 00 movb $0x0,-0x53(%ebp)
name[1] = '0' + nfiles / 1000;
3a74: c1 ea 06 shr $0x6,%edx
3a77: 8d 42 30 lea 0x30(%edx),%eax
name[2] = '0' + (nfiles % 1000) / 100;
3a7a: 69 d2 e8 03 00 00 imul $0x3e8,%edx,%edx
name[1] = '0' + nfiles / 1000;
3a80: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
3a83: 89 d8 mov %ebx,%eax
3a85: 29 d0 sub %edx,%eax
3a87: f7 e6 mul %esi
name[3] = '0' + (nfiles % 100) / 10;
3a89: 89 d8 mov %ebx,%eax
name[2] = '0' + (nfiles % 1000) / 100;
3a8b: c1 ea 05 shr $0x5,%edx
3a8e: 83 c2 30 add $0x30,%edx
3a91: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
3a94: f7 e6 mul %esi
3a96: 89 d8 mov %ebx,%eax
3a98: c1 ea 05 shr $0x5,%edx
3a9b: 6b d2 64 imul $0x64,%edx,%edx
3a9e: 29 d0 sub %edx,%eax
3aa0: f7 e1 mul %ecx
name[4] = '0' + (nfiles % 10);
3aa2: 89 d8 mov %ebx,%eax
name[3] = '0' + (nfiles % 100) / 10;
3aa4: c1 ea 03 shr $0x3,%edx
3aa7: 83 c2 30 add $0x30,%edx
3aaa: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
3aad: f7 e1 mul %ecx
3aaf: 89 d9 mov %ebx,%ecx
nfiles--;
3ab1: 83 eb 01 sub $0x1,%ebx
name[4] = '0' + (nfiles % 10);
3ab4: c1 ea 03 shr $0x3,%edx
3ab7: 8d 04 92 lea (%edx,%edx,4),%eax
3aba: 01 c0 add %eax,%eax
3abc: 29 c1 sub %eax,%ecx
3abe: 89 c8 mov %ecx,%eax
3ac0: 83 c0 30 add $0x30,%eax
3ac3: 88 45 ac mov %al,-0x54(%ebp)
unlink(name);
3ac6: 8d 45 a8 lea -0x58(%ebp),%eax
3ac9: 50 push %eax
3aca: e8 f3 03 00 00 call 3ec2 <unlink>
while(nfiles >= 0){
3acf: 83 c4 10 add $0x10,%esp
3ad2: 83 fb ff cmp $0xffffffff,%ebx
3ad5: 75 89 jne 3a60 <fsfull+0x130>
printf(1, "fsfull test finished\n");
3ad7: 83 ec 08 sub $0x8,%esp
3ada: 68 d4 52 00 00 push $0x52d4
3adf: 6a 01 push $0x1
3ae1: e8 fa 04 00 00 call 3fe0 <printf>
}
3ae6: 83 c4 10 add $0x10,%esp
3ae9: 8d 65 f4 lea -0xc(%ebp),%esp
3aec: 5b pop %ebx
3aed: 5e pop %esi
3aee: 5f pop %edi
3aef: 5d pop %ebp
3af0: c3 ret
3af1: eb 0d jmp 3b00 <uio>
3af3: 90 nop
3af4: 90 nop
3af5: 90 nop
3af6: 90 nop
3af7: 90 nop
3af8: 90 nop
3af9: 90 nop
3afa: 90 nop
3afb: 90 nop
3afc: 90 nop
3afd: 90 nop
3afe: 90 nop
3aff: 90 nop
00003b00 <uio>:
{
3b00: 55 push %ebp
3b01: 89 e5 mov %esp,%ebp
3b03: 83 ec 10 sub $0x10,%esp
printf(1, "uio test\n");
3b06: 68 ea 52 00 00 push $0x52ea
3b0b: 6a 01 push $0x1
3b0d: e8 ce 04 00 00 call 3fe0 <printf>
pid = fork();
3b12: e8 53 03 00 00 call 3e6a <fork>
if(pid == 0){
3b17: 83 c4 10 add $0x10,%esp
3b1a: 85 c0 test %eax,%eax
3b1c: 74 1f je 3b3d <uio+0x3d>
} else if(pid < 0){
3b1e: 78 48 js 3b68 <uio+0x68>
wait(null);
3b20: 83 ec 0c sub $0xc,%esp
3b23: 6a 00 push $0x0
3b25: e8 50 03 00 00 call 3e7a <wait>
printf(1, "uio test done\n");
3b2a: 58 pop %eax
3b2b: 5a pop %edx
3b2c: 68 f4 52 00 00 push $0x52f4
3b31: 6a 01 push $0x1
3b33: e8 a8 04 00 00 call 3fe0 <printf>
}
3b38: 83 c4 10 add $0x10,%esp
3b3b: c9 leave
3b3c: c3 ret
asm volatile("outb %0,%1"::"a"(val), "d" (port));
3b3d: b8 09 00 00 00 mov $0x9,%eax
3b42: ba 70 00 00 00 mov $0x70,%edx
3b47: ee out %al,(%dx)
asm volatile("inb %1,%0" : "=a" (val) : "d" (port));
3b48: ba 71 00 00 00 mov $0x71,%edx
3b4d: ec in (%dx),%al
printf(1, "uio: uio succeeded; test FAILED\n");
3b4e: 50 push %eax
3b4f: 50 push %eax
3b50: 68 80 5a 00 00 push $0x5a80
3b55: 6a 01 push $0x1
3b57: e8 84 04 00 00 call 3fe0 <printf>
exit(0);
3b5c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3b63: e8 0a 03 00 00 call 3e72 <exit>
printf (1, "fork failed\n");
3b68: 51 push %ecx
3b69: 51 push %ecx
3b6a: 68 79 52 00 00 push $0x5279
3b6f: 6a 01 push $0x1
3b71: e8 6a 04 00 00 call 3fe0 <printf>
exit(0);
3b76: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3b7d: e8 f0 02 00 00 call 3e72 <exit>
3b82: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3b89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003b90 <argptest>:
{
3b90: 55 push %ebp
3b91: 89 e5 mov %esp,%ebp
3b93: 53 push %ebx
3b94: 83 ec 0c sub $0xc,%esp
fd = open("init", O_RDONLY);
3b97: 6a 00 push $0x0
3b99: 68 03 53 00 00 push $0x5303
3b9e: e8 0f 03 00 00 call 3eb2 <open>
if (fd < 0) {
3ba3: 83 c4 10 add $0x10,%esp
3ba6: 85 c0 test %eax,%eax
3ba8: 78 39 js 3be3 <argptest+0x53>
read(fd, sbrk(0) - 1, -1);
3baa: 83 ec 0c sub $0xc,%esp
3bad: 89 c3 mov %eax,%ebx
3baf: 6a 00 push $0x0
3bb1: e8 44 03 00 00 call 3efa <sbrk>
3bb6: 83 c4 0c add $0xc,%esp
3bb9: 83 e8 01 sub $0x1,%eax
3bbc: 6a ff push $0xffffffff
3bbe: 50 push %eax
3bbf: 53 push %ebx
3bc0: e8 c5 02 00 00 call 3e8a <read>
close(fd);
3bc5: 89 1c 24 mov %ebx,(%esp)
3bc8: e8 cd 02 00 00 call 3e9a <close>
printf(1, "arg test passed\n");
3bcd: 58 pop %eax
3bce: 5a pop %edx
3bcf: 68 15 53 00 00 push $0x5315
3bd4: 6a 01 push $0x1
3bd6: e8 05 04 00 00 call 3fe0 <printf>
}
3bdb: 83 c4 10 add $0x10,%esp
3bde: 8b 5d fc mov -0x4(%ebp),%ebx
3be1: c9 leave
3be2: c3 ret
printf(2, "open failed\n");
3be3: 51 push %ecx
3be4: 51 push %ecx
3be5: 68 08 53 00 00 push $0x5308
3bea: 6a 02 push $0x2
3bec: e8 ef 03 00 00 call 3fe0 <printf>
exit(0);
3bf1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3bf8: e8 75 02 00 00 call 3e72 <exit>
3bfd: 8d 76 00 lea 0x0(%esi),%esi
00003c00 <rand>:
randstate = randstate * 1664525 + 1013904223;
3c00: 69 05 e4 63 00 00 0d imul $0x19660d,0x63e4,%eax
3c07: 66 19 00
{
3c0a: 55 push %ebp
3c0b: 89 e5 mov %esp,%ebp
}
3c0d: 5d pop %ebp
randstate = randstate * 1664525 + 1013904223;
3c0e: 05 5f f3 6e 3c add $0x3c6ef35f,%eax
3c13: a3 e4 63 00 00 mov %eax,0x63e4
}
3c18: c3 ret
3c19: 66 90 xchg %ax,%ax
3c1b: 66 90 xchg %ax,%ax
3c1d: 66 90 xchg %ax,%ax
3c1f: 90 nop
00003c20 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
3c20: 55 push %ebp
3c21: 89 e5 mov %esp,%ebp
3c23: 53 push %ebx
3c24: 8b 45 08 mov 0x8(%ebp),%eax
3c27: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
3c2a: 89 c2 mov %eax,%edx
3c2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3c30: 83 c1 01 add $0x1,%ecx
3c33: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
3c37: 83 c2 01 add $0x1,%edx
3c3a: 84 db test %bl,%bl
3c3c: 88 5a ff mov %bl,-0x1(%edx)
3c3f: 75 ef jne 3c30 <strcpy+0x10>
;
return os;
}
3c41: 5b pop %ebx
3c42: 5d pop %ebp
3c43: c3 ret
3c44: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3c4a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00003c50 <strcmp>:
int
strcmp(const char *p, const char *q)
{
3c50: 55 push %ebp
3c51: 89 e5 mov %esp,%ebp
3c53: 53 push %ebx
3c54: 8b 55 08 mov 0x8(%ebp),%edx
3c57: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
3c5a: 0f b6 02 movzbl (%edx),%eax
3c5d: 0f b6 19 movzbl (%ecx),%ebx
3c60: 84 c0 test %al,%al
3c62: 75 1c jne 3c80 <strcmp+0x30>
3c64: eb 2a jmp 3c90 <strcmp+0x40>
3c66: 8d 76 00 lea 0x0(%esi),%esi
3c69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
3c70: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
3c73: 0f b6 02 movzbl (%edx),%eax
p++, q++;
3c76: 83 c1 01 add $0x1,%ecx
3c79: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
3c7c: 84 c0 test %al,%al
3c7e: 74 10 je 3c90 <strcmp+0x40>
3c80: 38 d8 cmp %bl,%al
3c82: 74 ec je 3c70 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
3c84: 29 d8 sub %ebx,%eax
}
3c86: 5b pop %ebx
3c87: 5d pop %ebp
3c88: c3 ret
3c89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3c90: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
3c92: 29 d8 sub %ebx,%eax
}
3c94: 5b pop %ebx
3c95: 5d pop %ebp
3c96: c3 ret
3c97: 89 f6 mov %esi,%esi
3c99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003ca0 <strlen>:
uint
strlen(const char *s)
{
3ca0: 55 push %ebp
3ca1: 89 e5 mov %esp,%ebp
3ca3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
3ca6: 80 39 00 cmpb $0x0,(%ecx)
3ca9: 74 15 je 3cc0 <strlen+0x20>
3cab: 31 d2 xor %edx,%edx
3cad: 8d 76 00 lea 0x0(%esi),%esi
3cb0: 83 c2 01 add $0x1,%edx
3cb3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
3cb7: 89 d0 mov %edx,%eax
3cb9: 75 f5 jne 3cb0 <strlen+0x10>
;
return n;
}
3cbb: 5d pop %ebp
3cbc: c3 ret
3cbd: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
3cc0: 31 c0 xor %eax,%eax
}
3cc2: 5d pop %ebp
3cc3: c3 ret
3cc4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3cca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00003cd0 <memset>:
void*
memset(void *dst, int c, uint n)
{
3cd0: 55 push %ebp
3cd1: 89 e5 mov %esp,%ebp
3cd3: 57 push %edi
3cd4: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
3cd7: 8b 4d 10 mov 0x10(%ebp),%ecx
3cda: 8b 45 0c mov 0xc(%ebp),%eax
3cdd: 89 d7 mov %edx,%edi
3cdf: fc cld
3ce0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
3ce2: 89 d0 mov %edx,%eax
3ce4: 5f pop %edi
3ce5: 5d pop %ebp
3ce6: c3 ret
3ce7: 89 f6 mov %esi,%esi
3ce9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003cf0 <strchr>:
char*
strchr(const char *s, char c)
{
3cf0: 55 push %ebp
3cf1: 89 e5 mov %esp,%ebp
3cf3: 53 push %ebx
3cf4: 8b 45 08 mov 0x8(%ebp),%eax
3cf7: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
3cfa: 0f b6 10 movzbl (%eax),%edx
3cfd: 84 d2 test %dl,%dl
3cff: 74 1d je 3d1e <strchr+0x2e>
if(*s == c)
3d01: 38 d3 cmp %dl,%bl
3d03: 89 d9 mov %ebx,%ecx
3d05: 75 0d jne 3d14 <strchr+0x24>
3d07: eb 17 jmp 3d20 <strchr+0x30>
3d09: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3d10: 38 ca cmp %cl,%dl
3d12: 74 0c je 3d20 <strchr+0x30>
for(; *s; s++)
3d14: 83 c0 01 add $0x1,%eax
3d17: 0f b6 10 movzbl (%eax),%edx
3d1a: 84 d2 test %dl,%dl
3d1c: 75 f2 jne 3d10 <strchr+0x20>
return (char*)s;
return 0;
3d1e: 31 c0 xor %eax,%eax
}
3d20: 5b pop %ebx
3d21: 5d pop %ebp
3d22: c3 ret
3d23: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3d29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003d30 <gets>:
char*
gets(char *buf, int max)
{
3d30: 55 push %ebp
3d31: 89 e5 mov %esp,%ebp
3d33: 57 push %edi
3d34: 56 push %esi
3d35: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
3d36: 31 f6 xor %esi,%esi
3d38: 89 f3 mov %esi,%ebx
{
3d3a: 83 ec 1c sub $0x1c,%esp
3d3d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
3d40: eb 2f jmp 3d71 <gets+0x41>
3d42: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
3d48: 8d 45 e7 lea -0x19(%ebp),%eax
3d4b: 83 ec 04 sub $0x4,%esp
3d4e: 6a 01 push $0x1
3d50: 50 push %eax
3d51: 6a 00 push $0x0
3d53: e8 32 01 00 00 call 3e8a <read>
if(cc < 1)
3d58: 83 c4 10 add $0x10,%esp
3d5b: 85 c0 test %eax,%eax
3d5d: 7e 1c jle 3d7b <gets+0x4b>
break;
buf[i++] = c;
3d5f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
3d63: 83 c7 01 add $0x1,%edi
3d66: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
3d69: 3c 0a cmp $0xa,%al
3d6b: 74 23 je 3d90 <gets+0x60>
3d6d: 3c 0d cmp $0xd,%al
3d6f: 74 1f je 3d90 <gets+0x60>
for(i=0; i+1 < max; ){
3d71: 83 c3 01 add $0x1,%ebx
3d74: 3b 5d 0c cmp 0xc(%ebp),%ebx
3d77: 89 fe mov %edi,%esi
3d79: 7c cd jl 3d48 <gets+0x18>
3d7b: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
3d7d: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
3d80: c6 03 00 movb $0x0,(%ebx)
}
3d83: 8d 65 f4 lea -0xc(%ebp),%esp
3d86: 5b pop %ebx
3d87: 5e pop %esi
3d88: 5f pop %edi
3d89: 5d pop %ebp
3d8a: c3 ret
3d8b: 90 nop
3d8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3d90: 8b 75 08 mov 0x8(%ebp),%esi
3d93: 8b 45 08 mov 0x8(%ebp),%eax
3d96: 01 de add %ebx,%esi
3d98: 89 f3 mov %esi,%ebx
buf[i] = '\0';
3d9a: c6 03 00 movb $0x0,(%ebx)
}
3d9d: 8d 65 f4 lea -0xc(%ebp),%esp
3da0: 5b pop %ebx
3da1: 5e pop %esi
3da2: 5f pop %edi
3da3: 5d pop %ebp
3da4: c3 ret
3da5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3da9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003db0 <stat>:
int
stat(const char *n, struct stat *st)
{
3db0: 55 push %ebp
3db1: 89 e5 mov %esp,%ebp
3db3: 56 push %esi
3db4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
3db5: 83 ec 08 sub $0x8,%esp
3db8: 6a 00 push $0x0
3dba: ff 75 08 pushl 0x8(%ebp)
3dbd: e8 f0 00 00 00 call 3eb2 <open>
if(fd < 0)
3dc2: 83 c4 10 add $0x10,%esp
3dc5: 85 c0 test %eax,%eax
3dc7: 78 27 js 3df0 <stat+0x40>
return -1;
r = fstat(fd, st);
3dc9: 83 ec 08 sub $0x8,%esp
3dcc: ff 75 0c pushl 0xc(%ebp)
3dcf: 89 c3 mov %eax,%ebx
3dd1: 50 push %eax
3dd2: e8 f3 00 00 00 call 3eca <fstat>
close(fd);
3dd7: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
3dda: 89 c6 mov %eax,%esi
close(fd);
3ddc: e8 b9 00 00 00 call 3e9a <close>
return r;
3de1: 83 c4 10 add $0x10,%esp
}
3de4: 8d 65 f8 lea -0x8(%ebp),%esp
3de7: 89 f0 mov %esi,%eax
3de9: 5b pop %ebx
3dea: 5e pop %esi
3deb: 5d pop %ebp
3dec: c3 ret
3ded: 8d 76 00 lea 0x0(%esi),%esi
return -1;
3df0: be ff ff ff ff mov $0xffffffff,%esi
3df5: eb ed jmp 3de4 <stat+0x34>
3df7: 89 f6 mov %esi,%esi
3df9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003e00 <atoi>:
int
atoi(const char *s)
{
3e00: 55 push %ebp
3e01: 89 e5 mov %esp,%ebp
3e03: 53 push %ebx
3e04: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
3e07: 0f be 11 movsbl (%ecx),%edx
3e0a: 8d 42 d0 lea -0x30(%edx),%eax
3e0d: 3c 09 cmp $0x9,%al
n = 0;
3e0f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
3e14: 77 1f ja 3e35 <atoi+0x35>
3e16: 8d 76 00 lea 0x0(%esi),%esi
3e19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
3e20: 8d 04 80 lea (%eax,%eax,4),%eax
3e23: 83 c1 01 add $0x1,%ecx
3e26: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
3e2a: 0f be 11 movsbl (%ecx),%edx
3e2d: 8d 5a d0 lea -0x30(%edx),%ebx
3e30: 80 fb 09 cmp $0x9,%bl
3e33: 76 eb jbe 3e20 <atoi+0x20>
return n;
}
3e35: 5b pop %ebx
3e36: 5d pop %ebp
3e37: c3 ret
3e38: 90 nop
3e39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003e40 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
3e40: 55 push %ebp
3e41: 89 e5 mov %esp,%ebp
3e43: 56 push %esi
3e44: 53 push %ebx
3e45: 8b 5d 10 mov 0x10(%ebp),%ebx
3e48: 8b 45 08 mov 0x8(%ebp),%eax
3e4b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
3e4e: 85 db test %ebx,%ebx
3e50: 7e 14 jle 3e66 <memmove+0x26>
3e52: 31 d2 xor %edx,%edx
3e54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
3e58: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
3e5c: 88 0c 10 mov %cl,(%eax,%edx,1)
3e5f: 83 c2 01 add $0x1,%edx
while(n-- > 0)
3e62: 39 d3 cmp %edx,%ebx
3e64: 75 f2 jne 3e58 <memmove+0x18>
return vdst;
}
3e66: 5b pop %ebx
3e67: 5e pop %esi
3e68: 5d pop %ebp
3e69: c3 ret
00003e6a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
3e6a: b8 01 00 00 00 mov $0x1,%eax
3e6f: cd 40 int $0x40
3e71: c3 ret
00003e72 <exit>:
SYSCALL(exit)
3e72: b8 02 00 00 00 mov $0x2,%eax
3e77: cd 40 int $0x40
3e79: c3 ret
00003e7a <wait>:
SYSCALL(wait)
3e7a: b8 03 00 00 00 mov $0x3,%eax
3e7f: cd 40 int $0x40
3e81: c3 ret
00003e82 <pipe>:
SYSCALL(pipe)
3e82: b8 04 00 00 00 mov $0x4,%eax
3e87: cd 40 int $0x40
3e89: c3 ret
00003e8a <read>:
SYSCALL(read)
3e8a: b8 05 00 00 00 mov $0x5,%eax
3e8f: cd 40 int $0x40
3e91: c3 ret
00003e92 <write>:
SYSCALL(write)
3e92: b8 10 00 00 00 mov $0x10,%eax
3e97: cd 40 int $0x40
3e99: c3 ret
00003e9a <close>:
SYSCALL(close)
3e9a: b8 15 00 00 00 mov $0x15,%eax
3e9f: cd 40 int $0x40
3ea1: c3 ret
00003ea2 <kill>:
SYSCALL(kill)
3ea2: b8 06 00 00 00 mov $0x6,%eax
3ea7: cd 40 int $0x40
3ea9: c3 ret
00003eaa <exec>:
SYSCALL(exec)
3eaa: b8 07 00 00 00 mov $0x7,%eax
3eaf: cd 40 int $0x40
3eb1: c3 ret
00003eb2 <open>:
SYSCALL(open)
3eb2: b8 0f 00 00 00 mov $0xf,%eax
3eb7: cd 40 int $0x40
3eb9: c3 ret
00003eba <mknod>:
SYSCALL(mknod)
3eba: b8 11 00 00 00 mov $0x11,%eax
3ebf: cd 40 int $0x40
3ec1: c3 ret
00003ec2 <unlink>:
SYSCALL(unlink)
3ec2: b8 12 00 00 00 mov $0x12,%eax
3ec7: cd 40 int $0x40
3ec9: c3 ret
00003eca <fstat>:
SYSCALL(fstat)
3eca: b8 08 00 00 00 mov $0x8,%eax
3ecf: cd 40 int $0x40
3ed1: c3 ret
00003ed2 <link>:
SYSCALL(link)
3ed2: b8 13 00 00 00 mov $0x13,%eax
3ed7: cd 40 int $0x40
3ed9: c3 ret
00003eda <mkdir>:
SYSCALL(mkdir)
3eda: b8 14 00 00 00 mov $0x14,%eax
3edf: cd 40 int $0x40
3ee1: c3 ret
00003ee2 <chdir>:
SYSCALL(chdir)
3ee2: b8 09 00 00 00 mov $0x9,%eax
3ee7: cd 40 int $0x40
3ee9: c3 ret
00003eea <dup>:
SYSCALL(dup)
3eea: b8 0a 00 00 00 mov $0xa,%eax
3eef: cd 40 int $0x40
3ef1: c3 ret
00003ef2 <getpid>:
SYSCALL(getpid)
3ef2: b8 0b 00 00 00 mov $0xb,%eax
3ef7: cd 40 int $0x40
3ef9: c3 ret
00003efa <sbrk>:
SYSCALL(sbrk)
3efa: b8 0c 00 00 00 mov $0xc,%eax
3eff: cd 40 int $0x40
3f01: c3 ret
00003f02 <sleep>:
SYSCALL(sleep)
3f02: b8 0d 00 00 00 mov $0xd,%eax
3f07: cd 40 int $0x40
3f09: c3 ret
00003f0a <uptime>:
SYSCALL(uptime)
3f0a: b8 0e 00 00 00 mov $0xe,%eax
3f0f: cd 40 int $0x40
3f11: c3 ret
00003f12 <memsize>:
SYSCALL(memsize)
3f12: b8 16 00 00 00 mov $0x16,%eax
3f17: cd 40 int $0x40
3f19: c3 ret
00003f1a <set_ps_priority>:
SYSCALL(set_ps_priority)
3f1a: b8 17 00 00 00 mov $0x17,%eax
3f1f: cd 40 int $0x40
3f21: c3 ret
00003f22 <set_cfs_priority>:
SYSCALL(set_cfs_priority)
3f22: b8 18 00 00 00 mov $0x18,%eax
3f27: cd 40 int $0x40
3f29: c3 ret
00003f2a <policy>:
SYSCALL(policy)
3f2a: b8 19 00 00 00 mov $0x19,%eax
3f2f: cd 40 int $0x40
3f31: c3 ret
00003f32 <proc_info>:
3f32: b8 1a 00 00 00 mov $0x1a,%eax
3f37: cd 40 int $0x40
3f39: c3 ret
3f3a: 66 90 xchg %ax,%ax
3f3c: 66 90 xchg %ax,%ax
3f3e: 66 90 xchg %ax,%ax
00003f40 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
3f40: 55 push %ebp
3f41: 89 e5 mov %esp,%ebp
3f43: 57 push %edi
3f44: 56 push %esi
3f45: 53 push %ebx
3f46: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
3f49: 85 d2 test %edx,%edx
{
3f4b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
3f4e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
3f50: 79 76 jns 3fc8 <printint+0x88>
3f52: f6 45 08 01 testb $0x1,0x8(%ebp)
3f56: 74 70 je 3fc8 <printint+0x88>
x = -xx;
3f58: f7 d8 neg %eax
neg = 1;
3f5a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
3f61: 31 f6 xor %esi,%esi
3f63: 8d 5d d7 lea -0x29(%ebp),%ebx
3f66: eb 0a jmp 3f72 <printint+0x32>
3f68: 90 nop
3f69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
3f70: 89 fe mov %edi,%esi
3f72: 31 d2 xor %edx,%edx
3f74: 8d 7e 01 lea 0x1(%esi),%edi
3f77: f7 f1 div %ecx
3f79: 0f b6 92 d8 5a 00 00 movzbl 0x5ad8(%edx),%edx
}while((x /= base) != 0);
3f80: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
3f82: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
3f85: 75 e9 jne 3f70 <printint+0x30>
if(neg)
3f87: 8b 45 c4 mov -0x3c(%ebp),%eax
3f8a: 85 c0 test %eax,%eax
3f8c: 74 08 je 3f96 <printint+0x56>
buf[i++] = '-';
3f8e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
3f93: 8d 7e 02 lea 0x2(%esi),%edi
3f96: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
3f9a: 8b 7d c0 mov -0x40(%ebp),%edi
3f9d: 8d 76 00 lea 0x0(%esi),%esi
3fa0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
3fa3: 83 ec 04 sub $0x4,%esp
3fa6: 83 ee 01 sub $0x1,%esi
3fa9: 6a 01 push $0x1
3fab: 53 push %ebx
3fac: 57 push %edi
3fad: 88 45 d7 mov %al,-0x29(%ebp)
3fb0: e8 dd fe ff ff call 3e92 <write>
while(--i >= 0)
3fb5: 83 c4 10 add $0x10,%esp
3fb8: 39 de cmp %ebx,%esi
3fba: 75 e4 jne 3fa0 <printint+0x60>
putc(fd, buf[i]);
}
3fbc: 8d 65 f4 lea -0xc(%ebp),%esp
3fbf: 5b pop %ebx
3fc0: 5e pop %esi
3fc1: 5f pop %edi
3fc2: 5d pop %ebp
3fc3: c3 ret
3fc4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
3fc8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
3fcf: eb 90 jmp 3f61 <printint+0x21>
3fd1: eb 0d jmp 3fe0 <printf>
3fd3: 90 nop
3fd4: 90 nop
3fd5: 90 nop
3fd6: 90 nop
3fd7: 90 nop
3fd8: 90 nop
3fd9: 90 nop
3fda: 90 nop
3fdb: 90 nop
3fdc: 90 nop
3fdd: 90 nop
3fde: 90 nop
3fdf: 90 nop
00003fe0 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
3fe0: 55 push %ebp
3fe1: 89 e5 mov %esp,%ebp
3fe3: 57 push %edi
3fe4: 56 push %esi
3fe5: 53 push %ebx
3fe6: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3fe9: 8b 75 0c mov 0xc(%ebp),%esi
3fec: 0f b6 1e movzbl (%esi),%ebx
3fef: 84 db test %bl,%bl
3ff1: 0f 84 b3 00 00 00 je 40aa <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
3ff7: 8d 45 10 lea 0x10(%ebp),%eax
3ffa: 83 c6 01 add $0x1,%esi
state = 0;
3ffd: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
3fff: 89 45 d4 mov %eax,-0x2c(%ebp)
4002: eb 2f jmp 4033 <printf+0x53>
4004: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
4008: 83 f8 25 cmp $0x25,%eax
400b: 0f 84 a7 00 00 00 je 40b8 <printf+0xd8>
write(fd, &c, 1);
4011: 8d 45 e2 lea -0x1e(%ebp),%eax
4014: 83 ec 04 sub $0x4,%esp
4017: 88 5d e2 mov %bl,-0x1e(%ebp)
401a: 6a 01 push $0x1
401c: 50 push %eax
401d: ff 75 08 pushl 0x8(%ebp)
4020: e8 6d fe ff ff call 3e92 <write>
4025: 83 c4 10 add $0x10,%esp
4028: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
402b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
402f: 84 db test %bl,%bl
4031: 74 77 je 40aa <printf+0xca>
if(state == 0){
4033: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
4035: 0f be cb movsbl %bl,%ecx
4038: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
403b: 74 cb je 4008 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
403d: 83 ff 25 cmp $0x25,%edi
4040: 75 e6 jne 4028 <printf+0x48>
if(c == 'd'){
4042: 83 f8 64 cmp $0x64,%eax
4045: 0f 84 05 01 00 00 je 4150 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
404b: 81 e1 f7 00 00 00 and $0xf7,%ecx
4051: 83 f9 70 cmp $0x70,%ecx
4054: 74 72 je 40c8 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
4056: 83 f8 73 cmp $0x73,%eax
4059: 0f 84 99 00 00 00 je 40f8 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
405f: 83 f8 63 cmp $0x63,%eax
4062: 0f 84 08 01 00 00 je 4170 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
4068: 83 f8 25 cmp $0x25,%eax
406b: 0f 84 ef 00 00 00 je 4160 <printf+0x180>
write(fd, &c, 1);
4071: 8d 45 e7 lea -0x19(%ebp),%eax
4074: 83 ec 04 sub $0x4,%esp
4077: c6 45 e7 25 movb $0x25,-0x19(%ebp)
407b: 6a 01 push $0x1
407d: 50 push %eax
407e: ff 75 08 pushl 0x8(%ebp)
4081: e8 0c fe ff ff call 3e92 <write>
4086: 83 c4 0c add $0xc,%esp
4089: 8d 45 e6 lea -0x1a(%ebp),%eax
408c: 88 5d e6 mov %bl,-0x1a(%ebp)
408f: 6a 01 push $0x1
4091: 50 push %eax
4092: ff 75 08 pushl 0x8(%ebp)
4095: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4098: 31 ff xor %edi,%edi
write(fd, &c, 1);
409a: e8 f3 fd ff ff call 3e92 <write>
for(i = 0; fmt[i]; i++){
409f: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
40a3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
40a6: 84 db test %bl,%bl
40a8: 75 89 jne 4033 <printf+0x53>
}
}
}
40aa: 8d 65 f4 lea -0xc(%ebp),%esp
40ad: 5b pop %ebx
40ae: 5e pop %esi
40af: 5f pop %edi
40b0: 5d pop %ebp
40b1: c3 ret
40b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
40b8: bf 25 00 00 00 mov $0x25,%edi
40bd: e9 66 ff ff ff jmp 4028 <printf+0x48>
40c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
40c8: 83 ec 0c sub $0xc,%esp
40cb: b9 10 00 00 00 mov $0x10,%ecx
40d0: 6a 00 push $0x0
40d2: 8b 7d d4 mov -0x2c(%ebp),%edi
40d5: 8b 45 08 mov 0x8(%ebp),%eax
40d8: 8b 17 mov (%edi),%edx
40da: e8 61 fe ff ff call 3f40 <printint>
ap++;
40df: 89 f8 mov %edi,%eax
40e1: 83 c4 10 add $0x10,%esp
state = 0;
40e4: 31 ff xor %edi,%edi
ap++;
40e6: 83 c0 04 add $0x4,%eax
40e9: 89 45 d4 mov %eax,-0x2c(%ebp)
40ec: e9 37 ff ff ff jmp 4028 <printf+0x48>
40f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
40f8: 8b 45 d4 mov -0x2c(%ebp),%eax
40fb: 8b 08 mov (%eax),%ecx
ap++;
40fd: 83 c0 04 add $0x4,%eax
4100: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
4103: 85 c9 test %ecx,%ecx
4105: 0f 84 8e 00 00 00 je 4199 <printf+0x1b9>
while(*s != 0){
410b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
410e: 31 ff xor %edi,%edi
s = (char*)*ap;
4110: 89 cb mov %ecx,%ebx
while(*s != 0){
4112: 84 c0 test %al,%al
4114: 0f 84 0e ff ff ff je 4028 <printf+0x48>
411a: 89 75 d0 mov %esi,-0x30(%ebp)
411d: 89 de mov %ebx,%esi
411f: 8b 5d 08 mov 0x8(%ebp),%ebx
4122: 8d 7d e3 lea -0x1d(%ebp),%edi
4125: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
4128: 83 ec 04 sub $0x4,%esp
s++;
412b: 83 c6 01 add $0x1,%esi
412e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
4131: 6a 01 push $0x1
4133: 57 push %edi
4134: 53 push %ebx
4135: e8 58 fd ff ff call 3e92 <write>
while(*s != 0){
413a: 0f b6 06 movzbl (%esi),%eax
413d: 83 c4 10 add $0x10,%esp
4140: 84 c0 test %al,%al
4142: 75 e4 jne 4128 <printf+0x148>
4144: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
4147: 31 ff xor %edi,%edi
4149: e9 da fe ff ff jmp 4028 <printf+0x48>
414e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
4150: 83 ec 0c sub $0xc,%esp
4153: b9 0a 00 00 00 mov $0xa,%ecx
4158: 6a 01 push $0x1
415a: e9 73 ff ff ff jmp 40d2 <printf+0xf2>
415f: 90 nop
write(fd, &c, 1);
4160: 83 ec 04 sub $0x4,%esp
4163: 88 5d e5 mov %bl,-0x1b(%ebp)
4166: 8d 45 e5 lea -0x1b(%ebp),%eax
4169: 6a 01 push $0x1
416b: e9 21 ff ff ff jmp 4091 <printf+0xb1>
putc(fd, *ap);
4170: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
4173: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
4176: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
4178: 6a 01 push $0x1
ap++;
417a: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
417d: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
4180: 8d 45 e4 lea -0x1c(%ebp),%eax
4183: 50 push %eax
4184: ff 75 08 pushl 0x8(%ebp)
4187: e8 06 fd ff ff call 3e92 <write>
ap++;
418c: 89 7d d4 mov %edi,-0x2c(%ebp)
418f: 83 c4 10 add $0x10,%esp
state = 0;
4192: 31 ff xor %edi,%edi
4194: e9 8f fe ff ff jmp 4028 <printf+0x48>
s = "(null)";
4199: bb d0 5a 00 00 mov $0x5ad0,%ebx
while(*s != 0){
419e: b8 28 00 00 00 mov $0x28,%eax
41a3: e9 72 ff ff ff jmp 411a <printf+0x13a>
41a8: 66 90 xchg %ax,%ax
41aa: 66 90 xchg %ax,%ax
41ac: 66 90 xchg %ax,%ax
41ae: 66 90 xchg %ax,%ax
000041b0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
41b0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
41b1: a1 80 64 00 00 mov 0x6480,%eax
{
41b6: 89 e5 mov %esp,%ebp
41b8: 57 push %edi
41b9: 56 push %esi
41ba: 53 push %ebx
41bb: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
41be: 8d 4b f8 lea -0x8(%ebx),%ecx
41c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
41c8: 39 c8 cmp %ecx,%eax
41ca: 8b 10 mov (%eax),%edx
41cc: 73 32 jae 4200 <free+0x50>
41ce: 39 d1 cmp %edx,%ecx
41d0: 72 04 jb 41d6 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
41d2: 39 d0 cmp %edx,%eax
41d4: 72 32 jb 4208 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
41d6: 8b 73 fc mov -0x4(%ebx),%esi
41d9: 8d 3c f1 lea (%ecx,%esi,8),%edi
41dc: 39 fa cmp %edi,%edx
41de: 74 30 je 4210 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
41e0: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
41e3: 8b 50 04 mov 0x4(%eax),%edx
41e6: 8d 34 d0 lea (%eax,%edx,8),%esi
41e9: 39 f1 cmp %esi,%ecx
41eb: 74 3a je 4227 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
41ed: 89 08 mov %ecx,(%eax)
freep = p;
41ef: a3 80 64 00 00 mov %eax,0x6480
}
41f4: 5b pop %ebx
41f5: 5e pop %esi
41f6: 5f pop %edi
41f7: 5d pop %ebp
41f8: c3 ret
41f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
4200: 39 d0 cmp %edx,%eax
4202: 72 04 jb 4208 <free+0x58>
4204: 39 d1 cmp %edx,%ecx
4206: 72 ce jb 41d6 <free+0x26>
{
4208: 89 d0 mov %edx,%eax
420a: eb bc jmp 41c8 <free+0x18>
420c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
4210: 03 72 04 add 0x4(%edx),%esi
4213: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
4216: 8b 10 mov (%eax),%edx
4218: 8b 12 mov (%edx),%edx
421a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
421d: 8b 50 04 mov 0x4(%eax),%edx
4220: 8d 34 d0 lea (%eax,%edx,8),%esi
4223: 39 f1 cmp %esi,%ecx
4225: 75 c6 jne 41ed <free+0x3d>
p->s.size += bp->s.size;
4227: 03 53 fc add -0x4(%ebx),%edx
freep = p;
422a: a3 80 64 00 00 mov %eax,0x6480
p->s.size += bp->s.size;
422f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
4232: 8b 53 f8 mov -0x8(%ebx),%edx
4235: 89 10 mov %edx,(%eax)
}
4237: 5b pop %ebx
4238: 5e pop %esi
4239: 5f pop %edi
423a: 5d pop %ebp
423b: c3 ret
423c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00004240 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
4240: 55 push %ebp
4241: 89 e5 mov %esp,%ebp
4243: 57 push %edi
4244: 56 push %esi
4245: 53 push %ebx
4246: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
4249: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
424c: 8b 15 80 64 00 00 mov 0x6480,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
4252: 8d 78 07 lea 0x7(%eax),%edi
4255: c1 ef 03 shr $0x3,%edi
4258: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
425b: 85 d2 test %edx,%edx
425d: 0f 84 9d 00 00 00 je 4300 <malloc+0xc0>
4263: 8b 02 mov (%edx),%eax
4265: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
4268: 39 cf cmp %ecx,%edi
426a: 76 6c jbe 42d8 <malloc+0x98>
426c: 81 ff 00 10 00 00 cmp $0x1000,%edi
4272: bb 00 10 00 00 mov $0x1000,%ebx
4277: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
427a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
4281: eb 0e jmp 4291 <malloc+0x51>
4283: 90 nop
4284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
4288: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
428a: 8b 48 04 mov 0x4(%eax),%ecx
428d: 39 f9 cmp %edi,%ecx
428f: 73 47 jae 42d8 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
4291: 39 05 80 64 00 00 cmp %eax,0x6480
4297: 89 c2 mov %eax,%edx
4299: 75 ed jne 4288 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
429b: 83 ec 0c sub $0xc,%esp
429e: 56 push %esi
429f: e8 56 fc ff ff call 3efa <sbrk>
if(p == (char*)-1)
42a4: 83 c4 10 add $0x10,%esp
42a7: 83 f8 ff cmp $0xffffffff,%eax
42aa: 74 1c je 42c8 <malloc+0x88>
hp->s.size = nu;
42ac: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
42af: 83 ec 0c sub $0xc,%esp
42b2: 83 c0 08 add $0x8,%eax
42b5: 50 push %eax
42b6: e8 f5 fe ff ff call 41b0 <free>
return freep;
42bb: 8b 15 80 64 00 00 mov 0x6480,%edx
if((p = morecore(nunits)) == 0)
42c1: 83 c4 10 add $0x10,%esp
42c4: 85 d2 test %edx,%edx
42c6: 75 c0 jne 4288 <malloc+0x48>
return 0;
}
}
42c8: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
42cb: 31 c0 xor %eax,%eax
}
42cd: 5b pop %ebx
42ce: 5e pop %esi
42cf: 5f pop %edi
42d0: 5d pop %ebp
42d1: c3 ret
42d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
42d8: 39 cf cmp %ecx,%edi
42da: 74 54 je 4330 <malloc+0xf0>
p->s.size -= nunits;
42dc: 29 f9 sub %edi,%ecx
42de: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
42e1: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
42e4: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
42e7: 89 15 80 64 00 00 mov %edx,0x6480
}
42ed: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
42f0: 83 c0 08 add $0x8,%eax
}
42f3: 5b pop %ebx
42f4: 5e pop %esi
42f5: 5f pop %edi
42f6: 5d pop %ebp
42f7: c3 ret
42f8: 90 nop
42f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
4300: c7 05 80 64 00 00 84 movl $0x6484,0x6480
4307: 64 00 00
430a: c7 05 84 64 00 00 84 movl $0x6484,0x6484
4311: 64 00 00
base.s.size = 0;
4314: b8 84 64 00 00 mov $0x6484,%eax
4319: c7 05 88 64 00 00 00 movl $0x0,0x6488
4320: 00 00 00
4323: e9 44 ff ff ff jmp 426c <malloc+0x2c>
4328: 90 nop
4329: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
4330: 8b 08 mov (%eax),%ecx
4332: 89 0a mov %ecx,(%edx)
4334: eb b1 jmp 42e7 <malloc+0xa7>
| 42.227535 | 240 | 0.433621 |
9c7e2f0d82a09addaaa7419842bb7e8d23f7e7ed | 2,536 | js | JavaScript | wp-content/themes/bimber/js/mycred-notifications.js | aniskchaou/BLOG-COMET-CMS | c1fbaeaffb4cdb62082049d7e76f0a10fcefe9c1 | [
"MIT"
] | null | null | null | wp-content/themes/bimber/js/mycred-notifications.js | aniskchaou/BLOG-COMET-CMS | c1fbaeaffb4cdb62082049d7e76f0a10fcefe9c1 | [
"MIT"
] | null | null | null | wp-content/themes/bimber/js/mycred-notifications.js | aniskchaou/BLOG-COMET-CMS | c1fbaeaffb4cdb62082049d7e76f0a10fcefe9c1 | [
"MIT"
] | null | null | null | /**************************
*
* MyCred Notifications
* (images, video)
*
**************************/
(function ($) {
'use strict';
g1.myCredNotifications = function () {
var setTimeoutForFirstNotification = function() {
if ( $('.g1-mycred-notice-overlay-standard').attr('data-g1-mycred-notice-timeout') && $('.g1-notification-standard').length > 0) {
var timeout = $('.g1-mycred-notice-overlay-standard').attr('data-g1-mycred-notice-timeout');
var firstNotification = $('.g1-notification-standard')[0];
setTimeout(function() {
firstNotification.remove();
setTimeoutForFirstNotification();
}, timeout * 1000);
}
};
var bindStandardNotificationEvents = function() {
if ($('.g1-mycred-notice-overlay').length > 0 || $('.g1-mycred-notice-overlay-standard').length < 1) {
return;
}
$('.g1-notification-standard-close').on('click', function (e) {
$(this).closest('.g1-notification-standard').remove();
setTimeoutForFirstNotification();
});
setTimeoutForFirstNotification();
};
$('.g1-mycred-notice-close').on('click', function (e) {
var $that = $(this);
$that.closest('.g1-mycred-notice-overlay').removeClass('g1-mycred-notice-overlay-visible');
setTimeout(function(){
$that.closest('g1-mycred-notice-overlay').remove();
bindStandardNotificationEvents();
}, 375);
});
$('.g1-mycred-notice-overlay').on('click', function (e) {
var $that = $(this);
$that.closest('.g1-mycred-notice-overlay').removeClass('g1-mycred-notice-overlay-visible');
setTimeout(function(){
$that.remove();
bindStandardNotificationEvents();
}, 375);
}).children().click(function(e) {
if (!$(e.target).hasClass('g1-mycred-notice-close') && !$(e.target).hasClass('g1-mycred-notice-share')){
return false;
}
});
bindStandardNotificationEvents();
var noticesTop = $('#wpadminbar').outerHeight() + $('.g1-sticky-top-wrapper').outerHeight();
$('.g1-mycred-notice-overlay-standard').css('top', noticesTop);
};
// Fire it up.
$(document).ready(function () {
g1.myCredNotifications();
});
})(jQuery);
| 36.753623 | 142 | 0.527208 |
8561285cd9f739f26b5399d928f0290177a627f2 | 1,328 | js | JavaScript | examples/naver-map-basic.js | jsdelivrbot/playground-4 | 5639675b31e29ca6c76698f3b778cc5d038484c2 | [
"BSD-2-Clause-FreeBSD"
] | 4 | 2019-01-24T06:05:34.000Z | 2021-10-20T06:09:57.000Z | examples/naver-map-basic.js | jsdelivrbot/playground-4 | 5639675b31e29ca6c76698f3b778cc5d038484c2 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | examples/naver-map-basic.js | jsdelivrbot/playground-4 | 5639675b31e29ca6c76698f3b778cc5d038484c2 | [
"BSD-2-Clause-FreeBSD"
] | 1 | 2018-12-09T04:07:28.000Z | 2018-12-09T04:07:28.000Z | const map = new naver.maps.Map('map', {
center: new naver.maps.LatLng(37.5666805, 126.9784147),
zoom: 4
});
const jeju = new naver.maps.LatLng(33.3590628, 126.534361),
busan = new naver.maps.LatLng(35.1797865, 129.0750194),
dokdo = new naver.maps.LatLngBounds(
new naver.maps.LatLng(37.2380651, 131.8562652),
new naver.maps.LatLng(37.2444436, 131.8786475)),
seoul = new naver.maps.LatLngBounds(
new naver.maps.LatLng(37.42829747263545, 126.76620435615891),
new naver.maps.LatLng(37.7010174173061, 127.18379493229875));
document.querySelector("#to-jeju").addEventListener("click", function (e) {
e.preventDefault();
map.setCenter(jeju);
});
document.querySelector("#to-1").addEventListener("click", function (e) {
e.preventDefault();
map.setZoom(1, true);
});
document.querySelector("#to-dokdo").addEventListener("click", function (e) {
e.preventDefault();
map.fitBounds(dokdo);
});
document.querySelector("#to-busan").addEventListener("click", function (e) {
e.preventDefault();
map.panTo(busan);
});
document.querySelector("#to-seoul").addEventListener("click", function (e) {
e.preventDefault();
map.panToBounds(seoul);
});
document.querySelector("#panBy").addEventListener("click", function (e) {
e.preventDefault();
map.panBy(new naver.maps.Point(10, 10));
});
| 26.56 | 76 | 0.703313 |
7407f9c5ee50604ced7ac61bf921dabc9fbd236f | 2,317 | h | C | speedplugin.h | XMuli/lfxSpeed | 1bc58d743df9f00e034a9f9e17528dd5a897274e | [
"MIT"
] | null | null | null | speedplugin.h | XMuli/lfxSpeed | 1bc58d743df9f00e034a9f9e17528dd5a897274e | [
"MIT"
] | null | null | null | speedplugin.h | XMuli/lfxSpeed | 1bc58d743df9f00e034a9f9e17528dd5a897274e | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2020 xmuli
*
* Author: xmuli(偕臧) xmulitech@gmail.com
* GitHub: https://github.com/xmuli
*
* 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.
* */
#ifndef SPEEDPLUGIN_H
#define SPEEDPLUGIN_H
#include <QObject>
#include <DLabel>
#include "pluginsiteminterface.h"
#include "dtkwidget_global.h"
#include "dlabel.h"
class QTimer;
class SpeedInfo;
class WinMain;
class SpeedWidget;
class SettingModel;
DWIDGET_USE_NAMESPACE
class SpeedPlugin : public QObject, public PluginsItemInterface
{
Q_OBJECT
Q_INTERFACES(PluginsItemInterface) // 声明实现了的接口
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "lfxSpeed.json") // 插件元数据
public:
explicit SpeedPlugin(QObject *parent = nullptr);
// 插件必须重写函数
virtual const QString pluginName() const override;
virtual void init(PluginProxyInterface *proxyInter) override;
virtual QWidget *itemWidget(const QString &itemKey) override;
// 插件禁用和启用相关的接口
virtual bool pluginIsAllowDisable() override;
virtual bool pluginIsDisable() override;
virtual void pluginStateSwitched() override;
virtual const QString pluginDisplayName() const override;
virtual const QString itemContextMenu(const QString &itemKey) override;
virtual void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
virtual QWidget *itemTipsWidget(const QString &itemKey) override;
signals:
void labUpload(const QString &labUpload);
public slots:
void onUpdateTip();
void onMouseTip(int status);
private:
PluginProxyInterface *m_proxyInter;
SpeedWidget *m_speedWidget;
WinMain *m_winMain;
SettingModel *m_model;
DLabel m_labTip;
QTimer m_timer;
bool m_bMouseTip;
};
#endif // SPEEDPLUGIN_H
| 29.705128 | 109 | 0.754855 |
59624c82ea6a9ad7dd4f7de12548234493c930c0 | 701 | h | C | aws-cpp-sdk-dataexchange/include/aws/dataexchange/model/ExceptionCause.h | perfectrecall/aws-sdk-cpp | fb8cbebf2fd62720b65aeff841ad2950e73d8ebd | [
"Apache-2.0"
] | 1 | 2022-02-12T08:09:30.000Z | 2022-02-12T08:09:30.000Z | aws-cpp-sdk-dataexchange/include/aws/dataexchange/model/ExceptionCause.h | perfectrecall/aws-sdk-cpp | fb8cbebf2fd62720b65aeff841ad2950e73d8ebd | [
"Apache-2.0"
] | 1 | 2021-10-14T16:57:00.000Z | 2021-10-18T10:47:24.000Z | aws-cpp-sdk-dataexchange/include/aws/dataexchange/model/ExceptionCause.h | ravindra-wagh/aws-sdk-cpp | 7d5ff01b3c3b872f31ca98fb4ce868cd01e97696 | [
"Apache-2.0"
] | 1 | 2021-11-09T11:58:03.000Z | 2021-11-09T11:58:03.000Z | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/dataexchange/DataExchange_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace DataExchange
{
namespace Model
{
enum class ExceptionCause
{
NOT_SET,
InsufficientS3BucketPolicy,
S3AccessDenied
};
namespace ExceptionCauseMapper
{
AWS_DATAEXCHANGE_API ExceptionCause GetExceptionCauseForName(const Aws::String& name);
AWS_DATAEXCHANGE_API Aws::String GetNameForExceptionCause(ExceptionCause value);
} // namespace ExceptionCauseMapper
} // namespace Model
} // namespace DataExchange
} // namespace Aws
| 21.90625 | 86 | 0.774608 |
2667b4188c781f9f553c97a40fc825a3f8c3750f | 51,106 | java | Java | corpus/norm-class/eclipse.jdt.core/5028.java | masud-technope/ACER-Replication-Package-ASE2017 | cb7318a729eb1403004d451a164c851af2d81f7a | [
"MIT"
] | null | null | null | corpus/norm-class/eclipse.jdt.core/5028.java | masud-technope/ACER-Replication-Package-ASE2017 | cb7318a729eb1403004d451a164c851af2d81f7a | [
"MIT"
] | null | null | null | corpus/norm-class/eclipse.jdt.core/5028.java | masud-technope/ACER-Replication-Package-ASE2017 | cb7318a729eb1403004d451a164c851af2d81f7a | [
"MIT"
] | null | null | null | copyright ibm corporation rights reserved program accompanying materials terms eclipse license accompanies distribution http eclipse org legal epl html contributors ibm corporation initial api implementation org eclipse jdt internal core dom rewrite java util list org eclipse jdt core dom org eclipse jdt internal compiler util util suppress warnings suppresswarnings rawtypes ast rewrite flattener astrewriteflattener ast visitor astvisitor deprecated deprecated code child property descriptor childpropertydescriptor internal array component type property array type arraytype component type property deprecated deprecated code simple property descriptor simplepropertydescriptor internal field modifiers property field declaration fielddeclaration modifiers property deprecated deprecated code simple property descriptor simplepropertydescriptor internal initializer modifiers property initializer modifiers property deprecated deprecated code simple property descriptor simplepropertydescriptor internal method modifiers property method declaration methoddeclaration modifiers property deprecated deprecated code child property descriptor childpropertydescriptor internal method type property method declaration methoddeclaration type property deprecated deprecated code simple property descriptor simplepropertydescriptor internal method extra dimensions property method declaration methoddeclaration extra dimensions property deprecated deprecated code child list property descriptor childlistpropertydescriptor internal method thrown exceptions property method declaration methoddeclaration thrown exceptions property deprecated deprecated code simple property descriptor simplepropertydescriptor internal type modifiers property type declaration typedeclaration modifiers property deprecated deprecated code child property descriptor childpropertydescriptor internal type superclass property type declaration typedeclaration superclass property deprecated deprecated code child list property descriptor childlistpropertydescriptor internal type interfaces property type declaration typedeclaration interfaces property deprecated deprecated code child property descriptor childpropertydescriptor internal cic property class instance creation classinstancecreation property deprecated deprecated code simple property descriptor simplepropertydescriptor internal fragment extra dimensions property variable declaration fragment variabledeclarationfragment extra dimensions property deprecated deprecated code child property descriptor childpropertydescriptor internal t ds tds type declaration property type declaration statement typedeclarationstatement type declaration property deprecated deprecated code simple property descriptor simplepropertydescriptor internal variable modifiers property single variable declaration singlevariabledeclaration modifiers property deprecated deprecated code simple property descriptor simplepropertydescriptor internal variable extra dimensions property single variable declaration singlevariabledeclaration extra dimensions property deprecated deprecated code simple property descriptor simplepropertydescriptor internal vde modifiers property variable declaration expression variabledeclarationexpression modifiers property deprecated deprecated code simple property descriptor simplepropertydescriptor internal vds modifiers property variable declaration statement variabledeclarationstatement modifiers property deprecated deprecated code jls internal ast jls deprecated deprecated code jls internal ast jls deprecated deprecated code jls internal ast jls string as string asstring ast node astnode node rewrite event store rewriteeventstore store ast rewrite flattener astrewriteflattener flattener ast rewrite flattener astrewriteflattener store node accept flattener flattener get result getresult string buffer stringbuffer result rewrite event store rewriteeventstore store ast rewrite flattener astrewriteflattener rewrite event store rewriteeventstore store store store result string buffer stringbuffer returns string accumulated visit serialized string get result getresult convert string lose extra space string buffer copying string result to string tostring resets printer reset result set length setlength appends text representation modifier flags single space param modifiers modifiers param buf code string buffer stringbuffer code write result print modifiers printmodifiers modifiers string buffer stringbuffer buf modifier is public ispublic modifiers nls buf append modifier is protected isprotected modifiers nls buf append modifier is private isprivate modifiers nls buf append modifier is static isstatic modifiers nls buf append modifier is abstract isabstract modifiers nls buf append modifier is final isfinal modifiers nls buf append modifier is synchronized issynchronized modifiers nls buf append modifier is volatile isvolatile modifiers nls buf append modifier is native isnative modifiers nls buf append modifier is strictfp isstrictfp modifiers nls buf append modifier is transient istransient modifiers nls buf append list get child list getchildlist ast node astnode parent structural property descriptor structuralpropertydescriptor child property childproperty list get attribute getattribute parent child property childproperty ast node astnode get child node getchildnode ast node astnode parent structural property descriptor structuralpropertydescriptor child property childproperty ast node astnode get attribute getattribute parent child property childproperty get int attribute getintattribute ast node astnode parent structural property descriptor structuralpropertydescriptor child property childproperty integer get attribute getattribute parent child property childproperty int value intvalue get boolean attribute getbooleanattribute ast node astnode parent structural property descriptor structuralpropertydescriptor child property childproperty get attribute getattribute parent child property childproperty boolean value booleanvalue object get attribute getattribute ast node astnode parent structural property descriptor structuralpropertydescriptor child property childproperty store get new value getnewvalue parent child property childproperty visit list visitlist ast node astnode parent structural property descriptor structuralpropertydescriptor child property childproperty string separator list list get child list getchildlist parent child property childproperty list size separator result append separator ast node astnode list accept visit list visitlist ast node astnode parent structural property descriptor structuralpropertydescriptor child property childproperty string separator string lead string post list list get child list getchildlist parent child property childproperty list is empty isempty result append lead list size separator result append separator ast node astnode list accept result append post visit extra dimensions visitextradimensions ast node astnode node simple property descriptor simplepropertydescriptor dimensions child list property descriptor childlistpropertydescriptor dimensions info dimensionsinfo node getast api level apilevel ast jls extra dimensions extradimensions get int attribute getintattribute node dimensions extra dimensions extradimensions nls result append nls visit list visitlist node dimensions info dimensionsinfo string value of valueof string value of valueof util empty string ast visitor astvisitor visit anonymous class declaration anonymousclassdeclaration visit anonymous class declaration anonymousclassdeclaration node result append visit list visitlist node anonymous class declaration anonymousclassdeclaration body declarations property result append ast visitor astvisitor visit array access arrayaccess visit array access arrayaccess node get child node getchildnode node array access arrayaccess array property accept result append get child node getchildnode node array access arrayaccess property accept result append ast visitor astvisitor visit array creation arraycreation visit array creation arraycreation node nls result append array type arraytype array type arraytype array type arraytype get child node getchildnode node array creation arraycreation type property element type count dimensions type element type elementtype dimensions astlevelgte node getast api level apilevel ast jls astlevelgte element type elementtype type get child node getchildnode array type arraytype array type arraytype element type property dimensions get child list getchildlist array type arraytype array type arraytype dimensions property size element type elementtype type get child node getchildnode array type arraytype internal array component type property include array type dimensions element type elementtype is array type isarraytype dimensions element type elementtype type get child node getchildnode element type elementtype internal array component type property element type elementtype accept add annotations dimension dimension expression list list get child list getchildlist node array creation arraycreation dimensions property size list size size internal visit dimension annotations internalvisitdimensionannotations array type arraytype astlevelgte result append ast node astnode list accept result append add annotations extra array dimension list size dimensions internal visit dimension annotations internalvisitdimensionannotations array type arraytype astlevelgte nls result append ast node astnode initializer get child node getchildnode node array creation arraycreation initializer property initializer get child node getchildnode node array creation arraycreation initializer property accept internal visit dimension annotations internalvisitdimensionannotations array type arraytype array type arraytype astlevelgte astlevelgte dimension dimension dimension array type arraytype dimensions visit list visitlist dimension dimension annotations property string value of valueof util empty string string value of valueof ast visitor astvisitor visit array initializer arrayinitializer visit array initializer arrayinitializer node result append visit list visitlist node array initializer arrayinitializer expressions property string value of valueof result append ast visitor astvisitor visit array type arraytype visit array type arraytype node node getast api level apilevel ast jls get child node getchildnode node internal array component type property accept nls result append get child node getchildnode node array type arraytype element type property accept visit list visitlist node array type arraytype dimensions property util empty string util empty string util empty string ast visitor astvisitor visit assert statement assertstatement visit assert statement assertstatement node nls result append get child node getchildnode node assert statement assertstatement expression property accept ast node astnode message get child node getchildnode node assert statement assertstatement message property message result append message accept result append ast visitor astvisitor visit assignment visit assignment node get child node getchildnode node assignment left hand side property accept result append get attribute getattribute node assignment property to string tostring get child node getchildnode node assignment hand side property accept ast visitor astvisitor visit block visit block node result append visit list visitlist node block statements property result append ast visitor astvisitor visit boolean literal booleanliteral visit boolean literal booleanliteral node node boolean value booleanvalue nls result append nls result append ast visitor astvisitor visit break statement breakstatement visit break statement breakstatement node nls result append ast node astnode label get child node getchildnode node break statement breakstatement label property label result append label accept result append ast visitor astvisitor visit cast expression castexpression visit cast expression castexpression node result append get child node getchildnode node cast expression castexpression type property accept result append get child node getchildnode node cast expression castexpression expression property accept ast visitor astvisitor visit catch clause catchclause visit catch clause catchclause node nls result append get child node getchildnode node catch clause catchclause exception property accept result append get child node getchildnode node catch clause catchclause body property accept ast visitor astvisitor visit character literal characterliteral visit character literal characterliteral node result append get attribute getattribute node character literal characterliteral escaped property ast visitor astvisitor visit class instance creation classinstancecreation visit class instance creation classinstancecreation node ast node astnode expression get child node getchildnode node class instance creation classinstancecreation expression property expression expression accept result append nls result append node getast api level apilevel jls internal get child node getchildnode node internal cic property accept visit list visitlist node class instance creation classinstancecreation type arguments property string value of valueof string value of valueof string value of valueof get child node getchildnode node class instance creation classinstancecreation type property accept result append visit list visitlist node class instance creation classinstancecreation arguments property string value of valueof result append ast node astnode decl get child node getchildnode node class instance creation classinstancecreation anonymous declaration property decl decl accept ast visitor astvisitor visit compilation unit compilationunit visit compilation unit compilationunit node ast node astnode pack get child node getchildnode node compilation unit compilationunit property pack pack accept visit list visitlist node compilation unit compilationunit imports property visit list visitlist node compilation unit compilationunit types property ast visitor astvisitor visit conditional expression conditionalexpression visit conditional expression conditionalexpression node get child node getchildnode node conditional expression conditionalexpression expression property accept result append get child node getchildnode node conditional expression conditionalexpression expression property accept result append get child node getchildnode node conditional expression conditionalexpression expression property accept ast visitor astvisitor visit constructor invocation constructorinvocation visit constructor invocation constructorinvocation node node getast api level apilevel jls internal visit list visitlist node constructor invocation constructorinvocation type arguments property string value of valueof string value of valueof string value of valueof nls result append visit list visitlist node constructor invocation constructorinvocation arguments property string value of valueof nls result append ast visitor astvisitor visit continue statement continuestatement visit continue statement continuestatement node nls result append ast node astnode label get child node getchildnode node continue statement continuestatement label property label result append label accept result append ast visitor astvisitor visit creation reference creationreference visit creation reference creationreference node get child node getchildnode node creation reference creationreference type property accept nls result append visit list visitlist node creation reference creationreference type arguments property util empty string string value of valueof string value of valueof nls result append visit dimension node visit list visitlist node dimension annotations property string value of valueof string value of valueof string value of valueof nls result append ast visitor astvisitor visit do statement dostatement visit do statement dostatement node nls result append get child node getchildnode node do statement dostatement body property accept nls result append get child node getchildnode node do statement dostatement expression property accept nls result append ast visitor astvisitor visit empty statement emptystatement visit empty statement emptystatement node result append ast visitor astvisitor visit expression statement expressionstatement visit expression statement expressionstatement node get child node getchildnode node expression statement expressionstatement expression property accept result append ast visitor astvisitor visit field access fieldaccess visit field access fieldaccess node get child node getchildnode node field access fieldaccess expression property accept result append get child node getchildnode node field access fieldaccess property accept ast visitor astvisitor visit field declaration fielddeclaration visit field declaration fielddeclaration node ast node astnode javadoc get child node getchildnode node field declaration fielddeclaration javadoc property javadoc javadoc accept node getast api level apilevel jls internal print modifiers printmodifiers get int attribute getintattribute node internal field modifiers property result visit list visitlist node field declaration fielddeclaration modifiers property string value of valueof util empty string string value of valueof get child node getchildnode node field declaration fielddeclaration type property accept result append visit list visitlist node field declaration fielddeclaration fragments property string value of valueof result append ast visitor astvisitor visit for statement forstatement visit for statement forstatement node nls result append visit list visitlist node for statement forstatement init ializers initializers property string value of valueof result append ast node astnode expression get child node getchildnode node for statement forstatement expression property expression expression accept result append visit list visitlist node for statement forstatement update rs updaters property string value of valueof result append get child node getchildnode node for statement forstatement body property accept ast visitor astvisitor visit if statement ifstatement visit if statement ifstatement node nls result append get child node getchildnode node if statement ifstatement expression property accept result append get child node getchildnode node if statement ifstatement statement property accept ast node astnode else statement elsestatement get child node getchildnode node if statement ifstatement statement property else statement elsestatement nls result append else statement elsestatement accept ast visitor astvisitor visit import declaration importdeclaration visit import declaration importdeclaration node nls result append node getast api level apilevel jls internal get boolean attribute getbooleanattribute node import declaration importdeclaration property nls result append nls get child node getchildnode node import declaration importdeclaration property accept get boolean attribute getbooleanattribute node import declaration importdeclaration demand property nls result append result append ast visitor astvisitor visit infix expression infixexpression visit infix expression infixexpression node get child node getchildnode node infix expression infixexpression left operand property accept result append string get attribute getattribute node infix expression infixexpression property to string tostring result append result append get child node getchildnode node infix expression infixexpression operand property accept string separator visit list visitlist node infix expression infixexpression extended operands property separator separator util empty string ast visitor astvisitor visit initializer visit initializer node ast node astnode javadoc get child node getchildnode node initializer javadoc property javadoc javadoc accept node getast api level apilevel jls internal print modifiers printmodifiers get int attribute getintattribute node internal initializer modifiers property result visit list visitlist node initializer modifiers property string value of valueof util empty string string value of valueof get child node getchildnode node initializer body property accept ast visitor astvisitor visit instanceof expression instanceofexpression visit instanceof expression instanceofexpression node get child node getchildnode node instanceof expression instanceofexpression left operand property accept nls result append get child node getchildnode node instanceof expression instanceofexpression operand property accept ast visitor astvisitor visit int ersection type intersectiontype visit int ersection type intersectiontype node nls visit list visitlist node int ersection type intersectiontype types property util empty string util empty string ast visitor astvisitor visit javadoc visit javadoc node nls result append list list get child list getchildlist node javadoc tags property list size nls result append ast node astnode list accept nls result append ast visitor astvisitor visit labeled statement labeledstatement visit labeled statement labeledstatement node get child node getchildnode node labeled statement labeledstatement label property accept nls result append get child node getchildnode node labeled statement labeledstatement body property accept ast visitor astvisitor visit lambda expression lambdaexpression visit lambda expression lambdaexpression node has parentheses hasparentheses get boolean attribute getbooleanattribute node lambda expression lambdaexpression parentheses property has parentheses hasparentheses list parameters get child list getchildlist node lambda expression lambdaexpression parameters property has parentheses hasparentheses parameters size parameters variable declaration fragment variabledeclarationfragment has parentheses hasparentheses result append visit list visitlist node lambda expression lambdaexpression parameters property string value of valueof has parentheses hasparentheses result append nls result append get child node getchildnode node lambda expression lambdaexpression body property accept ast visitor astvisitor visit method declaration methoddeclaration visit method declaration methoddeclaration node ast node astnode javadoc get child node getchildnode node method declaration methoddeclaration javadoc property javadoc javadoc accept node getast api level apilevel jls internal print modifiers printmodifiers get int attribute getintattribute node internal method modifiers property result visit list visitlist node method declaration methoddeclaration modifiers property string value of valueof util empty string string value of valueof visit list visitlist node method declaration methoddeclaration type parameters property string value of valueof string value of valueof string value of valueof get boolean attribute getbooleanattribute node method declaration methoddeclaration constructor property node getast api level apilevel jls internal get child node getchildnode node internal method type property accept ast node astnode return type returntype get child node getchildnode node method declaration methoddeclaration type property return type returntype return type returntype accept methods type nls result append nls result append get child node getchildnode node method declaration methoddeclaration property accept result append receiver parameter node getast api level apilevel ast jls ast node astnode receiver type receivertype get child node getchildnode node method declaration methoddeclaration receiver type property receiver type receivertype receiver type receivertype accept result append ast node astnode qualifier get child node getchildnode node method declaration methoddeclaration receiver qualifier property qualifier qualifier accept result append nls result append nls get child list getchildlist node method declaration methoddeclaration parameters property size result append visit list visitlist node method declaration methoddeclaration parameters property string value of valueof result append visit extra dimensions visitextradimensions node internal method extra dimensions property method declaration methoddeclaration extra dimensions property child list property descriptor childlistpropertydescriptor exceptions property exceptionsproperty node getast api level apilevel ast jls internal method thrown exceptions property method declaration methoddeclaration thrown exception types property nls visit list visitlist node exceptions property exceptionsproperty string value of valueof util empty string ast node astnode body get child node getchildnode node method declaration methoddeclaration body property body result append body accept ast visitor astvisitor visit method invocation methodinvocation visit method invocation methodinvocation node ast node astnode expression get child node getchildnode node method invocation methodinvocation expression property expression expression accept result append node getast api level apilevel jls internal visit list visitlist node method invocation methodinvocation type arguments property string value of valueof string value of valueof string value of valueof get child node getchildnode node method invocation methodinvocation property accept result append visit list visitlist node method invocation methodinvocation arguments property string value of valueof result append ast visitor astvisitor visit null literal nullliteral visit null literal nullliteral node nls result append ast visitor astvisitor visit number literal numberliteral visit number literal numberliteral node result append get attribute getattribute node number literal numberliteral token property to string tostring ast visitor astvisitor visit package declaration packagedeclaration visit package declaration packagedeclaration node node getast api level apilevel jls internal ast node astnode javadoc get child node getchildnode node package declaration packagedeclaration javadoc property javadoc javadoc accept visit list visitlist node package declaration packagedeclaration annotations property string value of valueof nls result append get child node getchildnode node package declaration packagedeclaration property accept result append ast visitor astvisitor visit parenthesized expression parenthesizedexpression visit parenthesized expression parenthesizedexpression node result append get child node getchildnode node parenthesized expression parenthesizedexpression expression property accept result append ast visitor astvisitor visit postfix expression postfixexpression visit postfix expression postfixexpression node get child node getchildnode node postfix expression postfixexpression operand property accept result append get attribute getattribute node postfix expression postfixexpression property to string tostring ast visitor astvisitor visit prefix expression prefixexpression visit prefix expression prefixexpression node result append get attribute getattribute node prefix expression prefixexpression property to string tostring get child node getchildnode node prefix expression prefixexpression operand property accept ast visitor astvisitor visit primitive type primitivetype visit primitive type primitivetype node node getast api level apilevel ast jls visit list visitlist node primitive type primitivetype annotations property string value of valueof util empty string string value of valueof result append get attribute getattribute node primitive type primitivetype primitive type code property to string tostring ast visitor astvisitor visit qualified name qualifiedname visit qualified name qualifiedname node get child node getchildnode node qualified name qualifiedname qualifier property accept result append get child node getchildnode node qualified name qualifiedname property accept ast visitor astvisitor visit return statement returnstatement visit return statement returnstatement node nls result append ast node astnode expression get child node getchildnode node return statement returnstatement expression property expression result append expression accept result append ast visitor astvisitor visit simple name simplename visit simple name simplename node result append get attribute getattribute node simple name simplename identifier property ast visitor astvisitor visit simple type simpletype visit simple type simpletype node node getast api level apilevel ast jls visit list visitlist node simple type simpletype annotations property string value of valueof util empty string string value of valueof node get name getname accept ast visitor astvisitor visit single variable declaration singlevariabledeclaration visit single variable declaration singlevariabledeclaration node node getast api level apilevel jls internal print modifiers printmodifiers get int attribute getintattribute node internal variable modifiers property result visit list visitlist node single variable declaration singlevariabledeclaration modifiers property string value of valueof util empty string string value of valueof get child node getchildnode node single variable declaration singlevariabledeclaration type property accept node getast api level apilevel ast jls node is varargs isvarargs visit list visitlist node single variable declaration singlevariabledeclaration varargs annotations property string value of valueof util empty string string value of valueof node getast api level apilevel jls internal get boolean attribute getbooleanattribute node single variable declaration singlevariabledeclaration varargs property nls result append nls result append get child node getchildnode node single variable declaration singlevariabledeclaration property accept visit extra dimensions visitextradimensions node internal variable extra dimensions property single variable declaration singlevariabledeclaration extra dimensions property ast node astnode initializer get child node getchildnode node single variable declaration singlevariabledeclaration initializer property initializer result append initializer accept ast visitor astvisitor visit string literal stringliteral visit string literal stringliteral node result append get attribute getattribute node string literal stringliteral escaped property ast visitor astvisitor visit super constructor invocation superconstructorinvocation visit super constructor invocation superconstructorinvocation node ast node astnode expression get child node getchildnode node super constructor invocation superconstructorinvocation expression property expression expression accept result append node getast api level apilevel jls internal visit list visitlist node super constructor invocation superconstructorinvocation type arguments property string value of valueof string value of valueof string value of valueof nls result append visit list visitlist node super constructor invocation superconstructorinvocation arguments property string value of valueof nls result append ast visitor astvisitor visit super field access superfieldaccess visit super field access superfieldaccess node ast node astnode qualifier get child node getchildnode node super field access superfieldaccess qualifier property qualifier qualifier accept result append nls result append get child node getchildnode node super field access superfieldaccess property accept ast visitor astvisitor visit super method invocation supermethodinvocation visit super method invocation supermethodinvocation node ast node astnode qualifier get child node getchildnode node super method invocation supermethodinvocation qualifier property qualifier qualifier accept result append nls result append node getast api level apilevel jls internal visit list visitlist node super method invocation supermethodinvocation type arguments property string value of valueof string value of valueof string value of valueof get child node getchildnode node super method invocation supermethodinvocation property accept result append visit list visitlist node super method invocation supermethodinvocation arguments property string value of valueof result append ast visitor astvisitor visit switch case switchcase visit switch case switchcase node ast node astnode expression get child node getchildnode node switch case switchcase expression property expression nls result append nls result append expression accept result append ast visitor astvisitor visit switch statement switchstatement visit switch statement switchstatement node nls result append get child node getchildnode node switch statement switchstatement expression property accept result append result append visit list visitlist node switch statement switchstatement statements property result append ast visitor astvisitor visit synchronized statement synchronizedstatement visit synchronized statement synchronizedstatement node nls result append get child node getchildnode node synchronized statement synchronizedstatement expression property accept result append get child node getchildnode node synchronized statement synchronizedstatement body property accept ast visitor astvisitor visit this expression thisexpression visit this expression thisexpression node ast node astnode qualifier get child node getchildnode node this expression thisexpression qualifier property qualifier qualifier accept result append nls result append ast visitor astvisitor visit throw statement throwstatement visit throw statement throwstatement node nls result append get child node getchildnode node throw statement throwstatement expression property accept result append ast visitor astvisitor visit try statement trystatement visit try statement trystatement node nls result append node getast api level apilevel jls internal visit list visitlist node try statement trystatement resources property string value of valueof string value of valueof string value of valueof get child node getchildnode node try statement trystatement body property accept result append visit list visitlist node try statement trystatement clauses property ast node astnode finally clause finallyclause get child node getchildnode node try statement trystatement property finally clause finallyclause nls result append finally clause finallyclause accept ast visitor astvisitor visit type declaration typedeclaration visit type declaration typedeclaration node api level apilevel node getast api level apilevel ast node astnode javadoc get child node getchildnode node type declaration typedeclaration javadoc property javadoc javadoc accept api level apilevel jls internal print modifiers printmodifiers get int attribute getintattribute node internal type modifiers property result visit list visitlist node type declaration typedeclaration modifiers property string value of valueof util empty string string value of valueof is interface isinterface get boolean attribute getbooleanattribute node type declaration typedeclaration property nls nls result append is interface isinterface get child node getchildnode node type declaration typedeclaration property accept api level apilevel jls internal visit list visitlist node type declaration typedeclaration type parameters property string value of valueof string value of valueof string value of valueof result append child property descriptor childpropertydescriptor super class property superclassproperty api level apilevel jls internal internal type superclass property type declaration typedeclaration superclass type property ast node astnode superclass get child node getchildnode node super class property superclassproperty superclass nls result append superclass accept result append child list property descriptor childlistpropertydescriptor super interface property superinterfaceproperty api level apilevel jls internal internal type interfaces property type declaration typedeclaration types property nls nls string lead is interface isinterface visit list visitlist node super interface property superinterfaceproperty string value of valueof lead util empty string result append visit list visitlist node type declaration typedeclaration body declarations property result append ast visitor astvisitor visit type declaration statement typedeclarationstatement visit type declaration statement typedeclarationstatement node node getast api level apilevel jls internal get child node getchildnode node internal t ds tds type declaration property accept get child node getchildnode node type declaration statement typedeclarationstatement declaration property accept ast visitor astvisitor visit type literal typeliteral visit type literal typeliteral node get child node getchildnode node type literal typeliteral type property accept nls result append ast visitor astvisitor visit union type uniontype visit union type uniontype node nls visit list visitlist node union type uniontype types property util empty string util empty string ast visitor astvisitor visit variable declaration expression variabledeclarationexpression visit variable declaration expression variabledeclarationexpression node node getast api level apilevel jls internal print modifiers printmodifiers get int attribute getintattribute node internal vde modifiers property result visit list visitlist node variable declaration expression variabledeclarationexpression modifiers property string value of valueof util empty string string value of valueof get child node getchildnode node variable declaration expression variabledeclarationexpression type property accept result append visit list visitlist node variable declaration expression variabledeclarationexpression fragments property string value of valueof ast visitor astvisitor visit variable declaration fragment variabledeclarationfragment visit variable declaration fragment variabledeclarationfragment node get child node getchildnode node variable declaration fragment variabledeclarationfragment property accept visit extra dimensions visitextradimensions node internal fragment extra dimensions property variable declaration fragment variabledeclarationfragment extra dimensions property ast node astnode initializer get child node getchildnode node variable declaration fragment variabledeclarationfragment initializer property initializer result append initializer accept ast visitor astvisitor visit variable declaration statement variabledeclarationstatement visit variable declaration statement variabledeclarationstatement node node getast api level apilevel jls internal print modifiers printmodifiers get int attribute getintattribute node internal vds modifiers property result visit list visitlist node variable declaration statement variabledeclarationstatement modifiers property string value of valueof util empty string string value of valueof get child node getchildnode node variable declaration statement variabledeclarationstatement type property accept result append visit list visitlist node variable declaration statement variabledeclarationstatement fragments property string value of valueof result append ast visitor astvisitor visit while statement whilestatement visit while statement whilestatement node nls result append get child node getchildnode node while statement whilestatement expression property accept result append get child node getchildnode node while statement whilestatement body property accept javadoc org eclipse jdt core dom ast visitor astvisitor visit org eclipse jdt core dom block comment blockcomment visit block comment blockcomment node flatten source javadoc org eclipse jdt core dom ast visitor astvisitor visit org eclipse jdt core dom line comment linecomment visit line comment linecomment node flatten source javadoc org eclipse jdt core dom ast visitor astvisitor visit org eclipse jdt core dom member ref memberref visit member ref memberref node ast node astnode qualifier get child node getchildnode node member ref memberref qualifier property qualifier qualifier accept result append get child node getchildnode node member ref memberref property accept javadoc org eclipse jdt core dom ast visitor astvisitor visit org eclipse jdt core dom method ref methodref visit method ref methodref node ast node astnode qualifier get child node getchildnode node method ref methodref qualifier property qualifier qualifier accept result append get child node getchildnode node method ref methodref property accept result append nls visit list visitlist node method ref methodref parameters property result append javadoc org eclipse jdt core dom ast visitor astvisitor visit org eclipse jdt core dom method ref parameter methodrefparameter visit method ref parameter methodrefparameter node get child node getchildnode node method ref parameter methodrefparameter type property accept node getast api level apilevel jls internal get boolean attribute getbooleanattribute node method ref parameter methodrefparameter varargs property nls result append nls ast node astnode get child node getchildnode node method ref parameter methodrefparameter property result append accept javadoc org eclipse jdt core dom ast visitor astvisitor visit org eclipse jdt core dom tag element tagelement visit tag element tagelement node object tag name tagname get attribute getattribute node tag element tagelement tag property tag name tagname result append string tag name tagname list list get child list getchildlist node tag element tagelement fragments property list size tag name tagname result append ast node astnode curr ast node astnode list curr tag element tagelement result append curr accept result append curr accept javadoc org eclipse jdt core dom ast visitor astvisitor visit org eclipse jdt core dom text element textelement visit text element textelement node result append get attribute getattribute node text element textelement text property ast visitor astvisitor visit annotation type declaration annotationtypedeclaration visit annotation type declaration annotationtypedeclaration node ast node astnode javadoc get child node getchildnode node annotation type declaration annotationtypedeclaration javadoc property javadoc javadoc accept visit list visitlist node annotation type declaration annotationtypedeclaration modifiers property string value of valueof util empty string string value of valueof nls result append get child node getchildnode node annotation type declaration annotationtypedeclaration property accept result append visit list visitlist node annotation type declaration annotationtypedeclaration body declarations property util empty string result append ast visitor astvisitor visit annotation type member declaration annotationtypememberdeclaration visit annotation type member declaration annotationtypememberdeclaration node ast node astnode javadoc get child node getchildnode node annotation type member declaration annotationtypememberdeclaration javadoc property javadoc javadoc accept visit list visitlist node annotation type member declaration annotationtypememberdeclaration modifiers property string value of valueof util empty string string value of valueof get child node getchildnode node annotation type member declaration annotationtypememberdeclaration type property accept result append get child node getchildnode node annotation type member declaration annotationtypememberdeclaration property accept nls result append ast node astnode def get child node getchildnode node annotation type member declaration annotationtypememberdeclaration property def nls result append def accept result append ast visitor astvisitor visit enhanced for statement enhancedforstatement visit enhanced for statement enhancedforstatement node nls result append get child node getchildnode node enhanced for statement enhancedforstatement parameter property accept result append get child node getchildnode node enhanced for statement enhancedforstatement expression property accept result append get child node getchildnode node enhanced for statement enhancedforstatement body property accept ast visitor astvisitor visit enum constant declaration enumconstantdeclaration visit enum constant declaration enumconstantdeclaration node ast node astnode javadoc get child node getchildnode node enum constant declaration enumconstantdeclaration javadoc property javadoc javadoc accept visit list visitlist node enum constant declaration enumconstantdeclaration modifiers property string value of valueof util empty string string value of valueof get child node getchildnode node enum constant declaration enumconstantdeclaration property accept visit list visitlist node enum constant declaration enumconstantdeclaration arguments property string value of valueof string value of valueof string value of valueof ast node astnode class decl classdecl get child node getchildnode node enum constant declaration enumconstantdeclaration anonymous declaration property class decl classdecl class decl classdecl accept ast visitor astvisitor visit enum declaration enumdeclaration visit enum declaration enumdeclaration node ast node astnode javadoc get child node getchildnode node enum declaration enumdeclaration javadoc property javadoc javadoc accept visit list visitlist node enum declaration enumdeclaration modifiers property string value of valueof util empty string string value of valueof nls result append enum get child node getchildnode node enum declaration enumdeclaration property accept result append nls visit list visitlist node enum declaration enumdeclaration types property string value of valueof util empty string result append visit list visitlist node enum declaration enumdeclaration enum constants property string value of valueof util empty string util empty string visit list visitlist node enum declaration enumdeclaration body declarations property util empty string string value of valueof util empty string result append ast visitor astvisitor visit expression method reference expressionmethodreference visit expression method reference expressionmethodreference node get child node getchildnode node expression method reference expressionmethodreference expression property accept nls result append visit list visitlist node expression method reference expressionmethodreference type arguments property util empty string string value of valueof string value of valueof node get name getname accept ast visitor astvisitor visit marker annotation markerannotation visit marker annotation markerannotation node result append get child node getchildnode node marker annotation markerannotation type property accept ast visitor astvisitor visit member value pair membervaluepair visit member value pair membervaluepair node get child node getchildnode node member value pair membervaluepair property accept result append get child node getchildnode node member value pair membervaluepair property accept ast visitor astvisitor visit modifier visit modifier node result append get attribute getattribute node modifier keyword property to string tostring ast visitor astvisitor visit normal annotation normalannotation visit normal annotation normalannotation node result append get child node getchildnode node normal annotation normalannotation type property accept result append nls visit list visitlist node normal annotation normalannotation values property result append ast visitor astvisitor visit name qualified type namequalifiedtype visit name qualified type namequalifiedtype node get child node getchildnode node name qualified type namequalifiedtype qualifier property accept result append node getast api level apilevel ast jls visit list visitlist node name qualified type namequalifiedtype annotations property string value of valueof util empty string string value of valueof get child node getchildnode node name qualified type namequalifiedtype property accept ast visitor astvisitor visit parameterized type parameterizedtype visit parameterized type parameterizedtype node get child node getchildnode node parameterized type parameterizedtype type property accept result append nls visit list visitlist node parameterized type parameterizedtype type arguments property result append ast visitor astvisitor visit qualified type qualifiedtype visit qualified type qualifiedtype node get child node getchildnode node qualified type qualifiedtype qualifier property accept result append node getast api level apilevel ast jls visit list visitlist node qualified type qualifiedtype annotations property string value of valueof util empty string string value of valueof get child node getchildnode node qualified type qualifiedtype property accept javadoc org eclipse jdt core dom ast visitor astvisitor visit org eclipse jdt core dom single member annotation singlememberannotation visit single member annotation singlememberannotation node result append get child node getchildnode node single member annotation singlememberannotation type property accept result append get child node getchildnode node single member annotation singlememberannotation property accept result append ast visitor astvisitor visit super method reference supermethodreference visit super method reference supermethodreference node ast node astnode qualifier get child node getchildnode node super method reference supermethodreference qualifier property qualifier qualifier accept result append nls result append visit list visitlist node super method reference supermethodreference type arguments property util empty string string value of valueof string value of valueof node get name getname accept ast visitor astvisitor visit type method reference typemethodreference visit type method reference typemethodreference node get child node getchildnode node type method reference typemethodreference type property accept nls result append visit list visitlist node type method reference typemethodreference type arguments property util empty string string value of valueof string value of valueof node get name getname accept javadoc org eclipse jdt core dom ast visitor astvisitor visit org eclipse jdt core dom type parameter typeparameter visit type parameter typeparameter node node getast api level apilevel ast jls visit list visitlist node type parameter typeparameter modifiers property string value of valueof util empty string string value of valueof get child node getchildnode node type parameter typeparameter property accept nls nls visit list visitlist node type parameter typeparameter type bounds property util empty string javadoc org eclipse jdt core dom ast visitor astvisitor visit org eclipse jdt core dom wildcard type wildcardtype visit wildcard type wildcardtype node node getast api level apilevel ast jls visit list visitlist node wildcard type wildcardtype annotations property string value of valueof util empty string string value of valueof result append ast node astnode bound get child node getchildnode node wildcard type wildcardtype bound property bound get boolean attribute getbooleanattribute node wildcard type wildcardtype upper bound property nls result append nls nls result append nls bound accept | 51,106 | 51,106 | 0.876042 |
9ba377a985ae17dab352f69f7b44267dc90e5480 | 3,055 | js | JavaScript | public/js/userAwaitingBlogs.js | ALI-KAMRAN/laravel | 8a7198f7131f19bdfcd520f62015e2ee2e8a2b9c | [
"MIT"
] | null | null | null | public/js/userAwaitingBlogs.js | ALI-KAMRAN/laravel | 8a7198f7131f19bdfcd520f62015e2ee2e8a2b9c | [
"MIT"
] | null | null | null | public/js/userAwaitingBlogs.js | ALI-KAMRAN/laravel | 8a7198f7131f19bdfcd520f62015e2ee2e8a2b9c | [
"MIT"
] | null | null | null |
$(document).ready(function(){
// datatable code
var table = $('#awaiting').DataTable({
processing: true,
serverSide: true,
responsive: true,
autoWidth: true,
order: [0,'desc'],
"ajax": {
'url' : baseUrl+'/getUserAwaitingBlogs',
'type': 'get',
},
columns: [
{data: 'image', name: 'image'},
{data: 'title', name: 'title'},
{data: 'user_id', name: 'user_id'},
{data: 'category_id', name: 'category_id'},
{data: 'short_description', name: 'short_description'},
{data: 'description', name: 'description'},
{data: 'active', name: 'active'},
{data: 'action', name: 'action', orderable : false, searchable:false},
{data: 'action1', name: 'action1', orderable : false, searchable:false},
],
"columnDefs" : [
{
"width" : "40%" , "targets" : 2
},
{
"width" : "20%" , "targets" : 1
},
{
"render" : function (data,type,row,meta)
{
return `<img src="${baseUrl}/images/blogsImages/${row.image}" style="width:70px;height:70px"> `
},
"targets" : 0
},
{
"render" : function (data,type,row,meta)
{
return `<a href="${baseUrl}/userEditBlogBladeView/${row.id}" class="btn btn-primary btn-sm editCategory" id="${row.id}"><i class='fas fa-pencil-alt'></i> Edit</a> `
},
"targets" : 7
},
{
"render" : function (data,type,row,meta)
{
return `<a href="#" class="btn btn-danger btn-sm userBlogsDelete" id="${row.id}"><i class='far fa-trash-alt'></i> Delete</a> `
},
"targets" : 8
},
]
});
// delete category
$(document).on('click','.userBlogsDelete',function(e){
e.preventDefault();
var id = $(this).attr('id');
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url:baseUrl+'/userDeleteBlogs/'+ id,
type:'GET',
processData:false,
contentType:false,
success : function(data){
Swal.fire({
icon: 'success',
title:'Success',
text: 'Blog was deleted successfully',
})
table.ajax.reload();
},
error : function(data,textStatus,xhr)
{
Swal.fire({
icon: 'error',
title:'not found',
text: 'sorry data was not found',
})
},
})
}
})
});
}); | 25.247934 | 177 | 0.452046 |
e78a61acaec62e74bd58df8e73a2d27214805ee9 | 1,714 | js | JavaScript | .cache/sync-requires.js | 0zzz/gatsby-starter-muses | 50bb4878f658b0b2486f6f028a714065dc9693b3 | [
"MIT"
] | null | null | null | .cache/sync-requires.js | 0zzz/gatsby-starter-muses | 50bb4878f658b0b2486f6f028a714065dc9693b3 | [
"MIT"
] | null | null | null | .cache/sync-requires.js | 0zzz/gatsby-starter-muses | 50bb4878f658b0b2486f6f028a714065dc9693b3 | [
"MIT"
] | null | null | null | // prefer default export if available
const preferDefault = m => m && m.default || m
exports.layouts = {
"layout---index": preferDefault(require("/Users/linzhou/Documents/project/gatsby-starter-muses/.cache/layouts/index.js"))
}
exports.components = {
"component---src-templates-blog-post-js": preferDefault(require("/Users/linzhou/Documents/project/gatsby-starter-muses/src/templates/BlogPost.js")),
"component---cache-dev-404-page-js": preferDefault(require("/Users/linzhou/Documents/project/gatsby-starter-muses/.cache/dev-404-page.js")),
"component---src-pages-404-js": preferDefault(require("/Users/linzhou/Documents/project/gatsby-starter-muses/src/pages/404.js")),
"component---src-pages-index-js": preferDefault(require("/Users/linzhou/Documents/project/gatsby-starter-muses/src/pages/index.js"))
}
exports.json = {
"layout-index.json": require("/Users/linzhou/Documents/project/gatsby-starter-muses/.cache/json/layout-index.json"),
"blog-3.json": require("/Users/linzhou/Documents/project/gatsby-starter-muses/.cache/json/blog-3.json"),
"blog-2.json": require("/Users/linzhou/Documents/project/gatsby-starter-muses/.cache/json/blog-2.json"),
"blog-1.json": require("/Users/linzhou/Documents/project/gatsby-starter-muses/.cache/json/blog-1.json"),
"dev-404-page.json": require("/Users/linzhou/Documents/project/gatsby-starter-muses/.cache/json/dev-404-page.json"),
"404.json": require("/Users/linzhou/Documents/project/gatsby-starter-muses/.cache/json/404.json"),
"index.json": require("/Users/linzhou/Documents/project/gatsby-starter-muses/.cache/json/index.json"),
"404-html.json": require("/Users/linzhou/Documents/project/gatsby-starter-muses/.cache/json/404-html.json")
} | 68.56 | 150 | 0.754376 |
b9084044d012ca23c2e30927c864e0ff22a42e23 | 6,888 | c | C | WiFiSwitch/firmware/main/http_server/http_server.c | maygli/Datcha | 55fc3397334dfb41f4d8308847ee2ed981574399 | [
"MIT"
] | 1 | 2022-02-25T06:07:47.000Z | 2022-02-25T06:07:47.000Z | WiFiSwitch/firmware/main/http_server/http_server.c | maygli/Datcha | 55fc3397334dfb41f4d8308847ee2ed981574399 | [
"MIT"
] | null | null | null | WiFiSwitch/firmware/main/http_server/http_server.c | maygli/Datcha | 55fc3397334dfb41f4d8308847ee2ed981574399 | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2022 Maygli (mmaygli@gmail.com)
*
* 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 <esp_err.h>
#include <esp_log.h>
#include <esp_http_server.h>
#include "../common_def.h"
#include "server_config.h"
#include "server_get_file.h"
#include "http_upload.h"
#include "switch_control.h"
#include "switch_settings.h"
#include "wifi_settings.h"
#include "http_server.h"
#include "board_info.h"
#include "meteo_info.h"
//Requests
#define SWITCH_STATE "/switch_state"
#define SWITCH_CONTROL "/switch_control"
#define SWITCH_SETTINGS "/switch_settings"
#define WIFI_SETTINGS "/wifi_settings"
#define BOARD_INFO "/board_info"
#define METEO_STATE "/meteo_state"
static const char SERVER_TAG[]="server";
esp_err_t HTTP_ServerStart(HTTPServer* theServer)
{
if( theServer == NULL ){
ESP_LOGE(SERVER_TAG,"HTTP_ServerStart: Can't init server. Pointer to structure is NULL");
return ESP_ERR_INVALID_ARG;
}
theServer->m_HttpServer = NULL;
// strcpy(theServer->m_Path,INT_FLASH_BASE_PATH"/"HTML_DIR_NAME"/");
strcpy(theServer->m_Path,HTML_DIR"/");
theServer->m_BasePathSize = strlen(theServer->m_Path);
ESP_LOGI(SERVER_TAG,"Server base path=%s", theServer->m_Path);
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
config.lru_purge_enable = true;
/* Use the URI wildcard matching function in order to
* allow the same handler to respond to multiple different
* target URIs which match the wildcard scheme */
config.uri_match_fn = httpd_uri_match_wildcard;
config.max_uri_handlers = 16;
ESP_LOGI(SERVER_TAG, "Starting HTTP Server");
esp_err_t aRes = httpd_start(&theServer->m_HttpServer, &config);
if ( aRes != ESP_OK ) {
ESP_LOGE(SERVER_TAG, "Failed to start file server %d!", aRes);
return ESP_FAIL;
}
httpd_uri_t aGetDefault = {
.uri = DEFAULT_PAGE_URI, // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = HTTP_SendFile,
.user_ctx = theServer // Pass server data as context
};
httpd_register_uri_handler(theServer->m_HttpServer, &aGetDefault);
httpd_uri_t aGetBoardInfo = {
.uri = BOARD_INFO, // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = HTTP_GetBoardInfo,
.user_ctx = theServer // Pass server data as context
};
httpd_register_uri_handler(theServer->m_HttpServer, &aGetBoardInfo);
httpd_uri_t aGetMeteoInfo = {
.uri = METEO_STATE, // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = HTTP_GetMeteoInfo,
.user_ctx = theServer // Pass server data as context
};
httpd_register_uri_handler(theServer->m_HttpServer, &aGetMeteoInfo);
httpd_uri_t aGetSwitchState = {
.uri = SWITCH_STATE, // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = HTTP_GetSwitchState,
.user_ctx = theServer // Pass server data as context
};
httpd_register_uri_handler(theServer->m_HttpServer, &aGetSwitchState);
httpd_uri_t aSwitchSettingsGet = {
.uri = SWITCH_SETTINGS, // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = HTTP_GetSwitchSettings,
.user_ctx = theServer // Pass server data as context
};
httpd_register_uri_handler(theServer->m_HttpServer, &aSwitchSettingsGet);
httpd_uri_t aWiFiSettingsGet = {
.uri = WIFI_SETTINGS, // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = HTTP_GetWiFiSettings,
.user_ctx = theServer // Pass server data as context
};
httpd_register_uri_handler(theServer->m_HttpServer, &aWiFiSettingsGet);
/* get html */
httpd_uri_t aGetHtml = {
.uri = "*", // Match all URIs of type /path/to/file
.method = HTTP_GET,
.handler = HTTP_SendFile,
.user_ctx = theServer // Pass server data as context
};
httpd_register_uri_handler(theServer->m_HttpServer, &aGetHtml);
httpd_uri_t aSwitchControl = {
.uri = SWITCH_CONTROL, // Match all URIs of type /path/to/file
.method = HTTP_POST,
.handler = HTTP_SwitchControl,
.user_ctx = theServer // Pass server data as context
};
httpd_register_uri_handler(theServer->m_HttpServer, &aSwitchControl);
httpd_uri_t aSwitchSettingsSet = {
.uri = SWITCH_SETTINGS, // Match all URIs of type /path/to/file
.method = HTTP_POST,
.handler = HTTP_SetSwitchSettings,
.user_ctx = theServer // Pass server data as context
};
httpd_register_uri_handler(theServer->m_HttpServer, &aSwitchSettingsSet);
httpd_uri_t aWiFiSettingsSet = {
.uri = WIFI_SETTINGS, // Match all URIs of type /path/to/file
.method = HTTP_POST,
.handler = HTTP_SetWiFiSettings,
.user_ctx = theServer // Pass server data as context
};
httpd_register_uri_handler(theServer->m_HttpServer, &aWiFiSettingsSet);
httpd_uri_t aFileUpload = {
.uri = "*", // Match all URIs of type /path/to/file
.method = HTTP_POST,
.handler = HTTP_UploadFile,
.user_ctx = theServer // Pass server data as context
};
httpd_register_uri_handler(theServer->m_HttpServer, &aFileUpload);
return ESP_OK;
}
esp_err_t HTTP_ServerStop(HTTPServer* theServer)
{
if( theServer == NULL ){
ESP_LOGE(SERVER_TAG,"HTTP_ServerStop: Can't init server. Pointer to structure is NULL");
return ESP_ERR_INVALID_ARG;
}
if( theServer->m_HttpServer == NULL ){
return ESP_OK;
}
httpd_stop(theServer->m_HttpServer);
return ESP_OK;
}
| 38.266667 | 97 | 0.674071 |
99605fce3ab3dc068e98d064042bbf3957084758 | 1,349 | kt | Kotlin | src/main/kotlin/com/github/kerubistan/kerub/data/ispn/AuditEntryDaoImpl.kt | fossabot/kerub | 50ac690f71b018f3db60c6b44f203902baecf50a | [
"Apache-2.0"
] | 16 | 2016-01-03T12:57:25.000Z | 2020-08-04T10:36:30.000Z | src/main/kotlin/com/github/kerubistan/kerub/data/ispn/AuditEntryDaoImpl.kt | fossabot/kerub | 50ac690f71b018f3db60c6b44f203902baecf50a | [
"Apache-2.0"
] | 205 | 2015-10-27T11:38:26.000Z | 2021-05-09T11:53:18.000Z | src/main/kotlin/com/github/kerubistan/kerub/data/ispn/AuditEntryDaoImpl.kt | fossabot/kerub | 50ac690f71b018f3db60c6b44f203902baecf50a | [
"Apache-2.0"
] | 4 | 2018-01-26T14:07:12.000Z | 2019-12-05T20:49:30.000Z | package com.github.kerubistan.kerub.data.ispn
import com.github.kerubistan.kerub.data.AuditEntryDao
import com.github.kerubistan.kerub.model.AddEntry
import com.github.kerubistan.kerub.model.AuditEntry
import com.github.kerubistan.kerub.model.DeleteEntry
import com.github.kerubistan.kerub.model.UpdateEntry
import com.github.kerubistan.kerub.utils.byId
import org.infinispan.AdvancedCache
import org.infinispan.query.Search
import org.infinispan.query.dsl.Query
import org.infinispan.query.dsl.QueryBuilder
import java.util.UUID
import kotlin.reflect.KClass
class AuditEntryDaoImpl(private val cache: AdvancedCache<UUID, AuditEntry>) : AuditEntryDao {
override fun addAll(entities: Collection<AuditEntry>) {
cache.putAllAsync(entities.byId())
}
override fun add(entity: AuditEntry): UUID {
cache.putAsync(entity.id, entity)
return entity.id
}
override fun listById(id: UUID): List<AuditEntry> =
criteria(builder(AddEntry::class), id) +
criteria(builder(UpdateEntry::class), id) +
criteria(builder(DeleteEntry::class), id)
private fun builder(clazz: KClass<*>) =
Search.getQueryFactory(cache).from(clazz.java)
private fun criteria(builder: QueryBuilder<*>, id: UUID): List<AuditEntry> =
builder
.having(AuditEntry::idStr.name).eq(id.toString()).toBuilder<Query>()
.build()!!
.list<AuditEntry>()
} | 34.589744 | 93 | 0.772424 |
62ef12bc6ac651bc282c95bd6d55990e3eee659f | 850 | kt | Kotlin | android/src/main/kotlin/com/wshunli/flutter/flutter_qr_code/custom/ZXingLayout.kt | wshunli/flutter_qr_code | 06b55692578edc4559d79fa68168022772c520a6 | [
"Apache-2.0"
] | 3 | 2020-11-03T06:16:08.000Z | 2020-11-06T03:30:46.000Z | android/src/main/kotlin/com/wshunli/flutter/flutter_qr_code/custom/ZXingLayout.kt | wshunli/flutter_qr_code | 06b55692578edc4559d79fa68168022772c520a6 | [
"Apache-2.0"
] | 2 | 2020-11-03T05:52:44.000Z | 2021-04-06T07:22:40.000Z | android/src/main/kotlin/com/wshunli/flutter/flutter_qr_code/custom/ZXingLayout.kt | wshunli/flutter_qr_code | 06b55692578edc4559d79fa68168022772c520a6 | [
"Apache-2.0"
] | 1 | 2020-11-03T06:16:13.000Z | 2020-11-03T06:16:13.000Z | package com.wshunli.flutter.flutter_qr_code.custom
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.wshunli.flutter.flutter_qr_code.R
/**
* author : wshunli
* email : wshunli@qq.com
* date : 2020/8/16 11:06
* description : 扫码布局
*/
class ZXingLayout : FrameLayout {
constructor(context: Context) : super(context) {
initView(context)
}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
initView(context)
}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
initView(context)
}
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.view_qr_scan, this, true)
}
} | 25.757576 | 114 | 0.712941 |
96767c8b50e71d7f432fc9606c115747a1186313 | 124 | php | PHP | resources/views/increment.blade.php | sophiasudiacal/Reddit-Clone | 11379ea1d48aac9e70e8fb7c7874a518519a0f99 | [
"MIT"
] | null | null | null | resources/views/increment.blade.php | sophiasudiacal/Reddit-Clone | 11379ea1d48aac9e70e8fb7c7874a518519a0f99 | [
"MIT"
] | null | null | null | resources/views/increment.blade.php | sophiasudiacal/Reddit-Clone | 11379ea1d48aac9e70e8fb7c7874a518519a0f99 | [
"MIT"
] | null | null | null | @extends('layouts.master')
@section('content')
<h3>Your number:</h3>
{{ $int }}
<h3>Plus one:</h3>
{{ $inc }}
@stop | 12.4 | 26 | 0.556452 |