content
stringlengths
263
5.24M
pred_label
stringclasses
1 value
pred_score_pos
float64
0.6
1
import Foundation public extension ChordQuality { public static let Dyads = [ ChordQuality.PowerChord, ] public static let Triads = [ ChordQuality.Major, ChordQuality.Minor, ChordQuality.Augmented, ChordQuality.Diminished, ChordQuality.Sus2, ChordQuality.Sus4, ] public static let UnalteredTetrads = [ ChordQuality.Domi...
__label__POS
0.675628
#ifndef REFCOUNT_H #define REFCOUNT_H #include "threadtools.h" #if defined( _WIN32 ) #pragma once #endif class IRefCounted { public: virtual int AddRef() = 0; virtual int Release() = 0; }; template <class REFCOUNTED_ITEM_PTR> inline int SafeRelease(REFCOUNTED_ITEM_PTR& pRef) { REFCOUNTED_ITEM_PTR* ppRef = &pRef...
__label__POS
0.775372
#include <u.h> #include <libc.h> #include <bio.h> #include "modem.h" int initfaxmodem(Modem *m) { m->fax = 1; m->phase = 'A'; m->valid = 0; return Eok; } static int parameters(long a[], char *s) { char *p; int i; i = 0; if((p = strchr(s, ':')) == 0) return 0; p++; while(s = strchr(p, ',')){ a[i++] = ...
__label__POS
0.985523
// Copyright (c) 2015 Ben Guo. All rights reserved. import Foundation public enum MKUtil { /// Returns the nth inversion of the given sorted array of semitone indices static func invert(_ semitoneIndices: [Float], n: UInt) -> [Float] { let count = semitoneIndices.count let modN = Int(n) % cou...
__label__POS
0.884658
#ifndef CBASEENT #define CBASEENT #pragma once //#include "icliententity.h" #include "NetVarManager.hpp" #include "PatternScan.hpp" #include "netvars.hpp" namespace VirtualMethod { template <typename T, std::size_t Idx, typename ...Args> constexpr T call(void* classBase, Args... args) noexcept { return (*reint...
__label__POS
0.621812
import Foundation public enum Chord { //: Dyads public static let PowerChord = Harmony.create(ChordQuality.PowerChord.intervals) //> Triads public static let Major = Harmony.create(ChordQuality.Major.intervals) public static let Minor = Harmony.create(ChordQuality.Minor.intervals) public static let Augmented = Harmon...
__label__POS
0.962142
#include "sam.h" void moveto(File *f, Range r) { Posn p1 = r.p1, p2 = r.p2; f->dot.r.p1 = p1; f->dot.r.p2 = p2; if(f->rasp){ telldot(f); outTsl(Hmoveto, f->tag, f->dot.r.p1); } } void telldot(File *f) { if(f->rasp == 0) panic("telldot"); if(f->dot.r.p1==f->tdot.p1 && f->dot.r.p2==f->tdot.p2) return; ...
__label__POS
0.720273
#include "sam.h" #include "parse.h" int Glooping; int nest; int append(File*, Cmd*, Posn); int display(File*); void looper(File*, Cmd*, int); void filelooper(Cmd*, int); void linelooper(File*, Cmd*); void resetxec(void) { Glooping = nest = 0; } int cmdexec(File *f, Cmd *cp) { int i; Addr *ap; Address a; if(f ...
__label__POS
0.60201
#include "sam.h" Rune samname[] = L"~~sam~~"; Rune *left[]= { L"{[(<«", L"\n", L"'\"`", 0 }; Rune *right[]= { L"}])>»", L"\n", L"'\"`", 0 }; char RSAM[] = "sam"; char SAMTERM[] = "/bin/aux/samterm"; char HOME[] = "home"; char TMPDIR[] = "/tmp"; char SH[] = "rc"; char SHPATH[] = "/bin/rc"; char RX[] = "rx"; c...
__label__POS
0.672246
#include "rc.h" #define Bit(i) (7-(i)) /* N 0's preceded by i 1's, T(Bit(2)) is 1100 0000 */ #define T(i) (((1 << (Bit(i)+1))-1) ^ 0xFF) /* 0000 0000 0000 0111 1111 1111 */ #define RuneX(i) ((1 << (Bit(i) + ((i)-1)*Bitx))-1) enum { Bitx = Bit(1), Tx = T(1), /* 1000 0000 */ Rune1 = (1<<(Bit(0)+0*Bitx))-1, /* 000...
__label__POS
0.909097
/* * Plan 9 versions of system-specific functions * By convention, exported routines herein have names beginning with an * upper case letter. */ #include "rc.h" #include "exec.h" #include "io.h" #include "fns.h" char *Signame[] = { "sigexit", "sighup", "sigint", "sigquit", "sigalrm", "sigkill", "sigfpe", "sigterm...
__label__POS
0.615262
#include "rc.h" #include "exec.h" #include "fns.h" unsigned hash(char *as, int n) { int i = 1; unsigned h = 0; uchar *s; s = (uchar *)as; while (*s) h += *s++ * i++; return h % n; } #define NKW 30 struct kw{ char *name; int type; struct kw *next; }*kw[NKW]; void kenter(int type, char *name) { int h = ha...
__label__POS
0.811275
#include "rc.h" #include "exec.h" #include "io.h" #include "fns.h" tree *treenodes; /* * create and clear a new tree node, and add it * to the node list. */ tree* newtree(void) { tree *t = new(tree); t->iskw = 0; t->str = 0; t->child[0] = t->child[1] = t->child[2] = 0; t->next = treenodes; treenodes = t; ret...
__label__POS
0.8103
#include "rc.h" #include "exec.h" #include "io.h" #include "fns.h" int havefork = 0; static char ** rcargv(char *s) { int argc; char **argv; word *p; p = vlook("*")->val; argv = emalloc((count(p)+6)*sizeof(char*)); argc = 0; argv[argc++] = argv0; if(flag['e']) argv[argc++] = "-Se"; else argv[argc++] = "...
__label__POS
0.680674
#include "gc.h" /* * Based on: Granlund, T.; Montgomery, P.L. * "Division by Invariant Integers using Multiplication". * SIGPLAN Notices, Vol. 29, June 1994, page 61. */ #define TN(n) ((uvlong)1 << (n)) #define T31 TN(31) #define T32 TN(32) int multiplier(ulong d, int p, uvlong *mp) { int l; uvlong mlo, mhi, t...
__label__POS
0.94619
#include <u.h> #include <libc.h> #include <fcall.h> #include <bio.h> #include <regexp.h> #define Extern #include "exportfs.h" Reprog **exclude, **include; char *patternfile; void exclusions(void) { Biobuf *f; int ni, nmaxi, ne, nmaxe; char *line; if(patternfile == nil) return; f = Bopen(patternfile, OREAD); ...
__label__POS
0.90077
#ifndef UTILINTRUSIVELIST_H #define UTILINTRUSIVELIST_H #ifdef _WIN32 #pragma once #endif #include "basetypes.h" #include "utlmemory.h" #include "dbg.h" namespace IntrusiveList { #ifdef SUPERSLOW_DEBUG_VERSION template<class T> inline void ValidateDList(T* head) { if (head) { ...
__label__POS
0.664536
#include <u.h> #include <libc.h> #include <auth.h> #include <fcall.h> #include <thread.h> #include <9p.h> #include "cifs.h" struct { char *name; int (*func)(Fmt *f); char *buf; int len; } Infdir[] = { { "Users", userinfo }, { "Groups", groupinfo }, { "Shares", shareinfo }, { "Connection", conninfo }, { "...
__label__POS
0.976228
#ifndef UTLSORTVECTOR_H #define UTLSORTVECTOR_H #ifdef _WIN32 #pragma once #endif #include "utlvector.h" #ifndef _WIN32 extern void* g_pUtlSortVectorQSortContext; #endif template <class T> class CUtlSortVectorDefaultLess { public: bool Less(const T& lhs, const T& rhs, void*) { return lhs < rhs; } }; template...
__label__POS
0.670206
#include <u.h> #include <libc.h> #include <bio.h> #include <ctype.h> #include <mach.h> #define Extern extern #include "acid.h" #include "y.tab.h" static int syren; Lsym* unique(char *buf, Sym *s) { Lsym *l; int i, renamed; renamed = 0; strcpy(buf, s->name); for(;;) { l = look(buf); if(l == 0 || (l->lexval =...
__label__POS
0.640302
#include <u.h> #include <libc.h> #include <bio.h> #include <ctype.h> #include <mach.h> #define Extern extern #include "acid.h" static List **tail; List* construct(Node *l) { List *lh, **save; save = tail; lh = 0; tail = &lh; build(l); tail = save; return lh; } int listlen(List *l) { int len; len = 0; wh...
__label__POS
0.933435
#define EXTERN #include "gc.h" /* Bits bor(Bits a, Bits b) { Bits c; int i; for(i=0; i<BITS; i++) c.b[i] = a.b[i] | b.b[i]; return c; } */ /* Bits band(Bits a, Bits b) { Bits c; int i; for(i=0; i<BITS; i++) c.b[i] = a.b[i] & b.b[i]; return c; } */ /* Bits bnot(Bits a) { Bits c; int i; for(i=0; i<BI...
__label__POS
0.904604
#include <u.h> #include <libc.h> #include <bio.h> #include <ctype.h> #include <mach.h> #define Extern extern #include "acid.h" #include "y.tab.h" struct keywd { char *name; int terminal; } keywds[] = { "do", Tdo, "if", Tif, "then", Tthen, "else", Telse, "while", Twhile, "loop", Tloop, "head", Thead, "t...
__label__POS
0.857974
#include <u.h> #include <libc.h> #include <bio.h> #include <ctype.h> #include <mach.h> #define Extern extern #include "acid.h" #include "y.tab.h" static void install(int); void nocore(void) { int i; if(cormap == 0) return; for (i = 0; i < cormap->nsegs; i++) if (cormap->seg[i].inuse && cormap->seg[i].fd >= 0...
__label__POS
0.716071
#include <u.h> /* * The code makes two assumptions: strlen(ld) is 1 or 2; latintab[i].ld can be a * prefix of latintab[j].ld only when j<i. */ struct cvlist { char *ld; /* must be seen before using this conversion */ char *si; /* options for last input characters */ Rune *so; /* the corresponding Rune for eac...
__label__POS
0.991911
#ifndef CONTROLS_H #define CONTROLS_H #ifdef _WIN32 #pragma once #endif #include "VGUI.h" #include "IPanel.h" #include "IKeyValuesSystem.h" #include "interface.h" #include "MouseCode.h" #include "KeyCode.h" #include "tier3.h" namespace vgui { bool VGui_InitInterfacesList(const char* moduleName, CreateInterfaceFn...
__label__POS
0.979525
#include <u.h> #include <libc.h> #include "compat.h" typedef struct Exporter Exporter; struct Exporter { int fd; Chan **roots; int nroots; }; int mounter(char *mntpt, int how, int fd, int n) { char buf[32]; int i, ok, mfd; ok = 1; for(i = 0; i < n; i++){ snprint(buf, sizeof buf, "%d", i); mfd = dup(fd, -1...
__label__POS
0.884579
#include "all.h" static int readmsg(Chan *c, void *abuf, int n, int *ninep) { int fd, len; uchar *buf; buf = abuf; fd = c->chan; qlock(&c->rlock); if(readn(fd, buf, 3) != 3){ qunlock(&c->rlock); print("readn(3) fails: %r\n"); return -1; } if((50 <= buf[0] && buf[0] <= 87 && (buf[0]&1)==0 && GBIT16(buf+1...
__label__POS
0.85152
#include "astro.h" double dist(Obj1 *p, Obj1 *q) { double a; a = sin(p->decl2)*sin(q->decl2) + cos(p->decl2)*cos(q->decl2)*cos(p->ra-q->ra); a = fabs(atan2(pyth(a), a)) / radsec; return a; } int rline(int f) { char *p; int c; static char buf[1024]; static int bc, bn, bf; if(bf != f) { bf = f; bn = 0;...
__label__POS
0.884405
#include "astro.h" double mercfp[] = { 0.013, 0.6807, 0.048, 0.6283, 0.185, 0.6231, 0.711, 0.6191, 0.285, 0.5784, 0.075, 0.5411, 0.019, 0.5585, 0.010, 2.8449, 0.039, 2.8117, 0.147, 2.8135, 0.552, 2.8126, 2.100, 2.8126, 3.724, 2.8046, 0.729, 2.7883, 0.186, 2.7890, 0.049, 2.7943, 0.013, ...
__label__POS
0.805465
#include <u.h> #include <libc.h> #include <bio.h> #include "sky.h" double PI_180 = 0.0174532925199432957692369; double TWOPI = 6.2831853071795864769252867665590057683943387987502; double LN2 = 0.69314718055994530941723212145817656807550013436025; static double angledangle=(180./PI)*MILLIARCSEC; int rint(char *p, int ...
__label__POS
0.664394
#include <u.h> #include <libc.h> #include "dat.h" Place nowhere = { Undef, Undef }; static void setlat(Place *p, double lat) { p->lat = lat; } static void setlon(Place *p, double lon) { p->lon = lon; } static int printlatlon(char *p, int n, double lat, char po, char ne) { char c; double d; int deg, min, sec; ...
__label__POS
0.608519
#ifndef UTLRBTREE_H #define UTLRBTREE_H #include "utlmemory.h" #include "utlfixedmemory.h" #include "utlblockmemory.h" #define FOR_EACH_UTLRBTREE( treeName, iteratorName ) \ for ( int iteratorName = treeName.FirstInorder(); (treeName).IsUtlRBTree && iteratorName != treeName.InvalidIndex(); iteratorName = treeName.N...
__label__POS
0.610171
#include "stdinc.h" #include "9.h" typedef struct { char* argv0; int (*cmd)(int, char*[]); } Cmd; static struct { QLock lock; Cmd* cmd; int ncmd; int hi; } cbox; enum { NCmdIncr = 20, }; int cliError(char* fmt, ...) { char *p; va_list arg; va_start(arg, fmt); p = vsmprint(fmt, arg); werrstr("%s", p); ...
__label__POS
0.960657
#include <u.h> #include <libc.h> typedef uvlong u64int; #define TWID64 ((u64int)~(u64int)0) u64int unittoull(char *s) { char *es; u64int n; if(s == nil) return TWID64; n = strtoul(s, &es, 0); if(*es == 'k' || *es == 'K'){ n *= 1024; es++; }else if(*es == 'm' || *es == 'M'){ n *= 1024*1024; es++; }...
__label__POS
0.689696
#include <u.h> #include <libc.h> #include <thread.h> #include <venti.h> #include <bio.h> char *host; Biobuf b; VtConn *z; uchar *buf; void run(Biobuf*); int nn; void usage(void) { fprint(2, "usage: readlist [-h host] list\n"); threadexitsall("usage"); } int parsescore(uchar *score, char *buf, int n) { int i, c; ...
__label__POS
0.772804
#include "all.h" #define FDEV(d) ((d)->fw.fw) enum { DEBUG = 0 }; Devsize fwormsize(Device *d) { Devsize l; l = devsize(FDEV(d)); l -= l/(BUFSIZE*8) + 1; return l; } void fwormream(Device *d) { Iobuf *p; Device *fdev; Off a, b; print("fworm ream\n"); devinit(d); fdev = FDEV(d); a = fwormsize(d); b = ...
__label__POS
0.801529
#include "all.h" struct { char* name; Userid uid; Userid lead; } minusers[] = { "adm", -1, -1, "none", 0, -1, "tor", 1, 1, "sys", 10000, 0, "map", 10001, 10001, "doc", 10002, 0, "upas", 10003, 10003, "font", 10004, 0, "bootes", 10005, 10005, 0 }; static char buf[4096]; static Rune ichar[] = L"?=+...
__label__POS
0.699051
#include <u.h> #include <libc.h> #include <ctype.h> #include <authsrv.h> #include <mp.h> #include <libsec.h> #include <bio.h> #include "authcmdlib.h" char authkey[DESKEYLEN]; int verb; int usepass; int convert(char*, char*, int); int dofcrypt(int, char*, char*, int); void usage(void); void main(int argc, char *argv[...
__label__POS
0.691051
#include <u.h> #include <libc.h> #include <bio.h> #include <ctype.h> #include "authcmdlib.h" void clrbio(Acctbio *a) { int i; if(a->user) free(a->user); if(a->name) free(a->name); if(a->dept) free(a->dept); for(i = 0; i < Nemail; i++) if(a->email[i]) free(a->email[i]); memset(a, 0, sizeof(Acctbio)); ...
__label__POS
0.756984
#include <u.h> #include <libc.h> #include <authsrv.h> #include <bio.h> #include "authcmdlib.h" static char *pbmsg = "AS protocol botch"; int asrdresp(int fd, char *buf, int len) { char error[AERRLEN]; if(read(fd, buf, 1) != 1){ werrstr(pbmsg); return -1; } switch(buf[0]){ case AuthOK: if(readn(fd, buf, l...
__label__POS
0.626201
typedef struct Opt Opt; int debug; #define DPRINT if(debug)fprint enum { /* control characters */ Se= 240, /* end subnegotiation */ NOP= 241, Mark= 242, /* data mark */ Break= 243, Interrupt= 244, Abort= 245, /* TENEX ^O */ AreYouThere= 246, Erasechar= 247, /* erase last character */ Eraseline= 248...
__label__POS
0.699186
#include <u.h> #include <libc.h> #include "flashfs.h" int convJ2M(Jrec *j, uchar *buff) { int m, n; switch(j->type) { case FT_create: if(j->mode & (1 << 8)) { if(j->mode & DMDIR) j->type = FT_DCREATE1; else j->type = FT_FCREATE1; } else { if(j->mode & DMDIR) j->type = FT_DCREATE0; els...
__label__POS
0.646462
#include "all.h" #include <ndb.h> static int alarmflag; static int Iconv(Fmt*); static void openudp(int); static void cachereply(Rpccall*, void*, int); static int replycache(int, Rpccall*, long (*)(int, void*, long)); static void udpserver(int, Progmap*); static void tcpserver(int, Progmap*); static void getendpoints...
__label__POS
0.703869
import numpy as np from .. import _base class NCSSBeforeAfter(_base.DatasetHotellingsPaired): def _set_values(self): self.www = 'http://ncss.wpengine.netdna-cdn.com/wp-content/themes/ncss/pdf/Procedures/NCSS/Hotellings_One-Sample_T2.pdf' self.YA = np.array([[36,34,30], [36,36,28], [41,32,29], [11,10,8], ...
__label__POS
0.985757
import numpy as np from .. import _base class RSXLHotellings1(_base.DatasetHotellings1): def _set_values(self): self.www = 'http://www.real-statistics.com/multivariate-statistics/hotellings-t-square-statistic/one-sample-hotellings-t-square/' self.Y = np.array([ [6, 8, 3, 5, 19], [6, 7, 3, 4, 9], [5, 7...
__label__POS
0.862585
#ifndef _POSIX_SOURCE #include <u.h> #include <libc.h> #else #define _BSD_EXTENSION #include <stdlib.h> #include <unistd.h> #include <string.h> #endif #include <stdio.h> #define ERR(str, chr) if(opterr){fprintf(stderr, "%s%s%c\n", argv[0], str, chr);} int opterr = 1; int optind = 1; int optopt; char ...
__label__POS
0.746507
#include <u.h> #include <libc.h> #include <bio.h> #include <ctype.h> #include "common.h" #include "comments.h" #include "path.h" struct strtab charcode[FONTSIZE] = { {4, "\\000"}, {4, "\\001"}, {4, "\\002"}, {4, "\\003"}, {4, "\\004"}, {4, "\\005"}, {4, "\\006"}, {4, "\\007"}, {4, "\\010"}, {4, "\\011"}, {4, "\\012...
__label__POS
0.972287
// Axel '0vercl0k' Souchet - 27 April 2019 // CVE-2019-9810 - IonMonkey MArraySlice incorrect alias information // The issue has been found by Amat Cama and Richard Zhu for compromising Mozilla Firefox // during Pwn2Own2019. // const Debug = false; const dbg = p => { if(Debug == false) { return; } ...
__label__POS
0.635287
import numpy as np from .. import _base class Detergent(_base.DatasetANOVA2): def _set_values(self): self.www = 'http://statweb.stanford.edu/~susan/courses/s141/exanova.pdf' self.Y = np.array([4,5,6,5, 7,9,8,12, 10,12,11,9, 6,6,4,4, 13,15,12,12, 12,13,10,13]) self.A = np.array([0,0,0,0,...
__label__POS
0.919463
import numpy as np from .. import _base class Antidepressant(_base.DatasetANOVA2rm): def _set_values(self): self.www = 'http://www.pc.rhul.ac.uk/staff/J.Larsson/teaching/pdfs/repeatedmeasures.pdf' Y = np.array([ [70, 60, 81, 52], [66, 52, 70, 40], [56, 41, 60, 31], [68, 59, 77, 49], ]) m,...
__label__POS
0.891562
#include <u.h> #include <libc.h> #include <bio.h> #include <ctype.h> Biobuf in; Biobuf out; enum { Empty, Sys, Dk, Ip, Domain, }; int iscomment(char *name) { return *name == '#'; } /* * is this a fully specified datakit name? */ int isdk(char *name) { int slash; slash = 0; for(; *name; name++){ if(is...
__label__POS
0.916784
/* * common code for all the assemblers */ void pragpack(void) { while(getnsc() != '\n') ; } void pragvararg(void) { while(getnsc() != '\n') ; } void pragfpround(void) { while(getnsc() != '\n') ; } void pragprofile(void) { while(getnsc() != '\n') ; } void pragincomplete(void) { while(getnsc() != '\n...
__label__POS
0.703456
#include <u.h> #include <libc.h> #include <ctype.h> #include <bio.h> #include <comments.h> #include <path.h> #define UNKNOWNCHAR "/sys/lib/postscript/prologues/pjw.char.ps" char *optnames = "a:c:f:l:m:n:o:p:s:t:x:y:P:"; double aspectratio = 1.0; Biobuf inbuf, outbuf; Biobuf *bin, *bout; int char_no = 0; /* characte...
__label__POS
0.611259
#include "cc.h" static char *kwd[] = { "$adt", "$aggr", "$append", "$builtin", "$complex", "$defn", "$delete", "$do", "$else", "$eval", "$head", "$if", "$local", "$loop", "$return", "$tail", "$then", "$union", "$whatis", "$while", }; static char picklestr[] = "\tbp = pickle(bp, ep, un, "; static char* pmap(char *...
__label__POS
0.626456
#define VARMAC 0x80 long getnsn(void) { long n; int c; c = getnsc(); if(c < '0' || c > '9') return -1; n = 0; while(c >= '0' && c <= '9') { n = n*10 + c-'0'; c = getc(); } unget(c); return n; } static void nextsym(int c) { int c1; char *cp; for(cp = symb;;) { if(c >= Runeself) { for(c1=0;;) {...
__label__POS
0.635228
/* Copyright © Coraid, Inc. 2006. All rights reserved. */ #include <u.h> #include <libc.h> #include "cec.h" int fd = -1; int cfd = -1; int efd = -1; int netopen0(char *e) { char buf[128], ctl[13]; int n; snprint(buf, sizeof buf, "%s/clone", e); if((efd = open(buf, ORDWR)) == -1) return -1; memset(ctl, 0, siz...
__label__POS
0.988782
#include "stdinc.h" #include "dat.h" #include "fns.h" void waitforkick(Round *r) { int n; qlock(&r->lock); r->last = r->current; assert(r->current+1 == r->next); rwakeupall(&r->finish); while(!r->doanother) rsleep(&r->start); n = r->next++; r->current = n; r->doanother = 0; qunlock(&r->lock); } static vo...
__label__POS
0.82689
#include "stdinc.h" #include "dat.h" #include "fns.h" static int verbose; static int fd; static int fd1; static uchar *data; static uchar *data1; static int blocksize; static int sleepms; void usage(void) { fprint(2, "usage: cmparenas [-b blocksize] [-s ms] [-v] arenapart1 arenapart2 [name...]]\n"); threadexitsall(...
__label__POS
0.821657
#include "stdinc.h" #include "dat.h" #include "fns.h" static uchar *data; static uchar *data1; static int blocksize; static int sleepms; static int fd; static int force; static vlong offset0; void usage(void) { fprint(2, "usage: reseal [-f] [-b blocksize] [-s ms] arenapart1 [name...]]\n"); threadexitsall(0); } sta...
__label__POS
0.758606
#include "stdinc.h" #include "dat.h" #include "fns.h" static char vcmagic[] = "venti config\n"; enum { Maxconfig = 8 * 1024, Maglen = sizeof vcmagic - 1, }; int readifile(IFile *f, char *name) { Part *p; ZBlock *b; u8int *z; p = initpart(name, OREAD); if(p == nil) return -1; b = alloczblock(Maxconfig+1, 1...
__label__POS
0.807801
#include "stdinc.h" #include "dat.h" #include "fns.h" static int syncarenaindex(Arena *arena, u64int a0) { int ok; u32int clump; u64int a; ClumpInfo ci; IAddr ia; AState as; if(arena->diskstats.clumps == arena->memstats.clumps) return 0; memset(&as, 0, sizeof as); as.arena = arena; as.stats = arena->di...
__label__POS
0.837321
#include "stdinc.h" #include "dat.h" #include "fns.h" int namecmp(char *s, char *t) { return strncmp(s, t, ANameSize); } void namecp(char *dst, char *src) { strncpy(dst, src, ANameSize - 1); dst[ANameSize - 1] = '\0'; } int nameok(char *name) { char *t; int c; if(name == nil) return -1; for(t = name; c = *...
__label__POS
0.95916
#include <u.h> #include <libc.h> int alarmed; int done; void usage(void) { fprint(2, "usage: %s [-q]\n", argv0); exits("usage"); } void ding(void*, char *s) { if(strstr(s, "alarm")){ alarmed = 1; noted(NCONT); } else noted(NDFLT); } void main(int argc, char **argv) { int fd, cfd; int i; char buf[1]; ...
__label__POS
0.617678
#include <u.h> #include <libc.h> void usage(void) { fprint(2, "usage: %s [-q] [-t secs] goodstring [badstring ...]\n", argv0); exits("usage"); } void catch(void*, char *s) { exits(s); } int writewithoutcr(int fd, char *p, int i) { char *q, *e; /* dump cr's */ for(e = p+i; p < e; ){ q = memchr(p, '\r', e-p);...
__label__POS
0.951009
/* * Mirror one arena partition onto another. * Be careful to copy only new data. */ #include "stdinc.h" #include "dat.h" #include "fns.h" Channel *writechan; typedef struct Write Write; struct Write { uchar *p; int n; uvlong o; int error; }; Part *src; Part *dst; int force; int verbose; int dosha1 = 1; ch...
__label__POS
0.66083
#include "stdinc.h" #include "dat.h" #include "fns.h" static int verbose; static int fd; static uchar *data; static int blocksize; static int sleepms; static vlong offset0; void usage(void) { fprint(2, "usage: verifyarena [-b blocksize] [-s ms] [-v] [arenapart [name...]]\n"); threadexitsall(0); } static int preadb...
__label__POS
0.789727
#include <u.h> #include <libc.h> void usage(void) { fprint(2, "usage: %s [-q] [-t seconds] command\n", argv0); exits("usage"); } struct { char *resp; int ok; } tab[] = { { "ok\n", 1 }, { "connect\n", 1 }, { "no carrier\n", 0 }, { "no dialtone\n", 0 }, { "error\n", 0 }, { "busy\n", 0 }, { "no answer\n",...
__label__POS
0.926794
#include <u.h> #include <libc.h> #include "git.h" #define TMPPATH(suff) (".git/objects/pack/repack."suff) int cleanup(Hash h) { char newpfx[42], dpath[256], fpath[256]; int i, j, nd; Dir *d; snprint(newpfx, sizeof(newpfx), "%H.", h); for(i = 0; i < 256; i++){ snprint(dpath, sizeof(dpath), ".git/objects/%02x"...
__label__POS
0.65268
#include <u.h> #include <libc.h> #include "git.h" char *fetchbranch; char *upstream = "origin"; int listonly; int resolveremote(Hash *h, char *ref) { char buf[128], *s; int r, f; ref = strip(ref); if((r = hparse(h, ref)) != -1) return r; /* Slightly special handling: translate remote refs to local ones. */ ...
__label__POS
0.776537
#include <u.h> #include <libc.h> #include <ctype.h> #include "git.h" typedef struct Eval Eval; enum { Blank, Keep, Drop, Skip, }; struct Eval { char *str; char *p; Object **stk; int nstk; int stksz; }; static char *colors[] = { [Keep] "keep", [Drop] "drop", [Blank] "blank", [Skip] "skip", }; static Objec...
__label__POS
0.807931
#include <u.h> #include <libc.h> #include <ctype.h> #include "git.h" #define Useragent "useragent git/2.24.1" #define Contenthdr "headers Content-Type: application/x-git-%s-pack-request" #define Accepthdr "headers Accept: application/x-git-%s-pack-result" enum { Nproto = 16, Nport = 16, Nhost = 256, Npath = 128,...
__label__POS
0.956467
#include <u.h> #include <libc.h> #include <ctype.h> #include "git.h" Reprog *authorpat; Hash Zhash; int chattygit; int interactive = 1; Object* emptydir(void) { static Object *e; if(e != nil) return ref(e); e = emalloc(sizeof(Object)); e->hash = Zhash; e->type = GTree; e->tree = emalloc(sizeof(Tinfo)); e-...
__label__POS
0.957888
#include "stdinc.h" #include "dat.h" #include "fns.h" static int extra, missing, wrong; static void phdr(DBlock *eb) { static int did; if(!did){ did = 1; print("# diff actual correct\n"); } print("%s block 0x%llux\n", eb->part->name, eb->addr); } static void pie(IEntry *ie, char c) { print("%c %V %22lld %3...
__label__POS
0.636724
#include <u.h> #include <libc.h> #include <ctype.h> #include <auth.h> #include "git.h" char *pathpfx = nil; int allowwrite; int fmtpkt(Conn *c, char *fmt, ...) { char pkt[Pktmax]; va_list ap; int n; va_start(ap, fmt); n = vsnprint(pkt, sizeof(pkt), fmt, ap); n = writepkt(c, pkt, n); va_end(ap); return n; } ...
__label__POS
0.792755
#include <u.h> #include <libc.h> #include "git.h" typedef struct Capset Capset; typedef struct Map Map; struct Capset { int sideband; int sideband64k; int report; }; struct Map { char *ref; Hash ours; Hash theirs; }; int sendall; int force; int nbranch; char **branch; char *removed[128]; int nremoved; int np...
__label__POS
0.808758
#include <u.h> #include <libc.h> #include <ctype.h> #include "git.h" enum { Sinit, Siter, }; static int crackidx(char *path, int *np) { int fd; char buf[4]; if((fd = open(path, OREAD)) == -1) return -1; if(seek(fd, 8 + 255*4, 0) == -1) return -1; if(readn(fd, buf, sizeof(buf)) != sizeof(buf)) return -1;...
__label__POS
0.965457
#include "stdinc.h" #include "dat.h" #include "fns.h" /* * disk structure conversion routines */ #define U8GET(p) ((p)[0]) #define U16GET(p) (((p)[0]<<8)|(p)[1]) #define U32GET(p) ((u32int)(((p)[0]<<24)|((p)[1]<<16)|((p)[2]<<8)|(p)[3])) #define U64GET(p) (((u64int)U32GET(p)<<32)|(u64int)U32GET((p)+4)) #define U8PUT...
__label__POS
0.751365
/* * * debugger * */ #include "defs.h" #include "fns.h" int printcol = 0; int infile = STDIN; int maxpos = MAXPOS; Biobuf stdout; void printc(int c) { dprint("%c", c); } /* was move to next f1-sized tab stop; now just print a tab */ int tconv(Fmt *f) { return fmtstrcpy(f, "\t"); } void flushbuf(void) { if...
__label__POS
0.704482
#include "stdinc.h" #include "dat.h" #include "fns.h" typedef struct AHash AHash; /* * hash table for finding arena's based on their names. */ struct AHash { AHash *next; Arena *arena; }; enum { AHashSize = 512, Emergency = 0, /* flag: performing emergency surgery */ }; static AHash *ahash[AHashSize]; stati...
__label__POS
0.874916
#include <plan9.h> #include <fcall.h> static uchar* gstring(uchar *p, uchar *ep, char **s) { uint n; if(p+BIT16SZ > ep) return nil; n = GBIT16(p); p += BIT16SZ - 1; if(p+n+1 > ep) return nil; /* move it down, on top of count, to make room for '\0' */ memmove(p, p + 1, n); p[n] = '\0'; *s = (char*)p; p +...
__label__POS
0.864933
#include <plan9.h> #include <fcall.h> int statcheck(uchar *buf, uint nbuf) { uchar *ebuf; int i; ebuf = buf + nbuf; buf += STATFIXLEN - 4 * BIT16SZ; for(i = 0; i < 4; i++){ if(buf + BIT16SZ > ebuf) return -1; buf += BIT16SZ + GBIT16(buf); } if(buf != ebuf) return -1; return 0; } static char null...
__label__POS
0.710425
#include <plan9.h> #include <fcall.h> static uchar* pstring(uchar *p, char *s) { uint n; n = strlen(s); PBIT16(p, n); p += BIT16SZ; memmove(p, s, n); p += n; return p; } static uchar* pqid(uchar *p, Qid *q) { PBIT8(p, q->type); p += BIT8SZ; PBIT32(p, q->vers); p += BIT32SZ; PBIT64(p, q->path); p += BIT6...
__label__POS
0.904444
#include <plan9.h> #include <fcall.h> uint sizeD2M(Dir *d) { char *sv[4]; int i, ns; sv[0] = d->name; sv[1] = d->uid; sv[2] = d->gid; sv[3] = d->muid; ns = 0; for(i = 0; i < 4; i++) ns += strlen(sv[i]); return STATFIXLEN + ns; } uint convD2M(Dir *d, uchar *buf, uint nbuf) { uchar *p, *ebuf; char *sv[4...
__label__POS
0.823594
#include <plan9.h> #define SIZE 4096 extern int printcol; int print(char *fmt, ...) { char buf[SIZE], *out; va_list arg, temp; int n; va_start(arg, fmt); va_copy(temp, arg); out = doprint(buf, buf+SIZE, fmt, &temp); va_end(temp); va_end(arg); n = write(1, buf, (long)(out-buf)); return n; } int fprint(int ...
__label__POS
0.92068
#include <u.h> #include <libc.h> #include "drawterm.h" void* erealloc(void *v, ulong n) { v = realloc(v, n); if(v == nil) sysfatal("out of memory"); return v; } char* estrdup(char *s) { s = strdup(s); if(s == nil) sysfatal("out of memory"); return s; } char* estrappend(char *s, char *fmt, ...) { char *t; ...
__label__POS
0.768637
#include "u.h" #include "lib.h" #include "kern/dat.h" #include "kern/fns.h" #include "user.h" #include "drawterm.h" char *argv0; char *user; extern int errfmt(Fmt*); void sizebug(void) { /* * Needed by various parts of the code. * This is a huge bug. */ assert(sizeof(char)==1); assert(sizeof(short)==2); as...
__label__POS
0.608395
#include <u.h> #include <libc.h> #include <draw.h> #include <memdraw.h> int _loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) { int y, l, lpart, rpart, mx, m, mr; uchar *q; if(!rectinrect(r, i->r)) return -1; l = bytesperline(r, i->depth); if(ndata < l*Dy(r)) return -1; ndata = l*Dy(r); q = b...
__label__POS
0.720823
#include <u.h> #include <libc.h> #include <draw.h> #include <memdraw.h> #include <memlayer.h> Point memimagestring(Memimage *b, Point p, Memimage *color, Point cp, Memsubfont *f, char *cs) { int w, width; uchar *s; Rune c; Fontchar *i; s = (uchar*)cs; for(; (c=*s); p.x+=width, cp.x+=width){ width = 0; if(c ...
__label__POS
0.907451
#include <u.h> #include <libc.h> #include <draw.h> #include <memdraw.h> #define poolalloc(a, b) malloc(b) #define poolfree(a, b) free(b) void memimagemove(void *from, void *to) { Memdata *md; md = *(Memdata**)to; if(md->base != from){ print("compacted data not right: #%p\n", md->base); abort(); } md->base =...
__label__POS
0.654518
#include <u.h> #include <libc.h> #include <auth.h> #include <authsrv.h> #include "authlocal.h" enum { ARgiveup = 100, }; static int dorpc(AuthRpc *rpc, char *verb, char *val, int len, AuthGetkey *getkey) { int ret; for(;;){ if((ret = auth_rpc(rpc, verb, val, len)) != ARneedkey && ret != ARbadkey) return ret;...
__label__POS
0.773996
#include <u.h> #include <libc.h> #include <fcall.h> static uchar* gstring(uchar *p, uchar *ep, char **s) { uint n; if(p+BIT16SZ > ep) return nil; n = GBIT16(p); p += BIT16SZ - 1; if(p+n+1 > ep) return nil; /* move it down, on top of count, to make room for '\0' */ memmove(p, p + 1, n); p[n] = '\0'; *s = ...
__label__POS
0.817847
#include <u.h> #include <libc.h> #include "fmtdef.h" /* * Reads a floating-point number by interpreting successive characters * returned by (*f)(vp). The last call it makes to f terminates the * scan, so is not a character in the number. It may therefore be * necessary to back up the input stream up one byte aft...
__label__POS
0.824269
#include <u.h> #include <libc.h> #define Bit(i) (7-(i)) /* N 0's preceded by i 1's, T(Bit(2)) is 1100 0000 */ #define T(i) (((1 << (Bit(i)+1))-1) ^ 0xFF) /* 0000 0000 0000 0111 1111 1111 */ #define RuneX(i) ((1 << (Bit(i) + ((i)-1)*Bitx))-1) enum { Bitx = Bit(1), Tx = T(1), /* 1000 0000 */ Rune1 = (1<<(Bit(0)+0...
__label__POS
0.903177
#include <u.h> #include <libc.h> #include "fmtdef.h" static int runeFmtStrFlush(Fmt *f) { Rune *s; int n; if(f->start == nil) return 0; n = (uintptr)f->farg; n *= 2; s = (Rune*)f->start; f->start = realloc(s, sizeof(Rune)*n); if(f->start == nil){ f->farg = nil; f->to = nil; f->stop = nil; free(s); ...
__label__POS
0.989841
#include <u.h> #include <libc.h> static uvlong order = (uvlong) 0x0001020304050607ULL; static void be2vlong(vlong *to, uchar *f) { uchar *t, *o; int i; t = (uchar*)to; o = (uchar*)&order; for(i = 0; i < 8; i++) t[o[i]] = f[i]; } /* * After a fork with fd's copied, both fd's are pointing to * the same Cha...
__label__POS
0.681612
#include <u.h> #include <libc.h> #include <fcall.h> int statcheck(uchar *buf, uint nbuf) { uchar *ebuf; int i; ebuf = buf + nbuf; if(nbuf < STATFIXLEN || nbuf != BIT16SZ + GBIT16(buf)) return -1; buf += STATFIXLEN - 4 * BIT16SZ; for(i = 0; i < 4; i++){ if(buf + BIT16SZ > ebuf) return -1; buf += BIT1...
__label__POS
0.833562
#include <u.h> #include <libc.h> #include <fcall.h> static uchar* pstring(uchar *p, char *s) { uint n; if(s == nil){ PBIT16(p, 0); p += BIT16SZ; return p; } n = strlen(s); PBIT16(p, n); p += BIT16SZ; memmove(p, s, n); p += n; return p; } static uchar* pqid(uchar *p, Qid *q) { PBIT8(p, q->type); p +...
__label__POS
0.913518
#include <u.h> #include <libc.h> #include <fcall.h> uint sizeD2M(Dir *d) { char *sv[4]; int i, ns; sv[0] = d->name; sv[1] = d->uid; sv[2] = d->gid; sv[3] = d->muid; ns = 0; for(i = 0; i < 4; i++) if(sv[i]) ns += strlen(sv[i]); return STATFIXLEN + ns; } uint convD2M(Dir *d, uchar *buf, uint nbuf) { u...
__label__POS
0.773726
#include <u.h> #include <libc.h> static char qsep[] = " \t\r\n"; static char* qtoken(char *s, char *sep) { int quoting; char *t; quoting = 0; t = s; /* s is output string, t is input string */ while(*t!='\0' && (quoting || utfrune(sep, *t)==nil)){ if(*t != '\''){ *s++ = *t++; continue; } /* *t is a ...
__label__POS
0.873119