/*******************************************************************************
 * Copyright (c) 2015 hangum.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 *
 * Contributors:
 *     hangum - initial API and implementation
 ******************************************************************************/
package com.hangum.tadpole.engine.sql.parser.define;

import java.util.regex.Pattern;

/**
 * parser deifne
 *
 * @author hangum
 *
 */
public class ParserDefine {
	/** REGEXP pattern flag */
	public final static int PATTERN_FLAG = Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL;
}

{'repo_name': 'hangum/TadpoleForDBTools', 'stars': '512', 'repo_language': 'Java', 'file_name': 'MANIFEST.MF', 'mime_type': 'text/plain', 'hash': -8634139450201159930, 'source_dataset': 'data'}


/* shc.c */

/**
 * This software contains an ad hoc version of the 'Alleged RC4' algorithm,
 * which was anonymously posted on sci.crypt news by cypherpunks on Sep 1994.
 *
 * My implementation is a complete rewrite of the one found in
 * an unknown-copyright (283 characters) version picked up from:
 *    From: allen@gateway.grumman.com (John L. Allen)
 *    Newsgroups: comp.lang.c
 *    Subject: Shrink this C code for fame and fun
 *    Date: 21 May 1996 10:49:37 -0400
 * And it is licensed also under GPL.
 *
 *That's where I got it, now I am going to do some work on it
 *It will reside here: http://github.com/neurobin/shc
 */

static const char my_name[] = "shc";
static const char version[] = "Version 4.0.3";
static const char subject[] = "Generic Shell Script Compiler";
static const char cpright[] = "GNU GPL Version 3";
static const struct { const char * f, * s, * e; }
	provider = { "Md Jahidul", "Hamid", "<jahidulhamid@yahoo.com>" };

/*
static const struct { const char * f, * s, * e; }
	author = { "Francisco", "Garcia", "<frosal@fi.upm.es>" };
*/
/*This is the original author who first came up with this*/

static const char * copying[] = {
"Copying:",
"",
"    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, write to the Free Software",
"    @Neurobin, Dhaka, Bangladesh",
"",
"    Report problems and questions to:http://github.com/neurobin/shc",
"",
0};

static const char * abstract[] = {
"Abstract:",
"",
"    This tool generates a stripped binary executable version",
"    of the script specified at command line.",
"",
"    Binary version will be saved with a .x extension by default.",
"    You can specify output file name too with [-o filname] option.",
"",
"    You can specify expiration date [-e] too, after which binary will",
"    refuse to be executed, displaying \"[-m]\" instead.",
"",
"    You can compile whatever interpreted script, but valid [-i], [-x]",
"    and [-l] options must be given.",
"",
0};

static const char usage[] =
"Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-o outfile] [-rvDSUHCABh] -f script";

static const char * help[] = {
"",
"    -e %s  Expiration date in dd/mm/yyyy format [none]",
"    -m %s  Message to display upon expiration [\"Please contact your provider\"]",
"    -f %s  File name of the script to compile",
"    -i %s  Inline option for the shell interpreter i.e: -e",
"    -x %s  eXec command, as a printf format i.e: exec('%s',@ARGV);",
"    -l %s  Last shell option i.e: --",
"    -o %s  output filename",
"    -r     Relax security. Make a redistributable binary",
"    -v     Verbose compilation",
"    -S     Switch ON setuid for root callable programs [OFF]",
"    -D     Switch ON debug exec calls [OFF]",
"    -U     Make binary untraceable [no]",
"    -H     Hardening : extra security protection [no]",
"           Require bourne shell (sh) and parameters are not supported",
"    -C     Display license and exit",
"    -A     Display abstract and exit",
"    -B     Compile for busybox",
"    -h     Display help and exit",
"",
"    Environment variables used:",
"    Name    Default  Usage",
"    CC      cc       C compiler command",
"    CFLAGS  <none>   C compiler flags",
"    LDFLAGS <none>   Linker flags",
"",
"    Please consult the shc man page.",
"",
0};

#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>

#define SIZE 4096

static char * file;
static char * file2;
static char   date[21];
static char * mail = "Please contact your provider jahidulhamid@yahoo.com";
static char   rlax[1];
static char * shll;
static char * inlo;
static char * xecc;
static char * lsto;
static char * opts;
static char * text;
static int verbose;
static const char SETUID_line[] =
"#define SETUID %d	/* Define as 1 to call setuid(0) at start of script */\n";
static int SETUID_flag = 0;
static const char DEBUGEXEC_line[] =
"#define DEBUGEXEC	%d	/* Define as 1 to debug execvp calls */\n";
static int DEBUGEXEC_flag = 0;
static const char TRACEABLE_line[] =
"#define TRACEABLE	%d	/* Define as 1 to enable ptrace the executable */\n";
static int TRACEABLE_flag = 1;
static const char HARDENING_line[] =
"#define HARDENING	%d	/* Define as 1 to disable ptrace/dump the executable */\n";
static int HARDENING_flag = 0;
static const char BUSYBOXON_line[] =
"#define BUSYBOXON	%d	/* Define as 1 to enable work with busybox */\n";
static int BUSYBOXON_flag = 0;

static const char * RTC[] = {
"",
"#if HARDENING",
"static const char * shc_x[] = {",
"\"/*\",",
"\" * Copyright 2019 - Intika <intika@librefox.org>\",",
"\" * Replace ******** with secret read from fd 21\",",
"\" * Also change arguments location of sub commands (sh script commands)\",",
"\" * gcc -Wall -fpic -shared -o shc_secret.so shc_secret.c -ldl\",",
"\" */\",",
"\"\",",
"\"#define _GNU_SOURCE /* needed to get RTLD_NEXT defined in dlfcn.h */\",",
"\"#define PLACEHOLDER \\\"********\\\"\",",
"\"#include <dlfcn.h>\",",
"\"#include <stdlib.h>\",",
"\"#include <string.h>\",",
"\"#include <unistd.h>\",",
"\"#include <stdio.h>\",",
"\"#include <signal.h>\",",
"\"\",",
"\"static char secret[128000]; //max size\",",
"\"typedef int (*pfi)(int, char **, char **);\",",
"\"static pfi real_main;\",",
"\"\",",
"\"// copy argv to new location\",",
"\"char **copyargs(int argc, char** argv){\",",
"\"    char **newargv = malloc((argc+1)*sizeof(*argv));\",",
"\"    char *from,*to;\",",
"\"    int i,len;\",",
"\"\",",
"\"    for(i = 0; i<argc; i++){\",",
"\"        from = argv[i];\",",
"\"        len = strlen(from)+1;\",",
"\"        to = malloc(len);\",",
"\"        memcpy(to,from,len);\",",
"\"        // zap old argv space\",",
"\"        memset(from,'\\\\0',len);\",",
"\"        newargv[i] = to;\",",
"\"        argv[i] = 0;\",",
"\"    }\",",
"\"    newargv[argc] = 0;\",",
"\"    return newargv;\",",
"\"}\",",
"\"\",",
"\"static int mymain(int argc, char** argv, char** env) {\",",
"\"    //fprintf(stderr, \\\"Inject main argc = %d\\\\n\\\", argc);\",",
"\"    return real_main(argc, copyargs(argc,argv), env);\",",
"\"}\",",
"\"\",",
"\"int __libc_start_main(int (*main) (int, char**, char**),\",",
"\"                      int argc,\",",
"\"                      char **argv,\",",
"\"                      void (*init) (void),\",",
"\"                      void (*fini)(void),\",",
"\"                      void (*rtld_fini)(void),\",",
"\"                      void (*stack_end)){\",",
"\"    static int (*real___libc_start_main)() = NULL;\",",
"\"    int n;\",",
"\"\",",
"\"    if (!real___libc_start_main) {\",",
"\"        real___libc_start_main = dlsym(RTLD_NEXT, \\\"__libc_start_main\\\");\",",
"\"        if (!real___libc_start_main) abort();\",",
"\"    }\",",
"\"\",",
"\"    n = read(21, secret, sizeof(secret));\",",
"\"    if (n > 0) {\",",
"\"      int i;\",",
"\"\",",
"\"    if (secret[n - 1] == '\\\\n') secret[--n] = '\\\\0';\",",
"\"    for (i = 1; i < argc; i++)\",",
"\"        if (strcmp(argv[i], PLACEHOLDER) == 0)\",",
"\"          argv[i] = secret;\",",
"\"    }\",",
"\"\",",
"\"    real_main = main;\",",
"\"\",",
"\"    return real___libc_start_main(mymain, argc, argv, init, fini, rtld_fini, stack_end);\",",
"\"}\",",
"\"\",",
"0};",
"#endif /* HARDENING */",
"",
"/* rtc.c */",
"",
"#include <sys/stat.h>",
"#include <sys/types.h>",
"",
"#include <errno.h>",
"#include <stdio.h>",
"#include <stdlib.h>",
"#include <string.h>",
"#include <time.h>",
"#include <unistd.h>",
"",
"/* 'Alleged RC4' */",
"",
"static unsigned char stte[256], indx, jndx, kndx;",
"",
"/*",
" * Reset arc4 stte. ",
" */",
"void stte_0(void)",
"{",
"	indx = jndx = kndx = 0;",
"	do {",
"		stte[indx] = indx;",
"	} while (++indx);",
"}",
"",
"/*",
" * Set key. Can be used more than once. ",
" */",
"void key(void * str, int len)",
"{",
"	unsigned char tmp, * ptr = (unsigned char *)str;",
"	while (len > 0) {",
"		do {",
"			tmp = stte[indx];",
"			kndx += tmp;",
"			kndx += ptr[(int)indx % len];",
"			stte[indx] = stte[kndx];",
"			stte[kndx] = tmp;",
"		} while (++indx);",
"		ptr += 256;",
"		len -= 256;",
"	}",
"}",
"",
"/*",
" * Crypt data. ",
" */",
"void arc4(void * str, int len)",
"{",
"	unsigned char tmp, * ptr = (unsigned char *)str;",
"	while (len > 0) {",
"		indx++;",
"		tmp = stte[indx];",
"		jndx += tmp;",
"		stte[indx] = stte[jndx];",
"		stte[jndx] = tmp;",
"		tmp += stte[indx];",
"		*ptr ^= stte[tmp];",
"		ptr++;",
"		len--;",
"	}",
"}",
"",
"/* End of ARC4 */",
"",
"#if HARDENING",
"",
"#include <sys/ptrace.h>",
"#include <sys/wait.h>",
"#include <signal.h>",
"#include <sys/prctl.h>",
"#define PR_SET_PTRACER 0x59616d61",
"",
"/* Seccomp Sandboxing Init */",
"#include <stdlib.h>",
"#include <stdio.h>",
"#include <stddef.h>",
"#include <string.h>",
"#include <unistd.h>",
"#include <errno.h>",
"",
"#include <sys/types.h>",
"#include <sys/prctl.h>",
"#include <sys/syscall.h>",
"#include <sys/socket.h>",
"",
"#include <linux/filter.h>",
"#include <linux/seccomp.h>",
"#include <linux/audit.h>",
"",
"#define ArchField offsetof(struct seccomp_data, arch)",
"",
"#define Allow(syscall) \\",
"    BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, SYS_##syscall, 0, 1), \\",
"    BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW)",
"",
"struct sock_filter filter[] = {",
"    /* validate arch */",
"    BPF_STMT(BPF_LD+BPF_W+BPF_ABS, ArchField),",
"    BPF_JUMP( BPF_JMP+BPF_JEQ+BPF_K, AUDIT_ARCH_X86_64, 1, 0),",
"    BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),",
"",
"    /* load syscall */",
"    BPF_STMT(BPF_LD+BPF_W+BPF_ABS, offsetof(struct seccomp_data, nr)),",
"",
"    /* list of allowed syscalls */",
"    Allow(exit_group),  /* exits a process */",
"    Allow(brk),         /* for malloc(), inside libc */",
"    Allow(mmap),        /* also for malloc() */",
"    Allow(munmap),      /* for free(), inside libc */",
"",
"    /* and if we don't match above, die */",
"    BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL),",
"};",
"struct sock_fprog filterprog = {",
"    .len = sizeof(filter)/sizeof(filter[0]),",
"    .filter = filter",
"};",
"",
"/* Seccomp Sandboxing - Set up the restricted environment */",
"void seccomp_hardening() {",
"    if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {",
"        perror(\"Could not start seccomp:\");",
"        exit(1);",
"    }",
"    if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &filterprog) == -1) {",
"        perror(\"Could not start seccomp:\");",
"        exit(1);",
"    }",
"} ",
"/* End Seccomp Sandboxing Init */",
"",
"void shc_x_file() {",
"    FILE *fp;",
"    int line = 0;",
"",
"    if ((fp = fopen(\"/tmp/shc_x.c\", \"w\")) == NULL ) {exit(1); exit(1);}",
"    for (line = 0; shc_x[line]; line++)	fprintf(fp, \"%s\\n\", shc_x[line]);",
"    fflush(fp);fclose(fp);",
"}",
"",
"int make() {",
"	char * cc, * cflags, * ldflags;",
"    char cmd[4096];",
"",
"	cc = getenv(\"CC\");",
"	if (!cc) cc = \"cc\";",
"",
"	sprintf(cmd, \"%s %s -o %s %s\", cc, \"-Wall -fpic -shared\", \"/tmp/shc_x.so\", \"/tmp/shc_x.c -ldl\");",
"	if (system(cmd)) {remove(\"/tmp/shc_x.c\"); return -1;}",
"	remove(\"/tmp/shc_x.c\"); return 0;",
"}",
"",
"void arc4_hardrun(void * str, int len) {",
"    //Decode locally",
"    char tmp2[len];",
"    char tmp3[len+1024];",
"    memcpy(tmp2, str, len);",
"",
"	unsigned char tmp, * ptr = (unsigned char *)tmp2;",
"    int lentmp = len;",
"    int pid, status;",
"    pid = fork();",
"",
"    shc_x_file();",
"    if (make()) {exit(1);}",
"",
"    setenv(\"LD_PRELOAD\",\"/tmp/shc_x.so\",1);",
"",
"    if(pid==0) {",
"",
"        //Start tracing to protect from dump & trace",
"        if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {",
"            kill(getpid(), SIGKILL);",
"            _exit(1);",
"        }",
"",
"        //Decode Bash",
"        while (len > 0) {",
"            indx++;",
"            tmp = stte[indx];",
"            jndx += tmp;",
"            stte[indx] = stte[jndx];",
"            stte[jndx] = tmp;",
"            tmp += stte[indx];",
"            *ptr ^= stte[tmp];",
"            ptr++;",
"            len--;",
"        }",
"",
"        //Do the magic",
"        sprintf(tmp3, \"%s %s\", \"'********' 21<<<\", tmp2);",
"",
"        //Exec bash script //fork execl with 'sh -c'",
"        system(tmp2);",
"",
"        //Empty script variable",
"        memcpy(tmp2, str, lentmp);",
"",
"        //Clean temp",
"        remove(\"/tmp/shc_x.so\");",
"",
"        //Sinal to detach ptrace",
"        ptrace(PTRACE_DETACH, 0, 0, 0);",
"        exit(0);",
"    }",
"    else {wait(&status);}",
"",
"    /* Seccomp Sandboxing - Start */",
"    seccomp_hardening();",
"",
"    exit(0);",
"}",
"#endif /* HARDENING */",
"",
"/*",
" * Key with file invariants. ",
" */",
"int key_with_file(char * file)",
"{",
"	struct stat statf[1];",
"	struct stat control[1];",
"",
"	if (stat(file, statf) < 0)",
"		return -1;",
"",
"	/* Turn on stable fields */",
"	memset(control, 0, sizeof(control));",
"	control->st_ino = statf->st_ino;",
"	control->st_dev = statf->st_dev;",
"	control->st_rdev = statf->st_rdev;",
"	control->st_uid = statf->st_uid;",
"	control->st_gid = statf->st_gid;",
"	control->st_size = statf->st_size;",
"	control->st_mtime = statf->st_mtime;",
"	control->st_ctime = statf->st_ctime;",
"	key(control, sizeof(control));",
"	return 0;",
"}",
"",
"#if DEBUGEXEC",
"void debugexec(char * sh11, int argc, char ** argv)",
"{",
"	int i;",
"	fprintf(stderr, \"shll=%s\\n\", sh11 ? sh11 : \"<null>\");",
"	fprintf(stderr, \"argc=%d\\n\", argc);",
"	if (!argv) {",
"		fprintf(stderr, \"argv=<null>\\n\");",
"	} else { ",
"		for (i = 0; i <= argc ; i++)",
"			fprintf(stderr, \"argv[%d]=%.60s\\n\", i, argv[i] ? argv[i] : \"<null>\");",
"	}",
"}",
"#endif /* DEBUGEXEC */",
"",
"void rmarg(char ** argv, char * arg)",
"{",
"	for (; argv && *argv && *argv != arg; argv++);",
"	for (; argv && *argv; argv++)",
"		*argv = argv[1];",
"}",
"",
"void chkenv_end(void);",
"",
"int chkenv(int argc)",
"{",
"	char buff[512];",
"	unsigned long mask, m;",
"	int l, a, c;",
"	char * string;",
"	extern char ** environ;",
"",
"	mask = (unsigned long)getpid();",
"	stte_0();",
"	 key(&chkenv, (void*)&chkenv_end - (void*)&chkenv);",
"	 key(&data, sizeof(data));",
"	 key(&mask, sizeof(mask));",
"	arc4(&mask, sizeof(mask));",
"	sprintf(buff, \"x%lx\", mask);",
"	string = getenv(buff);",
"#if DEBUGEXEC",
"	fprintf(stderr, \"getenv(%s)=%s\\n\", buff, string ? string : \"<null>\");",
"#endif",
"	l = strlen(buff);",
"	if (!string) {",
"		/* 1st */",
"		sprintf(&buff[l], \"=%lu %d\", mask, argc);",
"		putenv(strdup(buff));",
"		return 0;",
"	}",
"	c = sscanf(string, \"%lu %d%c\", &m, &a, buff);",
"	if (c == 2 && m == mask) {",
"		/* 3rd */",
"		rmarg(environ, &string[-l - 1]);",
"		return 1 + (argc - a);",
"	}",
"	return -1;",
"}",
"",
"void chkenv_end(void){}",
"",
"#if HARDENING",
"",
"static void gets_process_name(const pid_t pid, char * name) {",
"	char procfile[BUFSIZ];",
"	sprintf(procfile, \"/proc/%d/cmdline\", pid);",
"	FILE* f = fopen(procfile, \"r\");",
"	if (f) {",
"		size_t size;",
"		size = fread(name, sizeof (char), sizeof (procfile), f);",
"		if (size > 0) {",
"			if ('\\n' == name[size - 1])",
"				name[size - 1] = '\\0';",
"		}",
"		fclose(f);",
"	}",
"}",
"",
"void hardening() {",
"    prctl(PR_SET_DUMPABLE, 0);",
"    prctl(PR_SET_PTRACER, -1);",
"",
"    int pid = getppid();",
"    char name[256] = {0};",
"    gets_process_name(pid, name);",
"",
"    if (   (strcmp(name, \"bash\") != 0) ",
"        && (strcmp(name, \"/bin/bash\") != 0) ",
"        && (strcmp(name, \"sh\") != 0) ",
"        && (strcmp(name, \"/bin/sh\") != 0) ",
"        && (strcmp(name, \"sudo\") != 0) ",
"        && (strcmp(name, \"/bin/sudo\") != 0) ",
"        && (strcmp(name, \"/usr/bin/sudo\") != 0)",
"        && (strcmp(name, \"gksudo\") != 0) ",
"        && (strcmp(name, \"/bin/gksudo\") != 0) ",
"        && (strcmp(name, \"/usr/bin/gksudo\") != 0) ",
"        && (strcmp(name, \"kdesu\") != 0) ",
"        && (strcmp(name, \"/bin/kdesu\") != 0) ",
"        && (strcmp(name, \"/usr/bin/kdesu\") != 0) ",
"       )",
"    {",
"        printf(\"Operation not permitted\\n\");",
"        kill(getpid(), SIGKILL);",
"        exit(1);",
"    }",
"}",
"",
"#endif /* HARDENING */",
"",
"#if !TRACEABLE",
"",
"#define _LINUX_SOURCE_COMPAT",
"#include <sys/ptrace.h>",
"#include <sys/types.h>",
"#include <sys/wait.h>",
"#include <fcntl.h>",
"#include <signal.h>",
"#include <stdio.h>",
"#include <unistd.h>",
"",
"#if !defined(PT_ATTACHEXC) /* New replacement for PT_ATTACH */",
"   #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)",
"       #define PT_ATTACHEXC	PT_ATTACH",
"   #elif defined(PTRACE_ATTACH)",
"       #define PT_ATTACHEXC PTRACE_ATTACH",
"   #endif",
"#endif",
"",
"void untraceable(char * argv0)",
"{",
"	char proc[80];",
"	int pid, mine;",
"",
"	switch(pid = fork()) {",
"	case  0:",
"		pid = getppid();",
"		/* For problematic SunOS ptrace */",
"#if defined(__FreeBSD__)",
"		sprintf(proc, \"/proc/%d/mem\", (int)pid);",
"#else",
"		sprintf(proc, \"/proc/%d/as\",  (int)pid);",
"#endif",
"		close(0);",
"		mine = !open(proc, O_RDWR|O_EXCL);",
"		if (!mine && errno != EBUSY)",
"			mine = !ptrace(PT_ATTACHEXC, pid, 0, 0);",
"		if (mine) {",
"			kill(pid, SIGCONT);",
"		} else {",
/*"			fprintf(stderr, \"%s is being traced!\\n\", argv0);",*/
"			perror(argv0);",
"			kill(pid, SIGKILL);",
"		}",
"		_exit(mine);",
"	case -1:",
"		break;",
"	default:",
"		if (pid == waitpid(pid, 0, 0))",
"			return;",
"	}",
"	perror(argv0);",
"	_exit(1);",
"}",
"#endif /* !TRACEABLE */",
"",
"char * xsh(int argc, char ** argv)",
"{",
"	char * scrpt;",
"	int ret, i, j;",
"	char ** varg;",
"	char * me = argv[0];",
"	if (me == NULL) { me = getenv(\"_\"); }",
"	if (me == 0) { fprintf(stderr, \"E: neither argv[0] nor $_ works.\"); exit(1); }",
"",
"	ret = chkenv(argc);",
"	stte_0();",
"	 key(pswd, pswd_z);",
"	arc4(msg1, msg1_z);",
"	arc4(date, date_z);",
"	if (date[0] && (atoll(date)<time(NULL)))",
"		return msg1;",
"	arc4(shll, shll_z);",
"	arc4(inlo, inlo_z);",
"	arc4(xecc, xecc_z);",
"	arc4(lsto, lsto_z);",
"	arc4(tst1, tst1_z);",
"	 key(tst1, tst1_z);",
"	arc4(chk1, chk1_z);",
"	if ((chk1_z != tst1_z) || memcmp(tst1, chk1, tst1_z))",
"		return tst1;",
"	arc4(msg2, msg2_z);",
"	if (ret < 0)",
"		return msg2;",
"	varg = (char **)calloc(argc + 10, sizeof(char *));",
"	if (!varg)",
"		return 0;",
"	if (ret) {",
"		arc4(rlax, rlax_z);",
"		if (!rlax[0] && key_with_file(shll))",
"			return shll;",
"		arc4(opts, opts_z);",
"#if HARDENING",
"	    arc4_hardrun(text, text_z);",
"	    exit(0);",
"       /* Seccomp Sandboxing - Start */",
"       seccomp_hardening();",
"#endif",
"		arc4(text, text_z);",
"		arc4(tst2, tst2_z);",
"		 key(tst2, tst2_z);",
"		arc4(chk2, chk2_z);",
"		if ((chk2_z != tst2_z) || memcmp(tst2, chk2, tst2_z))",
"			return tst2;",
"		/* Prepend hide_z spaces to script text to hide it. */",
"		scrpt = malloc(hide_z + text_z);",
"		if (!scrpt)",
"			return 0;",
"		memset(scrpt, (int) ' ', hide_z);",
"		memcpy(&scrpt[hide_z], text, text_z);",
"	} else {			/* Reexecute */",
"		if (*xecc) {",
"			scrpt = malloc(512);",
"			if (!scrpt)",
"				return 0;",
"			sprintf(scrpt, xecc, me);",
"		} else {",
"			scrpt = me;",
"		}",
"	}",
"	j = 0;",
"#if BUSYBOXON",
"	varg[j++] = \"busybox\";",
"	varg[j++] = \"sh\";",
"#else",
"	varg[j++] = argv[0];		/* My own name at execution */",
"#endif",
"	if (ret && *opts)",
"		varg[j++] = opts;	/* Options on 1st line of code */",
"	if (*inlo)",
"		varg[j++] = inlo;	/* Option introducing inline code */",
"	varg[j++] = scrpt;		/* The script itself */",
"	if (*lsto)",
"		varg[j++] = lsto;	/* Option meaning last option */",
"	i = (ret > 1) ? ret : 0;	/* Args numbering correction */",
"	while (i < argc)",
"		varg[j++] = argv[i++];	/* Main run-time arguments */",
"	varg[j] = 0;			/* NULL terminated array */",
"#if DEBUGEXEC",
"	debugexec(shll, j, varg);",
"#endif",
"	execvp(shll, varg);",
"	return shll;",
"}",
"",
"int main(int argc, char ** argv)",
"{",
"#if SETUID",
"   setuid(0);",
"#endif",
"#if DEBUGEXEC",
"	debugexec(\"main\", argc, argv);",
"#endif",
"#if HARDENING",
"	hardening();",
"#endif",
"#if !TRACEABLE",
"	untraceable(argv[0]);",
"#endif",
"	argv[1] = xsh(argc, argv);",
"	fprintf(stderr, \"%s%s%s: %s\\n\", argv[0],",
"		errno ? \": \" : \"\",",
"		errno ? strerror(errno) : \"\",",
"		argv[1] ? argv[1] : \"<null>\"",
"	);",
"	return 1;",
"}",
0};

static int parse_an_arg(int argc, char * argv[])
{
	extern char * optarg;
	const char * opts = "e:m:f:i:x:l:o:rvDSUHCABh";
	struct tm tmp[1];
	time_t expdate;
	int cnt, l;
	char ctrl;

	switch (getopt(argc, argv, opts)) {
	case 'e':
		memset(tmp, 0, sizeof(tmp));
		cnt = sscanf(optarg, "%2d/%2d/%4d%c",
			&tmp->tm_mday, &tmp->tm_mon, &tmp->tm_year, &ctrl);
		if (cnt == 3) {
			tmp->tm_mon--;
			tmp->tm_year -= 1900;
			expdate = mktime(tmp);
		}
		if (cnt != 3 || expdate <= 0) {
			fprintf(stderr, "%s parse(-e %s): Not a valid value\n",
				my_name,  optarg);
			return -1;
		}
		sprintf(date, "%lld", (long long)expdate);
		if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate));
		expdate = atoll(date);
		if (verbose) fprintf(stderr, "%s -e %s", my_name, ctime(&expdate));
		break;
	case 'm':
		mail = optarg;
		break;
	case 'f':
		if (file) {
			fprintf(stderr, "%s parse(-f): Specified more than once\n",
				my_name);
			return -1;
		}
		file = optarg;
		break;
	case 'i':
		inlo = optarg;
		break;
	case 'x':
		xecc = optarg;
		break;
	case 'l':
		lsto = optarg;
		break;
	case 'o':
		file2 = optarg;
		break;
	case 'r':
		rlax[0]++;
		break;
	case 'v':
		verbose++;
		break;
	case 'S':
		SETUID_flag = 1;
        break;
	case 'D':
		DEBUGEXEC_flag = 1;
		break;
	case 'U':
		TRACEABLE_flag = 0;
		break;
	case 'H':
		HARDENING_flag = 1;
		break;
	case 'C':
		fprintf(stderr, "%s %s, %s\n", my_name, version, subject);
		fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e);
		fprintf(stderr, "%s ", my_name);
		for (l = 0; copying[l]; l++)
			fprintf(stderr, "%s\n", copying[l]);
		fprintf(stderr, "    %s %s %s\n\n", provider.f, provider.s, provider.e);
		exit(0);
		break;
	case 'A':
		fprintf(stderr, "%s %s, %s\n", my_name, version, subject);
		fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e);
		fprintf(stderr, "%s ", my_name);
		for (l = 0; abstract[l]; l++)
			fprintf(stderr, "%s\n", abstract[l]);
		exit(0);
		break;
	case 'h':
		fprintf(stderr, "%s %s, %s\n", my_name, version, subject);
		fprintf(stderr, "%s %s %s %s %s\n", my_name, cpright, provider.f, provider.s, provider.e);
		fprintf(stderr, "%s %s\n", my_name, usage);
		for (l = 0; help[l]; l++)
			fprintf(stderr, "%s\n", help[l]);
		exit(0);
		break;
	case -1:
		if (!file) {
			fprintf(stderr, "%s parse(-f): No source file specified\n", my_name);
			file = "";
			return -1;
		}
		return 0;
	case 'B':
		BUSYBOXON_flag = 1;
		break;
	case ':':
		fprintf(stderr, "%s parse: Missing parameter\n", my_name);
		return -1;
	case '?':
		fprintf(stderr, "%s parse: Unknown option\n", my_name);
		return -1;
	default:
		fprintf(stderr, "%s parse: Unknown return\n", my_name);
		return -1;
	}
	return 1;
}

static void parse_args(int argc, char * argv[])
{
	int err = 0;
	int ret;

#if 0
	my_name = strrchr(argv[0], '/');
	if (my_name)
		my_name++;
	else
		my_name = argv[0];
#endif

	do {
		ret = parse_an_arg(argc, argv);
		if (ret == -1)
			err++;
	} while (ret);

	if (err) {
		fprintf(stderr, "\n%s %s\n\n", my_name, usage);
		exit(1);
	}
}

/* 'Alleged RC4' */

static unsigned char stte[256], indx, jndx, kndx;

/*
 * Reset arc4 stte.
 */
void stte_0(void)
{
	indx = jndx = kndx = 0;
	do {
		stte[indx] = indx;
	} while (++indx);
}

/*
 * Set key. Can be used more than once.
 */
void key(void * str, int len)
{
	unsigned char tmp, * ptr = (unsigned char *)str;
	while (len > 0) {
		do {
			tmp = stte[indx];
			kndx += tmp;
			kndx += ptr[(int)indx % len];
			stte[indx] = stte[kndx];
			stte[kndx] = tmp;
		} while (++indx);
		ptr += 256;
		len -= 256;
	}
}

/*
 * Crypt data.
 */
void arc4(void * str, int len)
{
	unsigned char tmp, * ptr = (unsigned char *)str;
	while (len > 0) {
		indx++;
		tmp = stte[indx];
		jndx += tmp;
		stte[indx] = stte[jndx];
		stte[jndx] = tmp;
		tmp += stte[indx];
		*ptr ^= stte[tmp];
		ptr++;
		len--;
	}
}

/* End of ARC4 */

/*
 * Key with file invariants.
 */
int key_with_file(char * file)
{
	struct stat statf[1];
	struct stat control[1];

	if (stat(file, statf) < 0)
		return -1;

	/* Turn on stable fields */
	memset(control, 0, sizeof(control));
	control->st_ino = statf->st_ino;
	control->st_dev = statf->st_dev;
	control->st_rdev = statf->st_rdev;
	control->st_uid = statf->st_uid;
	control->st_gid = statf->st_gid;
	control->st_size = statf->st_size;
	control->st_mtime = statf->st_mtime;
	control->st_ctime = statf->st_ctime;
	key(control, sizeof(control));
	return 0;
}

/*
 * NVI stands for Shells that complaint "Not Valid Identifier" on
 * environment variables with characters as "=|#:*?$ ".
 */
struct {
	char * shll;
	char * inlo;
	char * lsto;
	char * xecc;
} shellsDB[] = {
	{ "perl", "-e", "--", "exec('%s',@ARGV);" },
	{ "rc",   "-c", "",   "builtin exec %s $*" },
	{ "sh",   "-c", "",   "exec '%s' \"$@\"" }, /* IRIX_nvi */
	{ "dash", "-c", "",   "exec '%s' \"$@\"" },
	{ "bash", "-c", "",   "exec '%s' \"$@\"" },
	{ "zsh",  "-c", "",   "exec '%s' \"$@\"" },
	{ "bsh",  "-c", "",   "exec '%s' \"$@\"" }, /* AIX_nvi */
	{ "Rsh",  "-c", "",   "exec '%s' \"$@\"" }, /* AIX_nvi */
	{ "ksh",  "-c", "",   "exec '%s' \"$@\"" }, /* OK on Solaris, AIX and Linux (THX <bryan.hogan@dstintl.com>) */
	{ "tsh",  "-c", "--", "exec '%s' \"$@\"" }, /* AIX */
	{ "ash",  "-c", "--", "exec '%s' \"$@\"" }, /* Linux */
	{ "csh",  "-c", "-b", "exec '%s' $argv" }, /* AIX: No file for $0 */
	{ "tcsh", "-c", "-b", "exec '%s' $argv" },
	{ NULL,   NULL, NULL, NULL },
};

int eval_shell(char * text)
{
	int i;
	char * ptr;

	ptr = strchr(text, (int)'\n');
	if (!ptr)
		i = strlen(text);
	else
		i = ptr - text;
	ptr  = malloc(i + 1);
	shll = malloc(i + 1);
	opts = malloc(i + 1);
	if (!ptr || !shll || !opts)
		return -1;
	strncpy(ptr, text, i);
	ptr[i] = '\0';

	*opts = '\0';
	i = sscanf(ptr, " #!%s%s %c", shll, opts, opts);
	if (i < 1 || i > 2) {
		fprintf(stderr, "%s: invalid first line in script: %s\n", my_name, ptr);
		return -1;
	}
	free(ptr);

	shll = realloc(shll, strlen(shll) + 1);
	ptr  = strrchr(shll, (int)'/');
	if (!ptr) {
		fprintf(stderr, "%s: invalid shll\n", my_name);
		return -1;
	}
	if (*ptr == '/')
		ptr++;
	if (verbose) fprintf(stderr, "%s shll=%s\n", my_name, ptr);

	for(i=0; shellsDB[i].shll; i++) {
		if(!strcmp(ptr, shellsDB[i].shll)) {
			if (!inlo)
				inlo = strdup(shellsDB[i].inlo);
			if (!xecc)
				xecc = strdup(shellsDB[i].xecc);
			if (!lsto)
				lsto = strdup(shellsDB[i].lsto);
		}
	}
	if (!inlo || !xecc || !lsto) {
		fprintf(stderr, "%s Unknown shell (%s): specify [-i][-x][-l]\n", my_name, ptr);
		return -1;
	}
	if (verbose) fprintf(stderr, "%s [-i]=%s\n", my_name, inlo);
	if (verbose) fprintf(stderr, "%s [-x]=%s\n", my_name, xecc);
	if (verbose) fprintf(stderr, "%s [-l]=%s\n", my_name, lsto);

	opts = realloc(opts, strlen(opts) + 1);
	if (*opts && !strcmp(opts, lsto)) {
		fprintf(stderr, "%s opts=%s : Is equal to [-l]. Removing opts\n", my_name, opts);
		*opts = '\0';
	} else if (!strcmp(opts, "-")) {
		fprintf(stderr, "%s opts=%s : No real one. Removing opts\n", my_name, opts);
		*opts = '\0';
	}
	if (verbose) fprintf(stderr, "%s opts=%s\n", my_name, opts);
	return 0;
}

char * read_script(char * file)
{
	FILE * i;
	char * text;
	int cnt, l;

	text = malloc(SIZE);
	if (!text)
		return NULL;
	i = fopen(file, "r");
	if (!i)
		return NULL;
	for (l = 0;;) {
		text = realloc(text, l + SIZE);
		if (!text)
			return NULL;
		cnt = fread(&text[l], 1, SIZE, i);
		if (!cnt)
			break;
		l += cnt;
	}
	fclose(i);
	text = realloc(text, l + 1);
	if (!text)
		return NULL;
	text[l] = '\0';

	/* Check current System ARG_MAX limit. */
	if (l > 0.80 * (cnt = sysconf(_SC_ARG_MAX))) {
		fprintf(stderr, "%s: WARNING!!\n"
"   Scripts of length near to (or higher than) the current System limit on\n"
"   \"maximum size of arguments to EXEC\", could comprise its binary execution.\n"
"   In the current System the call sysconf(_SC_ARG_MAX) returns %d bytes\n"
"   and your script \"%s\" is %d bytes length.\n",
		my_name, cnt, file, l);
	}
	return text;
}

unsigned rand_mod(unsigned mod)
{
	/* Without skew */
	unsigned rnd, top = RAND_MAX;
	top -= top % mod;
	while (top <= (rnd = rand()))
		continue;
	/* Using high-order bits. */
	rnd = 1.0*mod*rnd/(1.0+top);
	return rnd;
}

char rand_chr(void)
{
	return (char)rand_mod(1<<(sizeof(char)<<3));
}

int noise(char * ptr, unsigned min, unsigned xtra, int str)
{
	if (xtra) xtra = rand_mod(xtra);
	xtra += min;
	for (min = 0; min < xtra; min++, ptr++)
		do
			*ptr = rand_chr();
		while (str && !isalnum((int)*ptr));
	if (str) *ptr = '\0';
	return xtra;
}

static int offset;

void prnt_bytes(FILE * o, char * ptr, int m, int l, int n)
{
	int i;

	l += m;
	n += l;
	for (i = 0; i < n; i++) {
		if ((i & 0xf) == 0)
			fprintf(o, "\n\t\"");
		fprintf(o, "\\%03o", (unsigned char)((i>=m) && (i<l) ? ptr[i-m] : rand_chr()));
		if ((i & 0xf) == 0xf)
			fprintf(o, "\"");
	}
	if ((i & 0xf) != 0)
		fprintf(o, "\"");
	offset += n;
}

void prnt_array(FILE * o, void * ptr, char * name, int l, char * cast)
{
	int m = rand_mod(1+l/4);		/* Random amount of random pre  padding (offset) */
	int n = rand_mod(1+l/4);		/* Random amount of random post padding  (tail)  */
	int a = (offset+m)%l;
	if (cast && a) m += l - a;		/* Type alignement. */
	fprintf(o, "\n");
	fprintf(o, "#define      %s_z	%d", name, l);
	fprintf(o, "\n");
	fprintf(o, "#define      %s	(%s(&data[%d]))", name, cast?cast:"", offset+m);
	prnt_bytes(o, ptr, m, l, n);
}

void dump_array(FILE * o, void * ptr, char * name, int l, char * cast)
{
	arc4(ptr, l);
	prnt_array(o, ptr, name, l, cast);
}

int write_C(char * file, char * argv[])
{
	char pswd[256];
	int pswd_z = sizeof(pswd);
	char* msg1 = strdup("has expired!\n");
	int msg1_z = strlen(msg1) + 1;
	int date_z = strlen(date) + 1;
	char* kwsh = strdup(shll);
	int shll_z = strlen(shll) + 1;
	int inlo_z = strlen(inlo) + 1;
	int xecc_z = strlen(xecc) + 1;
	int lsto_z = strlen(lsto) + 1;
	char* tst1 = strdup("location has changed!");
	int tst1_z = strlen(tst1) + 1;
	char* chk1 = strdup(tst1);
	int chk1_z = tst1_z;
	char* msg2 = strdup("abnormal behavior!");
	int msg2_z = strlen(msg2) + 1;
	int rlax_z = sizeof(rlax);
	int opts_z = strlen(opts) + 1;
	int text_z = strlen(text) + 1;
	char* tst2 = strdup("shell has changed!");
	int tst2_z = strlen(tst2) + 1;
	char* chk2 = strdup(tst2);
	int chk2_z = tst2_z;
	char* name = strdup(file);
	FILE * o;
	int indx;
	int numd = 0;
	int done = 0;

	/* Encrypt */
	srand((unsigned)time(NULL)^(unsigned)getpid());
	pswd_z = noise(pswd, pswd_z, 0, 0); numd++;
	stte_0();
	 key(pswd, pswd_z);
	msg1_z += strlen(mail);
	msg1 = strcat(realloc(msg1, msg1_z), mail);
	arc4(msg1, msg1_z); numd++;
	arc4(date, date_z); numd++;
	arc4(shll, shll_z); numd++;
	arc4(inlo, inlo_z); numd++;
	arc4(xecc, xecc_z); numd++;
	arc4(lsto, lsto_z); numd++;
	arc4(tst1, tst1_z); numd++;
	 key(chk1, chk1_z);
	arc4(chk1, chk1_z); numd++;
	arc4(msg2, msg2_z); numd++;
	indx = !rlax[0];
	arc4(rlax, rlax_z); numd++;
	if (indx && key_with_file(kwsh)) {
		fprintf(stderr, "%s: invalid file name: %s ", my_name, kwsh);
		perror("");
		exit(1);
	}
	arc4(opts, opts_z); numd++;
	arc4(text, text_z); numd++;
	arc4(tst2, tst2_z); numd++;
	 key(chk2, chk2_z);
	arc4(chk2, chk2_z); numd++;

	/* Output */
	name = strcat(realloc(name, strlen(name)+5), ".x.c");
	o = fopen(name, "w");
	if (!o) {
		fprintf(stderr, "%s: creating output file: %s ", my_name, name);
		perror("");
		exit(1);
	}
	fprintf(o, "#if 0\n");
	fprintf(o, "\t%s %s, %s\n", my_name, version, subject);
	fprintf(o, "\t%s %s %s %s\n\n\t", cpright, provider.f, provider.s, provider.e);
	for (indx = 0; argv[indx]; indx++)
		fprintf(o, "%s ", argv[indx]);
	fprintf(o, "\n#endif\n\n");
	fprintf(o, "static  char data [] = ");
	do {
		done = 0;
		indx = rand_mod(15);
		do {
			switch (indx) {
			case  0: if (pswd_z>=0) {prnt_array(o, pswd, "pswd", pswd_z, 0); pswd_z=done=-1; break;}
			case  1: if (msg1_z>=0) {prnt_array(o, msg1, "msg1", msg1_z, 0); msg1_z=done=-1; break;}
			case  2: if (date_z>=0) {prnt_array(o, date, "date", date_z, 0); date_z=done=-1; break;}
			case  3: if (shll_z>=0) {prnt_array(o, shll, "shll", shll_z, 0); shll_z=done=-1; break;}
			case  4: if (inlo_z>=0) {prnt_array(o, inlo, "inlo", inlo_z, 0); inlo_z=done=-1; break;}
			case  5: if (xecc_z>=0) {prnt_array(o, xecc, "xecc", xecc_z, 0); xecc_z=done=-1; break;}
			case  6: if (lsto_z>=0) {prnt_array(o, lsto, "lsto", lsto_z, 0); lsto_z=done=-1; break;}
			case  7: if (tst1_z>=0) {prnt_array(o, tst1, "tst1", tst1_z, 0); tst1_z=done=-1; break;}
			case  8: if (chk1_z>=0) {prnt_array(o, chk1, "chk1", chk1_z, 0); chk1_z=done=-1; break;}
			case  9: if (msg2_z>=0) {prnt_array(o, msg2, "msg2", msg2_z, 0); msg2_z=done=-1; break;}
			case 10: if (rlax_z>=0) {prnt_array(o, rlax, "rlax", rlax_z, 0); rlax_z=done=-1; break;}
			case 11: if (opts_z>=0) {prnt_array(o, opts, "opts", opts_z, 0); opts_z=done=-1; break;}
			case 12: if (text_z>=0) {prnt_array(o, text, "text", text_z, 0); text_z=done=-1; break;}
			case 13: if (tst2_z>=0) {prnt_array(o, tst2, "tst2", tst2_z, 0); tst2_z=done=-1; break;}
			case 14: if (chk2_z>=0) {prnt_array(o, chk2, "chk2", chk2_z, 0); chk2_z=done=-1; break;}
			}
			indx = 0;
		} while (!done);
	} while (numd+=done);
	fprintf(o, "/* End of data[] */;\n");
	fprintf(o, "#define      %s_z	%d\n", "hide", 1<<12);
	fprintf(o, SETUID_line, SETUID_flag);
	fprintf(o, DEBUGEXEC_line, DEBUGEXEC_flag);
	fprintf(o, TRACEABLE_line, TRACEABLE_flag);
	fprintf(o, HARDENING_line, HARDENING_flag);
    fprintf(o, BUSYBOXON_line, BUSYBOXON_flag);
	for (indx = 0; RTC[indx]; indx++)
		fprintf(o, "%s\n", RTC[indx]);
	fflush(o);
	fclose(o);

	return 0;
}

int make(void)
{
	char * cc, * cflags, * ldflags;
	char cmd[SIZE];

	cc = getenv("CC");
	if (!cc)
		cc = "cc";
	cflags = getenv("CFLAGS");
	if (!cflags)
		cflags = "";
	ldflags = getenv("LDFLAGS");
	if (!ldflags)
		ldflags = "";

if(!file2){
file2=(char*)realloc(file2,strlen(file)+3);
strcpy(file2,file);
file2=strcat(file2,".x");

}
	sprintf(cmd, "%s %s %s %s.x.c -o %s", cc, cflags, ldflags, file, file2);
	if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd);
	if (system(cmd))
		return -1;
	sprintf(cmd, "strip %s", file2);
	if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd);
	if (system(cmd))
		fprintf(stderr, "%s: never mind\n", my_name);
	sprintf(cmd, "chmod ug=rwx,o=rx %s", file2);
	if (verbose) fprintf(stderr, "%s: %s\n", my_name, cmd);
	if (system(cmd))
		fprintf(stderr, "%s: remove read permission\n", my_name);

	return 0;
}

void do_all(int argc, char * argv[])
{
	parse_args(argc, argv);
	text = read_script(file);
	if (!text)
		return;
	if (eval_shell(text))
		return;
	if (write_C(file, argv))
		return;
	if (make())
		return;
	exit(0);
}

int main(int argc, char * argv[])
{
	putenv("LANG=");
	do_all(argc, argv);
	/* Return on error */
	perror(argv[0]);
	exit(1);
	return 1;
}

{'repo_name': 'neurobin/shc', 'stars': '899', 'repo_language': 'C', 'file_name': 'ttest.sh', 'mime_type': 'text/x-shellscript', 'hash': 4822697023351527575, 'source_dataset': 'data'}


/**
 * ScriptDev2 is an extension for mangos providing enhanced features for
 * area triggers, creatures, game objects, instances, items, and spells beyond
 * the default database scripting in mangos.
 *
 * Copyright (C) 2006-2013  ScriptDev2 <http://www.scriptdev2.com/>
 *
 * 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 2 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * World of Warcraft, and all World of Warcraft or Warcraft art, images,
 * and lore are copyrighted by Blizzard Entertainment, Inc.
 */

/**
 * ScriptData
 * SDName:      Durotar
 * SD%Complete: 100
 * SDComment:   Quest support: 5441.
 * SDCategory:  Durotar
 * EndScriptData
 */

/**
 * ContentData
 * npc_lazy_peon
 * EndContentData
 */

#include "precompiled.h"

/*######
## npc_lazy_peon
######*/

enum
{
    SAY_PEON_AWAKE_1        = -1000795,
    SAY_PEON_AWAKE_2        = -1000796,

    SPELL_PEON_SLEEP        = 17743,
    SPELL_AWAKEN_PEON       = 19938,

    NPC_SLEEPING_PEON       = 10556,
    GO_LUMBERPILE           = 175784,
};

struct MANGOS_DLL_DECL npc_lazy_peonAI : public ScriptedAI
{
    npc_lazy_peonAI(Creature* pCreature) : ScriptedAI(pCreature)
    {
        Reset();
        m_uiStopSleepingTimer = urand(30000, 120000);       // Set on spawn to a potential small timer, to get nice results for initial case
    }

    uint32 m_uiResetSleepTimer;                             // Time, until the npc stops harvesting lumber
    uint32 m_uiStopSleepingTimer;                           // Time, until the npcs (re)starts working on its own

    void Reset() override
    {
        m_uiResetSleepTimer = 0;
        m_uiStopSleepingTimer = urand(90000, 120000);       // Sleeping aura has only 2min duration
    }

    // Can also be self invoked for random working
    void StartLumbering(Unit* pInvoker)
    {
        m_uiStopSleepingTimer = 0;
        if (GameObject* pLumber = GetClosestGameObjectWithEntry(m_creature, GO_LUMBERPILE, 15.0f))
        {
            m_creature->RemoveAurasDueToSpell(SPELL_PEON_SLEEP);

            float fX, fY, fZ;
            m_creature->SetWalk(false);
            pLumber->GetContactPoint(m_creature, fX, fY, fZ, CONTACT_DISTANCE);

            if (pInvoker->GetTypeId() == TYPEID_PLAYER)
            {
                DoScriptText(SAY_PEON_AWAKE_1, m_creature);
                ((Player*)pInvoker)->KilledMonsterCredit(m_creature->GetEntry(), m_creature->GetObjectGuid());
                m_creature->GetMotionMaster()->MovePoint(1, fX, fY, fZ);
            }
            else
            {
                m_creature->GetMotionMaster()->MovePoint(2, fX, fY, fZ);
            }
        }
        else
        {
            script_error_log("No GameObject of entry %u was found in range or something really bad happened.", GO_LUMBERPILE);
        }
    }

    void MovementInform(uint32 uiMotionType, uint32 uiPointId) override
    {
        if (uiMotionType != POINT_MOTION_TYPE || !uiPointId)
        {
            return;
        }

        m_creature->HandleEmote(EMOTE_STATE_WORK_CHOPWOOD);
        // TODO - random bevahior for self-invoked awakening guesswork
        m_uiResetSleepTimer = uiPointId == 1 ? 80000 : urand(30000, 60000);
    }

    void UpdateAI(const uint32 uiDiff) override
    {
        if (m_uiResetSleepTimer)
        {
            if (m_uiResetSleepTimer <= uiDiff)
            {
                DoScriptText(SAY_PEON_AWAKE_2, m_creature);
                m_creature->HandleEmote(EMOTE_STATE_NONE);
                EnterEvadeMode();
                m_uiResetSleepTimer = 0;
            }
            else
            {
                m_uiResetSleepTimer -= uiDiff;
            }
        }

        if (m_uiStopSleepingTimer)
        {
            if (m_uiStopSleepingTimer <= uiDiff)
            {
                StartLumbering(m_creature);
            }
            else
            {
                m_uiStopSleepingTimer -= uiDiff;
            }
        }
    }
};

CreatureAI* GetAI_npc_lazy_peon(Creature* pCreature)
{
    return new npc_lazy_peonAI(pCreature);
}

bool EffectDummyCreature_lazy_peon_awake(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget, ObjectGuid /*originalCasterGuid*/)
{
    // always check spellid and effectindex
    if (uiSpellId == SPELL_AWAKEN_PEON && uiEffIndex == EFFECT_INDEX_0)
    {
        if (!pCreatureTarget->HasAura(SPELL_PEON_SLEEP) || pCaster->GetTypeId() != TYPEID_PLAYER || pCreatureTarget->GetEntry() != NPC_SLEEPING_PEON)
        {
            return true;
        }

        if (npc_lazy_peonAI* pPeonAI = dynamic_cast<npc_lazy_peonAI*>(pCreatureTarget->AI()))
        {
            pPeonAI->StartLumbering(pCaster);
        }

        // always return true when we are handling this spell and effect
        return true;
    }

    return false;
}

void AddSC_durotar()
{
    Script* pNewScript;

    pNewScript = new Script;
    pNewScript->Name = "npc_lazy_peon";
    pNewScript->GetAI = &GetAI_npc_lazy_peon;
    pNewScript->pEffectDummyNPC = &EffectDummyCreature_lazy_peon_awake;
    pNewScript->RegisterSelf();
}

{'repo_name': 'mangosArchives/serverZero_Rel19', 'stars': '113', 'repo_language': 'C++', 'file_name': 'Vector2int16.h', 'mime_type': 'text/x-c++', 'hash': -4862835567865875272, 'source_dataset': 'data'}


/****************************************************************************
**
** Copyright (c) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator
**
**
** GNU Free Documentation License
**
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
**
**
****************************************************************************/

// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************

/*!

    \contentspage index.html
    \previouspage creator-using-qt-quick-designer.html
    \page quick-components.html
    \nextpage quick-buttons.html

    \title Creating Components

    A \l{glossary-component}{component} provides a way of defining a new type
    that you can re-use in other QML files. A component is like a black box; it
    interacts with the outside world through properties, signals, and slots, and
    is generally defined in its own QML file. You can import components to
    screens and applications.

    You can use the following QML elements to create components:

    \list

        \o  \l{http://qt-project.org/doc/qt-4.8/qml-borderimage.html}
            {Border Image}
            uses an image as a border or background.

        \o  \l{http://qt-project.org/doc/qt-4.8/qml-image.html}{Image}
            adds a bitmap to the scene. You can stretch and tile images.

        \o  \l{http://qt-project.org/doc/qt-4.8/qml-item.html}{Item}
            is the most basic of all visual items in QML. Even though it has no
            visual appearance, it defines all the properties that are common
            across visual items, such as the x and y position, width and height,
            anchoring, and key handling.

        \o  \l{http://qt-project.org/doc/qt-4.8/qml-rectangle.html}{Rectangle}
            adds a rectangle that is painted with a solid fill color and an
            optional border. You can also use the radius property to create
            rounded rectangles.

        \o  \l{http://qt-project.org/doc/qt-4.8/qml-text.html}{Text}
            adds formatted read-only text.

        \o  \l{http://qt-project.org/doc/qt-4.8/qml-textedit.html}{Text Edit}
            adds a single line of editable formatted text that can be validated.

        \o  \l{http://qt-project.org/doc/qt-4.8/qml-textinput.html}{Text Input}
            adds a single line of editable plain text that can be validated.

        \o  \l{http://qt-project.org/doc/qt-4.8/qml-webview.html}{Web View}
            adds web content to a canvas.

    \endlist

    QML elements allow you to write cross-platform applications with custom look
    and feel. You can also use ready-made Qt Quick Components that enable you to
    create applications with a native look and feel for a particular target
    platform. You can install the components as part of \QSDK.

    When you use the \QC project wizard to create Qt Quick applications, you
    can select which component set to use in your application.

    Even if you use the Qt Quick Components, you can still write cross-platform
    applications, by using different sets of QML files for each platform.

    \section1 Creating Components in Qt Quick Designer

    \list 1

        \o  Select \gui {File > New File or Project > Files and Classes > QML
            > Choose} to create a new .qml file.

            \note Components are listed in the \gui {QML Components} section of
            the \gui Library pane only if the filename begins with a capital
            letter.

        \o  Click \gui Design to open the .qml file in \QMLD.

        \o  Drag and drop an item from the \gui Library pane to the editor.

        \o  Edit item properties in the \gui Properties pane.

            The available properties depend on the item.

    \endlist

    \if defined(qcmanual)
    The following sections contain examples of how to create some common
    components:

    \list

        \o  \l{Creating Buttons}

        \o  \l{Creating Scalable Buttons and Borders}

    \endlist

    \section1 Moving Within Components

    Components can consist of several other components. To view the component
    hierarchy as a bread crumb path when you edit a component on the canvas,
    select \gui {Go into Component} or press \key F2. Click the component
    names in the path to navigate to them. You can easily navigate back to the
    top level when you are done editing the component.

    \image qmldesigner-breadcrumbs.png "Go into Component command"
    \endif
*/

{'repo_name': 'forio/julia-studio', 'stars': '216', 'repo_language': 'C++', 'file_name': 'to-title-case.html', 'mime_type': 'text/html', 'hash': -2273805421245786965, 'source_dataset': 'data'}


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>name.abuchen.portfolio</groupId>
		<artifactId>portfolio-app</artifactId>
		<version>0.48.2-SNAPSHOT</version>
		<relativePath>../portfolio-app</relativePath>
	</parent>

	<artifactId>name.abuchen.portfolio.feature</artifactId>
	<packaging>eclipse-feature</packaging>

	<properties>
		<sonar.skip>true</sonar.skip>
	</properties>

	<build>
		<plugins>
			<plugin>
				<artifactId>maven-enforcer-plugin</artifactId>
				<executions>
					<execution>
						<id>enforce-versions</id>
						<phase>none</phase>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jarsigner-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
</project>

{'repo_name': 'buchen/portfolio', 'stars': '823', 'repo_language': 'Java', 'file_name': 'x86-distro.product', 'mime_type': 'text/xml', 'hash': -8160054697661716, 'source_dataset': 'data'}


// SPDX-License-Identifier: GPL-2.0+
/*
 * (C) Copyright 2002
 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
 * Marius Groeger <mgroeger@sysgo.de>
 *
 * (C) Copyright 2002
 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
 */

/*
 * CPU specific code
 */

#include <common.h>
#include <command.h>
#include <cpu_func.h>
#include <irq_func.h>
#include <asm/cache.h>
#include <asm/system.h>

static void cache_flush(void);

int cleanup_before_linux (void)
{
	/*
	 * this function is called just before we call linux
	 * it prepares the processor for linux
	 *
	 * we turn off caches etc ...
	 */

	disable_interrupts();

	/* turn off I/D-cache */
	icache_disable();
	dcache_disable();
	l2_cache_disable();

	/* flush I/D-cache */
	cache_flush();

	return 0;
}

/* flush I/D-cache */
static void cache_flush (void)
{
#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
	unsigned long i = 0;

	asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));
#endif
}

{'repo_name': 'u-boot/u-boot', 'stars': '1164', 'repo_language': 'C', 'file_name': 'Makefile', 'mime_type': 'text/plain', 'hash': -3276747543334361702, 'source_dataset': 'data'}


#
# Copyright (C) 2020 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas 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 Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.

class AddRootAccountIdToSubmissions < ActiveRecord::Migration[5.2]
  include MigrationHelpers::AddColumnAndFk

  tag :predeploy

  def up
    add_column_and_fk :submissions, :root_account_id, :accounts, if_not_exists: true
  end

  def down
    remove_column :submissions, :root_account_id
  end
end

{'repo_name': 'instructure/canvas-lms', 'stars': '3425', 'repo_language': 'Ruby', 'file_name': 'entry_point.sh', 'mime_type': 'text/x-shellscript', 'hash': 4629609512503576217, 'source_dataset': 'data'}


/* $Id$ */

%#define PUBHASHSIZE 20
%#define OKAUTHTOKSIZE 20

typedef opaque xpub3_hash_t[PUBHASHSIZE];
typedef opaque okauthtok_t[OKAUTHTOKSIZE];

enum oksig_t {
  OK_SIG_NONE = 0,
  OK_SIG_HARDKILL = 1,
  OK_SIG_SOFTKILL = 2,
  OK_SIG_KILL = 3,
  OK_SIG_ABORT = 4
};

enum xpub_version_t {
  XPUB_V1 = 1,
  XPUB_V2 = 2,
  XPUB_V3 = 3
};

struct ok_killsig_t {
  oksig_t sig;
  okauthtok_t authtok;
};

typedef string xpub_var_t <>;
typedef string xpub_str_t <>;
typedef string xpub_key_t <>;
typedef string xpub_fn_t  <>;
typedef unsigned hyper ok_xtime_t;

struct xpub3_identifier_list_t {
    xpub_str_t params<>;
    xpub_str_t opt_params<>;
};

struct xpub3_fstat_t {
  xpub_fn_t  fn;
  u_int32_t  ctime;
  xpub3_hash_t hash;
};

%struct xpub3_expr_t;
%struct xpub3_zone_t;

struct xpub3_zstr_t {
  opaque s<>;
  opaque zs<>;
  int clev;
};

enum xpub3_expr_typ_t {
   XPUB3_EXPR_NULL,
   XPUB3_EXPR_NOT,
   XPUB3_EXPR_CALL,
   XPUB3_EXPR_RELATION,
   XPUB3_EXPR_DICT,
   XPUB3_EXPR_EQ,
   XPUB3_EXPR_DICTREF,
   XPUB3_EXPR_VECREF,
   XPUB3_EXPR_REF,
   XPUB3_EXPR_SHELL_STR,
   XPUB3_EXPR_STR,
   XPUB3_EXPR_INT,
   XPUB3_EXPR_UINT,
   XPUB3_EXPR_DOUBLE,
   XPUB3_EXPR_LIST,
   XPUB3_EXPR_REGEX,
   XPUB3_EXPR_MATHOP,
   XPUB3_EXPR_ASSIGNMENT,
   XPUB3_EXPR_BOOL,
   XPUB3_EXPR_PUBNULL,
   XPUB3_EXPR_LAMBDA,
   XPUB3_EXPR_HEREDOC,
   XPUB3_EXPR_SCOPED_REF
};

enum xpub3_relop_t { XPUB3_REL_LT, XPUB3_REL_GT, XPUB3_REL_LTE, XPUB3_REL_GTE };

enum xpub3_mathop_opcode_t {
     XPUB3_MATHOP_NONE = 0,
     XPUB3_MATHOP_ADD = 1,
     XPUB3_MATHOP_SUBTRACT = 2,
     XPUB3_MATHOP_MULT = 4,
     XPUB3_MATHOP_MOD = 5,
     XPUB3_MATHOP_AND = 6,
     XPUB3_MATHOP_OR = 7,
     XPUB3_MATHOP_DIV = 8
};

struct xpub3_mathop_t {
   int lineno;
   xpub3_mathop_opcode_t opcode;
   xpub3_expr_t *o1;
   xpub3_expr_t *o2;
};

struct xpub3_not_t {
   int lineno;
   xpub3_expr_t *e;
};

struct xpub3_expr_list_t {
   int lineno;
   xpub3_expr_t list<>;
};

struct xpub3_call_t {
   int lineno;
   xpub3_expr_t *fn;
   xpub3_expr_list_t args;
   bool blocking;
};

struct xpub3_eq_t {
   int lineno;
   xpub3_expr_t *o1;
   xpub3_expr_t *o2;
   bool pos;
};

struct xpub3_relation_t {
   int lineno;
   xpub3_relop_t relop;
   xpub3_expr_t *left;
   xpub3_expr_t *right;
};

struct xpub3_dictref_t {
   int lineno;
   xpub3_expr_t *dict;
   string key<>;
};

struct xpub3_vecref_t {
   int lineno;
   xpub3_expr_t *vec;
   xpub3_expr_t *index;
};

struct xpub3_ref_t {
   int lineno;
   string key<>;
};

enum xpub3_ref_scope_t {
   XPUB3_REF_SCOPE_GLOBALS = 1,
   XPUB3_REF_SCOPE_UNIVERSALS = 2
};

struct xpub3_scoped_ref_t {
   int lineno;
   string key<>;
   xpub3_ref_scope_t scope;
};

struct xpub3_shell_str_t {
   int lineno;
   xpub3_expr_list_t elements;
};

struct xpub3_str_t {
   string val<>;
};

struct xpub3_int_t {
   hyper val;
};

struct xpub3_bool_t {
  int i;
};

struct xpub3_uint_t {
  unsigned hyper val;
};

struct xpub3_double_t {
   string val<>;
};

struct xpub3_binding_t {
  xpub_key_t key;
  xpub3_expr_t *val;
};

typedef xpub3_binding_t xpub3_bindings_t<>;

struct xpub3_dict_t {
  int lineno;
  xpub3_bindings_t entries;
};

struct xpub3_regex_t {
  int lineno;
  string body<>;
  string opts<>;
};

struct xpub3_assignment_t {
  int lineno;
  xpub3_expr_t *lhs;
  xpub3_expr_t *rhs;
};

struct xpub3_lambda_t {
   int lineno;
   xpub3_str_t filename;
   xpub_fn_t name;
   xpub3_identifier_list_t params;
   xpub3_zone_t *body;
};

struct xpub3_heredoc_t {
   int lineno;
   xpub3_zone_t *body;
};

union xpub3_expr_t switch (xpub3_expr_typ_t typ) {
case XPUB3_EXPR_NULL:
     void;
case XPUB3_EXPR_PUBNULL:
     void;
case XPUB3_EXPR_NOT:
     xpub3_not_t xnot;
case XPUB3_EXPR_MATHOP:
     xpub3_mathop_t mathop;
case XPUB3_EXPR_CALL:
     xpub3_call_t call;
case XPUB3_EXPR_RELATION:
     xpub3_relation_t relation;
case XPUB3_EXPR_DICT:
     xpub3_dict_t dict;
case XPUB3_EXPR_LIST:
     xpub3_expr_list_t list;
case XPUB3_EXPR_EQ:
     xpub3_eq_t eq;
case XPUB3_EXPR_DICTREF:
     xpub3_dictref_t dictref;
case XPUB3_EXPR_VECREF:
     xpub3_vecref_t vecref;
case XPUB3_EXPR_REF:
     xpub3_ref_t xref;
case XPUB3_EXPR_SCOPED_REF:
     xpub3_scoped_ref_t scoped_xref;
case XPUB3_EXPR_SHELL_STR:
     xpub3_shell_str_t shell_str;
case XPUB3_EXPR_STR:
     xpub3_str_t xstr;
case XPUB3_EXPR_INT:
     xpub3_int_t xint;
case XPUB3_EXPR_UINT:
     xpub3_uint_t xuint;
case XPUB3_EXPR_DOUBLE:
     xpub3_double_t xdouble;
case XPUB3_EXPR_REGEX:
     xpub3_regex_t regex;
case XPUB3_EXPR_ASSIGNMENT:
     xpub3_assignment_t assignment;
case XPUB3_EXPR_BOOL:
     xpub3_int_t xbool;
case XPUB3_EXPR_LAMBDA:
     xpub3_lambda_t lambda;
case XPUB3_EXPR_HEREDOC:
     xpub3_heredoc_t heredoc;
};

/* ======================================================================= */
/* PUB3 Zones */

%struct xpub3_statement_t;

struct xpub3_zone_html_t {
  int lineno;
  xpub3_zone_t zones<>;
};

struct xpub3_zone_text_t {
  int lineno;
  xpub3_zstr_t original_text;
  xpub3_zstr_t wss_text;
};

struct xpub3_zone_raw_t {
  int lineno;
  xpub3_zstr_t data;
};

struct xpub3_zone_pub_t {
  int lineno;
  xpub3_statement_t statements<>;
};

struct xpub3_zone_wss_boundary_t {
  int lineno;
  bool on;
  string tag<>;
};

struct xpub3_zone_inline_expr_t {
  int lineno;
  xpub3_expr_t expr;
};

enum xpub3_zone_typ_t {
    XPUB3_ZONE_NONE = 0,
    XPUB3_ZONE_HTML = 1,
    XPUB3_ZONE_TEXT = 2,
    XPUB3_ZONE_INLINE_EXPR = 3,
    XPUB3_ZONE_PUB = 4,
    XPUB3_ZONE_RAW = 5,
    XPUB3_ZONE_WSS_BOUNDARY = 6
};

union xpub3_zone_t switch (xpub3_zone_typ_t typ) {
case XPUB3_ZONE_HTML:
   xpub3_zone_html_t html;
case XPUB3_ZONE_TEXT:
   xpub3_zone_text_t text;
case XPUB3_ZONE_INLINE_EXPR:
   xpub3_zone_inline_expr_t zone_inline;
case XPUB3_ZONE_PUB:
   xpub3_zone_pub_t zone_pub;
case XPUB3_ZONE_RAW:
   xpub3_zone_raw_t zone_raw;
case XPUB3_ZONE_WSS_BOUNDARY:
   xpub3_zone_wss_boundary_t zone_wss_boundary;
default:
   void;
};

/* ======================================================================= */
/* Pub3 File Structures */

struct xpub3_metadata_t {
  xpub_fn_t jailed_filename;
  xpub_fn_t real_filename;
  xpub3_hash_t hash; // The hash of the **raw unparsed file** on the disk
  ok_xtime_t ctime;
};

struct xpub3_file_t {
  xpub3_metadata_t metadata;
  xpub3_zone_t *root;
  unsigned opts;
};

/* ======================================================================= */
/* PUB3 statements */

struct xpub3_for_t {
  int lineno;
  xpub_var_t iter;
  xpub3_expr_t arr;
  xpub3_zone_t body;
  xpub3_zone_t *empty;
};

struct xpub3_while_t {
  int lineno;
  xpub3_expr_t cond;
  xpub3_zone_t body;
};

struct xpub3_include_t {
  int lineno;
  xpub3_expr_t file;
  xpub3_expr_t dict;
};

struct xpub3_if_clause_t {
  int lineno;
  xpub3_expr_t expr;
  xpub3_zone_t body;
};

struct xpub3_if_t {
  int lineno;
  xpub3_if_clause_t clauses<>;
};

struct xpub3_case_t {
  int lineno;
  xpub3_expr_t *key;
  xpub3_zone_t body;
};

typedef xpub3_case_t xpub3_cases_t<>;

struct xpub3_switch_t {
  int lineno;
  xpub3_expr_t key;
  xpub3_cases_t cases;
  xpub3_case_t *defcase;
};

struct xpub3_return_t {
  int lineno;
  xpub3_expr_t retval;
};

struct xpub3_break_t {
  int lineno;
};

struct xpub3_fndef_t {
  int lineno;
  string name<>;
  xpub3_lambda_t lambda;
};

struct xpub3_continue_t {
  int lineno;
};

struct xpub3_exit_t {
  int lineno;
};

struct xpub3_decls_t {
  int lineno;
  xpub3_dict_t decls;
};

struct xpub3_print_t {
   int lineno;
   xpub3_expr_list_t args;
};

struct xpub3_expr_statement_t {
  int lineno;
  xpub3_expr_t *expr;
};

struct xpub3_statement_zone_t {
  int lineno;
  xpub3_zone_t zone;
};

enum xpub3_statement_typ_t {
   XPUB3_STATEMENT_NONE = 0,
   XPUB3_STATEMENT_INCLUDE = 1,
   XPUB3_STATEMENT_LOAD = 2,
   XPUB3_STATEMENT_ZONE = 3,
   XPUB3_STATEMENT_FOR = 4,
   XPUB3_STATEMENT_LOCALS = 5,
   XPUB3_STATEMENT_UNIVERSALS = 6,
   XPUB3_STATEMENT_IF = 7,
   XPUB3_STATEMENT_PRINT = 8,
   XPUB3_STATEMENT_EXPR = 9,
   XPUB3_STATEMENT_FNDEF = 10,
   XPUB3_STATEMENT_SWITCH = 11,
   XPUB3_STATEMENT_BREAK = 12,
   XPUB3_STATEMENT_RETURN = 13,
   XPUB3_STATEMENT_CONTINUE = 14,
   XPUB3_STATEMENT_GLOBALS = 15,
   XPUB3_STATEMENT_WHILE = 16,
   XPUB3_STATEMENT_EXIT = 17
};

%struct xpub3_zone_t;

union xpub3_statement_t switch (xpub3_statement_typ_t typ) {
 case XPUB3_STATEMENT_NONE:
   void;

 case XPUB3_STATEMENT_INCLUDE:
 case XPUB3_STATEMENT_LOAD:
   xpub3_include_t include;

 case XPUB3_STATEMENT_ZONE:
   xpub3_statement_zone_t zone;

 case XPUB3_STATEMENT_FOR:
   xpub3_for_t for_statement;

 case XPUB3_STATEMENT_WHILE:
   xpub3_while_t while_statement;

 case XPUB3_STATEMENT_LOCALS:
 case XPUB3_STATEMENT_GLOBALS:
 case XPUB3_STATEMENT_UNIVERSALS:
   xpub3_decls_t decls;

 case XPUB3_STATEMENT_IF:
   xpub3_if_t if_statement;

 case XPUB3_STATEMENT_PRINT:
   xpub3_print_t print;

 case XPUB3_STATEMENT_EXPR:
   xpub3_expr_statement_t expr_statement;

 case XPUB3_STATEMENT_SWITCH:
   xpub3_switch_t switch_statement;

 case XPUB3_STATEMENT_BREAK:
   xpub3_break_t break_statement;

 case XPUB3_STATEMENT_CONTINUE:
   xpub3_continue_t continue_statement;

 case XPUB3_STATEMENT_RETURN:
   xpub3_return_t return_statement;

 case XPUB3_STATEMENT_FNDEF:
   xpub3_fndef_t fndef;

 case XPUB3_STATEMENT_EXIT:
   xpub3_exit_t exit_statement;
};

/* ====================================================================== */
/* pure JSON */

enum xpub3_json_typ_t { XPUB3_JSON_ERROR,
     		      	XPUB3_JSON_BOOL,
     		        XPUB3_JSON_INT32,
			XPUB3_JSON_UINT32,
     		      	XPUB3_JSON_INT64,
			XPUB3_JSON_UINT64,
			XPUB3_JSON_DOUBLE,
			XPUB3_JSON_STRING,
			XPUB3_JSON_DICT,
			XPUB3_JSON_LIST,
			XPUB3_JSON_NULL };

%struct xpub3_json_t;

typedef opaque xpub3_json_str_t<>;

struct xpub3_json_list_t {
       xpub3_json_t entries<>;
};

struct xpub3_json_pair_t {
       xpub3_json_str_t key;
       xpub3_json_t *value;
};

typedef xpub3_json_pair_t xpub3_json_pairs_t<>;

struct xpub3_json_dict_t {
       xpub3_json_pairs_t entries;
};

union xpub3_json_t switch (xpub3_json_typ_t typ) {
case XPUB3_JSON_BOOL:
     bool json_bool;
case XPUB3_JSON_INT32:
     int json_int32;
case XPUB3_JSON_UINT32:
     unsigned json_uint32;
case XPUB3_JSON_INT64:
     hyper json_int64;
case XPUB3_JSON_UINT64:
     unsigned hyper json_uint64;
case XPUB3_JSON_STRING:
     xpub3_json_str_t json_string;
case XPUB3_JSON_DICT:
     xpub3_json_dict_t json_dict;
case XPUB3_JSON_LIST:
     xpub3_json_list_t json_list;
case XPUB3_JSON_DOUBLE:
     xpub3_double_t json_double;
default:
     void;
};

/* ----------------------------------------------------------------------- */

/* XDR descriptions of constants -- poor man's reflection! */

struct rpc_int_constant_t {
   string name<>;
   int value;
};

typedef rpc_int_constant_t rpc_int_constants_t<>;

struct rpc_constant_set_t {
   rpc_int_constants_t progs;
   rpc_int_constants_t vers;
   rpc_int_constants_t procs;
   rpc_int_constants_t enums;
   rpc_int_constants_t pound_defs;
};

namespace rpc {
  program JSON_INTROSPECTION_PROG {
    version JSON_INTROSPECTION_V1 {

      rpc_constant_set_t
      JSON_INTROSPECTION_FETCH_CONSTANTS(void) = 0;

    } = 1;
  } = 79921;
};

/* ----------------------------------------------------------------------- */

/* ======================================================================= */

enum xpub_status_typ_t {
  XPUB_STATUS_OK = 0,
  XPUB_STATUS_ERR = 1,
  XPUB_STATUS_NOCHANGE = 2,
  XPUB_STATUS_NOENT = 3,
  XPUB_STATUS_OOB = 4,                 /* out of bounds */
  XPUB_STATUS_NOT_IMPLEMENTED = 5,
  XPUB_STATUS_RPC_ERR = 6,
  XPUB_UNAVAILABLE = 7,                /* disabled at runtime */
  XPUB_STATUS_CORRUPTION = 8,
  XPUB_STATUS_EPARSE = 9,
  XPUB_STATUS_EIO = 10
};

enum xpub3_xfer_mode_t {
  XPUB_XFER_WHOLE = 0,
  XPUB_XFER_CHUNKED = 1
};

typedef string xpub3_errstr_t<>;
typedef xpub3_errstr_t xpub3_errstrs_t<>;

union xpub_status_t switch (xpub_status_typ_t status)
{
 case XPUB_STATUS_OK:
   void;
 case XPUB_STATUS_RPC_ERR:
   u_int32_t rpc_err;
 case XPUB_STATUS_NOENT:
 case XPUB_STATUS_EPARSE:
 case XPUB_STATUS_EIO:
   xpub3_errstrs_t errors;
 default:
   xpub3_errstr_t error;
};

union xpub3_lookup_res_t switch (xpub_status_typ_t status)
{
 case XPUB_STATUS_OK:
   xpub3_fstat_t stat;
 case XPUB_STATUS_ERR:
   string error<>;
 default:
   void;
};

struct xpub3_chunk_t {
  unsigned 		offset;
  opaque		data<>;
};

struct xpub3_chunkshdr_t {
  xpub3_hash_t          xdrhash;   /* a hash of the file's XDR repr */
  int                   leasetime; /* time until flush possibility from cache*/
  unsigned		datasize;  /* size of the XDR repr */
  xpub3_hash_t          dathash;   /* hash of the file's data */
};

union xpub3_xfered_file_t switch (xpub3_xfer_mode_t mode) {
case XPUB_XFER_WHOLE:
  xpub3_file_t whole;
case XPUB_XFER_CHUNKED:
  xpub3_chunkshdr_t chunked;
};

enum xpub3_freshness_typ_t {
  XPUB3_FRESH_NONE = 0,
  XPUB3_FRESH_CTIME = 1,
  XPUB3_FRESH_HASH = 2
};

union xpub3_file_freshcheck_t switch (xpub3_freshness_typ_t mode) {
case XPUB3_FRESH_NONE:
  void;
case XPUB3_FRESH_CTIME:
  u_int32_t ctime;
case XPUB3_FRESH_HASH:
  xpub3_hash_t hash;
};

struct xpub3_getfile_arg_t {
  xpub_fn_t               filename;
  unsigned                options;
  xpub3_file_freshcheck_t fresh;
  unsigned		  maxsz;
};

struct xpub3_getchunk_arg_t {
  xpub3_hash_t hash;
  unsigned opts;
  unsigned offset;
  unsigned size;
};

union xpub3_getchunk_res_t switch (xpub_status_typ_t status) {
case XPUB_STATUS_OK:
  xpub3_chunk_t chunk;
case XPUB_STATUS_ERR:
  string error<>;
default:
  void;
};

union xpub3_getfile_res_t switch (xpub_status_typ_t code) {
case XPUB_STATUS_OK:
  xpub3_xfered_file_t file;
default:
  xpub_status_t error_status;
};

union xpub3_get_root_config_res_t switch (xpub_status_typ_t status) {
case XPUB_STATUS_OK:
   xpub_fn_t fn;
case XPUB_STATUS_ERR:
   string error<>;
default:
   void;
};

struct xpub3_fstat_set_t {
   unsigned timestamp;
   xpub3_fstat_t fstats<>;
   xpub_fn_t misses<>;
};

/*
 * All files in the delta set should be removed from the service's
 * cache, either because the disappered, or because they were updated.
 */
struct xpub3_delta_set_t {
   hyper serial;
   unsigned start;
   unsigned stop;
   xpub_fn_t files<>;
};

union xpub3_get_fstats_res_t switch (xpub_status_typ_t status) {
case XPUB_STATUS_OK:
  xpub3_fstat_set_t stats;
case XPUB_STATUS_ERR:
  string error<>;
default:
  void;
};

namespace rpc {

program PUB_PROG {
	/*
	 * Version 2 of Pub. Simplified protocol, and a simplified
	 * server, too.
	 */
	version PUB_VERS3 {

		void
		PUB3_NULL (void) = 0;

		xpub3_get_root_config_res_t
		PUB3_GET_ROOT_CONFIG (void) = 1;

		xpub3_getfile_res_t
		PUB3_GETFILE (xpub3_getfile_arg_t) = 2;

		/*
		 * Input an mtime, and get all changes since that
		 * mtime (or perhaps all fstat's if there was a mod
		 * since the given mtime).
		 */
		xpub3_get_fstats_res_t
		PUB3_GET_FSTATS (u_int32_t) = 3;

		/*
	  	 * If the file is too big to be returned all at once,
		 * we need to get it by chunks.
		 */
		xpub3_getchunk_res_t
		PUB3_GETCHUNK(xpub3_getchunk_arg_t) = 8;

		/*
		 * for each service, pubd needs to send a socket pair
		 * end over a pipe.
		 */
 	  	int
		PUB3_CLONE (int) = 4;

		bool
		PUB3_PUSH_DELTAS(xpub3_delta_set_t) = 5;

		bool
		PUB3_GET_PUSHES (void) = 6;

		/*
	 	 * Get a file hash, and ctime, but bypass NFS
		 * so go from pubd<->pubd.
		 */
		xpub3_lookup_res_t
		PUB3_LOOKUP (xpub_fn_t) = 7;

		void
		PUB3_KILL (ok_killsig_t) = 99;
	} = 3;

} = 11277;

};

{'repo_name': 'OkCupid/okws', 'stars': '235', 'repo_language': 'C++', 'file_name': 'pubserv.T', 'mime_type': 'text/x-c', 'hash': 4598962071967046584, 'source_dataset': 'data'}


// The package f is a go/doc test for functions and factory ...
PACKAGE f

IMPORTPATH
	testdata/f

FILENAMES
	testdata/f.go

FUNCTIONS
	// Exported must always be visible. Was issue 2824.
	func Exported() private

{'repo_name': 'riscv/riscv-gcc', 'stars': '155', 'repo_language': 'C', 'file_name': 'visium-protos.h', 'mime_type': 'text/x-c', 'hash': 6905321743860665172, 'source_dataset': 'data'}


<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
	<data>
		<int key="IBDocument.SystemTarget">1050</int>
		<string key="IBDocument.SystemVersion">9C31</string>
		<string key="IBDocument.InterfaceBuilderVersion">644</string>
		<string key="IBDocument.AppKitVersion">949.26</string>
		<string key="IBDocument.HIToolboxVersion">352.00</string>
		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
			<bool key="EncodedWithXMLCoder">YES</bool>
			<integer value="5"/>
		</object>
		<object class="NSArray" key="IBDocument.PluginDependencies">
			<bool key="EncodedWithXMLCoder">YES</bool>
			<string>com.apple.WebKitIBPlugin</string>
			<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
		</object>
		<object class="NSMutableArray" key="IBDocument.RootObjects" id="625423742">
			<bool key="EncodedWithXMLCoder">YES</bool>
			<object class="NSCustomObject" id="272387934">
				<string key="NSClassName">FRAPreviewController</string>
			</object>
			<object class="NSCustomObject" id="602813496">
				<string key="NSClassName">FirstResponder</string>
			</object>
			<object class="NSCustomObject" id="27047093">
				<string key="NSClassName">NSApplication</string>
			</object>
			<object class="NSWindowTemplate" id="212784435">
				<int key="NSWindowStyleMask">15</int>
				<int key="NSWindowBacking">2</int>
				<string key="NSWindowRect">{{288, 476}, {572, 375}}</string>
				<int key="NSWTFlags">1886912512</int>
				<string type="base64-UTF8" key="NSWindowTitle">UHJldmlldyAtIFNtdWx0cm9uIDxkbyBub3QgbG9jYWxpc2U+A</string>
				<string key="NSWindowClass">NSPanel</string>
				<object class="NSMutableString" key="NSViewClass">
					<characters key="NS.bytes">View</characters>
				</object>
				<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
				<string key="NSWindowContentMinSize">{572, 375}</string>
				<object class="NSView" key="NSWindowView" id="794293269">
					<reference key="NSNextResponder"/>
					<int key="NSvFlags">256</int>
					<object class="NSMutableArray" key="NSSubviews">
						<bool key="EncodedWithXMLCoder">YES</bool>
						<object class="NSTextField" id="97755258">
							<reference key="NSNextResponder" ref="794293269"/>
							<int key="NSvFlags">270</int>
							<string key="NSFrame">{{87, 348}, {269, 22}}</string>
							<reference key="NSSuperview" ref="794293269"/>
							<bool key="NSEnabled">YES</bool>
							<object class="NSTextFieldCell" key="NSCell" id="837639802">
								<int key="NSCellFlags">-1804468671</int>
								<int key="NSCellFlags2">272630784</int>
								<string key="NSContents"/>
								<object class="NSFont" key="NSSupport" id="1025863700">
									<string key="NSName">LucidaGrande</string>
									<double key="NSSize">1.300000e+01</double>
									<int key="NSfFlags">1044</int>
								</object>
								<reference key="NSControlView" ref="97755258"/>
								<bool key="NSDrawsBackground">YES</bool>
								<object class="NSColor" key="NSBackgroundColor" id="424515593">
									<int key="NSColorSpace">6</int>
									<string key="NSCatalogName">System</string>
									<string key="NSColorName">textBackgroundColor</string>
									<object class="NSColor" key="NSColor">
										<int key="NSColorSpace">3</int>
										<bytes key="NSWhite">MQA</bytes>
									</object>
								</object>
								<object class="NSColor" key="NSTextColor">
									<int key="NSColorSpace">6</int>
									<string key="NSCatalogName">System</string>
									<string key="NSColorName">textColor</string>
									<object class="NSColor" key="NSColor" id="784309873">
										<int key="NSColorSpace">3</int>
										<bytes key="NSWhite">MAA</bytes>
									</object>
								</object>
							</object>
						</object>
						<object class="NSTextField" id="537844613">
							<reference key="NSNextResponder" ref="794293269"/>
							<int key="NSvFlags">268</int>
							<string key="NSFrame">{{10, 350}, {72, 17}}</string>
							<reference key="NSSuperview" ref="794293269"/>
							<bool key="NSEnabled">YES</bool>
							<object class="NSTextFieldCell" key="NSCell" id="585393940">
								<int key="NSCellFlags">67239424</int>
								<int key="NSCellFlags2">272629760</int>
								<string type="base64-UTF8" key="NSContents">44OZ44O844K5VVJMOg</string>
								<reference key="NSSupport" ref="1025863700"/>
								<reference key="NSControlView" ref="537844613"/>
								<object class="NSColor" key="NSBackgroundColor">
									<int key="NSColorSpace">6</int>
									<string key="NSCatalogName">System</string>
									<string key="NSColorName">controlColor</string>
									<object class="NSColor" key="NSColor">
										<int key="NSColorSpace">3</int>
										<bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
									</object>
								</object>
								<object class="NSColor" key="NSTextColor">
									<int key="NSColorSpace">6</int>
									<string key="NSCatalogName">System</string>
									<string key="NSColorName">controlTextColor</string>
									<reference key="NSColor" ref="784309873"/>
								</object>
							</object>
						</object>
						<object class="NSButton" id="150085716">
							<reference key="NSNextResponder" ref="794293269"/>
							<int key="NSvFlags">265</int>
							<string key="NSFrame">{{379, 350}, {96, 18}}</string>
							<reference key="NSSuperview" ref="794293269"/>
							<bool key="NSEnabled">YES</bool>
							<object class="NSButtonCell" key="NSCell" id="299526322">
								<int key="NSCellFlags">67239424</int>
								<int key="NSCellFlags2">0</int>
								<string type="base64-UTF8" key="NSContents">6Ieq5YuV5pu05pawA</string>
								<reference key="NSSupport" ref="1025863700"/>
								<reference key="NSControlView" ref="150085716"/>
								<int key="NSButtonFlags">1211912703</int>
								<int key="NSButtonFlags2">2</int>
								<object class="NSButtonImageSource" key="NSAlternateImage">
									<string key="NSImageName">NSSwitch</string>
								</object>
								<string key="NSAlternateContents"/>
								<string key="NSKeyEquivalent"/>
								<int key="NSPeriodicDelay">200</int>
								<int key="NSPeriodicInterval">25</int>
							</object>
						</object>
						<object class="NSButton" id="94341811">
							<reference key="NSNextResponder" ref="794293269"/>
							<int key="NSvFlags">265</int>
							<string key="NSFrame">{{470, 341}, {92, 32}}</string>
							<reference key="NSSuperview" ref="794293269"/>
							<bool key="NSEnabled">YES</bool>
							<object class="NSButtonCell" key="NSCell" id="604858827">
								<int key="NSCellFlags">67239424</int>
								<int key="NSCellFlags2">134217728</int>
								<string type="base64-UTF8" key="NSContents">44Oq44Ot44O844OJA</string>
								<reference key="NSSupport" ref="1025863700"/>
								<reference key="NSControlView" ref="94341811"/>
								<int key="NSButtonFlags">-2038284033</int>
								<int key="NSButtonFlags2">1</int>
								<reference key="NSAlternateImage" ref="1025863700"/>
								<string key="NSAlternateContents"/>
								<string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
								<int key="NSPeriodicDelay">200</int>
								<int key="NSPeriodicInterval">25</int>
							</object>
						</object>
						<object class="NSBox" id="618947053">
							<reference key="NSNextResponder" ref="794293269"/>
							<int key="NSvFlags">266</int>
							<string key="NSFrame">{{0, 339}, {572, 5}}</string>
							<reference key="NSSuperview" ref="794293269"/>
							<string key="NSOffsets">{0, 0}</string>
							<object class="NSTextFieldCell" key="NSTitleCell">
								<int key="NSCellFlags">67239424</int>
								<int key="NSCellFlags2">0</int>
								<string key="NSContents">Box</string>
								<reference key="NSSupport" ref="1025863700"/>
								<reference key="NSBackgroundColor" ref="424515593"/>
								<object class="NSColor" key="NSTextColor">
									<int key="NSColorSpace">3</int>
									<bytes key="NSWhite">MCAwLjgwMDAwMDAxAA</bytes>
								</object>
							</object>
							<int key="NSBorderType">3</int>
							<int key="NSBoxType">2</int>
							<int key="NSTitlePosition">0</int>
							<bool key="NSTransparent">NO</bool>
						</object>
						<object class="WebView" id="222877261">
							<reference key="NSNextResponder" ref="794293269"/>
							<int key="NSvFlags">274</int>
							<object class="NSMutableSet" key="NSDragTypes">
								<bool key="EncodedWithXMLCoder">YES</bool>
								<object class="NSMutableArray" key="set.sortedObjects">
									<bool key="EncodedWithXMLCoder">YES</bool>
									<string>Apple HTML pasteboard type</string>
									<string>Apple PICT pasteboard type</string>
									<string>Apple URL pasteboard type</string>
									<string>Apple Web Archive pasteboard type</string>
									<string>NSColor pasteboard type</string>
									<string>NSFilenamesPboardType</string>
									<string>NSStringPboardType</string>
									<string>NeXT RTFD pasteboard type</string>
									<string>NeXT Rich Text Format v1.0 pasteboard type</string>
									<string>NeXT TIFF v4.0 pasteboard type</string>
									<string>WebURLsWithTitlesPboardType</string>
									<string>public.url</string>
									<string>public.url-name</string>
								</object>
							</object>
							<string key="NSFrameSize">{572, 341}</string>
							<reference key="NSSuperview" ref="794293269"/>
							<reference key="NSNextKeyView"/>
							<string key="FrameName"/>
							<string key="GroupName"/>
							<object class="WebPreferences" key="Preferences">
								<string key="Identifier"/>
								<object class="NSMutableDictionary" key="Values">
									<bool key="EncodedWithXMLCoder">YES</bool>
									<object class="NSMutableArray" key="dict.sortedKeys">
										<bool key="EncodedWithXMLCoder">YES</bool>
										<string>WebKitDefaultFixedFontSize</string>
										<string>WebKitDefaultFontSize</string>
										<string>WebKitMinimumFontSize</string>
									</object>
									<object class="NSMutableArray" key="dict.values">
										<bool key="EncodedWithXMLCoder">YES</bool>
										<integer value="12" id="453210809"/>
										<reference ref="453210809"/>
										<integer value="1"/>
									</object>
								</object>
							</object>
							<bool key="UseBackForwardList">YES</bool>
							<bool key="AllowsUndo">YES</bool>
						</object>
					</object>
					<string key="NSFrameSize">{572, 375}</string>
					<reference key="NSSuperview"/>
				</object>
				<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
				<string key="NSMinSize">{572, 397}</string>
				<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
				<string key="NSFrameAutosaveName">PreviewWindow</string>
			</object>
			<object class="NSUserDefaultsController" id="698086975">
				<bool key="NSSharedInstance">YES</bool>
			</object>
		</object>
		<object class="IBObjectContainer" key="IBDocument.Objects">
			<object class="NSMutableArray" key="connectionRecords">
				<bool key="EncodedWithXMLCoder">YES</bool>
				<object class="IBConnectionRecord">
					<object class="IBBindingConnection" key="connection">
						<string key="label">value: values.LiveUpdatePreview</string>
						<reference key="source" ref="150085716"/>
						<reference key="destination" ref="698086975"/>
						<object class="NSNibBindingConnector" key="connector">
							<reference key="NSSource" ref="150085716"/>
							<reference key="NSDestination" ref="698086975"/>
							<string key="NSLabel">value: values.LiveUpdatePreview</string>
							<string key="NSBinding">value</string>
							<string key="NSKeyPath">values.LiveUpdatePreview</string>
							<int key="NSNibBindingConnectorVersion">2</int>
						</object>
					</object>
					<int key="connectionID">15</int>
				</object>
				<object class="IBConnectionRecord">
					<object class="IBBindingConnection" key="connection">
						<string key="label">value: values.BaseURL</string>
						<reference key="source" ref="97755258"/>
						<reference key="destination" ref="698086975"/>
						<object class="NSNibBindingConnector" key="connector">
							<reference key="NSSource" ref="97755258"/>
							<reference key="NSDestination" ref="698086975"/>
							<string key="NSLabel">value: values.BaseURL</string>
							<string key="NSBinding">value</string>
							<string key="NSKeyPath">values.BaseURL</string>
							<int key="NSNibBindingConnectorVersion">2</int>
						</object>
					</object>
					<int key="connectionID">16</int>
				</object>
				<object class="IBConnectionRecord">
					<object class="IBOutletConnection" key="connection">
						<string key="label">webView</string>
						<reference key="source" ref="272387934"/>
						<reference key="destination" ref="222877261"/>
					</object>
					<int key="connectionID">17</int>
				</object>
				<object class="IBConnectionRecord">
					<object class="IBOutletConnection" key="connection">
						<string key="label">previewWindow</string>
						<reference key="source" ref="272387934"/>
						<reference key="destination" ref="212784435"/>
					</object>
					<int key="connectionID">18</int>
				</object>
				<object class="IBConnectionRecord">
					<object class="IBActionConnection" key="connection">
						<string key="label">reloadAction:</string>
						<reference key="source" ref="272387934"/>
						<reference key="destination" ref="94341811"/>
					</object>
					<int key="connectionID">19</int>
				</object>
			</object>
			<object class="IBMutableOrderedSet" key="objectRecords">
				<object class="NSArray" key="orderedObjects">
					<bool key="EncodedWithXMLCoder">YES</bool>
					<object class="IBObjectRecord">
						<int key="objectID">0</int>
						<object class="NSArray" key="object" id="0">
							<bool key="EncodedWithXMLCoder">YES</bool>
						</object>
						<reference key="children" ref="625423742"/>
						<nil key="parent"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">-2</int>
						<reference key="object" ref="272387934"/>
						<reference key="parent" ref="0"/>
						<string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">-1</int>
						<reference key="object" ref="602813496"/>
						<reference key="parent" ref="0"/>
						<string key="objectName">First Responder</string>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">5</int>
						<reference key="object" ref="212784435"/>
						<object class="NSMutableArray" key="children">
							<bool key="EncodedWithXMLCoder">YES</bool>
							<reference ref="794293269"/>
						</object>
						<reference key="parent" ref="0"/>
						<string key="objectName">Window</string>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">6</int>
						<reference key="object" ref="794293269"/>
						<object class="NSMutableArray" key="children">
							<bool key="EncodedWithXMLCoder">YES</bool>
							<reference ref="97755258"/>
							<reference ref="537844613"/>
							<reference ref="150085716"/>
							<reference ref="94341811"/>
							<reference ref="618947053"/>
							<reference ref="222877261"/>
						</object>
						<reference key="parent" ref="212784435"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">7</int>
						<reference key="object" ref="97755258"/>
						<object class="NSMutableArray" key="children">
							<bool key="EncodedWithXMLCoder">YES</bool>
							<reference ref="837639802"/>
						</object>
						<reference key="parent" ref="794293269"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">8</int>
						<reference key="object" ref="537844613"/>
						<object class="NSMutableArray" key="children">
							<bool key="EncodedWithXMLCoder">YES</bool>
							<reference ref="585393940"/>
						</object>
						<reference key="parent" ref="794293269"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">9</int>
						<reference key="object" ref="150085716"/>
						<object class="NSMutableArray" key="children">
							<bool key="EncodedWithXMLCoder">YES</bool>
							<reference ref="299526322"/>
						</object>
						<reference key="parent" ref="794293269"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">10</int>
						<reference key="object" ref="94341811"/>
						<object class="NSMutableArray" key="children">
							<bool key="EncodedWithXMLCoder">YES</bool>
							<reference ref="604858827"/>
						</object>
						<reference key="parent" ref="794293269"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">11</int>
						<reference key="object" ref="618947053"/>
						<object class="NSMutableArray" key="children">
							<bool key="EncodedWithXMLCoder">YES</bool>
							<object class="NSView" id="273189716">
								<nil key="NSNextResponder"/>
								<int key="NSvFlags">256</int>
								<string key="NSFrame">{{2, 2}, {125, 1}}</string>
							</object>
						</object>
						<reference key="parent" ref="794293269"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">12</int>
						<reference key="object" ref="273189716"/>
						<reference key="parent" ref="618947053"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">13</int>
						<reference key="object" ref="222877261"/>
						<reference key="parent" ref="794293269"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">14</int>
						<reference key="object" ref="698086975"/>
						<reference key="parent" ref="0"/>
						<string key="objectName">Shared Defaults</string>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">21</int>
						<reference key="object" ref="837639802"/>
						<reference key="parent" ref="97755258"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">22</int>
						<reference key="object" ref="585393940"/>
						<reference key="parent" ref="537844613"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">23</int>
						<reference key="object" ref="299526322"/>
						<reference key="parent" ref="150085716"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">24</int>
						<reference key="object" ref="604858827"/>
						<reference key="parent" ref="94341811"/>
					</object>
					<object class="IBObjectRecord">
						<int key="objectID">-3</int>
						<reference key="object" ref="27047093"/>
						<reference key="parent" ref="0"/>
						<string key="objectName">Application</string>
					</object>
				</object>
			</object>
			<object class="NSMutableDictionary" key="flattenedProperties">
				<bool key="EncodedWithXMLCoder">YES</bool>
				<object class="NSMutableArray" key="dict.sortedKeys">
					<bool key="EncodedWithXMLCoder">YES</bool>
					<string>-1.IBPluginDependency</string>
					<string>-2.IBPluginDependency</string>
					<string>10.IBPluginDependency</string>
					<string>10.ImportedFromIB2</string>
					<string>11.IBPluginDependency</string>
					<string>11.ImportedFromIB2</string>
					<string>12.IBPluginDependency</string>
					<string>12.ImportedFromIB2</string>
					<string>13.IBPluginDependency</string>
					<string>13.ImportedFromIB2</string>
					<string>14.IBPluginDependency</string>
					<string>14.ImportedFromIB2</string>
					<string>5.IBEditorWindowLastContentRect</string>
					<string>5.IBPluginDependency</string>
					<string>5.IBWindowTemplateEditedContentRect</string>
					<string>5.ImportedFromIB2</string>
					<string>5.lastResizeAction</string>
					<string>5.windowTemplate.hasMaxSize</string>
					<string>5.windowTemplate.hasMinSize</string>
					<string>5.windowTemplate.maxSize</string>
					<string>5.windowTemplate.minSize</string>
					<string>6.IBPluginDependency</string>
					<string>6.ImportedFromIB2</string>
					<string>7.IBPluginDependency</string>
					<string>7.ImportedFromIB2</string>
					<string>8.IBPluginDependency</string>
					<string>8.ImportedFromIB2</string>
					<string>9.IBPluginDependency</string>
					<string>9.ImportedFromIB2</string>
				</object>
				<object class="NSMutableArray" key="dict.values">
					<bool key="EncodedWithXMLCoder">YES</bool>
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
					<integer value="1" id="5"/>
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
					<reference ref="5"/>
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
					<reference ref="5"/>
					<string>com.apple.WebKitIBPlugin</string>
					<reference ref="5"/>
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
					<reference ref="5"/>
					<string>{{222, 476}, {572, 375}}</string>
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
					<string>{{222, 476}, {572, 375}}</string>
					<reference ref="5"/>
					<object class="NSDictionary">
						<bool key="EncodedWithXMLCoder">YES</bool>
						<object class="NSMutableArray" key="dict.sortedKeys">
							<bool key="EncodedWithXMLCoder">YES</bool>
							<string>IBResizeActionFinalFrame</string>
							<string>IBResizeActionInitialFrame</string>
						</object>
						<object class="NSMutableArray" key="dict.values">
							<bool key="EncodedWithXMLCoder">YES</bool>
							<string>{{222, 476}, {572, 375}}</string>
							<string>{{222, 476}, {572, 375}}</string>
						</object>
					</object>
					<reference ref="5"/>
					<reference ref="5"/>
					<string>{3.40282e+38, 3.40282e+38}</string>
					<string>{572, 375}</string>
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
					<reference ref="5"/>
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
					<reference ref="5"/>
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
					<reference ref="5"/>
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
					<reference ref="5"/>
				</object>
			</object>
			<object class="NSMutableDictionary" key="unlocalizedProperties">
				<bool key="EncodedWithXMLCoder">YES</bool>
				<object class="NSArray" key="dict.sortedKeys">
					<bool key="EncodedWithXMLCoder">YES</bool>
				</object>
				<object class="NSMutableArray" key="dict.values">
					<bool key="EncodedWithXMLCoder">YES</bool>
				</object>
			</object>
			<nil key="activeLocalization"/>
			<object class="NSMutableDictionary" key="localizations">
				<bool key="EncodedWithXMLCoder">YES</bool>
				<object class="NSArray" key="dict.sortedKeys">
					<bool key="EncodedWithXMLCoder">YES</bool>
				</object>
				<object class="NSMutableArray" key="dict.values">
					<bool key="EncodedWithXMLCoder">YES</bool>
				</object>
			</object>
			<nil key="sourceID"/>
			<int key="maxID">24</int>
		</object>
		<object class="IBClassDescriber" key="IBDocument.Classes">
			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
				<bool key="EncodedWithXMLCoder">YES</bool>
				<object class="IBPartialClassDescription">
					<string key="className">FirstResponder</string>
					<object class="IBClassDescriptionSource" key="sourceIdentifier">
						<string key="majorKey">IBUserSource</string>
						<string key="minorKey"/>
					</object>
				</object>
				<object class="IBPartialClassDescription">
					<string key="className">FRAPreviewController</string>
					<string key="superclassName">NSObject</string>
					<object class="NSMutableDictionary" key="actions">
						<string key="NS.key.0">reloadAction:</string>
						<string key="NS.object.0">id</string>
					</object>
					<object class="NSMutableDictionary" key="outlets">
						<bool key="EncodedWithXMLCoder">YES</bool>
						<object class="NSMutableArray" key="dict.sortedKeys">
							<bool key="EncodedWithXMLCoder">YES</bool>
							<string>previewWindow</string>
							<string>webView</string>
						</object>
						<object class="NSMutableArray" key="dict.values">
							<bool key="EncodedWithXMLCoder">YES</bool>
							<string>NSWindow</string>
							<string>WebView</string>
						</object>
					</object>
					<object class="IBClassDescriptionSource" key="sourceIdentifier">
						<string key="majorKey">IBUserSource</string>
						<string key="minorKey"/>
					</object>
				</object>
			</object>
		</object>
		<int key="IBDocument.localizationMode">0</int>
		<nil key="IBDocument.LastKnownRelativeProjectPath"/>
		<int key="IBDocument.defaultPropertyAccessControl">3</int>
	</data>
</archive>

{'repo_name': 'jfmoy/Fraise', 'stars': '274', 'repo_language': 'Objective-C', 'file_name': 'info.nib', 'mime_type': 'text/xml', 'hash': 367874223099417880, 'source_dataset': 'data'}


#!/bin/bash

SCRIPTDIR=`pwd`

mkdir -p ../data/word2vec/raw
cd ../data/word2vec/raw

if [ ! -e 1-billion-word-language-modeling-benchmark-r13output.tar.gz ]; then
echo "Downloading"
wget http://www.statmt.org/lm-benchmark/1-billion-word-language-modeling-benchmark-r13output.tar.gz
fi

if [ ! -d 1-billion-word-language-modeling-benchmark-r13output ]; then
echo "Uncompressing"
tar xvzf 1-billion-word-language-modeling-benchmark-r13output.tar.gz
# fix the misplaced first news item
mv 1-billion-word-language-modeling-benchmark-r13output/heldout-monolingual.tokenized.shuffled/news.en-00000-of-00100 \
   1-billion-word-language-modeling-benchmark-r13output/training-monolingual.tokenized.shuffled
fi

cd 1-billion-word-language-modeling-benchmark-r13output/training-monolingual.tokenized.shuffled

FILES=`echo news.en*00100 | sed 's/ /,/g'`

mkdir -p ${SCRIPTDIR}/../data/word2vec/tokenized
mkdir -p ${SCRIPTDIR}/../data/word2vec/tokenized2
mkdir -p ${SCRIPTDIR}/../data/word2vec/data

${SCRIPTDIR}/../cbin/tparse2.exe -i "${FILES}" -f ../../fmt.txt -o ${SCRIPTDIR}/../data/word2vec/tokenized/ -c

cd ${SCRIPTDIR}/../data/word2vec/raw/1-billion-word-language-modeling-benchmark-r13output/heldout-monolingual.tokenized.shuffled/

FILES=`echo news.en*00050 | sed 's/ /,/g'`

${SCRIPTDIR}/../cbin/tparse2.exe -i "${FILES}" -f ../../fmt.txt -o ${SCRIPTDIR}/../data/word2vec/tokenized2/ -c

cd ${SCRIPTDIR}

bidmach getw2vdata.ssc

{'repo_name': 'BIDData/BIDMach', 'stars': '909', 'repo_language': 'Scala', 'file_name': 'factorSet.txt', 'mime_type': 'text/plain', 'hash': -5422093720103100905, 'source_dataset': 'data'}


# Copyright Hugh Perkins 2016
"""
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 subprocess
import pyopencl as cl
import pytest
import os
from os import path
from test import test_common

@pytest.fixture(scope='module')
def dotdotdot_cl():
    # lets check it's compileable ll first, using llvm
    ll_filepath = 'test/dotdotdot.ll'

    with open(ll_filepath, 'r') as f:
        ll_sourcecode = f.read()

    kernelName = test_common.mangle('test_si', ['float *'])
    cl_sourcecode = test_common.ll_to_cl(ll_sourcecode, kernelName, num_clmems=1)
    print('cl_sourcecode', cl_sourcecode)
    return cl_sourcecode

@pytest.fixture(scope='module')
def dotdotdot(context, dotdotdot_cl):
    kernelName = test_common.mangle('test_si', ['float *'])
    kernel = test_common.build_kernel(context, dotdotdot_cl, kernelName)
    return kernel

def test_program_compiles(dotdotdot):
    pass

# def test_copy_float(extract_value, q, float_data, float_data_gpu):
#     extract_value.__getattr__(test_common.mangle('test_floats', ['float *']))(q, (32,), (32,), float_data_gpu)
#     cl.enqueue_copy(q, float_data, float_data_gpu)
#     q.finish()
#     assert float_data[0] == float_data[1]

{'repo_name': 'hughperkins/coriander', 'stars': '607', 'repo_language': 'LLVM', 'file_name': 'gtest.h', 'mime_type': 'text/x-c', 'hash': 6835111748089058014, 'source_dataset': 'data'}


var convert = require('./convert'),
    func = convert('uniqueId', require('../uniqueId'));

func.placeholder = require('./placeholder');
module.exports = func;

{'repo_name': 'SwiftPackageIndex/SwiftPackageIndex-Server', 'stars': '149', 'repo_language': 'Swift', 'file_name': 'AppShell+mock.swift', 'mime_type': 'text/plain', 'hash': 8321864149167653266, 'source_dataset': 'data'}


//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// <fstream>

// template <class charT, class traits = char_traits<charT> >
// class basic_fstream

// void close();

#include <fstream>
#include <cassert>
#include "test_macros.h"
#include "platform_support.h"

int main(int, char**)
{
    std::string temp = get_temp_file_name();
    {
        std::fstream fs;
        assert(!fs.is_open());
        fs.open(temp.c_str(), std::ios_base::out);
        assert(fs.is_open());
        fs.close();
        assert(!fs.is_open());
    }
    std::remove(temp.c_str());
    {
        std::wfstream fs;
        assert(!fs.is_open());
        fs.open(temp.c_str(), std::ios_base::out);
        assert(fs.is_open());
        fs.close();
        assert(!fs.is_open());
    }
    std::remove(temp.c_str());

  return 0;
}

{'repo_name': 'intel/llvm', 'stars': '317', 'repo_language': 'C++', 'file_name': 'is_error_code_enum_io_errc.pass.cpp', 'mime_type': 'text/x-c', 'hash': -7460613594072345614, 'source_dataset': 'data'}


#!/bin/bash

set -e

~/.nuget/packages/grpc.tools/1.16.0/tools/linux_x64/protoc \
    --proto_path=. \
    --csharp_out=.. \
    user.proto

{'repo_name': 'confluentinc/confluent-kafka-dotnet', 'stars': '1595', 'repo_language': 'C#', 'file_name': 'navbar.tmpl.partial', 'mime_type': 'text/plain', 'hash': 8277825007127721818, 'source_dataset': 'data'}