file
stringlengths 18
26
| data
stringlengths 3
1.04M
|
---|---|
the_stack_data/9511819.c | #include <stdio.h>
struct {
unsigned int a : 1;
unsigned int b : 2;
unsigned int : 0; /* next unsigned int */
unsigned int c : 1;
unsigned int d : 8;
} f;
struct {
unsigned int a : 1;
unsigned int b : 2;
unsigned int c : 4;
unsigned int : 1;
unsigned int d : 8;
} bits;
int main(void)
{
f.a = 1;
f.b = 2;
f.c = 1;
f.d = 128;
printf("%u %u %u %u\n", f.a, f.b, f.c, f.d);
void *p = &f;
unsigned u1 = *((unsigned *) p);
unsigned u2 = *((unsigned *) p+1);
/* 0000 0000 0000 0101 */
printf("%u\n", u1);
/* 0000 0001 0000 0001 */
printf("%u\n", u2);
bits.a = 1; /* 1 */
bits.b = 2; /* 10 */
bits.c = 15; /* 1111 */
bits.d = 128; /* 1000 0000 */
void *pbits = &bits;
/* 1000 0000 0111 1101 */
printf("%u\n", *((unsigned *) pbits));
return 0;
}
|
the_stack_data/363084.c | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <omp.h>
#include <sys/time.h>
enum {
N = 100000
};
double wtime()
{
struct timeval t;
gettimeofday(&t, NULL);
return (double)t.tv_sec + (double)t.tv_usec * 1E-6;
}
double sum(double *v, int low, int high)
{
if (low == high)
return v[low];
int mid = (low + high) / 2;
return sum(v, low, mid) + sum(v, mid + 1, high);
}
double sum_omp_tasks(double *v, int low, int high)
{
if (low == high)
return v[low];
double sum_left, sum_right;
int mid = (low + high) / 2;
#pragma omp task shared(sum_left)
sum_left = sum_omp_tasks(v, low, mid);
#pragma omp task shared(sum_right)
sum_right = sum_omp_tasks(v, mid + 1, high);
#pragma omp taskwait
return sum_left + sum_right;
}
double sum_omp(double *v, int low, int high)
{
double s = 0;
#pragma omp parallel
{
#pragma omp single nowait
s = sum_omp_tasks(v, low, high);
}
return s;
}
double run_serial()
{
double *v = malloc(sizeof(*v) * N);
for (int i = 0; i < N; i++)
v[i] = i + 1.0;
double t = wtime();
double res = sum(v, 0, N - 1);
t = wtime() - t;
printf("Result (serial): %.4f; error %.12f\n", res, fabs(res - (1.0 + N) / 2.0 * N));
free(v);
return t;
}
double run_parallel()
{
double *v = malloc(sizeof(*v) * N);
for (int i = 0; i < N; i++)
v[i] = i + 1.0;
double t = wtime();
double res = sum_omp(v, 0, N - 1);
t = wtime() - t;
printf("Result (parallel): %.4f; error %.12f\n", res, fabs(res - (1.0 + N) / 2.0 * N));
free(v);
return t;
}
int main(int argc, char **argv)
{
printf("Recursive summation N = %d\n", N);
double tserial = run_serial();
double tparallel = run_parallel();
printf("Execution time (serial): %.6f\n", tserial);
printf("Execution time (parallel): %.6f\n", tparallel);
printf("Speedup: %.2f\n", tserial / tparallel);
return 0;
}
|
the_stack_data/1214320.c | #include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <complex.h>
#ifdef complex
#undef complex
#endif
#ifdef I
#undef I
#endif
#if defined(_WIN64)
typedef long long BLASLONG;
typedef unsigned long long BLASULONG;
#else
typedef long BLASLONG;
typedef unsigned long BLASULONG;
#endif
#ifdef LAPACK_ILP64
typedef BLASLONG blasint;
#if defined(_WIN64)
#define blasabs(x) llabs(x)
#else
#define blasabs(x) labs(x)
#endif
#else
typedef int blasint;
#define blasabs(x) abs(x)
#endif
typedef blasint integer;
typedef unsigned int uinteger;
typedef char *address;
typedef short int shortint;
typedef float real;
typedef double doublereal;
typedef struct { real r, i; } complex;
typedef struct { doublereal r, i; } doublecomplex;
#ifdef _MSC_VER
static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
#else
static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
#endif
#define pCf(z) (*_pCf(z))
#define pCd(z) (*_pCd(z))
typedef int logical;
typedef short int shortlogical;
typedef char logical1;
typedef char integer1;
#define TRUE_ (1)
#define FALSE_ (0)
/* Extern is for use with -E */
#ifndef Extern
#define Extern extern
#endif
/* I/O stuff */
typedef int flag;
typedef int ftnlen;
typedef int ftnint;
/*external read, write*/
typedef struct
{ flag cierr;
ftnint ciunit;
flag ciend;
char *cifmt;
ftnint cirec;
} cilist;
/*internal read, write*/
typedef struct
{ flag icierr;
char *iciunit;
flag iciend;
char *icifmt;
ftnint icirlen;
ftnint icirnum;
} icilist;
/*open*/
typedef struct
{ flag oerr;
ftnint ounit;
char *ofnm;
ftnlen ofnmlen;
char *osta;
char *oacc;
char *ofm;
ftnint orl;
char *oblnk;
} olist;
/*close*/
typedef struct
{ flag cerr;
ftnint cunit;
char *csta;
} cllist;
/*rewind, backspace, endfile*/
typedef struct
{ flag aerr;
ftnint aunit;
} alist;
/* inquire */
typedef struct
{ flag inerr;
ftnint inunit;
char *infile;
ftnlen infilen;
ftnint *inex; /*parameters in standard's order*/
ftnint *inopen;
ftnint *innum;
ftnint *innamed;
char *inname;
ftnlen innamlen;
char *inacc;
ftnlen inacclen;
char *inseq;
ftnlen inseqlen;
char *indir;
ftnlen indirlen;
char *infmt;
ftnlen infmtlen;
char *inform;
ftnint informlen;
char *inunf;
ftnlen inunflen;
ftnint *inrecl;
ftnint *innrec;
char *inblank;
ftnlen inblanklen;
} inlist;
#define VOID void
union Multitype { /* for multiple entry points */
integer1 g;
shortint h;
integer i;
/* longint j; */
real r;
doublereal d;
complex c;
doublecomplex z;
};
typedef union Multitype Multitype;
struct Vardesc { /* for Namelist */
char *name;
char *addr;
ftnlen *dims;
int type;
};
typedef struct Vardesc Vardesc;
struct Namelist {
char *name;
Vardesc **vars;
int nvars;
};
typedef struct Namelist Namelist;
#define abs(x) ((x) >= 0 ? (x) : -(x))
#define dabs(x) (fabs(x))
#define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
#define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
#define dmin(a,b) (f2cmin(a,b))
#define dmax(a,b) (f2cmax(a,b))
#define bit_test(a,b) ((a) >> (b) & 1)
#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
#define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
#define abort_() { sig_die("Fortran abort routine called", 1); }
#define c_abs(z) (cabsf(Cf(z)))
#define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
#ifdef _MSC_VER
#define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
#define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);}
#else
#define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
#define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
#endif
#define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
#define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
#define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
//#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
#define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
#define d_abs(x) (fabs(*(x)))
#define d_acos(x) (acos(*(x)))
#define d_asin(x) (asin(*(x)))
#define d_atan(x) (atan(*(x)))
#define d_atn2(x, y) (atan2(*(x),*(y)))
#define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
#define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
#define d_cos(x) (cos(*(x)))
#define d_cosh(x) (cosh(*(x)))
#define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
#define d_exp(x) (exp(*(x)))
#define d_imag(z) (cimag(Cd(z)))
#define r_imag(z) (cimagf(Cf(z)))
#define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define d_log(x) (log(*(x)))
#define d_mod(x, y) (fmod(*(x), *(y)))
#define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
#define d_nint(x) u_nint(*(x))
#define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
#define d_sign(a,b) u_sign(*(a),*(b))
#define r_sign(a,b) u_sign(*(a),*(b))
#define d_sin(x) (sin(*(x)))
#define d_sinh(x) (sinh(*(x)))
#define d_sqrt(x) (sqrt(*(x)))
#define d_tan(x) (tan(*(x)))
#define d_tanh(x) (tanh(*(x)))
#define i_abs(x) abs(*(x))
#define i_dnnt(x) ((integer)u_nint(*(x)))
#define i_len(s, n) (n)
#define i_nint(x) ((integer)u_nint(*(x)))
#define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
#define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
#define pow_si(B,E) spow_ui(*(B),*(E))
#define pow_ri(B,E) spow_ui(*(B),*(E))
#define pow_di(B,E) dpow_ui(*(B),*(E))
#define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
#define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
#define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
#define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
#define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
#define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
#define sig_die(s, kill) { exit(1); }
#define s_stop(s, n) {exit(0);}
static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
#define z_abs(z) (cabs(Cd(z)))
#define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
#define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
#define myexit_() break;
#define mycycle() continue;
#define myceiling(w) {ceil(w)}
#define myhuge(w) {HUGE_VAL}
//#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
#define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
/* procedure parameter types for -A and -C++ */
#define F2C_proc_par_types 1
#ifdef __cplusplus
typedef logical (*L_fp)(...);
#else
typedef logical (*L_fp)();
#endif
static float spow_ui(float x, integer n) {
float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static double dpow_ui(double x, integer n) {
double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#ifdef _MSC_VER
static _Fcomplex cpow_ui(complex x, integer n) {
complex pow={1.0,0.0}; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
for(u = n; ; ) {
if(u & 01) pow.r *= x.r, pow.i *= x.i;
if(u >>= 1) x.r *= x.r, x.i *= x.i;
else break;
}
}
_Fcomplex p={pow.r, pow.i};
return p;
}
#else
static _Complex float cpow_ui(_Complex float x, integer n) {
_Complex float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#endif
#ifdef _MSC_VER
static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
_Dcomplex pow={1.0,0.0}; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
for(u = n; ; ) {
if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
else break;
}
}
_Dcomplex p = {pow._Val[0], pow._Val[1]};
return p;
}
#else
static _Complex double zpow_ui(_Complex double x, integer n) {
_Complex double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#endif
static integer pow_ii(integer x, integer n) {
integer pow; unsigned long int u;
if (n <= 0) {
if (n == 0 || x == 1) pow = 1;
else if (x != -1) pow = x == 0 ? 1/x : 0;
else n = -n;
}
if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
u = n;
for(pow = 1; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static integer dmaxloc_(double *w, integer s, integer e, integer *n)
{
double m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static integer smaxloc_(float *w, integer s, integer e, integer *n)
{
float m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Fcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
}
}
pCf(z) = zdotc;
}
#else
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
#endif
static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Dcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
}
}
pCd(z) = zdotc;
}
#else
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
#endif
static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Fcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
}
}
pCf(z) = zdotc;
}
#else
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i]) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
#endif
static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Dcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
}
}
pCd(z) = zdotc;
}
#else
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i]) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
#endif
/* -- translated by f2c (version 20000121).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
/* > \brief \b SLAED4 used by sstedc. Finds a single root of the secular equation. */
/* =========== DOCUMENTATION =========== */
/* Online html documentation available at */
/* http://www.netlib.org/lapack/explore-html/ */
/* > \htmlonly */
/* > Download SLAED4 + dependencies */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slaed4.
f"> */
/* > [TGZ]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slaed4.
f"> */
/* > [ZIP]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slaed4.
f"> */
/* > [TXT]</a> */
/* > \endhtmlonly */
/* Definition: */
/* =========== */
/* SUBROUTINE SLAED4( N, I, D, Z, DELTA, RHO, DLAM, INFO ) */
/* INTEGER I, INFO, N */
/* REAL DLAM, RHO */
/* REAL D( * ), DELTA( * ), Z( * ) */
/* > \par Purpose: */
/* ============= */
/* > */
/* > \verbatim */
/* > */
/* > This subroutine computes the I-th updated eigenvalue of a symmetric */
/* > rank-one modification to a diagonal matrix whose elements are */
/* > given in the array d, and that */
/* > */
/* > D(i) < D(j) for i < j */
/* > */
/* > and that RHO > 0. This is arranged by the calling routine, and is */
/* > no loss in generality. The rank-one modified system is thus */
/* > */
/* > diag( D ) + RHO * Z * Z_transpose. */
/* > */
/* > where we assume the Euclidean norm of Z is 1. */
/* > */
/* > The method consists of approximating the rational functions in the */
/* > secular equation by simpler interpolating rational functions. */
/* > \endverbatim */
/* Arguments: */
/* ========== */
/* > \param[in] N */
/* > \verbatim */
/* > N is INTEGER */
/* > The length of all arrays. */
/* > \endverbatim */
/* > */
/* > \param[in] I */
/* > \verbatim */
/* > I is INTEGER */
/* > The index of the eigenvalue to be computed. 1 <= I <= N. */
/* > \endverbatim */
/* > */
/* > \param[in] D */
/* > \verbatim */
/* > D is REAL array, dimension (N) */
/* > The original eigenvalues. It is assumed that they are in */
/* > order, D(I) < D(J) for I < J. */
/* > \endverbatim */
/* > */
/* > \param[in] Z */
/* > \verbatim */
/* > Z is REAL array, dimension (N) */
/* > The components of the updating vector. */
/* > \endverbatim */
/* > */
/* > \param[out] DELTA */
/* > \verbatim */
/* > DELTA is REAL array, dimension (N) */
/* > If N > 2, DELTA contains (D(j) - lambda_I) in its j-th */
/* > component. If N = 1, then DELTA(1) = 1. If N = 2, see SLAED5 */
/* > for detail. The vector DELTA contains the information necessary */
/* > to construct the eigenvectors by SLAED3 and SLAED9. */
/* > \endverbatim */
/* > */
/* > \param[in] RHO */
/* > \verbatim */
/* > RHO is REAL */
/* > The scalar in the symmetric updating formula. */
/* > \endverbatim */
/* > */
/* > \param[out] DLAM */
/* > \verbatim */
/* > DLAM is REAL */
/* > The computed lambda_I, the I-th updated eigenvalue. */
/* > \endverbatim */
/* > */
/* > \param[out] INFO */
/* > \verbatim */
/* > INFO is INTEGER */
/* > = 0: successful exit */
/* > > 0: if INFO = 1, the updating process failed. */
/* > \endverbatim */
/* > \par Internal Parameters: */
/* ========================= */
/* > */
/* > \verbatim */
/* > Logical variable ORGATI (origin-at-i?) is used for distinguishing */
/* > whether D(i) or D(i+1) is treated as the origin. */
/* > */
/* > ORGATI = .true. origin at i */
/* > ORGATI = .false. origin at i+1 */
/* > */
/* > Logical variable SWTCH3 (switch-for-3-poles?) is for noting */
/* > if we are working with THREE poles! */
/* > */
/* > MAXIT is the maximum number of iterations allowed for each */
/* > eigenvalue. */
/* > \endverbatim */
/* Authors: */
/* ======== */
/* > \author Univ. of Tennessee */
/* > \author Univ. of California Berkeley */
/* > \author Univ. of Colorado Denver */
/* > \author NAG Ltd. */
/* > \date December 2016 */
/* > \ingroup auxOTHERcomputational */
/* > \par Contributors: */
/* ================== */
/* > */
/* > Ren-Cang Li, Computer Science Division, University of California */
/* > at Berkeley, USA */
/* > */
/* ===================================================================== */
/* Subroutine */ int slaed4_(integer *n, integer *i__, real *d__, real *z__,
real *delta, real *rho, real *dlam, integer *info)
{
/* System generated locals */
integer i__1;
real r__1;
/* Local variables */
real dphi, dpsi;
integer iter;
real temp, prew, temp1, a, b, c__;
integer j;
real w, dltlb, dltub, midpt;
integer niter;
logical swtch;
extern /* Subroutine */ int slaed5_(integer *, real *, real *, real *,
real *, real *), slaed6_(integer *, logical *, real *, real *,
real *, real *, real *, integer *);
logical swtch3;
integer ii;
real dw;
extern real slamch_(char *);
real zz[3];
logical orgati;
real erretm, rhoinv;
integer ip1;
real del, eta, phi, eps, tau, psi;
integer iim1, iip1;
/* -- LAPACK computational routine (version 3.7.0) -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
/* December 2016 */
/* ===================================================================== */
/* Since this routine is called in an inner loop, we do no argument */
/* checking. */
/* Quick return for N=1 and 2. */
/* Parameter adjustments */
--delta;
--z__;
--d__;
/* Function Body */
*info = 0;
if (*n == 1) {
/* Presumably, I=1 upon entry */
*dlam = d__[1] + *rho * z__[1] * z__[1];
delta[1] = 1.f;
return 0;
}
if (*n == 2) {
slaed5_(i__, &d__[1], &z__[1], &delta[1], rho, dlam);
return 0;
}
/* Compute machine epsilon */
eps = slamch_("Epsilon");
rhoinv = 1.f / *rho;
/* The case I = N */
if (*i__ == *n) {
/* Initialize some basic variables */
ii = *n - 1;
niter = 1;
/* Calculate initial guess */
midpt = *rho / 2.f;
/* If ||Z||_2 is not one, then TEMP should be set to */
/* RHO * ||Z||_2^2 / TWO */
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
delta[j] = d__[j] - d__[*i__] - midpt;
/* L10: */
}
psi = 0.f;
i__1 = *n - 2;
for (j = 1; j <= i__1; ++j) {
psi += z__[j] * z__[j] / delta[j];
/* L20: */
}
c__ = rhoinv + psi;
w = c__ + z__[ii] * z__[ii] / delta[ii] + z__[*n] * z__[*n] / delta[*
n];
if (w <= 0.f) {
temp = z__[*n - 1] * z__[*n - 1] / (d__[*n] - d__[*n - 1] + *rho)
+ z__[*n] * z__[*n] / *rho;
if (c__ <= temp) {
tau = *rho;
} else {
del = d__[*n] - d__[*n - 1];
a = -c__ * del + z__[*n - 1] * z__[*n - 1] + z__[*n] * z__[*n]
;
b = z__[*n] * z__[*n] * del;
if (a < 0.f) {
tau = b * 2.f / (sqrt(a * a + b * 4.f * c__) - a);
} else {
tau = (a + sqrt(a * a + b * 4.f * c__)) / (c__ * 2.f);
}
}
/* It can be proved that */
/* D(N)+RHO/2 <= LAMBDA(N) < D(N)+TAU <= D(N)+RHO */
dltlb = midpt;
dltub = *rho;
} else {
del = d__[*n] - d__[*n - 1];
a = -c__ * del + z__[*n - 1] * z__[*n - 1] + z__[*n] * z__[*n];
b = z__[*n] * z__[*n] * del;
if (a < 0.f) {
tau = b * 2.f / (sqrt(a * a + b * 4.f * c__) - a);
} else {
tau = (a + sqrt(a * a + b * 4.f * c__)) / (c__ * 2.f);
}
/* It can be proved that */
/* D(N) < D(N)+TAU < LAMBDA(N) < D(N)+RHO/2 */
dltlb = 0.f;
dltub = midpt;
}
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
delta[j] = d__[j] - d__[*i__] - tau;
/* L30: */
}
/* Evaluate PSI and the derivative DPSI */
dpsi = 0.f;
psi = 0.f;
erretm = 0.f;
i__1 = ii;
for (j = 1; j <= i__1; ++j) {
temp = z__[j] / delta[j];
psi += z__[j] * temp;
dpsi += temp * temp;
erretm += psi;
/* L40: */
}
erretm = abs(erretm);
/* Evaluate PHI and the derivative DPHI */
temp = z__[*n] / delta[*n];
phi = z__[*n] * temp;
dphi = temp * temp;
erretm = (-phi - psi) * 8.f + erretm - phi + rhoinv + abs(tau) * (
dpsi + dphi);
w = rhoinv + phi + psi;
/* Test for convergence */
if (abs(w) <= eps * erretm) {
*dlam = d__[*i__] + tau;
goto L250;
}
if (w <= 0.f) {
dltlb = f2cmax(dltlb,tau);
} else {
dltub = f2cmin(dltub,tau);
}
/* Calculate the new step */
++niter;
c__ = w - delta[*n - 1] * dpsi - delta[*n] * dphi;
a = (delta[*n - 1] + delta[*n]) * w - delta[*n - 1] * delta[*n] * (
dpsi + dphi);
b = delta[*n - 1] * delta[*n] * w;
if (c__ < 0.f) {
c__ = abs(c__);
}
if (c__ == 0.f) {
/* ETA = B/A */
/* ETA = RHO - TAU */
eta = dltub - tau;
} else if (a >= 0.f) {
eta = (a + sqrt((r__1 = a * a - b * 4.f * c__, abs(r__1)))) / (
c__ * 2.f);
} else {
eta = b * 2.f / (a - sqrt((r__1 = a * a - b * 4.f * c__, abs(r__1)
)));
}
/* Note, eta should be positive if w is negative, and */
/* eta should be negative otherwise. However, */
/* if for some reason caused by roundoff, eta*w > 0, */
/* we simply use one Newton step instead. This way */
/* will guarantee eta*w < 0. */
if (w * eta > 0.f) {
eta = -w / (dpsi + dphi);
}
temp = tau + eta;
if (temp > dltub || temp < dltlb) {
if (w < 0.f) {
eta = (dltub - tau) / 2.f;
} else {
eta = (dltlb - tau) / 2.f;
}
}
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
delta[j] -= eta;
/* L50: */
}
tau += eta;
/* Evaluate PSI and the derivative DPSI */
dpsi = 0.f;
psi = 0.f;
erretm = 0.f;
i__1 = ii;
for (j = 1; j <= i__1; ++j) {
temp = z__[j] / delta[j];
psi += z__[j] * temp;
dpsi += temp * temp;
erretm += psi;
/* L60: */
}
erretm = abs(erretm);
/* Evaluate PHI and the derivative DPHI */
temp = z__[*n] / delta[*n];
phi = z__[*n] * temp;
dphi = temp * temp;
erretm = (-phi - psi) * 8.f + erretm - phi + rhoinv + abs(tau) * (
dpsi + dphi);
w = rhoinv + phi + psi;
/* Main loop to update the values of the array DELTA */
iter = niter + 1;
for (niter = iter; niter <= 30; ++niter) {
/* Test for convergence */
if (abs(w) <= eps * erretm) {
*dlam = d__[*i__] + tau;
goto L250;
}
if (w <= 0.f) {
dltlb = f2cmax(dltlb,tau);
} else {
dltub = f2cmin(dltub,tau);
}
/* Calculate the new step */
c__ = w - delta[*n - 1] * dpsi - delta[*n] * dphi;
a = (delta[*n - 1] + delta[*n]) * w - delta[*n - 1] * delta[*n] *
(dpsi + dphi);
b = delta[*n - 1] * delta[*n] * w;
if (a >= 0.f) {
eta = (a + sqrt((r__1 = a * a - b * 4.f * c__, abs(r__1)))) /
(c__ * 2.f);
} else {
eta = b * 2.f / (a - sqrt((r__1 = a * a - b * 4.f * c__, abs(
r__1))));
}
/* Note, eta should be positive if w is negative, and */
/* eta should be negative otherwise. However, */
/* if for some reason caused by roundoff, eta*w > 0, */
/* we simply use one Newton step instead. This way */
/* will guarantee eta*w < 0. */
if (w * eta > 0.f) {
eta = -w / (dpsi + dphi);
}
temp = tau + eta;
if (temp > dltub || temp < dltlb) {
if (w < 0.f) {
eta = (dltub - tau) / 2.f;
} else {
eta = (dltlb - tau) / 2.f;
}
}
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
delta[j] -= eta;
/* L70: */
}
tau += eta;
/* Evaluate PSI and the derivative DPSI */
dpsi = 0.f;
psi = 0.f;
erretm = 0.f;
i__1 = ii;
for (j = 1; j <= i__1; ++j) {
temp = z__[j] / delta[j];
psi += z__[j] * temp;
dpsi += temp * temp;
erretm += psi;
/* L80: */
}
erretm = abs(erretm);
/* Evaluate PHI and the derivative DPHI */
temp = z__[*n] / delta[*n];
phi = z__[*n] * temp;
dphi = temp * temp;
erretm = (-phi - psi) * 8.f + erretm - phi + rhoinv + abs(tau) * (
dpsi + dphi);
w = rhoinv + phi + psi;
/* L90: */
}
/* Return with INFO = 1, NITER = MAXIT and not converged */
*info = 1;
*dlam = d__[*i__] + tau;
goto L250;
/* End for the case I = N */
} else {
/* The case for I < N */
niter = 1;
ip1 = *i__ + 1;
/* Calculate initial guess */
del = d__[ip1] - d__[*i__];
midpt = del / 2.f;
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
delta[j] = d__[j] - d__[*i__] - midpt;
/* L100: */
}
psi = 0.f;
i__1 = *i__ - 1;
for (j = 1; j <= i__1; ++j) {
psi += z__[j] * z__[j] / delta[j];
/* L110: */
}
phi = 0.f;
i__1 = *i__ + 2;
for (j = *n; j >= i__1; --j) {
phi += z__[j] * z__[j] / delta[j];
/* L120: */
}
c__ = rhoinv + psi + phi;
w = c__ + z__[*i__] * z__[*i__] / delta[*i__] + z__[ip1] * z__[ip1] /
delta[ip1];
if (w > 0.f) {
/* d(i)< the ith eigenvalue < (d(i)+d(i+1))/2 */
/* We choose d(i) as origin. */
orgati = TRUE_;
a = c__ * del + z__[*i__] * z__[*i__] + z__[ip1] * z__[ip1];
b = z__[*i__] * z__[*i__] * del;
if (a > 0.f) {
tau = b * 2.f / (a + sqrt((r__1 = a * a - b * 4.f * c__, abs(
r__1))));
} else {
tau = (a - sqrt((r__1 = a * a - b * 4.f * c__, abs(r__1)))) /
(c__ * 2.f);
}
dltlb = 0.f;
dltub = midpt;
} else {
/* (d(i)+d(i+1))/2 <= the ith eigenvalue < d(i+1) */
/* We choose d(i+1) as origin. */
orgati = FALSE_;
a = c__ * del - z__[*i__] * z__[*i__] - z__[ip1] * z__[ip1];
b = z__[ip1] * z__[ip1] * del;
if (a < 0.f) {
tau = b * 2.f / (a - sqrt((r__1 = a * a + b * 4.f * c__, abs(
r__1))));
} else {
tau = -(a + sqrt((r__1 = a * a + b * 4.f * c__, abs(r__1)))) /
(c__ * 2.f);
}
dltlb = -midpt;
dltub = 0.f;
}
if (orgati) {
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
delta[j] = d__[j] - d__[*i__] - tau;
/* L130: */
}
} else {
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
delta[j] = d__[j] - d__[ip1] - tau;
/* L140: */
}
}
if (orgati) {
ii = *i__;
} else {
ii = *i__ + 1;
}
iim1 = ii - 1;
iip1 = ii + 1;
/* Evaluate PSI and the derivative DPSI */
dpsi = 0.f;
psi = 0.f;
erretm = 0.f;
i__1 = iim1;
for (j = 1; j <= i__1; ++j) {
temp = z__[j] / delta[j];
psi += z__[j] * temp;
dpsi += temp * temp;
erretm += psi;
/* L150: */
}
erretm = abs(erretm);
/* Evaluate PHI and the derivative DPHI */
dphi = 0.f;
phi = 0.f;
i__1 = iip1;
for (j = *n; j >= i__1; --j) {
temp = z__[j] / delta[j];
phi += z__[j] * temp;
dphi += temp * temp;
erretm += phi;
/* L160: */
}
w = rhoinv + phi + psi;
/* W is the value of the secular function with */
/* its ii-th element removed. */
swtch3 = FALSE_;
if (orgati) {
if (w < 0.f) {
swtch3 = TRUE_;
}
} else {
if (w > 0.f) {
swtch3 = TRUE_;
}
}
if (ii == 1 || ii == *n) {
swtch3 = FALSE_;
}
temp = z__[ii] / delta[ii];
dw = dpsi + dphi + temp * temp;
temp = z__[ii] * temp;
w += temp;
erretm = (phi - psi) * 8.f + erretm + rhoinv * 2.f + abs(temp) * 3.f
+ abs(tau) * dw;
/* Test for convergence */
if (abs(w) <= eps * erretm) {
if (orgati) {
*dlam = d__[*i__] + tau;
} else {
*dlam = d__[ip1] + tau;
}
goto L250;
}
if (w <= 0.f) {
dltlb = f2cmax(dltlb,tau);
} else {
dltub = f2cmin(dltub,tau);
}
/* Calculate the new step */
++niter;
if (! swtch3) {
if (orgati) {
/* Computing 2nd power */
r__1 = z__[*i__] / delta[*i__];
c__ = w - delta[ip1] * dw - (d__[*i__] - d__[ip1]) * (r__1 *
r__1);
} else {
/* Computing 2nd power */
r__1 = z__[ip1] / delta[ip1];
c__ = w - delta[*i__] * dw - (d__[ip1] - d__[*i__]) * (r__1 *
r__1);
}
a = (delta[*i__] + delta[ip1]) * w - delta[*i__] * delta[ip1] *
dw;
b = delta[*i__] * delta[ip1] * w;
if (c__ == 0.f) {
if (a == 0.f) {
if (orgati) {
a = z__[*i__] * z__[*i__] + delta[ip1] * delta[ip1] *
(dpsi + dphi);
} else {
a = z__[ip1] * z__[ip1] + delta[*i__] * delta[*i__] *
(dpsi + dphi);
}
}
eta = b / a;
} else if (a <= 0.f) {
eta = (a - sqrt((r__1 = a * a - b * 4.f * c__, abs(r__1)))) /
(c__ * 2.f);
} else {
eta = b * 2.f / (a + sqrt((r__1 = a * a - b * 4.f * c__, abs(
r__1))));
}
} else {
/* Interpolation using THREE most relevant poles */
temp = rhoinv + psi + phi;
if (orgati) {
temp1 = z__[iim1] / delta[iim1];
temp1 *= temp1;
c__ = temp - delta[iip1] * (dpsi + dphi) - (d__[iim1] - d__[
iip1]) * temp1;
zz[0] = z__[iim1] * z__[iim1];
zz[2] = delta[iip1] * delta[iip1] * (dpsi - temp1 + dphi);
} else {
temp1 = z__[iip1] / delta[iip1];
temp1 *= temp1;
c__ = temp - delta[iim1] * (dpsi + dphi) - (d__[iip1] - d__[
iim1]) * temp1;
zz[0] = delta[iim1] * delta[iim1] * (dpsi + (dphi - temp1));
zz[2] = z__[iip1] * z__[iip1];
}
zz[1] = z__[ii] * z__[ii];
slaed6_(&niter, &orgati, &c__, &delta[iim1], zz, &w, &eta, info);
if (*info != 0) {
goto L250;
}
}
/* Note, eta should be positive if w is negative, and */
/* eta should be negative otherwise. However, */
/* if for some reason caused by roundoff, eta*w > 0, */
/* we simply use one Newton step instead. This way */
/* will guarantee eta*w < 0. */
if (w * eta >= 0.f) {
eta = -w / dw;
}
temp = tau + eta;
if (temp > dltub || temp < dltlb) {
if (w < 0.f) {
eta = (dltub - tau) / 2.f;
} else {
eta = (dltlb - tau) / 2.f;
}
}
prew = w;
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
delta[j] -= eta;
/* L180: */
}
/* Evaluate PSI and the derivative DPSI */
dpsi = 0.f;
psi = 0.f;
erretm = 0.f;
i__1 = iim1;
for (j = 1; j <= i__1; ++j) {
temp = z__[j] / delta[j];
psi += z__[j] * temp;
dpsi += temp * temp;
erretm += psi;
/* L190: */
}
erretm = abs(erretm);
/* Evaluate PHI and the derivative DPHI */
dphi = 0.f;
phi = 0.f;
i__1 = iip1;
for (j = *n; j >= i__1; --j) {
temp = z__[j] / delta[j];
phi += z__[j] * temp;
dphi += temp * temp;
erretm += phi;
/* L200: */
}
temp = z__[ii] / delta[ii];
dw = dpsi + dphi + temp * temp;
temp = z__[ii] * temp;
w = rhoinv + phi + psi + temp;
erretm = (phi - psi) * 8.f + erretm + rhoinv * 2.f + abs(temp) * 3.f
+ (r__1 = tau + eta, abs(r__1)) * dw;
swtch = FALSE_;
if (orgati) {
if (-w > abs(prew) / 10.f) {
swtch = TRUE_;
}
} else {
if (w > abs(prew) / 10.f) {
swtch = TRUE_;
}
}
tau += eta;
/* Main loop to update the values of the array DELTA */
iter = niter + 1;
for (niter = iter; niter <= 30; ++niter) {
/* Test for convergence */
if (abs(w) <= eps * erretm) {
if (orgati) {
*dlam = d__[*i__] + tau;
} else {
*dlam = d__[ip1] + tau;
}
goto L250;
}
if (w <= 0.f) {
dltlb = f2cmax(dltlb,tau);
} else {
dltub = f2cmin(dltub,tau);
}
/* Calculate the new step */
if (! swtch3) {
if (! swtch) {
if (orgati) {
/* Computing 2nd power */
r__1 = z__[*i__] / delta[*i__];
c__ = w - delta[ip1] * dw - (d__[*i__] - d__[ip1]) * (
r__1 * r__1);
} else {
/* Computing 2nd power */
r__1 = z__[ip1] / delta[ip1];
c__ = w - delta[*i__] * dw - (d__[ip1] - d__[*i__]) *
(r__1 * r__1);
}
} else {
temp = z__[ii] / delta[ii];
if (orgati) {
dpsi += temp * temp;
} else {
dphi += temp * temp;
}
c__ = w - delta[*i__] * dpsi - delta[ip1] * dphi;
}
a = (delta[*i__] + delta[ip1]) * w - delta[*i__] * delta[ip1]
* dw;
b = delta[*i__] * delta[ip1] * w;
if (c__ == 0.f) {
if (a == 0.f) {
if (! swtch) {
if (orgati) {
a = z__[*i__] * z__[*i__] + delta[ip1] *
delta[ip1] * (dpsi + dphi);
} else {
a = z__[ip1] * z__[ip1] + delta[*i__] * delta[
*i__] * (dpsi + dphi);
}
} else {
a = delta[*i__] * delta[*i__] * dpsi + delta[ip1]
* delta[ip1] * dphi;
}
}
eta = b / a;
} else if (a <= 0.f) {
eta = (a - sqrt((r__1 = a * a - b * 4.f * c__, abs(r__1)))
) / (c__ * 2.f);
} else {
eta = b * 2.f / (a + sqrt((r__1 = a * a - b * 4.f * c__,
abs(r__1))));
}
} else {
/* Interpolation using THREE most relevant poles */
temp = rhoinv + psi + phi;
if (swtch) {
c__ = temp - delta[iim1] * dpsi - delta[iip1] * dphi;
zz[0] = delta[iim1] * delta[iim1] * dpsi;
zz[2] = delta[iip1] * delta[iip1] * dphi;
} else {
if (orgati) {
temp1 = z__[iim1] / delta[iim1];
temp1 *= temp1;
c__ = temp - delta[iip1] * (dpsi + dphi) - (d__[iim1]
- d__[iip1]) * temp1;
zz[0] = z__[iim1] * z__[iim1];
zz[2] = delta[iip1] * delta[iip1] * (dpsi - temp1 +
dphi);
} else {
temp1 = z__[iip1] / delta[iip1];
temp1 *= temp1;
c__ = temp - delta[iim1] * (dpsi + dphi) - (d__[iip1]
- d__[iim1]) * temp1;
zz[0] = delta[iim1] * delta[iim1] * (dpsi + (dphi -
temp1));
zz[2] = z__[iip1] * z__[iip1];
}
}
slaed6_(&niter, &orgati, &c__, &delta[iim1], zz, &w, &eta,
info);
if (*info != 0) {
goto L250;
}
}
/* Note, eta should be positive if w is negative, and */
/* eta should be negative otherwise. However, */
/* if for some reason caused by roundoff, eta*w > 0, */
/* we simply use one Newton step instead. This way */
/* will guarantee eta*w < 0. */
if (w * eta >= 0.f) {
eta = -w / dw;
}
temp = tau + eta;
if (temp > dltub || temp < dltlb) {
if (w < 0.f) {
eta = (dltub - tau) / 2.f;
} else {
eta = (dltlb - tau) / 2.f;
}
}
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
delta[j] -= eta;
/* L210: */
}
tau += eta;
prew = w;
/* Evaluate PSI and the derivative DPSI */
dpsi = 0.f;
psi = 0.f;
erretm = 0.f;
i__1 = iim1;
for (j = 1; j <= i__1; ++j) {
temp = z__[j] / delta[j];
psi += z__[j] * temp;
dpsi += temp * temp;
erretm += psi;
/* L220: */
}
erretm = abs(erretm);
/* Evaluate PHI and the derivative DPHI */
dphi = 0.f;
phi = 0.f;
i__1 = iip1;
for (j = *n; j >= i__1; --j) {
temp = z__[j] / delta[j];
phi += z__[j] * temp;
dphi += temp * temp;
erretm += phi;
/* L230: */
}
temp = z__[ii] / delta[ii];
dw = dpsi + dphi + temp * temp;
temp = z__[ii] * temp;
w = rhoinv + phi + psi + temp;
erretm = (phi - psi) * 8.f + erretm + rhoinv * 2.f + abs(temp) *
3.f + abs(tau) * dw;
if (w * prew > 0.f && abs(w) > abs(prew) / 10.f) {
swtch = ! swtch;
}
/* L240: */
}
/* Return with INFO = 1, NITER = MAXIT and not converged */
*info = 1;
if (orgati) {
*dlam = d__[*i__] + tau;
} else {
*dlam = d__[ip1] + tau;
}
}
L250:
return 0;
/* End of SLAED4 */
} /* slaed4_ */
|
the_stack_data/231392408.c |
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node
{char data[10];
struct node * link;};
struct node *start=NULL;
void insert_node()
{
struct node *new_node;
new_node=(struct node *)malloc(sizeof(struct node));
if(new_node==NULL)
{printf("\nMemory Allocation failed");}
else{
printf("\nEnter the string to be stored in the node ");
scanf("%s",&new_node->data);
new_node->link=NULL;
if(start!=NULL)
new_node->link=start;
start=new_node;}
}
void traverse()
{
struct node *ptr;
ptr=start;
if(ptr==NULL)
printf("\nEmpty List");
else
{ printf("\n");
while(ptr!=NULL)
{printf("%s -> ",ptr->data);
ptr=ptr->link;}}
}
void reverse()
{ struct node *prev,*cn;
if(start != NULL)
{
prev = start;
cn = start->link;
start = start->link;
prev->link = NULL;
while(start != NULL)
{
start = start->link;
cn->link = prev;
prev = cn;
cn = start;
}
start = prev;
}
}
void main()
{
int n,i;
printf("\nEnter the no:of nodes to be inserted");
scanf("%d",&n);
for(i=0;i<n;i++)
insert_node();
printf("\nCurrent Link List :: ");
traverse();
printf("\nReversed Link List ::");
reverse();
traverse();
}
|
the_stack_data/48575743.c | #include<sys/types.h>
#include<sys/stat.h>
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
int main(int argc, char *argv[])
{
struct stat st;
if(argc != 2) {
perror("Usage Error: a.out");
}
if(stat(argv[1], &st)==-1) {
perror("stat");
}
printf("File type: ");
switch(st.st_mode & S_IFMT) {
case S_IFBLK: printf("block device\n"); break;
case S_IFCHR: printf("Char device\n"); break;
case S_IFDIR: printf("Dir\n"); break;
case S_IFIFO: printf("Fifo / pipe\n"); break;
case S_IFLNK: printf("symlink\n"); break;
case S_IFREG: printf("regular file\n"); break;
case S_IFSOCK: printf("socket\n"); break;
default : printf("unknown");
}
printf("Inode number: %ld\n", (long)st.st_ino);
printf("Mode: %lo (octal)\n", (unsigned long) st.st_mode);
printf("Link cnt: %ld\n",(long) st.st_nlink);
printf("Ownership: UID:%ldGID:%ld\n",(long) st.st_uid, (long) st.st_gid);
printf("I/O Blocks: %ld bytes\n", (long) st.st_blksize);
printf("File size: %lld bytes\n", (long long) st.st_size);
printf("Blocks allocated: %lld\n", (long long) st.st_blocks);
}
|
the_stack_data/105618.c | /* 直接插入排序函数 */
void insert_sort(int * array, int length)
{
int i,j;
for(i = 1; i < length; i++){ /* 控制循环的次数 */
int temp;
j = i;
temp = array[j]; /* 临时值的赋值 */
while(j > 0){
if(temp < array[j - 1]){ /* 移动后面的所有数组元素 */
array[j] = array[j - 1];
j--;
}else
break; /* 跳出循环 */
}
array[j] = temp; /* 临时值保存在适当的位置上 */
}
}
/* 二分查找函数 */
int binary_search(int * array, int item, int length)
{
int high, low, mid;
high = length - 1; /* 高端 */
low = 0; /* 低端 */
mid = (high + low)/2; /* 中间位置 */
while(low <= high){ /* 当高端大于低端时开始循环 */
if(array[mid] > item){ /* 是否大于中点的元素 */
high = mid;
mid = (high + low)/2;
}else if(array[mid] < item){ /* 是否小于中点的元素 */
low = mid;
mid = (high + low)/2;
}else
return mid; /* 等于中点元素,则返回该元素 */
}
return -1; /* 否则没有找到该元素 */
}
/* 冒泡排序函数 */
void bubble_sort(int * array, int length)
{
int i, j;
int exchange;
int temp;
i = 0;
exchange = 1; /* 是否交换的标志位 */
while(i < length && exchange){ /* 当上一趟循环没有交换元素时,停止循环 */
j = length - 1;
exchange = 0; /* 清空交换元素标志 */
while(j >= i){
if(array[j] < array[j - 1]){ /* 如果两个元素逆序,则交换两个元素 */
temp = array[j];
array[j] = array[j - 1];
array[j - 1] = temp;
exchange = 1; /* 设置交换元素标志位 */
}
j--;
}
i++; /* 总的循环次数累加 */
}
}
|
the_stack_data/90765440.c | //REVERSE PRINT CIRCULAR SINGLY LINKED list
#include<stdio.h>
#include<stdlib.h>
struct Node
{
int data;
struct Node* next ;
};
struct Node* head;
void insert_at_end()
{
struct Node* new_node = (struct Node*)malloc(sizeof(struct Node));
if(!new_node)
{
printf("NO MEMORY ALLOCATED");
return;
}
scanf("%d" , &new_node->data);
new_node ->next = head ;
if(!head)
{
head = new_node;
return;
}
else
{
struct Node* temp;
for(temp = head ; temp->next!= head ; temp = temp->next);
temp->next = new_node;
return;
}
}
void insert_at_beginning()
{
struct Node* new_node = (struct Node*)malloc(sizeof(struct Node));
if(!new_node)
{
printf("NO MEMORY ALLOCATED");
return;
}
scanf("%d" , &new_node->data);
if(!head)
{
new_node->next= head;
head = new_node;
return;
}
else
{
struct Node* temp;
for(temp = head ; temp->next!= head ; temp = temp->next);
temp->next = new_node;
new_node->next= head;
head = new_node;
return;
}
}
void rev_print(struct Node* phead)
{
if(!head)
return;
if(phead->next!=head)
{
rev_print(phead->next);
printf("%d" , phead->data);
}
}
void print()
{
struct Node* temp;
for(temp = head ; temp->next!= head ; temp = temp->next)
{
printf("%2d" , temp->data);
}
// if(!phead)
// return;
// else
// {
// printf("%d" , phead->data);
// print(phead->next);
// return;
// }
}
int main()
{
for(int i =1 ; i<=7 ; i++)
{
insert_at_beginning();
}
print(head);
return 0;
}
|
the_stack_data/243429.c | /* { dg-do run } */
/* { dg-options "-O3" } */
#include <stdlib.h>
#define N 64
#ifndef TYPE1
#define TYPE1 int
#define TYPE2 long long
#endif
signed TYPE1 a[N], b, g[N];
unsigned TYPE1 c[N], h[N];
signed TYPE2 d[N], e, j[N];
unsigned TYPE2 f[N], k[N];
#ifndef S
#define S(x) x
#endif
__attribute__((noinline)) void
f1 (void)
{
int i;
for (i = 0; i < N; i++)
g[i] = a[i] << S (b);
}
__attribute__((noinline)) void
f2 (void)
{
int i;
for (i = 0; i < N; i++)
g[i] = a[i] >> S (b);
}
__attribute__((noinline)) void
f3 (void)
{
int i;
for (i = 0; i < N; i++)
h[i] = c[i] >> S (b);
}
__attribute__((noinline)) void
f4 (void)
{
int i;
for (i = 0; i < N; i++)
j[i] = d[i] << S (e);
}
__attribute__((noinline)) void
f5 (void)
{
int i;
for (i = 0; i < N; i++)
j[i] = d[i] >> S (e);
}
__attribute__((noinline)) void
f6 (void)
{
int i;
for (i = 0; i < N; i++)
k[i] = f[i] >> S (e);
}
__attribute__((noinline)) void
f7 (void)
{
int i;
for (i = 0; i < N; i++)
j[i] = d[i] << S (b);
}
__attribute__((noinline)) void
f8 (void)
{
int i;
for (i = 0; i < N; i++)
j[i] = d[i] >> S (b);
}
__attribute__((noinline)) void
f9 (void)
{
int i;
for (i = 0; i < N; i++)
k[i] = f[i] >> S (b);
}
int
main ()
{
int i;
b = 7;
e = 12;
for (i = 0; i < N; i++)
{
asm ("");
c[i] = (rand () << 1) | (rand () & 1);
a[i] = c[i];
d[i] = (rand () << 1) | (rand () & 1);
d[i] |= (unsigned long long) c[i] << 32;
f[i] = d[i];
}
f1 ();
f3 ();
f4 ();
f6 ();
for (i = 0; i < N; i++)
if (g[i] != (signed TYPE1) (a[i] << S (b))
|| h[i] != (unsigned TYPE1) (c[i] >> S (b))
|| j[i] != (signed TYPE2) (d[i] << S (e))
|| k[i] != (unsigned TYPE2) (f[i] >> S (e)))
abort ();
f2 ();
f5 ();
f9 ();
for (i = 0; i < N; i++)
if (g[i] != (signed TYPE1) (a[i] >> S (b))
|| j[i] != (signed TYPE2) (d[i] >> S (e))
|| k[i] != (unsigned TYPE2) (f[i] >> S (b)))
abort ();
f7 ();
for (i = 0; i < N; i++)
if (j[i] != (signed TYPE2) (d[i] << S (b)))
abort ();
f8 ();
for (i = 0; i < N; i++)
if (j[i] != (signed TYPE2) (d[i] >> S (b)))
abort ();
return 0;
}
|
the_stack_data/45451127.c |
#include <omp.h>
#include <stdio.h>
#define LOOPCOUNT 200
int
check_single_copyprivate (FILE * logFile)
{
int result = 0;
int nr_iterations = 0;
int i;
#pragma omp parallel private(i)
{
for (i = 0; i < LOOPCOUNT; i++)
{
int j;
/*
int thread;
thread=omp_get_thread_num();
*/
#pragma omp single copyprivate(j)
{
nr_iterations++;
j = i;
/*printf("thread %d assigns ,j=%d,i=%d\n",thread,j,i); */
}
/* #pragma omp barrier */
#pragma omp critical
{
/*printf("thread=%d,j=%d,i=%d\n",thread,j,i); */
result = result + j - i;
}
#pragma omp barrier
} /* end of for */
} /* end of parallel */
return (result == 0) && (nr_iterations == LOOPCOUNT);
}
int
crosscheck_single_copyprivate (FILE * logFile)
{
int result = 0;
int nr_iterations = 0;
int i;
#pragma omp parallel private(i)
{
for (i = 0; i < LOOPCOUNT; i++)
{
int j;
/*
int thread;
thread=omp_get_thread_num();
*/
#pragma omp single private(j)
{
nr_iterations++;
j = i;
/*printf("thread %d assigns ,j=%d,i=%d\n",thread,j,i); */
}
/* #pragma omp barrier */
#pragma omp critical
{
/*printf("thread=%d,j=%d,i=%d\n",thread,j,i); */
result = result + j - i;
}
#pragma omp barrier
} /* end of for */
} /* end of parallel */
return (result == 0) && (nr_iterations == LOOPCOUNT);
}
|
the_stack_data/1194099.c | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
printf("Result: %d\n", 1 / atoi(argv[1]));
return 0;
}
|
the_stack_data/178265554.c | /**
******************************************************************************
* @file stm32f3xx_ll_dma.c
* @author MCD Application Team
* @version V1.4.0
* @date 16-December-2016
* @brief DMA LL module driver.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#if defined(USE_FULL_LL_DRIVER)
/* Includes ------------------------------------------------------------------*/
#include "stm32f3xx_ll_dma.h"
#include "stm32f3xx_ll_bus.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif
/** @addtogroup STM32F3xx_LL_Driver
* @{
*/
#if defined (DMA1) || defined (DMA2)
/** @defgroup DMA_LL DMA
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/** @addtogroup DMA_LL_Private_Macros
* @{
*/
#define IS_LL_DMA_DIRECTION(__VALUE__) (((__VALUE__) == LL_DMA_DIRECTION_PERIPH_TO_MEMORY) || \
((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_PERIPH) || \
((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_MEMORY))
#define IS_LL_DMA_MODE(__VALUE__) (((__VALUE__) == LL_DMA_MODE_NORMAL) || \
((__VALUE__) == LL_DMA_MODE_CIRCULAR))
#define IS_LL_DMA_PERIPHINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_PERIPH_INCREMENT) || \
((__VALUE__) == LL_DMA_PERIPH_NOINCREMENT))
#define IS_LL_DMA_MEMORYINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_MEMORY_INCREMENT) || \
((__VALUE__) == LL_DMA_MEMORY_NOINCREMENT))
#define IS_LL_DMA_PERIPHDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_PDATAALIGN_BYTE) || \
((__VALUE__) == LL_DMA_PDATAALIGN_HALFWORD) || \
((__VALUE__) == LL_DMA_PDATAALIGN_WORD))
#define IS_LL_DMA_MEMORYDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_MDATAALIGN_BYTE) || \
((__VALUE__) == LL_DMA_MDATAALIGN_HALFWORD) || \
((__VALUE__) == LL_DMA_MDATAALIGN_WORD))
#define IS_LL_DMA_NBDATA(__VALUE__) ((__VALUE__) <= (uint32_t)0x0000FFFFU)
#define IS_LL_DMA_PRIORITY(__VALUE__) (((__VALUE__) == LL_DMA_PRIORITY_LOW) || \
((__VALUE__) == LL_DMA_PRIORITY_MEDIUM) || \
((__VALUE__) == LL_DMA_PRIORITY_HIGH) || \
((__VALUE__) == LL_DMA_PRIORITY_VERYHIGH))
#if defined (DMA2)
#if defined (DMA2_Channel6) && defined (DMA2_Channel7)
#define IS_LL_DMA_ALL_CHANNEL_INSTANCE(INSTANCE, CHANNEL) ((((INSTANCE) == DMA1) && \
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
((CHANNEL) == LL_DMA_CHANNEL_2) || \
((CHANNEL) == LL_DMA_CHANNEL_3) || \
((CHANNEL) == LL_DMA_CHANNEL_4) || \
((CHANNEL) == LL_DMA_CHANNEL_5) || \
((CHANNEL) == LL_DMA_CHANNEL_6) || \
((CHANNEL) == LL_DMA_CHANNEL_7))) || \
(((INSTANCE) == DMA2) && \
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
((CHANNEL) == LL_DMA_CHANNEL_2) || \
((CHANNEL) == LL_DMA_CHANNEL_3) || \
((CHANNEL) == LL_DMA_CHANNEL_4) || \
((CHANNEL) == LL_DMA_CHANNEL_5) || \
((CHANNEL) == LL_DMA_CHANNEL_6) || \
((CHANNEL) == LL_DMA_CHANNEL_7))))
#else
#define IS_LL_DMA_ALL_CHANNEL_INSTANCE(INSTANCE, CHANNEL) ((((INSTANCE) == DMA1) && \
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
((CHANNEL) == LL_DMA_CHANNEL_2) || \
((CHANNEL) == LL_DMA_CHANNEL_3) || \
((CHANNEL) == LL_DMA_CHANNEL_4) || \
((CHANNEL) == LL_DMA_CHANNEL_5) || \
((CHANNEL) == LL_DMA_CHANNEL_6) || \
((CHANNEL) == LL_DMA_CHANNEL_7))) || \
(((INSTANCE) == DMA2) && \
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
((CHANNEL) == LL_DMA_CHANNEL_2) || \
((CHANNEL) == LL_DMA_CHANNEL_3) || \
((CHANNEL) == LL_DMA_CHANNEL_4) || \
((CHANNEL) == LL_DMA_CHANNEL_5))))
#endif
#else
#define IS_LL_DMA_ALL_CHANNEL_INSTANCE(INSTANCE, CHANNEL) ((((INSTANCE) == DMA1) && \
(((CHANNEL) == LL_DMA_CHANNEL_1)|| \
((CHANNEL) == LL_DMA_CHANNEL_2) || \
((CHANNEL) == LL_DMA_CHANNEL_3) || \
((CHANNEL) == LL_DMA_CHANNEL_4) || \
((CHANNEL) == LL_DMA_CHANNEL_5) || \
((CHANNEL) == LL_DMA_CHANNEL_6) || \
((CHANNEL) == LL_DMA_CHANNEL_7))))
#endif
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup DMA_LL_Exported_Functions
* @{
*/
/** @addtogroup DMA_LL_EF_Init
* @{
*/
/**
* @brief De-initialize the DMA registers to their default reset values.
* @param DMAx DMAx Instance
* @param Channel This parameter can be one of the following values:
* @arg @ref LL_DMA_CHANNEL_1
* @arg @ref LL_DMA_CHANNEL_2
* @arg @ref LL_DMA_CHANNEL_3
* @arg @ref LL_DMA_CHANNEL_4
* @arg @ref LL_DMA_CHANNEL_5
* @arg @ref LL_DMA_CHANNEL_6
* @arg @ref LL_DMA_CHANNEL_7
* @retval An ErrorStatus enumeration value:
* - SUCCESS: DMA registers are de-initialized
* - ERROR: DMA registers are not de-initialized
*/
uint32_t LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Channel)
{
DMA_Channel_TypeDef *tmp = (DMA_Channel_TypeDef *)DMA1_Channel1;
ErrorStatus status = SUCCESS;
/* Check the DMA Instance DMAx and Channel parameters*/
assert_param(IS_LL_DMA_ALL_CHANNEL_INSTANCE(DMAx, Channel));
tmp = (DMA_Channel_TypeDef *)(__LL_DMA_GET_CHANNEL_INSTANCE(DMAx, Channel));
/* Disable the selected DMAx_Channely */
CLEAR_BIT(tmp->CCR, DMA_CCR_EN);
/* Reset DMAx_Channely control register */
LL_DMA_WriteReg(tmp, CCR, 0U);
/* Reset DMAx_Channely remaining bytes register */
LL_DMA_WriteReg(tmp, CNDTR, 0U);
/* Reset DMAx_Channely peripheral address register */
LL_DMA_WriteReg(tmp, CPAR, 0U);
/* Reset DMAx_Channely memory address register */
LL_DMA_WriteReg(tmp, CMAR, 0U);
if (Channel == LL_DMA_CHANNEL_1)
{
/* Reset interrupt pending bits for DMAx Channel1 */
LL_DMA_ClearFlag_GI1(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_2)
{
/* Reset interrupt pending bits for DMAx Channel2 */
LL_DMA_ClearFlag_GI2(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_3)
{
/* Reset interrupt pending bits for DMAx Channel3 */
LL_DMA_ClearFlag_GI3(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_4)
{
/* Reset interrupt pending bits for DMAx Channel4 */
LL_DMA_ClearFlag_GI4(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_5)
{
/* Reset interrupt pending bits for DMAx Channel5 */
LL_DMA_ClearFlag_GI5(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_6)
{
/* Reset interrupt pending bits for DMAx Channel6 */
LL_DMA_ClearFlag_GI6(DMAx);
}
else if (Channel == LL_DMA_CHANNEL_7)
{
/* Reset interrupt pending bits for DMAx Channel7 */
LL_DMA_ClearFlag_GI7(DMAx);
}
else
{
status = ERROR;
}
return status;
}
/**
* @brief Initialize the DMA registers according to the specified parameters in DMA_InitStruct.
* @note To convert DMAx_Channely Instance to DMAx Instance and Channely, use helper macros :
* @arg @ref __LL_DMA_GET_INSTANCE
* @arg @ref __LL_DMA_GET_CHANNEL
* @param DMAx DMAx Instance
* @param Channel This parameter can be one of the following values:
* @arg @ref LL_DMA_CHANNEL_1
* @arg @ref LL_DMA_CHANNEL_2
* @arg @ref LL_DMA_CHANNEL_3
* @arg @ref LL_DMA_CHANNEL_4
* @arg @ref LL_DMA_CHANNEL_5
* @arg @ref LL_DMA_CHANNEL_6
* @arg @ref LL_DMA_CHANNEL_7
* @param DMA_InitStruct pointer to a @ref LL_DMA_InitTypeDef structure.
* @retval An ErrorStatus enumeration value:
* - SUCCESS: DMA registers are initialized
* - ERROR: Not applicable
*/
uint32_t LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Channel, LL_DMA_InitTypeDef *DMA_InitStruct)
{
/* Check the DMA Instance DMAx and Channel parameters*/
assert_param(IS_LL_DMA_ALL_CHANNEL_INSTANCE(DMAx, Channel));
/* Check the DMA parameters from DMA_InitStruct */
assert_param(IS_LL_DMA_DIRECTION(DMA_InitStruct->Direction));
assert_param(IS_LL_DMA_MODE(DMA_InitStruct->Mode));
assert_param(IS_LL_DMA_PERIPHINCMODE(DMA_InitStruct->PeriphOrM2MSrcIncMode));
assert_param(IS_LL_DMA_MEMORYINCMODE(DMA_InitStruct->MemoryOrM2MDstIncMode));
assert_param(IS_LL_DMA_PERIPHDATASIZE(DMA_InitStruct->PeriphOrM2MSrcDataSize));
assert_param(IS_LL_DMA_MEMORYDATASIZE(DMA_InitStruct->MemoryOrM2MDstDataSize));
assert_param(IS_LL_DMA_NBDATA(DMA_InitStruct->NbData));
assert_param(IS_LL_DMA_PRIORITY(DMA_InitStruct->Priority));
/*---------------------------- DMAx CCR Configuration ------------------------
* Configure DMAx_Channely: data transfer direction, data transfer mode,
* peripheral and memory increment mode,
* data size alignment and priority level with parameters :
* - Direction: DMA_CCR_DIR and DMA_CCR_MEM2MEM bits
* - Mode: DMA_CCR_CIRC bit
* - PeriphOrM2MSrcIncMode: DMA_CCR_PINC bit
* - MemoryOrM2MDstIncMode: DMA_CCR_MINC bit
* - PeriphOrM2MSrcDataSize: DMA_CCR_PSIZE[1:0] bits
* - MemoryOrM2MDstDataSize: DMA_CCR_MSIZE[1:0] bits
* - Priority: DMA_CCR_PL[1:0] bits
*/
LL_DMA_ConfigTransfer(DMAx, Channel, DMA_InitStruct->Direction | \
DMA_InitStruct->Mode | \
DMA_InitStruct->PeriphOrM2MSrcIncMode | \
DMA_InitStruct->MemoryOrM2MDstIncMode | \
DMA_InitStruct->PeriphOrM2MSrcDataSize | \
DMA_InitStruct->MemoryOrM2MDstDataSize | \
DMA_InitStruct->Priority);
/*-------------------------- DMAx CMAR Configuration -------------------------
* Configure the memory or destination base address with parameter :
* - MemoryOrM2MDstAddress: DMA_CMAR_MA[31:0] bits
*/
LL_DMA_SetMemoryAddress(DMAx, Channel, DMA_InitStruct->MemoryOrM2MDstAddress);
/*-------------------------- DMAx CPAR Configuration -------------------------
* Configure the peripheral or source base address with parameter :
* - PeriphOrM2MSrcAddress: DMA_CPAR_PA[31:0] bits
*/
LL_DMA_SetPeriphAddress(DMAx, Channel, DMA_InitStruct->PeriphOrM2MSrcAddress);
/*--------------------------- DMAx CNDTR Configuration -----------------------
* Configure the peripheral base address with parameter :
* - NbData: DMA_CNDTR_NDT[15:0] bits
*/
LL_DMA_SetDataLength(DMAx, Channel, DMA_InitStruct->NbData);
return SUCCESS;
}
/**
* @brief Set each @ref LL_DMA_InitTypeDef field to default value.
* @param DMA_InitStruct Pointer to a @ref LL_DMA_InitTypeDef structure.
* @retval None
*/
void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct)
{
/* Set DMA_InitStruct fields to default values */
DMA_InitStruct->PeriphOrM2MSrcAddress = (uint32_t)0x00000000U;
DMA_InitStruct->MemoryOrM2MDstAddress = (uint32_t)0x00000000U;
DMA_InitStruct->Direction = LL_DMA_DIRECTION_PERIPH_TO_MEMORY;
DMA_InitStruct->Mode = LL_DMA_MODE_NORMAL;
DMA_InitStruct->PeriphOrM2MSrcIncMode = LL_DMA_PERIPH_NOINCREMENT;
DMA_InitStruct->MemoryOrM2MDstIncMode = LL_DMA_MEMORY_NOINCREMENT;
DMA_InitStruct->PeriphOrM2MSrcDataSize = LL_DMA_PDATAALIGN_BYTE;
DMA_InitStruct->MemoryOrM2MDstDataSize = LL_DMA_MDATAALIGN_BYTE;
DMA_InitStruct->NbData = (uint32_t)0x00000000U;
DMA_InitStruct->Priority = LL_DMA_PRIORITY_LOW;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#endif /* DMA1 || DMA2 */
/**
* @}
*/
#endif /* USE_FULL_LL_DRIVER */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
the_stack_data/144882.c | /**
* copyright : (C) 2006 by aleal
*/ |
the_stack_data/482157.c | /**
* CVE-2014-4014 Linux Kernel Local Privilege Escalation PoC
*
* Vitaly Nikolenko
* http://hashcrack.org
*
* Usage: ./poc [file_path]
*
* where file_path is the file on which you want to set the sgid bit
*/
#define _GNU_SOURCE
#include <sys/wait.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <limits.h>
#include <string.h>
#include <assert.h>
#define STACK_SIZE (1024 * 1024)
static char child_stack[STACK_SIZE];
struct args {
int pipe_fd[2];
char *file_path;
};
static int child(void *arg) {
struct args *f_args = (struct args *)arg;
char c;
// close stdout
close(f_args->pipe_fd[1]);
assert(read(f_args->pipe_fd[0], &c, 1) == 0);
// set the setgid bit
chmod(f_args->file_path, S_ISGID|S_IRUSR|S_IWUSR|S_IRGRP|S_IXGRP|S_IXUSR);
return 0;
}
int main(int argc, char *argv[]) {
int fd;
pid_t pid;
char mapping[1024];
char map_file[PATH_MAX];
struct args f_args;
assert(argc == 2);
f_args.file_path = argv[1];
// create a pipe for synching the child and parent
assert(pipe(f_args.pipe_fd) != -1);
pid = clone(child, child_stack + STACK_SIZE, CLONE_NEWUSER | SIGCHLD, &f_args);
assert(pid != -1);
// get the current uid outside the namespace
snprintf(mapping, 1024, "0 %d 1\n", getuid());
// update uid and gid maps in the child
snprintf(map_file, PATH_MAX, "/proc/%ld/uid_map", (long) pid);
fd = open(map_file, O_RDWR); assert(fd != -1);
assert(write(fd, mapping, strlen(mapping)) == strlen(mapping));
close(f_args.pipe_fd[1]);
assert (waitpid(pid, NULL, 0) != -1);
}
|
the_stack_data/24771.c | #include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
printf("A simple program that display his name and PID\n");
if (argc != 1)
return 1;
printf("%s : %d\n", argv[0]+2, getpid());
return 0;
} |
the_stack_data/930269.c | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
unsigned int seed;
time_t now = time(NULL);
printf("Current time in seconds is %ld\n", now);
srand(now);
for(unsigned int i = 1; i <= 10; i++)
{
printf("%10d", 1 + (rand() % 6));
if(i % 5 == 0)
{
printf("\n");
}
}
}
|
the_stack_data/1044028.c | #include<stdio.h>
#include<string.h>
#define MAX 1000 // 大数的最大位数
/*
大数乘法
参数:
num1为第一个因数,用字符数组保存
num2为第二个因数
sum数组保存相乘的结果 即:num1*num2=sum
返回值:返回数组sum的有效长度,即计算结果的位数
*/
int Multiplication(char num1[],char num2[], int sum[])
{
int i, j, len, len1, len2;
int a[MAX+10] = {0};
int b[MAX+10] = {0};
int c[MAX*2+10] = {0};
len1 = strlen(num1);
for(j = 0, i = len1-1; i >= 0; i--) //把数字字符转换为整型数
a[j++] = num1[i]-'0';
len2 = strlen(num2);
for(j = 0, i = len2-1; i >= 0; i--)
b[j++] = num2[i]-'0';
for(i = 0; i < len2; i++)//用第二个数乘以第一个数,每次一位
{
for(j = 0; j < len1; j++)
{
c[i+j] += b[i] * a[j]; //先乘起来,后面统一进位
}
}
for(i=0; i<MAX*2; i++) //循环统一处理进位问题
{
if(c[i]>=10)
{
c[i+1]+=c[i]/10;
c[i]%=10;
}
}
for(i = MAX*2; c[i]==0 && i>=0; i--); //跳过高位的0
len = i+1; // 记录结果的长度
for(; i>=0; i--)
sum[i]=c[i];
return len;
}
int main()
{
int i, len;
int sum[MAX*2+10] = {0}; // 存放计算的结果,低位在前,高位在后,即sum[0]是低位
char num1[] = "123456789123456789"; // 第一个大数
char num2[] = "123456789123456789"; // 第二个大数
len = Multiplication(num1, num2, sum);
// 输出结果
printf("%s\n *\n%s\n =\n", num1, num2);
for(i = len-1; i>=0; i--)
printf("%d", sum[i]);
printf("\n");
return 0;
}
|
the_stack_data/150140317.c | /* 1024-point complex FFT (radix-2, in-place, decimation-in-time) */
#define NPOINTS 1024
#define NSTAGES 10
float data_real[1024];
float data_imag[1024];
float coef_real[1024];
float coef_imag[1024];
main()
{
void fft();
int i;
int j=0;
input_dsp (data_real, NPOINTS, 0);
/* input_dsp (data_imag, NPOINTS, 0); */
for (i=0 ; i<256 ; i++){
*(data_imag + j) = 1;
*(coef_real + j) = 1;
*(coef_imag + j) = 1;
j++;
}
fft(data_real, data_imag, coef_real, coef_imag);
output_dsp (data_real, NPOINTS, 0);
output_dsp (data_imag, NPOINTS, 0);
output_dsp (coef_real, NPOINTS, 0);
output_dsp (coef_imag, NPOINTS, 0);
}
void fft(data_real, data_imag, coef_real, coef_imag)
float *data_real; /* pointer to real data points */
float *data_imag; /* pointer to imaginary data points */
float *coef_real; /* pointer to real coefficient points */
float *coef_imag; /* pointer to imaginary coefficient points */
{
int i;
int j;
int k;
float *A_real;
float *A_imag;
float *B_real;
float *B_imag;
float temp_real;
float temp_imag;
float Ar;
float Ai;
float Br;
float Bi;
float Wr;
float Wi;
int groupsPerStage = 1;
int buttersPerGroup = NPOINTS / 2;
for (i = 0; i < NSTAGES; i++) {
A_real = data_real;
A_imag = data_imag;
B_real = data_real;
B_real += buttersPerGroup;
B_imag = data_imag;
B_imag += buttersPerGroup;
j = 0;
do {
Wr = *coef_real++;
Wi = *coef_imag++;
k = 0;
do {
Ar = *A_real;
Ai = *A_imag;
Br = *B_real;
Bi = *B_imag;
temp_real = Wr * Br - Wi * Bi;
temp_imag = Wi * Br + Wr * Bi;
*A_real++ = Ar + temp_real;
*B_real++ = Ar - temp_real;
*A_imag++ = Ai + temp_imag;
*B_imag++ = Ai - temp_imag;
k++;
} while (k < buttersPerGroup);
A_real += buttersPerGroup;
A_imag += buttersPerGroup;
B_real += buttersPerGroup;
B_imag += buttersPerGroup;
j++;
} while (j < groupsPerStage);
groupsPerStage <<= 1;
buttersPerGroup >>= 1;
}
}
|
the_stack_data/115742.c | // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
__attribute__((overloadable)) void f1(a) int a; {
}
void f2(a) int a; {
}
// CHECK: !DISubprogram(name: "f1", linkageName: "_Z2f1i"
// CHECK: !DISubprogram(name: "f2", scope: {{.*}}, spFlags: DISPFlagDefinition,
|
the_stack_data/132004.c | /*numPass=2, numTotal=5
Verdict:WRONG_ANSWER, Visibility:1, Input:"1 5 7 2", ExpOutput:"The second largest number is 5", Output:"The second largest number is 1"
Verdict:ACCEPTED, Visibility:1, Input:"8 6 4 2", ExpOutput:"The second largest number is 6", Output:"The second largest number is 6"
Verdict:WRONG_ANSWER, Visibility:0, Input:"1 10 15 3", ExpOutput:"The second largest number is 10", Output:"The second largest number is 1"
Verdict:WRONG_ANSWER, Visibility:0, Input:"1 3 3 2 ", ExpOutput:"The second largest number is 3", Output:"The second largest number is 1"
Verdict:ACCEPTED, Visibility:0, Input:"1 1 1 2", ExpOutput:"The second largest number is 1", Output:"The second largest number is 1"
*/
#include<stdio.h>
int main()
{ int a,b,c,d;
scanf("%d %d %d %d",&a,&b,&c,&d);//input the numbers
int g1=a,g2=c,s;
if(b>a)
{g1=b;
b=a;
}//g1 stores greatest and b stores lowest among a and b
if(d>g2)
{g2=d;
d=c;
}//g2 stores greatest and d stores lowest among c and d
if((g1>g2)&&(b>g2))
s=b;
printf("The second largest number is %d",s);
return 0;
} |
the_stack_data/6389028.c | #include<stdio.h>
int main() {
return 0;
} |
the_stack_data/170451812.c | #include <stdio.h>
#include <stdlib.h>
int main(){
int N; //Number of elements in the array
printf("\n Enter the number of elements in the array\n");
scanf("%d",&N);
int *arr=malloc(N*sizeof(*arr)); //Dynamic creation of an Integer array of Size N
printf("\n Enter the elemnts of the array\n");
for(int i=0;i<N;i++){
scanf("%d",&arr[i]); //Inputting the elements of array
}
printf("\n Original Array\n"); //Printing the original array
for(int i=0;i<N;i++){
printf("%d ",arr[i]);
}
int temp; //Temporary variable used for swapping later
for(int i=0;i<N-1;i++){ //Sorting process begins
for(int j=0;j<N-i-1;j++){
if(arr[j]>arr[j+1]){ //Checking if a number at the previous index is greater than the number at its next,if so, swapping takes place
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
printf("\n Sorted Array\n"); //Printing sorted array
for(int i=0;i<N;i++){
printf("%d ",arr[i]);
}
}
|
the_stack_data/62636657.c | #include<stdio.h>
int numero_incrementado(int *p,int num){
int num_incre = num + *p;
return num_incre;
}
int main(void){
int numero, n;
scanf("%d%d",&numero,&n);
int *pN = &n;
int numInc = numero_incrementado(pN,numero);
printf("%d\n",numInc);
return 0;
} |
the_stack_data/116999.c | #include <stdio.h>
#include <string.h>
#include <assert.h>
int main() {
char buffer[256];
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
for (int k = 0; k < 35; k++) {
for (int t = 0; t < 256; t++) buffer[t] = t;
char *dest = buffer + i + 128;
char *src = buffer + j;
// printf("%d, %d, %d\n", i, j, k);
assert(memcpy(dest, src, k) == dest);
assert(memcmp(dest, src, k) == 0);
}
}
}
printf("ok.\n");
return 1;
}
|
the_stack_data/170453541.c | /*
* Created by gt on 10/21/21 - 4:32 PM.
* Copyright (c) 2021 GTXC. All rights reserved.
*/
#include <stdio.h>
struct packed_struct {
int count;
char c;
unsigned int : 3; // unnamed bits, for padding
unsigned int f1: 1;
unsigned int f2: 1;
unsigned int f3: 1;
unsigned int type: 8;
unsigned int index: 18;
};
int main() {
struct packed_struct ps = {17, 'g', .f1 = 1,.f2 = 0,.f3 = 1,.type = 2, .index = 262143};
printf("sizeof ps: %li\n", sizeof ps);
int count = ps.count;
char c = ps.c;
unsigned int f1 = ps.f1;
unsigned int f2 = ps.f2;
unsigned int f3 = ps.f3;
unsigned int type = ps.type;
unsigned int index = ps.index;
printf("count: %i\n", count);
printf("c: %c\n", c);
printf("f1: %u\n", f1);
printf("f2: %u\n", f2);
printf("f3: %u\n", f3);
printf("type: %u\n", type);
printf("index: %u\n", index);
return 0;
}
|
the_stack_data/25137930.c | #include <stdio.h>
#include <stdlib.h>
/*
* Count the number of times a depth measurement increases from the previous measurement. (There is no measurement before the first measurement.) In the example above, the changes are as follows:
*
* 199 (N/A - no previous measurement)
* 200 (increased)
* 208 (increased)
* 210 (increased)
* 200 (decreased)
* 207 (increased)
* 240 (increased)
* 269 (increased)
* 260 (decreased)
* 263 (increased)
*
* In this example, there are 7 measurements that are larger than the previous measurement.
*
* How many measurements are larger than the previous measurement?
**/
// path to the input file
const char INPUT_PATH[] = "input";
int main() {
FILE* fp = fopen(INPUT_PATH, "r");
if (fp == NULL) return 1;
// store the contents of every line in the input
char buffer[10];
int prev = -1;
int increments = 0;
while (fgets(buffer, 10, fp)) {
int val = atoi(buffer);
// if prev is -1, that means this is the first measurement
if (prev != -1 && val > prev) increments++;
prev = val;
}
printf("number of increments: %d\n", increments);
fclose(fp);
return 0;
}
|
the_stack_data/69726.c | int test() {
return 12;
}
int main() {
int x = 4;
while(x < 10) {
x += test();
x++;
x -= 12;
}
return 0;
}
|
the_stack_data/67326235.c | #include <stdio.h>
void charfunc(char a)
{
printf("char: %c\n", a);
}
void intfunc(int a)
{
printf("int: %d\n", a);
}
void floatfunc(float a)
{
printf("float: %f\n", a);
}
void main() {
charfunc('a');
charfunc(98);
charfunc(99.0);
intfunc('a');
intfunc(98);
intfunc(99.0);
floatfunc('a');
floatfunc(98);
floatfunc(99.0);
printf("%c %d %f\n", 'a', 'b', (double)'c');
printf("%c %d %f\n", 97, 98, (double)99);
printf("%c %d %f\n", (int)97.0, (int)98.0, 99.0);
char b = 97;
char c = 97.0;
printf("%d %d\n", b, c);
int d = 'a';
int e = 97.0;
printf("%d %d\n", d, e);
float f = 'a';
float g = 97;
printf("%f %f\n", f, g);
}
|
the_stack_data/89260.c | #include <stdlib.h>
int f(void)
{
return 42;
}
int g(void) __attribute((alias("f")));
int main(void)
{
if (f == g) return g() - 42;
else abort();
}
|
the_stack_data/61074226.c | /*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <signal.h>
/* this function is called from the ARM assembly setjmp fragments */
int
sigblock(int mask)
{
int n;
union {
int the_mask;
sigset_t the_sigset;
} in, out;
in.the_mask = mask;
n = sigprocmask(SIG_BLOCK, &in.the_sigset, &out.the_sigset);
if (n)
return n;
return out.the_mask;
}
|
the_stack_data/147659.c | #include<stdio.h>
#include<stdlib.h>
int main(){
int *p =(int*)calloc(sizeof(int),5);
for(int i=0;i<5;i++){
p[i]=i+2;
}
for(int k=0;k<5;k++){
printf("%d\n",p[k]);
}
return 0;
}
|
the_stack_data/741127.c | /* Taxonomy Classification: 0000000000000143000200 */
/*
* WRITE/READ 0 write
* WHICH BOUND 0 upper
* DATA TYPE 0 char
* MEMORY LOCATION 0 stack
* SCOPE 0 same
* CONTAINER 0 no
* POINTER 0 no
* INDEX COMPLEXITY 0 constant
* ADDRESS COMPLEXITY 0 constant
* LENGTH COMPLEXITY 0 N/A
* ADDRESS ALIAS 0 none
* INDEX ALIAS 0 none
* LOCAL CONTROL FLOW 0 none
* SECONDARY CONTROL FLOW 1 if
* LOOP STRUCTURE 4 non-standard for
* LOOP COMPLEXITY 3 two
* ASYNCHRONY 0 no
* TAINT 0 no
* RUNTIME ENV. DEPENDENCE 0 no
* MAGNITUDE 2 8 bytes
* CONTINUOUS/DISCRETE 0 discrete
* SIGNEDNESS 0 no
*/
/*
Copyright 2005 Massachusetts Institute of Technology
All rights reserved.
Redistribution and use of software in source and binary forms, with or without
modification, are permitted provided that the following conditions are met.
- Redistributions of source code must retain the above copyright notice,
this set of conditions and the disclaimer below.
- Redistributions in binary form must reproduce the copyright notice, this
set of conditions, and the disclaimer below in the documentation and/or
other materials provided with the distribution.
- Neither the name of the Massachusetts Institute of Technology nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS".
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
int main(int argc, char *argv[])
{
int test_value;
int inc_value;
int loop_counter;
char buf[10];
test_value = 17;
inc_value = 17 - (17 - 1);
for(loop_counter = 0; ; loop_counter += inc_value)
{
if (loop_counter > test_value) break;
/* BAD */
buf[17] = 'A';
}
return 0;
}
|
the_stack_data/175143123.c | /*@-booltype Kzam@*/
typedef int Kzam;
enum { true, false } ; /* changed to be consistent with ISO true/false */
int main() {
Kzam b = true;
Kzam b1 = b;
b = true;
b = b1;
b = 12; /* Assignment of int to Kzam: b = 12 */
b = true && false;
b = b && false;
b = false && b;
if ((b && false) == 0)
return(0);
return(0);
}
|
the_stack_data/237643124.c | void ctridiag(double *a, double *b, double *c, double *x, int n){
// Solve a tridiagonal system inplace.
// Initialize temporary variable and index.
int i;
double temp;
// Perform necessary computation in place.
// Initial steps
c[0] = c[0] / b[0];
x[0] = x[0] / b[0];
// Iterate down arrays.
for (i=0; i<n-2; i++){
temp = 1.0 / (b[i+1] - a[i] * c[i]);
c[i+1] = c[i+1] * temp;
x[i+1] = (x[i+1] - a[i] * x[i]) * temp;
}
// Perform last step.
x[n-1] = (x[n-1] - a[n-2] * x[n-2]) / (b[n-1] - a[n-2] * c[n-2]);
// Perform back substitution to finish constructing the solution.
for (i=n-2; i>-1; i--){
x[i] = x[i] - c[i] * x[i+1];
}
}
|
the_stack_data/178264797.c | #include <stdio.h>
int main() {
int i, arr[50], sum, num;
printf("\nEnter no of elements :");
scanf("%d", &num);
//Reading values into Array
printf("\nEnter the values :");
for (i = 0; i < num; i++)
scanf("%d", &arr[i]);
//Computation of total
sum = 0;
for (i = 0; i < num; i++)
sum = sum + arr[i];
//Printing of all elements of array
for (i = 0; i < num; i++)
printf("\na[%d]=%d", i, arr[i]);
//Printing of total
printf("\nSum=%d", sum);
return (0);
}
|
the_stack_data/89199098.c | #include<stdio.h>
#include<limits.h>
int a,b,u,v,n,i,j,ne=1;
int visited[10]={0}, min, mincost=0, cost[10][10];
void main()
{
printf("Enter the number of nodes: ");
scanf("%d",&n);
printf("Enter the adjacency matrix: \n");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
scanf("%d",&cost[i][j]);
if(cost[i][j]==0)
cost[i][j]=INT_MAX;
}
visited[0]=1;
printf("\n");
while(ne<n)
{
for(i=0, min=INT_MAX; i<n; i++)
for(j=0; j<n; j++)
if(cost[i][j]<min)
if(visited[i]!=0)
{
min=cost[i][j];
a=u=i;
b=v=j;
}
if(visited[u]==0 || visited[v]==0)
{
printf("\nEdge %d [%d %d], Cost = %d",ne++,a+1,b+1,min);
mincost+=min;
visited[b]=1;
}
cost[a][b]=cost[b][a]=INT_MAX;
}
printf("\n\nMinimun Cost = %d ", mincost);
} |
the_stack_data/182841.c | #include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
int user_id, return_code;
user_id = geteuid();
if (user_id != 0) {
fprintf(stderr, "Not enough privileges to run this program.\n");
exit(1);
}
return_code = system("iptables -P INPUT ACCEPT; iptables -P OUTPUT ACCEPT; iptables -P FORWARD ACCEPT; iptables -F");
if ( return_code != 0 ) {
fprintf(stdout, "ERROR: Could not free the iptables rules.\n");
exit(1);
}
fprintf(stdout, "IPTables ruleset was successfully cleansed.\n");
return 0;
}
|
the_stack_data/182954006.c | #include<stdio.h>
#include<inttypes.h>
//Preprocessor directives
#define WORD uint32_t// possibly a problem as machine may be little endian
#define PF PRIX32//print format for the word - 32bit hex
#define W 32//length of a word
#define BYTE uint8_t//
//SHA256 works on blocks of 512 bits
union Block{//all memory variables stored in same location
BYTE bytes[64];//8 * 64 = 512- dealing with blocks as bytes
WORD words[16];//32 x 16 = 512 - dealing with blocks as words
uint64_t sixf[8];// 8 * 64 - dealing with the last 64 bits of last block
};
//enum for keeping track of where we are with the input message/padding, like a flag
enum Status{
READ, PAD, END
};
//loop through the preprocesses blocks - Returns 1 if it created a new block from original meassage or padding.
//Returns 0 if all padded message has already been consumed. 0 returns out of the loop.
int next_block(FILE *f, union Block *B, enum Status *S, uint64_t *nobits){
//no of bytes to read
size_t nobytes;
if(*S == END){
return 0;
} else if(*S == READ){
//Try to read 64 bytes from the input file
//fread is a more accurate way to check if the end of file has been reached.in pref to feof
nobytes = fread(B->bytes, 1, 64, f);//B is now a pointer to a union block
//Calculate the total bits read so far.
*nobits = *nobits + (8 * nobytes);//update nobits
/* *nobits = *nobits + (8 * nobytes);
on lhs of assignment *nobits means update whatever is at the address of nobits - find the address and update whatever is there
on rhs of assignment *nobits means whatever nobits points at and find its value - get the value
*/
//512 bits -> 512 - 65 same as 64 bytes -> 55 bytes
//enough room for padding
if(nobytes == 64){//if read 64 bytes - return 1
// this happens when we can read 64 bytes from f.
return 1;
} else if(nobytes < 56){
//Append a 1 bit(and seven 0 bits to make full byte)
//this happens when there is enough room for all the padding.
B->bytes[nobytes] = 0x80;//In bits: 10000000
//Append enough 0 bits, leaving 64 at the end
for(nobytes++;nobytes < 56; nobytes++){
B->bytes[nobytes]= 0x00;//in bits: 0000000
}
//Append length of original input (CHECK ENDIANESS)
B->sixf[7] = *nobits;
//say this is the last block
*S = END;
} else{
//Gotten to end of input message - not enough room in this block for all the padding
//Append a 1 bit(and 7 0 bits to make a full byte).
B->bytes[nobytes++] = 0x80;
//Append 0 bits.
for(nobytes++; nobytes < 64; nobytes++){
B->bytes[nobytes]= 0x00;//in bits: 0000000
}
// Change to staus to PAD
*S = PAD;
}
} else if(*S == PAD){
nobytes = 0;
//Append 0 bits
for(nobytes = 0; nobytes < 56; nobytes++){
B->bytes[nobytes]= 0x00;//in bits: 0000000
}
//Append nobits as an integer. CHECK ENDIAN
B->sixf[7] = *nobits;
//Change the status to END
*S = END;
}
return 1;
}
//on cli man 3 fopen, 3 means give c function fopen. man = manual page. Q to get out of a man pag
int main(int argc, char *argv[]){
//Remember to error check, if no file etc. Or if file doesn't open properly
//read docs about different possible errors
int i;
//the current block
union Block B;
//total number of bits read
uint64_t nobits =0;
//current status of reading input
enum Status S = READ;
//* = pointer, File pointer for reading
FILE *f;
//open file from cli for reading
f = fopen(argv[1], "r"); // path and mode
//number of bytes to read
//loop through the preprocesses blocks
while (next_block(f, &B, &S, &nobits))
{
//print the 16 32 bit words
for(i=0; i < 16; i++){
printf("%08" PF " ", B.words[i]);
}
printf("\n");
}
fclose(f);//close file when finished
printf("Total bits read %d. \n", nobits);
return 0;
}
//padding, look over it in documentation, look up union vs a struct. |
the_stack_data/43887995.c | /**
* @file TRNG_Characterization.c
*
* This file defines the data collection function for characterization of the
* TRNG.
*/
/****************************************************************************
* The confidential and proprietary information contained in this file may *
* only be used by a person authorised under and to the extent permitted *
* by a subsisting licensing agreement from Arm Limited (or its affiliates). *
* (C) COPYRIGHT [2001-2019] Arm Limited (or its affiliates). *
* ALL RIGHTS RESERVED *
* This entire notice must be reproduced on all copies of this file *
* and copies of this file may only be made by a person if such person is *
* permitted to do so under the terms of a subsisting license agreement *
* from Arm Limited (or its affiliates). *
*****************************************************************************/
/*
* Revision history:
* 1.0 (16-Mar-2010): Initial revision
* 1.1 (11-Jul-2010): Added extra metadata to output format
* 1.2 (18-Jul-2010): Fixed reset sequence
* Changed sampling rate metadata to 32-bit
* 1.3 (09-Jun-2011): Added 8 bit processor support
* 1.4 (07-Feb-2013): Only 192bit EHR support
* 1.5 (03-Mar-2013): Replace isSlowMode with TRNGMode
* 1.6 (06-Mar-2013): Support both DxTRNG and CryptoCell4.4
* 1.7 (14-May-2015): Support for 800-90B
* 1.8 (07-Oct-2015): Renamed DX to CC
* 1.9 (29-Oct-2019): Replace hardcoded numbers with meaningful Macros;
* Add comments to improve the readbility;
* TRNGMode in header changes from[31:31] to [31:30];
* Change dataBuff_ptr to a callback function
*/
/* RNG module registers and value defination */
#define HW_RNG_ISR_REG_ADDR 0x104UL
#define HW_RNG_ISR_REG_EHR_VALID 0x1
#define HW_RNG_ISR_REG_AUTOCORR_ERR 0x2
#define HW_RNG_ICR_REG_ADDR 0x108UL
#define HW_TRNG_CONFIG_REG_ADDR 0x10CUL
#define HW_TRNG_VALID_REG_ADDR 0x110UL
#define HW_TRNG_VALID_REG_EHR_NOT_READY 0x0
#define HW_EHR_DATA_ADDR_0_REG_ADDR 0x114UL
#define HW_RND_SOURCE_ENABLE_REG_ADDR 0x12CUL
#define HW_RND_SOURCE_ENABLE_REG_SET 0x1
#define HW_RND_SOURCE_ENABLE_REG_CLR 0x0
#define HW_SAMPLE_CNT1_REG_ADDR 0x130UL
#define HW_TRNG_DEBUG_CONTROL_REG_ADDR 0x138UL
#define HW_TRNG_DEBUG_CONTROL_REG_VNC_BYPASS 0x2
#define HW_TRNG_DEBUG_CONTROL_REG_CRNGT_BYPASS 0x4
#define HW_TRNG_DEBUG_CONTROL_REG_AUTOCORR_BYPASS 0x8
#define HW_TRNG_DEBUG_CONTROL_REG_FAST (HW_TRNG_DEBUG_CONTROL_REG_VNC_BYPASS | \
HW_TRNG_DEBUG_CONTROL_REG_CRNGT_BYPASS | \
HW_TRNG_DEBUG_CONTROL_REG_AUTOCORR_BYPASS)
#define HW_TRNG_DEBUG_CONTROL_REG_FE 0x0
#define HW_TRNG_DEBUG_CONTROL_REG_80090B (HW_TRNG_DEBUG_CONTROL_REG_VNC_BYPASS | \
HW_TRNG_DEBUG_CONTROL_REG_AUTOCORR_BYPASS)
#define HW_RNG_SW_RESET_REG_ADDR 0x140UL
#define HW_RNG_SW_RESET_REG_SET 0x1
#define HW_RNG_VERSION_REG_ADDR 0x1C0UL
#define HW_RNG_CLK_ENABLE_REG_ADDR 0x1C4UL
#define HW_RNG_CLK_ENABLE_REG_SET 0x1
/*
* the output format defination
* the output buffer consists of header + sample bits + footer
* header: 4 words.
* word0/3=0xAABBCCDD
* word1=TRNGmode[31:30]+roscLen[25:24]+simpleLen[23:0]
* word2=sampleCount
* footer: 3 words.
* wordn/n+2=0xDDCCBBAA
* wordn+1=error flags
*/
#define OUTPUT_FORMAT_HEADER_LENGTH_IN_WORDS 4
#define OUTPUT_FORMAT_FOOTER_LENGTH_IN_WORDS 3
#define OUTPUT_FORMAT_OVERHEAD_LENGTH_IN_WORDS (OUTPUT_FORMAT_HEADER_LENGTH_IN_WORDS + \
OUTPUT_FORMAT_FOOTER_LENGTH_IN_WORDS)
#define OUTPUT_FORMAT_HEADER_SIG_VAL 0xAABBCCDD
#define OUTPUT_FORMAT_FOOTER_SIG_VAL 0xDDCCBBAA
#define OUTPUT_FORMAT_TRNG_MODE_SHIFT 24
#define OUTPUT_FORMAT_ROSC_LEN_SHIFT 30
#define OUTPUT_FORMAT_HEADER_LENGTH_IN_BYTES (4*sizeof(uint32_t))
#define OUTPUT_FORMAT_FOOTER_LENGTH_IN_BYTES (3*sizeof(uint32_t))
/* TRNG mode defination */
#define TRNG_MODE_FAST 0
#define TRNG_MODE_FE 1
#define TRNG_MODE_80090B 2
/* error code defination */
#define CC_TRNG_INVALID_PARAM_TRNG_MODE (-1)
#define CC_TRNG_INVALID_PARAM_ROSC_LEN (-2)
#define CC_TRNG_INVALID_PARAM_SAMPLE_CNT (-3)
#define CC_TRNG_INVALID_PARAM_BUF_SIZE (-4)
#define CC_TRNG_INVALID_PARAM_NULL_PTR (-5)
#define CC_TRNG_SAMPLE_LOST 0x1
/* other size and length defination */
#define EHR_SIZE_IN_WORDS 6
#define EHR_SIZE_IN_BYTES (6*sizeof(uint32_t))
#define MAX_BUFFER_LENGTH (1<<24)
#define MIN_BUFFER_LENGTH ((OUTPUT_FORMAT_OVERHEAD_LENGTH_IN_WORDS + \
EHR_SIZE_IN_WORDS) * sizeof(uint32_t))
#define DATA_COLLECTION_START_INDEX 0
#define TRNG_ROSC_MAX_LENGTH 3
#define TRNG_BUFFER_SIZE_IN_WORDS 6
#define MINIUM_SAMPLE_CNT 1
#ifndef NULL
#define NULL 0
#endif
/* data type and operation defination */
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
/*
* callback function type define
* this function is called by CC_TST_TRNG() to prcess the data generated
* or collected by CC_TST_TRNG()
* @outputSize the size of the data
* @outputBuffer buffer for the generated or collected data
*/
typedef void (*callback_TRNG)(uint32_t outputSize, uint8_t *outputBuffer);
/* report any compile errors in the next two lines to Arm */
typedef int __testCharSize[((uint8_t)~0)==255?1:-1];
typedef int __testUint32Size[(sizeof(uint32_t)==4)?1:-1];
#define CC_GEN_WriteRegister(base_addr, reg_addr, val) \
do { ((volatile uint32_t*)(base_addr))[(reg_addr) / sizeof(uint32_t)] = (uint32_t)(val); } while(0)
#define CC_GEN_ReadRegister(base_addr, reg_addr) ((volatile uint32_t*)(base_addr))[(reg_addr) / sizeof(uint32_t)]
/*
* collect TRNG output for characterization
*
* @regBaseAddress: base address in system memory map of TRNG registers
* @TRNGMode: base iteration- TRNG_MODE_FAST
* 1st iteration - TRNG_MODE_FAST
* 2nd iteration - TRNG_MODE_FE compliant with BSI AIS-31
* TRNG_MODE_80090B compliant with NIST SP 800-90B
* @roscLength: ring oscillator length (0 to 3)
* @sampleCount: ring oscillator sample counter value
* @buffSize: size of buffer dataBuff_ptr; must be between 52 and 2^24 bytes;
* the buffsize should include the header+footer+sample_bits
* buffsize >= header(16 bytes)+sample_bits/8 (bytes)+footer(12 bytes)
* e.g. if 100Mbits data need to be collected, the mininal bufferSize should be
* 12,500,000+28=12,500,028bytes. For safe, the buffSize can be 12,501,000 bytes
* @callbackFunc: callback function to process the real output data
* This callbackFunc will be called many times in CC_TST_TRNG
* First, after 16bytes header is generated, it is called once
* Then, it is be called repeatedly when the 24bytes EHR registers are full
* Finally, it is called after the 12bytes footer is generated
* @return 0 on succeeds. non-zero value on failure.
*/
int CC_TST_TRNG( unsigned long regBaseAddress,
uint32_t TRNGMode,
uint32_t roscLength,
uint32_t sampleCount,
uint32_t buffSize,
callback_TRNG callbackFunc)
{
/* LOCAL DEFINATIONS AND INITIALIZATIONS*/
/*return value*/
uint32_t Error = 0;
/* loop variable */
uint32_t i = 0;
uint32_t j = 0;
/* the number of full blocks needed */
uint32_t NumOfBlocks = 0;
/* hardware parameters */
uint32_t EhrSizeInWords = EHR_SIZE_IN_WORDS;
uint32_t tmpSampleCnt = 0;
uint32_t dataArray[TRNG_BUFFER_SIZE_IN_WORDS] = {0};
uint32_t *dataBuff_ptr = dataArray;
/* FUNCTION LOGIC */
/* ............... validate inputs .................................... */
/* -------------------------------------------------------------------- */
if (TRNGMode > TRNG_MODE_80090B)
{
return CC_TRNG_INVALID_PARAM_TRNG_MODE;
}
if (roscLength > TRNG_ROSC_MAX_LENGTH)
{
return CC_TRNG_INVALID_PARAM_ROSC_LEN;
}
if (sampleCount < MINIUM_SAMPLE_CNT)
{
return CC_TRNG_INVALID_PARAM_SAMPLE_CNT;
}
if ((buffSize < MIN_BUFFER_LENGTH) || (buffSize>= MAX_BUFFER_LENGTH))
{
return CC_TRNG_INVALID_PARAM_BUF_SIZE;
}
if (NULL == callbackFunc)
{
return CC_TRNG_INVALID_PARAM_NULL_PTR;
}
/* ........... initializing the hardware .............................. */
/* -------------------------------------------------------------------- */
/* reset the RNG block */
CC_GEN_WriteRegister(regBaseAddress, HW_RNG_SW_RESET_REG_ADDR, HW_RNG_SW_RESET_REG_SET);
/* enable RNG clock and set sample counter value untile it is set correctly*/
do
{
/* enable the HW RNG clock */
CC_GEN_WriteRegister(regBaseAddress, HW_RNG_CLK_ENABLE_REG_ADDR, HW_RNG_CLK_ENABLE_REG_SET);
/* set sample counter value*/
CC_GEN_WriteRegister(regBaseAddress, HW_SAMPLE_CNT1_REG_ADDR, sampleCount);
/*read back sample counter value*/
tmpSampleCnt = CC_GEN_ReadRegister(regBaseAddress, HW_SAMPLE_CNT1_REG_ADDR);
}while (tmpSampleCnt != sampleCount); /* wait until the sample counter is set correctly*/
/* set RNG rosc Length */
CC_GEN_WriteRegister(regBaseAddress, HW_TRNG_CONFIG_REG_ADDR, roscLength);
/* configure TRNG debug control register based on different mode. */
if (TRNGMode == TRNG_MODE_FAST)
{
/* fast TRNG: bypass VNC, CRNGT and auto correlate, activate none. */
CC_GEN_WriteRegister(regBaseAddress, HW_TRNG_DEBUG_CONTROL_REG_ADDR , HW_TRNG_DEBUG_CONTROL_REG_FAST);
}
else if (TRNGMode == TRNG_MODE_FE)
{
/* FE TRNG: bypass none, activate all */
CC_GEN_WriteRegister(regBaseAddress, HW_TRNG_DEBUG_CONTROL_REG_ADDR , HW_TRNG_DEBUG_CONTROL_REG_FE);
}
else if (TRNGMode == TRNG_MODE_80090B)
{
/* 800-90B TRNG: bypass VNC and auto correlate, activate CRNGT */
CC_GEN_WriteRegister(regBaseAddress, HW_TRNG_DEBUG_CONTROL_REG_ADDR , HW_TRNG_DEBUG_CONTROL_REG_80090B);
}
/* enable the RND source */
CC_GEN_WriteRegister(regBaseAddress, HW_RND_SOURCE_ENABLE_REG_ADDR, HW_RND_SOURCE_ENABLE_REG_SET);
/* ........... executing the RND operation ............................ */
/* -------------------------------------------------------------------- */
/* write header into buffer */
*(dataBuff_ptr++) = OUTPUT_FORMAT_HEADER_SIG_VAL;
*(dataBuff_ptr++) = (TRNGMode << OUTPUT_FORMAT_ROSC_LEN_SHIFT) |
(roscLength << OUTPUT_FORMAT_TRNG_MODE_SHIFT) |
buffSize;
*(dataBuff_ptr++) = sampleCount;
*(dataBuff_ptr++) = OUTPUT_FORMAT_HEADER_SIG_VAL;
callbackFunc(OUTPUT_FORMAT_HEADER_LENGTH_IN_BYTES, (uint8_t *)dataArray);
dataBuff_ptr = dataArray;
/* calculate the number of full blocks needed */
NumOfBlocks = (buffSize/sizeof(uint32_t) - OUTPUT_FORMAT_OVERHEAD_LENGTH_IN_WORDS) / EhrSizeInWords;
/* fill the Output buffer with up to full blocks */
/* BEGIN TIMING: start time measurement at this point */
for (i = 0; i < NumOfBlocks; i++)
{
uint32_t valid_at_start, valid;
/*
* TRNG data collecting must be continuous.
* verification methodology:
* 1) initial state detection is vaild_at_start == HW_TRNG_VALID_REG_EHR_NOT_READY
* 2) proceed only after HW_RNG_ISR_REG_EHR_VALID bit changed from 0 to 1
* (that means EHR data is ready for reading)
*/
valid_at_start = CC_GEN_ReadRegister(regBaseAddress, HW_TRNG_VALID_REG_ADDR);
valid = valid_at_start;
/*
* wait for EHR valid. ISR_REG indicates whether EHR valid or any error detected.
* bit[0]-EHR_VALID, bit[1]-AUTOCORR_ERR, bit[2]-CRNGT_ERR, bit[3]-VN_ERR
*/
while ((valid & (HW_RNG_ISR_REG_EHR_VALID|HW_RNG_ISR_REG_AUTOCORR_ERR)) == 0x0)
{
valid = CC_GEN_ReadRegister(regBaseAddress, HW_RNG_ISR_REG_ADDR);
}
/*
* after EHR data is ready, first check any error detected
* different bit in variable Error indicates different error
* Error bit[0] samples were lost during collection.
* Error bit[1] autocorrelation error. corresponding to ISR_REG[1].
* this error will cause TRNG cease to function until next reset
* Error bit[2] CRNGT error. corresponding to ISR_REG[2].
* This error occurs when 2 consecutive blocks of 16 collected bits are equal.
* Error bit[3] Von Neumann error. corresponding to ISR_REG[3].
* this error occurs if 32 consecutive collected bits are identical.
*/
/* if it is not the first interation, valid_at_start must be not ready. otherwise it means samples were lost */
if ((valid_at_start != HW_TRNG_VALID_REG_EHR_NOT_READY) && (i != DATA_COLLECTION_START_INDEX))
{
Error = CC_TRNG_SAMPLE_LOST;
}
/*pass bit[31:1] to Error. mask out bit[0] which is used for CC_TRNG_SAMPLE_LOST*/
if ((valid & ~CC_TRNG_SAMPLE_LOST) != 0)
{
Error |= (valid & ~CC_TRNG_SAMPLE_LOST);
}
if (Error & HW_RNG_ISR_REG_AUTOCORR_ERR)
{
break; /* autocorrelation error is irrecoverable */
}
/* clean up interrupt status */
CC_GEN_WriteRegister(regBaseAddress, HW_RNG_ICR_REG_ADDR, ~0UL);
/*
* load the current random data from EHR registers to the output buffer.
* NOTE: TRNG hardware will auto start to re-fill bits to EHR_DATA_REG0-5
* after the host read out all 6 registers
*/
for (j=0; j<EhrSizeInWords; j++)
{
*(dataBuff_ptr++) = CC_GEN_ReadRegister(regBaseAddress, HW_EHR_DATA_ADDR_0_REG_ADDR+(j*sizeof(uint32_t)));
}
callbackFunc(EHR_SIZE_IN_BYTES, (uint8_t *)dataArray);
dataBuff_ptr = dataArray;
}
/* END TIMING: end time measurement at this point */
/* write footer into buffer */
*(dataBuff_ptr++) = OUTPUT_FORMAT_FOOTER_SIG_VAL;
/* only record sample lost error in output buffer */
*(dataBuff_ptr++) = Error & CC_TRNG_SAMPLE_LOST;
*(dataBuff_ptr++) = OUTPUT_FORMAT_FOOTER_SIG_VAL;
callbackFunc(OUTPUT_FORMAT_FOOTER_LENGTH_IN_BYTES, (uint8_t *)dataArray);
/* disable the RND source */
CC_GEN_WriteRegister(regBaseAddress, HW_RND_SOURCE_ENABLE_REG_ADDR, HW_RND_SOURCE_ENABLE_REG_CLR);
/* .............. end of function ..................................... */
/* -------------------------------------------------------------------- */
return Error;
}
|
the_stack_data/220454915.c | #include<stdio.h>
int main()
{
int m,n,t,s,p,q;
scanf("%d%d",&m,&n);
t=n,s=m,p=m,q=n;
while(--n){
t=t*n;
}
while(s>p-q+1){
m=m*(s-1);
s--;
}
printf("%d\n",m/t);
return 0;
} |
the_stack_data/170451959.c | #include <stdio.h>
#include <stdlib.h>
struct Stack {
int size;
int top;
int *S;
};
void create(struct Stack *st) {
printf("Enter Size ");
scanf("%d", &st->size);
st->top = -1;
st->S = (int *)malloc(st->size * sizeof(int));
}
void Display(struct Stack st) {
int i;
for (i = st.top; i >= 0; i--) {
printf("%d ", st.S[i]);
}
printf("\n");
}
void push(struct Stack *st, int x) {
if (st->top == st->size - 1) {
printf("Stack overflow\n");
} else {
st->top++;
st->S[st->top] = x;
}
}
int pop(struct Stack *st) {
int x = -1;
if (st->top == -1) {
printf("Stack is empty\n");
} else {
x = st->S[st->top--];
}
return x;
}
int peek(struct Stack st, int index) {
int x = -1;
if (st.top - index + 1 < 0) {
printf("Invalid Index \n");
}
x = st.S[st.top - index + 1];
return x;
}
int isEmpty(struct Stack st) {
if (st.top == -1) {
return 1;
}
return 0;
}
int isFull(struct Stack st) {
if (st.top == st.size - 1) {
return 1;
}
return 0;
}
int stackTop(struct Stack st) {
if (!isEmpty(st)) {
return st.S[st.top];
}
return -1;
}
int main(int argc, const char * argv[]) {
struct Stack st;
create(&st);
push(&st, 10);
push(&st, 20);
push(&st, 30);
push(&st, 40);
printf("%d is being peeked \n", peek(st, 2));
// printf("%d is removed from the top\n", pop(&st));
Display(st);
return 0;
}
|
the_stack_data/114581.c | # include <stdlib.h>
# include <termcap.h>
# include <stdio.h>
# include <sys/ioctl.h>
# include <signal.h>
# include <termios.h>
# include <dirent.h>
# include <sys/stat.h>
# include <ftw.h>
# include <unistd.h>
# include <sys/param.h>
static struct termios kuku;
void key()
{
struct termios s;
tcgetattr(STDERR_FILENO, &kuku);
s = kuku;
s.c_lflag &= ~(ICANON | ECHO);
s.c_cc[VMIN] = 1;
s.c_cc[VTIME] = 0;
tcsetattr(STDERR_FILENO, TCSANOW, &s);
}
int main()
{
int c;
printf("kuku\n");
while (1)
{
c = getc(stdin);
key();
printf("%d\n", c);
}
return (0);
}
|
the_stack_data/200144198.c | #include<stdio.h>
int main()
{
int LCM,HCF,a,b;
printf("Enter first number: ");
scanf("%d",&a);
printf("Enter second number: ");
scanf("%d",&b);
printf("Enter the LCM: ");
scanf("%d",&LCM);
HCF=(a*b)/LCM;
printf("HCF is: %d",HCF);
return 0;
} |
the_stack_data/59513517.c | #include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
static void f1(int, int, int, int);
static void f2(void);
static jmp_buf jmpbuffer;
static int globval;
int main(void)
{
int autoval;
register int regival;
volatile int volaval;
static int statval;
globval = 1; autoval = 2; regival = 3; volaval = 4; statval = 5;
if (setjmp(jmpbuffer) != 0) {
printf ("after longjmp: \n");
printf ("globval = %d, autoval = %d, regival = %d, volaval = %d, statval = %d\n",
globval, autoval, regival, volaval, statval);
exit (0);
}
globval = 95; autoval = 96; regival = 97; volaval = 98; statval = 99;
f1(autoval, regival, volaval, statval);
exit (0);
}
static void f1(int i, int j, int k, int l)
{
printf ("in f1():\n");
printf ("globval = %d, autoval = %d, regival = %d, volaval = %d, statval = %d\n", globval, i, j, k, l);
f2();
}
static void f2(void)
{
longjmp(jmpbuffer, 1);
}
|
the_stack_data/115609.c | void a()
{
int e;
}
void b()
{
double f;
if(f == 0)
a();
}
void c()
{
int d;
}
int main()
{
int k;
if(k == 0)
{
int l;
a();
c();
}
else
{
b();
}
int n;
a();
return n;
}
|
the_stack_data/553325.c | /*
This program is a part of Riscade project.
Licensed under MIT License.
See https://github.com/m13253/riscade/blob/master/COPYING for licensing information.
*/
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
static const uint8_t fl = 10;
static const uint8_t sp = 11;
static const uint8_t s0 = 12;
static const uint8_t s1 = 13;
static const uint8_t s2 = 14;
static const uint8_t pc = 15;
static void print_debug(const uint8_t memory[0x10000], const uint8_t registers[16]) {
fprintf(stderr, "\nr0:%02x r1:%02x r2:%02x r3:%02x r4:%02x r5:%02x r6:%02x r7:%02x r8:%02x r9:%02x\nfl:%02x sp:%02x s0:%02x s1:%02x s2:%02x pc:%02x(%02x)\n\n", registers[0], registers[1], registers[2], registers[3], registers[4], registers[5], registers[6], registers[7], registers[8], registers[9], registers[fl], registers[sp], registers[s0], registers[s1], registers[s2], registers[pc], memory[registers[s2] << 8 | registers[pc]]);
}
static int run_inst(uint8_t memory[0x10000], uint8_t registers[16]) {
uint8_t inst = memory[registers[s2] << 8 | registers[pc]];
registers[pc]++;
if(inst >> 7 != (registers[fl] & 0x1)) {
return 1;
}
inst &= 0x7f;
// NOP
if(inst == 0x00) {
// HLT
} else if(inst == 0x01) {
return 0;
// IN
} else if(inst == 0x02) {
uint8_t port = registers[1];
if(port == 0) {
int c = fgetc(stdin);
if(c != EOF) {
registers[0] = (uint8_t) c;
registers[fl] &= 0xfd;
} else {
registers[0] = 0xff;
registers[fl] |= 0x2;
}
} else {
registers[0] = 0;
registers[fl] |= 0x2;
}
// OUT
} else if(inst == 0x03) {
uint8_t port = registers[1];
if(port == 1) {
if(fputc(registers[0], stdout) != EOF) {
registers[fl] &= 0xfd;
} else {
registers[fl] |= 0x2;
}
} else if(port == 2) {
if(fputc(registers[0], stderr) != EOF) {
registers[fl] &= 0xfd;
} else {
registers[fl] |= 0x2;
}
} else {
registers[fl] |= 0x2;
}
// SHR
} else if(inst == 0x04) {
int8_t shift = (int8_t) registers[1];
if(shift > 0 && shift < 8) {
registers[fl] &= 0xfd;
registers[fl] |= ((registers[0] >> (shift-1)) & 0x1) << 1;
if(registers[fl] & 0x8) {
registers[0] = ~((uint8_t) ~registers[0] >> shift);
} else {
registers[0] >>= shift;
}
} else if(shift > -8 && shift < 0) {
shift = -shift;
registers[fl] &= 0xfd;
registers[fl] |= ((registers[0] >> (8-shift)) & 0x1) << 1;
if(registers[fl] & 0x8) {
registers[0] = ~(~registers[0] << shift);
} else {
registers[0] <<= shift;
}
} else {
print_debug(memory, registers);
abort();
}
// SHR1
} else if(inst == 0x05) {
registers[fl] &= 0xfd;
registers[fl] |= (registers[0] & 0x1) << 1;
registers[0] >>= 1;
// ROR
} else if(inst == 0x06) {
if(registers[1] > 0 && registers[1] < 8) {
registers[0] = registers[0] >> registers[1] | registers[0] << (8-registers[1]);
} else {
print_debug(memory, registers);
abort();
}
// ROR1
} else if(inst == 0x07) {
registers[0] = registers[0] >> 1 | registers[0] << 7;
// CLI
} else if(inst == 0x08) {
registers[fl] &= 0x0f;
// CLF 1
} else if(inst == 0x09) {
registers[fl] &= 0xfd;
// CLF 2
} else if(inst == 0x0a) {
registers[fl] &= 0xfb;
// CLF 3
} else if(inst == 0x0b) {
registers[fl] &= 0xf7;
// TCE
} else if(inst == 0x0c) {
registers[fl] ^= 0x1;
// STF 1
} else if(inst == 0x0d) {
registers[fl] |= 0x2;
// STF 2
} else if(inst == 0x0e) {
registers[fl] |= 0x4;
// STF 3
} else if(inst == 0x0f) {
registers[fl] |= 0x8;
// TSP
} else if(inst == 0x10) {
registers[fl] &= 0xfe;
registers[fl] |= registers[0] & 1;
// SWP
} else if(inst >= 0x10 && inst <= 0x1f) {
uint8_t tmp = registers[0];
registers[0] = registers[inst & 0xf];
registers[inst & 0xf] = tmp;
// TSZ
} else if(inst == 0x20) {
if(registers[0]) {
registers[fl] |= 0x1;
} else {
registers[fl] &= 0xfe;
}
// CPF
} else if(inst >= 0x20 && inst <= 0x2f) {
registers[0] = registers[inst & 0xf];
// TSS
} else if(inst == 0x30) {
registers[fl] &= 0xfe;
registers[fl] |= registers[0] >> 7;
// CPT
} else if(inst >= 0x30 && inst <= 0x3f) {
registers[inst & 0xf] = registers[0];
// LD s0
} else if(inst == 0x44) {
registers[0] = memory[registers[s0] << 8 | registers[1]];
// LD s1
} else if(inst == 0x46) {
registers[0] = memory[registers[s1] << 8 | registers[1]];
// ST s0
} else if(inst == 0x45) {
memory[registers[s0] << 8 | registers[1]] = registers[0];
// ST s1
} else if(inst == 0x47) {
memory[registers[s1] << 8 | registers[1]] = registers[0];
// TSI
} else if(inst == 0x48) {
if(fl & 0xf0) {
registers[fl] |= 0x1;
} else {
registers[fl] &= 0xfe;
}
// TSF 1
} else if(inst == 0x49) {
if(registers[fl] & 0x2) {
registers[fl] |= 0x1;
} else {
registers[fl] &= 0xfe;
}
// TSF 2
} else if(inst == 0x4a) {
if(registers[fl] & 0x4) {
registers[fl] |= 0x1;
} else {
registers[fl] &= 0xfe;
}
// TSF 3
} else if(inst == 0x4b) {
if(registers[fl] & 0x8) {
registers[fl] |= 0x1;
} else {
registers[fl] &= 0xfe;
}
// LDS
} else if(inst == 0x4c) {
registers[0] = memory[registers[s1] << 8 | registers[sp]];
// STS
} else if(inst == 0x4d) {
memory[registers[s1] << 8 | registers[sp]] = registers[0];
// CLR
} else if(inst == 0x50) {
registers[0] = 0;
// NOT
} else if(inst == 0x51) {
registers[0] = ~registers[0];
// AND
} else if(inst == 0x52) {
registers[0] &= registers[1];
// OR
} else if(inst == 0x53) {
registers[0] |= registers[1];
// XOR
} else if(inst == 0x54) {
registers[0] ^= registers[1];
// DBG
} else if(inst == 0x55) {
print_debug(memory, registers);
// ADD
} else if(inst == 0x56) {
if(registers[0] + registers[1] >= 0xff) {
registers[fl] |= 0x2;
} else {
registers[fl] &= 0xfd;
}
registers[0] += registers[1];
// SUB
} else if(inst == 0x57) {
if(registers[0] - registers[1] < 0) {
registers[fl] |= 0x2;
} else {
registers[fl] &= 0xfd;
}
registers[0] -= registers[1];
// MUL
} else if(inst == 0x58) {
uint16_t prod = registers[0] * registers[1];
registers[0] = (uint8_t) prod;
registers[1] = (uint8_t) (prod >> 8);
// DIV
} else if(inst == 0x59) {
if(registers[0] == 0 && registers[1] == 0) {
registers[fl] |= 0x2;
registers[0] = 0;
registers[1] = 0;
} else if(registers[1] == 0) {
registers[fl] |= 0x2;
registers[0] = 0xff;
registers[1] = 0;
} else {
uint8_t r0 = registers[0];
uint8_t r1 = registers[1];
registers[fl] &= 0xfd;
registers[0] = r0 / r1;
registers[1] = r0 % r1;
}
// INC
} else if(inst == 0x5a) {
if(registers[0] == 0xff) {
registers[fl] |= 0x2;
} else {
registers[fl] &= 0xfd;
}
registers[0]++;
// DEC
} else if(inst == 0x5b) {
if(registers[0] == 0x0) {
registers[fl] |= 0x2;
} else {
registers[fl] &= 0xfd;
}
registers[0]--;
// POP
} else if(inst == 0x5c) {
registers[sp]++;
// PUSH
} else if(inst == 0x5d) {
registers[sp]--;
// LJMP
} else if(inst == 0x5e) {
uint8_t tmp0 = registers[0];
registers[0] = registers[pc];
registers[pc] = tmp0;
uint8_t tmp1 = registers[s0];
registers[s0] = registers[s2];
registers[s2] = tmp1;
// IRET
} else if(inst == 0x5f) {
registers[pc] = memory[registers[s1] << 8 | registers[sp]++];
registers[s0] = memory[registers[s1] << 8 | registers[sp]++];
registers[fl] |= 0x4;
// IML
} else if(inst >= 0x60 && inst <= 0x6f) {
registers[0] = (registers[0] & 0xf0) | (inst & 0x0f);
// IMH
} else if(inst >= 0x70 && inst <= 0x7f) {
registers[0] = (registers[0] & 0x0f) | (inst & 0x0f) << 4;
} else {
print_debug(memory, registers);
abort();
}
return 1;
}
static void emulate(uint8_t memory[0x10000], uint8_t registers[16]) {
while(run_inst(memory, registers)) {
}
}
int main(int argc, char *argv[]) {
if(argc < 2) {
fprintf(stderr, "Usage: %s ROM.bin\n\n", argv[0]);
return 1;
}
FILE *file = fopen(argv[1], "rb");
if(!file) {
int err = errno;
perror("Error opening ROM file");
return err;
}
uint8_t *memory = calloc(0x10000, 1);
if(!memory) {
int err = errno;
perror("Error allocating memory");
return err;
}
fread(memory, 1, 0x10000, file);
if(ferror(file)) {
int err = errno;
perror("Error reading ROM file");
return err;
}
fclose(file);
uint8_t registers[16] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0
};
emulate(memory, registers);
free(memory);
return 0;
}
|
the_stack_data/132952676.c | #include <stdio.h>
int main() {
int A, B, C, MaiorAB;
scanf("%d %d %d", &A, &B, &C);
MaiorAB = (A+B+abs(A-B))/2;
MaiorAB = (C+MaiorAB+abs(MaiorAB-C))/2;
printf("%d eh o maior\n", MaiorAB);
return 0;
}
|
the_stack_data/574463.c | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/* BAM-DMA Manager. */
#ifdef CONFIG_SPS_SUPPORT_BAMDMA
#include <linux/export.h>
#include <linux/memory.h> /* memset */
#include "spsi.h"
#include "bam.h"
#include "sps_bam.h" /* bam_dma_thresh_dma */
#include "sps_core.h" /* sps_h2bam() */
/**
* registers
*/
#define DMA_ENBL (0x00000000)
#ifdef CONFIG_SPS_SUPPORT_NDP_BAM
#define DMA_REVISION (0x00000004)
#define DMA_CONFIG (0x00000008)
#define DMA_CHNL_CONFIG(n) (0x00001000 + 4096 * (n))
#else
#define DMA_CHNL_CONFIG(n) (0x00000004 + 4 * (n))
#define DMA_CONFIG (0x00000040)
#endif
/**
* masks
*/
/* DMA_CHNL_confign */
#ifdef CONFIG_SPS_SUPPORT_NDP_BAM
#define DMA_CHNL_PRODUCER_PIPE_ENABLED 0x40000
#define DMA_CHNL_CONSUMER_PIPE_ENABLED 0x20000
#endif
#define DMA_CHNL_HALT_DONE 0x10000
#define DMA_CHNL_HALT 0x1000
#define DMA_CHNL_ENABLE 0x100
#define DMA_CHNL_ACT_THRESH 0x30
#define DMA_CHNL_WEIGHT 0x7
/* DMA_CONFIG */
#define TESTBUS_SELECT 0x3
/**
*
* Write register with debug info.
*
* @base - bam base virtual address.
* @offset - register offset.
* @val - value to write.
*
*/
static inline void dma_write_reg(void *base, u32 offset, u32 val)
{
iowrite32(val, base + offset);
SPS_DBG("sps:bamdma: write reg 0x%x w_val 0x%x.", offset, val);
}
/**
* Write register masked field with debug info.
*
* @base - bam base virtual address.
* @offset - register offset.
* @mask - register bitmask.
* @val - value to write.
*
*/
static inline void dma_write_reg_field(void *base, u32 offset,
const u32 mask, u32 val)
{
u32 shift = find_first_bit((void *)&mask, 32);
u32 tmp = ioread32(base + offset);
tmp &= ~mask; /* clear written bits */
val = tmp | (val << shift);
iowrite32(val, base + offset);
SPS_DBG("sps:bamdma: write reg 0x%x w_val 0x%x.", offset, val);
}
/* Round max number of pipes to nearest multiple of 2 */
#define DMA_MAX_PIPES ((BAM_MAX_PIPES / 2) * 2)
/* Maximum number of BAM-DMAs supported */
#define MAX_BAM_DMA_DEVICES 1
/* Maximum number of BAMs that will be registered */
#define MAX_BAM_DMA_BAMS 1
/* Pipe enable check values */
#define DMA_PIPES_STATE_DIFF 0
#define DMA_PIPES_BOTH_DISABLED 1
#define DMA_PIPES_BOTH_ENABLED 2
/* Even pipe is tx/dest/input/write, odd pipe is rx/src/output/read */
#define DMA_PIPE_IS_DEST(p) (((p) & 1) == 0)
#define DMA_PIPE_IS_SRC(p) (((p) & 1) != 0)
/* BAM DMA pipe state */
enum bamdma_pipe_state {
PIPE_INACTIVE = 0,
PIPE_ACTIVE
};
/* BAM DMA channel state */
enum bamdma_chan_state {
DMA_CHAN_STATE_FREE = 0,
DMA_CHAN_STATE_ALLOC_EXT, /* Client allocation */
DMA_CHAN_STATE_ALLOC_INT /* Internal (resource mgr) allocation */
};
struct bamdma_chan {
/* Allocation state */
enum bamdma_chan_state state;
/* BAM DMA channel configuration parameters */
u32 threshold;
enum sps_dma_priority priority;
/* HWIO channel configuration parameters */
enum bam_dma_thresh_dma thresh;
enum bam_dma_weight_dma weight;
};
/* BAM DMA device state */
struct bamdma_device {
/* BAM-DMA device state */
int enabled;
int local;
/* BAM device state */
struct sps_bam *bam;
/* BAM handle, for deregistration */
unsigned long h;
/* BAM DMA device virtual mapping */
void *virt_addr;
int virtual_mapped;
phys_addr_t phys_addr;
void *hwio;
/* BAM DMA pipe/channel state */
u32 num_pipes;
enum bamdma_pipe_state pipes[DMA_MAX_PIPES];
struct bamdma_chan chans[DMA_MAX_PIPES / 2];
};
/* BAM-DMA devices */
static struct bamdma_device bam_dma_dev[MAX_BAM_DMA_DEVICES];
static struct mutex bam_dma_lock;
/*
* The BAM DMA module registers all BAMs in the BSP properties, but only
* uses the first BAM-DMA device for allocations. References to the others
* are stored in the following data array.
*/
static int num_bams;
static unsigned long bam_handles[MAX_BAM_DMA_BAMS];
/**
* Find BAM-DMA device
*
* This function finds the BAM-DMA device associated with the BAM handle.
*
* @h - BAM handle
*
* @return - pointer to BAM-DMA device, or NULL on error
*
*/
static struct bamdma_device *sps_dma_find_device(unsigned long h)
{
return &bam_dma_dev[0];
}
/**
* BAM DMA device enable
*
* This function enables a BAM DMA device and the associated BAM.
*
* @dev - pointer to BAM DMA device context
*
* @return 0 on success, negative value on error
*
*/
static int sps_dma_device_enable(struct bamdma_device *dev)
{
if (dev->enabled)
return 0;
/*
* If the BAM-DMA device is locally controlled then enable BAM-DMA
* device
*/
if (dev->local)
dma_write_reg(dev->virt_addr, DMA_ENBL, 1);
/* Enable BAM device */
if (sps_bam_enable(dev->bam)) {
SPS_ERR("sps:Failed to enable BAM DMA's BAM: %pa",
&dev->phys_addr);
return SPS_ERROR;
}
dev->enabled = true;
return 0;
}
/**
* BAM DMA device enable
*
* This function initializes a BAM DMA device.
*
* @dev - pointer to BAM DMA device context
*
* @return 0 on success, negative value on error
*
*/
static int sps_dma_device_disable(struct bamdma_device *dev)
{
u32 pipe_index;
if (!dev->enabled)
return 0;
/* Do not disable if channels active */
for (pipe_index = 0; pipe_index < dev->num_pipes; pipe_index++) {
if (dev->pipes[pipe_index] != PIPE_INACTIVE)
break;
}
if (pipe_index < dev->num_pipes) {
SPS_ERR("sps:Fail to disable BAM-DMA %pa:channels are active",
&dev->phys_addr);
return SPS_ERROR;
}
dev->enabled = false;
/* Disable BAM device */
if (sps_bam_disable(dev->bam)) {
SPS_ERR("sps:Fail to disable BAM-DMA BAM:%pa", &dev->phys_addr);
return SPS_ERROR;
}
/* Is the BAM-DMA device locally controlled? */
if (dev->local)
/* Disable BAM-DMA device */
dma_write_reg(dev->virt_addr, DMA_ENBL, 0);
return 0;
}
/**
* Initialize BAM DMA device
*
*/
int sps_dma_device_init(unsigned long h)
{
struct bamdma_device *dev;
struct sps_bam_props *props;
int result = SPS_ERROR;
mutex_lock(&bam_dma_lock);
/* Find a free BAM-DMA device slot */
dev = NULL;
if (bam_dma_dev[0].bam != NULL) {
SPS_ERR("sps:BAM-DMA BAM device is already initialized.");
goto exit_err;
} else {
dev = &bam_dma_dev[0];
}
/* Record BAM */
memset(dev, 0, sizeof(*dev));
dev->h = h;
dev->bam = sps_h2bam(h);
if (dev->bam == NULL) {
SPS_ERR("sps:BAM-DMA BAM device is not found "
"from the handle.");
goto exit_err;
}
/* Map the BAM DMA device into virtual space, if necessary */
props = &dev->bam->props;
dev->phys_addr = props->periph_phys_addr;
if (props->periph_virt_addr != NULL) {
dev->virt_addr = props->periph_virt_addr;
dev->virtual_mapped = false;
} else {
if (props->periph_virt_size == 0) {
SPS_ERR("sps:Unable to map BAM DMA IO memory: %pa %x",
&dev->phys_addr, props->periph_virt_size);
goto exit_err;
}
dev->virt_addr = ioremap(dev->phys_addr,
props->periph_virt_size);
if (dev->virt_addr == NULL) {
SPS_ERR("sps:Unable to map BAM DMA IO memory: %pa %x",
&dev->phys_addr, props->periph_virt_size);
goto exit_err;
}
dev->virtual_mapped = true;
}
dev->hwio = (void *) dev->virt_addr;
/* Is the BAM-DMA device locally controlled? */
if ((props->manage & SPS_BAM_MGR_DEVICE_REMOTE) == 0) {
SPS_DBG2("sps:BAM-DMA is controlled locally: %pa",
&dev->phys_addr);
dev->local = true;
} else {
SPS_DBG2("sps:BAM-DMA is controlled remotely: %pa",
&dev->phys_addr);
dev->local = false;
}
/*
* Enable the BAM DMA and determine the number of pipes/channels.
* Leave the BAM-DMA enabled, since it is always a shared device.
*/
if (sps_dma_device_enable(dev))
goto exit_err;
dev->num_pipes = dev->bam->props.num_pipes;
result = 0;
exit_err:
if (result) {
if (dev != NULL) {
if (dev->virtual_mapped)
iounmap(dev->virt_addr);
dev->bam = NULL;
}
}
mutex_unlock(&bam_dma_lock);
return result;
}
/**
* De-initialize BAM DMA device
*
*/
int sps_dma_device_de_init(unsigned long h)
{
struct bamdma_device *dev;
u32 pipe_index;
u32 chan;
int result = 0;
mutex_lock(&bam_dma_lock);
dev = sps_dma_find_device(h);
if (dev == NULL) {
SPS_ERR("sps:BAM-DMA: not registered: %lx", h);
result = SPS_ERROR;
goto exit_err;
}
/* Check for channel leaks */
for (chan = 0; chan < dev->num_pipes / 2; chan++) {
if (dev->chans[chan].state != DMA_CHAN_STATE_FREE) {
SPS_ERR("sps:BAM-DMA: channel not free: %d", chan);
result = SPS_ERROR;
dev->chans[chan].state = DMA_CHAN_STATE_FREE;
}
}
for (pipe_index = 0; pipe_index < dev->num_pipes; pipe_index++) {
if (dev->pipes[pipe_index] != PIPE_INACTIVE) {
SPS_ERR("sps:BAM-DMA: pipe not inactive: %d",
pipe_index);
result = SPS_ERROR;
dev->pipes[pipe_index] = PIPE_INACTIVE;
}
}
/* Disable BAM and BAM-DMA */
if (sps_dma_device_disable(dev))
result = SPS_ERROR;
dev->h = BAM_HANDLE_INVALID;
dev->bam = NULL;
if (dev->virtual_mapped)
iounmap(dev->virt_addr);
exit_err:
mutex_unlock(&bam_dma_lock);
return result;
}
/**
* Initialize BAM DMA module
*
*/
int sps_dma_init(const struct sps_bam_props *bam_props)
{
struct sps_bam_props props;
const struct sps_bam_props *bam_reg;
unsigned long h;
/* Init local data */
memset(&bam_dma_dev, 0, sizeof(bam_dma_dev));
num_bams = 0;
memset(bam_handles, 0, sizeof(bam_handles));
/* Create a mutex to control access to the BAM-DMA devices */
mutex_init(&bam_dma_lock);
/* Are there any BAM DMA devices? */
if (bam_props == NULL)
return 0;
/*
* Registers all BAMs in the BSP properties, but only uses the first
* BAM-DMA device for allocations.
*/
if (bam_props->phys_addr) {
/* Force multi-EE option for all BAM-DMAs */
bam_reg = bam_props;
if ((bam_props->options & SPS_BAM_OPT_BAMDMA) &&
(bam_props->manage & SPS_BAM_MGR_MULTI_EE) == 0) {
SPS_DBG("sps:Setting multi-EE options for BAM-DMA: %pa",
&bam_props->phys_addr);
props = *bam_props;
props.manage |= SPS_BAM_MGR_MULTI_EE;
bam_reg = &props;
}
/* Register the BAM */
if (sps_register_bam_device(bam_reg, &h)) {
SPS_ERR(
"sps:Fail to register BAM-DMA BAM device: "
"phys %pa", &bam_props->phys_addr);
return SPS_ERROR;
}
/* Record the BAM so that it may be deregistered later */
if (num_bams < MAX_BAM_DMA_BAMS) {
bam_handles[num_bams] = h;
num_bams++;
} else {
SPS_ERR("sps:BAM-DMA: BAM limit exceeded: %d",
num_bams);
return SPS_ERROR;
}
} else {
SPS_ERR("sps:BAM-DMA phys_addr is zero.");
return SPS_ERROR;
}
return 0;
}
/**
* De-initialize BAM DMA module
*
*/
void sps_dma_de_init(void)
{
int n;
/* De-initialize the BAM devices */
for (n = 0; n < num_bams; n++)
sps_deregister_bam_device(bam_handles[n]);
/* Clear local data */
memset(&bam_dma_dev, 0, sizeof(bam_dma_dev));
num_bams = 0;
memset(bam_handles, 0, sizeof(bam_handles));
}
/**
* Allocate a BAM DMA channel
*
*/
int sps_alloc_dma_chan(const struct sps_alloc_dma_chan *alloc,
struct sps_dma_chan *chan_info)
{
struct bamdma_device *dev;
struct bamdma_chan *chan;
u32 pipe_index;
enum bam_dma_thresh_dma thresh = (enum bam_dma_thresh_dma) 0;
enum bam_dma_weight_dma weight = (enum bam_dma_weight_dma) 0;
int result = SPS_ERROR;
if (alloc == NULL || chan_info == NULL) {
SPS_ERR("sps:sps_alloc_dma_chan. invalid parameters");
return SPS_ERROR;
}
/* Translate threshold and priority to hwio values */
if (alloc->threshold != SPS_DMA_THRESHOLD_DEFAULT) {
if (alloc->threshold >= 512)
thresh = BAM_DMA_THRESH_512;
else if (alloc->threshold >= 256)
thresh = BAM_DMA_THRESH_256;
else if (alloc->threshold >= 128)
thresh = BAM_DMA_THRESH_128;
else
thresh = BAM_DMA_THRESH_64;
}
weight = alloc->priority;
if ((u32)alloc->priority > (u32)BAM_DMA_WEIGHT_HIGH) {
SPS_ERR("sps:BAM-DMA: invalid priority: %x", alloc->priority);
return SPS_ERROR;
}
mutex_lock(&bam_dma_lock);
dev = sps_dma_find_device(alloc->dev);
if (dev == NULL) {
SPS_ERR("sps:BAM-DMA: invalid BAM handle: %lx", alloc->dev);
goto exit_err;
}
/* Search for a free set of pipes */
for (pipe_index = 0, chan = dev->chans;
pipe_index < dev->num_pipes; pipe_index += 2, chan++) {
if (chan->state == DMA_CHAN_STATE_FREE) {
/* Just check pipes for safety */
if (dev->pipes[pipe_index] != PIPE_INACTIVE ||
dev->pipes[pipe_index + 1] != PIPE_INACTIVE) {
SPS_ERR("sps:BAM-DMA: channel %d state "
"error:%d %d",
pipe_index / 2, dev->pipes[pipe_index],
dev->pipes[pipe_index + 1]);
goto exit_err;
}
break; /* Found free pipe */
}
}
if (pipe_index >= dev->num_pipes) {
SPS_ERR("sps:BAM-DMA: no free channel. num_pipes = %d",
dev->num_pipes);
goto exit_err;
}
chan->state = DMA_CHAN_STATE_ALLOC_EXT;
/* Store config values for use when pipes are activated */
chan = &dev->chans[pipe_index / 2];
chan->threshold = alloc->threshold;
chan->thresh = thresh;
chan->priority = alloc->priority;
chan->weight = weight;
SPS_DBG2("sps:sps_alloc_dma_chan. pipe %d.\n", pipe_index);
/* Report allocated pipes to client */
chan_info->dev = dev->h;
/* Dest/input/write pipex */
chan_info->dest_pipe_index = pipe_index;
/* Source/output/read pipe */
chan_info->src_pipe_index = pipe_index + 1;
result = 0;
exit_err:
mutex_unlock(&bam_dma_lock);
return result;
}
EXPORT_SYMBOL(sps_alloc_dma_chan);
/**
* Free a BAM DMA channel
*
*/
int sps_free_dma_chan(struct sps_dma_chan *chan)
{
struct bamdma_device *dev;
u32 pipe_index;
int result = 0;
if (chan == NULL) {
SPS_ERR("sps:sps_free_dma_chan. chan is NULL");
return SPS_ERROR;
}
mutex_lock(&bam_dma_lock);
dev = sps_dma_find_device(chan->dev);
if (dev == NULL) {
SPS_ERR("sps:BAM-DMA: invalid BAM handle: %lx", chan->dev);
result = SPS_ERROR;
goto exit_err;
}
/* Verify the pipe indices */
pipe_index = chan->dest_pipe_index;
if (pipe_index >= dev->num_pipes || ((pipe_index & 1)) ||
(pipe_index + 1) != chan->src_pipe_index) {
SPS_ERR("sps:sps_free_dma_chan. Invalid pipe indices."
"num_pipes=%d.dest=%d.src=%d.",
dev->num_pipes,
chan->dest_pipe_index,
chan->src_pipe_index);
result = SPS_ERROR;
goto exit_err;
}
/* Are both pipes inactive? */
if (dev->chans[pipe_index / 2].state != DMA_CHAN_STATE_ALLOC_EXT ||
dev->pipes[pipe_index] != PIPE_INACTIVE ||
dev->pipes[pipe_index + 1] != PIPE_INACTIVE) {
SPS_ERR("sps:BAM-DMA: attempt to free active chan %d: %d %d",
pipe_index / 2, dev->pipes[pipe_index],
dev->pipes[pipe_index + 1]);
result = SPS_ERROR;
goto exit_err;
}
/* Free the channel */
dev->chans[pipe_index / 2].state = DMA_CHAN_STATE_FREE;
exit_err:
mutex_unlock(&bam_dma_lock);
return result;
}
EXPORT_SYMBOL(sps_free_dma_chan);
/**
* Activate a BAM DMA pipe
*
* This function activates a BAM DMA pipe.
*
* @dev - pointer to BAM-DMA device descriptor
*
* @pipe_index - pipe index
*
* @return 0 on success, negative value on error
*
*/
static u32 sps_dma_check_pipes(struct bamdma_device *dev, u32 pipe_index)
{
u32 pipe_in;
u32 pipe_out;
int enabled_in;
int enabled_out;
u32 check;
pipe_in = pipe_index & ~1;
pipe_out = pipe_in + 1;
enabled_in = bam_pipe_is_enabled(dev->bam->base, pipe_in);
enabled_out = bam_pipe_is_enabled(dev->bam->base, pipe_out);
if (!enabled_in && !enabled_out)
check = DMA_PIPES_BOTH_DISABLED;
else if (enabled_in && enabled_out)
check = DMA_PIPES_BOTH_ENABLED;
else
check = DMA_PIPES_STATE_DIFF;
return check;
}
/**
* Allocate a BAM DMA pipe
*
*/
int sps_dma_pipe_alloc(void *bam_arg, u32 pipe_index, enum sps_mode dir)
{
struct sps_bam *bam = bam_arg;
struct bamdma_device *dev;
struct bamdma_chan *chan;
u32 channel;
int result = SPS_ERROR;
if (bam == NULL) {
SPS_ERR("sps:BAM context is NULL");
return SPS_ERROR;
}
/* Check pipe direction */
if ((DMA_PIPE_IS_DEST(pipe_index) && dir != SPS_MODE_DEST) ||
(DMA_PIPE_IS_SRC(pipe_index) && dir != SPS_MODE_SRC)) {
SPS_ERR("sps:BAM-DMA: wrong direction for BAM %pa pipe %d",
&bam->props.phys_addr, pipe_index);
return SPS_ERROR;
}
mutex_lock(&bam_dma_lock);
dev = sps_dma_find_device((unsigned long) bam);
if (dev == NULL) {
SPS_ERR("sps:BAM-DMA: invalid BAM: %pa",
&bam->props.phys_addr);
goto exit_err;
}
if (pipe_index >= dev->num_pipes) {
SPS_ERR("sps:BAM-DMA: BAM %pa invalid pipe: %d",
&bam->props.phys_addr, pipe_index);
goto exit_err;
}
if (dev->pipes[pipe_index] != PIPE_INACTIVE) {
SPS_ERR("sps:BAM-DMA: BAM %pa pipe %d already active",
&bam->props.phys_addr, pipe_index);
goto exit_err;
}
/* Mark pipe active */
dev->pipes[pipe_index] = PIPE_ACTIVE;
/* If channel is not allocated, make an internal allocation */
channel = pipe_index / 2;
chan = &dev->chans[channel];
if (chan->state != DMA_CHAN_STATE_ALLOC_EXT &&
chan->state != DMA_CHAN_STATE_ALLOC_INT) {
chan->state = DMA_CHAN_STATE_ALLOC_INT;
}
result = 0;
exit_err:
mutex_unlock(&bam_dma_lock);
return result;
}
/**
* Enable a BAM DMA pipe
*
*/
int sps_dma_pipe_enable(void *bam_arg, u32 pipe_index)
{
struct sps_bam *bam = bam_arg;
struct bamdma_device *dev;
struct bamdma_chan *chan;
u32 channel;
int result = SPS_ERROR;
SPS_DBG2("sps:sps_dma_pipe_enable.pipe %d", pipe_index);
mutex_lock(&bam_dma_lock);
dev = sps_dma_find_device((unsigned long) bam);
if (dev == NULL) {
SPS_ERR("sps:BAM-DMA: invalid BAM");
goto exit_err;
}
if (pipe_index >= dev->num_pipes) {
SPS_ERR("sps:BAM-DMA: BAM %pa invalid pipe: %d",
&bam->props.phys_addr, pipe_index);
goto exit_err;
}
if (dev->pipes[pipe_index] != PIPE_ACTIVE) {
SPS_ERR("sps:BAM-DMA: BAM %pa pipe %d not active",
&bam->props.phys_addr, pipe_index);
goto exit_err;
}
/*
* The channel must be enabled when the dest/input/write pipe
* is enabled
*/
if (DMA_PIPE_IS_DEST(pipe_index)) {
/* Configure and enable the channel */
channel = pipe_index / 2;
chan = &dev->chans[channel];
if (chan->threshold != SPS_DMA_THRESHOLD_DEFAULT)
dma_write_reg_field(dev->virt_addr,
DMA_CHNL_CONFIG(channel),
DMA_CHNL_ACT_THRESH,
chan->thresh);
if (chan->priority != SPS_DMA_PRI_DEFAULT)
dma_write_reg_field(dev->virt_addr,
DMA_CHNL_CONFIG(channel),
DMA_CHNL_WEIGHT,
chan->weight);
dma_write_reg_field(dev->virt_addr,
DMA_CHNL_CONFIG(channel),
DMA_CHNL_ENABLE, 1);
}
result = 0;
exit_err:
mutex_unlock(&bam_dma_lock);
return result;
}
/**
* Deactivate a BAM DMA pipe
*
* This function deactivates a BAM DMA pipe.
*
* @dev - pointer to BAM-DMA device descriptor
*
* @bam - pointer to BAM device descriptor
*
* @pipe_index - pipe index
*
* @return 0 on success, negative value on error
*
*/
static int sps_dma_deactivate_pipe_atomic(struct bamdma_device *dev,
struct sps_bam *bam,
u32 pipe_index)
{
u32 channel;
if (dev->bam != bam)
return SPS_ERROR;
if (pipe_index >= dev->num_pipes)
return SPS_ERROR;
if (dev->pipes[pipe_index] != PIPE_ACTIVE)
return SPS_ERROR; /* Pipe is not active */
SPS_DBG2("sps:BAM-DMA: deactivate pipe %d", pipe_index);
/* Mark pipe inactive */
dev->pipes[pipe_index] = PIPE_INACTIVE;
/*
* Channel must be reset when either pipe is disabled, so just always
* reset regardless of other pipe's state
*/
channel = pipe_index / 2;
dma_write_reg_field(dev->virt_addr, DMA_CHNL_CONFIG(channel),
DMA_CHNL_ENABLE, 0);
/* If the peer pipe is also inactive, reset the channel */
if (sps_dma_check_pipes(dev, pipe_index) == DMA_PIPES_BOTH_DISABLED) {
/* Free channel if allocated internally */
if (dev->chans[channel].state == DMA_CHAN_STATE_ALLOC_INT)
dev->chans[channel].state = DMA_CHAN_STATE_FREE;
}
return 0;
}
/**
* Free a BAM DMA pipe
*
*/
int sps_dma_pipe_free(void *bam_arg, u32 pipe_index)
{
struct bamdma_device *dev;
struct sps_bam *bam = bam_arg;
int result;
mutex_lock(&bam_dma_lock);
dev = sps_dma_find_device((unsigned long) bam);
if (dev == NULL) {
SPS_ERR("sps:BAM-DMA: invalid BAM");
result = SPS_ERROR;
goto exit_err;
}
result = sps_dma_deactivate_pipe_atomic(dev, bam, pipe_index);
exit_err:
mutex_unlock(&bam_dma_lock);
return result;
}
/**
* Get the BAM handle for BAM-DMA.
*
* The BAM handle should be use as source/destination in the sps_connect().
*
* @return bam handle on success, zero on error
*/
unsigned long sps_dma_get_bam_handle(void)
{
return (unsigned long)bam_dma_dev[0].bam;
}
EXPORT_SYMBOL(sps_dma_get_bam_handle);
/**
* Free the BAM handle for BAM-DMA.
*
*/
void sps_dma_free_bam_handle(unsigned long h)
{
}
EXPORT_SYMBOL(sps_dma_free_bam_handle);
#endif /* CONFIG_SPS_SUPPORT_BAMDMA */
|
the_stack_data/713177.c | #include<stdio.h>
#include<math.h>
int main()
{
int i, sum=0;
int arr[4] = {4,5,6,7};
for(i=0; i<=3 ;i++)
sum=sum+arr[i];
printf("%d",sum);
return 0;
}
|
the_stack_data/167331370.c | /*Implemente uma função chamada TPilha, que receba um vetor de inteiros com 15 elementos. Para cada um deles, como segue, faça:
se o número for par, insira-o na pilha;
se o número lido for ímpar, retire um número da pilha;
Ao final, esvazie a pilha imprimindo os elementos.*/
#include <stdlib.h>
#include <stdio.h>
struct no {
int info;
struct no* prox;
};
typedef struct no No;
struct pilha {
No* prim;
};
typedef struct pilha Pilha;
Pilha* cria (void)
{
Pilha* p = (Pilha*) malloc(sizeof(Pilha));
p->prim = NULL;
return p;
}
No* ins_ini (No* l, int v)
{
No* p = (No*) malloc(sizeof(No));
p->info = v;
p->prox = l;
return p;
}
No* ret_ini (No* l)
{
No* p = l->prox;
free(l);
return p;
}
void push (Pilha* p, int v)
{
p->prim = ins_ini(p->prim,v);
}
int pop (Pilha* p)
{
int v;
v = p->prim->info;
p->prim = ret_ini(p->prim);
return v;
}
void TPilha (Pilha *p, int *v)
{
int i;
for(i=0;i<15;i++)
{
if(v[i]%2==0)
{
push(p,v[i]);
}
if(v[i]%2!=0)
{
pop(p);
}
}
}
void imprime (Pilha* p)
{
No* q;
printf("\nImprime:\n");
for (q=p->prim; q!=NULL; q=q->prox)
printf("%d\n",q->info);
}
int main(){
Pilha *p;
int v[15]={2,4,5,6,8,6,4,2,5,3,1,4,8,4,5};
p = cria();
TPilha(p,v);
imprime(p);
}
|
the_stack_data/206394021.c | /**
******************************************************************************
* @file stm32f3xx_ll_usart.c
* @author MCD Application Team
* @version V1.4.0
* @date 16-December-2016
* @brief USART LL module driver.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#if defined(USE_FULL_LL_DRIVER)
/* Includes ------------------------------------------------------------------*/
#include "stm32f3xx_ll_usart.h"
#include "stm32f3xx_ll_rcc.h"
#include "stm32f3xx_ll_bus.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif
/** @addtogroup STM32F3xx_LL_Driver
* @{
*/
#if defined (USART1) || defined (USART2) || defined (USART3) || defined (UART4) || defined (UART5)
/** @addtogroup USART_LL
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/** @addtogroup USART_LL_Private_Constants
* @{
*/
/**
* @}
*/
/* Private macros ------------------------------------------------------------*/
/** @addtogroup USART_LL_Private_Macros
* @{
*/
/* __BAUDRATE__ The maximum Baud Rate is derived from the maximum clock available
* divided by the smallest oversampling used on the USART (i.e. 8) */
#define IS_LL_USART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) <= 9000000U)
#define IS_LL_USART_DIRECTION(__VALUE__) (((__VALUE__) == LL_USART_DIRECTION_NONE) \
|| ((__VALUE__) == LL_USART_DIRECTION_RX) \
|| ((__VALUE__) == LL_USART_DIRECTION_TX) \
|| ((__VALUE__) == LL_USART_DIRECTION_TX_RX))
#define IS_LL_USART_PARITY(__VALUE__) (((__VALUE__) == LL_USART_PARITY_NONE) \
|| ((__VALUE__) == LL_USART_PARITY_EVEN) \
|| ((__VALUE__) == LL_USART_PARITY_ODD))
#if defined(USART_7BITS_SUPPORT)
#define IS_LL_USART_DATAWIDTH(__VALUE__) (((__VALUE__) == LL_USART_DATAWIDTH_7B) \
|| ((__VALUE__) == LL_USART_DATAWIDTH_8B) \
|| ((__VALUE__) == LL_USART_DATAWIDTH_9B))
#else
#define IS_LL_USART_DATAWIDTH(__VALUE__) (((__VALUE__) == LL_USART_DATAWIDTH_8B) \
|| ((__VALUE__) == LL_USART_DATAWIDTH_9B))
#endif
#define IS_LL_USART_OVERSAMPLING(__VALUE__) (((__VALUE__) == LL_USART_OVERSAMPLING_16) \
|| ((__VALUE__) == LL_USART_OVERSAMPLING_8))
#define IS_LL_USART_LASTBITCLKOUTPUT(__VALUE__) (((__VALUE__) == LL_USART_LASTCLKPULSE_NO_OUTPUT) \
|| ((__VALUE__) == LL_USART_LASTCLKPULSE_OUTPUT))
#define IS_LL_USART_CLOCKPHASE(__VALUE__) (((__VALUE__) == LL_USART_PHASE_1EDGE) \
|| ((__VALUE__) == LL_USART_PHASE_2EDGE))
#define IS_LL_USART_CLOCKPOLARITY(__VALUE__) (((__VALUE__) == LL_USART_POLARITY_LOW) \
|| ((__VALUE__) == LL_USART_POLARITY_HIGH))
#define IS_LL_USART_CLOCKOUTPUT(__VALUE__) (((__VALUE__) == LL_USART_CLOCK_DISABLE) \
|| ((__VALUE__) == LL_USART_CLOCK_ENABLE))
#define IS_LL_USART_STOPBITS(__VALUE__) (((__VALUE__) == LL_USART_STOPBITS_0_5) \
|| ((__VALUE__) == LL_USART_STOPBITS_1) \
|| ((__VALUE__) == LL_USART_STOPBITS_1_5) \
|| ((__VALUE__) == LL_USART_STOPBITS_2))
#define IS_LL_USART_HWCONTROL(__VALUE__) (((__VALUE__) == LL_USART_HWCONTROL_NONE) \
|| ((__VALUE__) == LL_USART_HWCONTROL_RTS) \
|| ((__VALUE__) == LL_USART_HWCONTROL_CTS) \
|| ((__VALUE__) == LL_USART_HWCONTROL_RTS_CTS))
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup USART_LL_Exported_Functions
* @{
*/
/** @addtogroup USART_LL_EF_Init
* @{
*/
/**
* @brief De-initialize USART registers (Registers restored to their default values).
* @param USARTx USART Instance
* @retval An ErrorStatus enumeration value:
* - SUCCESS: USART registers are de-initialized
* - ERROR: USART registers are not de-initialized
*/
ErrorStatus LL_USART_DeInit(USART_TypeDef *USARTx)
{
ErrorStatus status = SUCCESS;
/* Check the parameters */
assert_param(IS_UART_INSTANCE(USARTx));
if (USARTx == USART1)
{
/* Force reset of USART clock */
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_USART1);
/* Release reset of USART clock */
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_USART1);
}
else if (USARTx == USART2)
{
/* Force reset of USART clock */
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USART2);
/* Release reset of USART clock */
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USART2);
}
else if (USARTx == USART3)
{
/* Force reset of USART clock */
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USART3);
/* Release reset of USART clock */
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USART3);
}
#if defined(UART4)
else if (USARTx == UART4)
{
/* Force reset of UART clock */
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_UART4);
/* Release reset of UART clock */
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_UART4);
}
#endif /* UART4 */
#if defined(UART5)
else if (USARTx == UART5)
{
/* Force reset of UART clock */
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_UART5);
/* Release reset of UART clock */
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_UART5);
}
#endif /* UART5 */
else
{
status = ERROR;
}
return (status);
}
/**
* @brief Initialize USART registers according to the specified
* parameters in USART_InitStruct.
* @note As some bits in USART configuration registers can only be written when the USART is disabled (USART_CR1_UE bit =0),
* USART IP should be in disabled state prior calling this function. Otherwise, ERROR result will be returned.
* @note Baud rate value stored in USART_InitStruct BaudRate field, should be valid (different from 0).
* @param USARTx USART Instance
* @param USART_InitStruct: pointer to a LL_USART_InitTypeDef structure
* that contains the configuration information for the specified USART peripheral.
* @retval An ErrorStatus enumeration value:
* - SUCCESS: USART registers are initialized according to USART_InitStruct content
* - ERROR: Problem occurred during USART Registers initialization
*/
ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct)
{
ErrorStatus status = ERROR;
uint32_t periphclk = LL_RCC_PERIPH_FREQUENCY_NO;
#if defined(STM32F303x8)||defined(STM32F334x8)||defined(STM32F328xx)||defined(STM32F301x8)||defined(STM32F302x8)||defined(STM32F318xx)
LL_RCC_ClocksTypeDef RCC_Clocks;
#endif
/* Check the parameters */
assert_param(IS_UART_INSTANCE(USARTx));
assert_param(IS_LL_USART_BAUDRATE(USART_InitStruct->BaudRate));
assert_param(IS_LL_USART_DATAWIDTH(USART_InitStruct->DataWidth));
assert_param(IS_LL_USART_STOPBITS(USART_InitStruct->StopBits));
assert_param(IS_LL_USART_PARITY(USART_InitStruct->Parity));
assert_param(IS_LL_USART_DIRECTION(USART_InitStruct->TransferDirection));
assert_param(IS_LL_USART_HWCONTROL(USART_InitStruct->HardwareFlowControl));
assert_param(IS_LL_USART_OVERSAMPLING(USART_InitStruct->OverSampling));
/* USART needs to be in disabled state, in order to be able to configure some bits in
CRx registers */
if (LL_USART_IsEnabled(USARTx) == 0U)
{
/*---------------------------- USART CR1 Configuration -----------------------
* Configure USARTx CR1 (USART Word Length, Parity, Mode and Oversampling bits) with parameters:
* - DataWidth: USART_CR1_M bits according to USART_InitStruct->DataWidth value
* - Parity: USART_CR1_PCE, USART_CR1_PS bits according to USART_InitStruct->Parity value
* - TransferDirection: USART_CR1_TE, USART_CR1_RE bits according to USART_InitStruct->TransferDirection value
* - Oversampling: USART_CR1_OVER8 bit according to USART_InitStruct->OverSampling value.
*/
MODIFY_REG(USARTx->CR1,
(USART_CR1_M | USART_CR1_PCE | USART_CR1_PS |
USART_CR1_TE | USART_CR1_RE | USART_CR1_OVER8),
(USART_InitStruct->DataWidth | USART_InitStruct->Parity |
USART_InitStruct->TransferDirection | USART_InitStruct->OverSampling));
/*---------------------------- USART CR2 Configuration -----------------------
* Configure USARTx CR2 (Stop bits) with parameters:
* - Stop Bits: USART_CR2_STOP bits according to USART_InitStruct->StopBits value.
* - CLKEN, CPOL, CPHA and LBCL bits are to be configured using LL_USART_ClockInit().
*/
LL_USART_SetStopBitsLength(USARTx, USART_InitStruct->StopBits);
/*---------------------------- USART CR3 Configuration -----------------------
* Configure USARTx CR3 (Hardware Flow Control) with parameters:
* - HardwareFlowControl: USART_CR3_RTSE, USART_CR3_CTSE bits according to USART_InitStruct->HardwareFlowControl value.
*/
LL_USART_SetHWFlowCtrl(USARTx, USART_InitStruct->HardwareFlowControl);
/*---------------------------- USART BRR Configuration -----------------------
* Retrieve Clock frequency used for USART Peripheral
*/
if (USARTx == USART1)
{
periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART1_CLKSOURCE);
}
else if (USARTx == USART2)
{
#if defined (RCC_CFGR3_USART2SW)
periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART2_CLKSOURCE);
#else
/* USART2 clock is PCLK */
LL_RCC_GetSystemClocksFreq(&RCC_Clocks);
periphclk = RCC_Clocks.PCLK1_Frequency;
#endif
}
else if (USARTx == USART3)
{
#if defined (RCC_CFGR3_USART3SW)
periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART3_CLKSOURCE);
#else
/* USART3 clock is PCLK */
LL_RCC_GetSystemClocksFreq(&RCC_Clocks);
periphclk = RCC_Clocks.PCLK1_Frequency;
#endif
}
#if defined(UART4)
else if (USARTx == UART4)
{
periphclk = LL_RCC_GetUARTClockFreq(LL_RCC_UART4_CLKSOURCE);
}
#endif /* UART4 */
#if defined(UART5)
else if (USARTx == UART5)
{
periphclk = LL_RCC_GetUARTClockFreq(LL_RCC_UART5_CLKSOURCE);
}
#endif /* UART5 */
else
{
/* Nothing to do, as error code is already assigned to ERROR value */
}
/* Configure the USART Baud Rate :
- valid baud rate value (different from 0) is required
- Peripheral clock as returned by RCC service, should be valid (different from 0).
*/
if ((periphclk != LL_RCC_PERIPH_FREQUENCY_NO)
&& (USART_InitStruct->BaudRate != 0U))
{
status = SUCCESS;
LL_USART_SetBaudRate(USARTx,
periphclk,
USART_InitStruct->OverSampling,
USART_InitStruct->BaudRate);
}
}
/* Endif (=> USART not in Disabled state => return ERROR) */
return (status);
}
/**
* @brief Set each @ref LL_USART_InitTypeDef field to default value.
* @param USART_InitStruct: pointer to a @ref LL_USART_InitTypeDef structure
* whose fields will be set to default values.
* @retval None
*/
void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct)
{
/* Set USART_InitStruct fields to default values */
USART_InitStruct->BaudRate = 9600U;
USART_InitStruct->DataWidth = LL_USART_DATAWIDTH_8B;
USART_InitStruct->StopBits = LL_USART_STOPBITS_1;
USART_InitStruct->Parity = LL_USART_PARITY_NONE ;
USART_InitStruct->TransferDirection = LL_USART_DIRECTION_TX_RX;
USART_InitStruct->HardwareFlowControl = LL_USART_HWCONTROL_NONE;
USART_InitStruct->OverSampling = LL_USART_OVERSAMPLING_16;
}
/**
* @brief Initialize USART Clock related settings according to the
* specified parameters in the USART_ClockInitStruct.
* @note As some bits in USART configuration registers can only be written when the USART is disabled (USART_CR1_UE bit =0),
* USART IP should be in disabled state prior calling this function. Otherwise, ERROR result will be returned.
* @param USARTx USART Instance
* @param USART_ClockInitStruct: pointer to a @ref LL_USART_ClockInitTypeDef structure
* that contains the Clock configuration information for the specified USART peripheral.
* @retval An ErrorStatus enumeration value:
* - SUCCESS: USART registers related to Clock settings are initialized according to USART_ClockInitStruct content
* - ERROR: Problem occurred during USART Registers initialization
*/
ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct)
{
ErrorStatus status = SUCCESS;
/* Check USART Instance and Clock signal output parameters */
assert_param(IS_UART_INSTANCE(USARTx));
assert_param(IS_LL_USART_CLOCKOUTPUT(USART_ClockInitStruct->ClockOutput));
/* USART needs to be in disabled state, in order to be able to configure some bits in
CRx registers */
if (LL_USART_IsEnabled(USARTx) == 0U)
{
/*---------------------------- USART CR2 Configuration -----------------------*/
/* If Clock signal has to be output */
if (USART_ClockInitStruct->ClockOutput == LL_USART_CLOCK_DISABLE)
{
/* Deactivate Clock signal delivery :
* - Disable Clock Output: USART_CR2_CLKEN cleared
*/
LL_USART_DisableSCLKOutput(USARTx);
}
else
{
/* Ensure USART instance is USART capable */
assert_param(IS_USART_INSTANCE(USARTx));
/* Check clock related parameters */
assert_param(IS_LL_USART_CLOCKPOLARITY(USART_ClockInitStruct->ClockPolarity));
assert_param(IS_LL_USART_CLOCKPHASE(USART_ClockInitStruct->ClockPhase));
assert_param(IS_LL_USART_LASTBITCLKOUTPUT(USART_ClockInitStruct->LastBitClockPulse));
/*---------------------------- USART CR2 Configuration -----------------------
* Configure USARTx CR2 (Clock signal related bits) with parameters:
* - Enable Clock Output: USART_CR2_CLKEN set
* - Clock Polarity: USART_CR2_CPOL bit according to USART_ClockInitStruct->ClockPolarity value
* - Clock Phase: USART_CR2_CPHA bit according to USART_ClockInitStruct->ClockPhase value
* - Last Bit Clock Pulse Output: USART_CR2_LBCL bit according to USART_ClockInitStruct->LastBitClockPulse value.
*/
MODIFY_REG(USARTx->CR2,
USART_CR2_CLKEN | USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL,
USART_CR2_CLKEN | USART_ClockInitStruct->ClockPolarity |
USART_ClockInitStruct->ClockPhase | USART_ClockInitStruct->LastBitClockPulse);
}
}
/* Else (USART not in Disabled state => return ERROR */
else
{
status = ERROR;
}
return (status);
}
/**
* @brief Set each field of a @ref LL_USART_ClockInitTypeDef type structure to default value.
* @param USART_ClockInitStruct: pointer to a @ref LL_USART_ClockInitTypeDef structure
* whose fields will be set to default values.
* @retval None
*/
void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct)
{
/* Set LL_USART_ClockInitStruct fields with default values */
USART_ClockInitStruct->ClockOutput = LL_USART_CLOCK_DISABLE;
USART_ClockInitStruct->ClockPolarity = LL_USART_POLARITY_LOW; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */
USART_ClockInitStruct->ClockPhase = LL_USART_PHASE_1EDGE; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */
USART_ClockInitStruct->LastBitClockPulse = LL_USART_LASTCLKPULSE_NO_OUTPUT; /* Not relevant when ClockOutput = LL_USART_CLOCK_DISABLE */
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#endif /* USART1 || USART2|| USART3 || UART4 || UART5 */
/**
* @}
*/
#endif /* USE_FULL_LL_DRIVER */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
the_stack_data/59511844.c | extern float __VERIFIER_nondet_float(void);
extern int __VERIFIER_nondet_int(void);
typedef enum {false, true} bool;
bool __VERIFIER_nondet_bool(void) {
return __VERIFIER_nondet_int() != 0;
}
int main()
{
float x_6, _x_x_6;
bool _EL_U_518, _x__EL_U_518;
float x_0, _x_x_0;
float x_11, _x_x_11;
float x_7, _x_x_7;
float x_3, _x_x_3;
float x_1, _x_x_1;
float x_4, _x_x_4;
float x_5, _x_x_5;
float x_9, _x_x_9;
float x_8, _x_x_8;
float x_10, _x_x_10;
float x_2, _x_x_2;
int __steps_to_fair = __VERIFIER_nondet_int();
x_6 = __VERIFIER_nondet_float();
_EL_U_518 = __VERIFIER_nondet_bool();
x_0 = __VERIFIER_nondet_float();
x_11 = __VERIFIER_nondet_float();
x_7 = __VERIFIER_nondet_float();
x_3 = __VERIFIER_nondet_float();
x_1 = __VERIFIER_nondet_float();
x_4 = __VERIFIER_nondet_float();
x_5 = __VERIFIER_nondet_float();
x_9 = __VERIFIER_nondet_float();
x_8 = __VERIFIER_nondet_float();
x_10 = __VERIFIER_nondet_float();
x_2 = __VERIFIER_nondet_float();
bool __ok = (1 && ( !(( !(-1.0 <= (x_8 + (-1.0 * x_11)))) && ((-13.0 <= (x_4 + (-1.0 * x_7))) || (((x_7 + (-1.0 * x_11)) <= 7.0) && _EL_U_518)))));
while (__steps_to_fair >= 0 && __ok) {
if (((-13.0 <= (x_4 + (-1.0 * x_7))) || ( !((-13.0 <= (x_4 + (-1.0 * x_7))) || (((x_7 + (-1.0 * x_11)) <= 7.0) && _EL_U_518))))) {
__steps_to_fair = __VERIFIER_nondet_int();
} else {
__steps_to_fair--;
}
_x_x_6 = __VERIFIER_nondet_float();
_x__EL_U_518 = __VERIFIER_nondet_bool();
_x_x_0 = __VERIFIER_nondet_float();
_x_x_11 = __VERIFIER_nondet_float();
_x_x_7 = __VERIFIER_nondet_float();
_x_x_3 = __VERIFIER_nondet_float();
_x_x_1 = __VERIFIER_nondet_float();
_x_x_4 = __VERIFIER_nondet_float();
_x_x_5 = __VERIFIER_nondet_float();
_x_x_9 = __VERIFIER_nondet_float();
_x_x_8 = __VERIFIER_nondet_float();
_x_x_10 = __VERIFIER_nondet_float();
_x_x_2 = __VERIFIER_nondet_float();
__ok = ((((((((((((((((x_11 + (-1.0 * _x_x_0)) <= -11.0) && (((x_10 + (-1.0 * _x_x_0)) <= -11.0) && (((x_8 + (-1.0 * _x_x_0)) <= -1.0) && (((x_5 + (-1.0 * _x_x_0)) <= -18.0) && (((x_0 + (-1.0 * _x_x_0)) <= -11.0) && ((x_3 + (-1.0 * _x_x_0)) <= -18.0)))))) && (((x_11 + (-1.0 * _x_x_0)) == -11.0) || (((x_10 + (-1.0 * _x_x_0)) == -11.0) || (((x_8 + (-1.0 * _x_x_0)) == -1.0) || (((x_5 + (-1.0 * _x_x_0)) == -18.0) || (((x_0 + (-1.0 * _x_x_0)) == -11.0) || ((x_3 + (-1.0 * _x_x_0)) == -18.0))))))) && ((((x_11 + (-1.0 * _x_x_1)) <= -16.0) && (((x_8 + (-1.0 * _x_x_1)) <= -15.0) && (((x_4 + (-1.0 * _x_x_1)) <= -1.0) && (((x_2 + (-1.0 * _x_x_1)) <= -14.0) && (((x_0 + (-1.0 * _x_x_1)) <= -9.0) && ((x_1 + (-1.0 * _x_x_1)) <= -17.0)))))) && (((x_11 + (-1.0 * _x_x_1)) == -16.0) || (((x_8 + (-1.0 * _x_x_1)) == -15.0) || (((x_4 + (-1.0 * _x_x_1)) == -1.0) || (((x_2 + (-1.0 * _x_x_1)) == -14.0) || (((x_0 + (-1.0 * _x_x_1)) == -9.0) || ((x_1 + (-1.0 * _x_x_1)) == -17.0)))))))) && ((((x_11 + (-1.0 * _x_x_2)) <= -6.0) && (((x_10 + (-1.0 * _x_x_2)) <= -11.0) && (((x_6 + (-1.0 * _x_x_2)) <= -9.0) && (((x_4 + (-1.0 * _x_x_2)) <= -6.0) && (((x_0 + (-1.0 * _x_x_2)) <= -12.0) && ((x_3 + (-1.0 * _x_x_2)) <= -15.0)))))) && (((x_11 + (-1.0 * _x_x_2)) == -6.0) || (((x_10 + (-1.0 * _x_x_2)) == -11.0) || (((x_6 + (-1.0 * _x_x_2)) == -9.0) || (((x_4 + (-1.0 * _x_x_2)) == -6.0) || (((x_0 + (-1.0 * _x_x_2)) == -12.0) || ((x_3 + (-1.0 * _x_x_2)) == -15.0)))))))) && ((((x_9 + (-1.0 * _x_x_3)) <= -16.0) && (((x_7 + (-1.0 * _x_x_3)) <= -6.0) && (((x_6 + (-1.0 * _x_x_3)) <= -12.0) && (((x_4 + (-1.0 * _x_x_3)) <= -13.0) && (((x_0 + (-1.0 * _x_x_3)) <= -12.0) && ((x_3 + (-1.0 * _x_x_3)) <= -17.0)))))) && (((x_9 + (-1.0 * _x_x_3)) == -16.0) || (((x_7 + (-1.0 * _x_x_3)) == -6.0) || (((x_6 + (-1.0 * _x_x_3)) == -12.0) || (((x_4 + (-1.0 * _x_x_3)) == -13.0) || (((x_0 + (-1.0 * _x_x_3)) == -12.0) || ((x_3 + (-1.0 * _x_x_3)) == -17.0)))))))) && ((((x_10 + (-1.0 * _x_x_4)) <= -14.0) && (((x_9 + (-1.0 * _x_x_4)) <= -20.0) && (((x_8 + (-1.0 * _x_x_4)) <= -17.0) && (((x_7 + (-1.0 * _x_x_4)) <= -7.0) && (((x_1 + (-1.0 * _x_x_4)) <= -11.0) && ((x_3 + (-1.0 * _x_x_4)) <= -11.0)))))) && (((x_10 + (-1.0 * _x_x_4)) == -14.0) || (((x_9 + (-1.0 * _x_x_4)) == -20.0) || (((x_8 + (-1.0 * _x_x_4)) == -17.0) || (((x_7 + (-1.0 * _x_x_4)) == -7.0) || (((x_1 + (-1.0 * _x_x_4)) == -11.0) || ((x_3 + (-1.0 * _x_x_4)) == -11.0)))))))) && ((((x_11 + (-1.0 * _x_x_5)) <= -4.0) && (((x_10 + (-1.0 * _x_x_5)) <= -17.0) && (((x_9 + (-1.0 * _x_x_5)) <= -16.0) && (((x_5 + (-1.0 * _x_x_5)) <= -9.0) && (((x_1 + (-1.0 * _x_x_5)) <= -2.0) && ((x_3 + (-1.0 * _x_x_5)) <= -12.0)))))) && (((x_11 + (-1.0 * _x_x_5)) == -4.0) || (((x_10 + (-1.0 * _x_x_5)) == -17.0) || (((x_9 + (-1.0 * _x_x_5)) == -16.0) || (((x_5 + (-1.0 * _x_x_5)) == -9.0) || (((x_1 + (-1.0 * _x_x_5)) == -2.0) || ((x_3 + (-1.0 * _x_x_5)) == -12.0)))))))) && ((((x_11 + (-1.0 * _x_x_6)) <= -14.0) && (((x_7 + (-1.0 * _x_x_6)) <= -9.0) && (((x_6 + (-1.0 * _x_x_6)) <= -18.0) && (((x_4 + (-1.0 * _x_x_6)) <= -10.0) && (((x_2 + (-1.0 * _x_x_6)) <= -17.0) && ((x_3 + (-1.0 * _x_x_6)) <= -5.0)))))) && (((x_11 + (-1.0 * _x_x_6)) == -14.0) || (((x_7 + (-1.0 * _x_x_6)) == -9.0) || (((x_6 + (-1.0 * _x_x_6)) == -18.0) || (((x_4 + (-1.0 * _x_x_6)) == -10.0) || (((x_2 + (-1.0 * _x_x_6)) == -17.0) || ((x_3 + (-1.0 * _x_x_6)) == -5.0)))))))) && ((((x_11 + (-1.0 * _x_x_7)) <= -1.0) && (((x_9 + (-1.0 * _x_x_7)) <= -5.0) && (((x_8 + (-1.0 * _x_x_7)) <= -1.0) && (((x_4 + (-1.0 * _x_x_7)) <= -15.0) && (((x_2 + (-1.0 * _x_x_7)) <= -8.0) && ((x_3 + (-1.0 * _x_x_7)) <= -15.0)))))) && (((x_11 + (-1.0 * _x_x_7)) == -1.0) || (((x_9 + (-1.0 * _x_x_7)) == -5.0) || (((x_8 + (-1.0 * _x_x_7)) == -1.0) || (((x_4 + (-1.0 * _x_x_7)) == -15.0) || (((x_2 + (-1.0 * _x_x_7)) == -8.0) || ((x_3 + (-1.0 * _x_x_7)) == -15.0)))))))) && ((((x_11 + (-1.0 * _x_x_8)) <= -5.0) && (((x_10 + (-1.0 * _x_x_8)) <= -4.0) && (((x_8 + (-1.0 * _x_x_8)) <= -12.0) && (((x_5 + (-1.0 * _x_x_8)) <= -7.0) && (((x_0 + (-1.0 * _x_x_8)) <= -2.0) && ((x_4 + (-1.0 * _x_x_8)) <= -14.0)))))) && (((x_11 + (-1.0 * _x_x_8)) == -5.0) || (((x_10 + (-1.0 * _x_x_8)) == -4.0) || (((x_8 + (-1.0 * _x_x_8)) == -12.0) || (((x_5 + (-1.0 * _x_x_8)) == -7.0) || (((x_0 + (-1.0 * _x_x_8)) == -2.0) || ((x_4 + (-1.0 * _x_x_8)) == -14.0)))))))) && ((((x_11 + (-1.0 * _x_x_9)) <= -18.0) && (((x_9 + (-1.0 * _x_x_9)) <= -18.0) && (((x_5 + (-1.0 * _x_x_9)) <= -19.0) && (((x_4 + (-1.0 * _x_x_9)) <= -16.0) && (((x_0 + (-1.0 * _x_x_9)) <= -19.0) && ((x_1 + (-1.0 * _x_x_9)) <= -2.0)))))) && (((x_11 + (-1.0 * _x_x_9)) == -18.0) || (((x_9 + (-1.0 * _x_x_9)) == -18.0) || (((x_5 + (-1.0 * _x_x_9)) == -19.0) || (((x_4 + (-1.0 * _x_x_9)) == -16.0) || (((x_0 + (-1.0 * _x_x_9)) == -19.0) || ((x_1 + (-1.0 * _x_x_9)) == -2.0)))))))) && ((((x_11 + (-1.0 * _x_x_10)) <= -5.0) && (((x_8 + (-1.0 * _x_x_10)) <= -10.0) && (((x_6 + (-1.0 * _x_x_10)) <= -2.0) && (((x_5 + (-1.0 * _x_x_10)) <= -12.0) && (((x_1 + (-1.0 * _x_x_10)) <= -10.0) && ((x_2 + (-1.0 * _x_x_10)) <= -8.0)))))) && (((x_11 + (-1.0 * _x_x_10)) == -5.0) || (((x_8 + (-1.0 * _x_x_10)) == -10.0) || (((x_6 + (-1.0 * _x_x_10)) == -2.0) || (((x_5 + (-1.0 * _x_x_10)) == -12.0) || (((x_1 + (-1.0 * _x_x_10)) == -10.0) || ((x_2 + (-1.0 * _x_x_10)) == -8.0)))))))) && ((((x_10 + (-1.0 * _x_x_11)) <= -13.0) && (((x_9 + (-1.0 * _x_x_11)) <= -17.0) && (((x_5 + (-1.0 * _x_x_11)) <= -3.0) && (((x_3 + (-1.0 * _x_x_11)) <= -3.0) && (((x_0 + (-1.0 * _x_x_11)) <= -16.0) && ((x_2 + (-1.0 * _x_x_11)) <= -8.0)))))) && (((x_10 + (-1.0 * _x_x_11)) == -13.0) || (((x_9 + (-1.0 * _x_x_11)) == -17.0) || (((x_5 + (-1.0 * _x_x_11)) == -3.0) || (((x_3 + (-1.0 * _x_x_11)) == -3.0) || (((x_0 + (-1.0 * _x_x_11)) == -16.0) || ((x_2 + (-1.0 * _x_x_11)) == -8.0)))))))) && (_EL_U_518 == ((_x__EL_U_518 && ((_x_x_7 + (-1.0 * _x_x_11)) <= 7.0)) || (-13.0 <= (_x_x_4 + (-1.0 * _x_x_7))))));
x_6 = _x_x_6;
_EL_U_518 = _x__EL_U_518;
x_0 = _x_x_0;
x_11 = _x_x_11;
x_7 = _x_x_7;
x_3 = _x_x_3;
x_1 = _x_x_1;
x_4 = _x_x_4;
x_5 = _x_x_5;
x_9 = _x_x_9;
x_8 = _x_x_8;
x_10 = _x_x_10;
x_2 = _x_x_2;
}
}
|
the_stack_data/96267.c | #include <stdio.h>
int main()
{
int m,n;
scanf("%d%d",&m,&n);
int sum;
sum=m;
for(int i=1;i<n;i++){
sum=sum*(m-i);
}
for(int j=1;j<=n;j++){
sum=sum/j;
}
printf("%d\n",sum);
return 0;
} |
the_stack_data/430441.c | /******************************************************************************
* Name : mutexes_cond_using_pthread_mutexes.c
* Title : Mutexes implemented using POSIX thread condition variables.
*
* Copyright : 2010 by Imagination Technologies Limited.
* All rights reserved. No part of this software, either
* material or conceptual may be copied or distributed,
* transmitted, transcribed, stored in a retrieval system
* or translated into any human or computer language in any
* form by any means, electronic, mechanical, manual or
* other-wise, or disclosed to third parties without the
* express written permission of Imagination Technologies
* Limited, Unit 8, HomePark Industrial Estate,
* King's Langley, Hertfordshire, WD4 8LZ, U.K.
*
* Description : Mutexes using pthread mutexes, on condition multithread
* operation is detected.
*
* Platform : Linux
*
* Modifications:-
* $Log: mutexes_cond_using_pthread_mutexes.c $
******************************************************************************/
#if defined(PVR_MUTEXES_COND_USING_PTHREAD_MUTEXES)
/*
* Taking posix thread (PT) mutexes seems to be more exspensive than expected
* on some platforms. This implementation of PVR mutexes tries to avoid
* taking PT mutexes for non-multithreaded environments.
*/
#define LIKELY(x) __builtin_expect((x), 1)
#define UNLIKELY(x) __builtin_expect((x), 0)
/* Time to wait before retrying the resource lock */
#define PVR_MUTEX_SLEEP_US (10 * 1000)
/* The locking order is sPTMutex then sResourceLock */
struct pvr_mutex {
RESOURCE_LOCK sResourceLock;
pthread_mutex_t sPTMutex;
IMG_BOOL bGoingMultiThreaded;
IMG_BOOL bMultiThread;
};
static inline void PT_mutex_lock(pthread_mutex_t *psPTMutex)
{
IMG_INT iError = pthread_mutex_lock(psPTMutex);
if (iError != 0)
{
PVR_DPF((PVR_DBG_ERROR, "%s: pthread_mutex_lock failed (%d)", __FUNCTION__, iError));
abort();
}
}
static inline void PT_mutex_unlock(pthread_mutex_t *psPTMutex)
{
IMG_INT iError = pthread_mutex_unlock(psPTMutex);
if (iError != 0)
{
PVR_DPF((PVR_DBG_ERROR, "%s: pthread_mutex_unlock failed (%d)", __FUNCTION__, iError));
abort();
}
}
static inline void LockResource(RESOURCE_LOCK *psResourceLock)
{
for (;;)
{
if (TryLockResource(psResourceLock))
{
break;
}
/*
* If we couldn't get the resource lock, sleep for a
* while and try again. The sleep is to try and reduce
* problems due to livelock; when we try to take the
* lock on a CPU that already holds the lock.
* Calling sched_yield, as an alternative to
* sleeping, would not yield to another thread in
* all cases.
*/
PVRSRVWaitus(PVR_MUTEX_SLEEP_US);
}
}
/******************************************************************************
Function Name : PVRSRVCreateMutex
Inputs :
Outputs :
Returns :
Description :
******************************************************************************/
IMG_EXPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateMutex(PVRSRV_MUTEX_HANDLE *phMutex)
{
struct pvr_mutex *psPVRMutex;
IMG_INT iError;
#if defined(DEBUG)
pthread_mutexattr_t sPTAttr;
pthread_mutexattr_t *psPTAttr = &sPTAttr;
#else
pthread_mutexattr_t *psPTAttr = NULL;
#endif
psPVRMutex = malloc(sizeof(*psPVRMutex));
if (psPVRMutex == NULL)
{
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
memset(psPVRMutex, 0, sizeof(*psPVRMutex));
#if defined(DEBUG)
/*
* For the debug driver, enable error checking on mutexes.
* The non-debug driver uses the default mutex attributes.
*/
iError = pthread_mutexattr_init(psPTAttr);
if (iError != 0)
{
PVR_DPF((PVR_DBG_ERROR, "%s: pthread_mutexattr_init failed (%d)", __FUNCTION__, iError));
goto error_free;
}
iError = pthread_mutexattr_settype(psPTAttr, PTHREAD_MUTEX_ERRORCHECK);
if (iError != 0)
{
PVR_DPF((PVR_DBG_ERROR, "%s: pthread_mutexattr_settype failed (%d)", __FUNCTION__, iError));
goto error_attr;
}
#endif
iError = pthread_mutex_init(&psPVRMutex->sPTMutex, psPTAttr);
if (iError != 0)
{
PVR_DPF((PVR_DBG_ERROR, "%s: pthread_mutex_init failed (%d)", __FUNCTION__, iError));
goto error_attr;
}
#if defined(DEBUG)
iError = pthread_mutexattr_destroy(psPTAttr);
if (iError != 0)
{
PVR_DPF((PVR_DBG_ERROR, "%s: pthread_mutexattr_destroy failed (%d)", __FUNCTION__, iError));
}
#endif
*phMutex = (PVRSRV_MUTEX_HANDLE)psPVRMutex;
return PVRSRV_OK;
error_attr:
#if defined(DEBUG)
iError = pthread_mutexattr_destroy(psPTAttr);
if (iError != 0)
{
PVR_DPF((PVR_DBG_ERROR, "%s: pthread_mutexattr_destroy failed (%d)", __FUNCTION__, iError));
}
error_free:
#endif
free(psPVRMutex);
return PVRSRV_ERROR_INIT_FAILURE;
}
/******************************************************************************
Function Name : PVRSRVDestroyMutex
Inputs :
Outputs :
Returns :
Description :
******************************************************************************/
IMG_EXPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyMutex(PVRSRV_MUTEX_HANDLE hMutex)
{
struct pvr_mutex *psPVRMutex = (struct pvr_mutex *)hMutex;
IMG_INT iError;
iError = pthread_mutex_destroy(&psPVRMutex->sPTMutex);
if (iError != 0)
{
PVR_DPF((PVR_DBG_ERROR, "%s: pthread_mutex_destroy failed (%d)", __FUNCTION__, iError));
return PVRSRV_ERROR_MUTEX_DESTROY_FAILED;
}
free(psPVRMutex);
return PVRSRV_OK;
}
/******************************************************************************
Function Name : PVRSRVLockMutex
Inputs :
Outputs :
Returns :
Description :
******************************************************************************/
IMG_EXPORT void IMG_CALLCONV PVRSRVLockMutex(PVRSRV_MUTEX_HANDLE hMutex)
{
struct pvr_mutex *psPVRMutex = (struct pvr_mutex *)hMutex;
/*
* Once bMultiThread is set, it stays set. If it is unset, we
* will need to take the resource lock, and check the flag again,
* to avoid a race condition.
*/
if (UNLIKELY(psPVRMutex->bMultiThread))
{
PT_mutex_lock(&psPVRMutex->sPTMutex);
}
else
{
if (LIKELY(TryLockResource(&psPVRMutex->sResourceLock)))
{
/*
* Check bMultiThread again with the resource lock
* held, to avoid a race condition.
*/
if (UNLIKELY(psPVRMutex->bMultiThread))
{
UnlockResource(&psPVRMutex->sResourceLock);
PT_mutex_lock(&psPVRMutex->sPTMutex);
}
/*
* If bMultiThread is not set, we exit the
* function with the resource lock held, and
* the PT mutex unlocked. This is the fast
* path, for when there has been no contention
* for the PVR mutex.
*/
}
else
{
/*
* Each thread will go through this path at most
* once.
*/
/*
* Try to get the fast path to yield when
* the mutex is unlocked.
*/
psPVRMutex->bGoingMultiThreaded = IMG_TRUE;
PT_mutex_lock(&psPVRMutex->sPTMutex);
/*
* If another thread has been through this path,
* it will already have set bMultiThread, so we
* don't need to set it, avoiding the need to take
* the resource lock.
*/
if (!psPVRMutex->bMultiThread)
{
/*
* If we reach this point, we are waiting
* for another thread that has taken the
* fast path. We should reach this point
* at most once for each PVR mutex.
*/
LockResource(&psPVRMutex->sResourceLock);
psPVRMutex->bMultiThread = IMG_TRUE;
UnlockResource(&psPVRMutex->sResourceLock);
}
}
}
}
/*****************************************************************************
Function Name : PVRSRVUnlockMutex
Inputs :
Outputs :
Returns :
Description :
******************************************************************************/
IMG_EXPORT void IMG_CALLCONV PVRSRVUnlockMutex(PVRSRV_MUTEX_HANDLE hMutex)
{
struct pvr_mutex *psPVRMutex = (struct pvr_mutex *)hMutex;
/*
* Since both the PT mutex and the resource lock are held when
* bMultiThread is set, we know that the flag cannot change value
* whilst the PVR mutex is held, since we are holding either the
* resource lock, or the PT mutex.
*/
if (UNLIKELY(psPVRMutex->bMultiThread))
{
PT_mutex_unlock(&psPVRMutex->sPTMutex);
}
else
{
UnlockResource(&psPVRMutex->sResourceLock);
if (UNLIKELY(psPVRMutex->bGoingMultiThreaded))
{
/*
* Give other threads a chance to run if there
* is mutex contention. Without the yield,
* the fast path code would have an advantage
* when competing for the resource lock, since
* the slow path code sleeps between attempts
* to take the resource lock.
*/
#if defined(_POSIX_PRIORITY_SCHEDULING)
sched_yield();
#else
PVRSRVWaitus(PVR_MUTEX_SLEEP_US);
#endif
}
}
}
#endif /* defined(PVR_MUTEXES_COND_USING_PTHREAD_MUTEXES) */
|
the_stack_data/220456446.c | #include <stdio.h>
#include <math.h>
int main()
{
double x, y, yMax, yMin;
while (scanf("%lf %lf", &x, &y) && !(x == 0 && y == 0))
{
yMax = 3 * x;
yMin = x / 3;
if (x > 0)
{
if (y <= yMax && y >= yMin)
{
printf("INTERIOR\n");
}
else
{
printf("EXTERIOR\n");
}
}
else
{
if(y >= yMax && y <= yMin)
{
printf("INTERIOR\n");
}
else
{
printf("EXTERIOR\n");
}
}
}
return(0);
}
/*if (x >= 0)
{
if (y <= yMax && y >= yMin)
{
printf("INTERIOR\n");
}
else
{
printf("EXTERIOR\n");
}
}
else
{
if (y >= yMax && y <= yMin)
{
printf("INTERIOR\n");
}
else
{
printf("EXTERIOR\n");
}
}*/
|
the_stack_data/62637494.c | #include <openssl/md5.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#define STD_BLOCKSIZE 1024
void showHelp(){
printf("\
onmd-build -f <filename> -b <blocksize> -o <outputFile> -v -d -h\n\
\n\
-f <filename> - binary filename, to make hash table from.\n\
-b <blocksize> - blocksize for hashes.\n\
-o <outputFile> - output filename (hash table).\n\
-v - verbose.\n\
-d - debug.\n\
-h - show this help\n\
\n\
Smaller blocksize = Bigger hash table, but smaller rebuild time.\n\
Bigger blocksize = Smaller hash table, but long rebuild time.\n\
Standard blocksize: %d\n", STD_BLOCKSIZE);
exit(0);
}
int main(int argc, char *argv[]){
// Values
char filename[255];
char outputfilename[255];
memset(filename, 0x00, 255); // Quick clean filename
memset(outputfilename, 0x00, 255);
unsigned int blocksize = STD_BLOCKSIZE;
int verbose = 0;
int debug = 0;
int opt; // Parse arguments
while((opt = getopt(argc, argv, ":f:b:o:vdh")) != -1){
switch(opt){
case 'f': // Filename
strcpy(filename, optarg);
break;
case 'b': // Blocksize
blocksize = (unsigned int)atoi(optarg);
break;
case 'o': // Output file
strcpy(outputfilename, optarg);
break;
case 'v': // Verbose
verbose = 1;
break;
case 'd': // Debug
debug = 1;
break;
case 'h': // Help
showHelp();
break;
case ':':
printf("Value missing\n");
break;
case '?':
printf("Unknown option: %c\n", optopt);
break;
}
}
if(strlen(filename) < 1){
printf("Error! No filename, check onmd-build -h\n");
return 1;
}
if(strlen(outputfilename) < 1){
printf("Error! No output filename! Check onmd-build -h\n");
return 3;
}
printf("Filename: %s, Output: %s, Blocksize: %u\n", filename, outputfilename, blocksize);
// Open file
FILE *fptr;
fptr = fopen(filename, "rb");
if(fptr == NULL){
printf("Error! File not found.\n");
return 2;
}
// Open output
FILE *fptrout;
fptrout = fopen(outputfilename, "wb");
if(fptrout == NULL){
printf("Error! Can't create output file.\n");
return 4;
}
// Calculate hashes for blocks
unsigned char digest[MD5_DIGEST_LENGTH];
unsigned char block[blocksize];
size_t block_byte_read;
unsigned int lastBlockSize;
unsigned long blocks_n = 0;
while(1){
block_byte_read = fread(block, 1, blocksize, fptr); // Read next block
if(block_byte_read == blocksize){
// Calculate block hash
MD5(block, blocksize, digest);
if(verbose){
for(int i = 0; i < MD5_DIGEST_LENGTH; i++)
printf("%x", digest[i]);
printf("\n");
}
blocks_n++;
fwrite(digest, 1, MD5_DIGEST_LENGTH, fptrout); // write hash to output
}else if((block_byte_read < blocksize) && (block_byte_read != 0)){
// LAST BLOCK!
if(verbose) printf("LAST BLOCK: %lu BYTES! ", block_byte_read);
// Calculate block hash
MD5(block, blocksize, digest);
if(verbose){
for(int i = 0; i < MD5_DIGEST_LENGTH; i++)
printf("%x", digest[i]);
printf("\n");
}
blocks_n++;
lastBlockSize = block_byte_read;
fwrite(digest, 1, MD5_DIGEST_LENGTH, fptrout); // write hash to output
break;
}else if(block_byte_read == 0){
// If there is exactly zero bytes to read, just end
lastBlockSize = 0;
if(verbose) printf("Nothing to read.\n");
break;
}
}
if(verbose) printf("Total blocks: %lu, Last block bytes: %u\n", blocks_n, lastBlockSize);
unsigned long filelength = ftell(fptr);
if(!debug){ // Write metadata to output
fwrite(&blocksize, 1, sizeof(unsigned int), fptrout);
fwrite(&blocks_n, 1, sizeof(unsigned long), fptrout);
fwrite(&lastBlockSize, 1, sizeof(unsigned int), fptrout);
fwrite(&filelength, 1, sizeof(unsigned long), fptrout);
}
if(debug) printf("DEBUG: %ld, %ld\n", sizeof(unsigned int), sizeof(unsigned long));
fclose(fptrout);
fclose(fptr);
printf("Finished!\n");
return 0;
}
|
the_stack_data/40762965.c | #include <stdio.h>
int main() {
void* ptr[10] = {0};
// allocates of sie 0x20 tcahce bin
for(int i = 0; i < 10; i++) {
ptr[i] = malloc(16);
}
// frees until some go into fastbin
for(int i = 0; i < 10; i++) {
free(ptr[i]);
}
getchar(); // bp
}
|
the_stack_data/76721.c | /* Premake's Lua scripts, as static data buffers for release mode builds */
/* DO NOT EDIT - this file is autogenerated - see BUILD.txt */
/* To regenerate this file, run: premake4 embed */
const char* builtin_scripts[] = {
/* base/os.lua */
"function os.executef(cmd, ...)\nlocal arg={...}\ncmd = string.format(cmd, table.unpack(arg))\nreturn os.execute(cmd)\nend\nlocal function parse_ld_so_conf(conf_file)\nlocal first, last\nlocal dirs = { }\nlocal file = io.open(conf_file)\nif file == nil then\nreturn dirs\nend\nfor line in file:lines() do\nfirst = line:find(\"#\", 1, true)\nif first ~= nil then\nline = line:sub(1, first - 1)\nend\nif line ~= \"\" then\nfirst, last = line:find(\"include%s+\")\nif first ~= nil then\nlocal include_glob = line:sub(last + 1)\nlocal includes = os.matchfiles(include_glob)\nfor _, v in ipairs(includes) do\ndirs = table.join(dirs, parse_ld_so_conf(v))\nend\nelse\ntable.insert(dirs, line)\nend\nend\nend\nreturn dirs\nend\nfunction os.findlib(libname)\nlocal path, formats\nif os.is(\"windows\") then\nformats = { \"%s.dll\", \"%s\" }\npath = os.getenv(\"PATH\")\nelse\nif os.is(\"macosx\") then\nformats = { \"lib%s.dylib\", \"%s.dylib\" }\npath = os.getenv(\"DYLD_LIBRARY_PATH\")\nelse\nformats = { \"lib%s.so\", \"%s.so\" }\np"
"ath = os.getenv(\"LD_LIBRARY_PATH\") or \"\"\nfor _, v in ipairs(parse_ld_so_conf(\"/etc/ld.so.conf\")) do\npath = path .. \":\" .. v\nend\nend\ntable.insert(formats, \"%s\")\npath = path or \"\"\nif os.is64bit() then\npath = path .. \":/lib64:/usr/lib64/:usr/local/lib64\"\nend\npath = path .. \":/lib:/usr/lib:/usr/local/lib\"\nend\nfor _, fmt in ipairs(formats) do\nlocal name = string.format(fmt, libname)\nlocal result = os.pathsearch(name, path)\nif result then return result end\nend\nend\nfunction os.get()\nreturn _OPTIONS.os or _OS\nend\nfunction os.is(id)\nreturn (os.get():lower() == id:lower())\nend\nlocal _64BitHostTypes = {\n\"x86_64\",\n\"ia64\",\n\"amd64\",\n\"ppc64\",\n\"powerpc64\",\n\"sparc64\"\n}\nfunction os.is64bit()\nif (os._is64bit()) then\nreturn true\nend\nlocal arch = \"\"\nif _OS == \"windows\" then\narch = os.getenv(\"PROCESSOR_ARCHITECTURE\")\nelseif _OS == \"macosx\" then\narch = os.outputof(\"echo $HOSTTYPE\")\nelse\narch = os.outputof(\"uname -m\")\nend\nif nil ~= arch then\narch = a"
"rch:lower()\nfor _, hosttype in ipairs(_64BitHostTypes) do\nif arch:find(hosttype) then\nreturn true\nend\nend\nend\nreturn false\nend\nlocal function domatch(result, mask, wantfiles)\nif mask:startswith(\"./\") then\nmask = mask:sub(3)\nend\nlocal basedir = mask\nlocal starpos = mask:find(\"%*\")\nif starpos then\nbasedir = basedir:sub(1, starpos - 1)\nend\nbasedir = path.getdirectory(basedir)\nif (basedir == \".\") then basedir = \"\" end\nlocal recurse = mask:find(\"**\", nil, true)\nmask = path.wildcards(mask)\nlocal function matchwalker(basedir)\nlocal wildcard = path.join(basedir, \"*\")\nlocal m = os.matchstart(wildcard)\nwhile (os.matchnext(m)) do\nlocal isfile = os.matchisfile(m)\nif ((wantfiles and isfile) or (not wantfiles and not isfile)) then\nlocal fname = path.join(basedir, os.matchname(m))\nif fname:match(mask) == fname then\ntable.insert(result, fname)\nend\nend\nend\nos.matchdone(m)\nif recurse then\nm = os.matchstart(wildcard)\nwhile (os.matchnext(m)) do\nif not os.matchisfile(m) then\nlocal"
" dirname = os.matchname(m)\nmatchwalker(path.join(basedir, dirname))\nend\nend\nos.matchdone(m)\nend\nend\nmatchwalker(basedir)\nend\nfunction os.matchdirs(...)\nlocal arg={...}\nlocal result = { }\nfor _, mask in ipairs(arg) do\ndomatch(result, mask, false)\nend\nreturn result\nend\nfunction os.matchfiles(...)\nlocal arg={...}\nlocal result = { }\nfor _, mask in ipairs(arg) do\ndomatch(result, mask, true)\nend\nreturn result\nend\nlocal builtin_mkdir = os.mkdir\nfunction os.mkdir(p)\nlocal dir = iif(p:startswith(\"/\"), \"/\", \"\")\nfor part in p:gmatch(\"[^/]+\") do\ndir = dir .. part\nif (part ~= \"\" and not path.isabsolute(part) and not os.isdir(dir)) then\nlocal ok, err = builtin_mkdir(dir)\nif (not ok) then\nreturn nil, err\nend\nend\ndir = dir .. \"/\"\nend\nreturn true\nend\nfunction os.outputof(cmd)\nlocal pipe = io.popen(cmd)\nlocal result = pipe:read('*a')\npipe:close()\nreturn result\nend\nlocal builtin_rmdir = os.rmdir\nfunction os.rmdir(p)\nlocal dirs = os.matchdirs(p .. \"/*\")\nfor _, dname i"
"n ipairs(dirs) do\nos.rmdir(dname)\nend\nlocal files = os.matchfiles(p .. \"/*\")\nfor _, fname in ipairs(files) do\nos.remove(fname)\nend\nbuiltin_rmdir(p)\nend\n",
/* base/path.lua */
"function path.getbasename(p)\nlocal name = path.getname(p)\nlocal i = name:findlast(\".\", true)\nif (i) then\nreturn name:sub(1, i - 1)\nelse\nreturn name\nend\nend\nfunction path.removeext(name)\nlocal i = name:findlast(\".\", true)\nif (i) then\nreturn name:sub(1, i - 1)\nelse\nreturn name\nend\nend\nfunction path.getdirectory(p)\nlocal i = p:findlast(\"/\", true)\nif (i) then\nif i > 1 then i = i - 1 end\nreturn p:sub(1, i)\nelse\nreturn \".\"\nend\nend\nfunction path.getdrive(p)\nlocal ch1 = p:sub(1,1)\nlocal ch2 = p:sub(2,2)\nif ch2 == \":\" then\nreturn ch1\nend\nend\nfunction path.getextension(p)\nlocal i = p:findlast(\".\", true)\nif (i) then\nreturn p:sub(i)\nelse\nreturn \"\"\nend\nend\nfunction path.getname(p)\nlocal i = p:findlast(\"[/\\\\]\")\nif (i) then\nreturn p:sub(i + 1)\nelse\nreturn p\nend\nend\nfunction path.getcommonbasedir(a, b)\na = path.getdirectory(a)..'/'\nb = path.getdirectory(b)..'/'\nlocal idx = 0\nwhile (true) do\nlocal tst = a:find('/', idx + 1, true)\nif tst then\nif a:sub(1,t"
"st) == b:sub(1,tst) then\nidx = tst\nelse\nbreak\nend\nelse\nbreak\nend\nend\nlocal result = ''\nif idx > 1 then\nresult = a:sub(1, idx - 1)-- Remove the trailing slash to be consistent with other functions.\nend\nreturn result\nend\nfunction path.hasextension(fname, extensions)\nlocal fext = path.getextension(fname):lower()\nif type(extensions) == \"table\" then\nfor _, extension in pairs(extensions) do\nif fext == extension then\nreturn true\nend\nend\nreturn false\nelse\nreturn (fext == extensions)\nend\nend\nfunction path.iscfile(fname)\nreturn path.hasextension(fname, { \".c\", \".m\" })\nend\nfunction path.iscppfile(fname)\nreturn path.hasextension(fname, { \".cc\", \".cpp\", \".cxx\", \".c++\", \".c\", \".m\", \".mm\" })\nend\nfunction path.iscxfile(fname)\nreturn path.hasextension(fname, \".cx\")\nend\nfunction path.isobjcfile(fname)\nreturn path.hasextension(fname, { \".m\", \".mm\" })\nend\nfunction path.iscppheader(fname)\nreturn path.hasextension(fname, { \".h\", \".hh\", \".hpp\", \".hxx\" })\nend"
"\nfunction path.isappxmanifest(fname)\nreturn path.hasextension(fname, \".appxmanifest\")\nend\nfunction path.isandroidbuildfile(fname)\nreturn path.getname(fname) == \"AndroidManifest.xml\"\nend\nfunction path.isnatvis(fname)\nreturn path.hasextension(fname, \".natvis\")\nend\nfunction path.isasmfile(fname)\nreturn path.hasextension(fname, { \".asm\", \".s\", \".S\" })\nend\nfunction path.isvalafile(fname)\nreturn path.hasextension(fname, \".vala\")\nend\nfunction path.isswiftfile(fname)\nreturn path.hasextension(fname, \".swift\")\nend\nfunction path.issourcefile(fname)\nreturn path.iscfile(fname)\nor path.iscppfile(fname)\nor path.iscxfile(fname)\nor path.isasmfile(fname)\nor path.isvalafile(fname)\nor path.isswiftfile(fname)\nend\nfunction path.issourcefilevs(fname)\nreturn path.hasextension(fname, { \".cc\", \".cpp\", \".cxx\", \".c++\", \".c\" })\nor path.iscxfile(fname)\nend\nfunction path.isobjectfile(fname)\nreturn path.hasextension(fname, { \".o\", \".obj\" })\nend\nfunction path.isresourcefile(fname"
")\nreturn path.hasextension(fname, \".rc\")\nend\nfunction path.isimagefile(fname)\nlocal extensions = { \".png\" }\nlocal ext = path.getextension(fname):lower()\nreturn table.contains(extensions, ext)\nend\nfunction path.join(...)\nlocal arg={...}\nlocal numargs = select(\"#\", ...)\nif numargs == 0 then\nreturn \"\";\nend\nlocal allparts = {}\nfor i = numargs, 1, -1 do\nlocal part = select(i, ...)\nif part and #part > 0 and part ~= \".\" then\nwhile part:endswith(\"/\") do\npart = part:sub(1, -2)\nend\ntable.insert(allparts, 1, part)\nif path.isabsolute(part) then\nbreak\nend\nend\nend\nreturn table.concat(allparts, \"/\")\nend\nfunction path.rebase(p, oldbase, newbase)\np = path.getabsolute(path.join(oldbase, p))\np = path.getrelative(newbase, p)\nreturn p\nend\nfunction path.translate(p, sep)\nif (type(p) == \"table\") then\nlocal result = { }\nfor _, value in ipairs(p) do\ntable.insert(result, path.translate(value))\nend\nreturn result\nelse\nif (not sep) then\nif (os.is(\"windows\")) then\nsep = \"\\\\\""
"\nelse\nsep = \"/\"\nend\nend\nlocal result = p:gsub(\"[/\\\\]\", sep)\nreturn result\nend\nend\nfunction path.wildcards(pattern)\npattern = pattern:gsub(\"([%+%.%-%^%$%(%)%%])\", \"%%%1\")\npattern = pattern:gsub(\"%*%*\", \"\\001\")\npattern = pattern:gsub(\"%*\", \"\\002\")\npattern = pattern:gsub(\"\\001\", \".*\")\npattern = pattern:gsub(\"\\002\", \"[^/]*\")\nreturn pattern\nend\nfunction path.trimdots(p)\nlocal changed\nrepeat\nchanged = true\nif p:startswith(\"./\") then\np = p:sub(3)\nelseif p:startswith(\"../\") then\np = p:sub(4)\nelse\nchanged = false\nend\nuntil not changed\nreturn p\nend\nfunction path.rebase(p, oldbase, newbase)\np = path.getabsolute(path.join(oldbase, p))\np = path.getrelative(newbase, p)\nreturn p\nend\nfunction path.replaceextension(p, newext)\nlocal ext = path.getextension(p)\nif not ext then\nreturn p\nend\nif #newext > 0 and not newext:findlast(\".\", true) then\nnewext = \".\"..newext\nend\nreturn p:match(\"^(.*)\"..ext..\"$\")..newext\nend\n",
/* base/string.lua */
"function string.explode(s, pattern, plain)\nif (pattern == '') then return false end\nlocal pos = 0\nlocal arr = { }\nfor st,sp in function() return s:find(pattern, pos, plain) end do\ntable.insert(arr, s:sub(pos, st-1))\npos = sp + 1\nend\ntable.insert(arr, s:sub(pos))\nreturn arr\nend\nfunction string.findlast(s, pattern, plain)\nlocal curr = 0\nlocal term = nil\nrepeat\nlocal next, nextterm = s:find(pattern, curr + 1, plain)\nif (next) then\ncurr = next\nterm = nextterm\nend\nuntil (not next)\nif (curr > 0) then\nreturn curr, term\nend\nend\nfunction string.startswith(haystack, needle)\nreturn (haystack:find(needle, 1, true) == 1)\nend\nfunction string.trim(s)\nreturn (s:gsub(\"^%s*(.-)%s*$\", \"%1\"))\nend\n",
/* base/table.lua */
"function table.contains(t, value)\nfor _, v in pairs(t) do\nif v == value then return true end\nend\nreturn false\nend\nfunction table.icontains(t, value)\nfor _, v in ipairs(t) do\nif v == value then return true end\nend\nreturn false\nend\nfunction table.deepcopy(object)\nlocal seen = {}\nlocal function copy(object)\nif type(object) ~= \"table\" then\nreturn object\nelseif seen[object] then\nreturn seen[object]\nend\nlocal clone = {}\nseen[object] = clone\nfor key, value in pairs(object) do\nclone[key] = copy(value)\nend\nsetmetatable(clone, getmetatable(object))\nreturn clone\nend\nreturn copy(object)\nend\nfunction table.extract(arr, fname)\nlocal result = { }\nfor _,v in ipairs(arr) do\ntable.insert(result, v[fname])\nend\nreturn result\nend\nfunction table.flatten(arr)\nlocal result = { }\nlocal function flatten(arr)\nfor _, v in ipairs(arr) do\nif type(v) == \"table\" then\nflatten(v)\nelse\ntable.insert(result, v)\nend\nend\nend\nflatten(arr)\nreturn result\nend\nfunction table.implode(arr, before, aft"
"er, between)\nlocal result = \"\"\nfor _,v in ipairs(arr) do\nif (result ~= \"\" and between) then\nresult = result .. between\nend\nresult = result .. before .. v .. after\nend\nreturn result\nend\nfunction table.insertflat(tbl, values)\nif type(values) == \"table\" then\nfor _, value in ipairs(values) do\ntable.insertflat(tbl, value)\nend\nelse\ntable.insert(tbl, values)\nend\nend\nfunction table.isempty(t)\nreturn next(t) == nil\nend\nfunction table.join(...)\nlocal arg={...}\nlocal result = { }\nfor _,t in ipairs(arg) do\nif type(t) == \"table\" then\nfor _,v in ipairs(t) do\ntable.insert(result, v)\nend\nelse\ntable.insert(result, t)\nend\nend\nreturn result\nend\nfunction table.keys(tbl)\nlocal keys = {}\nfor k, _ in pairs(tbl) do\ntable.insert(keys, k)\nend\nreturn keys\nend\nfunction table.sortedpairs(t)\nlocal keys = table.keys(t)\nlocal i = 0\ntable.sort(keys)\nreturn function()\ni = i + 1\nif keys[i] == nil then\nreturn nil\nend\nreturn keys[i], t[keys[i]]\nend\nend\nfunction table.merge(...)\nlocal"
" arg={...}\nlocal result = { }\nfor _,t in ipairs(arg) do\nif type(t) == \"table\" then\nfor k,v in pairs(t) do\nresult[k] = v\nend\nelse\nerror(\"invalid value\")\nend\nend\nreturn result\nend\nfunction table.translate(arr, translation)\nlocal result = { }\nfor _, value in ipairs(arr) do\nlocal tvalue\nif type(translation) == \"function\" then\ntvalue = translation(value)\nelse\ntvalue = translation[value]\nend\nif (tvalue) then\ntable.insert(result, tvalue)\nend\nend\nreturn result\nend\nfunction table.reverse(arr)\nfor i=1, math.floor(#arr / 2) do\narr[i], arr[#arr - i + 1] = arr[#arr - i + 1], arr[i]\nend\nreturn arr\nend\nfunction table.arglist(arg, value)\nif #value > 0 then\nlocal args = {}\nfor _, val in ipairs(value) do\ntable.insert(args, string.format(\"%s %s\", arg, val))\nend\nreturn table.concat(args, \" \")\nelse\nreturn \"\"\nend\nend\n",
/* base/io.lua */
"io.eol = \"\\n\"\nio.indent = \"\\t\"\nio.indentLevel = 0\nlocal function _escaper(v) return v end\n_esc = _escaper\nfunction io.capture()\nlocal prev = io.captured\nio.captured = ''\nreturn prev\nend\nfunction io.endcapture(restore)\nlocal captured = io.captured\nio.captured = restore\nreturn captured\nend\nlocal builtin_open = io.open\nfunction io.open(fname, mode)\nif (mode) then\nif (mode:find(\"w\")) then\nlocal dir = path.getdirectory(fname)\nok, err = os.mkdir(dir)\nif (not ok) then\nerror(err, 0)\nend\nend\nend\nreturn builtin_open(fname, mode)\nend\nfunction io.printf(msg, ...)\nlocal arg={...}\nif not io.eol then\nio.eol = \"\\n\"\nend\nif not io.indent then\nio.indent = \"\\t\"\nend\nif type(msg) == \"number\" then\ns = string.rep(io.indent, msg) .. string.format(table.unpack(arg))\nelse\ns = string.format(msg, table.unpack(arg))\nend\nif io.captured then\nio.captured = io.captured .. s .. io.eol\nelse\nio.write(s)\nio.write(io.eol)\nend\nend\nfunction io.xprintf(msg, ...)\nlocal arg = "
"{...}\nfor i = 1, #arg do\narg[i] = io.esc(arg[i])\nend\nio.printf(msg, unpack(arg))\nend\nfunction io.esc(value)\nif type(value) == \"table\" then\nlocal result = {}\nlocal n = #value\nfor i = 1, n do\ntable.insert(result, io.esc(value[i]))\nend\nreturn result\nend\nreturn _esc(value or \"\")\nend\nfunction io.escaper(func)\n_esc = func or _escaper\nend\n_p = io.printf\n_x = io.xprintf\n",
/* base/globals.lua */
"premake = { }\npremake.platforms =\n{\nNative =\n{\ncfgsuffix = \"\",\n},\nx32 =\n{\ncfgsuffix = \"32\",\n},\nx64 =\n{\ncfgsuffix = \"64\",\n},\nUniversal =\n{\ncfgsuffix = \"univ\",\n},\nUniversal32 =\n{\ncfgsuffix = \"univ32\",\n},\nUniversal64 =\n{\ncfgsuffix = \"univ64\",\n},\nPS3 =\n{\ncfgsuffix = \"ps3\",\niscrosscompiler = true,\nnosharedlibs = true,\nnamestyle = \"PS3\",\n},\nWiiDev =\n{\ncfgsuffix = \"wii\",\niscrosscompiler = true,\nnamestyle = \"PS3\",\n},\nXbox360 =\n{\ncfgsuffix = \"xbox360\",\niscrosscompiler = true,\nnamestyle = \"windows\",\n},\nPowerPC =\n{\ncfgsuffix = \"ppc\",\niscrosscompiler = true,\n},\nARM =\n{\ncfgsuffix = \"ARM\",\niscrosscompiler = true,\n},\nOrbis =\n{\ncfgsuffix = \"orbis\",\niscrosscompiler = true,\nnamestyle = \"Orbis\",\n},\nDurango =\n{\ncfgsuffix = \"durango\",\niscrosscompiler = true,\nnosharedlibs = true,\nnamestyle = \"windows\",\n},\nTegraAndroi"
"d =\n{\ncfgsuffix = \"tegraandroid\",\niscrosscompiler = true,\nnamestyle = \"TegraAndroid\",\n},\nNX32 =\n{\ncfgsuffix = \"nx32\",\niscrosscompiler = true,\nnamestyle = \"NX\",\n},\nNX64 =\n{\ncfgsuffix = \"nx64\",\niscrosscompiler = true,\nnamestyle = \"NX\",\n},\nEmscripten =\n{\ncfgsuffix = \"emscripten\",\niscrosscompiler = true,\nnosharedlibs = true,\nnamestyle = \"Emscripten\",\n},\n}\nlocal builtin_dofile = dofile\nfunction dofile(fname)\nlocal oldcwd = os.getcwd()\nlocal oldfile = _SCRIPT\nif (not os.isfile(fname)) then\nlocal path = os.pathsearch(fname, _OPTIONS[\"scripts\"], os.getenv(\"PREMAKE_PATH\"))\nif (path) then\nfname = path..\"/\"..fname\nend\nend\n_SCRIPT = path.getabsolute(fname)\nlocal newcwd = path.getdirectory(_SCRIPT)\nos.chdir(newcwd)\nlocal a, b, c, d, e, f = builtin_dofile(_SCRIPT)\n_SCRIPT = oldfile\nos.chdir(oldcwd)\nreturn a, b, c, d, e, f\nend\nfunction iif(expr, trueval, falseval)\nif (expr) then\nreturn trueval\nelse\nreturn "
"falseval\nend\nend\nfunction include(fname)\nlocal dir, name = premake.findDefaultScript(fname, false)\nif dir ~= nil then\nreturn dofile(dir .. \"/\" .. name)\nend\nreturn nil\nend\nfunction printf(msg, ...)\nlocal arg={...}\nprint(string.format(msg, table.unpack(arg)))\nend\nfunction typex(t)\nlocal mt = getmetatable(t)\nif (mt) then\nif (mt.__type) then\nreturn mt.__type\nend\nend\nreturn type(t)\nend\n",
/* base/action.lua */
"premake.action = { }\npremake.action.list = { }\nfunction premake.action.add(a)\nlocal missing\nfor _, field in ipairs({\"description\", \"trigger\"}) do\nif (not a[field]) then\nmissing = field\nend\nend\nif (missing) then\nerror(\"action needs a \" .. missing, 3)\nend\npremake.action.list[a.trigger] = a\nend\nfunction premake.action.call(name)\nlocal a = premake.action.list[name]\nfor sln in premake.solution.each() do\nif a.onsolution then\na.onsolution(sln)\nend\nif sln.postsolutioncallbacks then\nfor _,cb in ipairs(sln.postsolutioncallbacks) do\ncb(sln)\nend\nend\nfor prj in premake.solution.eachproject(sln) do\nif a.onproject then\na.onproject(prj)\nend\nif prj.postprojectcallbacks then\nfor _,cb in ipairs(prj.postprojectcallbacks) do\ncb(prj)\nend\nend\nend\nend\nif a.execute then\na.execute()\nend\nend\nfunction premake.action.current()\nreturn premake.action.get(_ACTION)\nend\nfunction premake.action.get(name)\nreturn premake.action.list[name]\nend\nfunction premake.action.each()\nlocal keys = { }\nfor"
" _, action in pairs(premake.action.list) do\ntable.insert(keys, action.trigger)\nend\ntable.sort(keys)\nlocal i = 0\nreturn function()\ni = i + 1\nreturn premake.action.list[keys[i]]\nend\nend\nfunction premake.action.set(name)\n_ACTION = name\nlocal action = premake.action.get(name)\nif action then\n_OS = action.os or _OS\nend\nend\nfunction premake.action.supports(action, feature)\nif not action then\nreturn false\nend\nif action.valid_languages then\nif table.contains(action.valid_languages, feature) then\nreturn true\nend\nend\nif action.valid_kinds then\nif table.contains(action.valid_kinds, feature) then\nreturn true\nend\nend\nreturn false\nend\n",
/* base/option.lua */
"premake.option = { }\npremake.option.list = { }\nfunction premake.option.add(opt)\nlocal missing\nfor _, field in ipairs({ \"description\", \"trigger\" }) do\nif (not opt[field]) then\nmissing = field\nend\nend\nif (missing) then\nerror(\"option needs a \" .. missing, 3)\nend\npremake.option.list[opt.trigger] = opt\nend\nfunction premake.option.get(name)\nreturn premake.option.list[name]\nend\nfunction premake.option.each()\nlocal keys = { }\nfor _, option in pairs(premake.option.list) do\ntable.insert(keys, option.trigger)\nend\ntable.sort(keys)\nlocal i = 0\nreturn function()\ni = i + 1\nreturn premake.option.list[keys[i]]\nend\nend\nfunction premake.option.validate(values)\nfor key, value in pairs(values) do\nlocal opt = premake.option.get(key)\nif (not opt) then\nreturn false, \"invalid option '\" .. key .. \"'\"\nend\nif (opt.value and value == \"\") then\nreturn false, \"no value specified for option '\" .. key .. \"'\"\nend\nif opt.allowed then\nlocal found = false\nfor _, match in ipairs(opt.allowed) d"
"o\nif match[1] == value then\nfound = true\nbreak\nend\nend\nif not found then\nreturn false, string.format(\"invalid value '%s' for option '%s'\", value, key)\nend\nend\nend\nreturn true\nend\n",
/* base/tree.lua */
"premake.tree = { }\nlocal tree = premake.tree\nfunction premake.tree.new(n)\nlocal t = {\nname = n,\nchildren = { }\n}\nreturn t\nend\nfunction premake.tree.add(tr, p, onaddfunc)\nif p == \".\" then\nreturn tr\nend\nif p == \"/\" then\nreturn tr\nend\nlocal parentnode = tree.add(tr, path.getdirectory(p), onaddfunc)\nlocal childname = path.getname(p)\nif childname == \"..\" then\nreturn parentnode\nend\nlocal childnode = parentnode.children[childname]\nif not childnode or childnode.path ~= p then\nchildnode = tree.insert(parentnode, tree.new(childname))\nchildnode.path = p\nif onaddfunc then\nonaddfunc(childnode)\nend\nend\nreturn childnode\nend\nfunction premake.tree.insert(parent, child)\ntable.insert(parent.children, child)\nif child.name then\nparent.children[child.name] = child\nend\nchild.parent = parent\nreturn child\nend\nfunction premake.tree.getlocalpath(node)\nif node.parent.path then\nreturn node.name\nelseif node.cfg then\nreturn node.cfg.name\nelse\nreturn node.path\nend\nend\nfunction premake.tre"
"e.remove(node)\nlocal children = node.parent.children\nfor i = 1, #children do\nif children[i] == node then\ntable.remove(children, i)\nend\nend\nnode.children = {}\nend\nfunction premake.tree.sort(tr)\ntree.traverse(tr, {\nonnode = function(node)\ntable.sort(node.children, function(a,b)\nreturn a.name < b.name\nend)\nend\n}, true)\nend\nfunction premake.tree.traverse(t, fn, includeroot, initialdepth)\nlocal donode, dochildren\ndonode = function(node, fn, depth)\nif node.isremoved then\nreturn\nend\nif fn.onnode then\nfn.onnode(node, depth)\nend\nif #node.children > 0 then\nif fn.onbranchenter then\nfn.onbranchenter(node, depth)\nend\nif fn.onbranch then\nfn.onbranch(node, depth)\nend\ndochildren(node, fn, depth + 1)\nif fn.onbranchexit then\nfn.onbranchexit(node, depth)\nend\nelse\nif fn.onleaf then\nfn.onleaf(node, depth)\nend\nend\nend\ndochildren = function(parent, fn, depth)\nlocal i = 1\nwhile i <= #parent.children do\nlocal node = parent.children[i]\ndonode(node, fn, depth)\nif node == parent.children[i"
"] then\ni = i + 1\nend\nend\nend\nif not initialdepth then\ninitialdepth = 0\nend\nif includeroot then\ndonode(t, fn, initialdepth)\nelse\ndochildren(t, fn, initialdepth)\nend\nend\n",
/* base/solution.lua */
"premake.solution = { }\npremake.solution.list = { }\nfunction premake.solution.new(name)\nlocal sln = { }\ntable.insert(premake.solution.list, sln)\npremake.solution.list[name] = sln\nsetmetatable(sln, { __type=\"solution\" })\nsln.name = name\nsln.basedir = os.getcwd()\nsln.projects = { }\nsln.blocks = { }\nsln.configurations = { }\nsln.groups = { }\nsln.importedprojects = { }\nreturn sln\nend\nfunction premake.solution.each()\nlocal i = 0\nreturn function ()\ni = i + 1\nif i <= #premake.solution.list then\nreturn premake.solution.list[i]\nend\nend\nend\nfunction premake.solution.eachproject(sln)\nlocal i = 0\nreturn function ()\ni = i + 1\nif (i <= #sln.projects) then\nreturn premake.solution.getproject(sln, i)\nend\nend\nend\nfunction premake.solution.eachgroup(sln)\nlocal i = 0\nreturn function()\ni = i + 1\nif(i <= #sln.groups) then\nreturn premake.solution.getgroup(sln, i)\nend\nend\nend\nfunction premake.solution.get(key)\nreturn premake.solution.list[key]\nend\nfu"
"nction premake.solution.getproject(sln, idx)\nlocal prj = sln.projects[idx]\nlocal cfg = premake.getconfig(prj)\ncfg.name = prj.name\nreturn cfg\nend\nfunction premake.solution.getgroup(sln, idx)\nlocal grp = sln.groups[idx]\nreturn grp\nend",
/* base/project.lua */
"premake.project = { }\nfunction premake.project.buildsourcetree(prj, allfiles)\nlocal tr = premake.tree.new(prj.name)\ntr.project = prj\nlocal isvpath\nlocal function onadd(node)\nnode.isvpath = isvpath\nend\nfor fcfg in premake.project.eachfile(prj, allfiles) do\nisvpath = (fcfg.name ~= fcfg.vpath)\nlocal node = premake.tree.add(tr, fcfg.vpath, onadd)\nnode.cfg = fcfg\nend\npremake.tree.sort(tr)\nreturn tr\nend\nfunction premake.eachconfig(prj, platform)\nif prj.project then prj = prj.project end\nlocal cfgs = prj.solution.configurations\nlocal i = 0\nreturn function ()\ni = i + 1\nif i <= #cfgs then\nreturn premake.getconfig(prj, cfgs[i], platform)\nend\nend\nend\nfunction premake.project.eachfile(prj, allfiles)\nif not prj.project then prj = premake.getconfig(prj) end\nlocal i = 0\nlocal t = iif(allfiles, prj.allfiles, prj.files)\nlocal c = iif(allfiles, prj.__allfileconfigs, prj.__fileconfigs)\nreturn function ()\ni = i + 1\nif (i <= #t) then\nlocal fcfg = c[t[i]]\nfcfg.vpath = premake.project.getvpath(prj"
", fcfg.name)\nreturn fcfg\nend\nend\nend\nfunction premake.esc(value)\nif (type(value) == \"table\") then\nlocal result = { }\nfor _,v in ipairs(value) do\ntable.insert(result, premake.esc(v))\nend\nreturn result\nelse\nvalue = value:gsub('&', \"&\")\nvalue = value:gsub('\"', \""\")\nvalue = value:gsub(\"'\", \"'\")\nvalue = value:gsub('<', \"<\")\nvalue = value:gsub('>', \">\")\nvalue = value:gsub('\\r', \"
\")\nvalue = value:gsub('\\n', \"
\")\nreturn value\nend\nend\nfunction premake.filterplatforms(sln, map, default)\nlocal result = { }\nlocal keys = { }\nif sln.platforms then\nfor _, p in ipairs(sln.platforms) do\nif map[p] and not table.contains(keys, map[p]) then\ntable.insert(result, p)\ntable.insert(keys, map[p])\nend\nend\nend\nif #result == 0 and default then\ntable.insert(result, default)\nend\nreturn result\nend\nfunction premake.findproject(name)\nfor sln in premake.solution.each() do\nfor prj in premake.solution.eachproject(sln) do\nif (prj.name == name) then\n"
"return prj\nend\nend\nend\nend\nfunction premake.findfile(prj, extension)\nfor _, fname in ipairs(prj.files) do\nif fname:endswith(extension) then return fname end\nend\nend\nfunction premake.getconfig(prj, cfgname, pltname)\nprj = prj.project or prj\nif pltname == \"Native\" or not table.contains(prj.solution.platforms or {}, pltname) then\npltname = nil\nend\nlocal key = (cfgname or \"\")\nif pltname then key = key .. pltname end\nreturn prj.__configs[key]\nend\nfunction premake.getconfigname(cfgname, platform, useshortname)\nif cfgname then\nlocal name = cfgname\nif platform and platform ~= \"Native\" then\nif useshortname then\nname = name .. premake.platforms[platform].cfgsuffix\nelse\nname = name .. \"|\" .. platform\nend\nend\nreturn iif(useshortname, name:lower(), name)\nend\nend\nfunction premake.getdependencies(prj)\nprj = prj.project or prj\nlocal results = { }\nfor _, cfg in pairs(prj.__configs) do\nfor _, link in ipairs(cfg.links) do\nlocal dep = premake.findproject(link)\nif dep and not table.co"
"ntains(results, dep) then\ntable.insert(results, dep)\nend\nend\nend\nreturn results\nend\nfunction premake.project.getbasename(prjname, pattern)\nreturn pattern:gsub(\"%%%%\", prjname)\nend\nfunction premake.project.getfilename(prj, pattern)\nlocal fname = premake.project.getbasename(prj.name, pattern)\nfname = path.join(prj.location, fname)\nreturn path.getrelative(os.getcwd(), fname)\nend\n function premake.getlinks(cfg, kind, part)\nlocal result = iif (part == \"directory\" and kind == \"all\", cfg.libdirs, {})\nlocal cfgname = iif(cfg.name == cfg.project.name, \"\", cfg.name)\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\nlocal function canlink(source, target)\nif (target.kind ~= \"SharedLib\" and target.kind ~= \"StaticLib\") then\nreturn false\nend\nif premake.iscppproject(source) then\nreturn premake.iscppproject(target)\nelseif premake.isdotnetproject(source) then\nreturn premake.isdotnetproject(target)\nelseif premake.isswiftproject(source) then\nreturn pre"
"make.isswiftproject(source) or premake.iscppproject(source)\nend\nend\nfor _, link in ipairs(cfg.links) do\nlocal item\nlocal prj = premake.findproject(link)\nif prj and kind ~= \"system\" then\nlocal prjcfg = premake.getconfig(prj, cfgname, cfg.platform)\nif kind == \"dependencies\" or canlink(cfg, prjcfg) then\nif (part == \"directory\") then\nitem = path.rebase(prjcfg.linktarget.directory, prjcfg.location, cfg.location)\nelseif (part == \"basename\") then\nitem = prjcfg.linktarget.basename\nelseif (part == \"fullpath\") then\nitem = path.rebase(prjcfg.linktarget.fullpath, prjcfg.location, cfg.location)\nelseif (part == \"object\") then\nitem = prjcfg\nend\nend\nelseif not prj and (kind == \"system\" or kind == \"all\") then\nif (part == \"directory\") then\nitem = path.getdirectory(link)\nelseif (part == \"fullpath\") then\nitem = link\nif namestyle == \"windows\" then\nif premake.iscppproject(cfg) then\nitem = item .. \".lib\"\nelseif premake.isdotnetproject(cfg) then\nitem = item .. \".dll\"\nend\nend\nel"
"seif part == \"name\" then\nitem = path.getname(link)\nelseif part == \"basename\" then\nitem = path.getbasename(link)\nelse\nitem = link\nend\nif item:find(\"/\", nil, true) then\nitem = path.getrelative(cfg.project.location, item)\nend\nend\nif item then\nif pathstyle == \"windows\" and part ~= \"object\" then\nitem = path.translate(item, \"\\\\\")\nend\nif not table.contains(result, item) then\ntable.insert(result, item)\nend\nend\nend\nreturn result\nend\nfunction premake.getnamestyle(cfg)\nreturn premake.platforms[cfg.platform].namestyle or premake.gettool(cfg).namestyle or \"posix\"\nend\nfunction premake.getpathstyle(cfg)\nif premake.action.current().os == \"windows\" then\nreturn \"windows\"\nelse\nreturn \"posix\"\nend\nend\nfunction premake.gettarget(cfg, direction, pathstyle, namestyle, system)\nif system == \"bsd\" then\nsystem = \"linux\"\nend\nlocal kind = cfg.kind\nif premake.iscppproject(cfg) then\nif (namestyle == \"windows\" or system == \"windows\")\nand kind == \"SharedLib\" and direction ="
"= \"link\"\nand not cfg.flags.NoImportLib\nthen\nkind = \"StaticLib\"\nend\nif namestyle == \"posix\" and system == \"windows\" and kind ~= \"StaticLib\" then\nnamestyle = \"windows\"\nend\nend\nlocal field = \"build\"\nif direction == \"link\" and cfg.kind == \"SharedLib\" then\nfield = \"implib\"\nend\nlocal name = cfg[field..\"name\"] or cfg.targetname or cfg.project.name\nlocal dir = cfg[field..\"dir\"] or cfg.targetdir or path.getrelative(cfg.location, cfg.basedir)\nlocal subdir = cfg[field..\"subdir\"] or cfg.targetsubdir or \".\"\nlocal prefix = \"\"\nlocal suffix = \"\"\nlocal ext = \"\"\nlocal bundlepath, bundlename\ndir = path.join(dir, subdir)\nif namestyle == \"windows\" then\nif kind == \"ConsoleApp\" or kind == \"WindowedApp\" then\next = \".exe\"\nelseif kind == \"SharedLib\" then\next = \".dll\"\nelseif kind == \"StaticLib\" then\next = \".lib\"\nend\nelseif namestyle == \"posix\" then\nif kind == \"WindowedApp\" and system == \"macosx\" and not cfg.options.SkipBundling then\nbu"
"ndlename = name .. \".app\"\nbundlepath = path.join(dir, bundlename)\ndir = path.join(bundlepath, \"Contents/MacOS\")\nelseif (kind == \"ConsoleApp\" or kind == \"WindowedApp\") and system == \"os2\" then\next = \".exe\"\nelseif kind == \"SharedLib\" then\nprefix = \"lib\"\next = iif(system == \"macosx\", \".dylib\", \".so\")\nelseif kind == \"StaticLib\" then\nprefix = \"lib\"\next = \".a\"\nend\nelseif namestyle == \"PS3\" then\nif kind == \"ConsoleApp\" or kind == \"WindowedApp\" then\next = \".elf\"\nelseif kind == \"StaticLib\" then\nprefix = \"lib\"\next = \".a\"\nend\nelseif namestyle == \"Orbis\" then\nif kind == \"ConsoleApp\" or kind == \"WindowedApp\" then\next = \".elf\"\nelseif kind == \"StaticLib\" then\nprefix = \"lib\"\next = \".a\"\nelseif kind == \"SharedLib\" then\next = \".prx\"\nend\nelseif namestyle == \"TegraAndroid\" then\nif kind == \"ConsoleApp\" or kind == \"WindowedApp\" or kind == \"SharedLib\" then\nprefix = \"lib\"\next = \".so\"\nelseif kind == \"StaticLib\" then\nprefix = \"lib"
"\"\next = \".a\"\nend\nelseif namestyle == \"NX\" then\nif kind == \"ConsoleApp\" or kind == \"WindowedApp\" then\next = \".nspd_root\"\nelseif kind == \"StaticLib\" then\next = \".a\"\nelseif kind == \"SharedLib\" then\next = \".nro\"\nend\nelseif namestyle == \"Emscripten\" then\nif kind == \"ConsoleApp\" or kind == \"WindowedApp\" then\next = \".html\"\nelseif kind == \"StaticLib\" then\next = \".bc\"\nelseif kind == \"SharedLib\" then\next = \".js\"\nend\nend\nprefix = cfg[field..\"prefix\"] or cfg.targetprefix or prefix\nsuffix = cfg[field..\"suffix\"] or cfg.targetsuffix or suffix\next = cfg[field..\"extension\"] or cfg.targetextension or ext\nlocal result = { }\nresult.basename = name .. suffix\nresult.name = prefix .. name .. suffix .. ext\nresult.directory = dir\nresult.subdirectory = subdir\nresult.prefix = prefix\nresult.suffix = suffix\nresult.fullpath = path.join(result.directory, result.name)\nresult.bundlepath = bundlepath or result.fullpath\nif pathstyle == "
"\"windows\" then\nresult.directory = path.translate(result.directory, \"\\\\\")\nresult.subdirectory = path.translate(result.subdirectory, \"\\\\\")\nresult.fullpath = path.translate(result.fullpath, \"\\\\\")\nend\nreturn result\nend\nfunction premake.gettool(cfg)\nif premake.iscppproject(cfg) then\nif _OPTIONS.cc then\nreturn premake[_OPTIONS.cc]\nend\nlocal action = premake.action.current()\nif action.valid_tools then\nreturn premake[action.valid_tools.cc[1]]\nend\nreturn premake.gcc\nelseif premake.isdotnetproject(cfg) then\nreturn premake.dotnet\nelseif premake.isswiftproject(cfg) then\nreturn premake.swift\nelse\nreturn premake.valac\nend\nend\nfunction premake.project.getvpath(prj, abspath)\nlocal vpath = abspath\nlocal fname = path.getname(abspath)\nlocal max = abspath:len() - fname:len()\n \n -- First check for an exact match from the inverse vpaths\n if prj.inversevpaths and prj.inversevpaths[abspath] then\n return path.join(prj.inversevpaths[abspath], fname)\n"
" end\n local matches = {}\nfor replacement, patterns in pairs(prj.vpaths or {}) do\nfor _, pattern in ipairs(patterns) do\nlocal i = abspath:find(path.wildcards(pattern))\nif i == 1 then\ni = pattern:find(\"*\", 1, true) or (pattern:len() + 1)\nlocal leaf\nif i < max then\nleaf = abspath:sub(i)\nelse\nleaf = fname\nend\nif leaf:startswith(\"/\") then\nleaf = leaf:sub(2)\nend\nlocal stem = \"\"\nif replacement:len() > 0 then\nstem, stars = replacement:gsub(\"%*\", \"\")\nif stars == 0 then\nleaf = path.getname(leaf)\nend\nelse\nleaf = path.getname(leaf)\nend\ntable.insert(matches, path.join(stem, leaf))\nend\nend\nend\n \n if #matches > 0 then\n -- for the sake of determinism, return the first alphabetically\n table.sort(matches)\n vpath = matches[1]\n end\nreturn path.trimdots(vpath)\nend\nfunction premake.hascppproject(sln)\nfor prj in premake.solution.eachproject(sln) do\nif premake.iscppproject(prj) then\nreturn true\nend\nend\nend\nfunctio"
"n premake.hasdotnetproject(sln)\nfor prj in premake.solution.eachproject(sln) do\nif premake.isdotnetproject(prj) then\nreturn true\nend\nend\nend\nfunction premake.project.iscproject(prj)\nreturn prj.language == \"C\"\nend\nfunction premake.iscppproject(prj)\nreturn (prj.language == \"C\" or prj.language == \"C++\")\nend\nfunction premake.isdotnetproject(prj)\nreturn (prj.language == \"C#\")\nend\nfunction premake.isvalaproject(prj)\nreturn (prj.language == \"Vala\")\nend\nfunction premake.isswiftproject(prj)\nreturn (prj.language == \"Swift\")\nend\n",
/* base/config.lua */
"premake.config = { }\nlocal config = premake.config\nfunction premake.config.isdebugbuild(cfg)\nif cfg.flags.DebugRuntime then\nreturn true\nend\nif cfg.flags.ReleaseRuntime then\nreturn false\nend\nif cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed then\nreturn false\nend\nif not cfg.flags.Symbols then\nreturn false\nend\nreturn true\nend\nfunction premake.config.eachfile(cfg)\nlocal i = 0\nlocal t = cfg.files\nreturn function ()\ni = i + 1\nif (i <= #t) then\nlocal fcfg = cfg.__fileconfigs[t[i]]\nfcfg.vpath = premake.project.getvpath(cfg.project, fcfg.name)\nreturn fcfg\nend\nend\nend\nfunction premake.config.isincrementallink(cfg)\nif cfg.kind == \"StaticLib\" then\nreturn false\nend\nreturn not config.islinkeroptimizedbuild(cfg.flags) and not cfg.flags.NoIncrementalLink\nend\nfunction premake.config.isoptimizedbuild(flags)\nreturn flags.Optimize or flags.OptimizeSize or flags.OptimizeSpeed\nend\nfunction premake.config.islinkeroptimizedbuild(flags)\nreturn config.isoptimizedbuild(fl"
"ags) and not flags.NoOptimizeLink\nend\nfunction premake.config.iseditandcontinue(cfg)\nif cfg.flags.NoEditAndContinue\nor cfg.flags.Managed\nor (cfg.kind ~= \"StaticLib\" and not config.isincrementallink(cfg))\nor config.islinkeroptimizedbuild(cfg.flags) then\nreturn false\nend\nreturn true\nend\n",
/* base/bake.lua */
"premake.bake = { }\nlocal bake = premake.bake\nlocal nocopy =\n{\nblocks = true,\nkeywords = true,\nprojects = true,\n__configs = true,\n}\nlocal nocascade =\n{\nmakesettings = true,\n}\nlocal keeprelative =\n{\nbasedir = true,\nlocation = true,\n}\nfunction premake.getactiveterms(obj)\nlocal terms = { _action = _ACTION:lower(), os = os.get() }\nfor key, value in pairs(_OPTIONS) do\nif value ~= \"\" then\ntable.insert(terms, value:lower())\nelse\ntable.insert(terms, key:lower())\nend\nend\nreturn terms\nend\nfunction premake.iskeywordmatch(keyword, terms)\nif keyword:startswith(\"not \") then\nreturn not premake.iskeywordmatch(keyword:sub(5), terms)\nend\nfor _, pattern in ipairs(keyword:explode(\" or \")) do\nfor termkey, term in pairs(terms) do\nif term:match(pattern) == term then\nreturn termkey\nend\nend\nend\nend\nfunction premake.iskeywordsmatch(keywords, terms)\nlocal hasrequired = false\nfor _, keyword in ipairs(keywords) do\nlocal matched = premake.iskeywordmatch(keyword, terms)\nif not matched "
"then\nreturn false\nend\nif matched == \"required\" then\nhasrequired = true\nend\nend\nif terms.required and not hasrequired then\nreturn false\nelse\nreturn true\nend\nend\nlocal function adjustpaths(location, obj)\nfunction adjustpathlist(list)\nfor i, p in ipairs(list) do\nlist[i] = path.getrelative(location, p)\nend\nend\nif obj.allfiles ~= nil then\nadjustpathlist(obj.allfiles)\nend\nfor name, value in pairs(obj) do\nlocal field = premake.fields[name]\nif field and value and not keeprelative[name] then\nif field.kind == \"path\" then\nobj[name] = path.getrelative(location, value)\nelseif field.kind == \"dirlist\" or field.kind == \"filelist\" then\nadjustpathlist(value)\nelseif field.kind == \"keypath\" then\nfor k,v in pairs(value) do\nadjustpathlist(v)\nend\nend\nend\nend\nend\nlocal function removevalue(tbl, remove)\nfor index, item in ipairs(tbl) do\nif item == remove then\ntable.remove(tbl, index)\nbreak\nend\nend\nend\nlocal function removevalues(tbl, removes)\nfor k, v in pairs(tbl) do\nfor _, pat"
"tern in ipairs(removes) do\nif pattern == tbl[k] then\nif type(k) == \"number\" then\ntable.remove(tbl, k)\nelse\ntbl[k] = nil\nend\nbreak\nend\nend\nend\nend\nlocal function mergefield(kind, dest, src, mergecopiestotail)\nlocal tbl = dest or { }\nif kind == \"keyvalue\" or kind == \"keypath\" then\nfor key, value in pairs(src) do\ntbl[key] = mergefield(\"list\", tbl[key], value, mergecopiestotail)\nend\nelse\nfor _, item in ipairs(src) do\nif tbl[item] then\nif mergecopiestotail then\nremovevalue(tbl, item)\ntable.insert(tbl, item)\ntbl[item] = item\nend\nelse\ntable.insert(tbl, item)\ntbl[item] = item\nend\nend\nend\nreturn tbl\nend\nlocal function mergeobject(dest, src)\nif not src then\nreturn\nend\nfor fieldname, value in pairs(src) do\nif not nocopy[fieldname] then\nlocal field = premake.fields[fieldname]\nif field then\nif type(value) == \"table\" then\ndest[fieldname] = mergefield(field.kind, dest[fieldname], value, field.mergecopiestotail)\nif src.removes then\nremoves = src.removes[fieldname]\nif rem"
"oves then\nremovevalues(dest[fieldname], removes)\nend\nend\nelse\ndest[fieldname] = value\nend\nelse\ndest[fieldname] = value\nend\nend\nend\nend\nlocal function merge(dest, obj, basis, terms, cfgname, pltname)\nlocal key = cfgname or \"\"\npltname = pltname or \"Native\"\nif pltname ~= \"Native\" then\nkey = key .. pltname\nend\nterms.config = (cfgname or \"\"):lower()\nterms.platform = pltname:lower()\nlocal cfg = {}\nmergeobject(cfg, basis[key])\nadjustpaths(obj.location, cfg)\nmergeobject(cfg, obj)\nif (cfg.kind) then\nterms['kind']=cfg.kind:lower()\nend\nfor _, blk in ipairs(obj.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, terms))then\nmergeobject(cfg, blk)\nif (cfg.kind and not cfg.terms.kind) then\ncfg.terms['kind'] = cfg.kind:lower()\nterms['kind'] = cfg.kind:lower()\nend\nend\nend\ncfg.name = cfgname\ncfg.platform = pltname\nfor k,v in pairs(terms) do\ncfg.terms[k] =v\nend\ndest[key] = cfg\nend\nlocal function collapse(obj, basis)\nlocal result = {}\nbasis = basis or {}\nlocal sln = ob"
"j.solution or obj\nlocal terms = premake.getactiveterms(obj)\nmerge(result, obj, basis, terms)--this adjusts terms\nfor _, cfgname in ipairs(sln.configurations) do\nlocal terms_local = {}\nfor k,v in pairs(terms)do terms_local[k]=v end\nmerge(result, obj, basis, terms_local, cfgname, \"Native\")--terms cam also be adjusted here\nfor _, pltname in ipairs(sln.platforms or {}) do\nif pltname ~= \"Native\" then\nmerge(result, obj, basis,terms_local, cfgname, pltname)--terms also here\nend\nend\nend\nreturn result\nend\nlocal function builduniquedirs()\nlocal num_variations = 4\nlocal cfg_dirs = {}\nlocal hit_counts = {}\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dirs = { }\ndirs[1] = path.getabsolute(path.join(cfg.location, cfg.objdir or cfg.project.objdir or \"obj\"))\ndirs[2] = path.join(dirs[1], iif(cfg.platform == \"Native\", \"\", cfg.platform))\ndirs[3] = path.join(dirs[2], cfg.name)\ndirs[4] = path.join(dirs[3], cfg.project.nam"
"e)\ncfg_dirs[cfg] = dirs\nlocal start = iif(cfg.name, 2, 1)\nfor v = start, num_variations do\nlocal d = dirs[v]\nhit_counts[d] = (hit_counts[d] or 0) + 1\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dir\nlocal start = iif(cfg.name, 2, 1)\nfor v = start, iif(cfg.flags.SingleOutputDir==true,num_variations-1,num_variations) do\ndir = cfg_dirs[cfg][v]\nif hit_counts[dir] == 1 then break end\nend\ncfg.objectsdir = path.getrelative(cfg.location, dir)\nend\nend\nend\nend\nlocal function buildtargets()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\ncfg.buildtarget = premake.gettarget(cfg, \"build\", pathstyle, namestyle, cfg.system)\ncfg.linktarget = premake.gettarget(cfg, \"link\", pathstyle, namestyle, cfg.system)\nif pathstyle == \"windows\" then\ncfg.objec"
"tsdir = path.translate(cfg.objectsdir, \"\\\\\")\nend\nend\nend\nend\nend\n local function getCfgKind(cfg)\n if(cfg.kind) then\n return cfg.kind;\n end\n if(cfg.project.__configs[\"\"] and cfg.project.__configs[\"\"].kind) then\n return cfg.project.__configs[\"\"].kind;\n end\n return nil\n end\n local function getprojrec(dstArray, foundList, cfg, cfgname, searchField, bLinkage)\n if(not cfg) then return end\n local foundUsePrjs = {};\n for _, useName in ipairs(cfg[searchField]) do\n local testName = useName:lower();\n if((not foundList[testName])) then\n local theProj = nil;\n local theUseProj = nil;\n for _, prj in ipairs(cfg.project.solution.projects) do\n if (prj.name:lower() == testName) then\n if(prj.usage) then\n theUseProj = prj;\n else\n theProj = prj;\n end\n end\n end\n --Must connect to a usage project.\n if(theUseProj) then\n foundList[testName] = true;\n local prjEntry = {\n name = testName,\n proj = theProj,\n usageProj = theUseProj,\n bLinkageOnly = bLinkage,\n"
" };\n dstArray[testName] = prjEntry;\n table.insert(foundUsePrjs, theUseProj);\n end\n end\n end\n for _, usePrj in ipairs(foundUsePrjs) do\n --Links can only recurse through static libraries.\n if((searchField ~= \"links\") or\n (getCfgKind(usePrj.__configs[cfgname]) == \"StaticLib\")) then\n getprojrec(dstArray, foundList, usePrj.__configs[cfgname],\n cfgname, searchField, bLinkage);\n end\n end\n end\n --\n -- This function will recursively get all projects that the given configuration has in its \"uses\"\n -- field. The return values are a list of tables. Each table in that list contains the following:\n --name = The lowercase name of the project.\n --proj = The project. Can be nil if it is usage-only.\n --usageProj = The usage project. Can't be nil, as using a project that has no\n -- usage project is not put into the list.\n --bLinkageOnly = If this is true, then only the linkage information should be copied.\n -- The recursion will only look at the \"uses\" field on *usage* proje"
"cts.\n -- This function will also add projects to the list that are mentioned in the \"links\"\n -- field of usage projects. These will only copy linker information, but they will recurse.\n -- through other \"links\" fields.\n --\n local function getprojectsconnections(cfg, cfgname)\n local dstArray = {};\n local foundList = {};\n foundList[cfg.project.name:lower()] = true;\n --First, follow the uses recursively.\n getprojrec(dstArray, foundList, cfg, cfgname, \"uses\", false);\n --Next, go through all of the usage projects and recursively get their links.\n --But only if they're not already there. Get the links as linkage-only.\n local linkArray = {};\n for prjName, prjEntry in pairs(dstArray) do\n getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname,\n \"links\", true);\n end\n --Copy from linkArray into dstArray.\n for prjName, prjEntry in pairs(linkArray) do\n dstArray[prjName] = prjEntry;\n end\n return dstArray;\n end\n local function isnameofproj(cfg, "
"strName)\n local sln = cfg.project.solution;\n local strTest = strName:lower();\n for prjIx, prj in ipairs(sln.projects) do\n if (prj.name:lower() == strTest) then\n return true;\n end\n end\n return false;\n end\n --\n -- Copies the field from dstCfg to srcCfg.\n --\n local function copydependentfield(srcCfg, dstCfg, strSrcField)\n local srcField = premake.fields[strSrcField];\n local strDstField = strSrcField;\n if type(srcCfg[strSrcField]) == \"table\" then\n --handle paths.\n if (srcField.kind == \"dirlist\" or srcField.kind == \"filelist\") and\n (not keeprelative[strSrcField]) then\n for i,p in ipairs(srcCfg[strSrcField]) do\n table.insert(dstCfg[strDstField],\n path.rebase(p, srcCfg.project.location, dstCfg.project.location))\n end\n else\n if(strSrcField == \"links\") then\n for i,p in ipairs(srcCfg[strSrcField]) do\n if(not isnameofproj(dstCfg, p)) then\n table.insert(dstCfg[strDstField], p)\n else\n printf(\"Failed to copy '%s' from proj '%s'.\",\n p, srcCfg.project.nam"
"e);\n end\n end\n else\n for i,p in ipairs(srcCfg[strSrcField]) do\n table.insert(dstCfg[strDstField], p)\n end\n end\n end\n else\n if(srcField.kind == \"path\" and (not keeprelative[strSrcField])) then\n dstCfg[strDstField] = path.rebase(srcCfg[strSrcField],\n prj.location, dstCfg.project.location);\n else\n dstCfg[strDstField] = srcCfg[strSrcField];\n end\n end\n end\n --\n -- This function will take the list of project entries and apply their usage project data\n -- to the given configuration. It will copy compiling information for the projects that are\n -- not listed as linkage-only. It will copy the linking information for projects only if\n -- the source project is not a static library. It won't copy linking information\n -- if the project is in this solution; instead it will add that project to the configuration's\n -- links field, expecting that Premake will handle the rest.\n --\n local function copyusagedata(cfg, cfgname, linkToProjs)\n local myPrj = cfg.project;\n local"
" bIsStaticLib = (getCfgKind(cfg) == \"StaticLib\");\n for prjName, prjEntry in pairs(linkToProjs) do\n local srcPrj = prjEntry.usageProj;\n local srcCfg = srcPrj.__configs[cfgname];\n for name, field in pairs(premake.fields) do\n if(srcCfg[name]) then\n if(field.usagecopy) then\n if(not prjEntry.bLinkageOnly) then\n copydependentfield(srcCfg, cfg, name)\n end\n elseif(field.linkagecopy) then\n --Copy the linkage data if we're building a non-static thing\n --and this is a pure usage project. If it's not pure-usage, then\n --we will simply put the project's name in the links field later.\n if((not bIsStaticLib) and (not prjEntry.proj)) then\n copydependentfield(srcCfg, cfg, name)\n end\n end\n end\n end\n if((not bIsStaticLib) and prjEntry.proj) then\n table.insert(cfg.links, prjEntry.proj.name);\n end\n end\n end\n local function inverseliteralvpaths()\n for sln in premake.solution.each() do\n for _,prj in ipairs(sln.projects) do\n prj.inversevpaths = "
"{}\n for replacement, patterns in pairs(prj.vpaths or {}) do\n for _, pattern in ipairs(patterns) do\n if string.find(pattern, \"*\") == nil then\n prj.inversevpaths[pattern] = replacement\n end\n end\n end\n end\n end\n end\nfunction premake.bake.buildconfigs()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nprj.location = prj.location or sln.location or prj.basedir\nadjustpaths(prj.location, prj)\nfor _, blk in ipairs(prj.blocks) do\nadjustpaths(prj.location, blk)\nend\nend\nsln.location = sln.location or sln.basedir\nend\n -- convert paths for imported projects to be relative to solution location\nfor sln in premake.solution.each() do\nfor _, iprj in ipairs(sln.importedprojects) do\niprj.location = path.getabsolute(iprj.location)\nend\nend\n inverseliteralvpaths()\nfor sln in premake.solution.each() do\n"
"local basis = collapse(sln)\nfor _, prj in ipairs(sln.projects) do\nprj.__configs = collapse(prj, basis)\nfor _, cfg in pairs(prj.__configs) do\nbake.postprocess(prj, cfg)\nend\nend\nend\nfor sln in premake.solution.each() do\nfor prjIx, prj in ipairs(sln.projects) do\nif(not prj.usage) then\nfor cfgname, cfg in pairs(prj.__configs) do\nlocal usesPrjs = getprojectsconnections(cfg, cfgname);\ncopyusagedata(cfg, cfgname, usesPrjs)\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nfor prjIx, prj in ipairs(sln.projects) do\nfor cfgName, cfg in pairs(prj.__configs) do\ncfg.build = true\nlocal removes = nil\nif cfg.removes ~= nil then\nremoves = cfg.removes[\"platforms\"];\nend\nif removes ~= nil then\nfor _,p in ipairs(removes) do\nif p == cfg.platform then\ncfg.build = false\nend\nend\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nlocal removeList = {};\nfor index, prj in ipairs(sln.projects) do\nif(prj.usage) then\ntable.insert(removeList, 1, index); --Add in reverse order.\nend\nend\nfor "
"_, index in ipairs(removeList) do\ntable.remove(sln.projects, index);\nend\nend\nbuilduniquedirs()\nbuildtargets(cfg)\nend\nfunction premake.bake.postprocess(prj, cfg)\ncfg.project = prj\ncfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true)\ncfg.longname = premake.getconfigname(cfg.name, cfg.platform)\ncfg.location = cfg.location or cfg.basedir\nlocal platform = premake.platforms[cfg.platform]\nif platform.iscrosscompiler then\ncfg.system = cfg.platform\nelse\ncfg.system = os.get()\nend\nif cfg.kind == \"Bundle\"\nand _ACTION ~= \"gmake\"\nand (_ACTION ~= \"ninja\" and (not prj.options or not prj.options.SkipBundling))\nand not _ACTION:match(\"xcode[0-9]\") then\ncfg.kind = \"SharedLib\"\nend\nif cfg.kind == \"SharedLib\" and platform.nosharedlibs then\ncfg.kind = \"StaticLib\"\nend\nlocal removefiles = cfg.removefiles\nif _ACTION == 'gmake' or _ACTION == 'ninja' then\nremovefiles = table.join(removefiles, cfg.excludes)\nend\nlocal removefilesDict = {}\nfor _, fname in ipairs(removefiles) do"
"\nremovefilesDict[fname] = true\nend\nlocal files = {}\nfor _, fname in ipairs(cfg.files) do\nif removefilesDict[fname] == nil then\ntable.insert(files, fname)\nend\nend\ncfg.files = files\nlocal allfiles = {}\nlocal allfilesDict = {}\nif cfg.allfiles ~= nil then\nfor _, fname in ipairs(cfg.allfiles) do\nif allfilesDict[fname] == nil then\nif removefilesDict[fname] == nil then\nallfilesDict[fname] = true\ntable.insert(allfiles, fname)\nend\nend\nend\nend\ncfg.allfiles = allfiles\nfor name, field in pairs(premake.fields) do\nif field.isflags then\nlocal values = cfg[name]\nfor _, flag in ipairs(values) do values[flag] = true end\nend\nend\nlocal cfgfields = {\n{\"__fileconfigs\", cfg.files},\n{\"__allfileconfigs\", cfg.allfiles},\n}\nfor _, cfgfield in ipairs(cfgfields) do\nlocal fieldname = cfgfield[1]\nlocal field = cfgfield[2]\ncfg[fieldname] = { }\nfor _, fname in ipairs(field) do\nlocal fcfg = {}\nif premake._filelevelconfig then\ncfg.terms.required = fname:lower()\nfor _, blk in ipairs(cfg.project."
"blocks) do\nif (premake.iskeywordsmatch(blk.keywords, cfg.terms)) then\nmergeobject(fcfg, blk)\nend\nend\nend\nfcfg.name = fname\ncfg[fieldname][fname] = fcfg\ntable.insert(cfg[fieldname], fcfg)\nend\nend\nend\n",
/* base/api.lua */
"premake.fields = {}\npremake.check_paths = false\nfunction premake.checkvalue(value, allowed)\nif (allowed) then\nif (type(allowed) == \"function\") then\nreturn allowed(value)\nelse\nfor _,v in ipairs(allowed) do\nif (value:lower() == v:lower()) then\nreturn v\nend\nend\nreturn nil, \"invalid value '\" .. value .. \"'\"\nend\nelse\nreturn value\nend\nend\nfunction premake.getobject(t)\nlocal container\nif (t == \"container\" or t == \"solution\") then\ncontainer = premake.CurrentContainer\nelse\ncontainer = premake.CurrentConfiguration\nend\nif t == \"solution\" then\nif typex(container) == \"project\" then\ncontainer = container.solution\nend\nif typex(container) ~= \"solution\" then\ncontainer = nil\nend\nend\nlocal msg\nif (not container) then\nif (t == \"container\") then\nmsg = \"no active solution or project\"\nelseif (t == \"solution\") then\nmsg = \"no active solution\"\nelse\nmsg = \"no active solution, project, or configuration\"\nend\nend\nreturn container, msg\nend\nfunction premake.setarray(obj, "
"fieldname, value, allowed)\nobj[fieldname] = obj[fieldname] or {}\nlocal function add(value, depth)\nif type(value) == \"table\" then\nfor _,v in ipairs(value) do\nadd(v, depth + 1)\nend\nelse\nvalue, err = premake.checkvalue(value, allowed)\nif not value then\nerror(err, depth)\nend\ntable.insert(obj[fieldname], value)\nend\nend\nif value then\nadd(value, 5)\nend\nreturn obj[fieldname]\nend\nfunction premake.settable(obj, fieldname, value, allowed)\nobj[fieldname] = obj[fieldname] or {}\ntable.insert(obj[fieldname], value)\nreturn obj[fieldname]\nend\nlocal function domatchedarray(fields, value, matchfunc)\nlocal result = { }\nfunction makeabsolute(value, depth)\nif (type(value) == \"table\") then\nfor _, item in ipairs(value) do\nmakeabsolute(item, depth + 1)\nend\nelseif type(value) == \"string\" then\nif value:find(\"*\") then\nlocal arr = matchfunc(value);\nif (premake.check_paths) and (#arr == 0) then\nerror(\"Can't find matching files for pattern :\" .. value)\nend\nmakeabsolute(arr, depth + 1)\nelse\nt"
"able.insert(result, path.getabsolute(value))\nend\nelse\nerror(\"Invalid value in list: expected string, got \" .. type(value), depth)\nend\nend\nmakeabsolute(value, 3)\nlocal retval = {}\nfor index, field in ipairs(fields) do\nlocal ctype = field[1]\nlocal fieldname = field[2]\nlocal array = premake.setarray(ctype, fieldname, result)\nif index == 1 then\nretval = array\nend\nend\nreturn retval\nend\nfunction premake.setdirarray(fields, value)\nreturn domatchedarray(fields, value, os.matchdirs)\nend\nfunction premake.setfilearray(fields, value)\nreturn domatchedarray(fields, value, os.matchfiles)\nend\nfunction premake.setkeyvalue(ctype, fieldname, values)\nlocal container, err = premake.getobject(ctype)\nif not container then\nerror(err, 4)\nend\nif not container[fieldname] then\ncontainer[fieldname] = {}\nend\nif type(values) ~= \"table\" then\nerror(\"invalid value; table expected\", 4)\nend\nlocal field = container[fieldname]\nfor key,value in pairs(values) do\nif not field[key] then\nfield[key] = {}\nend"
"\ntable.insertflat(field[key], value)\nend\nreturn field\nend\nfunction premake.setstring(ctype, fieldname, value, allowed)\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (value) then\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then\nerror(err, 4)\nend\ncontainer[fieldname] = value\nend\nreturn container[fieldname]\nend\nfunction premake.remove(fieldname, value)\nlocal cfg = premake.CurrentConfiguration\ncfg.removes = cfg.removes or {}\ncfg.removes[fieldname] = premake.setarray(cfg.removes, fieldname, value)\nend\nlocal function accessor(name, value)\nlocal kind = premake.fields[name].kind\nlocal scope = premake.fields[name].scope\nlocal allowed = premake.fields[name].allowed\nif (kind == \"string\" or kind == \"path\") and value then\nif type(value) ~= \"string\" then\nerror(\"string value expected\", 3)\nend\nend\nlocal container, err = premake.getobject(scope)\nif (not container) then\nerror(err, 3)\nend\nif kind == \"string\" then"
"\nreturn premake.setstring(scope, name, value, allowed)\nelseif kind == \"path\" then\nif value then value = path.getabsolute(value) end\nreturn premake.setstring(scope, name, value)\nelseif kind == \"list\" then\nreturn premake.setarray(container, name, value, allowed)\nelseif kind == \"table\" then\nreturn premake.settable(container, name, value, allowed)\nelseif kind == \"dirlist\" then\nreturn premake.setdirarray({{container, name}}, value)\nelseif kind == \"filelist\" or kind == \"absolutefilelist\" then\nlocal fields = {{container, name}}\nif name == \"files\" then\nlocal prj, err = premake.getobject(\"container\")\nif (not prj) then\nerror(err, 2)\nend\ntable.insert(fields, {prj.blocks[1], \"allfiles\"})\nend\nreturn premake.setfilearray(fields, value)\nelseif kind == \"keyvalue\" or kind == \"keypath\" then\nreturn premake.setkeyvalue(scope, name, value)\nend\nend\nfunction configuration(terms)\nif not terms then\nreturn premake.CurrentConfiguration\nend\nlocal container, err = premake.getobject(\"cont"
"ainer\")\nif (not container) then\nerror(err, 2)\nend\nlocal cfg = { }\ncfg.terms = table.flatten({terms})\ntable.insert(container.blocks, cfg)\npremake.CurrentConfiguration = cfg\ncfg.keywords = { }\nfor _, word in ipairs(cfg.terms) do\ntable.insert(cfg.keywords, path.wildcards(word):lower())\nend\nfor name, field in pairs(premake.fields) do\nif (field.kind ~= \"string\" and field.kind ~= \"path\") then\ncfg[name] = { }\nend\nend\nreturn cfg\nend\nlocal function creategroup(name, sln, curpath, parent, inpath)\nlocal group = {}\nsetmetatable(group, {\n__type = \"group\"\n})\ntable.insert(sln.groups, group)\nsln.groups[inpath] = group\nif parent ~= nil then\ntable.insert(parent.groups, group)\nend\ngroup.solution = sln\ngroup.name = name\ngroup.uuid = os.uuid(curpath)\ngroup.parent = parent\ngroup.projects = { }\ngroup.groups = { }\nreturn group\nend\nlocal function creategroupsfrompath(inpath, sln)\nif inpath == nil then return nil end\ninpath = path.translate(inpath, \"/\")\nlocal groups = string.explode(inpa"
"th, \"/\")\nlocal curpath = \"\"\nlocal lastgroup = nil\nfor i, v in ipairs(groups) do\ncurpath = curpath .. \"/\" .. v:lower()\nlocal group = sln.groups[curpath]\nif group == nil then\ngroup = creategroup(v, sln, curpath, lastgroup, curpath)\nend\nlastgroup = group\nend\nreturn lastgroup\nend\nlocal function createproject(name, sln, isUsage)\nlocal prj = {}\nsetmetatable(prj, {\n__type = \"project\",\n})\ntable.insert(sln.projects, prj)\nif(isUsage) then\nif(sln.projects[name]) then\nsln.projects[name].usageProj = prj;\nelse\nsln.projects[name] = prj\nend\nelse\nif(sln.projects[name]) then\nprj.usageProj = sln.projects[name];\nend\nsln.projects[name] = prj\nend\nlocal group = creategroupsfrompath(premake.CurrentGroup, sln)\nif group ~= nil then\ntable.insert(group.projects, prj)\nend\nprj.solution = sln\nprj.name = name\nprj.basedir = os.getcwd()\nprj.uuid = os.uuid(prj.name)\nprj.blocks = { }\nprj.usage = isUsage\nprj.group = group\nreturn prj;\nend"
"\nfunction usage(name)\nif (not name) then\nif(typex(premake.CurrentContainer) ~= \"project\") then return nil end\nif(not premake.CurrentContainer.usage) then return nil end\nreturn premake.CurrentContainer\nend\nlocal sln\nif (typex(premake.CurrentContainer) == \"project\") then\nsln = premake.CurrentContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (typex(sln) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\nif((not sln.projects[name]) or\n((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then\npremake.CurrentContainer = createproject(name, sln, true)\nelse\npremake.CurrentContainer = iff(sln.projects[name].usage,\nsln.projects[name], sln.projects[name].usageProj)\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction project(name)\nif (not name) then\nif(typex(premake.CurrentContainer) ~= \"project\") then return nil end\nif(premake.CurrentContainer.usage) then return nil end\nreturn premake.CurrentContainer\nend\nlocal sln\nif (typex(pre"
"make.CurrentContainer) == \"project\") then\nsln = premake.CurrentContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (typex(sln) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\nif((not sln.projects[name]) or sln.projects[name].usage) then\npremake.CurrentContainer = createproject(name, sln)\nelse\npremake.CurrentContainer = sln.projects[name];\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction solution(name)\nif not name then\nif typex(premake.CurrentContainer) == \"project\" then\nreturn premake.CurrentContainer.solution\nelse\nreturn premake.CurrentContainer\nend\nend\npremake.CurrentContainer = premake.solution.get(name)\nif (not premake.CurrentContainer) then\npremake.CurrentContainer = premake.solution.new(name)\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction group(name)\nif not name then\nreturn premake.CurrentGroup\nend\npremake.CurrentGroup = name\nreturn premake.CurrentGroup\nend\nfunction importvsproject(location)\nif string.fi"
"nd(_ACTION, \"vs\") ~= 1 then\nerror(\"Only available for visual studio actions\")\nend\nsln, err = premake.getobject(\"solution\")\nif not sln then\nerror(err)\nend\nlocal group = creategroupsfrompath(premake.CurrentGroup, sln)\nlocal project = {}\nproject.location = location\nproject.group = group\nproject.flags = {}\ntable.insert(sln.importedprojects, project)\n end\nfunction newaction(a)\npremake.action.add(a)\nend\nfunction newoption(opt)\npremake.option.add(opt)\nend\nfunction enablefilelevelconfig()\npremake._filelevelconfig = true\nend\nfunction newapifield(field)\npremake.fields[field.name] = field\n_G[field.name] = function(value)\nreturn accessor(field.name, value)\nend\nif field.kind == \"list\"\nor field.kind == \"dirlist\"\nor field.kind == \"filelist\"\nor field.kind == \"absolutefilelist\"\nthen\nif field.name ~= \"removefiles\"\nand field.name ~= \"files\" then\n_G[\"remove\"..field.name] = function(value)\npremake.remove(field.name, value)\nend\nend\nend\nend\nnewapifield {\nname = \"arc"
"hivesplit_size\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"basedir\",\nkind = \"path\",\nscope = \"container\",\n}\nnewapifield {\nname = \"buildaction\",\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"Compile\",\n\"Copy\",\n\"Embed\",\n\"None\"\n}\n}\nnewapifield {\nname = \"buildoptions\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"buildoptions_asm\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"buildoptions_c\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"buildoptions_cpp\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"buildoptions_objc\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"buildoptions_objcpp\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"buildoptions_vala\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"clrreferences\",\nkind = \"list\",\nscope = \"container\",\n}\nnewapifield {\nname"
" = \"configurations\",\nkind = \"list\",\nscope = \"solution\",\n}\nnewapifield {\nname = \"custombuildtask\",\nkind = \"table\",\nscope = \"config\",\n}\nnewapifield {\nname = \"debugcmd\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"debugargs\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"debugdir\",\nkind = \"path\",\nscope = \"config\",\n}\nnewapifield {\nname = \"debugenvs\" ,\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"defines\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"deploymentoptions\",\nkind = \"list\",\nscope = \"config\",\nusagecopy = true,\n}\nnewapifield {\nname = \"dependency\",\nkind = \"table\",\nscope = \"config\",\n}\nnewapifield {\nname = \"deploymode\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"excludes\",\nkind = \"filelist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"forcenative\",\nkind = \"filelist\",\nscope = \"config\",\n}\nnewapifield "
"{\nname = \"nopch\",\nkind = \"filelist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"files\",\nkind = \"filelist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"removefiles\",\nkind = \"filelist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"flags\",\nkind = \"list\",\nscope = \"config\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_flags = {\nAntBuildDebuggable = 1,\nATL = 1,\nC7DebugInfo = 1,\nCpp11 = 1,\nCpp14 = 1,\nCpp17 = 1,\nCppLatest = 1,\nDebugEnvsDontMerge = 1,\nDebugEnvsInherit = 1,\nDeploymentContent = 1,\nEnableMinimalRebuild = 1,\nEnableSSE = 1,\nEnableSSE2 = 1,\nEnableAVX = 1,\nEnableAVX2 = 1,\nPedanticWarnings = 1,\nExtraWarnings = 1,\nFatalWarnings = 1,\nFloatFast = 1,\nFloatStrict = 1,\nFullSymbols = 1,\nHotpatchable = 1,\nLinkSupportCircularDependencies = 1,\nManaged = 1,\nMinimumWarnings = 1,\nMFC = 1,\nNativeWChar = 1,\nNo64BitChecks = 1,\nNoBufferSecurityCheck = 1,\nNoEditAndContinue = 1,\nNoExceptions = 1,\nNoFramePointer = 1,\nNoIm"
"portLib = 1,\nNoIncrementalLink = 1,\nNoJMC = 1,\nNoManifest = 1,\nNoMultiProcessorCompilation = 1,\nNoNativeWChar = 1,\nNoOptimizeLink = 1,\nNoPCH = 1,\nNoRTTI = 1,\nNoRuntimeChecks = 1,\nNoWinMD = 1, -- explicitly disables Windows Metadata\nNoWinRT = 1, -- explicitly disables Windows Runtime Extension\nFastCall = 1,\nStdCall = 1,\nSingleOutputDir = 1,\nObjcARC = 1,\nOptimize = 1,\nOptimizeSize = 1,\nOptimizeSpeed = 1,\nDebugRuntime = 1,\nReleaseRuntime = 1,\nSEH = 1,\nStaticATL = 1,\nStaticRuntime = 1,\nSymbols = 1,\nUnicode = 1,\nUnitySupport = 1,\nUnsafe = 1,\nUnsignedChar = 1,\nUseFullPaths = 1,\nUseLDResponseFile = 1,\nUseObjectResponseFile = 1,\nWinMain = 1\n}\nlocal englishToAmericanSpelling =\n{\nnooptimiselink = 'nooptimizelink',\noptimise = 'optimize',\noptimisesize = 'optimizesize',\noptimisespeed = 'optimizespeed',\n}\nlocal lowervalue = value:lower()\nlowervalue = englishToAmericanSpelling[lowervalue] or lowervalue\nfor v, _ in pairs(allowed_flags) do\nif v:lower() == lowervalue then\nretur"
"n v\nend\nend\nreturn nil, \"invalid flag\"\nend,\n}\nnewapifield {\nname = \"framework\",\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"1.0\",\n\"1.1\",\n\"2.0\",\n\"3.0\",\n\"3.5\",\n\"4.0\",\n\"4.5\",\n\"4.5.1\",\n\"4.5.2\",\n\"4.6\",\n\"4.6.1\",\n\"4.6.2\",\n}\n}\nnewapifield {\nname = \"iostargetplatformversion\",\nkind = \"string\",\nscope = \"project\",\n}\nnewapifield {\nname = \"macostargetplatformversion\",\nkind = \"string\",\nscope = \"project\",\n}\nnewapifield {\nname = \"tvostargetplatformversion\",\nkind = \"string\",\nscope = \"project\",\n}\nnewapifield {\nname = \"windowstargetplatformversion\",\nkind = \"string\",\nscope = \"project\",\n}\nnewapifield {\nname = \"windowstargetplatformminversion\",\nkind = \"string\",\nscope = \"project\",\n}\nnewapifield {\nname = \"forcedincludes\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"imagepath\",\nkind = \"path\",\nscope = \"config\",\n}\nnewapifield {\nname = \"imageoptions\",\nkind = \"list\","
"\nscope = \"config\",\n}\nnewapifield {\nname = \"implibdir\",\nkind = \"path\",\nscope = \"config\",\n}\nnewapifield {\nname = \"implibextension\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"implibname\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"implibprefix\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"implibsuffix\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"includedirs\",\nkind = \"dirlist\",\nscope = \"config\",\nusagecopy = true,\n}\nnewapifield {\nname = \"systemincludedirs\",\nkind = \"dirlist\",\nscope = \"config\",\nusagecopy = true,\n}\nnewapifield {\nname = \"userincludedirs\",\nkind = \"dirlist\",\nscope = \"config\",\nusagecopy = true,\n}\nnewapifield {\nname = \"usingdirs\",\nkind = \"dirlist\",\nscope = \"config\",\nusagecopy = true,\n}\nnewapifield {\nname = \"kind\",\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"ConsoleApp\",\n\"WindowedApp\",\n\"StaticLib"
"\",\n\"SharedLib\",\n\"Bundle\",\n}\n}\nnewapifield {\nname = \"language\",\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"C\",\n\"C++\",\n\"C#\",\n\"Vala\",\n\"Swift\",\n}\n}\nnewapifield {\nname = \"libdirs\",\nkind = \"dirlist\",\nscope = \"config\",\nlinkagecopy = true,\n}\nnewapifield {\nname = \"linkoptions\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"links\",\nkind = \"list\",\nscope = \"config\",\nallowed = function(value)\nif value:find('/', nil, true) then\nvalue = path.getabsolute(value)\nend\nreturn value\nend,\nlinkagecopy = true,\nmergecopiestotail = true,\n}\nnewapifield {\nname = \"location\",\nkind = \"path\",\nscope = \"container\",\n}\nnewapifield {\nname = \"makesettings\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"messageskip\",\nkind = \"list\",\nscope = \"solution\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_messages = {\nSkipCreatingMessage = 1,\nSkipBuildingMessage = 1,\nSkip"
"CleaningMessage = 1,\n}\nlocal lowervalue = value:lower()\nfor v, _ in pairs(allowed_messages) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid message to skip\"\nend,\n}\nnewapifield {\nname = \"msgarchiving\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"msgcompile\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"msgprecompile\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"msgcompile_objc\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"msgresource\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"msglinking\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"objdir\",\nkind = \"path\",\nscope = \"config\",\n}\nnewapifield {\nname = \"options\",\nkind = \"list\",\nscope = \"container\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_options = {\nForceCPP = 1,\nArchiveSplit = 1,\nSkipBundling = 1,\n"
"XcodeLibrarySchemes = 1,\nXcodeSchemeNoConfigs = 1,\n}\nlocal lowervalue = value:lower()\nfor v, _ in pairs(allowed_options) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid option\"\nend,\n}\nnewapifield {\nname = \"pchheader\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"pchsource\",\nkind = \"path\",\nscope = \"config\",\n}\nnewapifield {\nname = \"platforms\",\nkind = \"list\",\nscope = \"solution\",\nallowed = table.keys(premake.platforms),\n}\nnewapifield {\nname = \"postbuildcommands\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"prebuildcommands\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"postcompiletasks\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"prelinkcommands\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"propertysheets\",\nkind = \"dirlist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"pullmappingfile\",\nkind = \"path\",\n"
"scope = \"config\",\n}\nnewapifield {\nname = \"applicationdatadir\",\nkind = \"path\",\nscope = \"config\",\n}\nnewapifield {\nname = \"finalizemetasource\",\nkind = \"path\",\nscope = \"config\",\n}\nnewapifield {\nname = \"resdefines\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"resincludedirs\",\nkind = \"dirlist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"resoptions\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"sdkreferences\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"startproject\",\nkind = \"string\",\nscope = \"solution\",\n}\nnewapifield {\nname = \"targetdir\",\nkind = \"path\",\nscope = \"config\",\n}\nnewapifield {\nname = \"targetsubdir\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"targetextension\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"targetname\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"targetprefix\",\nki"
"nd = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"targetsuffix\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"trimpaths\",\nkind = \"dirlist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"uuid\",\nkind = \"string\",\nscope = \"container\",\nallowed = function(value)\nlocal ok = true\nif (#value ~= 36) then ok = false end\nfor i=1,36 do\nlocal ch = value:sub(i,i)\nif (not ch:find(\"[ABCDEFabcdef0123456789-]\")) then ok = false end\nend\nif (value:sub(9,9) ~= \"-\") then ok = false end\nif (value:sub(14,14) ~= \"-\") then ok = false end\nif (value:sub(19,19) ~= \"-\") then ok = false end\nif (value:sub(24,24) ~= \"-\") then ok = false end\nif (not ok) then\nreturn nil, \"invalid UUID\"\nend\nreturn value:upper()\nend\n}\nnewapifield {\nname = \"uses\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"vapidirs\",\nkind = \"dirlist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"vpaths\",\nkind = \"keypath\",\nscope = \"container\",\n"
"}\nnewapifield {\nname = \"vsimportreferences\",\nkind = \"filelist\",\nscope = \"container\",\n}\nnewapifield {\nname = \"dpiawareness\",\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"None\",\n\"High\",\n\"HighPerMonitor\",\n}\n}\nnewapifield {\nname = \"xcodeprojectopts\",\nkind = \"table\",\nscope = \"config\",\n}\nnewapifield {\nname = \"xcodetargetopts\",\nkind = \"table\",\nscope = \"config\",\n}\nnewapifield {\nname = \"xcodescriptphases\",\nkind = \"table\",\nscope = \"config\",\n}\nnewapifield {\nname = \"xcodecopyresources\",\nkind = \"table\",\nscope = \"project\",\n}\nnewapifield {\nname = \"xcodecopyframeworks\",\nkind = \"filelist\",\nscope = \"project\",\n}\nnewapifield {\nname = \"wholearchive\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"swiftmodulemaps\",\nkind = \"filelist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"buildoptions_swift\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"linkoptions_swift\",\nkind ="
" \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"androidtargetapi\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"androidminapi\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"androidarch\",\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"armv7-a\",\n\"armv7-a-hard\",\n\"arm64-v8a\",\n\"x86\",\n\"x86_64\",\n}\n}\nnewapifield {\nname = \"androidndktoolchainversion\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"androidstltype\",\nkind = \"string\",\nscope = \"config\",\n}\nnewapifield {\nname = \"androidcppstandard\",\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"c++98\",\n\"c++11\",\n\"c++1y\",\n\"gnu++98\",\n\"gnu++11\",\n\"gnu++1y\",\n}\n}\nnewapifield {\nname = \"androidlinker\",\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"bfd\",\n\"gold\",\n}\n}\nnewapifield {\nname = \"androiddebugintentparams\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"antbuildjavasourcedi"
"rs\",\nkind = \"dirlist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"antbuildjardirs\",\nkind = \"dirlist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"antbuildjardependencies\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"antbuildnativelibdirs\",\nkind = \"dirlist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"antbuildnativelibdependencies\",\nkind = \"list\",\nscope = \"config\",\n}\nnewapifield {\nname = \"antbuildassetsdirs\",\nkind = \"dirlist\",\nscope = \"config\",\n}\nnewapifield {\nname = \"postsolutioncallbacks\",\nkind = \"list\",\nscope = \"solution\",\n}\nnewapifield {\nname = \"postprojectcallbacks\",\nkind = \"list\",\nscope = \"project\",\n}\n",
/* base/cmdline.lua */
"newoption\n{\ntrigger = \"cc\",\nvalue = \"VALUE\",\ndescription = \"Choose a C/C++ compiler set\",\nallowed = {\n{ \"gcc\", \"GNU GCC (gcc/g++)\" },\n{ \"ow\", \"OpenWatcom\" },\n{ \"ghs\", \"Green Hills Software\" },\n}\n}\nnewoption\n{\ntrigger = \"dotnet\",\nvalue = \"VALUE\",\ndescription = \"Choose a .NET compiler set\",\nallowed = {\n{ \"msnet\", \"Microsoft .NET (csc)\" },\n{ \"mono\", \"Novell Mono (mcs)\" },\n{ \"pnet\", \"Portable.NET (cscc)\" },\n}\n}\nnewoption\n{\ntrigger = \"file\",\nvalue = \"FILE\",\ndescription = \"Read FILE as a Premake script; default is 'premake4.lua'\"\n}\nnewoption\n{\ntrigger = \"help\",\ndescription = \"Display this information\"\n}\nnewoption\n{\ntrigger = \"os\",\nvalue = \"VALUE\",\ndescription = \"Generate files for a different operating system\",\nallowed = {\n{ \"bsd\", \"OpenBSD, NetBSD, or FreeBSD\" },\n{ \"linux\", \"Linux\" },\n{ \"macosx\", \"Apple Mac OS X\" },\n{ \"solaris\", \"Sola"
"ris\" },\n{ \"windows\", \"Microsoft Windows\" },\n}\n}\nnewoption\n{\ntrigger = \"platform\",\nvalue = \"VALUE\",\ndescription = \"Add target architecture (if supported by action)\",\nallowed = {\n{ \"x32\", \"32-bit\" },\n{ \"x64\", \"64-bit\" },\n{ \"universal\", \"Mac OS X Universal, 32- and 64-bit\" },\n{ \"universal32\", \"Mac OS X Universal, 32-bit only\" },\n{ \"universal64\", \"Mac OS X Universal, 64-bit only\" },\n{ \"ps3\", \"Playstation 3\" },\n{ \"orbis\", \"Playstation 4\" },\n{ \"xbox360\", \"Xbox 360\" },\n{ \"durango\", \"Xbox One\" },\n{ \"ARM\", \"ARM\" },\n{ \"PowerPC\", \"PowerPC\" },\n}\n}\nnewoption\n{\ntrigger = \"scripts\",\nvalue = \"path\",\ndescription = \"Search for additional scripts on the given path\"\n}\nnewoption\n{\ntrigger = \"debug-profiler\",\ndescription = \"GENie script generation profiler.\"\n}\nnewoption\n{\ntrigger = \"version\",\ndescription = \"Display version information\"\n}\n",
/* base/inspect.lua */
"-- Copyright (c) 2013 Enrique García Cota\nlocal function smartQuote(str)\n if str:match('\"') and not str:match(\"'\") then\n return \"'\" .. str .. \"'\"\n end\n return '\"' .. str:gsub('\"', '\\\\\"') .. '\"'\nend\nlocal controlCharsTranslation = {\n [\"\\a\"] = \"\\\\a\", [\"\\b\"] = \"\\\\b\", [\"\\f\"] = \"\\\\f\", [\"\\n\"] = \"\\\\n\",\n [\"\\r\"] = \"\\\\r\", [\"\\t\"] = \"\\\\t\", [\"\\v\"] = \"\\\\v\"\n}\nlocal function escapeChar(c) return controlCharsTranslation[c] end\nlocal function escape(str)\n local result = str:gsub(\"\\\\\", \"\\\\\\\\\"):gsub(\"(%c)\", escapeChar)\n return result\nend\nlocal function isIdentifier(str)\n return type(str) == 'string' and str:match( \"^[_%a][_%a%d]*$\" )\nend\nlocal function isArrayKey(k, length)\n return type(k) == 'number' and 1 <= k and k <= length\nend\nlocal function isDictionaryKey(k, length)\n return not isArrayKey(k, length)\nend\nlocal defaultTypeOrders = {\n ['number'] = 1, ['boolean'] = 2, ['string'] = 3, ['table'] = 4,\n ['fu"
"nction'] = 5, ['userdata'] = 6, ['thread'] = 7\n}\nlocal function sortKeys(a, b)\n local ta, tb = type(a), type(b)\n -- strings and numbers are sorted numerically/alphabetically\n if ta == tb and (ta == 'string' or ta == 'number') then return a < b end\n local dta, dtb = defaultTypeOrders[ta], defaultTypeOrders[tb]\n -- Two default types are compared according to the defaultTypeOrders table\n if dta and dtb then return defaultTypeOrders[ta] < defaultTypeOrders[tb]\n elseif dta then return true -- default types before custom ones\n elseif dtb then return false -- custom types after default ones\n end\n -- custom types are sorted out alphabetically\n return ta < tb\nend\nlocal function getDictionaryKeys(t)\n local keys, length = {}, #t\n for k,_ in pairs(t) do\n if isDictionaryKey(k, length) then table.insert(keys, k) end\n end\n table.sort(keys, sortKeys)\n return keys\nend\nlocal function getToStringResultSafely(t, mt)\n local __tostring = type(mt) == 'table' and rawget(mt, '__tost"
"ring')\n local str, ok\n if type(__tostring) == 'function' then\n ok, str = pcall(__tostring, t)\n str = ok and str or 'error: ' .. tostring(str)\n end\n if type(str) == 'string' and #str > 0 then return str end\nend\nlocal maxIdsMetaTable = {\n __index = function(self, typeName)\n rawset(self, typeName, 0)\n return 0\n end\n}\nlocal idsMetaTable = {\n __index = function (self, typeName)\n local col = setmetatable({}, {__mode = \"kv\"})\n rawset(self, typeName, col)\n return col\n end\n}\nlocal function countTableAppearances(t, tableAppearances)\n tableAppearances = tableAppearances or setmetatable({}, {__mode = \"k\"})\n if type(t) == 'table' then\n if not tableAppearances[t] then\n tableAppearances[t] = 1\n for k,v in pairs(t) do\n countTableAppearances(k, tableAppearances)\n countTableAppearances(v, tableAppearances)\n end\n countTableAppearances(getmetatable(t), tableAppearances)\n else\n tableAppearances[t] = tableAppearances[t] +"
" 1\n end\n end\n return tableAppearances\nend\nlocal function parse_filter(filter)\n if type(filter) == 'function' then return filter end\n -- not a function, so it must be a table or table-like\n filter = type(filter) == 'table' and filter or {filter}\n local dictionary = {}\n for _,v in pairs(filter) do dictionary[v] = true end\n return function(x) return dictionary[x] end\nend\nlocal function makePath(path, key)\n local newPath, len = {}, #path\n for i=1, len do newPath[i] = path[i] end\n newPath[len+1] = key\n return newPath\nend\nfunction inspect(rootObject, options)\n options = options or {}\n local depth = options.depth or math.huge\n local filter = parse_filter(options.filter or {})\n local tableAppearances = countTableAppearances(rootObject)\n local buffer = {}\n local maxIds = setmetatable({}, maxIdsMetaTable)\n local ids = setmetatable({}, idsMetaTable)\n local level = 0\n local blen = 0 -- buffer length\n local function puts(...)\n local args = {...}\n "
"for i=1, #args do\n blen = blen + 1\n buffer[blen] = tostring(args[i])\n end\n end\n local function down(f)\n level = level + 1\n f()\n level = level - 1\n end\n local function tabify()\n puts(\"\\n\", string.rep(\" \", level))\n end\n local function commaControl(needsComma)\n if needsComma then puts(',') end\n return true\n end\n local function alreadyVisited(v)\n return ids[type(v)][v] ~= nil\n end\n local function getId(v)\n local tv = type(v)\n local id = ids[tv][v]\n if not id then\n id = maxIds[tv] + 1\n maxIds[tv] = id\n ids[tv][v] = id\n end\n return id\n end\n local putValue -- forward declaration that needs to go before putTable & putKey\n local function putKey(k)\n if isIdentifier(k) then return puts(k) end\n puts( \"[\" )\n putValue(k, {})\n puts(\"]\")\n end\n local function putTable(t, path)\n if alreadyVisited(t) then\n puts('<table ', getId(t), '>')\n elseif level >= depth then\n "
"puts('{...}')\n else\n if tableAppearances[t] > 1 then puts('<', getId(t), '>') end\n local dictKeys = getDictionaryKeys(t)\n local length = #t\n local mt = getmetatable(t)\n local to_string_result = getToStringResultSafely(t, mt)\n puts('{')\n down(function()\n if to_string_result then\n puts(' -- ', escape(to_string_result))\n if length >= 1 then tabify() end -- tabify the array values\n end\n local needsComma = false\n for i=1, length do\n needsComma = commaControl(needsComma)\n puts(' ')\n putValue(t[i], makePath(path, i))\n end\n for _,k in ipairs(dictKeys) do\n needsComma = commaControl(needsComma)\n tabify()\n putKey(k)\n puts(' = ')\n putValue(t[k], makePath(path, k))\n end\n if mt then\n needsComma = commaControl(needsComma)\n tabify()\n puts('<metatable> = '"
")\n putValue(mt, makePath(path, '<metatable>'))\n end\n end)\n if #dictKeys > 0 or mt then -- dictionary table. Justify closing }\n tabify()\n elseif length > 0 then -- array tables have one extra space before closing }\n puts(' ')\n end\n puts('}')\n end\n end\n -- putvalue is forward-declared before putTable & putKey\n putValue = function(v, path)\n if filter(v, path) then\n puts('<filtered>')\n else\n local tv = type(v)\n if tv == 'string' then\n puts(smartQuote(escape(v)))\n elseif tv == 'number' or tv == 'boolean' or tv == 'nil' then\n puts(tostring(v))\n elseif tv == 'table' then\n putTable(v, path)\n else\n puts('<',tv,' ',getId(v),'>')\n end\n end\n end\n putValue(rootObject, {})\n return table.concat(buffer)\nend\nfunction printtable(name, table)\nprint(\"table: \", name, inspect(table), \"\\n\")\nend\nfunction printstack()\nprint(debug.traceback(), \"\\n\")\nend\n",
/* base/profiler.lua */
"_profiler = {}\nfunction newProfiler(variant, sampledelay)\nif _profiler.running then\nprint(\"Profiler already running.\")\nreturn\nend\nvariant = variant or \"time\"\nif variant ~= \"time\" and variant ~= \"call\" then\nprint(\"Profiler method must be 'time' or 'call'.\")\nreturn\nend\nlocal newprof = {}\nfor k,v in pairs(_profiler) do\nnewprof[k] = v\nend\nnewprof.variant = variant\nnewprof.sampledelay = sampledelay or 100000\nreturn newprof\nend\nfunction _profiler.start(self)\nif _profiler.running then\nreturn\nend\n_profiler.running = self\nself.rawstats = {}\nself.callstack = {}\nif self.variant == \"time\" then\nself.lastclock = os.clock()\ndebug.sethook( _profiler_hook_wrapper_by_time, \"\", self.sampledelay )\nelseif self.variant == \"call\" then\ndebug.sethook( _profiler_hook_wrapper_by_call, \"cr\" )\nelse\nprint(\"Profiler method must be 'time' or 'call'.\")\nsys.exit(1)\nend\nend\nfunction _profiler.stop(self)\nif _profiler.running ~= self then\nreturn\nend\ndebug.sethook( nil )\n_profiler.runnin"
"g = nil\nend\nfunction _profiler_hook_wrapper_by_call(action)\nif _profiler.running == nil then\ndebug.sethook( nil )\nend\n_profiler.running:_internal_profile_by_call(action)\nend\nfunction _profiler_hook_wrapper_by_time(action)\nif _profiler.running == nil then\ndebug.sethook( nil )\nend\n_profiler.running:_internal_profile_by_time(action)\nend\nfunction _profiler._internal_profile_by_call(self,action)\nlocal caller_info = debug.getinfo( 3 )\nif caller_info == nil then\nprint \"No caller_info\"\nreturn\nend\nlocal latest_ar = nil\nif table.getn(self.callstack) > 0 then\nlatest_ar = self.callstack[table.getn(self.callstack)]\nend\nlocal should_not_profile = 0\nfor k,v in pairs(self.prevented_functions) do\nif k == caller_info.func then\nshould_not_profile = v\nend\nend\nif latest_ar then\nif latest_ar.should_not_profile == 2 then\nshould_not_profile = 2\nend\nend\nif action == \"call\" then\nlocal this_ar = {}\nthis_ar.should_not_profile = should_not_profile\nthis_ar.parent_ar = latest_ar\nthis_ar.anon_child "
"= 0\nthis_ar.name_child = 0\nthis_ar.children = {}\nthis_ar.children_time = {}\nthis_ar.clock_start = os.clock()\ntable.insert( self.callstack, this_ar )\nelse\nlocal this_ar = latest_ar\nif this_ar == nil then\nreturn -- No point in doing anything if no upper activation record\nend\nthis_ar.clock_end = os.clock()\nthis_ar.this_time = this_ar.clock_end - this_ar.clock_start\nif this_ar.parent_ar then\nthis_ar.parent_ar.children[caller_info.func] =\n(this_ar.parent_ar.children[caller_info.func] or 0) + 1\nthis_ar.parent_ar.children_time[caller_info.func] =\n(this_ar.parent_ar.children_time[caller_info.func] or 0 ) +\nthis_ar.this_time\nif caller_info.name == nil then\nthis_ar.parent_ar.anon_child =\nthis_ar.parent_ar.anon_child + this_ar.this_time\nelse\nthis_ar.parent_ar.name_child =\nthis_ar.parent_ar.name_child + this_ar.this_time\nend\nend\nif this_ar.should_not_profile == 0 then\nlocal inforec = self:_get_func_rec(caller_info.func,1)\ninforec.count = inforec.count + 1\ninforec.time = inforec.time + this_ar"
".this_time\ninforec.anon_child_time = inforec.anon_child_time + this_ar.anon_child\ninforec.name_child_time = inforec.name_child_time + this_ar.name_child\ninforec.func_info = caller_info\nfor k,v in pairs(this_ar.children) do\ninforec.children[k] = (inforec.children[k] or 0) + v\ninforec.children_time[k] =\n(inforec.children_time[k] or 0) + this_ar.children_time[k]\nend\nend\ntable.remove( self.callstack, table.getn( self.callstack ) )\nend\nend\nfunction _profiler._internal_profile_by_time(self,action)\nlocal timetaken = os.clock() - self.lastclock\nlocal depth = 3\nlocal at_top = true\nlocal last_caller\nlocal caller = debug.getinfo(depth)\nwhile caller do\nif not caller.func then caller.func = \"(tail call)\" end\nif self.prevented_functions[caller.func] == nil then\nlocal info = self:_get_func_rec(caller.func, 1, caller)\ninfo.count = info.count + 1\ninfo.time = info.time + timetaken\nif last_caller then\nif last_caller.name then\ninfo.name_child_time = info.name_child_time + timetaken\nelse\ninfo.anon_ch"
"ild_time = info.anon_child_time + timetaken\nend\ninfo.children[last_caller.func] =\n(info.children[last_caller.func] or 0) + 1\ninfo.children_time[last_caller.func] =\n(info.children_time[last_caller.func] or 0) + timetaken\nend\nend\ndepth = depth + 1\nlast_caller = caller\ncaller = debug.getinfo(depth)\nend\nself.lastclock = os.clock()\nend\nfunction _profiler._get_func_rec(self,func,force,info)\nlocal ret = self.rawstats[func]\nif ret == nil and force ~= 1 then\nreturn nil\nend\nif ret == nil then\nret = {}\nret.func = func\nret.count = 0\nret.time = 0\nret.anon_child_time = 0\nret.name_child_time = 0\nret.children = {}\nret.children_time = {}\nret.func_info = info\nself.rawstats[func] = ret\nend\nreturn ret\nend\nfunction _profiler.report( self, outfile, sort_by_total_time )\noutfile:write\n[[Lua Profile output created by profiler.lua. Copyright Pepperfish 2002+\n]]\nlocal terms = {}\nif self.variant == \"time\" then\nterms.capitalized = \"Sample\"\nterms.single = \"sample\"\nterms.pastverb = \"sampled\""
"\nelseif self.variant == \"call\" then\nterms.capitalized = \"Call\"\nterms.single = \"call\"\nterms.pastverb = \"called\"\nelse\nassert(false)\nend\nlocal total_time = 0\nlocal ordering = {}\nfor func,record in pairs(self.rawstats) do\ntable.insert(ordering, func)\nend\nif sort_by_total_time then\ntable.sort( ordering,\nfunction(a,b) return self.rawstats[a].time > self.rawstats[b].time end\n)\nelse\ntable.sort( ordering,\nfunction(a,b)\nlocal arec = self.rawstats[a]\nlocal brec = self.rawstats[b]\nlocal atime = arec.time - (arec.anon_child_time + arec.name_child_time)\nlocal btime = brec.time - (brec.anon_child_time + brec.name_child_time)\nreturn atime > btime\nend\n)\nend\nfor i=1,#ordering do\nlocal func = ordering[i]\nlocal record = self.rawstats[func]\nlocal thisfuncname = \" \" .. self:_pretty_name(func) .. \" \"\nif string.len( thisfuncname ) < 42 then\nthisfuncname = string.rep( \"-\", math.floor((42 - string.len(thisfuncname))/2) ) .. thisfuncname\nthisfuncname = thisfuncname .. string.rep( \"-\", 42"
" - string.len(thisfuncname) )\nend\ntotal_time = total_time + ( record.time - ( record.anon_child_time +\nrecord.name_child_time ) )\noutfile:write( string.rep( \"-\", 19 ) .. thisfuncname ..\nstring.rep( \"-\", 19 ) .. \"\\n\" )\noutfile:write( terms.capitalized..\" count: \" ..\nstring.format( \"%4d\", record.count ) .. \"\\n\" )\noutfile:write( \"Time spend total: \" ..\nstring.format( \"%4.3f\", record.time ) .. \"s\\n\" )\noutfile:write( \"Time spent in children: \" ..\nstring.format(\"%4.3f\",record.anon_child_time+record.name_child_time) ..\n\"s\\n\" )\nlocal timeinself =\nrecord.time - (record.anon_child_time + record.name_child_time)\noutfile:write( \"Time spent in self: \" ..\nstring.format(\"%4.3f\", timeinself) .. \"s\\n\" )\noutfile:write( \"Time spent per \" .. terms.single .. \": \" ..\nstring.format(\"%4.5f\", record.time/record.count) ..\n\"s/\" .. terms.single .. \"\\n\" )\noutfile:write( \"Time spent in self per \"..terms.single..\": \" ..\nstring.format( \"%4.5f\", timein"
"self/record.count ) .. \"s/\" ..\nterms.single..\"\\n\" )\nlocal added_blank = 0\nfor k,v in pairs(record.children) do\nif self.prevented_functions[k] == nil or\nself.prevented_functions[k] == 0\nthen\nif added_blank == 0 then\noutfile:write( \"\\n\" ) -- extra separation line\nadded_blank = 1\nend\noutfile:write( \"Child \" .. self:_pretty_name(k) ..\nstring.rep( \" \", 41-string.len(self:_pretty_name(k)) ) .. \" \" ..\nterms.pastverb..\" \" .. string.format(\"%6d\", v) )\noutfile:write( \" times. Took \" ..\nstring.format(\"%4.2f\", record.children_time[k] ) .. \"s\\n\" )\nend\nend\noutfile:write( \"\\n\" ) -- extra separation line\noutfile:flush()\nend\noutfile:write( \"\\n\\n\" )\noutfile:write( \"Total time spent in profiled functions: \" ..\nstring.format(\"%5.3g\",total_time) .. \"s\\n\" )\noutfile:write( [[\nEND\n]] )\noutfile:flush()\nend\nfunction _profiler.lua_report(self,outfile)\nlocal ordering = {}\nlocal functonum = {}\nfor func,record in pairs(self.rawstats) do\ntable.insert(ordering, func)\nfu"
"nctonum[func] = table.getn(ordering)\nend\noutfile:write(\n\"-- Profile generated by profiler.lua Copyright Pepperfish 2002+\\n\\n\" )\noutfile:write( \"-- Function names\\nfuncnames = {}\\n\" )\nfor i=1,table.getn(ordering) do\nlocal thisfunc = ordering[i]\noutfile:write( \"funcnames[\" .. i .. \"] = \" ..\nstring.format(\"%q\", self:_pretty_name(thisfunc)) .. \"\\n\" )\nend\noutfile:write( \"\\n\" )\noutfile:write( \"-- Function times\\nfunctimes = {}\\n\" )\nfor i=1,table.getn(ordering) do\nlocal thisfunc = ordering[i]\nlocal record = self.rawstats[thisfunc]\noutfile:write( \"functimes[\" .. i .. \"] = { \" )\noutfile:write( \"tot=\" .. record.time .. \", \" )\noutfile:write( \"achild=\" .. record.anon_child_time .. \", \" )\noutfile:write( \"nchild=\" .. record.name_child_time .. \", \" )\noutfile:write( \"count=\" .. record.count .. \" }\\n\" )\nend\noutfile:write( \"\\n\" )\noutfile:write( \"-- Child links\\nchildren = {}\\n\" )\nfor i=1,table.getn(ordering) do\nlocal thisfunc = ordering[i]\nlocal record"
" = self.rawstats[thisfunc]\noutfile:write( \"children[\" .. i .. \"] = { \" )\nfor k,v in pairs(record.children) do\nif functonum[k] then -- non-recorded functions will be ignored now\noutfile:write( functonum[k] .. \", \" )\nend\nend\noutfile:write( \"}\\n\" )\nend\noutfile:write( \"\\n\" )\noutfile:write( \"-- Child call counts\\nchildcounts = {}\\n\" )\nfor i=1,table.getn(ordering) do\nlocal thisfunc = ordering[i]\nlocal record = self.rawstats[thisfunc]\noutfile:write( \"children[\" .. i .. \"] = { \" )\nfor k,v in record.children do\nif functonum[k] then -- non-recorded functions will be ignored now\noutfile:write( v .. \", \" )\nend\nend\noutfile:write( \"}\\n\" )\nend\noutfile:write( \"\\n\" )\noutfile:write( \"-- Child call time\\nchildtimes = {}\\n\" )\nfor i=1,table.getn(ordering) do\nlocal thisfunc = ordering[i]\nlocal record = self.rawstats[thisfunc];\noutfile:write( \"children[\" .. i .. \"] = { \" )\nfor k,v in pairs(record.children) do\nif functonum[k] then -- non-recorded functions will be ignor"
"ed now\noutfile:write( record.children_time[k] .. \", \" )\nend\nend\noutfile:write( \"}\\n\" )\nend\noutfile:write( \"\\n\\n-- That is all.\\n\\n\" )\noutfile:flush()\nend\nfunction _profiler._pretty_name(self,func)\nlocal info = self.rawstats[ func ].func_info\nlocal name = \"\"\nif info.what == \"Lua\" then\nname = \"L:\"\nend\nif info.what == \"C\" then\nname = \"C:\"\nend\nif info.what == \"main\" then\nname = \" :\"\nend\nif info.name == nil then\nname = name .. \"<\"..tostring(func) .. \">\"\nelse\nname = name .. info.name\nend\nif info.source then\nname = name\nelse\nif info.what == \"C\" then\nname = name .. \"@?\"\nelse\nname = name .. \"@<string>\"\nend\nend\nname = name .. \":\"\nif info.what == \"C\" then\nname = name .. \"?\"\nelse\nname = name .. info.linedefined\nend\nreturn name\nend\nfunction _profiler.prevent(self, func, level)\nself.prevented_functions[func] = (level or 1)\nend\n_profiler.prevented_functions = {\n[_profiler.start] = 2,\n[_profiler.stop] = 2,\n[_profiler._internal_profile_by"
"_time] = 2,\n[_profiler._internal_profile_by_call] = 2,\n[_profiler_hook_wrapper_by_time] = 2,\n[_profiler_hook_wrapper_by_call] = 2,\n[_profiler.prevent] = 2,\n[_profiler._get_func_rec] = 2,\n[_profiler.report] = 2,\n[_profiler.lua_report] = 2,\n[_profiler._pretty_name] = 2\n}\n",
/* tools/dotnet.lua */
"premake.dotnet = { }\npremake.dotnet.namestyle = \"windows\"\nlocal flags =\n{\nFatalWarning = \"/warnaserror\",\nOptimize = \"/optimize\",\nOptimizeSize = \"/optimize\",\nOptimizeSpeed = \"/optimize\",\nSymbols = \"/debug\",\nUnsafe = \"/unsafe\"\n}\nfunction premake.dotnet.getbuildaction(fcfg)\nlocal ext = path.getextension(fcfg.name):lower()\nif fcfg.buildaction == \"Compile\" or ext == \".cs\" then\nreturn \"Compile\"\nelseif fcfg.buildaction == \"Embed\" or ext == \".resx\" then\nreturn \"EmbeddedResource\"\nelseif fcfg.buildaction == \"Copy\" or ext == \".asax\" or ext == \".aspx\" then\nreturn \"Content\"\nelse\nreturn \"None\"\nend\nend\nfunction premake.dotnet.getcompilervar(cfg)\nif (_OPTIONS.dotnet == \"msnet\") then\nreturn \"csc\"\nelseif (_OPTIONS.dotnet == \"mono\") then\nreturn \"mcs\"\nelse\nreturn \"cscc\"\nend\nend\nfunction premake.dotnet.getflags(cfg)\nlocal result = table.translate(cfg.flags, flags)\nreturn result\nend\nfunction premake.dotnet.getkind(cfg)\nif (c"
"fg.kind == \"ConsoleApp\") then\nreturn \"Exe\"\nelseif (cfg.kind == \"WindowedApp\") then\nreturn \"WinExe\"\nelseif (cfg.kind == \"SharedLib\") then\nreturn \"Library\"\nend\nend\n",
/* tools/gcc.lua */
"premake.gcc = { }\npremake.gcc.cc = \"gcc\"\npremake.gcc.cxx = \"g++\"\npremake.gcc.ar = \"ar\"\npremake.gcc.rc = \"windres\"\npremake.gcc.llvm = false\nlocal cflags =\n{\nEnableSSE = \"-msse\",\nEnableSSE2 = \"-msse2\",\nEnableAVX = \"-mavx\",\nEnableAVX2 = \"-mavx2\",\nPedanticWarnings = \"-Wall -Wextra -pedantic\",\nExtraWarnings = \"-Wall -Wextra\",\nFatalWarnings = \"-Werror\",\nFloatFast = \"-ffast-math\",\nFloatStrict = \"-ffloat-store\",\nNoFramePointer = \"-fomit-frame-pointer\",\nOptimize = \"-O2\",\nOptimizeSize = \"-Os\",\nOptimizeSpeed = \"-O3\",\nSymbols = \"-g\",\n}\nlocal cxxflags =\n{\nCpp11 = \"-std=c++11\",\nCpp14 = \"-std=c++14\",\nCpp17 = \"-std=c++17\",\nCppLatest = \"-std=c++2a\",\nNoExceptions = \"-fno-exceptions\",\nNoRTTI = \"-fno-rtti\",\nUnsignedChar = \"-funsigned-char\",\n}\nlocal objcflags =\n{\nObjcARC = \"-fobjc-arc\",\n}\npremake.gcc.platforms =\n{\nNative = {\n"
"cppflags = \"-MMD -MP\",\n},\nx32 = {\ncppflags = \"-MMD -MP\",\nflags = \"-m32\",\n},\nx64 = {\ncppflags = \"-MMD -MP\",\nflags = \"-m64\",\n},\nUniversal = {\nar = \"libtool\",\ncppflags = \"-MMD -MP\",\nflags = \"-arch i386 -arch x86_64 -arch ppc -arch ppc64\",\n},\nUniversal32 = {\nar = \"libtool\",\ncppflags = \"-MMD -MP\",\nflags = \"-arch i386 -arch ppc\",\n},\nUniversal64 = {\nar = \"libtool\",\ncppflags = \"-MMD -MP\",\nflags = \"-arch x86_64 -arch ppc64\",\n},\nPS3 = {\ncc = \"ppu-lv2-g++\",\ncxx = \"ppu-lv2-g++\",\nar = \"ppu-lv2-ar\",\ncppflags = \"-MMD -MP\",\n},\nWiiDev = {\ncppflags = \"-MMD -MP -I$(LIBOGC_INC) $(MACHDEP)\",\nldflags= \"-L$(LIBOGC_LIB) $(MACHDEP)\",\ncfgsettings = [[\n ifeq ($(strip $(DEVKITPPC)),)\n $(error \"DEVKITPPC environment variable is not set\")'\n endif\n include $(DEVKITPPC)/wii_rules']],\n},\nOrbis = {\ncc = \"orbis-clang\",\ncxx = \"orbis-clang++\",\nar = \"orbis-ar\",\ncppflag"
"s = \"-MMD -MP\",\n},\nEmscripten = {\ncc = \"$(EMSCRIPTEN)/emcc\",\ncxx = \"$(EMSCRIPTEN)/em++\",\nar = \"$(EMSCRIPTEN)/emar\",\ncppflags = \"-MMD -MP\",\n}\n}\nlocal platforms = premake.gcc.platforms\nfunction premake.gcc.getcppflags(cfg)\nlocal flags = { }\ntable.insert(flags, platforms[cfg.platform].cppflags)\nif flags[1]:startswith(\"-MMD\") then\ntable.insert(flags, \"-MP\")\nend\nreturn flags\nend\nfunction premake.gcc.getcflags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\ntable.insert(result, platforms[cfg.platform].flags)\nif cfg.system ~= \"windows\" and cfg.kind == \"SharedLib\" then\ntable.insert(result, \"-fPIC\")\nend\nreturn result\nend\nfunction premake.gcc.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxflags)\nreturn result\nend\nfunction premake.gcc.getobjcflags(cfg)\nreturn table.translate(cfg.flags, objcflags)\nend\nfunction premake.gcc.getldflags(cfg)\nlocal result = { }\nif not cfg.flags.Symbols then\nif cfg.system == \"macosx\" then"
"\nelse\ntable.insert(result, \"-s\")\nend\nend\nif cfg.kind == \"Bundle\" then\ntable.insert(result, \"-bundle\")\nend\nif cfg.kind == \"SharedLib\" then\nif cfg.system == \"macosx\" then\ntable.insert(result, \"-dynamiclib\")\nelse\ntable.insert(result, \"-shared\")\nend\nif cfg.system == \"windows\" and not cfg.flags.NoImportLib then\ntable.insert(result, '-Wl,--out-implib=\"' .. cfg.linktarget.fullpath .. '\"')\nend\nend\nif cfg.kind == \"WindowedApp\" and cfg.system == \"windows\" then\ntable.insert(result, \"-mwindows\")\nend\nlocal platform = platforms[cfg.platform]\ntable.insert(result, platform.flags)\ntable.insert(result, platform.ldflags)\nreturn result\nend\nfunction premake.gcc.getlibdirflags(cfg)\nlocal result = { }\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\ntable.insert(result, '-L\\\"' .. value .. '\\\"')\nend\nreturn result\nend\nfunction premake.gcc.islibfile(p)\nif path.getextension(p) == \".a\" then\nreturn true\nend\nreturn false\nend\nfunction premake.gcc.ge"
"tlibfiles(cfg)\nlocal result = {}\nfor _, value in ipairs(premake.getlinks(cfg, \"system\", \"fullpath\")) do\nif premake.gcc.islibfile(value) then\ntable.insert(result, _MAKE.esc(value))\nend\nend\nreturn result\nend\nfunction premake.gcc.getlinkflags(cfg)\nlocal result = {}\nfor _, value in ipairs(premake.getlinks(cfg, \"system\", \"fullpath\")) do\nif premake.gcc.islibfile(value) then\nvalue = path.rebase(value, cfg.project.location, cfg.location)\ntable.insert(result, _MAKE.esc(value))\nelseif path.getextension(value) == \".framework\" then\ntable.insert(result, '-framework ' .. _MAKE.esc(path.getbasename(value)))\nelse\ntable.insert(result, '-l' .. _MAKE.esc(path.getname(value)))\nend\nend\nreturn result\nend\nfunction premake.gcc.wholearchive(lib)\nif premake.gcc.llvm then\nreturn {\"-force_load\", lib}\nelse\nreturn {\"-Wl,--whole-archive\", lib, \"-Wl,--no-whole-archive\"}\nend\nend\nfunction premake.gcc.getarchiveflags(prj, cfg, ndx)\nlocal result = {}\nif cfg.platform:startswith(\"Universal\") then\n"
"if prj.options.ArchiveSplit then\nerror(\"gcc tool 'Universal*' platforms do not support split archives\")\nend\ntable.insert(result, '-o')\nelse\nif (not prj.options.ArchiveSplit) then\nif premake.gcc.llvm then\ntable.insert(result, 'rcs')\nelse\ntable.insert(result, '-rcs')\nend\nelse\nif premake.gcc.llvm then\nif (not ndx) then\ntable.insert(result, 'qc')\nelse\ntable.insert(result, 'cs')\nend\nelse\nif (not ndx) then\ntable.insert(result, '-qc')\nelse\ntable.insert(result, '-cs')\nend\nend\nend\nend\nreturn result\nend\nfunction premake.gcc.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, \"-D\" .. def)\nend\nreturn result\nend\nfunction premake.gcc.getincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, \"-I\\\"\" .. dir .. \"\\\"\")\nend\nreturn result\nend\nfunction premake.gcc.getquoteincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, \"-iquote \\\"\" .. "
"dir .. \"\\\"\")\nend\nreturn result\nend\nfunction premake.gcc.getsystemincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, \"-isystem \\\"\" .. dir .. \"\\\"\")\nend\nreturn result\nend\nfunction premake.gcc.getcfgsettings(cfg)\nreturn platforms[cfg.platform].cfgsettings\nend\n",
/* tools/ghs.lua */
"premake.ghs = { }\npremake.ghs.namestyle = \"PS3\"\npremake.ghs.cc = \"ccppc\"\npremake.ghs.cxx = \"cxppc\"\npremake.ghs.ar = \"cxppc\"\nlocal cflags =\n{\nFatalWarnings = \"--quit_after_warnings\",\nOptimize = \"-Ogeneral\",\nOptimizeSize = \"-Osize\",\nOptimizeSpeed = \"-Ospeed\",\nSymbols = \"-g\",\n}\nlocal cxxflags =\n{\nNoExceptions = \"--no_exceptions\",\nNoRTTI = \"--no_rtti\",\nUnsignedChar = \"--unsigned_chars\",\n}\npremake.ghs.platforms =\n{\nNative = {\ncppflags = \"-MMD\",\n},\nPowerPC = {\ncc = \"ccppc\",\ncxx = \"cxppc\",\nar = \"cxppc\",\ncppflags = \"-MMD\",\narflags = \"-archive -o\",\n},\nARM = {\ncc = \"ccarm\",\ncxx = \"cxarm\",\nar = \"cxarm\",\ncppflags = \"-MMD\",\narflags = \"-archive -o\",\n}\n}\nlocal platforms = premake.ghs.platforms\nfunction premake.ghs.getcppflags(cfg)\nlocal flags = { }\ntable.insert(flags, platforms[cfg.platform].cppflags)\nreturn flags\nend\nfunction premake.ghs.getcf"
"lags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\ntable.insert(result, platforms[cfg.platform].flags)\nreturn result\nend\nfunction premake.ghs.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxflags)\nreturn result\nend\nfunction premake.ghs.getldflags(cfg)\nlocal result = { }\nlocal platform = platforms[cfg.platform]\ntable.insert(result, platform.flags)\ntable.insert(result, platform.ldflags)\nreturn result\nend\nfunction premake.ghs.getlibdirflags(cfg)\nlocal result = { }\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\ntable.insert(result, '-L' .. _MAKE.esc(value))\nend\nreturn result\nend\nfunction premake.ghs.getlibfiles(cfg)\nlocal result = {}\nreturn result\nend\nfunction premake.ghs.getlinkflags(cfg)\nlocal result = {}\nfor _, value in ipairs(premake.getlinks(cfg, \"system\", \"name\")) do\ntable.insert(result, '-lnk=' .. _MAKE.esc(value))\nend\nreturn result\nend\nfunction premake.ghs.getarchiveflags(prj, cfg, ndx)\nif prj.options.ArchiveSplit then"
"\nerror(\"ghs tool does not support split archives\")\nend\nlocal result = {}\nlocal platform = platforms[cfg.platform]\ntable.insert(result, platform.arflags)\nreturn result\nend\nfunction premake.ghs.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\nfunction premake.ghs.getincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, \"-I\" .. _MAKE.esc(dir))\nend\nreturn result\nend\nfunction premake.ghs.getcfgsettings(cfg)\nreturn platforms[cfg.platform].cfgsettings\nend\n",
/* tools/msc.lua */
"premake.msc = { }\npremake.msc.namestyle = \"windows\"\n",
/* tools/ow.lua */
"premake.ow = { }\npremake.ow.namestyle = \"windows\"\npremake.ow.cc = \"WCL386\"\npremake.ow.cxx = \"WCL386\"\npremake.ow.ar = \"ar\"\nlocal cflags =\n{\nPedanticWarnings = \"-wx\",\nExtraWarnings = \"-wx\",\nFatalWarning = \"-we\",\nFloatFast = \"-omn\",\nFloatStrict = \"-op\",\nOptimize = \"-ox\",\nOptimizeSize = \"-os\",\nOptimizeSpeed = \"-ot\",\nSymbols = \"-d2\",\n}\nlocal cxxflags =\n{\nNoExceptions = \"-xd\",\nNoRTTI = \"-xr\",\n}\npremake.ow.platforms =\n{\nNative = {\nflags = \"\"\n},\n}\nfunction premake.ow.getcppflags(cfg)\nreturn {}\nend\nfunction premake.ow.getcflags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\nif (cfg.flags.Symbols) then\ntable.insert(result, \"-hw\") -- Watcom debug format for Watcom debugger\nend\nreturn result\nend\nfunction premake.ow.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxflags)\nreturn result\nend\nfunction premake.ow.getldflags(cfg)\nlocal result = { }\nif (cfg.flags.Symb"
"ols) then\ntable.insert(result, \"op symf\")\nend\nreturn result\nend\nfunction premake.ow.getlibfiles(cfg)\nlocal result = {}\nreturn result\nend\nfunction premake.ow.getlinkflags(cfg)\nlocal result = { }\nreturn result\nend\nfunction premake.ow.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\nfunction premake.ow.getincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, '-I \"' .. dir .. '\"')\nend\nreturn result\nend\n",
/* tools/snc.lua */
"premake.snc = { }\npremake.snc.cc = \"snc\"\npremake.snc.cxx = \"g++\"\npremake.snc.ar = \"ar\"\nlocal cflags =\n{\nPedanticWarnings = \"-Xdiag=2\",\nExtraWarnings = \"-Xdiag=2\",\nFatalWarnings = \"-Xquit=2\",\n}\nlocal cxxflags =\n{\nNoExceptions = \"\", -- No exceptions is the default in the SNC compiler.\nNoRTTI = \"-Xc-=rtti\",\n}\npremake.snc.platforms =\n{\nPS3 = {\ncc = \"ppu-lv2-g++\",\ncxx = \"ppu-lv2-g++\",\nar = \"ppu-lv2-ar\",\ncppflags = \"-MMD -MP\",\n}\n}\nlocal platforms = premake.snc.platforms\nfunction premake.snc.getcppflags(cfg)\nlocal result = { }\ntable.insert(result, platforms[cfg.platform].cppflags)\nreturn result\nend\nfunction premake.snc.getcflags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\ntable.insert(result, platforms[cfg.platform].flags)\nif cfg.kind == \"SharedLib\" then\ntable.insert(result, \"-fPIC\")\nend\nreturn result\nend\nfunction premake.snc.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxfl"
"ags)\nreturn result\nend\nfunction premake.snc.getldflags(cfg)\nlocal result = { }\nif not cfg.flags.Symbols then\ntable.insert(result, \"-s\")\nend\nif cfg.kind == \"SharedLib\" then\ntable.insert(result, \"-shared\")\nif not cfg.flags.NoImportLib then\ntable.insert(result, '-Wl,--out-implib=\"' .. cfg.linktarget.fullpath .. '\"')\nend\nend\nlocal platform = platforms[cfg.platform]\ntable.insert(result, platform.flags)\ntable.insert(result, platform.ldflags)\nreturn result\nend\nfunction premake.snc.getlibdirflags(cfg)\nlocal result = { }\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\ntable.insert(result, '-L' .. _MAKE.esc(value))\nend\nreturn result\nend\nfunction premake.snc.getlibfiles(cfg)\nlocal result = {}\nreturn result\nend\nfunction premake.snc.getlinkflags(cfg)\nlocal result = {}\nfor _, value in ipairs(premake.getlinks(cfg, \"system\", \"name\")) do\ntable.insert(result, '-l' .. _MAKE.esc(value))\nend\nreturn result\nend\nfunction premake.snc.getdefines(defines)\nlocal r"
"esult = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\nfunction premake.snc.getincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, \"-I\" .. _MAKE.esc(dir))\nend\nreturn result\nend\n",
/* tools/valac.lua */
"premake.valac = { }\npremake.valac.valac = \"valac\"\npremake.valac.cc = \"gcc\"\nlocal valaflags =\n{\nDisableAssert = \"--disable-assert\", -- Disable assertions\nDisableSinceCheck = \"--disable-since-check\", -- Do not check whether used symbols exist in local packages\nDisableWarnings = \"--disable-warnings\", -- Disable warnings\nEnableChecking = \"--enable-checking\", -- Enable additional run-time checks\nEnableDeprecated = \"--enable-deprecated\", -- Enable deprecated features\nEnableExperimental = \"--enable-experimental\", -- Enable experimental features\nEnableExperimentalNonNull = \"--enable-experimental-non-null\", -- Enable experimental enhancements for non-null types\nEnableGObjectTracing = \"--enable-gobject-tracing\", -- Enable GObject creation tracing\nEnableMemProfiler = \"--enable-mem-profiler\", -- Enable GLib memory profiler\nEnableTh"
"reading = \"--thread\", -- Enable multithreading support\nFatalWarnings = \"--fatal-warnings\", -- Treat warnings as fatal\nHideInternal = \"--hide-internal\", -- Hide symbols marked as internal\nNoStdPkg = \"--nostdpkg\", -- Do not include standard packages\nOptimize = \"-X -O2\",\nOptimizeSize = \"-X -Os\",\nOptimizeSpeed = \"-X -O3\",\nSymbols = \"-g\", -- Produce debug information\n}\npremake.valac.platforms = {}\nfunction premake.valac.getvalaflags(cfg)\nreturn table.translate(cfg.flags, valaflags)\nend\nfunction premake.valac.getlinks(links)\nlocal result = { }\nfor _, pkg in ipairs(links) do\ntable.insert(result, '--pkg ' .. pkg)\nend\nreturn result\nend\nfunction premake.valac.getdefines(defines)\nlocal result = { }\nfor _, def in ipairs(defines) do\ntable.insert(result, '-D ' .. def)\nend\nretu"
"rn result\nend\nfunction premake.valac.getbuildoptions(buildoptions)\nlocal result = { }\nfor _, def in ipairs(buildoptions) do\ntable.insert(result, '-X ' .. def)\nend\nreturn result\nend\nfunction premake.valac.getvapidirs(vapidirs)\nlocal result = { }\nfor _, def in ipairs(vapidirs) do\ntable.insert(result, '--vapidir=' .. def)\nend\nreturn result\nend\n",
/* tools/swift.lua */
"premake.swift = { }\npremake.swift.swiftc = \"swiftc\"\npremake.swift.swift = \"swift\"\npremake.swift.cc = \"gcc\"\npremake.swift.ar = \"ar\"\npremake.swift.ld = \"ld\"\npremake.swift.dsymutil = \"dsymutil\"\nlocal swiftcflags =\n{\nSymbols = \"-g\", -- Produce debug information\nDisableWarnings = \"--suppress-warnings\", -- Disable warnings\nFatalWarnings = \"--warnings-as-errors\", -- Treat warnings as fatal\nOptimize = \"-O -whole-module-optimization\",\nOptimizeSize = \"-O -whole-module-optimization\",\nOptimizeSpeed = \"-Ounchecked -whole-module-optimization\",\nMinimumWarnings = \"-minimum-warnings\",\n}\nlocal swiftlinkflags = {\nStaticRuntime = \"-static-stdlib\",\n}\npremake.swift.platforms = {\nNative = {\nswiftcflags = \"\",\nswiftlinkflags = \"\",\n},\nx64 = {\nswiftcflags = \"\",\nswiftlinkflags = \"\",\n}\n}\nlocal p"
"latforms = premake.swift.platforms\nfunction premake.swift.get_sdk_path(cfg)\nreturn string.trim(os.outputof(\"xcrun --show-sdk-path\"))\nend\nfunction premake.swift.get_sdk_platform_path(cfg)\nreturn string.trim(os.outputof(\"xcrun --show-sdk-platform-path\"))\nend\nfunction premake.swift.get_toolchain_path(cfg)\nreturn string.trim(os.outputof(\"xcode-select -p\")) .. \"/Toolchains/XcodeDefault.xctoolchain\"\nend\nfunction premake.swift.gettarget(cfg)\nreturn \"-target x86_64-apple-macosx10.11\"\nend\nfunction premake.swift.getswiftcflags(cfg)\nlocal result = table.translate(cfg.flags, swiftcflags)\ntable.insert(result, platforms[cfg.platform].swiftcflags)\nresult = table.join(result, cfg.buildoptions_swift)\nif cfg.kind == \"SharedLib\" or cfg.kind == \"StaticLib\" then\ntable.insert(result, \"-parse-as-library\")\nend\ntable.insert(result, premake.swift.gettarget(cfg))\nreturn result\nend\nfunction premake.swift.getswiftlinkflags(cfg)\nlocal result = table.translate(cfg.flags, swiftlinkflags)\ntable.insert("
"result, platforms[cfg.platform].swiftlinkflags)\nresult = table.join(result, cfg.linkoptions_swift)\nif cfg.kind == \"SharedLib\" or cfg.kind == \"StaticLib\" then\ntable.insert(result, \"-emit-library\")\nelse\ntable.insert(result, \"-emit-executable\")\nend\ntable.insert(result, premake.swift.gettarget(cfg))\nreturn result\nend\nfunction premake.swift.getmodulemaps(cfg)\nlocal maps = {}\nif next(cfg.swiftmodulemaps) then\nfor _, mod in ipairs(cfg.swiftmodulemaps) do\ntable.insert(maps, string.format(\"-Xcc -fmodule-map-file=%s\", mod))\nend\nend\nreturn maps\nend\nfunction premake.swift.getlibdirflags(cfg)\nreturn premake.gcc.getlibdirflags(cfg)\nend\nfunction premake.swift.getldflags(cfg)\nlocal result = { platforms[cfg.platform].ldflags }\nlocal links = premake.getlinks(cfg, \"siblings\", \"basename\")\nfor _,v in ipairs(links) do\nif path.getextension(v) == \".framework\" then\ntable.insert(result, \"-framework \"..v)\nelse\ntable.insert(result, \"-l\"..v)\nend\nend\nreturn result\nend\nfunction premake.s"
"wift.getlinkflags(cfg)\nreturn premake.gcc.getlinkflags(cfg)\nend\nfunction premake.swift.getarchiveflags(cfg)\nreturn \"\"\nend\n",
/* base/validate.lua */
"function premake.checkprojects()\nlocal action = premake.action.current()\nfor sln in premake.solution.each() do\nif (#sln.projects == 0) then\nreturn nil, \"solution '\" .. sln.name .. \"' needs at least one project\"\nend\nif (#sln.configurations == 0) then\nreturn nil, \"solution '\" .. sln.name .. \"' needs configurations\"\nend\nfor prj in premake.solution.eachproject(sln) do\nif (not prj.language) then\nreturn nil, \"project '\" ..prj.name .. \"' needs a language\"\nend\nif (action.valid_languages) then\nif (not table.contains(action.valid_languages, prj.language)) then\nreturn nil, \"the \" .. action.shortname .. \" action does not support \" .. prj.language .. \" projects\"\nend\nend\nfor cfg in premake.eachconfig(prj) do\nif (not cfg.kind) then\nreturn nil, \"project '\" ..prj.name .. \"' needs a kind in configuration '\" .. cfg.name .. \"'\"\nend\nif (action.valid_kinds) then\nif (not table.contains(action.valid_kinds, cfg.kind)) then\nreturn nil, \"the \" .. action.shortname .. \" action does not su"
"pport \" .. cfg.kind .. \" projects\"\nend\nend\nend\nif action.oncheckproject then\naction.oncheckproject(prj)\nend\nend\nend\nreturn true\nend\nfunction premake.checktools()\nlocal action = premake.action.current()\nif (not action.valid_tools) then \nreturn true \nend\nfor tool, values in pairs(action.valid_tools) do\nif (_OPTIONS[tool]) then\nif (not table.contains(values, _OPTIONS[tool])) then\nreturn nil, \"the \" .. action.shortname .. \" action does not support /\" .. tool .. \"=\" .. _OPTIONS[tool] .. \" (yet)\"\nend\nelse\n_OPTIONS[tool] = values[1]\nend\nend\nreturn true\nend\n",
/* base/help.lua */
"function premake.showhelp()\nprintf(\"\")\nprintf(\"Usage: genie [options] action [arguments]\")\nprintf(\"\")\nprintf(\"OPTIONS\")\nprintf(\"\")\nfor option in premake.option.each() do\nlocal trigger = option.trigger\nlocal description = option.description\nif (option.value) then trigger = trigger .. \"=\" .. option.value end\nif (option.allowed) then description = description .. \"; one of:\" end\nprintf(\" --%-15s %s\", trigger, description)\nif (option.allowed) then\nfor _, value in ipairs(option.allowed) do\nprintf(\" %-14s %s\", value[1], value[2])\nend\nend\nprintf(\"\")\nend\nprintf(\"ACTIONS\")\nprintf(\"\")\nfor action in premake.action.each() do\nprintf(\" %-17s %s\", action.trigger, action.description)\nend\nprintf(\"\")\nprintf(\"For additional information, see https://github.com/bkaradzic/genie\")\nend\n",
/* base/premake.lua */
"premake._filelevelconfig = false\npremake._checkgenerate = true\nfunction premake.generate(obj, filename, callback)\nlocal prev = io.capture()\nlocal abort = (callback(obj) == false)\nlocal new = io.endcapture(prev)\nif abort then\npremake.stats.num_skipped = premake.stats.num_skipped + 1\nreturn\nend\nfilename = premake.project.getfilename(obj, filename)\nif (premake._checkgenerate) then\nlocal delta = false\nlocal f, err = io.open(filename, \"rb\")\nif (not f) then\nif string.find(err, \"No such file or directory\") then\ndelta = true\nelse\nerror(err, 0)\nend\nelse\nlocal existing = f:read(\"*all\")\nif existing ~= new then\ndelta = true\nend\nf:close()\nend\nif delta then\nprintf(\"Generating %s...\", filename)\nlocal f, err = io.open(filename, \"wb\")\nif (not f) then\nerror(err, 0)\nend\nf:write(new)\nf:close()\npremake.stats.num_generated = premake.stats.num_generated + 1\nelse\npremake.stats.num_skipped = premake.stats.num_skipped + 1\nend\nelse\nprintf(\"Generating %s...\", filename)\nlocal f, err "
"= io.open(filename, \"wb\")\nif (not f) then\nerror(err, 0)\nend\nf:write(new)\nf:close()\npremake.stats.num_generated = premake.stats.num_generated + 1\nend\nend\nfunction premake.findDefaultScript(dir, search_upwards)\nsearch_upwards = search_upwards or true\nlocal last = \"\"\nwhile dir ~= last do\nfor _, name in ipairs({ \"genie.lua\", \"solution.lua\", \"premake4.lua\" }) do\nlocal script0 = dir .. \"/\" .. name\nif (os.isfile(script0)) then\nreturn dir, name\nend\nlocal script1 = dir .. \"/scripts/\" .. name\nif (os.isfile(script1)) then\nreturn dir .. \"/scripts/\", name\nend\nend\nlast = dir\ndir = path.getabsolute(dir .. \"/..\")\nif dir == \".\" or not search_upwards then break end\nend\nreturn nil, nil\nend\n",
/* base/iter.lua */
"iter = {}\nfunction iter.sortByKeys(arr, f)\nlocal a = table.keys(arr)\ntable.sort(a, f)\nlocal i = 0\nreturn function()\ni = i + 1\nif a[i] ~= nil then \nreturn a[i], arr[a[i]]\nend\nend\nend\n",
/* base/set.lua */
"Set_mt = {}\nfunction Set(t)\nlocal set = {}\nfor k, l in ipairs(t) do \nset[l] = true \nend\nsetmetatable(set, Set_mt)\nreturn set\nend\nfunction Set_mt.union(a, b)\nlocal res = Set{}\nfor k in pairs(a) do res[k] = true end\nfor k in pairs(b) do res[k] = true end\nreturn res\nend\nfunction Set_mt.intersection(a, b)\nlocal res = Set{}\nfor k in pairs(a) do\nres[k] = b[k]\nend\nreturn res\nend\nlocal function get_cache(a)\nif not rawget(a, \"__cache\") then\nrawset(a, \"__cache\", Set_mt.totable(a))\nend\nreturn rawget(a, \"__cache\")\nend\nfunction Set_mt.len(a)\nreturn #get_cache(a)\nend\nfunction Set_mt.implode(a, sep)\nreturn table.concat(get_cache(a), sep)\nend\nfunction Set_mt.totable(a)\nlocal res = {}\nfor k in pairs(a) do\ntable.insert(res, k)\nend\nreturn res\nend\nfunction Set_mt.difference(a, b)\nif getmetatable(b) ~= Set_mt then\nif type(b) ~= \"table\" then\nerror(type(b)..\" is not a Set or table\")\nend\nb=Set(b)\nend\nlocal res = Set{}\nfor k in pairs(a) do\nres[k] = not b[k] or nil\nend\nrawse"
"t(res, \"__cache\", nil)\nreturn res\nend\nfunction Set_mt.__index(a, i)\nif type(i) == \"number\" then\nreturn get_cache(a)[i]\nend\nreturn Set_mt[i] or rawget(a, i)\nend\nSet_mt.__add = Set_mt.union\nSet_mt.__mul = Set_mt.intersection\nSet_mt.__sub = Set_mt.difference\nSet_mt.__len = Set_mt.len\nSet_mt.__concat = Set_mt.implode",
/* actions/cmake/_cmake.lua */
"premake.cmake = { }\nnewaction {\ntrigger = \"cmake\",\nshortname = \"CMake\",\ndescription = \"Generate CMake project files\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"CMakeLists.txt\", premake.cmake.workspace)\nend,\nonproject = function(prj)\npremake.generate(prj, \"%%/CMakeLists.txt\", premake.cmake.project)\nend,\noncleansolution = function(sln)\npremake.clean.file(sln, \"CMakeLists.txt\")\nend,\noncleanproject = function(prj)\npremake.clean.file(prj, \"%%/CMakeLists.txt\")\nend\n}",
/* actions/cmake/cmake_workspace.lua */
"function premake.cmake.workspace(sln)\nif (sln.location ~= _WORKING_DIR) then\nlocal name = string.format(\"%s/CMakeLists.txt\", _WORKING_DIR)\nlocal f, err = io.open(name, \"wb\")\nif (not f) then\nerror(err, 0)\nend\nf:write('# CMakeLists autogenerated by GENie\\n')\nf:write('cmake_minimum_required(VERSION 2.8.4)\\n')\nf:write('\\n')\nf:write('add_subdirectory('.. path.getrelative(_WORKING_DIR, sln.location) ..')\\n')\nf:close()\nend\n_p('# CMakeLists autogenerated by GENie')\n_p('cmake_minimum_required(VERSION 2.8.4)')\n_p('')\nfor i,prj in ipairs(sln.projects) do\nlocal name = premake.esc(prj.name)\n_p('add_subdirectory(%s)', name)\nend\nend\n",
/* actions/cmake/cmake_project.lua */
"local cmake = premake.cmake\nlocal tree = premake.tree\nlocal includestr = 'include_directories(../%s)'\nlocal definestr = 'add_definitions(-D%s)'\nlocal function is_excluded(prj, cfg, file)\n if table.icontains(prj.excludes, file) then\n return true\n end\n if table.icontains(cfg.excludes, file) then\n return true\n end\n return false\nend\nfunction cmake.excludedFiles(prj, cfg, src)\n for _, v in ipairs(src) do\n if (is_excluded(prj, cfg, v)) then\n _p(1, 'list(REMOVE_ITEM source_list ../%s)', v)\n end\n end\nend\nfunction cmake.list(value)\n if #value > 0 then\n return \" \" .. table.concat(value, \" \")\n else\n return \"\"\n end\nend\nfunction cmake.files(prj)\n local ret = {}\n local tr = premake.project.buildsourcetree(prj)\n tree.traverse(tr, {\n onbranchenter = function(node, depth)\n end,\n onbranchexit = function(node, depth)\n end,\n onleaf = function(node, depth)\n "
" assert(node, \"unexpected empty node\")\n if node.cfg then\n table.insert(ret, node.cfg.name)\n _p(1, '../%s', node.cfg.name)\n end\n end,\n }, true, 1)\n return ret\nend\nfunction cmake.header(prj)\n _p('# %s project autogenerated by GENie', premake.action.current().shortname)\n _p('cmake_minimum_required(VERSION 2.8.4)')\n _p('')\n _p('project(%s)', premake.esc(prj.name))\nend\nfunction cmake.customtasks(prj)\n local dirs = {}\n local tasks = {}\n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do\n for _, buildtask in ipairs(custombuildtask or {}) do\n table.insert(tasks, buildtask)\n local d = string.format(\"${CMAKE_CURRENT_SOURCE_DIR}/../%s\", path.getdirectory(path.getrelative(prj.location, buildtask[2])))\n if not table.contains(dirs, d) then\n table.insert(dirs, d)\n _p('file(MAKE_DIRECTORY \\\"%s\\\")', d)\n end\n "
" end\n end\n _p('')\n for _, buildtask in ipairs(tasks) do\n local deps = string.format(\"${CMAKE_CURRENT_SOURCE_DIR}/../%s \", path.getrelative(prj.location, buildtask[1]))\n local outputs = string.format(\"${CMAKE_CURRENT_SOURCE_DIR}/../%s \", path.getrelative(prj.location, buildtask[2]))\n local msg = \"\"\n for _, depdata in ipairs(buildtask[3] or {}) do\n deps = deps .. string.format(\"${CMAKE_CURRENT_SOURCE_DIR}/../%s \", path.getrelative(prj.location, depdata))\n end\n _p('add_custom_command(')\n _p(1, 'OUTPUT %s', outputs)\n _p(1, 'DEPENDS %s', deps)\n for _, cmdline in ipairs(buildtask[4] or {}) do\n if (cmdline:sub(1, 1) ~= \"@\") then\n local cmd = cmdline\n local num = 1\n for _, depdata in ipairs(buildtask[3] or {}) do\n cmd = string.gsub(cmd, \"%$%(\" .. num .. \"%)\", string.format(\"${CMAKE_CURRENT_SOURCE_DIR}/../%s \", path.getrelative(pr"
"j.location, depdata)))\n num = num + 1\n end\n cmd = string.gsub(cmd, \"%$%(<%)\", string.format(\"${CMAKE_CURRENT_SOURCE_DIR}/../%s \", path.getrelative(prj.location, buildtask[1])))\n cmd = string.gsub(cmd, \"%$%(@%)\", outputs)\n _p(1, 'COMMAND %s', cmd)\n else\n msg = cmdline\n end\n end\n _p(1, 'COMMENT \\\"%s\\\"', msg)\n _p(')')\n _p('')\n end\nend\nfunction cmake.depRules(prj)\n local maintable = {}\n for _, dependency in ipairs(prj.dependency) do\n for _, dep in ipairs(dependency) do\n if path.issourcefile(dep[1]) then\n local dep1 = premake.esc(path.getrelative(prj.location, dep[1]))\n local dep2 = premake.esc(path.getrelative(prj.location, dep[2]))\n if not maintable[dep1] then maintable[dep1] = {} end\n table.insert(maintable[dep1], dep2)\n end\n end\n "
" end\n for key, _ in pairs(maintable) do\n local deplist = {}\n local depsname = string.format('%s_deps', path.getname(key))\n for _, d2 in pairs(maintable[key]) do\n table.insert(deplist, d2)\n end\n _p('set(')\n _p(1, depsname)\n for _, v in pairs(deplist) do\n _p(1, '${CMAKE_CURRENT_SOURCE_DIR}/../%s', v)\n end\n _p(')')\n _p('')\n _p('set_source_files_properties(')\n _p(1, '\\\"${CMAKE_CURRENT_SOURCE_DIR}/../%s\\\"', key)\n _p(1, 'PROPERTIES OBJECT_DEPENDS \\\"${%s}\\\"', depsname)\n _p(')')\n _p('')\n end\nend\nfunction cmake.commonRules(conf, str)\n local Dupes = {}\n local t2 = {}\n for _, cfg in ipairs(conf) do\n local cfgd = iif(str == includestr, cfg.includedirs, cfg.defines)\n for _, v in ipairs(cfgd) do\n if(t2[v] == #conf - 1) then\n _p(str, v)\n table.insert(Dupes, v)\n end\n if n"
"ot t2[v] then\n t2[v] = 1\n else\n t2[v] = t2[v] + 1\n end\n end\n end\n return Dupes\nend\nfunction cmake.cfgRules(cfg, dupes, str)\n for _, v in ipairs(cfg) do\n if (not table.icontains(dupes, v)) then\n _p(1, str, v)\n end\n end\nend\nfunction cmake.removeCrosscompiler(platforms)\n for i = #platforms, 1, -1 do\n if premake.platforms[platforms[i]].iscrosscompiler then\n table.remove(platforms, i)\n end\n end\nend\nfunction cmake.project(prj)\n io.indent = \" \"\n cmake.header(prj)\n _p('set(')\n _p('source_list')\n local source_files = cmake.files(prj)\n _p(')')\n _p('')\n local nativeplatform = iif(os.is64bit(), \"x64\", \"x32\")\n local cc = premake.gettool(prj)\n local platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\n cmake.removeCrosscompiler(platforms)\n local configurations = {}\n for _, platform in ipairs(plat"
"forms) do\n for cfg in premake.eachconfig(prj, platform) do\n -- TODO: Extend support for 32-bit targets on 64-bit hosts\n if cfg.platform == nativeplatform then\n table.insert(configurations, cfg)\n end\n end\n end\n local commonIncludes = cmake.commonRules(configurations, includestr)\n local commonDefines = cmake.commonRules(configurations, definestr)\n _p('')\n for _, cfg in ipairs(configurations) do\n _p('if(CMAKE_BUILD_TYPE MATCHES \\\"%s\\\")', cfg.name)\n -- list excluded files\n cmake.excludedFiles(prj, cfg, source_files)\n -- add includes directories\n cmake.cfgRules(cfg.includedirs, commonIncludes, includestr)\n -- add build defines\n cmake.cfgRules(cfg.defines, commonDefines, definestr)\n -- set CXX flags\n _p(1, 'set(CMAKE_CXX_FLAGS \\\"${CMAKE_CXX_FLAGS} %s\\\")', cmake.list(table.join(cc.getcppflags(cfg), cc.getcflags(cfg), cc.getcxxflags(cfg), cfg.buildoptio"
"ns, cfg.buildoptions_cpp)))\n -- set C flags\n _p(1, 'set(CMAKE_C_FLAGS \\\"${CMAKE_C_FLAGS} %s\\\")', cmake.list(table.join(cc.getcppflags(cfg), cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c)))\n _p('endif()')\n _p('')\n end\n -- force CPP if needed\n if (prj.options.ForceCPP) then\n _p('set_source_files_properties(${source_list} PROPERTIES LANGUAGE CXX)')\n end\n -- add custom tasks\n cmake.customtasks(prj)\n -- per-dependency build rules\n cmake.depRules(prj)\n for _, cfg in ipairs(configurations) do\n _p('if(CMAKE_BUILD_TYPE MATCHES \\\"%s\\\")', cfg.name)\n if (prj.kind == 'StaticLib') then\n _p(1, 'add_library(%s STATIC ${source_list})', premake.esc(cfg.buildtarget.basename))\n end\n if (prj.kind == 'SharedLib') then\n _p(1, 'add_library(%s SHARED ${source_list})', premake.esc(cfg.buildtarget.basename))\n end\n if (prj.kind == 'ConsoleApp' or prj.kind == 'WindowedApp') t"
"hen\n _p(1, 'add_executable(%s ${source_list})', premake.esc(cfg.buildtarget.basename))\n _p(1, 'target_link_libraries(%s%s%s)', premake.esc(cfg.buildtarget.basename), cmake.list(premake.esc(premake.getlinks(cfg, \"siblings\", \"basename\"))), cmake.list(cc.getlinkflags(cfg)))\n end\n _p('endif()')\n _p('')\n end\nend",
/* actions/make/_make.lua */
"_MAKE = { }\npremake.make = { }\nlocal make = premake.make\nfunction _MAKE.esc(value)\nlocal result\nif (type(value) == \"table\") then\nresult = { }\nfor _,v in ipairs(value) do\ntable.insert(result, _MAKE.esc(v))\nend\nreturn result\nelse\nresult = value:gsub(\"\\\\\", \"\\\\\\\\\")\nresult = result:gsub(\" \", \"\\\\ \")\nresult = result:gsub(\"%%(\", \"\\\\%(\")\nresult = result:gsub(\"%%)\", \"\\\\%)\")\nresult = result:gsub(\"$\\\\%((.-)\\\\%)\", \"$%(%1%)\")\nreturn result\nend\nend\nfunction _MAKE.escquote(value)\nlocal result\nif (type(value) == \"table\") then\nresult = { }\nfor _,v in ipairs(value) do\ntable.insert(result, _MAKE.escquote(v))\nend\nreturn result\nelse\nresult = value:gsub(\" \", \"\\\\ \")\nresult = result:gsub(\"\\\"\", \"\\\\\\\"\")\nreturn result\nend\nend\nfunction premake.make_copyrule(source, target)\n_p('%s: %s', target, source)\n_p('\\t@echo Copying $(notdir %s)', target)\n_p('\\t-$(call COPY,%s,%s)', source, target)\nend\nfunction premake.make_mkdirrule(var)\n_p('\\t@echo Cr"
"eating %s', var)\n_p('\\t-$(call MKDIR,%s)', var)\n_p('')\nend\nfunction make.list(value)\nif #value > 0 then\nreturn \" \" .. table.concat(value, \" \")\nelse\nreturn \"\"\nend\nend\nfunction _MAKE.getmakefilename(this, searchprjs)\nlocal count = 0\nfor sln in premake.solution.each() do\nif (sln.location == this.location) then count = count + 1 end\nif (searchprjs) then\nfor _,prj in ipairs(sln.projects) do\nif (prj.location == this.location) then count = count + 1 end\nend\nend\nend\nif (count == 1) then\nreturn \"Makefile\"\nelse\nreturn this.name .. \".make\"\nend\nend\nfunction _MAKE.getnames(tbl)\nlocal result = table.extract(tbl, \"name\")\nfor k,v in pairs(result) do\nresult[k] = _MAKE.esc(v)\nend\nreturn result\nend\nfunction make.settings(cfg, cc)\nif #cfg.makesettings > 0 then\nfor _, value in ipairs(cfg.makesettings) do\n_p(value)\nend\nend\nlocal toolsettings = cc.platforms[cfg.platform].cfgsettings\nif toolsettings then\n_p(toolsettings)\nend\nend\nnewaction {\ntrigger = \"gmake\",\nshort"
"name = \"GNU Make\",\ndescription = \"Generate GNU makefiles for POSIX, MinGW, and Cygwin\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\" },\nvalid_languages = { \"C\", \"C++\", \"C#\", \"Vala\", \"Swift\" },\nvalid_tools = {\ncc = { \"gcc\", \"ghs\" },\ndotnet = { \"mono\", \"msnet\", \"pnet\" },\nvalac = { \"valac\" },\nswift = { \"swift\" },\n},\nonsolution = function(sln)\npremake.generate(sln, _MAKE.getmakefilename(sln, false), premake.make_solution)\nend,\nonproject = function(prj)\nlocal makefile = _MAKE.getmakefilename(prj, true)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, makefile, premake.make_csharp)\nelseif premake.iscppproject(prj) then\npremake.generate(prj, makefile, premake.make_cpp)\nelseif premake.isswiftproject(prj) then\npremake.generate(prj, makefile, premake.make_swift)\nelse\npremake.generate(prj, makefile, premake.make_vala)\nend\nend,\noncleansolution = function(sln)\npremake.clean.file(sln, _MAKE.ge"
"tmakefilename(sln, false))\nend,\noncleanproject = function(prj)\npremake.clean.file(prj, _MAKE.getmakefilename(prj, true))\nend,\ngmake = {}\n}\n",
/* actions/make/make_solution.lua */
"function premake.make_solution(sln)\nlocal cc = premake[_OPTIONS.cc]\nlocal platforms = premake.filterplatforms(sln, cc.platforms, \"Native\")\n_p('# %s solution makefile autogenerated by GENie', premake.action.current().shortname)\n_p('# Type \"make help\" for usage help')\n_p('')\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(sln.configurations[1], platforms[1], true)))\n_p('endif')\n_p('export config')\n_p('')\nlocal projects = table.extract(sln.projects, \"name\")\ntable.sort(projects)\n_p('PROJECTS := %s', table.concat(_MAKE.esc(projects), \" \"))\n_p('')\n_p('.PHONY: all clean help $(PROJECTS)')\n_p('')\n_p('all: $(PROJECTS)')\n_p('')\nfor _, prj in ipairs(sln.projects) do\n_p('%s: %s', _MAKE.esc(prj.name), table.concat(_MAKE.esc(table.extract(premake.getdependencies(prj), \"name\")), \" \"))\nif (not sln.messageskip) or (not table.contains(sln.messageskip, \"SkipBuildingMessage\")) then\n_p('\\t@echo \"==== Building %s ($(config)) ====\"', prj.name)\nend\n_p('\\t@${MAKE} --no-pr"
"int-directory -C %s -f %s', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))\n_p('')\nend\n_p('clean:')\nfor _ ,prj in ipairs(sln.projects) do\n_p('\\t@${MAKE} --no-print-directory -C %s -f %s clean', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))\nend\n_p('')\n_p('help:')\n_p(1,'@echo \"Usage: make [config=name] [target]\"')\n_p(1,'@echo \"\"')\n_p(1,'@echo \"CONFIGURATIONS:\"')\nlocal cfgpairs = { }\nfor _, platform in ipairs(platforms) do\nfor _, cfgname in ipairs(sln.configurations) do\n_p(1,'@echo \" %s\"', premake.getconfigname(cfgname, platform, true))\nend\nend\n_p(1,'@echo \"\"')\n_p(1,'@echo \"TARGETS:\"')\n_p(1,'@echo \" all (default)\"')\n_p(1,'@echo \" clean\"')\nfor _, prj in ipairs(sln.projects) do\n_p(1,'@echo \" %s\"', prj.name)\nend\n_p(1,'@echo \"\"')\n_p(1,'@echo \"For more information, see https://github.com/bkaradzic/genie\"')\nend\n",
/* actions/make/make_cpp.lua */
"-- --\npremake.make.cpp = { }\npremake.make.override = { }\npremake.make.makefile_ignore = false\nlocal cpp = premake.make.cpp\nlocal make = premake.make\nfunction premake.make_cpp(prj)\nlocal cc = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\nlocal action = premake.action.current()\npremake.gmake_cpp_header(prj, cc, platforms)\npremake.gmake_cpp_configs(prj, cc, platforms)\ntable.sort(prj.allfiles)\nlocal objdirs = {}\nlocal additionalobjdirs = {}\nfor _, file in ipairs(prj.allfiles) do\nif path.issourcefile(file) then\nobjdirs[_MAKE.esc(path.getdirectory(path.trimdots(file)))] = 1\nend\nend\nfor _, custombuildtask in ipairs(prj.custombuildtask or {}) do\nfor _, buildtask in ipairs(custombuildtask or {}) do\nadditionalobjdirs[_MAKE.esc(path.getdirectory(path.getrelative(prj.location,buildtask[2])))] = 1\nend\nend\n_p('OBJDIRS := \\\\')\n_p('\\t$(OBJDIR) \\\\')\nfor dir, _ in iter.sortByKeys(objdirs) do\n_p('\\t$(OBJDIR)/%s \\\\', dir)\nend\nfor dir, _"
" in iter.sortByKeys(additionalobjdirs) do\n_p('\\t%s \\\\', dir)\nend\n_p('')\n_p('RESOURCES := \\\\')\nfor _, file in ipairs(prj.allfiles) do\nif path.isresourcefile(file) then\n_p('\\t$(OBJDIR)/%s.res \\\\', _MAKE.esc(path.getbasename(file)))\nend\nend\n_p('')\n_p('.PHONY: clean prebuild prelink')\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" and not prj.options.SkipBundling then\n_p('all: $(OBJDIRS) $(TARGETDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')\nelse\n_p('all: $(OBJDIRS) $(TARGETDIR) prebuild prelink $(TARGET)')\nend\n_p('\\t@:')\n_p('')\nif (prj.kind == \"StaticLib\" and prj.options.ArchiveSplit) then\n_p('define max_args')\n_p('\\t$(eval _args:=)')\n_p('\\t$(foreach obj,$3,$(eval _args+=$(obj))$(if $(word $2,$(_args)),$1$(_args)$(EOL)$(eval _args:=)))')\n_p('\\t$(if $(_args),$1$(_args))')\n_p('endef')\n_p('')\n_p('define EOL')\n_p('')\n_p('')\n_p('endef')\n_p('')\nend\n_p('$(TARGET): $(GCH) $(OBJECTS) $(LIBDEPS) $(EXTERNAL_LIBS) $(RESOUR"
"CES) $(OBJRESP) $(LDRESP) | $(TARGETDIR) $(OBJDIRS)')\nif prj.kind == \"StaticLib\" then\nif prj.msgarchiving then\n_p('\\t@echo ' .. prj.msgarchiving)\nelse\n_p('\\t@echo Archiving %s', prj.name)\nend\nif (not prj.archivesplit_size) then\nprj.archivesplit_size=200\nend\nif (not prj.options.ArchiveSplit) then\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGET)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGET)) del $(subst /,\\\\\\\\,$(TARGET))')\n_p('endif')\n_p('\\t$(SILENT) $(LINKCMD) $(LINKOBJS)' .. (os.is(\"MacOSX\") and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d'\" or \"\"))\nelse\n_p('\\t$(call RM,$(TARGET))')\n_p('\\t@$(call max_args,$(LINKCMD),'.. prj.archivesplit_size ..',$(LINKOBJS))' .. (os.is(\"MacOSX\") and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d'\" or \"\"))\n_p('\\t$(SILENT) $(LINKCMD_NDX)')\nend\nelse\nif prj.msglinking then\n_p('\\t@echo ' .. prj.msglinking)\nelse\n_p('\\t@echo Linking %s', prj.name)\nend\n_p('\\t$(SILENT) $(LINKCMD)"
"')\nend\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n_p('$(TARGETDIR):')\npremake.make_mkdirrule(\"$(TARGETDIR)\")\n_p('$(OBJDIRS):')\nif (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \"SkipCreatingMessage\")) then\n_p('\\t@echo Creating $(@)')\nend\n_p('\\t-$(call MKDIR,$@)')\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" and not prj.options.SkipBundling then\n_p('$(dir $(TARGETDIR))PkgInfo:')\n_p('$(dir $(TARGETDIR))Info.plist:')\n_p('')\nend\n_p('clean:')\nif (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \"SkipCleaningMessage\")) then\n_p('\\t@echo Cleaning %s', prj.name)\nend\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGET)')\n_p('\\t$(SILENT) rm -rf $(OBJDIR)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGET)) del $(subst /,\\\\\\\\,$(TARGET))')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PRE"
"BUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\ncpp.pchrules(prj)\ncpp.fileRules(prj, cc)\ncpp.dependencyRules(prj)\nfor _, custombuildtask in ipairs(prj.custombuildtask or {}) do\nfor _, buildtask in ipairs(custombuildtask or {}) do\nlocal deps = string.format(\"%s \",path.getrelative(prj.location,buildtask[1]))\nfor _, depdata in ipairs(buildtask[3] or {}) do\ndeps = deps .. string.format(\"%s \",path.getrelative(prj.location,depdata))\nend\n_p('%s: %s | $(TARGETDIR) $(OBJDIRS)'\n,path.getrelative(prj.location,buildtask[2])\n, deps\n)\nfor _, cmdline in ipairs(buildtask[4] or {}) do\nlocal cmd = cmdline\nlocal num = 1\nfor _, depdata in ipairs(buildtask[3] or {}) do\ncmd = string.gsub(cmd,\"%$%(\" .. num ..\"%)\", string.format(\"%s \",path.getrelative(prj.location,depdata)))\nnum = num + 1\nend\ncmd = string.gsub(cmd, \"%$%(<%)\", \"$<\")\ncmd = string.gsub(cmd, \"%$%(@%)\", \"$@\")\n_p('\\t$(SILENT) %s',cmd)\nend\n_p('')\nend\nend\n_p('-include $(OBJECTS:%%.o=%%.d)')\n_p('ifneq (,$("
"PCH))')\n_p(' -include $(OBJDIR)/$(notdir $(PCH)).d')\n_p(' -include $(OBJDIR)/$(notdir $(PCH))_objc.d')\n_p('endif')\nend\nfunction premake.gmake_cpp_header(prj, cc, platforms)\n_p('# %s project makefile autogenerated by GENie', premake.action.current().shortname)\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('ifeq (posix,$(SHELLTYPE))')\n_p(' MKDIR = $(SILENT) mkdir -p \"$(1)\"')\n_p(' COPY = $(SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p(' RM = $(SILENT) rm -f \"$(1)\"')\n_p('else')\n_p(' MKDIR = $(SILENT) mkdir \"$(subst /,\\\\\\\\,$(1))\" 2> nul || ex"
"it 0')\n_p(' COPY = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p(' RM = $(SILENT) del /F \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p('endif')\n_p('')\n_p('CC = %s', cc.cc)\n_p('CXX = %s', cc.cxx)\n_p('AR = %s', cc.ar)\n_p('')\n_p('ifndef RESCOMP')\n_p(' ifdef WINDRES')\n_p(' RESCOMP = $(WINDRES)')\n_p(' else')\n_p(' RESCOMP = %s', cc.rc or 'windres')\n_p(' endif')\n_p('endif')\n_p('')\nif (not premake.make.makefile_ignore) then\n_p('MAKEFILE = %s', _MAKE.getmakefilename(prj, true))\n_p('')\nend\nend\nlocal function is_excluded(prj, cfg, file)\nif table.icontains(prj.excludes, file) then\nreturn true\nend\nif table.icontains(cfg.excludes, file) then\nreturn true\nend\nreturn false\nend\nfunction premake.gmake_cpp_configs(prj, cc, platforms)\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\npremake.gmake_cpp_config(prj, cfg, cc)\nend\nend\nend\nfunction premake.gmake_cpp_config(prj, cfg, cc)\n_p('ifeq ($(config"
"),%s)', _MAKE.esc(cfg.shortname))\ncpp.platformtools(cfg, cc)\nlocal targetDir = _MAKE.esc(cfg.buildtarget.directory)\n_p(' ' .. (table.contains(premake.make.override,\"OBJDIR\") and \"override \" or \"\") .. 'OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\n_p(' ' .. (table.contains(premake.make.override,\"TARGETDIR\") and \"override \" or \"\") .. 'TARGETDIR = %s', iif(targetDir == \"\", \".\", targetDir))\n_p(' ' .. (table.contains(premake.make.override,\"TARGET\") and \"override \" or \"\") .. 'TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' DEFINES +=%s', make.list(_MAKE.escquote(cc.getdefines(cfg.defines))))\nlocal id = make.list(cc.getincludedirs(cfg.includedirs));\nlocal uid = make.list(cc.getquoteincludedirs(cfg.userincludedirs))\nlocal sid = make.list(cc.getsystemincludedirs(cfg.systemincludedirs))\nif id ~= \"\" then\n_p(' INCLUDES +=%s', id)\nend\nif uid ~= \"\" then\n_p(' INCLUDES +=%s', uid)\nend\nif sid ~="
" \"\" then\n_p(' INCLUDES +=%s', sid)\nend\ncpp.pchconfig(cfg)\ncpp.flags(cfg, cc)\ncpp.linker(prj, cfg, cc)\ntable.sort(cfg.files)\nif cfg.flags.UseObjectResponseFile then\n_p(' OBJRESP = $(OBJDIR)/%s_objects', prj.name)\nelse\n_p(' OBJRESP =')\nend\n_p(' OBJECTS := \\\\')\nfor _, file in ipairs(cfg.files) do\nif path.issourcefile(file) then\nif not is_excluded(prj, cfg, file) then\n_p('\\t$(OBJDIR)/%s.o \\\\'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n)\nend\nend\nend\n_p('')\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build"
" commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\nmake.settings(cfg, cc)\n_p('endif')\n_p('')\nend\nfunction cpp.platformtools(cfg, cc)\nlocal platform = cc.platforms[cfg.platform]\nif platform.cc then\n_p(' CC = %s', platform.cc)\nend\nif platform.cxx then\n_p(' CXX = %s', platform.cxx)\nend\nif platform.ar then\n_p(' AR = %s', platform.ar)\nend\nend\nfunction cpp.flags(cfg, cc)\nif cfg.pchheader and not cfg.flags.NoPCH then\n_p(' FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))')\n_p(' FORCE_INCLUDE_OBJC += -include $(OBJDIR)/$(notdir $(PCH))_objc')\nend\nif #cfg.forcedincludes > 0 then\n_p(' FORCE_INCLUDE += -include %s'\n,_MAKE.esc(table.concat(cfg.forcedincludes, \";\")))\nend\n_p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\n_p(' ALL_ASMFLAGS += $(ASMFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg"
".buildoptions, cfg.buildoptions_asm)))\n_p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c)))\n_p(' ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp)))\n_p(' ALL_OBJCFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getobjcflags(cfg), cfg.buildoptions, cfg.buildoptions_objc)))\n_p(' ALL_OBJCPPFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.getobjcflags(cfg), cfg.buildoptions, cfg.buildoptions_objcpp)))\n_p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',\n make.list(table.join(cc.getdefines(cfg.resdefines),\n cc.getincludedirs(cfg.resincludedirs), cfg.resoptions)))\nend\nfunction cpp.linker(prj, cfg, cc)\nlocal libdeps\nloc"
"al lddeps\nif #cfg.wholearchive > 0 then\nlibdeps = {}\nlddeps = {}\nfor _, linkcfg in ipairs(premake.getlinks(cfg, \"siblings\", \"object\")) do\nlocal linkpath = path.rebase(linkcfg.linktarget.fullpath, linkcfg.location, cfg.location)\nif table.icontains(cfg.wholearchive, linkcfg.project.name) then\nlddeps = table.join(lddeps, cc.wholearchive(linkpath))\nelse\ntable.insert(lddeps, linkpath)\nend\ntable.insert(libdeps, linkpath)\nend\nlibdeps = make.list(_MAKE.esc(libdeps))\nlddeps = make.list(_MAKE.esc(lddeps))\nelse\nlibdeps = make.list(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\")))\nlddeps = libdeps\nend\n_p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))\n_p(' LIBDEPS +=%s', libdeps)\n_p(' LDDEPS +=%s', lddeps)\nif cfg.flags.UseLDResponseFile then\n_p(' LDRESP = $(OBJDIR)/%s_libs', prj.name)\n_p(' LIBS += @$(LDRESP)%s', make.list(cc.getlinkflags(cfg)))\nelse\n"
"_p(' LDRESP =')\n_p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))\nend\n_p(' EXTERNAL_LIBS +=%s', make.list(cc.getlibfiles(cfg)))\n_p(' LINKOBJS = %s', (cfg.flags.UseObjectResponseFile and \"@$(OBJRESP)\" or \"$(OBJECTS)\"))\nif cfg.kind == \"StaticLib\" then\nif (not prj.options.ArchiveSplit) then\n_p(' LINKCMD = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, false)))\nelse\n_p(' LINKCMD = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, false)))\n_p(' LINKCMD_NDX = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, true)))\nend\nelse\nlocal tool = iif(cfg.language == \"C\", \"CC\", \"CXX\")\nlocal startgroup = ''\nlocal endgroup = ''\nif (cfg.flags.LinkSupportCircularDependencies) then\nstartgroup = '-Wl,--start-group '\nendgroup = ' -Wl,--end-group'\nend\n_p(' LINKCMD = $(%s) -o $(TARGET) $(LINKOBJS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) %s$(LIBS)%s', tool, startgroup, e"
"ndgroup)\nend\nend\nfunction cpp.pchconfig(cfg)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = path.getabsolute(path.join(cfg.project.location, incdir))\nlocal testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\n_p(' PCH = %s', _MAKE.esc(pch))\n_p(' GCH = $(OBJDIR)/$(notdir $(PCH)).gch')\n_p(' GCH_OBJC = $(OBJDIR)/$(notdir $(PCH))_objc.gch')\nend\nfunction cpp.pchrules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH) $(MAKEFILE) | $(OBJDIR)')\nif prj.msgprecompile then\n_p('\\t@echo ' .. prj.msgprecompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\nlocal cmd = iif(prj.language == \"C\", \"$(CC) $(ALL_CFLAGS) -x c-header\", \"$(CXX) $(ALL_CXXFLAGS) -x c++-header\")\n_p('\\t$(SILENT) %s $(DEFINES) $(INCLUDES) -o \"$@\" -c \"$<\"', cmd)\n_p('')\n_p('$(GCH_OBJC): $(PCH) $(MAKEFILE) | $(OBJDIR)')"
"\nif prj.msgprecompile then\n_p('\\t@echo ' .. prj.msgprecompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\nlocal cmd = iif(prj.language == \"C\", \"$(CC) $(ALL_OBJCFLAGS) -x objective-c-header\", \"$(CXX) $(ALL_OBJCPPFLAGS) -x objective-c++-header\")\n_p('\\t$(SILENT) %s $(DEFINES) $(INCLUDES) -o \"$@\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction cpp.fileRules(prj, cc)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\n_p('ifneq (,$(OBJRESP))')\n_p('$(OBJRESP): $(OBJECTS) | $(TARGETDIR) $(OBJDIRS)')\n_p('\\t$(SILENT) echo $^')\n_p('\\t$(SILENT) echo $^ > $@')\n_p('endif')\n_p('')\n_p('ifneq (,$(LDRESP))')\n_p('$(LDRESP): $(LDDEPS) | $(TARGETDIR) $(OBJDIRS)')\n_p('\\t$(SILENT) echo $^')\n_p('\\t$(SILENT) echo $^ > $@')\n_p('endif')\n_p('')\ntable.sort(prj.allfiles)\nfor _, file in ipairs(prj.allfiles or {}) do\nif path.issourcefile(file) then\nif (path.isobjcfile(file)) then\n_p('$(OBJDIR)/%s.o: %s $(GCH_OBJC) $(MAKEFILE) | $(OBJDIR)/%s'\n, _MAKE.esc(path.trimdots(path."
"removeext(file)))\n, _MAKE.esc(file)\n, _MAKE.esc(path.getdirectory(path.trimdots(file)))\n)\nelse\n_p('$(OBJDIR)/%s.o: %s $(GCH) $(MAKEFILE) | $(OBJDIR)/%s'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n, _MAKE.esc(path.getdirectory(path.trimdots(file)))\n)\nend\nif (path.isobjcfile(file) and prj.msgcompile_objc) then\n_p('\\t@echo ' .. prj.msgcompile_objc)\nelseif prj.msgcompile then\n_p('\\t@echo ' .. prj.msgcompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\nif (path.isobjcfile(file)) then\nif (path.iscfile(file)) then\n_p('\\t$(SILENT) $(CXX) $(ALL_OBJCFLAGS) $(FORCE_INCLUDE_OBJC) -o \"$@\" -c \"$<\"')\nelse\n_p('\\t$(SILENT) $(CXX) $(ALL_OBJCPPFLAGS) $(FORCE_INCLUDE_OBJC) -o \"$@\" -c \"$<\"')\nend\nelseif (path.isasmfile(file)) then\n_p('\\t$(SILENT) $(CC) $(ALL_ASMFLAGS) -o \"$@\" -c \"$<\"')\nelse\ncpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \"o\")\nend\nfor _, task in ipairs(prj.postcompiletasks or {}) do\n_p('\\t$(SILENT) %s', task)\n_p('')\nend\n_p('')\ne"
"lseif (path.getextension(file) == \".rc\") then\n_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\nif prj.msgresource then\n_p('\\t@echo ' .. prj.msgresource)\nelse\n_p('\\t@echo $(notdir $<)')\nend\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\n_p('')\nend\nend\nend\nfunction cpp.dependencyRules(prj)\nfor _, dependency in ipairs(prj.dependency or {}) do\nfor _, dep in ipairs(dependency or {}) do\nif (dep[3]==nil or dep[3]==false) then\n_p('$(OBJDIR)/%s.o: %s'\n, _MAKE.esc(path.trimdots(path.removeext(path.getrelative(prj.location, dep[1]))))\n, _MAKE.esc(path.getrelative(prj.location, dep[2]))\n)\nelse\n_p('%s: %s'\n, _MAKE.esc(dep[1])\n, _MAKE.esc(path.getrelative(prj.location, dep[2]))\n)\nend\n_p('')\nend\nend\nend\nfunction cpp.buildcommand(iscfile, objext)\nlocal flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$@\" -c \"$<\"', flags, objext)\nend\n",
/* actions/make/make_csharp.lua */
"local function getresourcefilename(cfg, fname)\nif path.getextension(fname) == \".resx\" then\nlocal name = cfg.buildtarget.basename .. \".\"\nlocal dir = path.getdirectory(fname)\nif dir ~= \".\" then\nname = name .. path.translate(dir, \".\") .. \".\"\nend\nreturn \"$(OBJDIR)/\" .. _MAKE.esc(name .. path.getbasename(fname)) .. \".resources\"\nelse\nreturn fname\nend\nend\nfunction premake.make_csharp(prj)\nlocal csc = premake.dotnet\nlocal cfglibs = { }\nlocal cfgpairs = { }\nlocal anycfg\nfor cfg in premake.eachconfig(prj) do\nanycfg = cfg\ncfglibs[cfg] = premake.getlinks(cfg, \"siblings\", \"fullpath\")\ncfgpairs[cfg] = { }\nfor _, fname in ipairs(cfglibs[cfg]) do\nif path.getdirectory(fname) ~= cfg.buildtarget.directory then\ncfgpairs[cfg][\"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname)\nend\nend\nend\nlocal sources = {}\nlocal embedded = { }\nlocal copypairs = { }\nfor fcfg in premake.project.eachfile(prj) do\nlocal action = csc.getbuildaction(fcfg)\nif action == \"Compile\" then"
"\ntable.insert(sources, fcfg.name)\nelseif action == \"EmbeddedResource\" then\ntable.insert(embedded, fcfg.name)\nelseif action == \"Content\" then\ncopypairs[\"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(fcfg.name))] = _MAKE.esc(fcfg.name)\nelseif path.getname(fcfg.name):lower() == \"app.config\" then\ncopypairs[\"$(TARGET).config\"] = _MAKE.esc(fcfg.name)\nend\nend\nlocal paths = table.translate(prj.libdirs, function(v) return path.join(prj.basedir, v) end)\npaths = table.join({prj.basedir}, paths)\nfor _, libname in ipairs(premake.getlinks(prj, \"system\", \"fullpath\")) do\nlocal libdir = os.pathsearch(libname..\".dll\", unpack(paths))\nif (libdir) then\nlocal target = \"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(libname))\nlocal source = path.getrelative(prj.basedir, path.join(libdir, libname))..\".dll\"\ncopypairs[target] = _MAKE.esc(source)\nend\nend\n_p('# %s project makefile autogenerated by GENie', premake.action.current().shortname)\n_p('')\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(prj.configu"
"rations[1]:lower()))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('ifeq (posix,$(SHELLTYPE))')\n_p(' MKDIR = $(SILENT) mkdir -p \"$(1)\"')\n_p(' COPY = $(SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p('else')\n_p(' MKDIR = $(SILENT) mkdir \"$(subst /,\\\\\\\\,$(1))\" 2> nul')\n_p(' COPY = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p('endif')\n_p('')\n_p('ifndef CSC')\n_p(' CSC=%s', csc.getcompilervar(prj))\n_p('endif')\n_p('')\n_p('ifndef RESGEN')\n_p(' RESGEN=resgen')\n_p('endif')\n_p('')\nlocal platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms)\ntable.insert(platforms, 1, \"\")\nfor cfg in premake.eachconfig(prj) "
"do\npremake.gmake_cs_config(cfg, csc, cfglibs)\nend\n_p('# To maintain compatibility with VS.NET, these values must be set at the project level')\n_p('TARGET := $(TARGETDIR)/%s', _MAKE.esc(prj.buildtarget.name))\n_p('FLAGS += /t:%s %s', csc.getkind(prj):lower(), table.implode(_MAKE.esc(prj.libdirs), \"/lib:\", \"\", \" \"))\n_p('REFERENCES += %s', table.implode(_MAKE.esc(premake.getlinks(prj, \"system\", \"basename\")), \"/r:\", \".dll\", \" \"))\n_p('')\n_p('SOURCES := \\\\')\nfor _, fname in ipairs(sources) do\n_p('\\t%s \\\\', _MAKE.esc(path.translate(fname)))\nend\n_p('')\n_p('EMBEDFILES := \\\\')\nfor _, fname in ipairs(embedded) do\n_p('\\t%s \\\\', getresourcefilename(prj, fname))\nend\n_p('')\n_p('COPYFILES += \\\\')\nfor target, source in pairs(cfgpairs[anycfg]) do\n_p('\\t%s \\\\', target)\nend\nfor target, source in pairs(copypairs) do\n_p('\\t%s \\\\', target)\nend\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin"
",$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('.PHONY: clean prebuild prelink')\n_p('')\n_p('all: $(TARGETDIR) $(OBJDIR) prebuild $(EMBEDFILES) $(COPYFILES) prelink $(TARGET)')\n_p('')\n_p('$(TARGET): $(SOURCES) $(EMBEDFILES) $(DEPENDS)')\n_p('\\t$(SILENT) $(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) $(SOURCES) $(patsubst %%,/resource:%%,$(EMBEDFILES))')\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n_p('$(TARGETDIR):')\npremake.make_mkdirrule(\"$(TARGETDIR)\")\n_p('$(OBJDIR):')\npremake.make_mkdirrule(\"$(OBJDIR)\")\n_p('clean:')\n_p('\\t@echo Cleaning %s', prj.name)\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGET) $(COPYFILES)')\n_p('\\t$(SILENT) rm -rf $(OBJDIR)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGETDIR)/%s.*) del $(subst /,\\\\\\\\,$(TARGETDIR)/%s.*)', prj.buildtarget.basename, prj.buildtarget.basename)\nfor target, source in pairs(cfgpairs"
"[anycfg]) do\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,%s) del $(subst /,\\\\\\\\,%s)', target, target)\nend\nfor target, source in pairs(copypairs) do\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,%s) del $(subst /,\\\\\\\\,%s)', target, target)\nend\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\n_p('# Per-configuration copied file rules')\nfor cfg in premake.eachconfig(prj) do\n_p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))\nfor target, source in pairs(cfgpairs[cfg]) do\npremake.make_copyrule(source, target)\nend\n_p('endif')\n_p('')\nend\n_p('# Copied file rules')\nfor target, source in pairs(copypairs) do\npremake.make_copyrule(source, target)\nend\n_p('# Embedded file rules')\nfor _, fname in ipairs(embedded) do\nif path.getextension(fname) == \".resx\" then\n_p('%s: %s', getresourcefilename(prj, fname), "
"_MAKE.esc(fname))\n_p('\\t$(SILENT) $(RESGEN) $^ $@')\nend\n_p('')\nend\nend\nfunction premake.gmake_cs_config(cfg, csc, cfglibs)\nlocal targetDir = _MAKE.esc(cfg.buildtarget.directory)\n_p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))\n_p(' TARGETDIR := %s', iif(targetDir == \"\", \".\", targetDir))\n_p(' OBJDIR := %s', _MAKE.esc(cfg.objectsdir))\n_p(' DEPENDS := %s', table.concat(_MAKE.esc(premake.getlinks(cfg, \"dependencies\", \"fullpath\")), \" \"))\n_p(' REFERENCES := %s', table.implode(_MAKE.esc(cfglibs[cfg]), \"/r:\", \"\", \" \"))\n_p(' FLAGS += %s %s', table.implode(cfg.defines, \"/d:\", \"\", \" \"), table.concat(table.join(csc.getflags(cfg), cfg.buildoptions), \" \"))\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link co"
"mmands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p('endif')\n_p('')\nend\n",
/* actions/make/make_vala.lua */
"local make = premake.make\nfunction premake.make_vala(prj)\nlocal valac = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, valac.platforms, \"Native\")\n_p('# %s project makefile autogenerated by GENie', premake.action.current().shortname)\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('ifeq (posix,$(SHELLTYPE))')\n_p(' MKDIR = $(SILENT) mkdir -p \"$(1)\"')\n_p(' COPY = $(SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p(' RM = $(SILENT) rm -f \"$(1)\"')\n_p('else')\n_p(' MKDIR = $(SILENT) mkdir \"$(subst /,\\\\\\\\,$(1))\" 2> nul || e"
"xit 0')\n_p(' COPY = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p(' RM = $(SILENT) del /F \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p('endif')\n_p('')\n_p('VALAC = %s', valac.valac)\n_p('CC = %s', valac.cc)\n_p('')\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\npremake.gmake_valac_config(prj, cfg, valac)\nend\nend\n_p('SOURCES := \\\\')\nfor _, file in ipairs(prj.files) do\nif path.issourcefile(file) then\nif not table.icontains(prj.excludes, file) then\n_p('\\t%s \\\\', _MAKE.esc(file))\nend\nend\nend\n_p('')\n_p('.PHONY: clean prebuild prelink')\n_p('')\n_p('all: prebuild prelink $(TARGET) | $(TARGETDIR)')\n_p('\\t@:')\n_p('')\n_p('$(TARGET): $(SOURCES) | $(TARGETDIR)')\n_p('\\t$(SILENT) $(VALAC) -o $(TARGET) --cc=$(CC) $(FLAGS) $(SOURCES)')\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n_p('$(TARGETDIR):')\npremake.make_mkdirrule(\"$(TARGETDIR)\")\n_p('clean:')\nif (not prj.solution.messageskip) or (not table.contains(prj"
".solution.messageskip, \"SkipCleaningMessage\")) then\n_p('\\t@echo Cleaning %s', prj.name)\nend\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGET)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGET)) del $(subst /,\\\\\\\\,$(TARGET))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\nend\nfunction premake.gmake_valac_config(prj, cfg, valac)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\n_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' DEFINES +=%s', make.list(valac.getdefines(cfg.defines)))\n_p(' VAPIDIRS +=%s', make.list(valac.getvapidirs(cfg.vapidirs)))\n_p(' PKGS +=%s', make.list(valac.getlinks(cfg.links)))\n_p(' FLAGS += $(DEFINES) $(VAPIDIRS) $(PKGS)%s', make.list(table.join(valac.getvalaflags(cfg), valac.getbuildoptions(cfg.buildoptions), valac.getbuildoptions(cfg.buildoptions_c), c"
"fg.buildoptions_vala)))\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p('endif')\n_p('')\nend\n",
/* actions/make/make_swift.lua */
"local make = premake.make\nlocal swift = { }\nfunction premake.make_swift(prj)\nlocal tool = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, tool.platforms, \"Native\")\n_p('# %s project makefile autogenerated by GENie', premake.action.current().shortname)\n_p('ifndef config')\n_p(1, 'config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(1, 'SILENT = @')\n_p('endif')\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(1, 'SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(1, 'SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))')\n_p(1, 'SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('ifeq (posix,$(SHELLTYPE))')\n_p(1, 'MKDIR = $(SILENT) mkdir -p \"$(1)\"')\n_p(1, 'COPY = $(SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p(1, 'RM = $(SILENT) rm -f \"$(1)\"')\n_p('else')\n_p(1, 'MKDIR = $(SILENT) mkdir \"$(subst /,"
"\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p(1, 'COPY = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p(1, 'RM = $(SILENT) del /F \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p('endif')\n_p('')\n_p('SWIFTC = %s', tool.swift)\n_p('SWIFTLINK = %s', tool.swiftc)\n_p('DSYMUTIL = %s', tool.dsymutil)\n_p('AR = %s', tool.ar)\n_p('')\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\nswift.generate_config(prj, cfg, tool)\nend\nend\n_p('.PHONY: ')\n_p('')\n_p('all: $(WORK_DIRS) $(TARGET)')\n_p('')\n_p('$(WORK_DIRS):')\n_p(1, '$(SILENT) $(call MKDIR,$@)')\n_p('')\n_p('SOURCES := \\\\')\nfor _, file in ipairs(prj.files) do\nif path.isswiftfile(file) then\n_p(1, '%s \\\\', _MAKE.esc(file))\nend\nend\n_p('')\nlocal objfiles = {}\n_p('OBJECTS_WITNESS := $(OBJDIR)/build.stamp')\n_p('OBJECTS := \\\\')\nfor _, file in ipairs(prj.files) do\nif path.isswiftfile(file) then\nlocal objname = _MAKE.esc(swift.objectname(file))\ntable.insert(objfiles, objnam"
"e)\n_p(1, '%s \\\\', objname)\nend\nend\n_p('')\nswift.file_rules(prj, objfiles)\nswift.linker(prj, tool)\nswift.generate_clean(prj)\nend\nfunction swift.objectname(file)\nreturn path.join(\"$(OBJDIR)\", path.getname(file)..\".o\")\nend\nfunction swift.file_rules(prj, objfiles)\n_p('$(OBJECTS_WITNESS): $(SOURCES)')\n_p(1, \"@rm -f $(OBJDIR)/data.tmp\")\n_p(1, \"@touch $(OBJDIR)/data.tmp\")\n_p(1, \"$(SILENT) $(SWIFTC) -frontend -c $(SOURCES) -enable-objc-interop $(SDK) -I $(OUT_DIR) $(SWIFTC_FLAGS) -module-cache-path $(MODULECACHE_DIR) -D SWIFT_PACKAGE $(MODULE_MAPS) -emit-module-doc-path $(OUT_DIR)/$(MODULE_NAME).swiftdoc -module-name $(MODULE_NAME) -emit-module-path $(OUT_DIR)/$(MODULE_NAME).swiftmodule -num-threads 8 %s\", table.arglist(\"-o\", objfiles))\n_p(1, \"@mv -f $(OBJDIR)/data.tmp $(OBJECTS_WITNESS)\")\n_p('')\n_p('$(OBJECTS): $(OBJECTS_WITNESS)')\n_p(1, '@if test -f $@; then :; else \\\\')\n_p(2, 'rm -f $(OBJECTS_WITNESS); \\\\')\n_p(2, '$(MAKE) $(AM_MAKEFLAGS) $(OBJECTS_WITNESS); \\\\')\n_p(1, 'f"
"i')\n_p('')\nend\nfunction swift.linker(prj, tool)\nlocal lddeps = make.list(premake.getlinks(prj, \"siblings\", \"fullpath\")) \nif prj.kind == \"StaticLib\" then\n_p(\"$(TARGET): $(OBJECTS) %s \", lddeps)\n_p(1, \"$(SILENT) $(AR) cr $(AR_FLAGS) $@ $(OBJECTS) %s\", (os.is(\"MacOSX\") and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d'\" or \"\"))\nelse\n_p(\"$(TARGET): $(OBJECTS) $(LDDEPS)\", lddeps)\n_p(1, \"$(SILENT) $(SWIFTLINK) $(SDK) -L $(OUT_DIR) -o $@ $(SWIFTLINK_FLAGS) $(LD_FLAGS) $(OBJECTS)\")\n_p(\"ifdef SYMBOLS\")\n_p(1, \"$(SILENT) $(DSYMUTIL) $(TARGET) -o $(SYMBOLS)\")\n_p(\"endif\")\nend\n_p('')\nend\nfunction swift.generate_clean(prj)\n_p('clean:')\nif (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \"SkipCleaningMessage\")) then\n_p('\\t@echo Cleaning %s', prj.name)\nend\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGET)')\n_p('\\t$(SILENT) rm -rf $(OBJDIR)')\n_p('\\t$(SILENT) rm -rf $(SYMBOLS)')\n_p('\\t$(SILENT) rm -rf $(MODULECACHE_DIR"
")')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGET)) del $(subst /,\\\\\\\\,$(TARGET))')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(SYMBOLS)) rmdir /s /q $(subst /,\\\\\\\\,$(SYMBOLS))')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(MODULECACHE_DIR)) rmdir /s /q $(subst /,\\\\\\\\,$(MODULECACHE_DIR))')\n_p('endif')\n_p('')\nend\nfunction swift.generate_config(prj, cfg, tool)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\n_p(1, \"OUT_DIR = %s\", cfg.buildtarget.directory)\n _p(1, \"MODULECACHE_DIR = $(OUT_DIR)/ModuleCache\")\n_p(1, \"TARGET = $(OUT_DIR)/%s\", _MAKE.esc(cfg.buildtarget.name))\nlocal objdir = path.join(cfg.objectsdir, prj.name .. \".build\")\n_p(1, \"OBJDIR = %s\", objdir)\n_p(1, \"MODULE_NAME = %s\", prj.name)\n_p(1, \"MODULE_MAPS = %s\", make.list(tool.getmodulemaps(cfg)))\n_p(1, \"SWIFTC_FLAGS = %s\", make.list(tool.getswiftcflags(cfg)))\n_p(1, \"SWIFTLINK_FLA"
"GS = %s\", make.list(tool.getswiftlinkflags(cfg)))\n_p(1, \"AR_FLAGS = %s\", make.list(tool.getarchiveflags(cfg, cfg, false)))\n_p(1, \"LD_FLAGS = %s\", make.list(tool.getldflags(cfg)))\n_p(1, \"LDDEPS = %s\", make.list(premake.getlinks(cfg, \"siblings\", \"fullpath\")))\nif cfg.flags.Symbols then\n_p(1, \"SYMBOLS = $(TARGET).dSYM\")\nend\nlocal sdk = tool.get_sdk_path(cfg)\nif sdk then\n_p(1, \"TOOLCHAIN_PATH = %s\", tool.get_toolchain_path(cfg))\n_p(1, \"SDK_PATH = %s\", sdk)\n_p(1, \"PLATFORM_PATH = %s\", tool.get_sdk_platform_path(cfg))\n_p(1, \"SDK = -sdk $(SDK_PATH)\")\nelse\n_p(1, \"SDK_PATH =\")\n_p(1, \"SDK =\")\nend\n_p(1,'WORK_DIRS = $(OUT_DIR) $(OBJDIR)')\n_p('endif')\n_p('')\nend",
/* actions/vstudio/_vstudio.lua */
"premake.vstudio = { }\nlocal toolsets = {\nvs2010 = \"v100\",\nvs2012 = \"v110\",\nvs2013 = \"v120\",\nvs2015 = \"v140\",\nvs2017 = \"v141\",\nvs2019 = \"v142\",\n}\npremake.vstudio.toolset = toolsets[_ACTION] or \"unknown?\"\npremake.vstudio.splashpath = ''\npremake.vstudio.xpwarning = true\nlocal vstudio = premake.vstudio\nvstudio.platforms = {\nany = \"Any CPU\",\nmixed = \"Mixed Platforms\",\nNative = \"Win32\",\nx86 = \"x86\",\nx32 = \"Win32\",\nx64 = \"x64\",\nPS3 = \"PS3\",\nXbox360 = \"Xbox 360\",\nARM = \"ARM\",\nOrbis = \"ORBIS\",\nDurango = \"Durango\",\nTegraAndroid = \"Tegra-Android\",\nNX32 = \"NX32\",\nNX64 = \"NX64\",\nEmscripten = \"Emscripten\",\n}\nfunction vstudio.arch(prj)\nif (prj.language == \"C#\") then\nreturn \"Any CPU\"\nelse\nreturn \"Win32\"\nend\nend\nfunction vstudio.iswinrt()\nreturn vstudio.storeapp ~= nil and vstudio.storeapp ~= ''\nend\nfunction vstudio.buildconfigs(sln)\nlocal cfgs = { }\nlocal platforms = premake.filterplatforms(sln, vstud"
"io.platforms, \"Native\")\nlocal hascpp = premake.hascppproject(sln)\nlocal hasdotnet = premake.hasdotnetproject(sln)\nif hasdotnet and (_ACTION > \"vs2008\" or hascpp) then\ntable.insert(platforms, 1, \"mixed\")\nend\nif hasdotnet and (_ACTION < \"vs2010\" or not hascpp) then\ntable.insert(platforms, 1, \"any\")\nend\nif _ACTION > \"vs2008\" then\nlocal platforms2010 = { }\nfor _, platform in ipairs(platforms) do\nif vstudio.platforms[platform] == \"Win32\" then\nif hascpp then\ntable.insert(platforms2010, platform)\nend\nif hasdotnet then\ntable.insert(platforms2010, \"x86\")\nend\nelse\ntable.insert(platforms2010, platform)\nend\nend\nplatforms = platforms2010\nend\nfor _, buildcfg in ipairs(sln.configurations) do\nfor _, platform in ipairs(platforms) do\nlocal entry = { }\nentry.src_buildcfg = buildcfg\nentry.src_platform = platform\nif platform ~= \"PS3\" or _ACTION > \"vs2008\" then\nentry.buildcfg = buildcfg\nentry.platform = vstudio.platforms[platform]\nelse\nentry.buildcfg = platform .. \" \" .. bu"
"ildcfg\nentry.platform = \"Win32\"\nend\nentry.name = entry.buildcfg .. \"|\" .. entry.platform\nentry.isreal = (platform ~= \"any\" and platform ~= \"mixed\")\ntable.insert(cfgs, entry)\nend\nend\nreturn cfgs\nend\nfunction premake.vstudio.bakeimports(sln)\nfor _,iprj in ipairs(sln.importedprojects) do\nif string.find(iprj.location, \".csproj\") ~= nil then\niprj.language = \"C#\"\nelse\niprj.language = \"C++\"\nend\nlocal f, err = io.open(iprj.location, \"r\")\nif (not f) then\nerror(err, 1)\nend\nlocal projcontents = f:read(\"*all\")\nf:close()\nlocal found, _, uuid = string.find(projcontents, \"<ProjectGuid>{([%w%-]+)}</ProjectGuid>\")\nif not found then\nerror(\"Could not find ProjectGuid element in project \" .. iprj.location, 1)\nend\niprj.uuid = uuid\nif iprj.language == \"C++\" and string.find(projcontents, \"<CLRSupport>true</CLRSupport>\") then\niprj.flags.Managed = true\nend\niprj.relpath = path.getrelative(sln.location, iprj.location)\nend\nend\nfunction premake.vstudio.getimportprj(prjpath, sln)"
"\nfor _,iprj in ipairs(sln.importedprojects) do\nif prjpath == iprj.relpath then\nreturn iprj\nend\nend\nerror(\"Could not find reference import project \" .. prjpath, 1)\nend\nfunction vstudio.cleansolution(sln)\npremake.clean.file(sln, \"%%.sln\")\npremake.clean.file(sln, \"%%.suo\")\npremake.clean.file(sln, \"%%.ncb\")\npremake.clean.file(sln, \"%%.userprefs\")\npremake.clean.file(sln, \"%%.usertasks\")\nend\nfunction vstudio.cleanproject(prj)\nlocal fname = premake.project.getfilename(prj, \"%%\")\nos.remove(fname .. \".vcproj\")\nos.remove(fname .. \".vcproj.user\")\nos.remove(fname .. \".vcxproj\")\nos.remove(fname .. \".vcxproj.user\")\nos.remove(fname .. \".vcxproj.filters\")\nos.remove(fname .. \".csproj\")\nos.remove(fname .. \".csproj.user\")\nos.remove(fname .. \".pidb\")\nos.remove(fname .. \".sdf\")\nend\nfunction vstudio.cleantarget(name)\nos.remove(name .. \".pdb\")\nos.remove(name .. \".idb\")\nos.remove(name .. \".ilk\")\nos.remove(name .. \".vshost.exe\")\nos.remove(name .. \".exe.manifest\""
")\nend\nfunction vstudio.projectfile(prj)\nlocal pattern\nif prj.language == \"C#\" then\npattern = \"%%.csproj\"\nelse\npattern = iif(_ACTION > \"vs2008\", \"%%.vcxproj\", \"%%.vcproj\")\nend\nlocal fname = premake.project.getbasename(prj.name, pattern)\nfname = path.join(prj.location, fname)\nreturn fname\nend\nfunction vstudio.tool(prj)\nif (prj.language == \"C#\") then\nreturn \"FAE04EC0-301F-11D3-BF4B-00C04F79EFBC\"\nelse\nreturn \"8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942\"\nend\nend\n",
/* actions/vstudio/vstudio_solution.lua */
"premake.vstudio.sln2005 = { }\nlocal vstudio = premake.vstudio\nlocal sln2005 = premake.vstudio.sln2005\nfunction sln2005.generate(sln)\nio.eol = '\\r\\n'\nsln.vstudio_configs = premake.vstudio.buildconfigs(sln)\npremake.vstudio.bakeimports(sln)\n_p('\\239\\187\\191')\nsln2005.reorderProjects(sln)\nsln2005.header(sln)\nfor grp in premake.solution.eachgroup(sln) do\nsln2005.group(grp)\nend\nfor prj in premake.solution.eachproject(sln) do\nsln2005.project(prj)\nend\n \nfor _,iprj in ipairs(sln.importedprojects) do\nsln2005.importproject(iprj)\nend\n_p('Global')\nsln2005.platforms(sln)\nsln2005.project_platforms(sln)\nsln2005.properties(sln)\nsln2005.project_groups(sln)\n_p('EndGlobal')\nend\nfunction sln2005.reorderProjects(sln)\nif sln.startproject then\nfor i, prj in ipairs(sln.projects) do\nif sln.startproject == prj.name then\nlocal cur = prj.group\nwhile cur ~= nil do\nfor j, group in ipairs(sln.groups) do\nif group == cur then\ntable.remove(sln.groups, j)\nbreak\nend\nend\ntable.insert(sln.groups, 1"
", cur)\ncur = cur.parent\nend\ntable.remove(sln.projects, i)\ntable.insert(sln.projects, 1, prj)\nbreak\nend\nend\nend\nend\nfunction sln2005.header(sln)\nlocal action = premake.action.current()\n_p('Microsoft Visual Studio Solution File, Format Version %d.00', action.vstudio.solutionVersion)\nif(_ACTION:sub(3) == \"2015\" or _ACTION:sub(3) == \"2017\") then\n_p('# Visual Studio %s', action.vstudio.toolsVersion:sub(1,2))\nelse\n_p('# Visual Studio %s', _ACTION:sub(3))\nend\nend\nfunction sln2005.project(prj)\nlocal projpath = path.translate(path.getrelative(prj.solution.location, vstudio.projectfile(prj)), \"\\\\\")\n_p('Project(\"{%s}\") = \"%s\", \"%s\", \"{%s}\"', vstudio.tool(prj), prj.name, projpath, prj.uuid)\nsln2005.projectdependencies(prj)\n_p('EndProject')\nend\nfunction sln2005.group(grp)\n_p('Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"%s\", \"%s\", \"{%s}\"', grp.name, grp.name, grp.uuid)\n_p('EndProject')\nend\n \nfunction sln2005.importproject(iprj)\n_p('Project(\"{%s}\") = \"%s"
"\", \"%s\", \"{%s}\"', vstudio.tool(iprj), path.getbasename(iprj.location), iprj.relpath, iprj.uuid)\n_p('EndProject')\nend\nfunction sln2005.projectdependencies(prj)\nlocal deps = premake.getdependencies(prj)\nif #deps > 0 then\nlocal function compareuuid(a, b) return a.uuid < b.uuid end\ntable.sort(deps, compareuuid)\n_p('\\tProjectSection(ProjectDependencies) = postProject')\nfor _, dep in ipairs(deps) do\n_p('\\t\\t{%s} = {%s}', dep.uuid, dep.uuid)\nend\n_p('\\tEndProjectSection')\nend\nend\nfunction sln2005.platforms(sln)\n_p('\\tGlobalSection(SolutionConfigurationPlatforms) = preSolution')\nfor _, cfg in ipairs(sln.vstudio_configs) do\n_p('\\t\\t%s = %s', cfg.name, cfg.name)\nend\n_p('\\tEndGlobalSection')\nend\nfunction sln2005.project_platform(prj, sln)\nfor _, cfg in ipairs(sln.vstudio_configs) do\nlocal mapped\nlocal buildfor\nif premake.isdotnetproject(prj) then\nbuildfor = \"x64\"\nmapped = \"Any CPU\"\nelseif prj.flags and prj.flags.Managed then\nmapped = \"x64\"\nelse\nif cfg.platform == \"Any CP"
"U\" or cfg.platform == \"Mixed Platforms\" then\nmapped = sln.vstudio_configs[3].platform\nelse\nmapped = cfg.platform\nend\nend\nlocal build_project = true\nif prj.solution ~= nil then\n build_project = premake.getconfig(prj, cfg.src_buildcfg, cfg.src_platform).build\nend\n_p('\\t\\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped)\nif build_project then\n if mapped == cfg.platform or cfg.platform == \"Mixed Platforms\" or buildfor == cfg.platform then\n _p('\\t\\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped)\n end\n if premake.vstudio.iswinrt() and prj.kind == \"WindowedApp\" then\n _p('\\t\\t{%s}.%s.Deploy.0 = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped)\n end\nend\nend\nend\nfunction sln2005.project_platforms(sln)\n_p('\\tGlobalSection(ProjectConfigurationPlatforms) = postSolution')\nfor prj in premake.solution.eachproject(sln) do\nsln2005.project_platform(prj, sln)\nend\nfor _,iprj in ipairs(sln.importedprojects) do\nsln2005.project_"
"platform(iprj, sln)\nend\n_p('\\tEndGlobalSection')\nend\nfunction sln2005.properties(sln)\n_p('\\tGlobalSection(SolutionProperties) = preSolution')\n_p('\\t\\tHideSolutionNode = FALSE')\n_p('\\tEndGlobalSection')\nend\nfunction sln2005.project_groups(sln)\n_p('\\tGlobalSection(NestedProjects) = preSolution')\nfor grp in premake.solution.eachgroup(sln) do\nif grp.parent ~= nil then\n_p('\\t\\t{%s} = {%s}', grp.uuid, grp.parent.uuid)\nend\nend\nfor prj in premake.solution.eachproject(sln) do\nif prj.group ~= nil then\n_p('\\t\\t{%s} = {%s}', prj.uuid, prj.group.uuid)\nend\nend\nfor _,iprj in ipairs(sln.importedprojects) do\nif iprj.group ~= nil then\n_p('\\t\\t{%s} = {%s}', iprj.uuid, iprj.group.uuid)\nend\nend\n \n_p('\\tEndGlobalSection')\nend",
/* actions/vstudio/vstudio_vcxproj.lua */
"premake.vstudio.vc2010 = { }\nlocal vc2010 = premake.vstudio.vc2010\nlocal vstudio = premake.vstudio\nlocal function vs2010_config(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nif cfginfo.src_platform == \"TegraAndroid\" then\n_p(1,'<PropertyGroup Label=\"NsightTegraProject\">')\n_p(2,'<NsightTegraProjectRevisionNumber>11</NsightTegraProjectRevisionNumber>')\n_p(1,'</PropertyGroup>')\nbreak\nend\nend\n_p(1,'<ItemGroup Label=\"ProjectConfigurations\">')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\n_p(2,'<ProjectConfiguration Include=\"%s\">', premake.esc(cfginfo.name))\n_p(3,'<Configuration>%s</Configuration>',cfginfo.buildcfg)\n_p(3,'<Platform>%s</Platform>',cfginfo.platform)\n_p(2,'</ProjectConfiguration>')\nend\n_p(1,'</ItemGroup>')\nend\nlocal function vs2010_globals(prj)\nlocal action = premake.action.current()\n_p(1,'<PropertyGroup Label=\"Globals\">')\n_p(2, '<ProjectGuid>{%s}</ProjectGuid>',prj.uuid)\n_p(2, '<RootNamespace>%s</RootNamespace>',prj.name)\nif vstudio.store"
"app ~= \"durango\" then\nlocal windowsTargetPlatformVersion = prj.windowstargetplatformversion or action.vstudio.windowsTargetPlatformVersion\nif windowsTargetPlatformVersion ~= nil then\n_p(2,'<WindowsTargetPlatformVersion>%s</WindowsTargetPlatformVersion>',windowsTargetPlatformVersion)\nif windowsTargetPlatformVersion and string.startswith(windowsTargetPlatformVersion, \"10.\") then\n_p(2,'<WindowsTargetPlatformMinVersion>%s</WindowsTargetPlatformMinVersion>', prj.windowstargetplatformminversion or \"10.0.10240.0\")\nend\nend\nend\nif prj.flags and prj.flags.Managed then\nlocal frameworkVersion = prj.framework or \"4.0\"\n_p(2, '<TargetFrameworkVersion>v%s</TargetFrameworkVersion>', frameworkVersion)\n_p(2, '<Keyword>ManagedCProj</Keyword>')\nelseif vstudio.iswinrt() then\n_p(2, '<DefaultLanguage>en-US</DefaultLanguage>')\nif vstudio.storeapp == \"durango\" then\n_p(2, '<Keyword>Win32Proj</Keyword>')\n_p(2, '<ApplicationEnvironment>title</ApplicationEnvironment>')\n_p(2, '<MinimumVisualStudioVersion>14.0</Mi"
"nimumVisualStudioVersion>')\n_p(2, '<TargetRuntime>Native</TargetRuntime>')\nelse\n_p(2, '<AppContainerApplication>true</AppContainerApplication>')\n_p(2, '<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>')\n_p(2, '<ApplicationType>Windows Store</ApplicationType>')\n_p(2, '<ApplicationTypeRevision>%s</ApplicationTypeRevision>', vstudio.storeapp)\nend\nelse\n_p(2, '<Keyword>Win32Proj</Keyword>')\nend\nif not vstudio.xpwarning then\n_p(2, '<XPDeprecationWarning>false</XPDeprecationWarning>')\nend\n_p(1,'</PropertyGroup>')\nend\nfunction vc2010.config_type(config)\nlocal t =\n{\nSharedLib = \"DynamicLibrary\",\nStaticLib = \"StaticLibrary\",\nConsoleApp = \"Application\",\nWindowedApp = \"Application\"\n}\nreturn t[config.kind]\nend\nlocal function if_config_and_platform()\nreturn 'Condition=\"\\'$(Configuration)|$(Platform)\\'==\\'%s\\'\"'\nend\nlocal function optimisation(cfg)\nlocal result = \"Disabled\"\nfor _, value in ipairs(cfg.flags) do\nif (value == \"Optimize\") then\nresult = \"Full\"\nels"
"eif (value == \"OptimizeSize\") then\nresult = \"MinSpace\"\nelseif (value == \"OptimizeSpeed\") then\nresult = \"MaxSpeed\"\nend\nend\nreturn result\nend\nfunction vc2010.configurationPropertyGroup(cfg, cfginfo)\n_p(1, '<PropertyGroup '..if_config_and_platform() ..' Label=\"Configuration\">'\n, premake.esc(cfginfo.name))\nlocal is2019 = premake.action.current() == premake.action.get(\"vs2019\")\nif is2019 then\n _p(2, '<VCProjectVersion>%s</VCProjectVersion>', action.vstudio.toolsVersion)\nif cfg.flags.UnitySupport then\n _p(2, '<EnableUnitySupport>true</EnableUnitySupport>')\nend\nend\n_p(2, '<ConfigurationType>%s</ConfigurationType>', vc2010.config_type(cfg))\n_p(2, '<UseDebugLibraries>%s</UseDebugLibraries>', iif(optimisation(cfg) == \"Disabled\",\"true\",\"false\"))\n_p(2, '<PlatformToolset>%s</PlatformToolset>', premake.vstudio.toolset)\nif os.is64bit() then\n_p(2, '<PreferredToolArchitecture>x64</PreferredToolArchitecture>')\nend\nif cfg.flags.MFC then\n_p(2,'<UseOfMfc>%s</UseOfMfc>', iif(cfg."
"flags.StaticRuntime, \"Static\", \"Dynamic\"))\nend\nif cfg.flags.ATL or cfg.flags.StaticATL then\n_p(2,'<UseOfAtl>%s</UseOfAtl>', iif(cfg.flags.StaticATL, \"Static\", \"Dynamic\"))\nend\nif cfg.flags.Unicode then\n_p(2,'<CharacterSet>Unicode</CharacterSet>')\nend\nif cfg.flags.Managed then\n_p(2,'<CLRSupport>true</CLRSupport>')\nend\nif cfg.platform == \"TegraAndroid\" then\nif cfg.androidtargetapi then\n_p(2,'<AndroidTargetAPI>android-%s</AndroidTargetAPI>', cfg.androidtargetapi)\nend\nif cfg.androidminapi then\n_p(2,'<AndroidMinAPI>android-%s</AndroidMinAPI>', cfg.androidminapi)\nend\nif cfg.androidarch then\n_p(2,'<AndroidArch>%s</AndroidArch>', cfg.androidarch)\nend\nif cfg.androidndktoolchainversion then\n_p(2,'<NdkToolchainVersion>%s</NdkToolchainVersion>', cfg.androidndktoolchainversion)\nend\nif cfg.androidstltype then\n_p(2,'<AndroidStlType>%s</AndroidStlType>', cfg.androidstltype)\nend\nend\nif cfg.platform == \"NX32\" or cfg.platform == \"NX64\" then\n_p(2,'<NintendoSdkRoot>$(NINTENDO_SDK_ROOT)"
"\\\\</NintendoSdkRoot>')\n_p(2,'<NintendoSdkSpec>NX</NintendoSdkSpec>')\nif premake.config.isdebugbuild(cfg) then\n_p(2,'<NintendoSdkBuildType>Debug</NintendoSdkBuildType>')\nelse\n_p(2,'<NintendoSdkBuildType>Release</NintendoSdkBuildType>')\nend\nend\nif cfg.flags.Symbols and (premake.action.current() == premake.action.get(\"vs2017\") or is2019) then\n_p(2, '<DebugSymbols>true</DebugSymbols>')\nend\n_p(1,'</PropertyGroup>')\nend\nlocal function import_props(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(1,'<ImportGroup '..if_config_and_platform() ..' Label=\"PropertySheets\">'\n,premake.esc(cfginfo.name))\n_p(2,'<Import Project=\"$(UserRootDir)\\\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists(\\'$(UserRootDir)\\\\Microsoft.Cpp.$(Platform).user.props\\')\" Label=\"LocalAppDataPlatform\" />')\nif #cfg.propertysheets > 0 then\nlocal dirs = cfg.propertysheets\nfor _, dir in ipairs(dirs) do\n_p(2,'<Impo"
"rt Project=\"%s\" />', path.translate(dir))\nend\nend\n_p(1,'</ImportGroup>')\nend\nend\nlocal function add_trailing_backslash(dir)\nif dir:len() > 0 and dir:sub(-1) ~= \"\\\\\" then\nreturn dir..\"\\\\\"\nend\nreturn dir\nend\nfunction vc2010.outputProperties(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\nlocal target = cfg.buildtarget\nlocal outdir = add_trailing_backslash(target.directory)\nlocal intdir = add_trailing_backslash(iif(action.vstudio.intDirAbsolute\n, path.translate(\n path.join(prj.solution.location, cfg.objectsdir)\n, '\\\\')\n, cfg.objectsdir\n))\n_p(1,'<PropertyGroup '..if_config_and_platform() ..'>', premake.esc(cfginfo.name))\n_p(2,'<OutDir>%s</OutDir>', iif(outdir:len() > 0, premake.esc(outdir), \".\\\\\"))\nif cfg.platform == \"Xbox360\" then\n_p(2,'<OutputFile>$(OutDir)%s</OutputFile>', premake.esc(target.name))\nend\n_p(2,'<IntDir>%s</IntDir>', premake.esc(intdir))\n_p(2,'<TargetName>%s<"
"/TargetName>', premake.esc(path.getbasename(target.name)))\n_p(2,'<TargetExt>%s</TargetExt>', premake.esc(path.getextension(target.name)))\nif cfg.kind == \"SharedLib\" then\nlocal ignore = (cfg.flags.NoImportLib ~= nil)\n_p(2,'<IgnoreImportLibrary>%s</IgnoreImportLibrary>', tostring(ignore))\nend\nif cfg.platform == \"Durango\" then\n_p(2, '<ReferencePath>$(Console_SdkLibPath);$(Console_SdkWindowsMetadataPath)</ReferencePath>')\n_p(2, '<LibraryPath>$(Console_SdkLibPath)</LibraryPath>')\n_p(2, '<LibraryWPath>$(Console_SdkLibPath);$(Console_SdkWindowsMetadataPath)</LibraryWPath>')\n_p(2, '<IncludePath>$(Console_SdkIncludeRoot)</IncludePath>')\n_p(2, '<ExecutablePath>$(Console_SdkRoot)bin;$(VCInstallDir)bin\\\\x86_amd64;$(VCInstallDir)bin;$(WindowsSDK_ExecutablePath_x86);$(VSInstallDir)Common7\\\\Tools\\\\bin;$(VSInstallDir)Common7\\\\tools;$(VSInstallDir)Common7\\\\ide;$(ProgramFiles)\\\\HTML Help Workshop;$(MSBuildToolsPath32);$(FxCopDir);$(PATH);</ExecutablePath>')\nif cfg.imagepath then\n_p(2, '<LayoutDir>%s"
"</LayoutDir>', cfg.imagepath)\nelse\n_p(2, '<LayoutDir>%s</LayoutDir>', prj.name)\nend\nif cfg.pullmappingfile ~= nil then\n_p(2,'<PullMappingFile>%s</PullMappingFile>', premake.esc(cfg.pullmappingfile))\nend\n_p(2, '<LayoutExtensionFilter>*.pdb;*.ilk;*.exp;*.lib;*.winmd;*.appxrecipe;*.pri;*.idb</LayoutExtensionFilter>')\n_p(2, '<IsolateConfigurationsOnDeploy>true</IsolateConfigurationsOnDeploy>')\nend\nif cfg.kind ~= \"StaticLib\" then\n_p(2,'<LinkIncremental>%s</LinkIncremental>', tostring(premake.config.isincrementallink(cfg)))\nend\nif cfg.applicationdatadir ~= nil then\n_p(2,'<ApplicationDataDir>%s</ApplicationDataDir>', premake.esc(cfg.applicationdatadir))\nend\nif cfg.flags.NoManifest then\n_p(2,'<GenerateManifest>false</GenerateManifest>')\nend\n_p(1,'</PropertyGroup>')\nend\nend\nlocal function runtime(cfg)\nlocal runtime\nlocal flags = cfg.flags\nif premake.config.isdebugbuild(cfg) then\nruntime = iif(flags.StaticRuntime and not flags.Managed, \"MultiThreadedDebug\", \"MultiThreadedDebugDLL\")\nelse"
"\nruntime = iif(flags.StaticRuntime and not flags.Managed, \"MultiThreaded\", \"MultiThreadedDLL\")\nend\nreturn runtime\nend\nlocal function precompiled_header(cfg)\n if not cfg.flags.NoPCH and cfg.pchheader then\n_p(3,'<PrecompiledHeader>Use</PrecompiledHeader>')\n_p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', cfg.pchheader)\nelse\n_p(3,'<PrecompiledHeader></PrecompiledHeader>')\nend\nend\nlocal function preprocessor(indent,cfg,escape)\nif #cfg.defines > 0 then\nlocal defines = table.concat(cfg.defines, \";\")\nif escape then\ndefines = defines:gsub('\"', '\\\\\"')\nend\nlocal isPreprocessorDefinitionPresent = string.find(defines, \"%%%(PreprocessorDefinitions%)\")\nif isPreprocessorDefinitionPresent then\n_p(indent,'<PreprocessorDefinitions>%s</PreprocessorDefinitions>'\n,premake.esc(defines))\nelse\n_p(indent,'<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>'\n,premake.esc(defines))\nend\nelse\n_p(indent,'<PreprocessorDefinitions></PreprocessorDefinitions>')"
"\nend\nend\nlocal function include_dirs(indent,cfg)\nlocal includedirs = table.join(cfg.userincludedirs, cfg.includedirs, cfg.systemincludedirs)\nif #includedirs> 0 then\n_p(indent,'<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>'\n,premake.esc(path.translate(table.concat(includedirs, \";\"), '\\\\')))\nend\nend\nlocal function using_dirs(indent,cfg)\nif #cfg.usingdirs > 0 then\n_p(indent,'<AdditionalUsingDirectories>%s;%%(AdditionalUsingDirectories)</AdditionalUsingDirectories>'\n,premake.esc(path.translate(table.concat(cfg.usingdirs, \";\"), '\\\\')))\nend\nend\nlocal function resource_compile(cfg)\n_p(2,'<ResourceCompile>')\npreprocessor(3,cfg,true)\ninclude_dirs(3,cfg)\n_p(2,'</ResourceCompile>')\nend\nlocal function cppstandard_vs2017_or_2019(cfg)\nif cfg.flags.CppLatest then\n_p(3, '<LanguageStandard>stdcpplatest</LanguageStandard>')\n_p(3, '<EnableModules>true</EnableModules>')\nelseif cfg.flags.Cpp17 then\n_p(3, '<LanguageStandard>stdcpp17</LanguageStand"
"ard>')\nelseif cfg.flags.Cpp14 then\n_p(3, '<LanguageStandard>stdcpp14</LanguageStandard>')\nend\nend\nlocal function exceptions(cfg)\nif cfg.platform == \"Orbis\" then\nif cfg.flags.NoExceptions then\n_p(3, '<CppExceptions>false</CppExceptions>')\nend\nelseif cfg.platform == \"TegraAndroid\" then\nif cfg.flags.NoExceptions then\n_p(3, '<GccExceptionHandling>false</GccExceptionHandling>')\nend\nelse\nif cfg.flags.NoExceptions then\n_p(3, '<ExceptionHandling>false</ExceptionHandling>')\nelseif cfg.flags.SEH then\n_p(3, '<ExceptionHandling>Async</ExceptionHandling>')\nend\nend\nend\nlocal function rtti(cfg)\nif cfg.flags.NoRTTI and not cfg.flags.Managed then\n_p(3,'<RuntimeTypeInfo>false</RuntimeTypeInfo>')\nend\nend\nlocal function calling_convention(cfg)\nif cfg.flags.FastCall then\n_p(3,'<CallingConvention>FastCall</CallingConvention>')\nelseif cfg.flags.StdCall then\n_p(3,'<CallingConvention>StdCall</CallingConvention>')\nend\nend\nlocal function wchar_t_builtin(cfg)\nif cfg.flags.NativeWChar then\n_p(3,'<Tr"
"eatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>')\nelseif cfg.flags.NoNativeWChar then\n_p(3,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>')\nend\nend\nlocal function sse(cfg)\nif cfg.flags.EnableSSE then\n_p(3, '<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>')\nelseif cfg.flags.EnableSSE2 then\n_p(3, '<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>')\nelseif cfg.flags.EnableAVX then\n_p(3, '<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>')\nelseif cfg.flags.EnableAVX2 then\n_p(3, '<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>')\nend\nend\nlocal function floating_point(cfg)\nif cfg.platform == \"Orbis\" then\nif cfg.flags.FloatFast then\n_p(3,'<FastMath>true</FastMath>')\nend\nelseif cfg.platform == \"TegraAndroid\" then\nelse\nif cfg.flags.FloatFast then\n_p(3,'<FloatingPointModel>Fast</FloatingPointModel>')\nelseif cfg.flags.FloatS"
"trict and not cfg.flags.Managed then\n_p(3,'<FloatingPointModel>Strict</FloatingPointModel>')\nend\nend\nend\nlocal function debug_info(cfg)\nlocal debug_info = ''\nif cfg.flags.Symbols then\nif cfg.flags.C7DebugInfo then\ndebug_info = \"OldStyle\"\nelseif (action.vstudio.supports64bitEditContinue == false and cfg.platform == \"x64\")\nor not premake.config.iseditandcontinue(cfg)\nthen\ndebug_info = \"ProgramDatabase\"\nelse\ndebug_info = \"EditAndContinue\"\nend\nend\n_p(3,'<DebugInformationFormat>%s</DebugInformationFormat>',debug_info)\nend\nlocal function minimal_build(cfg)\nif premake.config.isdebugbuild(cfg) and cfg.flags.EnableMinimalRebuild then\n_p(3,'<MinimalRebuild>true</MinimalRebuild>')\nelse\n_p(3,'<MinimalRebuild>false</MinimalRebuild>')\nend\nend\nlocal function compile_language(cfg)\nif cfg.options.ForceCPP then\n_p(3,'<CompileAs>CompileAsCpp</CompileAs>')\nelse\nif cfg.language == \"C\" then\n_p(3,'<CompileAs>CompileAsC</CompileAs>')\nend\nend\nend\nlocal function forcedinclude_files(indent,c"
"fg)\nif #cfg.forcedincludes > 0 then\n_p(indent,'<ForcedIncludeFiles>%s</ForcedIncludeFiles>'\n,premake.esc(path.translate(table.concat(cfg.forcedincludes, \";\"), '\\\\')))\nend\nend\nlocal function vs10_clcompile(cfg)\n_p(2,'<ClCompile>')\nlocal unsignedChar = \"/J \"\nlocal buildoptions = cfg.buildoptions\nif cfg.platform == \"Orbis\" then\nunsignedChar = \"-funsigned-char \";\n_p(3,'<GenerateDebugInformation>%s</GenerateDebugInformation>', tostring(cfg.flags.Symbols ~= nil))\nend\nif cfg.language == \"C\" and not cfg.options.ForceCPP then\nbuildoptions = table.join(buildoptions, cfg.buildoptions_c)\nelse\nbuildoptions = table.join(buildoptions, cfg.buildoptions_cpp)\nend\n_p(3,'<AdditionalOptions>%s %s%%(AdditionalOptions)</AdditionalOptions>'\n, table.concat(premake.esc(buildoptions), \" \")\n, iif(cfg.flags.UnsignedChar and cfg.platform ~= \"TegraAndroid\", unsignedChar, \" \")\n)\nif cfg.platform == \"TegraAndroid\" then\n_p(3,'<SignedChar>%s</SignedChar>', tostring(cfg.flags.UnsignedChar == nil))\n_p(3"
",'<GenerateDebugInformation>%s</GenerateDebugInformation>', tostring(cfg.flags.Symbols ~= nil))\nif cfg.androidcppstandard then\n_p(3,'<CppLanguageStandard>%s</CppLanguageStandard>', cfg.androidcppstandard)\nend\nend\nif cfg.platform == \"Orbis\" then\nlocal opt = optimisation(cfg)\nif opt == \"Disabled\" then\n_p(3,'<OptimizationLevel>Level0</OptimizationLevel>')\nelseif opt == \"MinSpace\" then\n_p(3,'<OptimizationLevel>Levelz</OptimizationLevel>') -- Oz is more aggressive than Os\nelseif opt == \"MaxSpeed\" then\n_p(3,'<OptimizationLevel>Level3</OptimizationLevel>')\nelse\n_p(3,'<OptimizationLevel>Level2</OptimizationLevel>')\nend\nelseif cfg.platform == \"TegraAndroid\" then\nlocal opt = optimisation(cfg)\nif opt == \"Disabled\" then\n_p(3,'<OptimizationLevel>O0</OptimizationLevel>')\nelseif opt == \"MinSpace\" then\n_p(3,'<OptimizationLevel>Os</OptimizationLevel>')\nelseif opt == \"MaxSpeed\" then\n_p(3,'<OptimizationLevel>O3</OptimizationLevel>')\nelse\n_p(3,'<OptimizationLevel>O2</OptimizationLevel>')\n"
"end\nelse\n_p(3,'<Optimization>%s</Optimization>', optimisation(cfg))\nend\ninclude_dirs(3, cfg)\nusing_dirs(3, cfg)\npreprocessor(3, cfg)\nminimal_build(cfg)\nif premake.config.isoptimizedbuild(cfg.flags) then\nif cfg.flags.NoOptimizeLink and cfg.flags.NoEditAndContinue then\n_p(3, '<StringPooling>false</StringPooling>')\n_p(3, '<FunctionLevelLinking>false</FunctionLevelLinking>')\nelse\n_p(3, '<StringPooling>true</StringPooling>')\n_p(3, '<FunctionLevelLinking>true</FunctionLevelLinking>')\nend\nelse\n_p(3, '<FunctionLevelLinking>true</FunctionLevelLinking>')\nif cfg.flags.NoRuntimeChecks then\n_p(3, '<BasicRuntimeChecks>Default</BasicRuntimeChecks>')\nelseif not cfg.flags.Managed then\n_p(3, '<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>')\nend\nif cfg.flags.ExtraWarnings then\nend\nend\nif cfg.platform == \"Durango\" or cfg.flags.NoWinRT then\n_p(3, '<CompileAsWinRT>false</CompileAsWinRT>')\nend\n_p(3, '<RuntimeLibrary>%s</RuntimeLibrary>', runtime(cfg))\nif cfg.flags.NoBufferSecurityCheck then"
"\n_p(3, '<BufferSecurityCheck>false</BufferSecurityCheck>')\nend\nif not cfg.flags.NoMultiProcessorCompilation and not cfg.flags.EnableMinimalRebuild then\n_p(3, '<MultiProcessorCompilation>true</MultiProcessorCompilation>')\nelse\n_p(3, '<MultiProcessorCompilation>false</MultiProcessorCompilation>')\nend\nprecompiled_header(cfg)\nif cfg.platform == \"Orbis\" then\nif cfg.flags.PedanticWarnings then\n_p(3, '<Warnings>MoreWarnings</Warnings>')\n_p(3, '<ExtraWarnings>true</ExtraWarnings>')\nelseif cfg.flags.ExtraWarnings then\n_p(3, '<Warnings>NormalWarnings</Warnings>')\n_p(3, '<ExtraWarnings>true</ExtraWarnings>')\nelseif cfg.flags.MinimumWarnings then\n_p(3, '<Warnings>WarningsOff</Warnings>')\n_p(3, '<ExtraWarnings>false</ExtraWarnings>')\nelse\n_p(3, '<Warnings>NormalWarnings</Warnings>')\n_p(3, '<ExtraWarnings>false</ExtraWarnings>')\nend\nif cfg.flags.FatalWarnings then\n_p(3, '<WarningsAsErrors>true</WarningsAsErrors>')\nend\nelseif cfg.platform == \"TegraAndroid\" then\nif cfg.flags.PedanticWarnings or "
"cfg.flags.ExtraWarnings then\n_p(3, '<Warnings>AllWarnings</Warnings>')\nelseif cfg.flags.MinimumWarnings then\n_p(3, '<Warnings>DisableAllWarnings</Warnings>')\nelse\n_p(3, '<Warnings>NormalWarnings</Warnings>')\nend\nif cfg.flags.FatalWarnings then\n_p(3, '<WarningsAsErrors>true</WarningsAsErrors>')\nend\nelse\nif cfg.flags.PedanticWarnings then\n_p(3, '<WarningLevel>EnableAllWarnings</WarningLevel>')\nelseif cfg.flags.ExtraWarnings then\n_p(3, '<WarningLevel>Level4</WarningLevel>')\nelseif cfg.flags.MinimumWarnings then\n_p(3, '<WarningLevel>Level1</WarningLevel>')\nelse\n_p(3 ,'<WarningLevel>Level3</WarningLevel>')\nend\nend\nif cfg.flags.FatalWarnings then\n_p(3, '<TreatWarningAsError>true</TreatWarningAsError>')\nend\nif premake.action.current() == premake.action.get(\"vs2017\") or\n premake.action.current() == premake.action.get(\"vs2019\") then\ncppstandard_vs2017_or_2019(cfg)\nend\nexceptions(cfg)\nrtti(cfg)\ncalling_convention(cfg)\nwchar_t_builtin(cfg)\nsse(cfg)\nfloating_point(cfg)\ndebug_info(cf"
"g)\nif cfg.flags.Symbols then\nif cfg.kind == \"StaticLib\" then\n_p(3, '<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>'\n, path.getbasename(cfg.buildtarget.name)\n)\nelse\n_p(3, '<ProgramDataBaseFileName>$(IntDir)%s.compile.pdb</ProgramDataBaseFileName>'\n, path.getbasename(cfg.buildtarget.name)\n)\nend\nend\nif cfg.flags.Hotpatchable then\n_p(3, '<CreateHotpatchableImage>true</CreateHotpatchableImage>')\nend\nif cfg.flags.NoFramePointer then\n_p(3, '<OmitFramePointers>true</OmitFramePointers>')\nend\nif cfg.flags.UseFullPaths then\n_p(3, '<UseFullPaths>true</UseFullPaths>')\nend\nif cfg.flags.NoJMC then\n_p(3,'<SupportJustMyCode>false</SupportJustMyCode>' )\nend\ncompile_language(cfg)\nforcedinclude_files(3,cfg);\nif vstudio.diagformat then\n_p(3, '<DiagnosticsFormat>%s</DiagnosticsFormat>', vstudio.diagformat)\nelse\n_p(3, '<DiagnosticsFormat>Caret</DiagnosticsFormat>')\nend\n_p(2,'</ClCompile>')\nend\nlocal function event_hooks(cfg)\nif #cfg.postbuildcommands> 0 then\n _p(2,'<PostBui"
"ldEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PostBuildEvent>')\nend\nif #cfg.prebuildcommands> 0 then\n _p(2,'<PreBuildEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prebuildcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PreBuildEvent>')\nend\nif #cfg.prelinkcommands> 0 then\n _p(2,'<PreLinkEvent>')\n_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prelinkcommands, \"\", \"\", \"\\r\\n\")))\n_p(2,'</PreLinkEvent>')\nend\nend\nlocal function additional_options(indent,cfg)\nif #cfg.linkoptions > 0 then\n_p(indent,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>',\ntable.concat(premake.esc(cfg.linkoptions), \" \"))\nend\nend\nlocal function link_target_machine(index,cfg)\nlocal platforms = {x32 = 'MachineX86', x64 = 'MachineX64'}\nif platforms[cfg.platform] then\n_p(index,'<TargetMachine>%s</TargetMachine>', platforms[cfg.platform])\nend\nend\nlocal function item_def_lib(cfg)\nif cfg"
".kind == 'StaticLib' and cfg.platform ~= \"Xbox360\" then\n_p(1,'<Lib>')\n_p(2,'<OutputFile>$(OutDir)%s</OutputFile>',cfg.buildtarget.name)\nadditional_options(2,cfg)\nlink_target_machine(2,cfg)\n_p(1,'</Lib>')\nend\nend\nlocal function import_lib(cfg)\nif cfg.kind == \"SharedLib\" then\nlocal implibname = cfg.linktarget.fullpath\n_p(3,'<ImportLibrary>%s</ImportLibrary>',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \"\\\\\" .. path.getname(implibname), implibname))\nend\nend\nlocal function hasmasmfiles(prj)\nlocal files = vc2010.getfilegroup(prj, \"MASM\")\nreturn #files > 0\nend\nlocal function ismanagedprj(prj, cfgname, pltname)\nlocal cfg = premake.getconfig(prj, cfgname, pltname)\nreturn cfg.flags.Managed == true\nend\nlocal function getcfglinks(cfg)\nlocal haswholearchive = #cfg.wholearchive > 0\nlocal msvcnaming = premake.getnamestyle(cfg) == \"windows\"\nlocal iscppprj = premake.iscppproject(cfg)\nlocal isnetprj = premake.isdotnetproject(cfg)\nlocal linkobjs = {}\nlocal links = iif"
"(haswholearchive\n, premake.getlinks(cfg, \"all\", \"object\")\n, premake.getlinks(cfg, \"system\", \"fullpath\")\n)\nfor _, link in ipairs(links) do\nlocal name = nil\nlocal directory = nil\nlocal whole = nil\nif type(link) == \"table\" then\nif not ismanagedprj(link.project, cfg.name, cfg.platform) then\nname = link.linktarget.basename\ndirectory = path.rebase(link.linktarget.directory, link.location, cfg.location)\nwhole = table.icontains(cfg.wholearchive, link.project.name)\nend\nelse\nname = link\nwhole = table.icontains(cfg.wholearchive, link)\nend\nif name then\nif haswholearchive and msvcnaming then\nif iscppprj then\nname = name .. \".lib\"\nelseif isnetprj then\nname = name .. \".dll\"\nend\nend\ntable.insert(linkobjs, {name=name, directory=directory, wholearchive=whole})\nend\nend\nreturn linkobjs\nend\nlocal function vs10_masm(prj, cfg)\nif hasmasmfiles(prj) then\n_p(2, '<MASM>')\n_p(3,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>'\n, table.concat(prema"
"ke.esc(table.join(cfg.buildoptions, cfg.buildoptions_asm)), \" \")\n)\nlocal includedirs = table.join(cfg.userincludedirs, cfg.includedirs, cfg.systemincludedirs)\nif #includedirs > 0 then\n_p(3, '<IncludePaths>%s;%%(IncludePaths)</IncludePaths>'\n, premake.esc(path.translate(table.concat(includedirs, \";\"), '\\\\'))\n)\nend\nlocal defines = table.join(cfg.defines)\ntable.insertflat(defines, iif(premake.config.isdebugbuild(cfg), \"_DEBUG\", {}))\ntable.insert(defines, iif(cfg.platform == \"x64\", \"_WIN64\", \"_WIN32\"))\ntable.insert(defines, iif(prj.kind == \"SharedLib\", \"_EXPORT=EXPORT\", \"_EXPORT=\"))\n_p(3, '<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>'\n, premake.esc(table.concat(defines, \";\"))\n)\nif cfg.flags.FatalWarnings then\n_p(3,'<TreatWarningsAsErrors>true</TreatWarningsAsErrors>')\nend\nif cfg.flags.MinimumWarnings then\n_p(3,'<WarningLevel>0</WarningLevel>')\nelse\n_p(3,'<WarningLevel>3</WarningLevel>')\nend\n_p(2, '</MASM>')\nend\nend\nlocal function "
"additional_manifest(cfg)\nif(cfg.dpiawareness ~= nil) then\n_p(2,'<Manifest>')\nif(cfg.dpiawareness == \"None\") then\n_p(3, '<EnableDpiAwareness>false</EnableDpiAwareness>')\nend\nif(cfg.dpiawareness == \"High\") then\n_p(3, '<EnableDpiAwareness>true</EnableDpiAwareness>')\nend\nif(cfg.dpiawareness == \"HighPerMonitor\") then\n_p(3, '<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>')\nend\n_p(2,'</Manifest>')\nend\nend\nfunction vc2010.link(cfg)\nlocal vs2017OrLater = premake.action.current() == premake.action.get(\"vs2017\") or\n premake.action.current() == premake.action.get(\"vs2019\")\nlocal links = getcfglinks(cfg)\n_p(2,'<Link>')\n_p(3,'<SubSystem>%s</SubSystem>', iif(cfg.kind == \"ConsoleApp\", \"Console\", \"Windows\"))\nif vs2017OrLater and cfg.flags.FullSymbols then\n_p(3,'<GenerateDebugInformation>DebugFull</GenerateDebugInformation>')\nelse\n_p(3,'<GenerateDebugInformation>%s</GenerateDebugInformation>', tostring(cfg.flags.Symbols ~= nil))\nend\nif cfg.flags.Symbols then\n_p(3, "
"'<ProgramDatabaseFile>$(OutDir)%s.pdb</ProgramDatabaseFile>'\n, path.getbasename(cfg.buildtarget.name)\n)\nend\nif premake.config.islinkeroptimizedbuild(cfg.flags) then\nif cfg.platform == \"Orbis\" then\n_p(3,'<DataStripping>StripFuncsAndData</DataStripping>')\n_p(3,'<DuplicateStripping>true</DuplicateStripping>')\nelse\n_p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>')\n_p(3,'<OptimizeReferences>true</OptimizeReferences>')\nend\nelseif cfg.platform == \"Orbis\" and premake.config.iseditandcontinue(cfg) then\n_p(3,'<EditAndContinue>true</EditAndContinue>')\nend\nif cfg.finalizemetasource ~= nil then\n_p(3,'<FinalizeMetaSource>%s</FinalizeMetaSource>', premake.esc(cfg.finalizemetasource))\nend\nif cfg.kind ~= 'StaticLib' then\nvc2010.additionalDependencies(3, cfg, links)\nvc2010.additionalLibraryDirectories(3, cfg, links)\n_p(3,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name)\nif vc2010.config_type(cfg) == 'Application' and not cfg.flags.WinMain and not cfg.flags.Managed then\nif cfg.flags.U"
"nicode then\n_p(3,'<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>')\nelse\n_p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>')\nend\nend\nimport_lib(cfg)\nlocal deffile = premake.findfile(cfg, \".def\")\nif deffile then\n_p(3,'<ModuleDefinitionFile>%s</ModuleDefinitionFile>', deffile)\nend\nlink_target_machine(3,cfg)\nadditional_options(3,cfg)\nif cfg.flags.NoWinMD and vstudio.iswinrt() and prj.kind == \"WindowedApp\" then\n_p(3,'<GenerateWindowsMetadata>false</GenerateWindowsMetadata>' )\nend\nend\nif cfg.platform == \"TegraAndroid\" then\nif cfg.androidlinker then\n_p(3,'<UseLinker>%s</UseLinker>',cfg.androidlinker)\nend\nend\nif cfg.flags.Hotpatchable then\n_p(3, '<CreateHotPatchableImage>Enabled</CreateHotPatchableImage>')\nend\n_p(2,'</Link>')\nif #cfg.wholearchive > 0 then\n_p(2, '<ProjectReference>')\n_p(3, '<LinkLibraryDependencies>false</LinkLibraryDependencies>')\n_p(2, '</ProjectReference>')\nend\nend\nfunction vc2010.additionalLibraryDirectories(tab, cfg, links)\nlocal dirs = cfg.libd"
"irs\nfor _, link in ipairs(links) do\nif link.directory and not table.icontains(dirs, link.directory) then\ntable.insert(dirs, link.directory)\nend\nend\n_p(tab, '<AdditionalLibraryDirectories>%s;%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>'\n, premake.esc(path.translate(table.concat(dirs, ';'), '\\\\'))\n)\nend\nfunction vc2010.additionalDependencies(tab, cfg, links)\nif #links > 0 then\nlocal deps = \"\"\nif cfg.platform == \"Orbis\" then\nlocal iswhole = false\nfor _, link in ipairs(links) do\nif link.wholearchive and not iswhole then\ndeps = deps .. \"--whole-archive;\"\niswhole = true\nelseif not link.wholearchive and iswhole then\ndeps = deps .. \"--no-whole-archive;\"\niswhole = false\nend\ndeps = deps .. \"-l\" .. link.name .. \";\"\nend\nelse\nfor _, link in ipairs(links) do\nif link.wholearchive then\ndeps = deps .. \"/WHOLEARCHIVE:\" .. link.name .. \";\"\nelse\ndeps = deps .. link.name .. \";\"\nend\nend\nend\nif cfg.platform == \"TegraAndroid\" then\ndeps = \"-Wl,--start-group;"
"\" .. deps .. \";-Wl,--end-group\"\nend\n_p(tab, '<AdditionalDependencies>%s;%s</AdditionalDependencies>'\n, deps\n, iif(cfg.platform == \"Durango\"\n, '%(XboxExtensionsDependencies)'\n, '%(AdditionalDependencies)'\n)\n)\nelseif cfg.platform == \"Durango\" then\n_p(tab, '<AdditionalDependencies>%%(XboxExtensionsDependencies)</AdditionalDependencies>')\nend\nend\nfunction ant_build(prj, cfg)\nif cfg.platform == \"TegraAndroid\" then\nlocal files = vc2010.getfilegroup(prj, \"AndroidBuild\")\n_p(2,'<AntBuild>')\nif #files > 0 then\n_p(3,'<AndroidManifestLocation>%s</AndroidManifestLocation>',path.translate(files[1].name))\nend\nlocal isdebugbuild = premake.config.isdebugbuild(cfg)\n_p(3,'<AntBuildType>%s</AntBuildType>',iif(isdebugbuild, 'Debug','Release'))\n_p(3,'<Debuggable>%s</Debuggable>',tostring(cfg.flags.AntBuildDebuggable ~= nil))\nif #cfg.antbuildjavasourcedirs > 0 then\nlocal dirs = table.concat(cfg.antbuildjavasourcedirs,\";\")\n_p(3,'<JavaSourceDir>%s</JavaSourceDir>',dirs)\nend\nif #cfg.antbuildjardi"
"rs > 0 then\nlocal dirs = table.concat(cfg.antbuildjardirs,\";\")\n_p(3,'<JarDirectories>%s</JarDirectories>',dirs)\nend\nif #cfg.antbuildjardependencies > 0 then\nlocal dirs = table.concat(cfg.antbuildjardependencies,\";\")\n_p(3,'<JarDependencies>%s</JarDependencies>',dirs)\nend\nif #cfg.antbuildnativelibdirs > 0 then\nlocal dirs = table.concat(cfg.antbuildnativelibdirs,\";\")\n_p(3,'<NativeLibDirectories>%s</NativeLibDirectories>',dirs)\nend\nif #cfg.antbuildnativelibdependencies > 0 then\nlocal dirs = table.concat(cfg.antbuildnativelibdependencies,\";\")\n_p(3,'<NativeLibDependencies>%s</NativeLibDependencies>',dirs)\nend\nif #cfg.antbuildassetsdirs > 0 then\nlocal dirs = table.concat(cfg.antbuildassetsdirs,\";\")\n_p(3,'<AssetsDirectories>%s</AssetsDirectories>',dirs)\nend\n_p(2,'</AntBuild>')\nend\nend\nlocal function item_definitions(prj)\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\n_p(1,'<ItemDefinitionGroup "
"' ..if_config_and_platform() ..'>'\n,premake.esc(cfginfo.name))\nvs10_clcompile(cfg)\nresource_compile(cfg)\nitem_def_lib(cfg)\nvc2010.link(cfg)\nant_build(prj, cfg)\nevent_hooks(cfg)\nvs10_masm(prj, cfg)\nadditional_manifest(cfg)\n_p(1,'</ItemDefinitionGroup>')\nend\nend\nfunction vc2010.getfilegroup(prj, group)\nlocal sortedfiles = prj.vc2010sortedfiles\nif not sortedfiles then\nsortedfiles = {\nClCompile = {},\nClInclude = {},\nMASM = {},\nObject = {},\nNone = {},\nResourceCompile = {},\nAppxManifest = {},\nAndroidBuild = {},\nNatvis = {},\nImage = {},\nDeploymentContent = {}\n}\nlocal foundAppxManifest = false\nfor file in premake.project.eachfile(prj, true) do\nif path.issourcefilevs(file.name) then\ntable.insert(sortedfiles.ClCompile, file)\nelseif path.iscppheader(file.name) then\nif not table.icontains(prj.removefiles, file) then\ntable.insert(sortedfiles.ClInclude, file)\nend\nelseif path.isobjectfile(file.name) then\ntable.insert(sortedfiles.Object, file)\nelseif path.isresourcefile(file.name) then\n"
"table.insert(sortedfiles.ResourceCompile, file)\nelseif path.isimagefile(file.name) then\ntable.insert(sortedfiles.Image, file)\nelseif path.isappxmanifest(file.name) then\nfoundAppxManifest = true\ntable.insert(sortedfiles.AppxManifest, file)\nelseif path.isandroidbuildfile(file.name) then\ntable.insert(sortedfiles.AndroidBuild, file)\nelseif path.isnatvis(file.name) then\ntable.insert(sortedfiles.Natvis, file)\nelseif path.isasmfile(file.name) then\ntable.insert(sortedfiles.MASM, file)\nelseif file.flags and table.icontains(file.flags, \"DeploymentContent\") then\ntable.insert(sortedfiles.DeploymentContent, file)\nelse\ntable.insert(sortedfiles.None, file)\nend\nend\nif vstudio.iswinrt() and prj.kind == \"WindowedApp\" and not foundAppxManifest then\nvstudio.needAppxManifest = true\nlocal fcfg = {}\nfcfg.name = prj.name .. \"/Package.appxmanifest\"\nfcfg.vpath = premake.project.getvpath(prj, fcfg.name)\ntable.insert(sortedfiles.AppxManifest, fcfg)\nlocal logo = {}\nlogo.name = prj.name .. \"/Logo.png\"\nlog"
"o.vpath = logo.name\ntable.insert(sortedfiles.Image, logo)\nlocal smallLogo = {}\nsmallLogo.name = prj.name .. \"/SmallLogo.png\"\nsmallLogo.vpath = smallLogo.name\ntable.insert(sortedfiles.Image, smallLogo)\nlocal storeLogo = {}\nstoreLogo.name = prj.name .. \"/StoreLogo.png\"\nstoreLogo.vpath = storeLogo.name\ntable.insert(sortedfiles.Image, storeLogo)\nlocal splashScreen = {}\nsplashScreen.name = prj.name .. \"/SplashScreen.png\"\nsplashScreen.vpath = splashScreen.name\ntable.insert(sortedfiles.Image, splashScreen)\nend\nprj.vc2010sortedfiles = sortedfiles\nend\nreturn sortedfiles[group]\nend\nfunction vc2010.files(prj)\nvc2010.simplefilesgroup(prj, \"ClInclude\")\nvc2010.compilerfilesgroup(prj)\nvc2010.simplefilesgroup(prj, \"Object\")\nvc2010.simplefilesgroup(prj, \"None\")\nvc2010.customtaskgroup(prj)\nvc2010.simplefilesgroup(prj, \"ResourceCompile\")\nvc2010.simplefilesgroup(prj, \"AppxManifest\")\nvc2010.simplefilesgroup(prj, \"AndroidBuild\")\nvc2010.simplefilesgroup(prj, \"Natvis\")\nvc2010.deploy"
"mentcontentgroup(prj, \"Image\")\nvc2010.deploymentcontentgroup(prj, \"DeploymentContent\", \"None\")\nend\nfunction vc2010.customtaskgroup(prj)\nlocal files = { }\nfor _, custombuildtask in ipairs(prj.custombuildtask or {}) do\nfor _, buildtask in ipairs(custombuildtask or {}) do\nlocal fcfg = { }\nfcfg.name = path.getrelative(prj.location,buildtask[1])\nfcfg.vpath = path.trimdots(fcfg.name)\ntable.insert(files, fcfg)\nend\nend\nif #files > 0 then\n_p(1,'<ItemGroup>')\nlocal groupedBuildTasks = {}\nlocal buildTaskNames = {}\nfor _, custombuildtask in ipairs(prj.custombuildtask or {}) do\nfor _, buildtask in ipairs(custombuildtask or {}) do\nif (groupedBuildTasks[buildtask[1]] == nil) then\ngroupedBuildTasks[buildtask[1]] = {}\ntable.insert(buildTaskNames, buildtask[1])\nend\ntable.insert(groupedBuildTasks[buildtask[1]], buildtask)\nend\nend\nfor _, name in ipairs(buildTaskNames) do\ncustombuildtask = groupedBuildTasks[name]\n_p(2,'<CustomBuild Include=\\\"%s\\\">', path.translate(path.getrelative(prj.locatio"
"n,name), \"\\\\\"))\n_p(3,'<FileType>Text</FileType>')\nlocal cmd = \"\"\nlocal outputs = \"\"\nfor _, buildtask in ipairs(custombuildtask or {}) do\nfor _, cmdline in ipairs(buildtask[4] or {}) do\ncmd = cmd .. cmdline\nlocal num = 1\nfor _, depdata in ipairs(buildtask[3] or {}) do\ncmd = string.gsub(cmd,\"%$%(\" .. num ..\"%)\", string.format(\"%s \",path.getrelative(prj.location,depdata)))\nnum = num + 1\nend\ncmd = string.gsub(cmd, \"%$%(<%)\", string.format(\"%s \",path.getrelative(prj.location,buildtask[1])))\ncmd = string.gsub(cmd, \"%$%(@%)\", string.format(\"%s \",path.getrelative(prj.location,buildtask[2])))\ncmd = cmd .. \"\\r\\n\"\nend\noutputs = outputs .. path.getrelative(prj.location,buildtask[2]) .. \";\"\nend\n_p(3,'<Command>%s</Command>',cmd)\n_p(3,'<Outputs>%s%%(Outputs)</Outputs>',outputs)\n_p(3,'<SubType>Designer</SubType>')\n_p(3,'<Message></Message>')\n_p(2,'</CustomBuild>')\nend\n_p(1,'</ItemGroup>')\nend\nend\nfunction vc2010.simplefilesgroup(prj, section, subtype)\nlocal configs = prj"
".solution.vstudio_configs\nlocal files = vc2010.getfilegroup(prj, section)\nif #files > 0 then\nlocal config_mappings = {}\nfor _, cfginfo in ipairs(configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\nif cfg.pchheader and cfg.pchsource and not cfg.flags.NoPCH then\nconfig_mappings[cfginfo] = path.translate(cfg.pchsource, \"\\\\\")\nend\nend\n_p(1,'<ItemGroup>')\nfor _, file in ipairs(files) do\nlocal prjexcluded = table.icontains(prj.excludes, file.name)\nlocal excludedcfgs = {}\nif not prjexcluded then\nfor _, vsconfig in ipairs(configs) do\nlocal cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform)\nlocal fileincfg = table.icontains(cfg.files, file.name)\nlocal cfgexcluded = table.icontains(cfg.excludes, file.name)\nif not fileincfg or cfgexcluded then\ntable.insert(excludedcfgs, vsconfig.name)\nend\nend\nend\nif subtype or prjexcluded or #excludedcfgs > 0 then\n_p(2, '<%s Include=\\\"%s\\\">', section, path.translate(file.name, \"\\\\\"))\nif p"
"rjexcluded then\n_p(3, '<ExcludedFromBuild>true</ExcludedFromBuild>')\nelse\nfor _, cfgname in ipairs(excludedcfgs) do\n_p(3, '<ExcludedFromBuild '\n.. if_config_and_platform()\n.. '>true</ExcludedFromBuild>'\n, premake.esc(cfgname)\n)\nend\nend\nif subtype then\n_p(3, '<SubType>%s</SubType>', subtype)\nend\n_p(2,'</%s>', section)\nelse\n_p(2, '<%s Include=\\\"%s\\\" />', section, path.translate(file.name, \"\\\\\"))\nend\nend\n_p(1,'</ItemGroup>')\nend\nend\nfunction vc2010.deploymentcontentgroup(prj, section, filetype)\nif filetype == nil then\nfiletype = section\nend\nlocal files = vc2010.getfilegroup(prj, section)\nif #files > 0 then\n_p(1,'<ItemGroup>')\nfor _, file in ipairs(files) do\n_p(2,'<%s Include=\\\"%s\\\">', filetype, path.translate(file.name, \"\\\\\"))\n_p(3,'<DeploymentContent>true</DeploymentContent>')\n_p(3,'<Link>%s</Link>', path.translate(file.vpath, \"\\\\\"))\n_p(2,'</%s>', filetype)\nend\n_p(1,'</ItemGroup>')\nend\nend\nfunction vc2010.compilerfilesgroup(prj)\nlocal configs = prj.solu"
"tion.vstudio_configs\nlocal files = vc2010.getfilegroup(prj, \"ClCompile\")\nif #files > 0 then\nlocal config_mappings = {}\nfor _, cfginfo in ipairs(configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\nif cfg.pchheader and cfg.pchsource and not cfg.flags.NoPCH then\nconfig_mappings[cfginfo] = path.translate(cfg.pchsource, \"\\\\\")\nend\nend\n_p(1,'<ItemGroup>')\nlocal existingBasenames = {};\nfor _, file in ipairs(files) do\nlocal filename = string.lower(path.getbasename(file.name))\nlocal disambiguation = existingBasenames[filename] or 0;\nexistingBasenames[filename] = disambiguation + 1\nlocal translatedpath = path.translate(file.name, \"\\\\\")\n_p(2, '<ClCompile Include=\\\"%s\\\">', translatedpath)\nfor _, vsconfig in ipairs(configs) do\nlocal cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform)\nlocal namestyle = premake.getnamestyle(cfg)\nif namestyle == \"TegraAndroid\" or namestyle == \"NX\" then\n_p(3, '<ObjectFileName '.. if_config_and"
"_platform() .. '>$(IntDir)%s.o</ObjectFileName>', premake.esc(vsconfig.name), premake.esc(path.translate(path.trimdots(path.removeext(file.name)))) )\nelse\nif disambiguation > 0 then\n_p(3, '<ObjectFileName '.. if_config_and_platform() .. '>$(IntDir)%s\\\\</ObjectFileName>', premake.esc(vsconfig.name), tostring(disambiguation))\nend\nend\nend\nif path.iscxfile(file.name) then\n_p(3, '<CompileAsWinRT>true</CompileAsWinRT>')\n_p(3, '<RuntimeTypeInfo>true</RuntimeTypeInfo>')\n_p(3, '<PrecompiledHeader>NotUsing</PrecompiledHeader>')\nend\nif vstudio.iswinrt() and string.len(file.name) > 2 and string.sub(file.name, -2) == \".c\" then\n_p(3,'<CompileAsWinRT>FALSE</CompileAsWinRT>')\nend\nfor _, cfginfo in ipairs(configs) do\nif config_mappings[cfginfo] and translatedpath == config_mappings[cfginfo] then\n_p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>Create</PrecompiledHeader>', premake.esc(cfginfo.name))\nconfig_mappings[cfginfo] = nil --only one source file per pch\nend\nend\nlocal nopch = table.icon"
"tains(prj.nopch, file.name)\nfor _, vsconfig in ipairs(configs) do\nlocal cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform)\nif nopch or table.icontains(cfg.nopch, file.name) then\n_p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>NotUsing</PrecompiledHeader>', premake.esc(vsconfig.name))\nend\nend\nlocal excluded = table.icontains(prj.excludes, file.name)\nfor _, vsconfig in ipairs(configs) do\nlocal cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform)\nlocal fileincfg = table.icontains(cfg.files, file.name)\nlocal cfgexcluded = table.icontains(cfg.excludes, file.name)\nif excluded or not fileincfg or cfgexcluded then\n_p(3, '<ExcludedFromBuild '\n.. if_config_and_platform()\n.. '>true</ExcludedFromBuild>'\n, premake.esc(vsconfig.name)\n)\nend\nend\nif prj.flags and prj.flags.Managed then\nlocal prjforcenative = table.icontains(prj.forcenative, file.name)\nfor _,vsconfig in ipairs(configs) do\nlocal cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsc"
"onfig.src_platform)\nif prjforcenative or table.icontains(cfg.forcenative, file.name) then\n_p(3, '<CompileAsManaged ' .. if_config_and_platform() .. '>false</CompileAsManaged>', premake.esc(vsconfig.name))\nend\nend\nend\n_p(2,'</ClCompile>')\nend\n_p(1,'</ItemGroup>')\nend\nend\nfunction vc2010.masmfiles(prj)\nlocal configs = prj.solution.vstudio_configs\nlocal files = vc2010.getfilegroup(prj, \"MASM\")\nif #files > 0 then\n_p(1, '<ItemGroup>')\nfor _, file in ipairs(files) do\nlocal translatedpath = path.translate(file.name, \"\\\\\")\n_p(2, '<MASM Include=\"%s\">', translatedpath)\nlocal excluded = table.icontains(prj.excludes, file.name)\nfor _, vsconfig in ipairs(configs) do\nlocal cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform)\nlocal fileincfg = table.icontains(cfg.files, file.name)\nlocal cfgexcluded = table.icontains(cfg.excludes, file.name)\nif excluded or not fileincfg or cfgexcluded then\n_p(3, '<ExcludedFromBuild '\n.. if_config_and_platform()\n.. '>true</ExcludedFromBu"
"ild>'\n, premake.esc(vsconfig.name)\n)\nend\nend\n_p(2, '</MASM>')\nend\n_p(1, '</ItemGroup>')\nend\nend\nfunction vc2010.header(targets)\nio.eol = \"\\r\\n\"\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\nlocal t = \"\"\nif targets then\nt = ' DefaultTargets=\"' .. targets .. '\"'\nend\n_p('<Project%s ToolsVersion=\"%s\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">', t, action.vstudio.toolsVersion)\nend\nfunction premake.vs2010_vcxproj(prj)\nlocal usemasm = hasmasmfiles(prj)\nio.indent = \" \"\nvc2010.header(\"Build\")\nvs2010_config(prj)\nvs2010_globals(prj)\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.Default.props\" />')\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)\nvc2010.configurationPropertyGroup(cfg, cfginfo)\nend\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.props\" />')\n_p(1,'<ImportGroup Label=\"ExtensionSettings\">')\nif usemasm then\n_p(2, '<Import Projec"
"t=\"$(VCTargetsPath)\\\\BuildCustomizations\\\\masm.props\" />')\nend\n_p(1,'</ImportGroup>')\nimport_props(prj)\n_p(1,'<PropertyGroup Label=\"UserMacros\" />')\nvc2010.outputProperties(prj)\nitem_definitions(prj)\nvc2010.files(prj)\nvc2010.clrReferences(prj)\nvc2010.projectReferences(prj)\nvc2010.sdkReferences(prj)\nvc2010.masmfiles(prj)\n_p(1,'<Import Project=\"$(VCTargetsPath)\\\\Microsoft.Cpp.targets\" />')\n_p(1,'<ImportGroup Label=\"ExtensionTargets\">')\nif usemasm then\n_p(2, '<Import Project=\"$(VCTargetsPath)\\\\BuildCustomizations\\\\masm.targets\" />')\nend\n_p(1,'</ImportGroup>')\n_p('</Project>')\nend\nfunction vc2010.clrReferences(prj)\nif #prj.clrreferences == 0 then\nreturn\nend\n_p(1,'<ItemGroup>')\nfor _, ref in ipairs(prj.clrreferences) do\nif os.isfile(ref) then\nlocal assembly = path.getbasename(ref)\n_p(2,'<Reference Include=\"%s\">', assembly)\n_p(3,'<HintPath>%s</HintPath>', path.getrelative(prj.location, ref))\n_p(2,'</Reference>')\nelse\n_p(2,'<Reference Include=\"%s\" />', ref)\nend"
"\nend\n_p(1,'</ItemGroup>')\nend\nfunction vc2010.projectReferences(prj)\nlocal deps = premake.getdependencies(prj)\nif #deps == 0 and #prj.vsimportreferences == 0 then\nreturn\nend\nlocal function compareuuid(a, b) return a.uuid < b.uuid end\ntable.sort(deps, compareuuid)\ntable.sort(table.join(prj.vsimportreferences), compareuuid)\n_p(1,'<ItemGroup>')\nfor _, dep in ipairs(deps) do\nlocal deppath = path.getrelative(prj.location, vstudio.projectfile(dep))\n_p(2,'<ProjectReference Include=\\\"%s\\\">', path.translate(deppath, \"\\\\\"))\n_p(3,'<Project>{%s}</Project>', dep.uuid)\nif vstudio.iswinrt() then\n_p(3,'<ReferenceOutputAssembly>false</ReferenceOutputAssembly>')\nend\n_p(2,'</ProjectReference>')\nend\nfor _, ref in ipairs(prj.vsimportreferences) do\nlocal slnrelpath = path.rebase(ref, prj.location, sln.location)\nlocal iprj = premake.vstudio.getimportprj(slnrelpath, prj.solution)\n_p(2,'<ProjectReference Include=\\\"%s\\\">', ref)\n_p(3,'<Project>{%s}</Project>', iprj.uuid)\n_p(2,'</ProjectReference>')"
"\nend\n_p(1,'</ItemGroup>')\nend\nfunction vc2010.sdkReferences(prj)\nlocal refs = prj.sdkreferences\nif #refs > 0 then\n_p(1,'<ItemGroup>')\nfor _, ref in ipairs(refs) do\n_p(2,'<SDKReference Include=\\\"%s\\\" />', ref)\nend\n_p(1,'</ItemGroup>')\nend\nend\nfunction vc2010.debugdir(cfg)\nlocal isnx = (cfg.platform == \"NX32\" or cfg.platform == \"NX64\")\nlocal debuggerFlavor =\n iif(isnx, 'OasisNXDebugger'\n, iif(cfg.platform == \"Orbis\", 'ORBISDebugger'\n, iif(cfg.platform == \"Durango\", 'XboxOneVCppDebugger'\n, iif(cfg.platform == \"TegraAndroid\", 'AndroidDebugger'\n, iif(vstudio.iswinrt(), 'AppHostLocalDebugger'\n, 'WindowsLocalDebugger'\n)))))\n_p(2, '<DebuggerFlavor>%s</DebuggerFlavor>', debuggerFlavor)\nif cfg.debugdir and not vstudio.iswinrt() then\n_p(2, '<LocalDebuggerWorkingDirectory>%s</LocalDebuggerWorkingDirectory>'\n, path.translate(cfg.debugdir, '\\\\')\n)\nend\nif cfg.debugcmd then\n_p(2, '<LocalDebugg"
"erCommand>%s</LocalDebuggerCommand>', cfg.debugcmd)\nend\nif cfg.debugargs then\n_p(2, '<LocalDebuggerCommandArguments>%s</LocalDebuggerCommandArguments>'\n, table.concat(cfg.debugargs, \" \")\n)\nend\nif cfg.debugenvs and #cfg.debugenvs > 0 then\n_p(2, '<LocalDebuggerEnvironment>%s%s</LocalDebuggerEnvironment>'\n, table.concat(cfg.debugenvs, \"\\n\")\n, iif(cfg.flags.DebugEnvsInherit,'\\n$(LocalDebuggerEnvironment)', '')\n)\nif cfg.flags.DebugEnvsDontMerge then\n_p(2, '<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>')\nend\nend\nif cfg.deploymode then\n_p(2, '<DeployMode>%s</DeployMode>', cfg.deploymode)\nend\nif cfg.platform == \"TegraAndroid\" then\nif cfg.androiddebugintentparams then\n_p(2, '<IntentParams>%s</IntentParams>'\n, table.concat(cfg.androiddebugintentparams, \" \")\n)\nend\nend\nend\nfunction premake.vs2010_vcxproj_user(prj)\nio.indent = \" \"\nvc2010.header()\nfor _, cfginfo in ipairs(prj.solution.vstudio_configs) do\nlocal cfg = premake.getconfig(prj, cfginfo.src_buildcf"
"g, cfginfo.src_platform)\n_p(' <PropertyGroup '.. if_config_and_platform() ..'>', premake.esc(cfginfo.name))\nvc2010.debugdir(cfg)\n_p(' </PropertyGroup>')\nend\n_p('</Project>')\nend\nlocal png1x1data = {\n0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, -- .PNG........IHDR\n0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x25, 0xdb, 0x56, -- .............%.V\n0xca, 0x00, 0x00, 0x00, 0x03, 0x50, 0x4c, 0x54, 0x45, 0x00, 0x00, 0x00, 0xa7, 0x7a, 0x3d, 0xda, -- .....PLTE....z=.\n0x00, 0x00, 0x00, 0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00, 0x00, -- [email protected]...\n0x0a, 0x49, 0x44, 0x41, 0x54, 0x08, 0xd7, 0x63, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0xe2, -- .IDAT..c`.......\n0x21, 0xbc, 0x33, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, -- !.3....IEND.B`.\n}\nfunction png1x1(obj, filename)\nfilename = premake.project.getfilename(obj, filename)\nlocal f, err = io.open(fi"
"lename, \"wb\")\nif f then\nfor _, byte in ipairs(png1x1data) do\nf:write(string.char(byte))\nend\nf:close()\nend\nend\nfunction premake.vs2010_appxmanifest(prj)\nio.indent = \" \"\nio.eol = \"\\r\\n\"\n_p('<?xml version=\"1.0\" encoding=\"utf-8\"?>')\nif vstudio.storeapp == \"10.0\" then\n_p('<Package')\n_p(1, 'xmlns=\"http://schemas.microsoft.com/appx/manifest/foundation/windows10\"')\n_p(1, 'xmlns:mp=\"http://schemas.microsoft.com/appx/2014/phone/manifest\"')\n_p(1, 'xmlns:uap=\"http://schemas.microsoft.com/appx/manifest/uap/windows10\"')\n_p(1, 'IgnorableNamespaces=\"uap mp\">')\nelseif vstudio.storeapp == \"durango\" then\n_p('<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\" xmlns:mx=\"http://schemas.microsoft.com/appx/2013/xbox/manifest\" IgnorableNamespaces=\"mx\">')\nend\n_p(1, '<Identity')\n_p(2, 'Name=\"' .. prj.uuid .. '\"')\n_p(2, 'Publisher=\"CN=Publisher\"')\n_p(2, 'Version=\"1.0.0.0\" />')\nif vstudio.storeapp == \"10.0\" then\n_p(1, '<mp:PhoneIdentity')\n_p(2, 'PhoneProductId"
"=\"' .. prj.uuid .. '\"')\n_p(2, 'PhonePublisherId=\"00000000-0000-0000-0000-000000000000\"/>')\nend\n_p(1, '<Properties>')\n_p(2, '<DisplayName>' .. prj.name .. '</DisplayName>')\n_p(2, '<PublisherDisplayName>PublisherDisplayName</PublisherDisplayName>')\n_p(2, '<Logo>' .. prj.name .. '\\\\StoreLogo.png</Logo>')\npng1x1(prj, \"%%/StoreLogo.png\")\n_p(2, '<Description>' .. prj.name .. '</Description>')\n_p(1,'</Properties>')\nif vstudio.storeapp == \"10.0\" then\n_p(1, '<Dependencies>')\n_p(2, '<TargetDeviceFamily Name=\"Windows.Universal\" MinVersion=\"10.0.10069.0\" MaxVersionTested=\"10.0.10069.0\" />')\n_p(1, '</Dependencies>')\nelseif vstudio.storeapp == \"durango\" then\n_p(1, '<Prerequisites>')\n_p(2, '<OSMinVersion>6.2</OSMinVersion>')\n_p(2, '<OSMaxVersionTested>6.2</OSMaxVersionTested>')\n_p(1, '</Prerequisites>')\nend\n_p(1, '<Resources>')\n_p(2, '<Resource Language=\"en-us\"/>')\n_p(1, '</Resources>')\n_p(1, '<Applications>')\n_p(2, '<Application Id=\"App\"')\n_p(3, 'Executable=\"$targetnametoken$."
"exe\"')\n_p(3, 'EntryPoint=\"' .. prj.name .. '.App\">')\nif vstudio.storeapp == \"10.0\" then\n_p(3, '<uap:VisualElements')\n_p(4, 'DisplayName=\"' .. prj.name .. '\"')\n_p(4, 'Square150x150Logo=\"' .. prj.name .. '\\\\Logo.png\"')\npng1x1(prj, \"%%/Logo.png\")\nif vstudio.storeapp == \"10.0\" then\n_p(4, 'Square44x44Logo=\"' .. prj.name .. '\\\\SmallLogo.png\"')\npng1x1(prj, \"%%/SmallLogo.png\")\nelse\n_p(4, 'Square30x30Logo=\"' .. prj.name .. '\\\\SmallLogo.png\"')\npng1x1(prj, \"%%/SmallLogo.png\")\nend\n_p(4, 'Description=\"' .. prj.name .. '\"')\n_p(4, 'BackgroundColor=\"transparent\">')\n_p(4, '<uap:SplashScreen Image=\"' .. prj.name .. '\\\\SplashScreen.png\" />')\npng1x1(prj, \"%%/SplashScreen.png\")\n_p(3, '</uap:VisualElements>')\nelseif vstudio.storeapp == \"durango\" then\n_p(3, '<VisualElements')\n_p(4, 'DisplayName=\"' .. prj.name .. '\"')\n_p(4, 'Logo=\"' .. prj.name .. '\\\\Logo.png\"')\npng1x1(prj, \"%%/Logo.png\")\n_p(4, 'SmallLogo=\"' .. prj.name .. '\\\\SmallLogo.png\"')\npng1x1(prj, \"%%"
"/SmallLogo.png\")\n_p(4, 'Description=\"' .. prj.name .. '\"')\n_p(4, 'ForegroundText=\"light\"')\n_p(4, 'BackgroundColor=\"transparent\">')\n_p(5, '<SplashScreen Image=\"' .. prj.name .. '\\\\SplashScreen.png\" />')\npng1x1(prj, \"%%/SplashScreen.png\")\n_p(3, '</VisualElements>')\n_p(3, '<Extensions>')\n_p(4, '<mx:Extension Category=\"xbox.system.resources\">')\n_p(4, '<mx:XboxSystemResources />')\n_p(4, '</mx:Extension>')\n_p(3, '</Extensions>')\nend\n_p(2, '</Application>')\n_p(1, '</Applications>')\n_p('</Package>')\nend\n",
/* actions/vstudio/vstudio_vcxproj_filters.lua */
"local vc2010 = premake.vstudio.vc2010\nlocal project = premake.project\nfunction vc2010.filteridgroup(prj)\nlocal filters = { }\nlocal filterfound = false\nfor file in premake.project.eachfile(prj, true) do\nlocal folders = string.explode(file.vpath, \"/\", true)\nlocal path = \"\"\nfor i = 1, #folders - 1 do\nif not filterfound then\nfilterfound = true\n_p(1,'<ItemGroup>')\nend\npath = path .. folders[i]\nif not filters[path] then\nfilters[path] = true\n_p(2, '<Filter Include=\"%s\">', path)\n_p(3, '<UniqueIdentifier>{%s}</UniqueIdentifier>', os.uuid(path))\n_p(2, '</Filter>')\nend\npath = path .. \"\\\\\"\nend\nend\nfor _, custombuildtask in ipairs(prj.custombuildtask or {}) do\nfor _, buildtask in ipairs(custombuildtask or {}) do\nlocal folders = string.explode(path.trimdots(path.getrelative(prj.location,buildtask[1])), \"/\", true)\nlocal path = \"\"\nfor i = 1, #folders - 1 do\nif not filterfound then\nfilterfound = true\n_p(1,'<ItemGroup>')\nend\npath = path .. folders[i]\nif not filters[path] then\nfilt"
"ers[path] = true\n_p(2, '<Filter Include=\"%s\">', path)\n_p(3, '<UniqueIdentifier>{%s}</UniqueIdentifier>', os.uuid(path))\n_p(2, '</Filter>')\nend\npath = path .. \"\\\\\"\nend\nend\nend\nif filterfound then\n_p(1,'</ItemGroup>')\nend\nend\nfunction vc2010.filefiltergroup(prj, section, kind)\nlocal files = vc2010.getfilegroup(prj, section) or {}\nif kind == nill then\nkind = section\nend\nif (section == \"CustomBuild\") then\nfor _, custombuildtask in ipairs(prj.custombuildtask or {}) do\nfor _, buildtask in ipairs(custombuildtask or {}) do\nlocal fcfg = { }\nfcfg.name = path.getrelative(prj.location,buildtask[1])\nfcfg.vpath = path.trimdots(fcfg.name)\ntable.insert(files, fcfg)\nend\nend\nend\nif #files > 0 then\n_p(1,'<ItemGroup>')\nfor _, file in ipairs(files) do\nlocal filter\nif file.name ~= file.vpath then\nfilter = path.getdirectory(file.vpath)\nelse\nfilter = path.getdirectory(file.name)\nend\nif filter ~= \".\" then\n_p(2,'<%s Include=\\\"%s\\\">', kind, path.translate(file.name, \"\\\\\"))\n_p(3,'<"
"Filter>%s</Filter>', path.translate(filter, \"\\\\\"))\n_p(2,'</%s>', kind)\nelse\n_p(2,'<%s Include=\\\"%s\\\" />', kind, path.translate(file.name, \"\\\\\"))\nend\nend\n_p(1,'</ItemGroup>')\nend\nend\nfunction vc2010.generate_filters(prj)\nio.indent = \" \"\nvc2010.header()\nvc2010.filteridgroup(prj)\nvc2010.filefiltergroup(prj, \"None\")\nvc2010.filefiltergroup(prj, \"ClInclude\")\nvc2010.filefiltergroup(prj, \"ClCompile\")\nvc2010.filefiltergroup(prj, \"Object\")\nvc2010.filefiltergroup(prj, \"ResourceCompile\")\nvc2010.filefiltergroup(prj, \"CustomBuild\")\nvc2010.filefiltergroup(prj, \"AppxManifest\")\nvc2010.filefiltergroup(prj, \"Natvis\")\nvc2010.filefiltergroup(prj, \"Image\")\nvc2010.filefiltergroup(prj, \"DeploymentContent\", \"None\")\nvc2010.filefiltergroup(prj, \"MASM\")\n_p('</Project>')\nend\n",
/* actions/vstudio/vs2010.lua */
"local vc2010 = premake.vstudio.vc2010\nlocal vstudio = premake.vstudio\nnewaction\n{\ntrigger = \"vs2010\",\nshortname = \"Visual Studio 2010\",\ndescription = \"Generate Microsoft Visual Studio 2010 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\" },\nvalid_languages = { \"C\", \"C++\", \"C#\"},\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", vstudio.sln2005.generate)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", vstudio.cs2005.generate)\npremake.generate(prj, \"%%.csproj.user\", vstudio.cs2005.generate_user)\nelse\npremake.generate(prj, \"%%.vcxproj\", premake.vs2010_vcxproj)\npremake.generate(prj, \"%%.vcxproj.user\", premake.vs2010_vcxproj_user)\npremake.generate(prj, \"%%.vcxproj.filters\", vstudio.vc2010.generate_filters)\nend\nend,\noncleanso"
"lution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget,\nvstudio = {\nproductVersion = \"8.0.30703\",\nsolutionVersion = \"11\",\ntargetFramework = \"4.0\",\ntoolsVersion = \"4.0\",\nsupports64bitEditContinue = false,\nintDirAbsolute = false,\n}\n}\n",
/* actions/vstudio/vs2012.lua */
"premake.vstudio.vc2012 = {}\nlocal vc2012 = premake.vstudio.vc2012\nlocal vstudio = premake.vstudio\nnewaction\n{\ntrigger = \"vs2012\",\nshortname = \"Visual Studio 2012\",\ndescription = \"Generate Microsoft Visual Studio 2012 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\" },\nvalid_languages = { \"C\", \"C++\", \"C#\"},\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", vstudio.sln2005.generate)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", vstudio.cs2005.generate)\npremake.generate(prj, \"%%.csproj.user\", vstudio.cs2005.generate_user)\nelse\npremake.generate(prj, \"%%.vcxproj\", premake.vs2010_vcxproj)\npremake.generate(prj, \"%%.vcxproj.user\", premake.vs2010_vcxproj_user)\npremake.generate(prj, \"%%.vcxproj.filters\", vstudio.vc2010.generate_f"
"ilters)\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget,\nvstudio = {\nsolutionVersion = \"12\",\ntargetFramework = \"4.5\",\ntoolsVersion = \"4.0\",\nsupports64bitEditContinue = false,\nintDirAbsolute = false,\n}\n}\n",
/* actions/vstudio/vs2013.lua */
"premake.vstudio.vc2013 = {}\nlocal vc2013 = premake.vstudio.vc2013\nlocal vstudio = premake.vstudio\nnewaction\n{\ntrigger = \"vs2013\",\nshortname = \"Visual Studio 2013\",\ndescription = \"Generate Microsoft Visual Studio 2013 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\" },\nvalid_languages = { \"C\", \"C++\", \"C#\"},\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", vstudio.sln2005.generate)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", vstudio.cs2005.generate)\npremake.generate(prj, \"%%.csproj.user\", vstudio.cs2005.generate_user)\nelse\npremake.vstudio.needAppxManifest = false\npremake.generate(prj, \"%%.vcxproj\", premake.vs2010_vcxproj)\npremake.generate(prj, \"%%.vcxproj.user\", premake.vs2010_vcxproj_user)\npremake.generate(prj, \"%%.vc"
"xproj.filters\", vstudio.vc2010.generate_filters)\nif premake.vstudio.needAppxManifest then\npremake.generate(prj, \"%%/Package.appxmanifest\", premake.vs2010_appxmanifest)\nend\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget,\nvstudio = {\nsolutionVersion = \"12\",\ntargetFramework = \"4.5\",\ntoolsVersion = \"12.0\",\nsupports64bitEditContinue = false,\nintDirAbsolute = false,\n}\n}\n",
/* actions/vstudio/vs2015.lua */
"premake.vstudio.vc2015 = {}\nlocal vc2015 = premake.vstudio.vc2015\nlocal vstudio = premake.vstudio\nnewaction\n{\ntrigger = \"vs2015\",\nshortname = \"Visual Studio 2015\",\ndescription = \"Generate Microsoft Visual Studio 2015 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", vstudio.sln2005.generate)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", vstudio.cs2005.generate)\npremake.generate(prj, \"%%.csproj.user\", vstudio.cs2005.generate_user)\nelse\npremake.vstudio.needAppxManifest = false\npremake.generate(prj, \"%%.vcxproj\", premake.vs2010_vcxproj)\npremake.generate(prj, \"%%.vcxproj.user\", premake.vs2010_vcxproj_user)\npremake.generate(prj, \"%%.v"
"cxproj.filters\", vstudio.vc2010.generate_filters)\nif premake.vstudio.needAppxManifest then\npremake.generate(prj, \"%%/Package.appxmanifest\", premake.vs2010_appxmanifest)\nend\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget,\nvstudio = {\nsolutionVersion = \"12\",\ntargetFramework = \"4.5\",\ntoolsVersion = \"14.0\",\nwindowsTargetPlatformVersion = \"8.1\",\nsupports64bitEditContinue = true,\nintDirAbsolute = false,\n}\n}\n",
/* actions/vstudio/vs2017.lua */
"premake.vstudio.vc2017 = {}\nlocal vc2017 = premake.vstudio.vc2017\nlocal vstudio = premake.vstudio\nnewaction\n{\ntrigger = \"vs2017\",\nshortname = \"Visual Studio 2017\",\ndescription = \"Generate Microsoft Visual Studio 2017 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", vstudio.sln2005.generate)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", vstudio.cs2005.generate)\npremake.generate(prj, \"%%.csproj.user\", vstudio.cs2005.generate_user)\nelse\npremake.vstudio.needAppxManifest = false\npremake.generate(prj, \"%%.vcxproj\", premake.vs2010_vcxproj)\npremake.generate(prj, \"%%.vcxproj.user\", premake.vs2010_vcxproj_user)\npremake.generate(prj, \"%%.v"
"cxproj.filters\", vstudio.vc2010.generate_filters)\nif premake.vstudio.needAppxManifest then\npremake.generate(prj, \"%%/Package.appxmanifest\", premake.vs2010_appxmanifest)\nend\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget,\nvstudio = {\nsolutionVersion = \"12\",\ntargetFramework = \"4.5.2\",\ntoolsVersion = \"15.0\",\nwindowsTargetPlatformVersion = \"8.1\",\nsupports64bitEditContinue = true,\nintDirAbsolute = false,\n}\n}\n",
/* actions/vstudio/vs2019.lua */
"premake.vstudio.vc2019 = {}\nlocal vc2019 = premake.vstudio.vc2019\nlocal vstudio = premake.vstudio\nnewaction\n{\ntrigger = \"vs2019\",\nshortname = \"Visual Studio 2019\",\ndescription = \"Generate Microsoft Visual Studio 2019 project files\",\nos = \"windows\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\" },\nvalid_languages = { \"C\", \"C++\", \"C#\" },\nvalid_tools = {\ncc = { \"msc\" },\ndotnet = { \"msnet\" },\n},\nonsolution = function(sln)\npremake.generate(sln, \"%%.sln\", vstudio.sln2005.generate)\nend,\nonproject = function(prj)\nif premake.isdotnetproject(prj) then\npremake.generate(prj, \"%%.csproj\", vstudio.cs2005.generate)\npremake.generate(prj, \"%%.csproj.user\", vstudio.cs2005.generate_user)\nelse\npremake.vstudio.needAppxManifest = false\npremake.generate(prj, \"%%.vcxproj\", premake.vs2010_vcxproj)\npremake.generate(prj, \"%%.vcxproj.user\", premake.vs2010_vcxproj_user)\npremake.generate(prj, \"%%.v"
"cxproj.filters\", vstudio.vc2010.generate_filters)\nif premake.vstudio.needAppxManifest then\npremake.generate(prj, \"%%/Package.appxmanifest\", premake.vs2010_appxmanifest)\nend\nend\nend,\noncleansolution = premake.vstudio.cleansolution,\noncleanproject = premake.vstudio.cleanproject,\noncleantarget = premake.vstudio.cleantarget,\nvstudio = {\nsolutionVersion = \"12\",\ntargetFramework = \"4.7.2\",\ntoolsVersion = \"16.0\",\nwindowsTargetPlatformVersion = \"10.0\",\nsupports64bitEditContinue = true,\nintDirAbsolute = false,\n}\n}\n",
/* actions/xcode/_xcode.lua */
"premake.xcode = { }\nfunction premake.xcode.checkproject(prj)\nlocal last\nfor cfg in premake.eachconfig(prj) do\nif last and last ~= cfg.kind then\nerror(\"Project '\" .. prj.name .. \"' uses more than one target kind; not supported by Xcode\", 0)\nend\nlast = cfg.kind\nend\nend\npremake.xcode.toolset = \"macosx\"\n",
/* actions/xcode/xcode_common.lua */
"premake.xcode.parameters = { }\nlocal xcode = premake.xcode\nlocal tree = premake.tree\nfunction xcode.getbuildcategory(node)\nlocal categories = {\n[\".a\"] = \"Frameworks\",\n[\".h\"] = \"Headers\",\n[\".hh\"] = \"Headers\",\n[\".hpp\"] = \"Headers\",\n[\".hxx\"] = \"Headers\",\n[\".inl\"] = \"Headers\",\n[\".c\"] = \"Sources\",\n[\".cc\"] = \"Sources\",\n[\".cpp\"] = \"Sources\",\n[\".cxx\"] = \"Sources\",\n[\".c++\"] = \"Sources\",\n[\".dylib\"] = \"Frameworks\",\n[\".bundle\"] = \"Frameworks\",\n[\".framework\"] = \"Frameworks\",\n[\".tbd\"] = \"Frameworks\",\n[\".m\"] = \"Sources\",\n[\".mm\"] = \"Sources\",\n[\".S\"] = \"Sources\",\n[\".strings\"] = \"Resources\",\n[\".nib\"] = \"Resources\",\n[\".xib\"] = \"Resources\",\n[\".icns\"] = \"Resources\",\n[\".bmp\"] = \"Resources\",\n[\".wav\"] = \"Resources\",\n[\".xcassets\"] = \"Resources\",\n[\".xcdatamodeld\"] = \"Sources\",\n[\".swift\"] = \"Sources\",\n}\nreturn categories[path.getextension(node.name)] or\ncategories[string.lower(path.getextension("
"node.name))]\nend\nfunction xcode.getconfigname(cfg)\nlocal name = cfg.name\nif #cfg.project.solution.xcode.platforms > 1 then\nname = name .. \" \" .. premake.action.current().valid_platforms[cfg.platform]\nend\nreturn name\nend\nfunction xcode.getfiletype(node)\nlocal types = {\n[\".c\"] = \"sourcecode.c.c\",\n[\".cc\"] = \"sourcecode.cpp.cpp\",\n[\".cpp\"] = \"sourcecode.cpp.cpp\",\n[\".css\"] = \"text.css\",\n[\".cxx\"] = \"sourcecode.cpp.cpp\",\n[\".c++\"] = \"sourcecode.cpp.cpp\",\n[\".entitlements\"] = \"text.xml\",\n[\".bundle\"] = \"wrapper.cfbundle\",\n[\".framework\"] = \"wrapper.framework\",\n[\".tbd\"] = \"sourcecode.text-based-dylib-definition\",\n[\".gif\"] = \"image.gif\",\n[\".h\"] = \"sourcecode.c.h\",\n[\".hh\"] = \"sourcecode.cpp.h\",\n[\".hpp\"] = \"sourcecode.cpp.h\",\n[\".hxx\"] = \"sourcecode.cpp.h\",\n[\".inl\"] = \"sourcecode.cpp.h\",\n[\".html\"] = \"text.html\",\n[\".lua\"] = \"sourceco"
"de.lua\",\n[\".m\"] = \"sourcecode.c.objc\",\n[\".mm\"] = \"sourcecode.cpp.objcpp\",\n[\".S\"] = \"sourcecode.asm\",\n[\".nib\"] = \"wrapper.nib\",\n[\".pch\"] = \"sourcecode.c.h\",\n[\".plist\"] = \"text.plist.xml\",\n[\".strings\"] = \"text.plist.strings\",\n[\".xib\"] = \"file.xib\",\n[\".icns\"] = \"image.icns\",\n[\".bmp\"] = \"image.bmp\",\n[\".wav\"] = \"audio.wav\",\n[\".xcassets\"] = \"folder.assetcatalog\",\n[\".xcdatamodeld\"] = \"wrapper.xcdatamodeld\",\n[\".swift\"] = \"sourcecode.swift\",\n}\nreturn types[path.getextension(node.path)] or\n(types[string.lower(path.getextension(node.path))] or \"text\")\nend\nfunction xcode.getfiletypeForced(node)\nlocal types = {\n[\".c\"] = \"sourcecode.cpp.cpp\",\n[\".cc\"] = \"sourcecode.cpp.cpp\",\n[\".cpp\"] = \"sourcecode.cpp.cpp\",\n[\".css\"] = \"text.css\",\n[\".cxx\"] = \"sourcecode.cpp.cpp\",\n[\".c++\"] = \"sourcecode.cpp.cpp\",\n[\".entitlements"
"\"] = \"text.xml\",\n[\".bundle\"] = \"wrapper.cfbundle\",\n[\".framework\"] = \"wrapper.framework\",\n[\".tbd\"] = \"wrapper.framework\",\n[\".gif\"] = \"image.gif\",\n[\".h\"] = \"sourcecode.cpp.h\",\n[\".hh\"] = \"sourcecode.cpp.h\",\n[\".hpp\"] = \"sourcecode.cpp.h\",\n[\".hxx\"] = \"sourcecode.cpp.h\",\n[\".inl\"] = \"sourcecode.cpp.h\",\n[\".html\"] = \"text.html\",\n[\".lua\"] = \"sourcecode.lua\",\n[\".m\"] = \"sourcecode.cpp.objcpp\",\n[\".mm\"] = \"sourcecode.cpp.objcpp\",\n[\".nib\"] = \"wrapper.nib\",\n[\".pch\"] = \"sourcecode.cpp.h\",\n[\".plist\"] = \"text.plist.xml\",\n[\".strings\"] = \"text.plist.strings\",\n[\".xib\"] = \"file.xib\",\n[\".icns\"] = \"image.icns\",\n[\".bmp\"] = \"image.bmp\",\n[\".wav\"] = \"audio.wav\",\n[\".xcassets\"] = \"folder.assetcatalog\",\n[\".xcdatamodeld\"] = \"wrapper.xcdatamodeld\",\n[\".swift\"] = \"sourcecode.swift\",\n}\nreturn types[path.ge"
"textension(node.path)] or\n(types[string.lower(path.getextension(node.path))] or \"text\")\nend\nfunction xcode.getproducttype(node)\nlocal types = {\nConsoleApp = \"com.apple.product-type.tool\",\nWindowedApp = node.cfg.options.SkipBundling and \"com.apple.product-type.tool\" or \"com.apple.product-type.application\",\nStaticLib = \"com.apple.product-type.library.static\",\nSharedLib = \"com.apple.product-type.library.dynamic\",\nBundle = node.cfg.options.SkipBundling and \"com.apple.product-type.tool\" or \"com.apple.product-type.bundle\",\n}\nreturn types[node.cfg.kind]\nend\nfunction xcode.gettargettype(node)\nlocal types = {\nConsoleApp = \"\\\"compiled.mach-o.executable\\\"\",\nWindowedApp = node.cfg.options.SkipBundling and \"\\\"compiled.mach-o.executable\\\"\" or \"wrapper.application\",\nStaticLib = \"archive.ar\",\nSharedLib = \"\\\"compiled.mach-o.dylib\\\"\",\nBundle = node.cfg.options.SkipBundling and \"\\\"compiled.mach-o.bundle\\\"\" or \"wrapper.cfbundle\",\n}\nreturn types"
"[node.cfg.kind]\nend\nfunction xcode.getxcodeprojname(prj)\nlocal fname = premake.project.getfilename(prj, \"%%.xcodeproj\")\nreturn fname\nend\nfunction xcode.isframework(fname)\nreturn (path.getextension(fname) == \".framework\" or path.getextension(fname) == \".tbd\")\nend\nfunction xcode.uuid(param)\nreturn os.uuid(param):upper():gsub('-',''):sub(0,24)\nend\nfunction xcode.newid(node, usage)\nlocal base = ''\nlocal prj = node.project\nif prj == nil then\nlocal parent = node.parent\nwhile parent ~= nil do\nif parent.project ~= nil then\nprj = parent.project\nbreak\nend\nparent = parent.parent\nend\nend\nif prj ~= nil then\nprj.uuidcounter = (prj.uuidcounter or 0) + 1\nbase = base .. prj.name .. \"$\" .. prj.uuidcounter .. \"$\"\nend\nbase = base .. \"$\" .. (node.path or node.name or \"\")\nbase = base .. \"$\" .. (usage or \"\")\nreturn xcode.uuid(base)\nend\nfunction xcode.getscriptphaselabel(cmd, count, cfg)\nreturn string.format(\"\\\"Script Phase %s [%s] (%s)\\\"\", count, cmd:match(\"(%w+)(.+)\"), iif"
"(cfg, xcode.getconfigname(cfg), \"all\"))\nend\nfunction xcode.getcopyphaselabel(type, count, target)\nreturn string.format(\"\\\"Copy %s %s [%s]\\\"\", type, count, target)\nend\nfunction xcode.preparesolution(sln)\nsln.xcode = { }\nsln.xcode.platforms = premake.filterplatforms(sln, premake.action.current().valid_platforms, \"Universal\")\nfor prj in premake.solution.eachproject(sln) do\nlocal cfg = premake.getconfig(prj, prj.configurations[1], sln.xcode.platforms[1])\nlocal node = premake.tree.new(path.getname(cfg.buildtarget.bundlepath))\nnode.cfg = cfg\nnode.id = premake.xcode.newid(node, \"product\")\nnode.targetid = premake.xcode.newid(node, \"target\")\nprj.xcode = {}\nprj.xcode.projectnode = node\nend\nend\nfunction xcode.printlist(list, tag, sort)\nif #list > 0 then\nif sort ~= nil and sort == true then\ntable.sort(list)\nend\n_p(4,'%s = (', tag)\nfor _, item in ipairs(list) do\nlocal escaped_item = item:gsub(\"\\\"\", \"\\\\\\\\\\\\\\\"\"):gsub(\"'\", \"\\\\\\\\'\")\n_p(5, '\"%s\",', escaped_item)\ne"
"nd\n_p(4,');')\nend\nend\nfunction xcode.quotestr(str)\nif str:match(\"[^a-zA-Z0-9$._/]\") == nil then\nreturn str\nend\nreturn \"\\\"\" .. str:gsub(\"[\\\"\\\\\\\"]\", \"\\\\%0\") .. \"\\\"\"\nend\nfunction xcode.Header(tr, objversion)\n_p('// !$*UTF8*$!')\n_p('{')\n_p(1,'archiveVersion = 1;')\n_p(1,'classes = {')\n_p(1,'};')\n_p(1,'objectVersion = %d;', objversion)\n_p(1,'objects = {')\n_p('')\nend\nfunction xcode.PBXBuildFile(tr)\nlocal function gatherCopyFiles(which)\nlocal copyfiles = {}\nlocal targets = tr.project[which]\nif #targets > 0 then\nfor _, t in ipairs(targets) do\nfor __, tt in ipairs(t) do\ntable.insertflat(copyfiles, tt[2])\nend\nend\nend\nreturn table.translate(copyfiles, path.getname)\nend\nlocal function gatherCopyFrameworks(which)\nlocal copyfiles = {}\nlocal targets = tr.project[which]\nif #targets > 0 then\ntable.insertflat(copyfiles, targets)\nend\nreturn table.translate(copyfiles, path.getname)\nend\nlocal copyfiles = table.flatten({\ngatherCopyFiles('xcodecopyresources'),\ngatherCop"
"yFrameworks('xcodecopyframeworks')\n})\n_p('/* Begin PBXBuildFile section */')\ntree.traverse(tr, {\nonnode = function(node)\nif node.buildid then\n_p(2,'%s /* %s in %s */ = {isa = PBXBuildFile; fileRef = %s /* %s */; };',\nnode.buildid, node.name, xcode.getbuildcategory(node), node.id, node.name)\nend\nif table.icontains(copyfiles, node.name) then\n_p(2,'%s /* %s in %s */ = {isa = PBXBuildFile; fileRef = %s /* %s */; %s };',\nxcode.uuid(node.name .. 'in CopyFiles'), node.name, 'CopyFiles', node.id, node.name,\niif(xcode.isframework(node.name), \"settings = {ATTRIBUTES = (CodeSignOnCopy, ); };\", \"\")\n)\nend\nend\n})\n_p('/* End PBXBuildFile section */')\n_p('')\nend\nfunction xcode.PBXContainerItemProxy(tr)\nif #tr.projects.children > 0 then\n_p('/* Begin PBXContainerItemProxy section */')\nfor _, node in ipairs(tr.projects.children) do\n_p(2,'%s /* PBXContainerItemProxy */ = {', node.productproxyid)\n_p(3,'isa = PBXContainerItemProxy;')\n_p(3,'containerPortal = %s /* %s */;', node.id, path.getname(node.pat"
"h))\n_p(3,'proxyType = 2;')\n_p(3,'remoteGlobalIDString = %s;', node.project.xcode.projectnode.id)\n_p(3,'remoteInfo = \"%s\";', node.project.xcode.projectnode.name)\n_p(2,'};')\n_p(2,'%s /* PBXContainerItemProxy */ = {', node.targetproxyid)\n_p(3,'isa = PBXContainerItemProxy;')\n_p(3,'containerPortal = %s /* %s */;', node.id, path.getname(node.path))\n_p(3,'proxyType = 1;')\n_p(3,'remoteGlobalIDString = %s;', node.project.xcode.projectnode.targetid)\n_p(3,'remoteInfo = \"%s\";', node.project.xcode.projectnode.name)\n_p(2,'};')\nend\n_p('/* End PBXContainerItemProxy section */')\n_p('')\nend\nend\nfunction xcode.PBXFileReference(tr,prj)\n_p('/* Begin PBXFileReference section */')\ntree.traverse(tr, {\nonleaf = function(node)\nif not node.path then\nreturn\nend\nif node.kind == \"product\" then\n_p(2,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; includeInIndex = 0; name = \"%s\"; path = \"%s\"; sourceTree = BUILT_PRODUCTS_DIR; };',\nnode.id, node.name, xcode.gettargettype(node), node.name, path"
".getname(node.cfg.buildtarget.bundlepath))\nelseif node.parent.parent == tr.projects then\nlocal relpath = path.getrelative(tr.project.location, node.parent.project.location)\n_p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = \"%s\"; path = \"%s\"; sourceTree = SOURCE_ROOT; };',\nnode.parent.id, node.parent.name, node.parent.name, path.join(relpath, node.parent.name))\nelse\nlocal pth, src\nif xcode.isframework(node.path) then\nlocal nodePath = node.path\nlocal _, matchEnd, variable = string.find(nodePath, \"^%$%((.+)%)/\")\nif variable then\nnodePath = string.sub(nodePath, matchEnd + 1)\nend\nif string.find(nodePath,'/') then\nif string.find(nodePath,'^%.')then\nnodePath = path.getabsolute(path.join(tr.project.location, nodePath))\nend\npth = nodePath\nelseif path.getextension(nodePath)=='.tbd' then\npth = \"/usr/lib/\" .. nodePath\nelse\npth = \"/System/Library/Frameworks/\" .. nodePath\nend\nif variable then\nsrc = variable\nif string.find(pth, '^/') then\npth "
"= string.sub(pth, 2)\nend\nelse\nsrc = \"<absolute>\"\nend\nelse\nsrc = \"<group>\"\nif node.location then\npth = node.location\nelseif node.parent.isvpath then\npth = node.cfg.name\nelse\npth = tree.getlocalpath(node)\nend\nend\nif (not prj.options.ForceCPP) then\n_p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = \"%s\"; path = \"%s\"; sourceTree = \"%s\"; };',\nnode.id, node.name, xcode.getfiletype(node), node.name, pth, src)\nelse\n_p(2,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; name = \"%s\"; path = \"%s\"; sourceTree = \"%s\"; };',\nnode.id, node.name, xcode.getfiletypeForced(node), node.name, pth, src)\nend\nend\nend\n})\n_p('/* End PBXFileReference section */')\n_p('')\nend\nfunction xcode.PBXFrameworksBuildPhase(tr)\n_p('/* Begin PBXFrameworksBuildPhase section */')\n_p(2,'%s /* Frameworks */ = {', tr.products.children[1].fxstageid)\n_p(3,'isa = PBXFrameworksBuildPhase;')\n_p(3,'buildActionMask = 2147483647;')\n_p(3,'files = (')\ntree.traverse(tr.frameworks"
", {\nonleaf = function(node)\n_p(4,'%s /* %s in Frameworks */,', node.buildid, node.name)\nend\n})\ntree.traverse(tr.projects, {\nonleaf = function(node)\n_p(4,'%s /* %s in Frameworks */,', node.buildid, node.name)\nend\n})\n_p(3,');')\n_p(3,'runOnlyForDeploymentPostprocessing = 0;')\n_p(2,'};')\n_p('/* End PBXFrameworksBuildPhase section */')\n_p('')\nend\nfunction xcode.PBXGroup(tr)\n_p('/* Begin PBXGroup section */')\ntree.traverse(tr, {\nonnode = function(node)\nif (node.path and #node.children == 0) or node.kind == \"vgroup\" then\nreturn\nend\nif node.parent == tr.projects then\n_p(2,'%s /* Products */ = {', node.productgroupid)\nelse\n_p(2,'%s /* %s */ = {', node.id, node.name)\nend\n_p(3,'isa = PBXGroup;')\n_p(3,'children = (')\nfor _, childnode in ipairs(node.children) do\n_p(4,'%s /* %s */,', childnode.id, childnode.name)\nend\n_p(3,');')\nif node.parent == tr.projects then\n_p(3,'name = Products;')\nelse\n_p(3,'name = \"%s\";', node.name)\nif node.location then\n_p(3,'path = \"%s\";', node.location)"
"\nelseif node.path and not node.isvpath then\nlocal p = node.path\nif node.parent.path then\np = path.getrelative(node.parent.path, node.path)\nend\n_p(3,'path = \"%s\";', p)\nend\nend\n_p(3,'sourceTree = \"<group>\";')\n_p(2,'};')\nend\n}, true)\n_p('/* End PBXGroup section */')\n_p('')\nend\nfunction xcode.PBXNativeTarget(tr)\n_p('/* Begin PBXNativeTarget section */')\nfor _, node in ipairs(tr.products.children) do\nlocal name = tr.project.name\nlocal function hasBuildCommands(which)\nif #tr.project[which] > 0 then\nreturn true\nend\nfor _, cfg in ipairs(tr.configs) do\nif #cfg[which] > 0 then\nreturn true\nend\nend\nend\nlocal function dobuildblock(id, label, which, action)\nif hasBuildCommands(which) then\nlocal commandcount = 0\nfor _, cfg in ipairs(tr.configs) do\ncommandcount = commandcount + #cfg[which]\nend\nif commandcount > 0 then\naction(id, label)\nend\nend\nend\nlocal function doscriptphases(which, action)\nlocal i = 0\nfor _, cfg in ipairs(tr.configs) do\nlocal cfgcmds = cfg[which]\nif cfgcmds ~"
"= nil then\nfor __, scripts in ipairs(cfgcmds) do\nfor ___, script in ipairs(scripts) do\nlocal cmd = script[1]\nlocal label = xcode.getscriptphaselabel(cmd, i, cfg)\nlocal id = xcode.uuid(label)\naction(id, label)\ni = i + 1\nend\nend\nend\nend\nend\nlocal function docopyresources(which, action)\nif hasBuildCommands(which) then\nlocal targets = tr.project[which]\nif #targets > 0 then\nlocal i = 0\nfor _, t in ipairs(targets) do\nfor __, tt in ipairs(t) do\nlocal label = xcode.getcopyphaselabel('Resources', i, tt[1])\nlocal id = xcode.uuid(label)\naction(id, label)\ni = i + 1\nend\nend\nend\nend\nend\nlocal function docopyframeworks(which, action)\nif hasBuildCommands(which) then\nlocal targets = tr.project[which]\nif #targets > 0 then\nlocal label = \"Copy Frameworks\"\nlocal id = xcode.uuid(label)\naction(id, label)\nend\nend\nend\nlocal function _p_label(id, label)\n_p(4, '%s /* %s */,', id, label)\nend\n_p(2,'%s /* %s */ = {', node.targetid, name)\n_p(3,'isa = PBXNativeTarget;')\n_p(3,'buildConfigurationLi"
"st = %s /* Build configuration list for PBXNativeTarget \"%s\" */;', node.cfgsection, name)\n_p(3,'buildPhases = (')\ndobuildblock('9607AE1010C857E500CD1376', 'Prebuild', 'prebuildcommands', _p_label)\n_p(4,'%s /* Resources */,', node.resstageid)\n_p(4,'%s /* Sources */,', node.sourcesid)\ndobuildblock('9607AE3510C85E7E00CD1376', 'Prelink', 'prelinkcommands', _p_label)\n_p(4,'%s /* Frameworks */,', node.fxstageid)\ndobuildblock('9607AE3710C85E8F00CD1376', 'Postbuild', 'postbuildcommands', _p_label)\ndoscriptphases(\"xcodescriptphases\", _p_label)\ndocopyresources(\"xcodecopyresources\", _p_label)\nif tr.project.kind == \"WindowedApp\" then\ndocopyframeworks(\"xcodecopyframeworks\", _p_label)\nend\n_p(3,');')\n_p(3,'buildRules = (')\n_p(3,');')\n_p(3,'dependencies = (')\nfor _, node in ipairs(tr.projects.children) do\n_p(4,'%s /* PBXTargetDependency */,', node.targetdependid)\nend\n_p(3,');')\n_p(3,'name = \"%s\";', name)\nlocal p\nif node.cfg.kind == \"ConsoleApp\" then\np = \"$(HOME)/bin\"\nelseif node.cfg.ki"
"nd == \"WindowedApp\" then\np = \"$(HOME)/Applications\"\nend\nif p then\n_p(3,'productInstallPath = \"%s\";', p)\nend\n_p(3,'productName = \"%s\";', name)\n_p(3,'productReference = %s /* %s */;', node.id, node.name)\n_p(3,'productType = \"%s\";', xcode.getproducttype(node))\n_p(2,'};')\nend\n_p('/* End PBXNativeTarget section */')\n_p('')\nend\nfunction xcode.PBXProject(tr, compatVersion)\n_p('/* Begin PBXProject section */')\n_p(2,'__RootObject_ /* Project object */ = {')\n_p(3,'isa = PBXProject;')\n_p(3,'buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject \"%s\" */;', tr.name)\n_p(3,'compatibilityVersion = \"Xcode %s\";', compatVersion)\n_p(3,'hasScannedForEncodings = 1;')\n_p(3,'mainGroup = %s /* %s */;', tr.id, tr.name)\n_p(3,'projectDirPath = \"\";')\nif #tr.projects.children > 0 then\n_p(3,'projectReferences = (')\nfor _, node in ipairs(tr.projects.children) do\n_p(4,'{')\n_p(5,'ProductGroup = %s /* Products */;', node.productgroupid)\n_p(5,'ProjectRef = %s /* %s"
" */;', node.id, path.getname(node.path))\n_p(4,'},')\nend\n_p(3,');')\nend\n_p(3,'projectRoot = \"\";')\n_p(3,'targets = (')\nfor _, node in ipairs(tr.products.children) do\n_p(4,'%s /* %s */,', node.targetid, node.name)\nend\n_p(3,');')\n_p(2,'};')\n_p('/* End PBXProject section */')\n_p('')\nend\nfunction xcode.PBXReferenceProxy(tr)\nif #tr.projects.children > 0 then\n_p('/* Begin PBXReferenceProxy section */')\ntree.traverse(tr.projects, {\nonleaf = function(node)\n_p(2,'%s /* %s */ = {', node.id, node.name)\n_p(3,'isa = PBXReferenceProxy;')\n_p(3,'fileType = %s;', xcode.gettargettype(node))\n_p(3,'path = \"%s\";', node.path)\n_p(3,'remoteRef = %s /* PBXContainerItemProxy */;', node.parent.productproxyid)\n_p(3,'sourceTree = BUILT_PRODUCTS_DIR;')\n_p(2,'};')\nend\n})\n_p('/* End PBXReferenceProxy section */')\n_p('')\nend\nend\nfunction xcode.PBXResourcesBuildPhase(tr)\n_p('/* Begin PBXResourcesBuildPhase section */')\nfor _, target in ipairs(tr.products.children) do\n_p(2,'%s /* Resources */ = {', target.r"
"esstageid)\n_p(3,'isa = PBXResourcesBuildPhase;')\n_p(3,'buildActionMask = 2147483647;')\n_p(3,'files = (')\ntree.traverse(tr, {\nonnode = function(node)\nif xcode.getbuildcategory(node) == \"Resources\" then\n_p(4,'%s /* %s in Resources */,', node.buildid, node.name)\nend\nend\n})\n_p(3,');')\n_p(3,'runOnlyForDeploymentPostprocessing = 0;')\n_p(2,'};')\nend\n_p('/* End PBXResourcesBuildPhase section */')\n_p('')\nend\nfunction xcode.PBXShellScriptBuildPhase(tr)\nlocal wrapperWritten = false\nlocal function doblock(id, name, commands, files)\nif commands ~= nil then\ncommands = table.flatten(commands)\nend\nif #commands > 0 then\nif not wrapperWritten then\n_p('/* Begin PBXShellScriptBuildPhase section */')\nwrapperWritten = true\nend\n_p(2,'%s /* %s */ = {', id, name)\n_p(3,'isa = PBXShellScriptBuildPhase;')\n_p(3,'buildActionMask = 2147483647;')\n_p(3,'files = (')\n_p(3,');')\n_p(3,'inputPaths = (');\nif files ~= nil then\nfiles = table.flatten(files)\nif #files > 0 then\nfor _, file in ipairs(files) do\n_p("
"4, '\"%s\",', file)\nend\nend\nend\n_p(3,');');\n_p(3,'name = %s;', name);\n_p(3,'outputPaths = (');\n_p(3,');');\n_p(3,'runOnlyForDeploymentPostprocessing = 0;');\n_p(3,'shellPath = /bin/sh;');\n_p(3,'shellScript = \"%s\";', table.concat(commands, \"\\\\n\"):gsub('\"', '\\\\\"'))\n_p(2,'};')\nend\nend\nlocal function wrapcommands(cmds, cfg)\nlocal commands = {}\nif #cmds > 0 then\ntable.insert(commands, 'if [ \"${CONFIGURATION}\" = \"' .. xcode.getconfigname(cfg) .. '\" ]; then')\nfor i = 1, #cmds do\nlocal cmd = cmds[i]\ncmd = cmd:gsub('\\\\','\\\\\\\\')\ntable.insert(commands, cmd)\nend\ntable.insert(commands, 'fi')\nend\nreturn commands\nend\nlocal function dobuildblock(id, name, which)\nlocal commands = {}\nfor _, cfg in ipairs(tr.configs) do\nlocal cfgcmds = wrapcommands(cfg[which], cfg)\nif #cfgcmds > 0 then\nfor i, cmd in ipairs(cfgcmds) do\ntable.insert(commands, cmd)\nend\nend\nend\ndoblock(id, name, commands)\nend\nlocal function doscriptphases(which)\nlocal i = 0\nfor _, cfg in ipairs(tr.configs) d"
"o\nlocal cfgcmds = cfg[which]\nif cfgcmds ~= nil then\nfor __, scripts in ipairs(cfgcmds) do\nfor ___, script in ipairs(scripts) do\nlocal cmd = script[1]\nlocal files = script[2]\nlocal label = xcode.getscriptphaselabel(cmd, i, cfg)\nlocal id = xcode.uuid(label)\ndoblock(id, label, wrapcommands({cmd}, cfg), files)\ni = i + 1\nend\nend\nend\nend\nend\ndobuildblock(\"9607AE1010C857E500CD1376\", \"Prebuild\", \"prebuildcommands\")\ndobuildblock(\"9607AE3510C85E7E00CD1376\", \"Prelink\", \"prelinkcommands\")\ndobuildblock(\"9607AE3710C85E8F00CD1376\", \"Postbuild\", \"postbuildcommands\")\ndoscriptphases(\"xcodescriptphases\")\nif wrapperWritten then\n_p('/* End PBXShellScriptBuildPhase section */')\nend\nend\nfunction xcode.PBXSourcesBuildPhase(tr,prj)\n_p('/* Begin PBXSourcesBuildPhase section */')\nfor _, target in ipairs(tr.products.children) do\n_p(2,'%s /* Sources */ = {', target.sourcesid)\n_p(3,'isa = PBXSourcesBuildPhase;')\n_p(3,'buildActionMask = 2147483647;')\n_p(3,'files = (')\ntree.traverse(tr, {\no"
"nleaf = function(node)\nif xcode.getbuildcategory(node) == \"Sources\" then\nif not table.icontains(prj.excludes, node.cfg.name) then -- if not excluded\n_p(4,'%s /* %s in Sources */,', node.buildid, node.name)\nend\nend\nend\n})\n_p(3,');')\n_p(3,'runOnlyForDeploymentPostprocessing = 0;')\n_p(2,'};')\nend\n_p('/* End PBXSourcesBuildPhase section */')\n_p('')\nend\nfunction xcode.PBXCopyFilesBuildPhase(tr)\nlocal wrapperWritten = false\nlocal function doblock(id, name, folderSpec, path, files)\nif #files > 0 then\nif not wrapperWritten then\n_p('/* Begin PBXCopyFilesBuildPhase section */')\nwrapperWritten = true\nend\n_p(2,'%s /* %s */ = {', id, name)\n_p(3,'isa = PBXCopyFilesBuildPhase;')\n_p(3,'buildActionMask = 2147483647;')\n_p(3,'dstPath = \\\"%s\\\";', path)\n_p(3,'dstSubfolderSpec = \\\"%s\\\";', folderSpec)\n_p(3,'files = (')\ntree.traverse(tr, {\nonleaf = function(node)\nif table.icontains(files, node.name) then\n_p(4,'%s /* %s in %s */,',\nxcode.uuid(node.name .. 'in CopyFiles'), node.name, 'CopyFile"
"s')\nend\nend\n})\n_p(3,');')\n_p(3,'runOnlyForDeploymentPostprocessing = 0;');\n_p(2,'};')\nend\nend\nlocal function docopyresources(which)\nlocal targets = tr.project[which]\nif #targets > 0 then\nlocal i = 0\nfor _, t in ipairs(targets) do\nfor __, tt in ipairs(t) do\nlocal label = xcode.getcopyphaselabel('Resources', i, tt[1])\nlocal id = xcode.uuid(label)\nlocal files = table.translate(table.flatten(tt[2]), path.getname)\ndoblock(id, label, 7, tt[1], files)\ni = i + 1\nend\nend\nend\nend\nlocal function docopyframeworks(which)\nlocal targets = tr.project[which]\nif #targets > 0 then\nlocal label = \"Copy Frameworks\"\nlocal id = xcode.uuid(label)\nlocal files = table.translate(table.flatten(targets), path.getname)\ndoblock(id, label, 10, \"\", files)\nend\nend\ndocopyresources(\"xcodecopyresources\")\nif tr.project.kind == \"WindowedApp\" then\ndocopyframeworks(\"xcodecopyframeworks\")\nend\nif wrapperWritten then\n_p('/* End PBXCopyFilesBuildPhase section */')\nend\nend\nfunction xcode.PBXVariantGroup(tr"
")\n_p('/* Begin PBXVariantGroup section */')\ntree.traverse(tr, {\nonbranch = function(node)\nif node.kind == \"vgroup\" then\n_p(2,'%s /* %s */ = {', node.id, node.name)\n_p(3,'isa = PBXVariantGroup;')\n_p(3,'children = (')\nfor _, lang in ipairs(node.children) do\n_p(4,'%s /* %s */,', lang.id, lang.name)\nend\n_p(3,');')\n_p(3,'name = %s;', node.name)\n_p(3,'sourceTree = \"<group>\";')\n_p(2,'};')\nend\nend\n})\n_p('/* End PBXVariantGroup section */')\n_p('')\nend\nfunction xcode.PBXTargetDependency(tr)\nif #tr.projects.children > 0 then\n_p('/* Begin PBXTargetDependency section */')\ntree.traverse(tr.projects, {\nonleaf = function(node)\n_p(2,'%s /* PBXTargetDependency */ = {', node.parent.targetdependid)\n_p(3,'isa = PBXTargetDependency;')\n_p(3,'name = \"%s\";', node.name)\n_p(3,'targetProxy = %s /* PBXContainerItemProxy */;', node.parent.targetproxyid)\n_p(2,'};')\nend\n})\n_p('/* End PBXTargetDependency section */')\n_p('')\nend\nend\nfunction xcode.cfg_excluded_files(prj, cfg)\nlocal excluded = {}\nloc"
"al function exclude_pattern(file)\nif path.isabsolute(file) then\nreturn file\nend\nlocal start, term = file:findlast(\"/%.%./\")\nif term then\nreturn path.join(\"*\", file:sub(term + 1))\nend\nstart, term = file:find(\"%.%./\")\nif start == 1 then\nreturn path.join(\"*\", file:sub(term + 1))\nend\nreturn path.join(\"*\", file)\nend\nlocal function add_file(file)\nlocal name = exclude_pattern(file)\nif not table.icontains(excluded, name) then\ntable.insert(excluded, name)\nend\nend\nlocal function verify_file(file)\nlocal name = exclude_pattern(file)\nif table.icontains(excluded, name) then\nerror(\"'\" .. file .. \"' would be excluded by the rule to exclude '\" .. name .. \"'\")\nend\nend\nfor _, file in ipairs(cfg.excludes) do\nadd_file(file)\nend\nfor _, file in ipairs(prj.allfiles) do\nif not table.icontains(prj.excludes, file) and not table.icontains(cfg.excludes, file) then\nif not table.icontains(cfg.files, file) then\nadd_file(file)\nelse\nverify_file(file)\nend\nend\nend\ntable.sort(excluded)\nreturn"
" excluded\nend\nfunction xcode.XCBuildConfiguration_Impl(tr, id, opts, cfg)\nlocal cfgname = xcode.getconfigname(cfg)\n_p(2,'%s /* %s */ = {', id, cfgname)\n_p(3,'isa = XCBuildConfiguration;')\n_p(3,'buildSettings = {')\nfor k, v in table.sortedpairs(opts) do\nif type(v) == \"table\" then\nif #v > 0 then\n_p(4,'%s = (', k)\nfor i, v2 in ipairs(v) do\n_p(5,'%s,', xcode.quotestr(tostring(v2)))\nend\n_p(4,');')\nend\nelse\n_p(4,'%s = %s;', k, xcode.quotestr(tostring(v)))\nend\nend\n_p(3,'};')\n_p(3,'name = %s;', xcode.quotestr(cfgname))\n_p(2,'};')\nend\nlocal function add_options(options, extras)\nfor _, tbl in ipairs(extras) do\nfor tkey, tval in pairs(tbl) do\noptions[tkey] = tval\nend\nend\nend\nlocal function add_wholearchive_links(opts, cfg)\nif #cfg.wholearchive > 0 then\nlocal linkopts = {}\nfor _, depcfg in ipairs(premake.getlinks(cfg, \"siblings\", \"object\")) do\nif table.icontains(cfg.wholearchive, depcfg.project.name) then\nlocal linkpath = path.rebase(depcfg.linktarget.fullpath, depcfg.location, cf"
"g.location)\ntable.insert(linkopts, \"-force_load\")\ntable.insert(linkopts, linkpath)\nend\nend\nif opts.OTHER_LDFLAGS then\nlinkopts = table.join(linkopts, opts.OTHER_LDFLAGS)\nend\nopts.OTHER_LDFLAGS = linkopts\nend\nend\nfunction xcode.XCBuildConfiguration(tr, prj, opts)\n_p('/* Begin XCBuildConfiguration section */')\nfor _, target in ipairs(tr.products.children) do\nfor _, cfg in ipairs(tr.configs) do\nlocal values = opts.ontarget(tr, target, cfg)\nadd_options(values, cfg.xcodetargetopts)\nxcode.XCBuildConfiguration_Impl(tr, cfg.xcode.targetid, values, cfg)\nend\nend\nfor _, cfg in ipairs(tr.configs) do\nlocal values = opts.onproject(tr, prj, cfg)\nadd_options(values, cfg.xcodeprojectopts)\nadd_wholearchive_links(values, cfg)\nxcode.XCBuildConfiguration_Impl(tr, cfg.xcode.projectid, values, cfg)\nend\n_p('/* End XCBuildConfiguration section */')\n_p('')\nend\nfunction xcode.XCBuildConfigurationList(tr)\nlocal sln = tr.project.solution\n_p('/* Begin XCConfigurationList section */')\nfor _, target in ipair"
"s(tr.products.children) do\n_p(2,'%s /* Build configuration list for PBXNativeTarget \"%s\" */ = {', target.cfgsection, target.name)\n_p(3,'isa = XCConfigurationList;')\n_p(3,'buildConfigurations = (')\nfor _, cfg in ipairs(tr.configs) do\n_p(4,'%s /* %s */,', cfg.xcode.targetid, xcode.getconfigname(cfg))\nend\n_p(3,');')\n_p(3,'defaultConfigurationIsVisible = 0;')\n_p(3,'defaultConfigurationName = \"%s\";', xcode.getconfigname(tr.configs[1]))\n_p(2,'};')\nend\n_p(2,'1DEB928908733DD80010E9CD /* Build configuration list for PBXProject \"%s\" */ = {', tr.name)\n_p(3,'isa = XCConfigurationList;')\n_p(3,'buildConfigurations = (')\nfor _, cfg in ipairs(tr.configs) do\n_p(4,'%s /* %s */,', cfg.xcode.projectid, xcode.getconfigname(cfg))\nend\n_p(3,');')\n_p(3,'defaultConfigurationIsVisible = 0;')\n_p(3,'defaultConfigurationName = \"%s\";', xcode.getconfigname(tr.configs[1]))\n_p(2,'};')\n_p('/* End XCConfigurationList section */')\n_p('')\nend\nfunction xcode.Footer()\n_p(1,'};')\n_p('\\trootObject = __RootObject_ /*"
" Project object */;')\n_p('}')\nend\n",
/* actions/xcode/xcode_project.lua */
"local xcode = premake.xcode\nlocal tree = premake.tree\nfunction xcode.buildprjtree(prj)\nlocal tr = premake.project.buildsourcetree(prj, true)\ntr.configs = {}\nfor _, cfgname in ipairs(prj.solution.configurations) do\nfor _, platform in ipairs(prj.solution.xcode.platforms) do\nlocal cfg = premake.getconfig(prj, cfgname, platform)\ncfg.xcode = {}\ncfg.xcode.targetid = xcode.newid(prj.xcode.projectnode, \"tgt:\"..platform..cfgname)\ncfg.xcode.projectid = xcode.newid(tr, \"prj:\"..platform..cfgname)\ntable.insert(tr.configs, cfg)\nend\nend\ntree.traverse(tr, {\nonbranch = function(node)\nif path.getextension(node.name) == \".lproj\" then\nlocal lang = path.getbasename(node.name) -- \"English\", \"French\", etc.\nfor _, filenode in ipairs(node.children) do\nlocal grpnode = node.parent.children[filenode.name]\nif not grpnode then\ngrpnode = tree.insert(node.parent, tree.new(filenode.name))\ngrpnode.kind = \"vgroup\"\nend\nfilenode.name = path.getbasename(lang)\ntree.insert(grpnode, filenode)\nend\ntree.remove(no"
"de)\nend\nend\n})\ntree.traverse(tr, {\nonbranch = function(node)\nif path.getextension(node.name) == \".xcassets\" then\nnode.children = {}\nend\nend\n})\ntr.frameworks = tree.new(\"Frameworks\")\nfor cfg in premake.eachconfig(prj) do\nfor _, link in ipairs(premake.getlinks(cfg, \"system\", \"fullpath\")) do\nlocal name = path.getname(link)\nif xcode.isframework(name) and not tr.frameworks.children[name] then\nnode = tree.insert(tr.frameworks, tree.new(name))\nnode.path = link\nend\nend\nend\nif #tr.frameworks.children > 0 then\ntree.insert(tr, tr.frameworks)\nend\ntr.products = tree.insert(tr, tree.new(\"Products\"))\ntr.projects = tree.new(\"Projects\")\nfor _, dep in ipairs(premake.getdependencies(prj, \"sibling\", \"object\")) do\nlocal xcpath = xcode.getxcodeprojname(dep)\nlocal xcnode = tree.insert(tr.projects, tree.new(path.getname(xcpath)))\nxcnode.path = xcpath\nxcnode.project = dep\nxcnode.productgroupid = xcode.newid(xcnode, \"prodgrp\")\nxcnode.productproxyid = xcode.newid(xcnode, \"prodprox\")\nx"
"cnode.targetproxyid = xcode.newid(xcnode, \"targprox\")\nxcnode.targetdependid = xcode.newid(xcnode, \"targdep\")\nlocal cfg = premake.getconfig(dep, prj.configurations[1])\nnode = tree.insert(xcnode, tree.new(cfg.linktarget.name))\nnode.path = cfg.linktarget.fullpath\nnode.cfg = cfg\nend\nif #tr.projects.children > 0 then\ntree.insert(tr, tr.projects)\nend\ntree.traverse(tr, {\nonbranchexit = function(node)\nfor _, child in ipairs(node.children) do\nif (child.location) then\nif (node.location) then\nwhile (not string.startswith(child.location, node.location)) do\nnode.location = path.getdirectory(node.location)\nend\nelse\nnode.location = path.getdirectory(child.location)\nend\nend\nend\nend,\nonleaf = function(node)\nif (node.cfg) then\nnode.location = node.cfg.name\nend\nend\n}, true)\ntree.traverse(tr, {\nonbranchexit = function(node, depth)\nif (node.location and node.parent and node.parent.location) then\nnode.location = path.getrelative(node.parent.location, node.location)\nend\nend,\nonleaf = function"
"(node, depth)\nif (node.location and node.parent and node.parent.location) then\nnode.location = path.getrelative(node.parent.location, node.location)\nend\nend\n}, true)\ntree.traverse(tr, {\nonnode = function(node)\nnode.id = xcode.newid(node)\nif xcode.getbuildcategory(node) then\nnode.buildid = xcode.newid(node, \"build\")\nend\nif string.endswith(node.name, \"Info.plist\") then\ntr.infoplist = node\nend\nif string.endswith(node.name, \".entitlements\") then\ntr.entitlements = node\nend\nend\n}, true)\nnode = tree.insert(tr.products, prj.xcode.projectnode)\nnode.kind = \"product\"\nnode.path = node.cfg.buildtarget.fullpath\nnode.cfgsection = xcode.newid(node, \"cfg\")\nnode.resstageid = xcode.newid(node, \"rez\")\nnode.sourcesid = xcode.newid(node, \"src\")\nnode.fxstageid = xcode.newid(node, \"fxs\")\nreturn tr\nend\n",
/* actions/xcode/xcode_scheme.lua */
"local premake = premake\nlocal xcode = premake.xcode\nlocal function buildableref(indent, prj, cfg)\ncfg = cfg or premake.eachconfig(prj)()\n_p(indent + 0, '<BuildableReference')\n_p(indent + 1, 'BuildableIdentifier = \"primary\"')\n_p(indent + 1, 'BlueprintIdentifier = \"%s\"', prj.xcode.projectnode.targetid)\n_p(indent + 1, 'BuildableName = \"%s\"', cfg.buildtarget.name)\n_p(indent + 1, 'BlueprintName = \"%s\"', prj.name)\n_p(indent + 1, 'ReferencedContainer = \"container:%s.xcodeproj\">', prj.name)\n_p(indent + 0, '</BuildableReference>')\nend\nlocal function cmdlineargs(indent, cfg)\nif #cfg.debugargs > 0 then\n_p(indent, '<CommandLineArguments>')\nfor _, arg in ipairs(cfg.debugargs) do\n_p(indent + 1, '<CommandLineArgument')\n_p(indent + 2, 'argument = \"%s\"', arg)\n_p(indent + 2, 'isEnabled = \"YES\">')\n_p(indent + 1, '</CommandLineArgument>')\nend\n_p(indent, '</CommandLineArguments>')\nend\nend\nlocal function envvars(indent, cfg)\nif #cfg.debugenvs > 0 then\n_p(indent, '<EnvironmentVariables>')\nf"
"or _, arg in ipairs(cfg.debugenvs) do\nlocal eq = arg:find(\"=\")\nlocal k = arg:sub(1, eq)\nlocal v = arg:sub(eq + 1)\n_p(indent + 1, '<EnvironmentVariable')\n_p(indent + 2, 'key = \"%s\"', arg:sub(1, eq))\n_p(indent + 2, 'value = \"%s\"', arg:sub(eq))\n_p(indent + 2, 'isEnabled = \"YES\">')\n_p(indent + 1, '</EnvironmentVariable>')\nend\n_p(indent, '</EnvironmentVariables>')\nend\nend\nlocal function workingdir(dir)\nif not path.isabsolute(dir) then\ndir = \"$PROJECT_DIR/\" .. dir\nend\nreturn dir\nend\nlocal function bestconfig(prj, fordebug)\nlocal bestcfg = nil\nlocal bestscore = -1\nfor cfg in premake.eachconfig(prj) do\nlocal score = 0\nif cfg.platform == \"Native\" then\nscore = score + 10\nend\nif fordebug and cfg.name == \"Debug\" then\nscore = score + 1\nend\nif not fordebug and cfg.name == \"Release\" then\nscore = score + 1\nend\nif score > bestscore then\nbestcfg = cfg\nbestscore = score\nend\nend\nreturn bestcfg\nend\nfunction xcode.scheme(tobuild, primary, schemecfg)\n_p('<?xml version=\"1.0\" "
"encoding=\"UTF-8\"?>')\n_p('<Scheme')\n_p(1, 'LastUpgradeVersion = \"0940\"')\n_p(1, 'version = \"1.3\">')\n_p(1, '<BuildAction')\n_p(2, 'parallelizeBuildables = \"YES\"')\n_p(2, 'buildImplicitDependencies = \"YES\">')\n_p(2, '<BuildActionEntries>')\nfor _, prj in ipairs(tobuild) do\n_p(3, '<BuildActionEntry')\n_p(4, 'buildForTesting = \"YES\"')\n_p(4, 'buildForRunning = \"YES\"')\n_p(4, 'buildForProfiling = \"YES\"')\n_p(4, 'buildForArchiving = \"YES\"')\n_p(4, 'buildForAnalyzing = \"YES\">')\nbuildableref(4, prj)\n_p(3, '</BuildActionEntry>')\nend\nlocal debugcfg = schemecfg or bestconfig(primary, true)\nlocal releasecfg = schemecfg or bestconfig(primary, false)\nlocal debugname = xcode.getconfigname(debugcfg)\nlocal releasename = xcode.getconfigname(releasecfg)\n_p(2, '</BuildActionEntries>')\n_p(1, '</BuildAction>')\n_p(1, '<TestAction')\n_p(2, 'buildConfiguration = \"%s\"', debugname)\n_p(2, 'selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"')\n_p(2, 'selectedLauncherIdentifier"
" = \"Xcode.DebuggerFoundation.Launcher.LLDB\"')\n_p(2, 'shouldUseLaunchSchemeArgsEnv = \"YES\">')\n_p(2, '<Testables>')\n_p(2, '</Testables>')\n_p(2, '<MacroExpansion>')\nbuildableref(3, primary, debugcfg)\n_p(2, '</MacroExpansion>')\n_p(2, '<AdditionalOptions>')\n_p(2, '</AdditionalOptions>')\n_p(1, '</TestAction>')\n_p(1, '<LaunchAction')\n_p(2, 'buildConfiguration = \"%s\"', debugname)\n_p(2, 'selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"')\n_p(2, 'selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"')\n_p(2, 'launchStyle = \"0\"')\nif debugcfg.debugdir then\n_p(2, 'useCustomWorkingDirectory = \"YES\"')\n_p(2, 'customWorkingDirectory = \"%s\"', workingdir(debugcfg.debugdir))\nelse\n_p(2, 'useCustomWorkingDirectory = \"NO\"')\nend\n_p(2, 'ignoresPersistentStateOnLaunch = \"NO\"')\n_p(2, 'debugDocumentVersioning = \"YES\"')\n_p(2, 'debugServiceExtension = \"internal\"')\n_p(2, 'allowLocationSimulation = \"YES\">')\nif debugcfg.debugcmd then\n_p(2, '<PathRunnable')"
"\n_p(3, 'runnableDebuggingMode = \"0\"')\n_p(3, 'FilePath = \"%s\">', debugcfg.debugcmd)\n_p(2, '</PathRunnable>')\nelse\n_p(2, '<BuildableProductRunnable')\n_p(3, 'runnableDebuggingMode = \"0\">')\nbuildableref(3, primary, debugcfg)\n_p(2, '</BuildableProductRunnable>')\nend\ncmdlineargs(2, debugcfg)\nenvvars(2, debugcfg)\n_p(2, '<AdditionalOptions>')\n_p(2, '</AdditionalOptions>')\n_p(1, '</LaunchAction>')\n_p(1, '<ProfileAction')\n_p(2, 'buildConfiguration = \"%s\"', releasename)\n_p(2, 'shouldUseLaunchSchemeArgsEnv = \"YES\"')\n_p(2, 'savedToolIdentifier = \"\"')\nif releasecfg.debugdir then\n_p(2, 'useCustomWorkingDirectory = \"YES\"')\n_p(2, 'customWorkingDirectory = \"%s\"', workingdir(releasecfg.debugdir))\nelse\n_p(2, 'useCustomWorkingDirectory = \"NO\"')\nend\n_p(2, 'debugDocumentVersioning = \"YES\">')\n_p(2, '<BuildableProductRunnable')\n_p(3, 'runnableDebuggingMode = \"0\">')\nbuildableref(3, primary, releasecfg)\n_p(2, '</BuildableProductRunnable>')\ncmdlineargs(2, releasecfg)\nenvvars(2, release"
"cfg)\n_p(1, '</ProfileAction>')\n_p(1, '<AnalyzeAction')\n_p(2, 'buildConfiguration = \"%s\">', debugname)\n_p(1, '</AnalyzeAction>')\n_p(1, '<ArchiveAction')\n_p(2, 'buildConfiguration = \"%s\"', releasename)\n_p(2, 'revealArchiveInOrganizer = \"YES\">')\n_p(1, '</ArchiveAction>')\n_p('</Scheme>')\nend\nfunction xcode.generate_schemes(prj, base_path)\nif (prj.kind == \"ConsoleApp\" or prj.kind == \"WindowedApp\") or (prj.options and prj.options.XcodeLibrarySchemes) then\nif prj.options and prj.options.XcodeSchemeNoConfigs then\npremake.generate(prj, path.join(base_path, \"%%.xcscheme\"),\nfunction(prj) xcode.scheme({prj}, prj) end)\nelse\nfor cfg in premake.eachconfig(prj) do\npremake.generate(prj, path.join(base_path, \"%% \" .. cfg.name .. \".xcscheme\"),\nfunction(prj) xcode.scheme({prj}, prj, cfg) end)\nend\nend\nend\nend\n",
/* actions/xcode/xcode_workspace.lua */
"local premake = premake\nlocal xcode = premake.xcode\nxcode.allscheme = false\nfunction xcode.workspace_head()\n_p('<?xml version=\"1.0\" encoding=\"UTF-8\"?>')\n_p('<Workspace')\n_p(1,'version = \"1.0\">')\nend\nfunction xcode.workspace_tail()\n_p('</Workspace>')\nend\nfunction xcode.workspace_file_ref(prj, indent)\nlocal projpath = path.getrelative(prj.solution.location, prj.location)\nif projpath == '.' then projpath = ''\nelse projpath = projpath ..'/'\nend\n_p(indent, '<FileRef')\n_p(indent + 1, 'location = \"group:%s\">', projpath .. prj.name .. '.xcodeproj')\n_p(indent, '</FileRef>')\nend\nfunction xcode.workspace_group(grp, indent)\n_p(indent, '<Group')\n_p(indent + 1, 'location = \"container:\"')\n_p(indent + 1, 'name = \"%s\">', grp.name)\nlocal function comparenames(a, b)\nreturn a.name < b.name\nend\nlocal groups = table.join(grp.groups)\nlocal projects = table.join(grp.projects)\ntable.sort(groups, comparenames)\ntable.sort(projects, comparenames)\nfor _, child in ipairs(groups) do\nxcode.workspac"
"e_group(child, indent + 1)\nend\nfor _, prj in ipairs(projects) do\nxcode.workspace_file_ref(prj, indent + 1)\nend\n_p(indent, '</Group>')\nend\nfunction xcode.workspace_generate(sln)\nxcode.preparesolution(sln)\nxcode.workspace_head()\nxcode.reorderProjects(sln)\nfor grp in premake.solution.eachgroup(sln) do\nif grp.parent == nil then\nxcode.workspace_group(grp, 1)\nend\nend\nfor prj in premake.solution.eachproject(sln) do\nif prj.group == nil then\nxcode.workspace_file_ref(prj, 1)\nend\nend\nxcode.workspace_tail()\nend\nfunction xcode.workspace_scheme(sln)\nif not xcode.allscheme then\nreturn false\nend\nlocal projects = {}\nlocal primary = nil\nfor prj in premake.solution.eachproject(sln) do\nif not primary or (sln.startproject == prj.name) then\nprimary = prj\nend\ntable.insert(projects, prj)\nend\nxcode.scheme(projects, primary)\nend\nfunction xcode.workspace_settings(sln)\n_p('<?xml version=\"1.0\" encoding=\"UTF-8\"?>')\n_p('<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/D"
"TDs/PropertyList-1.0.dtd\">')\n_p('<plist version=\"1.0\">')\n_p('<dict>')\n_p(1, '<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>')\n_p(1, '<false/>')\n_p('</dict>')\n_p('</plist>')\nend\nfunction xcode.reorderProjects(sln)\nif sln.startproject then\nfor i, prj in ipairs(sln.projects) do\nif sln.startproject == prj.name then\nlocal cur = prj.group\nwhile cur ~= nil do\nfor j, group in ipairs(sln.groups) do\nif group == cur then\ntable.remove(sln.groups, j)\nbreak\nend\nend\ntable.insert(sln.groups, 1, cur)\ncur = cur.parent\nend\ntable.remove(sln.projects, i)\ntable.insert(sln.projects, 1, prj)\nbreak\nend\nend\nend\nend\n",
/* actions/xcode/xcode8.lua */
"local premake = premake\npremake.xcode8 = { }\nlocal xcode = premake.xcode\nlocal xcode8 = premake.xcode8\nfunction xcode8.XCBuildConfiguration_Target(tr, target, cfg)\nlocal cfgname = xcode.getconfigname(cfg)\nlocal installpaths = {\nConsoleApp = \"/usr/local/bin\",\nWindowedApp = \"$(HOME)/Applications\",\nSharedLib = \"/usr/local/lib\",\nStaticLib = \"/usr/local/lib\",\nBundle = \"$(LOCAL_LIBRARY_DIR)/Bundles\",\n}\nlocal options = {\nALWAYS_SEARCH_USER_PATHS = \"NO\",\nGCC_DYNAMIC_NO_PIC = \"NO\",\nGCC_MODEL_TUNING = \"G5\",\nINSTALL_PATH = installpaths[cfg.kind],\nPRODUCT_NAME = cfg.buildtarget.basename,\n}\nif not cfg.flags.Symbols then\noptions.DEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\"\nend\nif cfg.kind ~= \"StaticLib\" and cfg.buildtarget.prefix ~= \"\" then\noptions.EXECUTABLE_PREFIX = cfg.buildtarget.prefix\nend\nif cfg.targetextension then\nlocal ext = cfg.targetextension\noptions.EXECUTABLE_EXTENSION = iif(ext:startswith(\".\"), ext:sub(2), ext)\nend\nif cfg.flags.ObjcARC then\noptions.CLA"
"NG_ENABLE_OBJC_ARC = \"YES\"\nend\nlocal outdir = path.getdirectory(cfg.buildtarget.bundlepath)\nif outdir ~= \".\" then\noptions.CONFIGURATION_BUILD_DIR = outdir\nend\nif tr.infoplist then\noptions.INFOPLIST_FILE = tr.infoplist.cfg.name\nend\nlocal infoplist_file = nil\nfor _, v in ipairs(cfg.files) do\nif (string.find (string.lower (v), 'info.plist') ~= nil) then\ninfoplist_file = string.format('$(SRCROOT)/%s', v)\nend\nend\nif infoplist_file ~= nil then\noptions.INFOPLIST_FILE = infoplist_file\nend\nlocal action = premake.action.current()\nlocal get_opt = function(opt, def)\nreturn (opt and #opt > 0) and opt or def\nend\nlocal iosversion = get_opt(cfg.iostargetplatformversion, action.xcode.iOSTargetPlatformVersion)\nlocal macosversion = get_opt(cfg.macostargetplatformversion, action.xcode.macOSTargetPlatformVersion)\nlocal tvosversion = get_opt(cfg.tvostargetplatformversion, action.xcode.tvOSTargetPlatformVersion)\nif iosversion then\noptions.IPHONEOS_DEPLOYMENT_TARGET = iosversion\nelseif macosversion then"
"\noptions.MACOSX_DEPLOYMENT_TARGET = macosversion\nelseif tvosversion then\noptions.TVOS_DEPLOYMENT_TARGET = tvosversion\nend\nif cfg.kind == \"Bundle\" and not cfg.options.SkipBundling then\noptions.PRODUCT_BUNDLE_IDENTIFIER = \"genie.\" .. cfg.buildtarget.basename:gsub(\"%s+\", \".\") --replace spaces with .\nlocal ext = cfg.targetextension\nif ext then\noptions.WRAPPER_EXTENSION = iif(ext:startswith(\".\"), ext:sub(2), ext)\nelse\noptions.WRAPPER_EXTENSION = \"bundle\"\nend\nend\nreturn options\nend\nfunction xcode8.XCBuildConfiguration_Project(tr, prj, cfg)\nlocal cfgname = xcode.getconfigname(cfg)\nlocal archs = {\nNative = nil,\nx32 = \"i386\",\nx64 = \"x86_64\",\nUniversal32 = \"$(ARCHS_STANDARD_32_BIT)\",\nUniversal64 = \"$(ARCHS_STANDARD_64_BIT)\",\nUniversal = \"$(ARCHS_STANDARD_32_64_BIT)\",\n}\nlocal checks = {\n[\"-ffast-math\"] = cfg.flags.FloatFast,\n[\"-ffloat-store\"] = cfg.flags.FloatStrict,\n[\"-fomit-frame-pointer\"] = cfg.flags.NoFramePointer,\n}\nloc"
"al cflags = { }\nfor flag, check in pairs(checks) do\nif check then\ntable.insert(cflags, flag)\nend\nend\nlocal ldflags = { }\nfor _, lib in ipairs(premake.getlinks(cfg, \"system\")) do\nif not xcode.isframework(lib) then\ntable.insert(ldflags, \"-l\" .. lib)\nend\nend\nlocal options = {\nARCHS = archs[cfg.platform],\nCLANG_WARN__DUPLICATE_METHOD_MATCH = \"YES\",\nCLANG_WARN_BOOL_CONVERSION = \"YES\",\nCLANG_WARN_CONSTANT_CONVERSION = \"YES\",\nCLANG_WARN_EMPTY_BODY = \"YES\",\nCLANG_WARN_ENUM_CONVERSION = \"YES\",\nCLANG_WARN_INFINITE_RECURSION = \"YES\",\nCLANG_WARN_INT_CONVERSION = \"YES\",\nCLANG_WARN_SUSPICIOUS_MOVE = \"YES\",\nCLANG_WARN_UNREACHABLE_CODE = \"YES\",\nCONFIGURATION_TEMP_DIR = \"$(OBJROOT)\",\nENABLE_STRICT_OBJC_MSGSEND = \"YES\",\nENABLE_TESTABILITY = \"YES\",\nGCC_C_LANGUAGE_STANDARD = \"gnu99\",\nGCC_NO_COMMON_BLOCKS = \"YES\",\nGCC_PREP"
"ROCESSOR_DEFINITIONS = cfg.defines,\nGCC_SYMBOLS_PRIVATE_EXTERN = \"NO\",\nGCC_WARN_64_TO_32_BIT_CONVERSION = \"YES\",\nGCC_WARN_ABOUT_RETURN_TYPE = \"YES\",\nGCC_WARN_UNDECLARED_SELECTOR = \"YES\",\nGCC_WARN_UNINITIALIZED_AUTOS = \"YES\",\nGCC_WARN_UNUSED_FUNCTION = \"YES\",\nGCC_WARN_UNUSED_VARIABLE = \"YES\",\nHEADER_SEARCH_PATHS = table.join(cfg.includedirs, cfg.systemincludedirs),\nLIBRARY_SEARCH_PATHS = cfg.libdirs,\nOBJROOT = cfg.objectsdir,\nONLY_ACTIVE_ARCH = \"YES\",\nOTHER_CFLAGS = table.join(cflags, cfg.buildoptions, cfg.buildoptions_c),\nOTHER_CPLUSPLUSFLAGS = table.join(cflags, cfg.buildoptions, cfg.buildoptions_cpp),\nOTHER_LDFLAGS = table.join(ldflags, cfg.linkoptions),\nSDKROOT = xcode.toolset,\nUSER_HEADER_SEARCH_PATHS = cfg.userincludedirs,\n}\nif tr.entitlements then\nop"
"tions.CODE_SIGN_ENTITLEMENTS = tr.entitlements.cfg.name\nend\nlocal targetdir = path.getdirectory(cfg.buildtarget.bundlepath)\nif targetdir ~= \".\" then\noptions.CONFIGURATION_BUILD_DIR = \"$(SYMROOT)\"\noptions.SYMROOT = targetdir\nend\nif cfg.flags.Symbols then\noptions.COPY_PHASE_STRIP = \"NO\"\nend\nlocal excluded = xcode.cfg_excluded_files(prj, cfg)\nif #excluded > 0 then\noptions.EXCLUDED_SOURCE_FILE_NAMES = excluded\nend\nif cfg.flags.NoExceptions then\noptions.GCC_ENABLE_CPP_EXCEPTIONS = \"NO\"\nend\nif cfg.flags.NoRTTI then\noptions.GCC_ENABLE_CPP_RTTI = \"NO\"\nend\nif cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then\noptions.GCC_ENABLE_FIX_AND_CONTINUE = \"YES\"\nend\nif cfg.flags.NoExceptions then\noptions.GCC_ENABLE_OBJC_EXCEPTIONS = \"NO\"\nend\nif cfg.flags.Optimize or cfg.flags.OptimizeSize then\noptions.GCC_OPTIMIZATION_LEVEL = \"s\"\nelseif cfg.flags.OptimizeSpeed then\noptions.GCC_OPTIMIZATION_LEVEL = 3\nelse\noptions.GCC_OPTIMIZATION_LEVEL = 0\nend\nif cfg.pchheader and not cfg.f"
"lags.NoPCH then\noptions.GCC_PRECOMPILE_PREFIX_HEADER = \"YES\"\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = path.getabsolute(path.join(cfg.project.location, incdir))\nlocal testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\noptions.GCC_PREFIX_HEADER = pch\nend\nif cfg.flags.FatalWarnings then\noptions.GCC_TREAT_WARNINGS_AS_ERRORS = \"YES\"\nend\nif cfg.kind == \"Bundle\" then\noptions.MACH_O_TYPE = \"mh_bundle\"\nend\nif cfg.flags.StaticRuntime then\noptions.STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = \"static\"\nend\nif cfg.flags.PedanticWarnings or cfg.flags.ExtraWarnings then\noptions.WARNING_CFLAGS = \"-Wall\"\nend\nif cfg.flags.Cpp11 then\noptions.CLANG_CXX_LANGUAGE_STANDARD = \"c++11\"\nelseif cfg.flags.Cpp14 or cfg.flags.CppLatest then\noptions.CLANG_CXX_LANGUAGE_STANDARD = \"c++14\"\nelseif cfg.flags.Cpp17 then\nif premake.action.current() == premake.action.get(\"xcode8\") then\nerror(\"X"
"Code8 does not support C++17.\")\nend\nend\nfor _, val in ipairs(premake.xcode.parameters) do\nlocal eqpos = string.find(val, \"=\")\nif eqpos ~= nil then\nlocal key = string.trim(string.sub(val, 1, eqpos - 1))\nlocal value = string.trim(string.sub(val, eqpos + 1))\noptions[key] = value\nend\nend\nreturn options\nend\nfunction xcode8.project(prj)\nlocal tr = xcode.buildprjtree(prj)\nxcode.Header(tr, 48)\nxcode.PBXBuildFile(tr)\nxcode.PBXContainerItemProxy(tr)\nxcode.PBXFileReference(tr,prj)\nxcode.PBXFrameworksBuildPhase(tr)\nxcode.PBXGroup(tr)\nxcode.PBXNativeTarget(tr)\nxcode.PBXProject(tr, \"8.0\")\nxcode.PBXReferenceProxy(tr)\nxcode.PBXResourcesBuildPhase(tr)\nxcode.PBXShellScriptBuildPhase(tr)\nxcode.PBXCopyFilesBuildPhase(tr)\nxcode.PBXSourcesBuildPhase(tr,prj)\nxcode.PBXVariantGroup(tr)\nxcode.PBXTargetDependency(tr)\nxcode.XCBuildConfiguration(tr, prj, {\nontarget = xcode8.XCBuildConfiguration_Target,\nonproject = xcode8.XCBuildConfiguration_Project,\n})\nxcode.XCBuildConfigurationList(tr)\nxcode.Foote"
"r(tr)\nend\nnewaction\n{\ntrigger = \"xcode8\",\nshortname = \"Xcode 8\",\ndescription = \"Generate Apple Xcode 8 project files\",\nos = \"macosx\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\" },\n},\nvalid_platforms = {\nNative = \"Native\",\nx32 = \"Native 32-bit\",\nx64 = \"Native 64-bit\",\nUniversal = \"Universal\",\n},\ndefault_platform = \"Native\",\nonsolution = function(sln)\npremake.generate(sln, \"%%.xcworkspace/contents.xcworkspacedata\", xcode.workspace_generate)\npremake.generate(sln, \"%%.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings\", xcode.workspace_settings)\npremake.generate(sln, \"%%.xcworkspace/xcshareddata/xcschemes/-ALL-.xcscheme\", xcode.workspace_scheme)\nend,\nonproject = function(prj)\npremake.generate(prj, \"%%.xcodeproj/project.pbxproj\", xcode8.project)\nxcode.generate_schemes(prj, \"%%.xcodeproj/xcshareddata/"
"xcschemes\")\nend,\noncleanproject = function(prj)\npremake.clean.directory(prj, \"%%.xcodeproj\")\npremake.clean.directory(prj, \"%%.xcworkspace\")\nend,\noncheckproject = xcode.checkproject,\nxcode = {\niOSTargetPlatformVersion = nil,\nmacOSTargetPlatformVersion = nil,\ntvOSTargetPlatformVersion = nil,\n},\n}\n",
/* actions/xcode/xcode9.lua */
"local premake = premake\npremake.xcode9 = { }\nlocal xcode = premake.xcode\nlocal xcode8 = premake.xcode8\nlocal xcode9 = premake.xcode9\nfunction xcode9.XCBuildConfiguration_Project(tr, prj, cfg)\nlocal options = xcode8.XCBuildConfiguration_Project(tr, prj, cfg)\nif cfg.flags.Cpp17 or cfg.flags.CppLatest then\noptions.CLANG_CXX_LANGUAGE_STANDARD = \"c++17\"\nend\nreturn table.merge(options, {\nCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = \"YES\",\nCLANG_WARN_COMMA = \"YES\",\nCLANG_WARN_NON_LITERAL_NULL_CONVERSION = \"YES\",\nCLANG_WARN_OBJC_LITERAL_CONVERSION = \"YES\",\nCLANG_WARN_RANGE_LOOP_ANALYSIS = \"YES\",\nCLANG_WARN_STRICT_PROTOTYPES = \"YES\",\n})\nend\nfunction xcode9.project(prj)\nlocal tr = xcode.buildprjtree(prj)\nxcode.Header(tr, 48)\nxcode.PBXBuildFile(tr)\nxcode.PBXContainerItemProxy(tr)\nxcode.PBXFileReference(tr,prj)\nxcode.PBXFrameworksBuildPhase(tr)\nxcode.PBXGroup(tr)\nxcode.PBXNativeTarget(tr)\nxcode.PBXProject(tr, \"8.0\")\nxcode.PBXReferenceProxy(tr)\nxcode.PBXResourcesBuildPhase(tr)\nxc"
"ode.PBXShellScriptBuildPhase(tr)\nxcode.PBXCopyFilesBuildPhase(tr)\nxcode.PBXSourcesBuildPhase(tr,prj)\nxcode.PBXVariantGroup(tr)\nxcode.PBXTargetDependency(tr)\nxcode.XCBuildConfiguration(tr, prj, {\nontarget = xcode8.XCBuildConfiguration_Target,\nonproject = xcode9.XCBuildConfiguration_Project,\n})\nxcode.XCBuildConfigurationList(tr)\nxcode.Footer(tr)\nend\nnewaction\n{\ntrigger = \"xcode9\",\nshortname = \"Xcode 9\",\ndescription = \"Generate Apple Xcode 9 project files\",\nos = \"macosx\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\" },\n},\nvalid_platforms = {\nNative = \"Native\",\nx32 = \"Native 32-bit\",\nx64 = \"Native 64-bit\",\nUniversal = \"Universal\",\n},\ndefault_platform = \"Native\",\nonsolution = function(sln)\npremake.generate(sln, \"%%.xcworkspace/contents.xcworkspacedata\", xcode.workspace_generate)\npremake.generate(sln, \"%%.x"
"cworkspace/xcshareddata/WorkspaceSettings.xcsettings\", xcode.workspace_settings)\npremake.generate(sln, \"%%.xcworkspace/xcshareddata/xcschemes/-ALL-.xcscheme\", xcode.workspace_scheme)\nend,\nonproject = function(prj)\npremake.generate(prj, \"%%.xcodeproj/project.pbxproj\", xcode9.project)\nxcode.generate_schemes(prj, \"%%.xcodeproj/xcshareddata/xcschemes\")\nend,\noncleanproject = function(prj)\npremake.clean.directory(prj, \"%%.xcodeproj\")\npremake.clean.directory(prj, \"%%.xcworkspace\")\nend,\noncheckproject = xcode.checkproject,\nxcode = {\niOSTargetPlatformVersion = nil,\nmacOSTargetPlatformVersion = nil,\ntvOSTargetPlatformVersion = nil,\n},\n}\n",
/* actions/xcode/xcode10.lua */
"local premake = premake\npremake.xcode10 = { }\nlocal xcode = premake.xcode\nlocal xcode8 = premake.xcode8\nlocal xcode9 = premake.xcode9\nlocal xcode10 = premake.xcode10\nfunction xcode10.XCBuildConfiguration_Project(tr, prj, cfg)\nlocal options = xcode9.XCBuildConfiguration_Project(tr, prj, cfg)\nreturn table.merge(options, {\nCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = \"YES\",\nCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = \"YES\",\nCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = \"YES\",\nCLANG_WARN_COMMA = \"YES\",\nCLANG_WARN_NON_LITERAL_NULL_CONVERSION = \"YES\",\nCLANG_WARN_OBJC_LITERAL_CONVERSION = \"YES\",\nCLANG_WARN_RANGE_LOOP_ANALYSIS = \"YES\",\nCLANG_WARN_STRICT_PROTOTYPES = \"YES\",\n})\nend\nfunction xcode10.XCBuildConfiguration_Target(tr, target, cfg)\nlocal options = xcode8.XCBuildConfiguration_Target(tr, target, cfg)\nif not cfg.flags.ObjcARC then\noptions.CLANG_ENABLE_OBJC_WEAK = \"YES\"\nend\nreturn options\nend\nfunction xcode10.project(prj)\nlocal tr = xcode.buildprjtree(prj)\nxcode.Header(tr, 48)"
"\nxcode.PBXBuildFile(tr)\nxcode.PBXContainerItemProxy(tr)\nxcode.PBXFileReference(tr,prj)\nxcode.PBXFrameworksBuildPhase(tr)\nxcode.PBXGroup(tr)\nxcode.PBXNativeTarget(tr)\nxcode.PBXProject(tr, \"8.0\")\nxcode.PBXReferenceProxy(tr)\nxcode.PBXResourcesBuildPhase(tr)\nxcode.PBXShellScriptBuildPhase(tr)\nxcode.PBXCopyFilesBuildPhase(tr)\nxcode.PBXSourcesBuildPhase(tr,prj)\nxcode.PBXVariantGroup(tr)\nxcode.PBXTargetDependency(tr)\nxcode.XCBuildConfiguration(tr, prj, {\nontarget = xcode10.XCBuildConfiguration_Target,\nonproject = xcode10.XCBuildConfiguration_Project,\n})\nxcode.XCBuildConfigurationList(tr)\nxcode.Footer(tr)\nend\nnewaction\n{\ntrigger = \"xcode10\",\nshortname = \"Xcode 10\",\ndescription = \"Generate Apple Xcode 10 project files (experimental)\",\nos = \"macosx\",\nvalid_kinds = { \"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\" },\nvalid_languages = { \"C\", \"C++\" },\nvalid_tools = {\ncc = { \"gcc\" },\n},\nvalid_platforms = {"
"\nNative = \"Native\",\nx32 = \"Native 32-bit\",\nx64 = \"Native 64-bit\",\nUniversal = \"Universal\",\n},\ndefault_platform = \"Native\",\nonsolution = function(sln)\npremake.generate(sln, \"%%.xcworkspace/contents.xcworkspacedata\", xcode.workspace_generate)\npremake.generate(sln, \"%%.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings\", xcode.workspace_settings)\npremake.generate(sln, \"%%.xcworkspace/xcshareddata/xcschemes/-ALL-.xcscheme\", xcode.workspace_scheme)\nend,\nonproject = function(prj)\npremake.generate(prj, \"%%.xcodeproj/project.pbxproj\", xcode10.project)\nxcode.generate_schemes(prj, \"%%.xcodeproj/xcshareddata/xcschemes\")\nend,\noncleanproject = function(prj)\npremake.clean.directory(prj, \"%%.xcodeproj\")\npremake.clean.directory(prj, \"%%.xcworkspace\")\nend,\noncheckproject = xcode.checkproject,\nxcode = {\niOSTargetPlatformVersion = nil,\nmacOSTargetPlatformVersion = nil,\ntvOSTargetPlatformVersion = nil,\n},\n}\n",
/* actions/fastbuild/_fastbuild.lua */
"premake.fastbuild = { }\nlocal fastbuild = premake.fastbuild\nnewaction\n{\ntrigger = \"vs2015-fastbuild\",\nshortname = \"FASTBuild VS2015\",\ndescription = \"Generate FASTBuild configuration files for Visual Studio 2015.\",\nvalid_kinds = {\n\"ConsoleApp\",\n\"WindowedApp\",\n\"StaticLib\",\n\"SharedLib\",\n\"Bundle\",\n},\nvalid_languages = {\n\"C\",\n\"C++\"\n},\nvalid_tools = {\ncc = {\n\"msc\"\n},\n},\nonsolution = function(sln)\npremake.generate(sln, \"fbuild.bff\", premake.fastbuild.solution)\nend,\nonproject = function(prj)\npremake.generate(prj, \"%%.bff\", premake.fastbuild.project)\nend,\noncleansolution = function(sln)\npremake.clean.file(sln, \"fbuild.bff\")\nend,\noncleanproject = function(prj)\npremake.clean.file(prj, \"%%.bff\")\nend,\n}\n",
/* actions/fastbuild/fastbuild_project.lua */
"-- Generates a FASTBuild config file for a project.\nlocal function add_trailing_backslash(dir)\nif dir:len() > 0 and dir:sub(-1) ~= \"\\\\\" then\nreturn dir..\"\\\\\"\nend\nreturn dir\nend\nlocal function compile(indentlevel, prj, cfg, commonbasepath)\nlocal firstflag = true\nfor _, cfgexclude in ipairs(cfg.excludes) do\nif path.issourcefile(cfgexclude) then\nif firstflag then\n_p(indentlevel, '// Excluded files:')\nfirstflag = false\nend\n_p(indentlevel, \".CompilerInputFiles - '%s'\", cfgexclude)\nend\nend\nif not firstflag then\n_p('')\nend\n_p(indentlevel, \".CompilerOutputPath = '%s'\", add_trailing_backslash(cfg.objectsdir))\n_p(indentlevel, \".Defines = ''\")\nfor _, define in ipairs(cfg.defines) do\n_p(indentlevel+1, \"+ ' /D%s'\", define)\nend\nif cfg.kind == 'SharedLib' then\n_p(indentlevel+1, \"+ ' /D_WINDLL'\")\nend\n_p(indentlevel, \".IncludeDirs = ''\")\nlocal sortedincdirs = table.join(cfg.userincludedirs, cfg.includedirs, cfg.systemincludedirs)\nlocal function getpathnodecount(p)\nlocal nodef"
"inder = string.gmatch(p, \"[^\\\\/]+\")\nlocal result = 0\nlocal node = nodefinder()\nwhile node do\nresult = result + ((node ~= '.' and 1) or 0)\nnode = nodefinder()\nend\nreturn result\nend\nlocal stepsfrombase = {}\nfor _, includedir in ipairs(sortedincdirs) do\nstepsfrombase[includedir] = getpathnodecount(path.getrelative(commonbasepath, includedir))\nend\nlocal function includesort(a, b)\nif stepsfrombase[a] == stepsfrombase[b] then\nreturn a < b\nelse\nreturn stepsfrombase[a] < stepsfrombase[b]\nend\nend\ntable.sort(sortedincdirs, includesort)\nfor _, includedir in ipairs(sortedincdirs) do\n_p(indentlevel+1, \"+ ' /I\\\"%s\\\"'\", includedir)\nend\n_p(indentlevel+1, \"+ .MSVCIncludes\")\nlocal compileroptions = {\n'\"%1\"',\n'/nologo',\n'/c',\n'/Gm-',\n'/Zc:inline',\n'/errorReport:prompt',\n'/FS',\n}\nif cfg.options.ForceCPP then\ntable.insert(compileroptions, '/TP')\nend\nif cfg.flags.PedanticWarnings\nor cfg.flags.ExtraWarnings\nthen\ntable.insert(compileroptions, '/W4')\nend\nif (cfg.flags.NativeWChar"
" == false or\ncfg.flags.NoNativeWChar) then\ntable.insert(compileroptions, '/Zc:wchar_t-')\nend\nif (cfg.flags.EnableMinimalRebuild or\ncfg.flags.NoMultiProcessorCompilation) then\nend\nif cfg.flags.FloatFast then\ntable.insert(compileroptions, '/fp:fast')\nelseif cfg.flags.FloatStrict then\ntable.insert(compileroptions, '/fp:strict')\nelse\ntable.insert(compileroptions, '/fp:precise')\nend\nif cfg.flags.FastCall then\ntable.insert(compileroptions, '/Gr')\nelseif cfg.flags.StdCall then\ntable.insert(compileroptions, '/Gd')\nend\nif cfg.flags.UnsignedChar then\ntable.insert(compileroptions, '/J')\nend\nif premake.config.isdebugbuild(cfg) then\nif cfg.flags.StaticRuntime then\ntable.insert(compileroptions, '/MTd')\nelse\ntable.insert(compileroptions, '/MDd')\nend\nelse\nif cfg.flags.StaticRuntime then\ntable.insert(compileroptions, '/MT')\nelse\ntable.insert(compileroptions, '/MD')\nend\nend\nif cfg.flags.Symbols then\nif (cfg.flags.C7DebugInfo) then\ntable.insert(compileroptions, '/Z7')\nelse\nif premake.config"
".iseditandcontinue(cfg) then\ntable.insert(compileroptions, '/ZI')\nelse\ntable.insert(compileroptions, '/Zi')\nend\nlocal targetdir = add_trailing_backslash(cfg.buildtarget.directory)\ntable.insert(compileroptions, string.format(\"/Fd\\\"%s%s.pdb\\\"\", targetdir, cfg.buildtarget.basename))\nend\nend\nlocal isoptimised = true\nif (cfg.flags.Optimize) then\ntable.insert(compileroptions, '/Ox')\nelseif (cfg.flags.OptimizeSize) then\ntable.insert(compileroptions, '/O1')\nelseif (cfg.flags.OptimizeSpeed) then\ntable.insert(compileroptions, '/O2')\nelse\nisoptimised = false\nend\nif isoptimised then\nif cfg.flags.NoOptimizeLink and cfg.flags.NoEditAndContinue then\ntable.insert(compileroptions, '/GF-')\ntable.insert(compileroptions, '/Gy-')\nelse\ntable.insert(compileroptions, '/GF')\ntable.insert(compileroptions, '/Gy')\nend\nelse\ntable.insert(compileroptions, '/Gy')\ntable.insert(compileroptions, '/Od')\ntable.insert(compileroptions, '/RTC1')\nend\nif cfg.flags.FatalWarnings then\ntable.insert(compileroptions, "
"'/WX')\nelse\ntable.insert(compileroptions, '/WX-')\nend\nif cfg.platform == 'x32' then\nif cfg.flags.EnableSSE2 then\ntable.insert(compileroptions, '/arch:SSE2')\nelseif cfg.flags.EnableSSE then\ntable.insert(compileroptions, '/arch:SSE')\nend\nend\nif cfg.flags.NoExceptions then\nelse\nif cfg.flags.SEH then\ntable.insert(compileroptions, '/EHa')\nelse\ntable.insert(compileroptions, '/EHsc')\nend\nend\nif cfg.flags.NoRTTI then\ntable.insert(compileroptions, '/GR-')\nelse\ntable.insert(compileroptions, '/GR')\nend\nif cfg.flags.NoFramePointer then\ntable.insert(compileroptions, '/Oy-')\nelse\ntable.insert(compileroptions, '/Oy')\nend\nfor _, addloption in ipairs(cfg.buildoptions) do\ntable.insert(compileroptions, addloption)\nend\n_p(indentlevel, \".CompilerOptions = ''\")\nfor _, option in ipairs(compileroptions) do\n_p(indentlevel+1, \"+ ' %s'\", option)\nend\n_p(indentlevel+1, \"+ .IncludeDirs\")\n_p(indentlevel+1, \"+ .Defines\")\nif not cfg.flags.NoPCH and cfg.pchheader then\n_p(indentlevel, \".CompilerIn"
"putFiles - '%s'\", cfg.pchsource)\n_p(indentlevel, \".PCHInputFile = '%s'\", cfg.pchsource)\n_p(indentlevel, \".PCHOutputFile = .CompilerOutputPath + '%s.pch'\", prj.name)\n_p(indentlevel, \".CompilerOptions + ' /Fp\\\"' + .CompilerOutputPath + '%s.pch\\\"'\", prj.name)\n_p(indentlevel, \".PCHOptions = .CompilerOptions\")\n_p(indentlevel+1, \"+ ' /Yc\\\"%s\\\"'\", cfg.pchheader)\n_p(indentlevel+1, \"+ ' /Fo\\\"%%3\\\"'\")\n_p(indentlevel, \".CompilerOptions + ' /Yu\\\"%s\\\"'\", cfg.pchheader)\nend\n_p(indentlevel+1, \"+ ' /Fo\\\"%%2\\\"'\") -- make sure the previous property is .CompilerOptions\nend\nlocal function library(prj, cfg, useconfig, commonbasepath)\n_p(1, \"Library('%s-%s-%s')\", prj.name, cfg.name, cfg.platform)\n_p(1, '{')\nuseconfig(2)\ncompile(2, prj, cfg, commonbasepath)\nlocal librarianoptions = {\n'\"%1\"',\n'/OUT:\"%2\"',\n'/NOLOGO',\n}\nif cfg.platform == 'x64' then\ntable.insert(librarianoptions, '/MACHINE:X64')\nelse\ntable.insert(librarianoptions, '/MACHINE:X86')\nend\n_p(2, \".Libraria"
"nOptions = ''\")\nfor _, option in ipairs(librarianoptions) do\n_p(3, \"+ ' %s'\", option)\nend\n_p(2, \".LibrarianOutput = '%s'\", cfg.buildtarget.fullpath)\n_p(1, '}')\n_p('')\nend\nlocal function binary(prj, cfg, useconfig, bintype, commonbasepath)\n_p(1, \"ObjectList('%s_obj-%s-%s')\", prj.name, cfg.name, cfg.platform)\n_p(1, '{')\nuseconfig(2)\ncompile(2, prj, cfg, commonbasepath)\n_p(1, '}')\n_p('')\n_p(1, \"%s('%s-%s-%s')\", bintype, prj.name, cfg.name, cfg.platform)\n_p(1, '{')\nuseconfig(2)\n_p(2, '.Libraries = {')\n_p(3, \"'%s_obj-%s-%s',\", prj.name, cfg.name, cfg.platform) -- Refer to the ObjectList\nlocal sorteddeplibs = {}\nfor _, deplib in ipairs(premake.getlinks(cfg, \"dependencies\", \"basename\")) do\ntable.insert(sorteddeplibs, string.format(\"'%s-%s-%s',\", deplib, cfg.name, cfg.platform))\nend\ntable.sort(sorteddeplibs)\nfor _, deplib in ipairs(sorteddeplibs) do\n_p(3, deplib)\nend\n_p(3, '}')\n_p(2, '.LinkerLinkObjects = false')\nlocal linkeroptions = {\n'\"%1\"',\n'/OUT:\"%2\"',\n'/NOLOG"
"O',\n'/errorReport:prompt',\n}\nlocal subsystemversion = '\",5.02\"'\nif cfg.platform == 'x32' then\nsubsystemversion = '\",5.01\"'\nend\nif cfg.kind == 'ConsoleApp' then\ntable.insert(linkeroptions, '/SUBSYSTEM:CONSOLE'..subsystemversion)\nelse\ntable.insert(linkeroptions, '/SUBSYSTEM:WINDOWS'..subsystemversion)\nend\nif cfg.kind == 'SharedLib' then\ntable.insert(linkeroptions, '/DLL')\nend\nif cfg.platform == 'x64' then\ntable.insert(linkeroptions, '/MACHINE:X64')\nelse\ntable.insert(linkeroptions, '/MACHINE:X86')\nend\nfor _, libdir in ipairs(cfg.libdirs) do\ntable.insert(linkeroptions, string.format('/LIBPATH:%s', path.translate(libdir, '\\\\')))\nend\nif not cfg.flags.WinMain and (cfg.kind == 'ConsoleApp' or cfg.kind == 'WindowedApp') then\nif cfg.flags.Unicode then\ntable.insert(linkeroptions, '/ENTRY:wmainCRTStartup')\nelse\ntable.insert(linkeroptions, '/ENTRY:mainCRTStartup')\nend\nend\nlocal deffile = premake.findfile(cfg, \".def\")\nif deffile then\ntable.insert(linkeroptions, '/DEF:%s', deffile)\nen"
"d\nif (cfg.flags.Symbols ~= nil) then\ntable.insert(linkeroptions, '/DEBUG')\nend\nif premake.config.islinkeroptimizedbuild(cfg.flags) then\ntable.insert(linkeroptions, '/OPT:REF')\ntable.insert(linkeroptions, '/OPT:ICF')\nend\ntable.insert(linkeroptions, '/INCREMENTAL'..((premake.config.isincrementallink(cfg) and '') or ':NO'))\nfor _, addloption in ipairs(cfg.linkoptions) do\ntable.insert(linkeroptions, addloption)\nend\nlocal linklibs = premake.getlinks(cfg, \"all\", \"fullpath\")\nfor _, linklib in ipairs(linklibs) do\ntable.insert(linkeroptions, path.getname(linklib))\nend\ntable.sort(linkeroptions)\n_p(2, \".LinkerOptions = ''\")\nfor _, option in ipairs(linkeroptions) do\n_p(3, \"+ ' %s'\", option)\nend\n_p(3, \"+ .MSVCLibPaths\")\n_p(2, \".LinkerOutput = '%s'\", cfg.buildtarget.fullpath)\n_p(1, '}')\n_p('')\nend\nlocal function executable(prj, cfg, useconfig, commonbasepath)\nbinary(prj, cfg, useconfig, 'Executable', commonbasepath)\nend\nlocal function dll(prj, cfg, useconfig, commonbasepath)\nbinary("
"prj, cfg, useconfig, 'DLL', commonbasepath)\nend\nlocal function alias(prj, cfg, target)\n_p(1, \"Alias('%s-%s-%s')\", prj.name, cfg.name, cfg.platform)\n_p(1, '{')\n_p(2, \".Targets = '%s'\", target)\n_p(1, '}')\n_p('')\nend\nfunction premake.fastbuild.project(prj)\nio.indent = ' '\n_p('// FASTBuild project configuration file autogenerated by GENie.')\n_p('')\n_p('{')\nlocal cppfiles = {}\nfor file in premake.project.eachfile(prj) do\nif path.issourcefile(file.name) then\ntable.insert(cppfiles, file.name)\nend\nend\nlocal commonbasepath = cppfiles[1]\nfor _, file in ipairs(cppfiles) do\ncommonbasepath = path.getcommonbasedir(commonbasepath..'/', file)\nend\n_p(1, \".CompilerInputFilesRoot = '%s/'\", commonbasepath)\n_p(1, '.CompilerInputFiles = {')\nfor _, file in ipairs(cppfiles) do\n_p(2, \"'%s',\", file)\nend\n_p(1, '}')\n_p('')\nlocal targetkindmap = {\nConsoleApp = executable,\nWindowedApp = executable,\nSharedLib = dll,\nStaticLib = library,\n}\nlocal useconfigmap = {\nx32 = function(indentlevel)\n_p"
"(indentlevel, 'Using(.MSVCx86Config)')\n_p('')\nend,\nx64 = function(indentlevel)\n_p(indentlevel, 'Using(.MSVCx64Config)')\n_p('')\nend,\n}\nlocal nativeplatform = (os.is64bit() and 'x64') or 'x32'\nfor _, platform in ipairs(prj.solution.platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\nif cfg.platform == 'Native' then\nalias(prj, cfg, string.format('%s-%s-%s', prj.name, cfg.name, nativeplatform))\nelse\ntargetkindmap[prj.kind](prj, cfg, useconfigmap[cfg.platform], commonbasepath)\nend\nend\nend\n_p('}')\nend\n",
/* actions/fastbuild/fastbuild_solution.lua */
"-- Generates a FASTBuild config file for a solution.\nfunction premake.fastbuild.solution(sln)\nio.indent = ' '\n_p('// FastBuild solution configuration file. Generated by GENie.')\n_p('//------------------------------------------------------------------------------------')\n_p('// %s', sln.name)\n_p('//------------------------------------------------------------------------------------')\n_p('#import VS140COMNTOOLS')\nlocal is64bit = os.is64bit()\nlocal target64 = (is64bit and ' amd64') or ' x86_amd64'\nlocal target32 = (is64bit and ' amd64_x86') or ''\nlocal getvcvarscontent = [[\n@set INCLUDE=\n@set LIB=\n@set CommandPromptType=\n@set PreferredToolArchitecture=\n@set Platform=\n@set Path=%SystemRoot%\\System32;%SystemRoot%;%SystemRoot%\\System32\\wbem\n@call \"%VS140COMNTOOLS%..\\..\\VC\\vcvarsall.bat\" %1\n@echo %INCLUDE%\n@echo %LIB%\n@echo %CommandPromptType%\n@echo %PreferredToolArchitecture%\n@echo %Platform%\n@echo %Path%\n]]\nlocal getvcvarsfilepath = os.getenv('TEMP')..'\\\\getvcvars.bat'\nlocal"
" getvcvarsfile = assert(io.open(getvcvarsfilepath, 'w'))\ngetvcvarsfile:write(getvcvarscontent)\ngetvcvarsfile:close()\nlocal vcvarsrawx86 = os.outputof(string.format('call \"%s\"%s', getvcvarsfilepath, target32))\nlocal vcvarsrawx64 = os.outputof(string.format('call \"%s\"%s', getvcvarsfilepath, target64))\nos.remove(getvcvarsfilepath)\nlocal msvcvars = {}\nmsvcvars.x32 = {}\nmsvcvars.x64 = {}\nlocal includeslibssplitter = string.gmatch(vcvarsrawx64, \"[^\\n]+\")\nmsvcvars.x64.includesraw = includeslibssplitter()\nmsvcvars.x64.libpathsraw = includeslibssplitter()\nmsvcvars.x64.commandprompttype = includeslibssplitter()\nmsvcvars.x64.preferredtoolarchitecture = includeslibssplitter()\nmsvcvars.x64.platform = includeslibssplitter()\nmsvcvars.x64.pathraw = includeslibssplitter()\nincludeslibssplitter = string.gmatch(vcvarsrawx86, \"[^\\n]+\")\nmsvcvars.x32.includesraw = includeslibssplitter()\nmsvcvars.x32.libpathsraw = includeslibssplitter()\nmsvcvars.x32.commandprompttype = includeslibssplitter()\nmsvcvars.x32"
".preferredtoolarchitecture = includeslibssplitter()\nmsvcvars.x32.platform = includeslibssplitter()\nmsvcvars.x32.pathraw = includeslibssplitter()\nlocal function printincludes(includesraw)\n_p(1, \".MSVCIncludes = ''\")\nfor i in string.gmatch(includesraw, \"[^;]+\") do\n_p(2, \"+ ' /I\\\"%s\\\"'\", i)\nend\nend\nlocal function printlibpaths(libpathsraw)\n_p(1, \".MSVCLibPaths = ''\")\nfor i in string.gmatch(libpathsraw, \"[^;]+\") do\n_p(2, \"+ ' /LIBPATH:\\\"%s\\\"'\", i)\nend\nend\nif is64bit then\n_p('.MSVCx64Config =')\n_p('[')\n_p(1, \".Compiler = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\amd64\\\\cl.exe'\")\n_p(1, \".Librarian = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\amd64\\\\lib.exe'\")\n_p(1, \".Linker = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\amd64\\\\link.exe'\")\nprintincludes(msvcvars.x64.includesraw)\nprintlibpaths(msvcvars.x64.libpathsraw)\n_p(']')\n_p('')\n_p('.MSVCx86Config =')\n_p('[')\n_p(1, \".Compiler = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\amd64_x86\\\\cl.exe'\")\n_p(1, \"."
"Librarian = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\amd64_x86\\\\lib.exe'\")\n_p(1, \".Linker = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\amd64_x86\\\\link.exe'\")\nprintincludes(msvcvars.x32.includesraw)\nprintlibpaths(msvcvars.x32.libpathsraw)\n_p(']')\n_p('')\nelse\n_p('.MSVCx64Config =')\n_p('[')\n_p(1, \".Compiler = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\x86_amd64\\\\cl.exe'\")\n_p(1, \".Librarian = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\x86_amd64\\\\lib.exe'\")\n_p(1, \".Linker = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\x86_amd64\\\\link.exe'\")\nprintincludes(msvcvars.x64.includesraw)\nprintlibpaths(msvcvars.x64.libpathsraw)\n_p(']')\n_p('')\n_p('.MSVCx86Config =')\n_p('[')\n_p(1, \".Compiler = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\cl.exe'\")\n_p(1, \".Librarian = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\lib.exe'\")\n_p(1, \".Linker = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin\\\\link.exe'\")\nprintincludes(msvcvars.x32.includesraw)\nprintlibpaths(msvcvars.x32.libpathsraw)\n_p(']')"
"\n_p('')\nend\nlocal msvcbin = '$VS140COMNTOOLS$..\\\\..\\\\VC\\\\bin' .. ((is64bit and '\\\\amd64') or '')\n_p('#import Path')\n_p('#import TMP')\n_p('#import SystemRoot')\n_p('')\n_p('Settings')\n_p('{')\n_p(1, '.Environment = {')\n_p(2, \"'Path=%s;$Path$',\", msvcbin)\n_p(2, \"'TMP=$TMP$',\")\n_p(2, \"'SystemRoot=$SystemRoot$',\")\n_p(2, '}')\n_p('}')\n_p('')\nlocal function projkindsort(a, b)\nlocal projvaluemap = {\nConsoleApp = 3,\nWindowedApp = 3,\nSharedLib = 2,\nStaticLib = 1,\n}\nif projvaluemap[a.kind] == projvaluemap[b.kind] then\nreturn a.name < b.name\nelse\nreturn projvaluemap[a.kind] < projvaluemap[b.kind]\nend\nend\nlocal sortedprojs = {}\nfor prj in premake.solution.eachproject(sln) do\ntable.insert(sortedprojs, prj)\nend\ntable.sort(sortedprojs, projkindsort)\nfor _, prj in ipairs(sortedprojs) do\nlocal fname = premake.project.getbasename(prj.name, '%%.bff')\nfname = path.join(prj.location, fname)\nfname = path.getrelative(sln.location, fname)\n_p('#include \"%s\"', fname)\nend\n_p('')"
"\n_p('.ProjectVariants = {')\nfor _, plat in ipairs(sln.platforms) do\nfor _, cfg in ipairs(sln.configurations) do\n_p(1, \"'%s-%s',\", cfg, plat)\nend\nend\n_p('}')\n_p('')\n_p('ForEach(.Variant in .ProjectVariants)')\n_p('{')\n_p(1, \"Alias('all-$Variant$')\")\n_p(1, '{')\n_p(2, '.Targets = {')\nfor _, prj in ipairs(sortedprojs) do\n_p(3, \"'%s-$Variant$',\", prj.name)\nend\n_p(2, '}')\n_p(1, '}')\n_p('}')\nend\n",
/* actions/ninja/_ninja.lua */
"premake.ninja = { }\nlocal p = premake\nnewaction\n{\ntrigger = \"ninja\",\nshortname = \"ninja\",\ndescription = \"Generate Ninja build files\",\nmodule = \"ninja\",\nvalid_kinds = {\"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\"},\nvalid_languages = {\"C\", \"C++\", \"Swift\"},\nvalid_tools = {\ncc = { \"gcc\" },\nswift = { \"swift\" },\n},\nonsolution = function(sln)\nio.eol = \"\\r\\n\"\nio.indent = \"\\t\"\nio.escaper(p.ninja.esc)\np.generate(sln, \"Makefile\", p.ninja.generate_solution)\nio.indent = \" \"\np.ninja.generate_ninja_builds(sln)\nend,\nonproject = function(prj)\nio.eol = \"\\r\\n\"\nio.indent = \" \"\nio.escaper(p.ninja.esc)\np.ninja.generate_project(prj)\nend,\noncleansolution = function(sln)\nfor _,name in ipairs(sln.configurations) do\npremake.clean.file(sln, p.ninja.get_solution_name(sln, name))\nend\nend,\noncleanproject = function(prj)\nend,\noncleantarget = function(prj)\nend,\n}\n",
/* actions/ninja/ninja_base.lua */
"local ninja = premake.ninja\nfunction ninja.esc(value)\nvalue = value:gsub(\"%$\", \"$$\") -- TODO maybe there is better way\nvalue = value:gsub(\":\", \"$:\")\nvalue = value:gsub(\"\\n\", \"$\\n\")\nvalue = value:gsub(\" \", \"$ \")\nreturn value\nend\nfunction ninja.shesc(value)\nif type(value) == \"table\" then\nlocal result = {}\nlocal n = #value\nfor i = 1, n do\ntable.insert(result, ninja.shesc(value[i]))\nend\nreturn result\nend\nif value:find(\" \") then\nreturn \"\\\"\" .. value .. \"\\\"\"\nend\nreturn value\nend\nfunction ninja.list(value)\nif #value > 0 then\nreturn \" \" .. table.concat(value, \" \")\nelse\nreturn \"\"\nend\nend\nfunction ninja.arglist(arg, value)\nif #value > 0 then\nlocal args = {}\nfor _, val in ipairs(value) do\ntable.insert(args, string.format(\"%s %s\", arg, val))\nend\nreturn table.concat(args, \" \")\nelse\nreturn \"\"\nend\nend\nfunction ninja.generate_project(prj)\nif prj.language == \"Swift\" then\nninja.generate_swift(prj)\nelse\nninja.generate_cpp(prj)\nend\nend\nloca"
"l function innerget(self, key)\nreturn rawget(getmetatable(self), key) or self.__inner[key]\nend\nlocal prj_proxy = { __index = innerget }\nlocal cfg_proxy = { __index = innerget }\nfunction new_prj_proxy(prj)\nprj = prj.project or prj\nlocal v = { __inner = prj }\nlocal __configs = {}\nfor key, cfg in pairs(prj.__configs) do\nif key ~= \"\" then\n__configs[key] = ninja.get_proxy(\"cfg\", cfg)\nelse\n__configs[key] = cfg\nend\nend\nv.__configs = __configs\nreturn setmetatable(v, prj_proxy)\nend\nlocal function rebasekeys(t, keys, old, new)\nfor _,key in ipairs(keys) do\nt[key] = path.rebase(t[key], old, new)\nend\nreturn t\nend\nlocal function rebasearray(t, old, new)\nlocal res = { }\nfor _,f in ipairs(t) do\ntable.insert(res, path.rebase(f, old, new))\nend\nreturn res\nend\nfunction new_cfg_proxy(cfg)\nlocal keys = { \"directory\", \"fullpath\", \"bundlepath\" }\nlocal old = cfg.location\nlocal new = path.join(cfg.location, cfg.shortname)\nlocal v = {\n__inner = cfg,\nlocation = new,\nobjectsdir = pa"
"th.rebase(cfg.objectsdir, old, new),\nbuildtarget = rebasekeys(table.deepcopy(cfg.buildtarget), keys, old, new),\nlinktarget = rebasekeys(table.deepcopy(cfg.linktarget), keys, old, new),\n}\nv.files = rebasearray(cfg.files, old, new)\nv.includedirs = rebasearray(cfg.includedirs, old, new)\nv.libdirs = rebasearray(cfg.libdirs, old, new)\nv.userincludedirs = rebasearray(cfg.userincludedirs, old, new)\nv.systemincludedirs = rebasearray(cfg.systemincludedirs, old, new)\nv.swiftmodulemaps = rebasearray(cfg.swiftmodulemaps, old, new)\nreturn setmetatable(v, cfg_proxy)\nend\nfunction cfg_proxy:getprojectfilename(fullpath)\nlocal name = self.project.name .. \".ninja\"\nif fullpath ~= nil then\nreturn path.join(self.location, name)\nend\nreturn name\nend\nfunction cfg_proxy:getoutputfilename()\nreturn path.join(self.buildtarget.directory, self.buildtarget.name)\nend\nlocal proxy_cache = { \nprj = { new = new_prj_proxy }, \ncfg = { new = new_cfg_proxy },\n}\nfunction get_proxy(cache, obj)\ni"
"f not cache[obj] then\ncache[obj] = cache.new(obj)\nend\nreturn cache[obj]\nend\nfunction ninja.get_proxy(typ, obj)\nif not proxy_cache[typ] then\nerror(\"invalid proxy type\")\nend\nreturn get_proxy(proxy_cache[typ], obj)\nend\n",
/* actions/ninja/ninja_solution.lua */
"local ninja = premake.ninja\nlocal p = premake\nlocal solution = p.solution\nfunction ninja.generate_solution(sln)\nlocal cc = premake[_OPTIONS.cc]\nlocal platforms = premake.filterplatforms(sln, cc.platforms, \"Native\")\n_p('# %s solution makefile autogenerated by GENie', premake.action.current().shortname)\n_p('# Type \"make help\" for usage help')\n_p('')\n_p('NINJA=ninja')\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(sln.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\nlocal projects = table.extract(sln.projects, \"name\")\ntable.sort(projects)\n_p('')\n_p('.PHONY: all clean help $(PROJECTS)')\n_p('')\n_p('all:')\nif (not sln.messageskip) or (not table.contains(sln.messageskip, \"SkipBuildingMessage\")) then\n_p(1, '@echo \"==== Building all ($(config)) ====\"')\nend\n_p(1, '@${NINJA} -C ${config} all')\n_p('')\nfor _, prj in ipairs(sln.projects) do\nlocal prjx = ninja.get_proxy(\"prj\", prj)\n_p('%s:', _MAKE.esc(prj.name))\nif (not sln.messageskip) or (not table.c"
"ontains(sln.messageskip, \"SkipBuildingMessage\")) then\n_p(1, '@echo \"==== Building %s ($(config)) ====\"', prj.name)\nend\n_p(1, '@${NINJA} -C ${config} %s', prj.name)\n_p('')\nend\n_p('clean:')\n_p(1, '@${NINJA} -C ${config} -t clean')\n_p('')\n_p('help:')\n_p(1,'@echo \"Usage: make [config=name] [target]\"')\n_p(1,'@echo \"\"')\n_p(1,'@echo \"CONFIGURATIONS:\"')\nlocal cfgpairs = { }\nfor _, platform in ipairs(platforms) do\nfor _, cfgname in ipairs(sln.configurations) do\n_p(1,'@echo \" %s\"', premake.getconfigname(cfgname, platform, true))\nend\nend\n_p(1,'@echo \"\"')\n_p(1,'@echo \"TARGETS:\"')\n_p(1,'@echo \" all (default)\"')\n_p(1,'@echo \" clean\"')\nfor _, prj in ipairs(sln.projects) do\n_p(1,'@echo \" %s\"', prj.name)\nend\n_p(1,'@echo \"\"')\n_p(1,'@echo \"For more information, see https://github.com/bkaradzic/genie\"')\nend\nlocal generate\nlocal function getconfigs(sln, name, plat)\nlocal cfgs = {}\nfor prj in solution.eachproject(sln) do\nprj = ninja.get_proxy(\"prj\", prj)\nfor cfg "
"in p.eachconfig(prj, plat) do\nif cfg.name == name then\ntable.insert(cfgs, cfg)\nend\nend\nend\nreturn cfgs\nend\nfunction ninja.generate_ninja_builds(sln)\nlocal cc = premake[_OPTIONS.cc]\nsln.getlocation = function(cfg, plat)\nreturn path.join(sln.location, premake.getconfigname(cfg, plat, true))\nend\nlocal platforms = premake.filterplatforms(sln, cc.platforms, \"Native\")\nfor _,plat in ipairs(platforms) do\nfor _,name in ipairs(sln.configurations) do\np.generate(sln, ninja.get_solution_name(sln, name, plat), function(sln)\ngenerate(getconfigs(sln, name, plat))\nend)\nend\nend\nend\nfunction ninja.get_solution_name(sln, cfg, plat)\nreturn path.join(sln.getlocation(cfg, plat), \"build.ninja\")\nend\nfunction generate(prjcfgs)\nlocal cfgs = {}\nlocal cfg_first = nil\nlocal cfg_first_lib = nil\n_p(\"# solution build file\")\n_p(\"# generated with GENie ninja\")\n_p(\"\")\n_p(\"# build projects\")\nfor _,cfg in ipairs(prjcfgs) do\nlocal key = cfg.project.name\nif not cfgs[key] then cfgs[key] = "
"\"\" end\ncfgs[key] = cfg:getoutputfilename() .. \" \"\nif not cfgs[\"all\"] then cfgs[\"all\"] = \"\" end\ncfgs[\"all\"] = cfgs[\"all\"] .. cfg:getoutputfilename() .. \" \"\nif (cfg_first == nil) and (cfg.kind == \"ConsoleApp\" or cfg.kind == \"WindowedApp\") then\ncfg_first = key\nend\nif (cfg_first_lib == nil) and (cfg.kind == \"StaticLib\" or cfg.kind == \"SharedLib\") then\ncfg_first_lib = key\nend\n_p(\"subninja \" .. cfg:getprojectfilename())\nend\n_p(\"\")\n_p(\"# targets\")\nfor cfg, outputs in iter.sortByKeys(cfgs) do\n_p(\"build \" .. cfg .. \": phony \" .. outputs)\nend\n_p(\"\")\n_p(\"# default target\")\n_p(\"default \" .. (cfg_first or cfg_first_lib))\n_p(\"\")\nend\n",
/* actions/ninja/ninja_cpp.lua */
"premake.ninja.cpp = { }\nlocal ninja = premake.ninja\nlocal cpp = premake.ninja.cpp\nlocal p = premake\nlocal function wrap_ninja_cmd(c)\nif os.is(\"windows\") then\nreturn 'cmd /c \"' .. c .. '\"'\nelse\nreturn c\nend\nend\nfunction ninja.generate_cpp(prj)\nlocal pxy = ninja.get_proxy(\"prj\", prj)\nlocal tool = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, tool.platforms, \"Native\")\nfor _, platform in ipairs(platforms) do\nfor cfg in p.eachconfig(pxy, platform) do\np.generate(cfg, cfg:getprojectfilename(), function() cpp.generate_config(prj, cfg) end)\nend\nend\nend\nfunction cpp.generate_config(prj, cfg)\nlocal tool = premake.gettool(prj)\n_p('# Ninja build project file autogenerated by GENie')\n_p('# https://github.com/bkaradzic/GENie')\n_p(\"\")\n_p(\"ninja_required_version = 1.7\")\n_p(\"\")\nlocal flags = {\ndefines = ninja.list(tool.getdefines(cfg.defines)),\nincludes = ninja.list(table.join(tool.getincludedirs(cfg.includedirs), tool.getquoteincludedirs(cfg.us"
"erincludedirs), tool.getsystemincludedirs(cfg.systemincludedirs))),\ncppflags = ninja.list(tool.getcppflags(cfg)),\nasmflags = ninja.list(table.join(tool.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_asm)),\ncflags = ninja.list(table.join(tool.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c)),\ncxxflags = ninja.list(table.join(tool.getcflags(cfg), tool.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp)),\nobjcflags = ninja.list(table.join(tool.getcflags(cfg), tool.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_objc)),\n}\n_p(\"\")\n_p(\"# core rules for \" .. cfg.name)\n_p(\"rule cc\")\n_p(\" command = \" .. wrap_ninja_cmd(tool.cc .. \" $defines $includes $flags -MMD -MF $out.d -c -o $out $in\"))\n_p(\" description = cc $out\")\n_p(\" depfile = $out.d\")\n_p(\" deps = gcc\")\n_p(\"\")\n_p(\"rule cxx\")\n_p(\" command = \" .. wrap_ninja_cmd(tool.cxx .. \" $defines $includes $flags -MMD -MF $out.d -c -o $out $in\"))\n_p(\" description = cxx $out\")\n_p(\" de"
"pfile = $out.d\")\n_p(\" deps = gcc\")\n_p(\"\")\n_p(\"rule ar\")\n_p(\" command = \" .. wrap_ninja_cmd(tool.ar .. \" $flags $out @$out.rsp \" .. (os.is(\"MacOSX\") and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d'\" or \"\")))\n_p(\" description = ar $out\")\n_p(\" rspfile = $out.rsp\")\n_p(\" rspfile_content = $in $libs\")\n_p(\"\")\nlocal link = iif(cfg.language == \"C\", tool.cc, tool.cxx)\n_p(\"rule link\")\nlocal startgroup = ''\nlocal endgroup = ''\nif (cfg.flags.LinkSupportCircularDependencies) then\nstartgroup = '-Wl,--start-group'\nendgroup = '-Wl,--end-group'\nend\n_p(\" command = \" .. wrap_ninja_cmd(\"$pre_link \" .. link .. \" -o $out @$out.rsp $all_ldflags $post_build\"))\n_p(\" description = link $out\")\n_p(\" rspfile = $out.rsp\")\n _p(\" rspfile_content = $all_outputfiles \" .. string.format(\"%s $libs %s\", startgroup, endgroup))\n_p(\"\")\n_p(\"rule exec\")\n_p(\" command = \" .. wrap_ninja_cmd(\"$command\"))\n_p(\""
" description = Run $type commands\")\n_p(\"\")\nif #cfg.prebuildcommands > 0 then\n_p(\"build __prebuildcommands_\" .. premake.esc(prj.name) .. \": exec\")\n_p(1, \"command = \" .. wrap_ninja_cmd(\"echo Running pre-build commands && \" .. table.implode(cfg.prebuildcommands, \"\", \"\", \" && \")))\n_p(1, \"type = pre-build\")\n_p(\"\")\nend\ncfg.pchheader_full = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = path.getabsolute(path.join(cfg.project.location, cfg.shortname, incdir))\nlocal testname = path.join(abspath, cfg.pchheader_full)\nif os.isfile(testname) then\ncfg.pchheader_full = path.getrelative(cfg.location, testname)\nbreak\nend\nend\ncpp.custombuildtask(prj, cfg)\ncpp.dependencyRules(prj, cfg)\ncpp.file_rules(prj, cfg, flags)\nlocal objfiles = {}\nfor _, file in ipairs(cfg.files) do\nif path.issourcefile(file) then\ntable.insert(objfiles, cpp.objectname(cfg, file))\nend\nend\n_p('')\ncpp.linker(prj, cfg, objfiles, tool, flags)\n_p(\"\")\nend\nfunction cpp.custombuildt"
"ask(prj, cfg)\nlocal cmd_index = 1\nlocal seen_commands = {}\nlocal command_by_name = {}\nlocal command_files = {}\nlocal prebuildsuffix = #cfg.prebuildcommands > 0 and \"||__prebuildcommands_\" .. premake.esc(prj.name) or \"\"\nfor _, custombuildtask in ipairs(prj.custombuildtask or {}) do\nfor _, buildtask in ipairs(custombuildtask or {}) do\nfor _, cmd in ipairs(buildtask[4] or {}) do\nlocal num = 1\nfor _, depdata in ipairs(buildtask[3] or {}) do\ncmd = string.gsub(cmd,\"%$%(\" .. num ..\"%)\", string.format(\"%s \", path.getrelative(cfg.location, depdata)))\nnum = num + 1\nend\ncmd = string.gsub(cmd, '%$%(<%)', '$in')\ncmd = string.gsub(cmd, '%$%(@%)', '$out')\nlocal cmd_name -- shortened command name\nif seen_commands[cmd] == nil then\nlocal _, _, name = string.find(cmd, '([.%w]+)%s')\nname = 'cmd' .. cmd_index .. '_' .. string.gsub(name, '[^%w]', '_')\nseen_commands[cmd] = {\nname = name,\nindex = cmd_index,\n}\ncmd_index = cmd_index + 1\ncmd_name = name\nelse\ncmd_name = seen_commands[cmd].name\nend\nl"
"ocal index = seen_commands[cmd].index\nif command_files[index] == nil then\ncommand_files[index] = {}\nend\nlocal cmd_set = command_files[index]\ntable.insert(cmd_set, {\nbuildtask[1],\nbuildtask[2],\nbuildtask[3],\nseen_commands[cmd].name,\n})\ncommand_files[index] = cmd_set\ncommand_by_name[cmd_name] = cmd\nend\nend\nend\n_p(\"# custom build rules\")\nfor command, details in pairs(seen_commands) do\n_p(\"rule \" .. details.name)\n_p(1, \"command = \" .. wrap_ninja_cmd(command))\nend\nfor cmd_index, cmdsets in ipairs(command_files) do\nfor _, cmdset in ipairs(cmdsets) do\nlocal file_in = path.getrelative(cfg.location, cmdset[1])\nlocal file_out = path.getrelative(cfg.location, cmdset[2])\nlocal deps = ''\nfor i, dep in ipairs(cmdset[3]) do\ndeps = deps .. path.getrelative(cfg.location, dep) .. ' '\nend\n_p(\"build \" .. file_out .. ': ' .. cmdset[4] .. ' ' .. file_in .. ' | ' .. deps .. prebuildsuffix)\n_p(\"\")\nend\nend\nend\nfunction cpp.dependencyRules(prj, cfg)\nlocal extra_deps = {}\nlocal order_deps = "
"{}\nlocal extra_flags = {}\nfor _, dependency in ipairs(prj.dependency or {}) do\nfor _, dep in ipairs(dependency or {}) do\nlocal objfilename = cpp.objectname(cfg, path.getrelative(prj.location, dep[1]))\nlocal dependency = path.getrelative(cfg.location, dep[2])\nif extra_deps[objfilename] == nil then\nextra_deps[objfilename] = {}\nend\ntable.insert(extra_deps[objfilename], dependency)\nend\nend\nlocal pchfilename = cfg.pchheader_full and cpp.pchname(cfg, cfg.pchheader_full) or ''\nfor _, file in ipairs(cfg.files) do\nlocal objfilename = file == cfg.pchheader and cpp.pchname(cfg, file) or cpp.objectname(cfg, file)\nif path.issourcefile(file) or file == cfg.pchheader then\nif #cfg.prebuildcommands > 0 then\nif order_deps[objfilename] == nil then\norder_deps[objfilename] = {}\nend\ntable.insert(order_deps[objfilename], '__prebuildcommands_' .. premake.esc(prj.name))\nend\nend\nif path.issourcefile(file) then\nif cfg.pchheader_full and not cfg.flags.NoPCH then\nlocal nopch = table.icontains(prj.nopch, file)\nif "
"not nopch then\nlocal suffix = path.isobjcfile(file) and '_objc' or ''\nif extra_deps[objfilename] == nil then\nextra_deps[objfilename] = {}\nend\ntable.insert(extra_deps[objfilename], pchfilename .. suffix .. \".gch\")\nif extra_flags[objfilename] == nil then\nextra_flags[objfilename] = {}\nend\ntable.insert(extra_flags[objfilename], '-include ' .. pchfilename .. suffix)\nend\nend\nend\nend\ncfg.extra_deps = extra_deps\ncfg.order_deps = order_deps\ncfg.extra_flags = extra_flags\nend\nfunction cpp.objectname(cfg, file)\nreturn path.join(cfg.objectsdir, path.trimdots(path.removeext(file)) .. \".o\")\nend\nfunction cpp.pchname(cfg, file)\nreturn path.join(cfg.objectsdir, path.trimdots(file))\nend\nfunction cpp.file_rules(prj,cfg, flags)\n_p(\"# build files\")\nfor _, file in ipairs(cfg.files) do\n_p(\"# FILE: \" .. file)\nif cfg.pchheader_full == file then\nlocal pchfilename = cpp.pchname(cfg, file)\nlocal extra_deps = #cfg.extra_deps and '| ' .. table.concat(cfg.extra_deps[pchfilename] or {}, ' ') or ''\nlocal "
"order_deps = #cfg.order_deps and '|| ' .. table.concat(cfg.order_deps[pchfilename] or {}, ' ') or ''\nlocal extra_flags = #cfg.extra_flags and ' ' .. table.concat(cfg.extra_flags[pchfilename] or {}, ' ') or ''\n_p(\"build \" .. pchfilename .. \".gch : cxx \" .. file .. extra_deps .. order_deps)\n_p(1, \"flags = \" .. flags['cxxflags'] .. extra_flags .. iif(prj.language == \"C\", \"-x c-header\", \"-x c++-header\"))\n_p(1, \"includes = \" .. flags.includes)\n_p(1, \"defines = \" .. flags.defines)\n_p(\"build \" .. pchfilename .. \"_objc.gch : cxx \" .. file .. extra_deps .. order_deps)\n_p(1, \"flags = \" .. flags['objcflags'] .. extra_flags .. iif(prj.language == \"C\", \"-x objective-c-header\", \"-x objective-c++-header\"))\n_p(1, \"includes = \" .. flags.includes)\n_p(1, \"defines = \" .. flags.defines)\nelseif path.issourcefile(file) then\nlocal objfilename = cpp.objectname(cfg, file)\nlocal extra_deps = #cfg.extra_deps and '| ' .. table.concat(cfg.extra_deps[objfilename] or {}, ' ') or ''\nlocal o"
"rder_deps = #cfg.order_deps and '|| ' .. table.concat(cfg.order_deps[objfilename] or {}, ' ') or ''\nlocal extra_flags = #cfg.extra_flags and ' ' .. table.concat(cfg.extra_flags[objfilename] or {}, ' ') or ''\nlocal cflags = \"cflags\"\nif path.isobjcfile(file) then\n_p(\"build \" .. objfilename .. \": cxx \" .. file .. extra_deps .. order_deps)\ncflags = \"objcflags\"\nelseif path.isasmfile(file) then\n_p(\"build \" .. objfilename .. \": cc \" .. file .. extra_deps .. order_deps)\ncflags = \"asmflags\"\nelseif path.iscfile(file) and not cfg.options.ForceCPP then\n_p(\"build \" .. objfilename .. \": cc \" .. file .. extra_deps .. order_deps)\nelse\n_p(\"build \" .. objfilename .. \": cxx \" .. file .. extra_deps .. order_deps)\ncflags = \"cxxflags\"\nend\n_p(1, \"flags = \" .. flags[cflags] .. extra_flags)\n_p(1, \"includes = \" .. flags.includes)\n_p(1, \"defines = \" .. flags.defines)\nelseif path.isresourcefile(file) then\nend\nend\n_p(\"\")\nend\nfunction cpp.linker(prj, cfg, objfiles, tool)\nlocal all"
"_ldflags = ninja.list(table.join(tool.getlibdirflags(cfg), tool.getldflags(cfg), cfg.linkoptions))\nlocal lddeps = ninja.list(premake.getlinks(cfg, \"siblings\", \"fullpath\"))\nlocal libs = lddeps .. \" \" .. ninja.list(tool.getlinkflags(cfg))\nlocal prebuildsuffix = #cfg.prebuildcommands > 0 and \"||__prebuildcommands\" or \"\"\nlocal function writevars()\n_p(1, \"all_ldflags = \" .. all_ldflags)\n_p(1, \"libs = \" .. libs)\n_p(1, \"all_outputfiles = \" .. table.concat(objfiles, \" \"))\nif #cfg.prelinkcommands > 0 then\n_p(1, 'pre_link = echo Running pre-link commands && ' .. table.implode(cfg.prelinkcommands, \"\", \"\", \" && \") .. \" && \")\nend\nif #cfg.postbuildcommands > 0 then\n_p(1, 'post_build = && echo Running post-build commands && ' .. table.implode(cfg.postbuildcommands, \"\", \"\", \" && \"))\nend\nend\nif cfg.kind == \"StaticLib\" then\nlocal ar_flags = ninja.list(tool.getarchiveflags(cfg, cfg, false))\n_p(\"# link static lib\")\n_p(\"build \" .. cfg:ge"
"toutputfilename() .. \": ar \" .. table.concat(objfiles, \" \") .. \" | \" .. lddeps .. prebuildsuffix)\n_p(1, \"flags = \" .. ninja.list(tool.getarchiveflags(cfg, cfg, false)))\n_p(1, \"all_outputfiles = \" .. table.concat(objfiles, \" \"))\nelseif cfg.kind == \"SharedLib\" or cfg.kind == \"Bundle\" then\nlocal output = cfg:getoutputfilename()\n_p(\"# link shared lib\")\n_p(\"build \" .. output .. \": link \" .. table.concat(objfiles, \" \") .. \" | \" .. lddeps .. prebuildsuffix)\nwritevars()\nelseif (cfg.kind == \"ConsoleApp\") or (cfg.kind == \"WindowedApp\") then\n_p(\"# link executable\")\n_p(\"build \" .. cfg:getoutputfilename() .. \": link \" .. table.concat(objfiles, \" \") .. \" | \" .. lddeps .. prebuildsuffix)\nwritevars()\nelse\np.error(\"ninja action doesn't support this kind of target \" .. cfg.kind)\nend\nend\n",
/* actions/ninja/ninja_swift.lua */
"local ninja = premake.ninja\nlocal swift = {}\nlocal p = premake\nfunction ninja.generate_swift(prj)\nlocal pxy = ninja.get_proxy(\"prj\", prj)\nlocal tool = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, tool.platforms, \"Native\")\nfor _, platform in ipairs(platforms) do\nfor cfg in p.eachconfig(pxy, platform) do\np.generate(cfg, cfg:getprojectfilename(), function() swift.generate_config(prj, cfg) end)\nend\nend\nend\nfunction swift.generate_config(prj, cfg)\nlocal tool = premake.gettool(prj)\nlocal flags = {\nswiftcflags = ninja.list(tool.getswiftcflags(cfg)),\nswiftlinkflags = ninja.list(tool.getswiftlinkflags(cfg)),\n}\n_p(\"# Swift project build file\")\n_p(\"# generated with GENie ninja\")\n_p(\"\")\n_p(\"ninja_required_version = 1.7\")\n_p(\"\")\n_p(\"out_dir = %s\", cfg.buildtarget.directory)\n_p(\"obj_dir = %s\", path.join(cfg.objectsdir, prj.name .. \".build\"))\n_p(\"target = $out_dir/%s\", cfg.buildtarget.name)\n_p(\"module_name = %s\", prj.name)\n_p(\"module_"
"maps = %s\", ninja.list(tool.getmodulemaps(cfg)))\n_p(\"swiftc_flags = %s\", flags.swiftcflags)\n_p(\"swiftlink_flags = %s\", flags.swiftlinkflags)\n_p(\"ar_flags = %s\", ninja.list(tool.getarchiveflags(cfg, cfg, false)))\n_p(\"ld_flags = %s\", ninja.list(tool.getldflags(cfg)))\nif cfg.flags.Symbols then\n_p(\"symbols = $target.dSYM\")\nsymbols_command = string.format(\"&& %s $target -o $symbols\", tool.dsymutil)\nelse\n_p(\"symbols = \")\nsymbols_command = \"\"\nend\nlocal sdk = tool.get_sdk_path(cfg)\nif sdk then\n_p(\"toolchain_path = %s\", tool.get_toolchain_path(cfg))\n_p(\"sdk_path = %s\", sdk)\n_p(\"platform_path = %s\", tool.get_sdk_platform_path(cfg))\n_p(\"sdk = -sdk $sdk_path\")\nelse\n_p(\"sdk_path =\")\n_p(\"sdk =\")\nend\n_p(\"\")\n_p(\"# core rules for %s\", cfg.name)\n_p(\"rule swiftc\")\n_p(1, \"command = %s -frontend -c $in -enable-objc-interop $sdk -I $out_dir $swiftc_flags -module-cache-path $out_dir/ModuleCache -D SWIFT_PACKAGE $module_maps -emit-module-doc-path $out_dir/$module_name.swift"
"doc -module-name $module_name -emit-module-path $out_dir/$module_name.swiftmodule -num-threads 8 $obj_files\", tool.swift)\n_p(1, \"description = compile $out\")\n_p(\"\")\n_p(\"rule swiftlink\")\n_p(1, \"command = %s $sdk -L $out_dir -o $out $swiftlink_flags $ld_flags $in %s\", tool.swiftc, symbols_command)\n_p(1, \"description = create executable\")\n_p(\"\")\n_p(\"rule ar\")\n_p(1, \"command = %s cr $ar_flags $out $in %s\", tool.ar, (os.is(\"MacOSX\") and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d'\" or \"\"))\n_p(1, \"description = ar $out\")\n_p(\"\")\nlocal objfiles = {}\nfor _, file in ipairs(cfg.files) do\nif path.isswiftfile(file) then\ntable.insert(objfiles, swift.objectname(cfg, file))\nend\nend\nswift.file_rules(cfg, objfiles)\n_p(\"\")\nswift.linker(prj, cfg, objfiles, tool)\nend\nfunction swift.objectname(cfg, file)\nreturn path.join(\"$obj_dir\", path.getname(file)..\".o\")\nend\nfunction swift.file_rules(cfg, objfiles)\n_p(\"build %s: swiftc %s\", ninja.list(objfiles), ninja.list(cfg"
".files))\n_p(1, \"obj_files = %s\", ninja.arglist(\"-o\", objfiles))\nend\nfunction swift.linker(prj, cfg, objfiles, tool)\nlocal lddeps = ninja.list(premake.getlinks(cfg, \"siblings\", \"fullpath\")) \nif cfg.kind == \"StaticLib\" then\n_p(\"build $target: ar %s | %s \", ninja.list(objfiles), lddeps)\nelse\nlocal lddeps = ninja.list(premake.getlinks(cfg, \"siblings\", \"fullpath\"))\n_p(\"build $target: swiftlink %s | %s\", ninja.list(objfiles), lddeps)\nend\nend\n",
/* actions/ninja/ninja_swift_incremental.lua */
"local ninja = premake.ninja\nlocal swift = { }\nlocal p = premake\nfunction ninja.generate_swift_incremental(prj)\nlocal pxy = ninja.get_proxy(\"prj\", prj)\nlocal tool = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, tool.platforms, \"Native\")\nfor _, platform in ipairs(platforms) do\nfor cfg in p.eachconfig(pxy, platform) do\np.generate(cfg, cfg:getprojectfilename(), function() swift.generate_config(prj, cfg) end)\nend\nend\nend\nfunction swift.generate_config(prj, cfg)\nlocal tool = premake.gettool(prj)\nlocal flags = {\nswiftcflags = ninja.list(table.join(tool.getswiftcflags(cfg), cfg.buildoptions_swiftc)),\n}\n_p(\"# Swift project build file\")\n_p(\"# generated with GENie ninja\")\n_p(\"\")\n_p(\"ninja_required_version = 1.7\")\n_p(\"\")\n_p(\"out_dir = %s\", cfg.buildtarget.directory)\n_p(\"obj_dir = %s\", path.join(cfg.objectsdir, prj.name .. \".build\"))\n_p(\"module_name = %s\", prj.name)\n_p(\"module_maps = %s\", ninja.list(tool.getmodulemaps(cfg)))\n_p(\"swiftc_f"
"lags = %s\", flags.swiftcflags)\n_p(\"swiftlink_flags = %s\", flags.swiftlinkflags)\n_p(\"ar_flags = %s\", ninja.list(tool.getarchiveflags(cfg, cfg, false)))\nlocal sdk = tool.get_sdk_path(cfg)\nif sdk then\n_p(\"toolchain_path = %s\", tool.get_toolchain_path(cfg))\n_p(\"sdk_path = %s\", sdk)\n_p(\"platform_path = %s\", tool.get_sdk_platform_path(cfg))\n_p(\"sdk = -sdk $sdk_path\")\n_p(\"ld_baseflags = -force_load $toolchain_path/usr/lib/arc/libarclite_macosx.a -L $out_dir -F $platform_path/Developer/Library/Frameworks -syslibroot $sdk_path -lobjc -lSystem -L $toolchain_path/usr/lib/swift/macosx -rpath $toolchain_path/usr/lib/swift/macosx -macosx_version_min 10.10.0 -no_objc_category_merging\")\nelse\n_p(\"sdk_path =\")\n_p(\"sdk =\")\n_p(\"ld_baseflags =\")\nend\n_p(\"\")\n_p(\"# core rules for %s\", cfg.name)\n_p(\"rule swiftc\")\n_p(1, \"command = %s -frontend -c -primary-file $in $files $target -enable-objc-interop $sdk -I $out_dir -enable-testing -module-cache-path $out_dir/ModuleCache -D SWIFT_PACKAGE $m"
"odule_maps -emit-module-doc-path $out_doc_name swiftc_flags -module-name $module_name -emit-module-path $out_module_name -emit-dependencies-path $out.d -emit-reference-dependencies-path $obj_dir/$basename.swiftdeps -o $out\", tool.swiftc)\n_p(1, \"description = compile $out\")\n_p(\"\")\n_p(\"rule swiftm\")\n_p(1, \"command = %s -frontend -emit-module $in $parse_as_library swiftc_flags $target -enable-objc-interop $sdk -I $out_dir -F $platform_path/Developer/Library/Frameworks -enable-testing -module-cache-path $out_dir/ModuleCache -D SWIFT_PACKAGE $module_maps -emit-module-doc-path $out_dir/$module_name.swiftdoc -module-name $module_name -o $out\", tool.swift)\n_p(1, \"description = generate module\")\n_p(\"\")\n_p(\"rule swiftlink\")\n_p(1, \"command = %s $target $sdk $swiftlink_flags -L $out_dir -o $out_dir/$module_name -F $platform_path/Developer/Library/Frameworks $in\", tool.swiftc)\n_p(1, \"description = linking $target\")\n_p(\"\")\n_p(\"rule ar\")\n_p(1, \"command = %s cr $ar_flags $out $in $libs %s\""
", tool.ar, (os.is(\"MacOSX\") and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d'\" or \"\"))\n_p(1, \"description = ar $out\")\n_p(\"\")\n_p(\"rule link\")\n_p(\" command = %s $in $ld_baseflags $all_ldflags $libs -o $out\", tool.ld)\n_p(\" description = link $out\")\n_p(\"\")\nswift.file_rules(cfg, flags)\nlocal objfiles = {}\nlocal modfiles = {}\nlocal docfiles = {}\nfor _, file in ipairs(cfg.files) do\nif path.issourcefile(file) then\ntable.insert(objfiles, swift.objectname(cfg, file))\ntable.insert(modfiles, swift.modulename(cfg, file))\ntable.insert(docfiles, swift.docname(cfg, file))\nend\nend\n_p(\"\")\nswift.linker(prj, cfg, {objfiles, modfiles, docfiles}, tool, flags)\n_p(\"\")\nend\nfunction swift.objectname(cfg, file)\nreturn path.join(\"$obj_dir\", path.getname(file)..\".o\")\nend\nfunction swift.modulename(cfg, file)\nreturn path.join(\"$obj_dir\", path.getname(file)..\".o.swiftmodule\")\nend\nfunction swift.docname(cfg, file)\nreturn path.join(\"$obj_dir\", path.getname(file)..\".o.swift"
"doc\")\nend\nfunction swift.file_rules(cfg, flags)\n_p(\"# build files\")\nlocal sfiles = Set(cfg.files)\nfor _, file in ipairs(cfg.files) do\nif path.issourcefile(file) then\nif path.isswiftfile(file) then\nlocal objn = swift.objectname(cfg, file)\nlocal modn = swift.modulename(cfg, file)\nlocal docn = swift.docname(cfg, file)\n_p(\"build %s | %s %s: swiftc %s\", objn, modn, docn, file)\n_p(1, \"out_module_name = %s\", modn)\n_p(1, \"out_doc_name = %s\", docn)\n_p(1, \"files = \".. ninja.list(sfiles - {file}))\nbuild_flags = \"swiftcflags\"\nend\n_p(1, \"flags = \" .. flags[build_flags])\nelseif path.isresourcefile(file) then\nend\nend\n_p(\"\")\nend\nfunction swift.linker(prj, cfg, depfiles, tool)\nlocal all_ldflags = ninja.list(table.join(tool.getlibdirflags(cfg), tool.getldflags(cfg), cfg.linkoptions))\nlocal lddeps = ninja.list(premake.getlinks(cfg, \"siblings\", \"fullpath\")) \nlocal libs = lddeps .. \" \" .. ninja.list(tool.getlinkflags(cfg))\nlocal function writevars()\n_p(1, \"all_ldfl"
"ags = \" .. all_ldflags)\n_p(1, \"libs = \" .. libs)\nend\nlocal objfiles, modfiles, docfiles = table.unpack(depfiles)\n_p(\"build $out_dir/$module_name.swiftmodule | $out_dir/$module_name.swiftdoc: swiftm %s | %s\", table.concat(modfiles, \" \"), table.concat(docfiles, \" \"))\n_p(\"\")\nlocal output = cfg:getoutputfilename()\nif cfg.kind == \"StaticLib\" then\nlocal ar_flags = ninja.list(tool.getarchiveflags(cfg, cfg, false))\n_p(\"build %s: ar %s | %s $out_dir/$module_name.swiftmodule $out_dir/$module_name.swiftdoc\", output, table.concat(objfiles, \" \"), lddeps)\n_p(1, \"flags = %s\", ninja.list(tool.getarchiveflags(cfg, cfg, false)))\nelseif cfg.kind == \"SharedLib\" then\n_p(\"build %s : swiftlink %s | %s $out_dir/$module_name.swiftmodule $out_dir/$module_name.swiftdoc\", output, table.concat(objfiles, \" \"), libs)\nwritevars()\nelseif (cfg.kind == \"ConsoleApp\") or (cfg.kind == \"WindowedApp\") then\n_p(\"build %s: swiftlink %s | %s $out_dir/$module_name.swiftmodule $out_dir/$module_name.swift"
"doc\", output, table.concat(objfiles, \" \"), lddeps)\nelse\np.error(\"ninja action doesn't support this kind of target \" .. cfg.kind)\nend\nend\n",
/* actions/qbs/_qbs.lua */
"premake.qbs = { }\nlocal qbs = premake.qbs\nnewaction\n{\ntrigger = \"qbs\",\nshortname = \"qbs\",\ndescription = \"Generate QBS build files\",\nmodule = \"qbs\",\nvalid_kinds = {\"ConsoleApp\", \"WindowedApp\", \"StaticLib\", \"SharedLib\", \"Bundle\"},\nvalid_languages = {\"C\", \"C++\"},\nvalid_tools = {\ncc = { \"gcc\", \"msc\" },\n},\nonsolution = function(sln)\nio.eol = \"\\n\"\nio.indent = \"\\t\"\nio.escaper(qbs.esc)\npremake.generate(sln, sln.name .. \".creator.qbs\", qbs.generate_solution)\nio.indent = \" \"\npremake.generate(sln, sln.name .. \".creator.qbs.user\", qbs.generate_user)\nend,\nonproject = function(prj)\nio.eol = \"\\n\"\nio.indent = \"\\t\"\nio.escaper(qbs.esc)\npremake.generate(prj, prj.name .. \".qbs\", qbs.generate_project)\nend,\n}\n",
/* actions/qbs/qbs_base.lua */
"function premake.qbs.list(indent, name, table)\nif #table > 0 then\n_p(indent, '%s: [', name)\nfor _, item in ipairs(table) do\n_p(indent+1, '\"%s\",', item:gsub('\"', '\\\\\"'))\nend\n_p(indent+1, ']')\nend\nend",
/* actions/qbs/qbs_solution.lua */
"local qbs = premake.qbs\nfunction qbs.generate_solution(sln)\n_p('/*')\n_p(' * QBS project file autogenerated by GENie')\n_p(' * https://github.com/bkaradzic/GENie')\n_p(' */')\n_p('')\n_p('import qbs')\n_p('')\n_p(0, 'Project {')\n_p(1, 'references: [')\nfor prj in premake.solution.eachproject(sln) do\n_p(2, '\"' .. prj.name .. '.qbs\",')\nend\n_p(1, ']')\n_p(0, '}')\nend\nlocal function is_app(kind)\nif kind == \"ConsoleApp\" or kind == \"WindowedApp\" then\nreturn true\nend\nreturn false\nend\nfunction qbs.generate_user(sln)\n_p(0, '<?xml version=\"1.0\" encoding=\"UTF-8\"?>')\n_p(0, '<!DOCTYPE QtCreatorProject>')\n_p(0, '<!-- QBS project file autogenerated by GENie https://github.com/bkaradzic/GENie -->')\n_p(0, '<qtcreator>')\nlocal startProject = 0\nlocal idx = 0\nfor prj in premake.solution.eachproject(sln) do\nif is_app(prj.kind) then\nif sln.startproject == prj.name then\nstartProject = idx\nend\nidx = idx + 1\nend\nend\n_p(1, '<data>')\n_p(2, '<variable>ProjectExplorer.Project.Target.0</variable>')\n"
"_p(2, '<valuemap type=\"QVariantMap\">')\n_p(3, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DefaultDisplayName\">Desktop</value>')\n_p(3, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DisplayName\">Desktop</value>')\nlocal qbsguid = \"\"\nlocal qbsprofile = \"\"\nlocal qtcreatordir = \"\"\nif _OS == \"windows\" then\nqtcreatordir = path.join(os.getenv(\"APPDATA\"), \"QtProject/qtcreator\")\nelse\nqtcreatordir = path.join(os.getenv(\"HOME\"), \".config/QtProject/qtcreator\")\nend\nlocal file = io.open(path.join(qtcreatordir, \"qbs.conf\"))\nif file == nil then\nfile = io.open(path.join(qtcreatordir, \"qbs/1.6.0/qbs.conf\"))\nend\nif file ~= nil then\nfor line in file:lines() do\nif line == \"[org]\" then\nlocal str = 'qt-project\\\\qbs\\\\preferences\\\\qtcreator\\\\kit\\\\%'\nlocal index = string.len(str)+1\nfor line in file:lines() do\nif index == string.find(line, '7B', index) then\nline = string.sub(line, index+2)\nqbsguid = string.sub(line, 1, 36)\nqbspro"
"file = string.sub(line, 41)\nbreak\nend\nend\nelse\nlocal str = '\\t<key>org.qt-project.qbs.preferences.qtcreator.kit.'\nlocal index = string.len(str)+1\nfor line in file:lines() do\nif qbsguid == \"\" and index == string.find(line, '{', index) then\nline = string.sub(line, index+1)\nqbsguid = string.sub(line, 1, 36)\nelseif qbsguid ~= \"\" then\nqbsprofile = string.sub(line, 10, 29)\nbreak\nend\nend\nend\nbreak\nend\nio.close(file)\nend\n_p(3, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.Id\">{%s}</value>', qbsguid)\n_p(3, '<value type=\"int\" key=\"ProjectExplorer.Target.ActiveBuildConfiguration\">0</value>')\n_p(3, '<value type=\"int\" key=\"ProjectExplorer.Target.ActiveDeployConfiguration\">0</value>')\n_p(3, '<value type=\"int\" key=\"ProjectExplorer.Target.ActiveRunConfiguration\">%d</value>', startProject)\nidx = 0\nfor _, cfgname in ipairs(sln.configurations) do\n_p(3, '<valuemap type=\"QVariantMap\" key=\"ProjectExplorer.Target.BuildConfiguration.%d\">', idx)\n_p(4, '<value type"
"=\"QString\" key=\"ProjectExplorer.BuildConfiguration.BuildDirectory\">build</value>')\n_p(4, '<valuemap type=\"QVariantMap\" key=\"ProjectExplorer.BuildConfiguration.BuildStepList.0\">')\n_p(5, '<valuemap type=\"QVariantMap\" key=\"ProjectExplorer.BuildStepList.Step.0\">')\n_p(6, '<value type=\"bool\" key=\"ProjectExplorer.BuildStep.Enabled\">true</value>')\n_p(6, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DefaultDisplayName\"></value>')\n_p(6, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DisplayName\">Qbs Build</value>')\n_p(6, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.Id\">Qbs.BuildStep</value>')\n_p(6, '<value type=\"bool\" key=\"Qbs.CleanInstallRoot\">false</value>')\n_p(6, '<valuemap type=\"QVariantMap\" key=\"Qbs.Configuration\">')\n_p(7, '<value type=\"QString\" key=\"qbs.buildVariant\">%s</value>', cfgname:lower())\n_p(7, '<value type=\"QString\" key=\"qbs.profile\">%s</value>', qbsprofile)\n_p(6, '</valuemap>')\n_p(5, '</valuem"
"ap>')\n_p(5, '<value type=\"int\" key=\"ProjectExplorer.BuildStepList.StepsCount\">1</value>')\n_p(5, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DefaultDisplayName\">Build</value>')\n_p(5, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DisplayName\"></value>')\n_p(5, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.Id\">ProjectExplorer.BuildSteps.Build</value>')\n_p(4, '</valuemap>')\n_p(4, '<valuemap type=\"QVariantMap\" key=\"ProjectExplorer.BuildConfiguration.BuildStepList.1\">')\n_p(5, '<valuemap type=\"QVariantMap\" key=\"ProjectExplorer.BuildStepList.Step.0\">')\n_p(6, '<value type=\"bool\" key=\"ProjectExplorer.BuildStep.Enabled\">true</value>')\n_p(6, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DefaultDisplayName\"></value>')\n_p(6, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DisplayName\">Qbs Clean</value>')\n_p(6, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.Id\">Qbs"
".CleanStep</value>')\n_p(6, '<value type=\"bool\" key=\"Qbs.CleanAll\">true</value>')\n_p(6, '<value type=\"bool\" key=\"Qbs.DryKeepGoing\">false</value>')\n_p(6, '<value type=\"bool\" key=\"Qbs.DryRun\">false</value>')\n_p(5, '</valuemap>')\n_p(5, '<value type=\"int\" key=\"ProjectExplorer.BuildStepList.StepsCount\">1</value>')\n_p(5, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DefaultDisplayName\">Clean</value>')\n_p(5, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DisplayName\"></value>')\n_p(5, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.Id\">ProjectExplorer.BuildSteps.Clean</value>')\n_p(4, '</valuemap>')\n_p(4, '<value type=\"int\" key=\"ProjectExplorer.BuildConfiguration.BuildStepListCount\">2</value>')\n_p(4, '<value type=\"bool\" key=\"ProjectExplorer.BuildConfiguration.ClearSystemEnvironment\">false</value>')\n_p(4, '<valuelist type=\"QVariantList\" key=\"ProjectExplorer.BuildConfiguration.UserEnvironmentChanges\"/>')\n_p(4, '<valu"
"e type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DefaultDisplayName\">%s</value>', cfgname)\n_p(4, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DisplayName\"></value>')\n_p(4, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.Id\">Qbs.QbsBuildConfiguration</value>')\n_p(3, '</valuemap>')\nidx = idx + 1\nend\n_p(3, '<value type=\"int\" key=\"ProjectExplorer.Target.BuildConfigurationCount\">%d</value>', idx)\n_p(3, '<valuemap type=\"QVariantMap\" key=\"ProjectExplorer.Target.DeployConfiguration.0\">')\n_p(4, '<valuemap type=\"QVariantMap\" key=\"ProjectExplorer.BuildConfiguration.BuildStepList.0\">')\n_p(5, '<value type=\"int\" key=\"ProjectExplorer.BuildStepList.StepsCount\">0</value>')\n_p(5, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DefaultDisplayName\">Deploy</value>')\n_p(5, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DisplayName\"></value>')\n_p(5, '<value type=\"QString\" key=\"ProjectExplorer.ProjectCo"
"nfiguration.Id\">ProjectExplorer.BuildSteps.Deploy</value>')\n_p(4, '</valuemap>')\n_p(4, '<value type=\"int\" key=\"ProjectExplorer.BuildConfiguration.BuildStepListCount\">1</value>')\n_p(4, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DefaultDisplayName\">Deploy locally</value>')\n_p(4, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DisplayName\">Qbs Install</value>')\n_p(4, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.Id\">Qbs.Deploy</value>')\n_p(3, '</valuemap>')\n_p(3, '<value type=\"int\" key=\"ProjectExplorer.Target.DeployConfigurationCount\">1</value>')\nidx = 0\nfor prj in premake.solution.eachproject(sln) do\nif is_app(prj.kind) then\n_p(3, '<valuemap type=\"QVariantMap\" key=\"ProjectExplorer.Target.RunConfiguration.%d\">', idx)\nif idx == startProject then\n_p(4, '<value type=\"int\" key=\"PE.EnvironmentAspect.Base\">2</value>')\nelse\n_p(4, '<value type=\"int\" key=\"PE.EnvironmentAspect.Base\">-1</value>')\nend\n_p(4, '<valuelist"
" type=\"QVariantList\" key=\"PE.EnvironmentAspect.Changes\"/>')\n_p(4, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DefaultDisplayName\">%s</value>', prj.name)\n_p(4, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.DisplayName\"></value>')\n_p(4, '<value type=\"QString\" key=\"ProjectExplorer.ProjectConfiguration.Id\">Qbs.RunConfiguration:%s.%s---Qbs.RC.NameSeparator---%s</value>', prj.name, qbsprofile, prj.name)\n_p(4, '<value type=\"QString\" key=\"Qbs.RunConfiguration.CommandLineArguments\"></value>')\nlocal cfg = premake.getconfig(prj, nil, nil)\nif cfg.debugdir ~= nil then\n_p(4, '<value type=\"QString\" key=\"Qbs.RunConfiguration.WorkingDirectory\">%s</value>', cfg.debugdir)\nelse\n_p(4, '<value type=\"QString\" key=\"Qbs.RunConfiguration.WorkingDirectory\"></value>')\nend\n_p(3, '</valuemap>')\nidx = idx + 1\nend\nend\n_p(3, '<value type=\"int\" key=\"ProjectExplorer.Target.RunConfigurationCount\">%d</value>', idx)\n_p(2, '</valuemap>')\n_p(1, '</data>')\n_p(1,"
" '<data>')\n_p(2, '<variable>ProjectExplorer.Project.TargetCount</variable>')\n_p(2, '<value type=\"int\">1</value>')\n_p(1, '</data>')\n_p(1, '<data>')\n_p(2, '<variable>Version</variable>')\n_p(2, '<value type=\"int\">18</value>')\n_p(1, '</data>')\n_p(0, '</qtcreator>')\nend\n",
/* actions/qbs/qbs_cpp.lua */
"local qbs = premake.qbs\nlocal function is_excluded(prj, cfg, file)\nif table.icontains(prj.excludes, file) then\nreturn true\nend\nif table.icontains(cfg.excludes, file) then\nreturn true\nend\nreturn false\nend\nfunction qbs.generate_project(prj)\nlocal indent = 0\n_p(indent, '/*')\n_p(indent, ' * QBS project file autogenerated by GENie')\n_p(indent, ' * https://github.com/bkaradzic/GENie')\n_p(indent, ' */')\n_p(indent, '')\n_p(indent, 'import qbs 1.0')\n_p(indent, '')\nif prj.kind == \"ConsoleApp\" then\n_p(indent, 'CppApplication {')\n_p(indent + 1, 'consoleApplication: true')\nelseif prj.kind == \"WindowedApp\" then\n_p(indent, 'CppApplication {')\n_p(indent + 1, 'consoleApplication: false')\nelseif prj.kind == \"StaticLib\" then\n_p(indent, 'StaticLibrary {')\nelseif prj.kind == \"SharedLib\" then\n_p(indent, 'DynamicLibrary {')\nend\nindent = indent + 1\n_p(indent, 'name: \"' .. prj.name .. '\"')\n_p(indent, 'Depends { name: \"cpp\" }')\nlocal deps = premake.getdependencies(prj)\nif #deps > 0 then\nfor"
" _, depprj in ipairs(deps) do\n_p(indent, 'Depends { name: \"%s\" }', depprj.name)\nend\nend\nlocal cc = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\nif cfg.platform ~= \"Native\" then\n_p('');\n_p(indent, 'Properties { /* %s */', premake.getconfigname(cfg.name, cfg.platform, true))\nindent = indent + 1\nlocal arch = \"\"\nlocal linkerFlags = cfg.linkoptions\nif cfg.platform == \"x32\" then\narch = '&& qbs.architecture == \"x86\"'\nelseif cfg.platform == \"x64\" then\narch = '&& qbs.architecture == \"x86_64\"'\nend\nif cfg.name == \"Debug\" then\n_p(indent, 'condition: qbs.buildVariant == \"debug\" %s', arch)\nelse\n_p(indent, 'condition: qbs.buildVariant == \"release\" %s', arch)\nend\n_p(indent, 'targetName: \"%s\"', cfg.buildtarget.basename)\n_p(indent, 'destinationDirectory: \"%s\"', path.getabsolute('projects/qbs/' .. cfg.buildtarget.directory) .. '/')\nif c"
"fg.flags.Cpp11 then\n_p(indent, 'cpp.cxxLanguageVersion: \"c++11\"')\nelseif cfg.flags.Cpp14 then\n_p(indent, 'cpp.cxxLanguageVersion: \"c++14\"')\nelseif cfg.flags.Cpp17 then\n_p(indent, 'cpp.cxxLanguageVersion: \"c++17\"')\nelse\n_p(indent, 'cpp.cxxLanguageVersion: \"c++98\"')\nend\nif os.is(\"windows\") then\nif not cfg.flags.WinMain and (cfg.kind == 'ConsoleApp' or cfg.kind == 'WindowedApp') then\nif cfg.flags.Unicode then\n_p(indent, 'cpp.entryPoint: \"wmainCRTStartup\"')\nelse\n_p(indent, 'cpp.entryPoint: \"mainCRTStartup\"')\nend\nend\nend\nqbs.list(\n indent\n, \"cpp.commonCompilerFlags\"\n, cfg.buildoptions\n)\nqbs.list(\n indent\n, \"cpp.cFlags\"\n, cfg.buildoptions_c\n)\nqbs.list(\n indent\n, \"cpp.cxxFlags\"\n, cfg.buildoptions_cpp\n)\nqbs.list(\n indent\n, \"cpp.objcFlags\"\n, cfg.buildoptions_objc\n)\nqbs.list(\n indent\n, \"cpp.objcxxFlags\"\n, cfg.buildoptions_objc\n)\nif cfg.flags.StaticRuntime then\n_p(indent, 'cpp.runtimeLibrary: \"static\"')\nelse\n_p(indent, 'cpp.runtimeLibrary: \"dyn"
"amic\"')\nend\nif cfg.flags.PedanticWarnings\nor cfg.flags.ExtraWarnings\nthen\n_p(indent, 'cpp.warningLevel: \"all\"')\nelse\n_p(indent, 'cpp.warningLevel: \"default\"')\nend\nif cfg.flags.FatalWarnings then\n_p(indent, 'cpp.treatWarningsAsErrors: true')\nelse\n_p(indent, 'cpp.treatWarningsAsErrors: false')\nend\nif cfg.flags.NoRTTI then\n_p(indent, 'cpp.enableRtti: false')\nelse\n_p(indent, 'cpp.enableRtti: true')\nend\nif cfg.flags.NoExceptions then\n_p(indent, 'cpp.enableExceptions: false')\nelse\n_p(indent, 'cpp.enableExceptions: true')\nend\nif cfg.flags.Symbols then\n_p(indent, 'cpp.debugInformation: true')\nelse\n_p(indent, 'cpp.debugInformation: false')\nend\nif cfg.flags.Unicode then\n_p(indent, 'cpp.windowsApiCharacterSet: \"unicode\"')\nelse\n_p(indent, 'cpp.windowsApiCharacterSet: \"\"')\nend\nif not cfg.pchheader or cfg.flags.NoPCH then\n_p(indent, 'cpp.usePrecompiledHeader: false')\nelse\n_p(indent, 'cpp.usePrecompiledHeader: true')\n_p(indent, 'Group {')\n_p(indent+1, 'name: \"PCH\"')\n_p(inden"
"t+1, 'files: [\"' .. cfg.pchheader .. '\"]')\n_p(indent+1, 'fileTags: [\"cpp_pch_src\"]')\n_p(indent, '}')\nend\nfor _, value in ipairs(cfg.flags) do\nif (value == \"Optimize\") then\nelseif (value == \"OptimizeSize\") then\n_p(indent, 'cpp.optimization: \"small\"')\nelseif (value == \"OptimizeSpeed\") then\n_p(indent, 'cpp.optimization: \"fast\"')\nend\nend\nqbs.list(\n indent\n, \"cpp.defines\"\n, cfg.defines\n)\nlocal sortedincdirs = table.join(cfg.userincludedirs, cfg.includedirs, cfg.systemincludedirs)\ntable.sort(sortedincdirs, includesort)\nqbs.list(\n indent\n, \"cpp.includePaths\"\n, sortedincdirs\n)\nqbs.list(\n indent\n, \"cpp.staticLibraries\"\n, premake.getlinks(cfg, \"system\", \"fullpath\")\n)\nqbs.list(\n indent\n, \"cpp.libraryPaths\"\n, cfg.libdirs\n)\nqbs.list(\n indent\n, \"cpp.linkerFlags\"\n, linkerFlags\n)\ntable.sort(prj.files)\nif #prj.files > 0 then\n_p(indent, 'files: [')\nfor _, file in ipairs(prj.files) do\nif path.iscfile(file)\nor path.iscppfile(file)\nor path.isobjcfile(fil"
"e)\nor path.isresourcefile(file)\nor path.iscppheader(file) then\nif not is_excluded(prj, cfg, file) then\n_p(indent+1, '\"%s\",', file)\nend\nend\nend\n_p(indent+1, ']')\nend\nif #prj.excludes > 0 then\n_p(indent, 'excludeFiles: [')\ntable.sort(prj.excludes)\nfor _, file in ipairs(prj.excludes) do\nif path.issourcefile(file) then\n_p(indent+1, '\"%s\",', file)\nend\nend\n_p(indent+1, ']')\nend\nindent = indent - 1\n_p(indent, '}');\nend\nend\nend\nindent = indent - 1\n_p(indent, '}')\nend\n",
/* _premake_main.lua */
"_WORKING_DIR = os.getcwd()\nlocal function injectplatform(platform)\nif not platform then return true end\nplatform = premake.checkvalue(platform, premake.fields.platforms.allowed)\nfor sln in premake.solution.each() do\nlocal platforms = sln.platforms or { }\nif #platforms == 0 then\ntable.insert(platforms, \"Native\")\nend\nif not table.contains(platforms, \"Native\") then\nreturn false, sln.name .. \" does not target native platform\\nNative platform settings are required for the --platform feature.\"\nend\nif not table.contains(platforms, platform) then\ntable.insert(platforms, platform)\nend\nsln.platforms = platforms\nend\nreturn true\nend\nfunction _premake_main(scriptpath)\nif (scriptpath) then\nlocal scripts = dofile(scriptpath .. \"/_manifest.lua\")\nfor _,v in ipairs(scripts) do\ndofile(scriptpath .. \"/\" .. v)\nend\nend\nlocal profiler = newProfiler()\nif (nil ~= _OPTIONS[\"debug-profiler\"]) then\nprofiler:start()\nend\n_PREMAKE_COMMAND = path.getabsolute(_PREMAKE_COMMAND)\npremake.action"
".set(_ACTION)\nmath.randomseed(os.time())\nif (nil ~= _OPTIONS[\"file\"]) then\nlocal fname = _OPTIONS[\"file\"]\nif (os.isfile(fname)) then\ndofile(fname)\nelse\nerror(\"No genie script '\" .. fname .. \"' found!\", 2)\nend\nelse\nlocal dir, name = premake.findDefaultScript(path.getabsolute(\"./\"))\nif dir ~= nil then\nos.chdir(dir)\ndofile(name)\nend\nend\nif (_OPTIONS[\"version\"] or _OPTIONS[\"help\"] or not _ACTION) then\nprintf(\"GENie - Project generator tool %s\", _GENIE_VERSION_STR)\nprintf(\"https://github.com/bkaradzic/GENie\")\nif (not _OPTIONS[\"version\"]) then\npremake.showhelp()\nend\nreturn 1\nend\naction = premake.action.current()\nif (not action) then\nerror(\"Error: no such action '\" .. _ACTION .. \"'\", 0)\nend\nok, err = premake.option.validate(_OPTIONS)\nif (not ok) then error(\"Error: \" .. err, 0) end\nok, err = premake.checktools()\nif (not ok) then error(\"Error: \" .. err, 0) end\nok, err = injectplatform(_OPTIONS[\"platform\"])\nif (not ok) then error(\"Error: \" .. err, 0) end\n"
"print(\"Building configurations...\")\npremake.bake.buildconfigs()\nok, err = premake.checkprojects()\nif (not ok) then error(\"Error: \" .. err, 0) end\npremake.stats = { }\npremake.stats.num_generated = 0\npremake.stats.num_skipped = 0\nprintf(\"Running action '%s'...\", action.trigger)\npremake.action.call(action.trigger)\nif (nil ~= _OPTIONS[\"debug-profiler\"]) then\nprofiler:stop()\nlocal filePath = path.getabsolute(\"GENie-profile.txt\")\nprint(\"Writing debug-profile report to ''\" .. filePath .. \"'.\")\nlocal outfile = io.open(filePath, \"w+\")\nprofiler:report(outfile, true)\noutfile:close()\nend\nprintf(\"Done. Generated %d/%d projects.\"\n, premake.stats.num_generated\n, premake.stats.num_generated+premake.stats.num_skipped\n)\nreturn 0\nend\n",
0
};
|
the_stack_data/170452782.c | #include <stdlib.h>
#include <errno.h>
void *__reallocarray(void *ptr, size_t nmemb, size_t size) {
size_t bytes;
if (__builtin_umull_overflow(nmemb, size, &bytes)) {
errno = ENOMEM;
return NULL;
}
return realloc(ptr, bytes);
}
void *reallocarray(void *ptr, size_t nmemb, size_t size)
__attribute__((__weak__, __alias__("__reallocarray")));
|
the_stack_data/51067.c | #include <stdio.h>
#include <stdlib.h>
#define L 10
typedef int ElementType;
void Merge(ElementType A[],ElementType TmpArray[],int Lpos,int Rpos,int RightEnd)
{
int i,LeftEnd,NumElements,TmpPos;
LeftEnd=Rpos-1;
TmpPos=Lpos;
NumElements=RightEnd-Lpos+1;
while(Lpos<=LeftEnd&&Rpos<RightEnd)
if(A[Lpos]<=A[Rpos])
TmpArray[TmpPos++]=A[Lpos++];
else
TmpArray[TmpPos++]=A[Rpos++];
while(Lpos<=LeftEnd)
TmpArray[TmpPos++]=A[Lpos++];
while(Rpos<=RightEnd)
TmpArray[TmpPos++]=A[Rpos++];
for(i=0;i<NumElements;i++,RightEnd--)
A[RightEnd]=TmpArray[RightEnd];
}
void MSort(ElementType A[], ElementType TmpArray[],int Left,int Right)
{
int Center;
if(Left<Right)
{
Center=(Left+Right)/2;
MSort(A,TmpArray,Left,Center);
MSort(A,TmpArray,Center+1,Right);
Merge(A,TmpArray,Left,Center+1,Right);
}
}
void MergeSort(ElementType A[],int N)
{
ElementType *TmpArray;
TmpArray=malloc(N*sizeof(ElementType));
if(TmpArray!=NULL)
{
MSort(A,TmpArray,0,N-1);
free(TmpArray);
}
else
{
printf("Fatal error in alloc memory!\n");
exit(1);
}
}
int main()
{
int i;
ElementType arr[L]={23,45,12,90,18,675,64,543,89,94};
MergeSort(arr,L);
printf("after sort ,the result following:\n");
for(i=0; i<L; i++)
printf("%d ",arr[i]);
printf("\n");
return 0;
}
|
the_stack_data/9160.c | char defalt[];
m_getfolder()
{
register char *folder;
m_getdefs();
if((folder = m_find("folder")) == -1 || *folder == 0)
folder = defalt;
return(folder);
}
|
the_stack_data/175143068.c | // Test stopset overflow in strcspn function
// RUN: %clang_asan %s -o %t && env ASAN_OPTIONS=$ASAN_OPTIONS:strict_string_checks=true not %run %t 2>&1 | FileCheck %s
// Test intercept_strcspn asan option
// RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:intercept_strspn=false %run %t 2>&1
#include <assert.h>
#include <string.h>
int main(int argc, char **argv) {
size_t r;
char s1[] = "ab";
char s2[] = {'a'};
char s3 = 0;
r = strcspn(s1, s2);
// CHECK:'s{{[2|3]}}' <== Memory access at offset {{[0-9]+ .*}}flows this variable
assert(r == 0);
return 0;
}
|
the_stack_data/153268961.c | /*
* $Xorg: WA32.c,v 1.4 2001/02/09 02:03:48 xorgcvs Exp $
*
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
* *
* Author: Keith Packard, MIT X Consortium
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <X11/Xos.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xdmcp.h>
int
XdmcpWriteARRAY32 (buffer, array)
XdmcpBufferPtr buffer;
ARRAY32Ptr array;
{
int i;
if (!XdmcpWriteCARD8 (buffer, array->length))
return FALSE;
for (i = 0; i < (int)array->length; i++)
if (!XdmcpWriteCARD32 (buffer, array->data[i]))
return FALSE;
return TRUE;
}
|
the_stack_data/20450717.c | /* Example code for Exercises in C.
Copyright 2016 Allen B. Downey
License: MIT License https://opensource.org/licenses/MIT
*/
/*2. It appears as though each child process received a copy of the global, stack,
and heap segments. When a child process is initialized, the values of the variables
created in the parent process are the same in the child process and the parent process.
However, when the child MODIFIES any of these variables (in the stack, heap, or global
segments), these changes are not communicated to the parent process. Additionally, each
child process cannot see changes that another child process makes to the variables in the
stack, global, or heap segments.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <wait.h>
// errno is an external global variable that contains
// error information
extern int errno;
int testGlob = 1;
// get_seconds returns the number of seconds since the
// beginning of the day, with microsecond precision
double get_seconds() {
struct timeval tv[1];
gettimeofday(tv, NULL);
return tv->tv_sec + tv->tv_usec / 1e6;
}
void child_code(int i)
{
sleep(i);
}
// main takes two parameters: argc is the number of command-line
// arguments; argv is an array of strings containing the command
// line arguments
int main(int argc, char *argv[])
{
int status;
pid_t pid;
double start, stop;
int i, num_children;
int* testHeap = malloc(sizeof(int));
*testHeap = 2;
int testStack = 20;
// the first command-line argument is the name of the executable.
// if there is a second, it is the number of children to create.
if (argc == 2) {
num_children = atoi(argv[1]);
} else {
num_children = 1;
}
// get the start time
start = get_seconds();
for (i=0; i<num_children; i++) {
// create a child process
// printf("Creating child %d.\n", i);
pid = fork();
/* check for an error */
if (pid == -1) {
fprintf(stderr, "fork failed: %s\n", strerror(errno));
perror(argv[0]);
exit(1);
}
/* see if we're the parent or the child */
if (pid == 0) {
//If we get here, then this is the child process
printf("before changing, child %d, testStack = %d, stack addr %p.\n", i, testStack, &testStack);
testStack = 40 + i;
printf("for child %d, testStack = %d, address = %p.\n\n", i, testStack, &testStack);
printf("before changing, child %d, testHeap = %d, address = %p.\n", i, *testHeap, testHeap);
*testHeap = 10 + i;
printf("for child %d, value of testHeap = %d, address = %p\n\n", i, *testHeap, testHeap);
printf("before changing, child %d, testGlob = %d, address = %p.\n", i, testGlob, &testGlob);
testGlob = 100 + i;
printf("for child %d, val of testGlob = %d, address = %p\n\n", i, testGlob, &testGlob);
child_code(i);
exit(i);
}
}
/* parent continues */
// printf("Hello from the parent.\n");
for (i=0; i<num_children; i++) {
pid = wait(&status);
if (pid == -1) {
fprintf(stderr, "wait failed: %s\n", strerror(errno));
perror(argv[0]);
exit(1);
}
// check the exit status of the child
status = WEXITSTATUS(status);
printf("Child %d exited with error code %d.\n", pid, status);
}
printf("for parent, testStack = %d, address = %p\n", testStack, &testStack);
printf("for parent, testHeap = %d, address = %p\n", *testHeap, testHeap);
printf("for parent, testGlob = %d, address = %p\n", testGlob, &testGlob);
// compute the elapsed time
stop = get_seconds();
printf("Elapsed time = %f seconds.\n", stop - start);
exit(0);
}
|
the_stack_data/31387993.c | #include<stdio.h>
#define MAXLINE 1000
int mgetline(char s[],int max);
int strend(char *s,char *t);
int mystrlen(char *t);
int main(void)
{
char s[MAXLINE],t[MAXLINE];
int ret;
mgetline(s,MAXLINE);
mgetline(t,MAXLINE);
ret = strend(s,t);
printf("%d",ret);
return 0;
}
int mgetline(char s[],int lim)
{
int c,i;
for(i=0;i<lim-1 && ((c=getchar())!=EOF) && c!='\n';++i)
s[i]=c;
if(c=='\n')
{
s[i]=c;
++i;
}
s[i]='\0';
return i;
}
int strend(char *s,char *t)
{
int len;
len=mystrlen(t);
while(*s!='\0')
++s;
--s;
while(*t!='\0')
++t;
--t;
while(len > 0)
{
if(*t==*s)
{
--t;
--s;
--len;
}
else
return 0;
}
if( len == 0)
return 1;
}
int mystrlen(char *t)
{
char *p;
p=t;
while(*p!='\0')
++p;
return p-t;
}
|
the_stack_data/111079264.c | #include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <complex.h>
#ifdef complex
#undef complex
#endif
#ifdef I
#undef I
#endif
#if defined(_WIN64)
typedef long long BLASLONG;
typedef unsigned long long BLASULONG;
#else
typedef long BLASLONG;
typedef unsigned long BLASULONG;
#endif
#ifdef LAPACK_ILP64
typedef BLASLONG blasint;
#if defined(_WIN64)
#define blasabs(x) llabs(x)
#else
#define blasabs(x) labs(x)
#endif
#else
typedef int blasint;
#define blasabs(x) abs(x)
#endif
typedef blasint integer;
typedef unsigned int uinteger;
typedef char *address;
typedef short int shortint;
typedef float real;
typedef double doublereal;
typedef struct { real r, i; } complex;
typedef struct { doublereal r, i; } doublecomplex;
#ifdef _MSC_VER
static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
#else
static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
#endif
#define pCf(z) (*_pCf(z))
#define pCd(z) (*_pCd(z))
typedef int logical;
typedef short int shortlogical;
typedef char logical1;
typedef char integer1;
#define TRUE_ (1)
#define FALSE_ (0)
/* Extern is for use with -E */
#ifndef Extern
#define Extern extern
#endif
/* I/O stuff */
typedef int flag;
typedef int ftnlen;
typedef int ftnint;
/*external read, write*/
typedef struct
{ flag cierr;
ftnint ciunit;
flag ciend;
char *cifmt;
ftnint cirec;
} cilist;
/*internal read, write*/
typedef struct
{ flag icierr;
char *iciunit;
flag iciend;
char *icifmt;
ftnint icirlen;
ftnint icirnum;
} icilist;
/*open*/
typedef struct
{ flag oerr;
ftnint ounit;
char *ofnm;
ftnlen ofnmlen;
char *osta;
char *oacc;
char *ofm;
ftnint orl;
char *oblnk;
} olist;
/*close*/
typedef struct
{ flag cerr;
ftnint cunit;
char *csta;
} cllist;
/*rewind, backspace, endfile*/
typedef struct
{ flag aerr;
ftnint aunit;
} alist;
/* inquire */
typedef struct
{ flag inerr;
ftnint inunit;
char *infile;
ftnlen infilen;
ftnint *inex; /*parameters in standard's order*/
ftnint *inopen;
ftnint *innum;
ftnint *innamed;
char *inname;
ftnlen innamlen;
char *inacc;
ftnlen inacclen;
char *inseq;
ftnlen inseqlen;
char *indir;
ftnlen indirlen;
char *infmt;
ftnlen infmtlen;
char *inform;
ftnint informlen;
char *inunf;
ftnlen inunflen;
ftnint *inrecl;
ftnint *innrec;
char *inblank;
ftnlen inblanklen;
} inlist;
#define VOID void
union Multitype { /* for multiple entry points */
integer1 g;
shortint h;
integer i;
/* longint j; */
real r;
doublereal d;
complex c;
doublecomplex z;
};
typedef union Multitype Multitype;
struct Vardesc { /* for Namelist */
char *name;
char *addr;
ftnlen *dims;
int type;
};
typedef struct Vardesc Vardesc;
struct Namelist {
char *name;
Vardesc **vars;
int nvars;
};
typedef struct Namelist Namelist;
#define abs(x) ((x) >= 0 ? (x) : -(x))
#define dabs(x) (fabs(x))
#define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
#define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
#define dmin(a,b) (f2cmin(a,b))
#define dmax(a,b) (f2cmax(a,b))
#define bit_test(a,b) ((a) >> (b) & 1)
#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
#define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
#define abort_() { sig_die("Fortran abort routine called", 1); }
#define c_abs(z) (cabsf(Cf(z)))
#define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
#ifdef _MSC_VER
#define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
#define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);}
#else
#define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
#define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
#endif
#define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
#define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
#define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
//#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
#define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
#define d_abs(x) (fabs(*(x)))
#define d_acos(x) (acos(*(x)))
#define d_asin(x) (asin(*(x)))
#define d_atan(x) (atan(*(x)))
#define d_atn2(x, y) (atan2(*(x),*(y)))
#define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
#define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
#define d_cos(x) (cos(*(x)))
#define d_cosh(x) (cosh(*(x)))
#define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
#define d_exp(x) (exp(*(x)))
#define d_imag(z) (cimag(Cd(z)))
#define r_imag(z) (cimagf(Cf(z)))
#define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
#define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
#define d_log(x) (log(*(x)))
#define d_mod(x, y) (fmod(*(x), *(y)))
#define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
#define d_nint(x) u_nint(*(x))
#define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
#define d_sign(a,b) u_sign(*(a),*(b))
#define r_sign(a,b) u_sign(*(a),*(b))
#define d_sin(x) (sin(*(x)))
#define d_sinh(x) (sinh(*(x)))
#define d_sqrt(x) (sqrt(*(x)))
#define d_tan(x) (tan(*(x)))
#define d_tanh(x) (tanh(*(x)))
#define i_abs(x) abs(*(x))
#define i_dnnt(x) ((integer)u_nint(*(x)))
#define i_len(s, n) (n)
#define i_nint(x) ((integer)u_nint(*(x)))
#define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
#define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
#define pow_si(B,E) spow_ui(*(B),*(E))
#define pow_ri(B,E) spow_ui(*(B),*(E))
#define pow_di(B,E) dpow_ui(*(B),*(E))
#define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
#define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
#define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
#define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
#define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
#define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
#define sig_die(s, kill) { exit(1); }
#define s_stop(s, n) {exit(0);}
static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
#define z_abs(z) (cabs(Cd(z)))
#define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
#define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
#define myexit_() break;
#define mycycle() continue;
#define myceiling(w) {ceil(w)}
#define myhuge(w) {HUGE_VAL}
//#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
#define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
/* procedure parameter types for -A and -C++ */
#define F2C_proc_par_types 1
#ifdef __cplusplus
typedef logical (*L_fp)(...);
#else
typedef logical (*L_fp)();
#endif
static float spow_ui(float x, integer n) {
float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static double dpow_ui(double x, integer n) {
double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#ifdef _MSC_VER
static _Fcomplex cpow_ui(complex x, integer n) {
complex pow={1.0,0.0}; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
for(u = n; ; ) {
if(u & 01) pow.r *= x.r, pow.i *= x.i;
if(u >>= 1) x.r *= x.r, x.i *= x.i;
else break;
}
}
_Fcomplex p={pow.r, pow.i};
return p;
}
#else
static _Complex float cpow_ui(_Complex float x, integer n) {
_Complex float pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#endif
#ifdef _MSC_VER
static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
_Dcomplex pow={1.0,0.0}; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
for(u = n; ; ) {
if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
else break;
}
}
_Dcomplex p = {pow._Val[0], pow._Val[1]};
return p;
}
#else
static _Complex double zpow_ui(_Complex double x, integer n) {
_Complex double pow=1.0; unsigned long int u;
if(n != 0) {
if(n < 0) n = -n, x = 1/x;
for(u = n; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
#endif
static integer pow_ii(integer x, integer n) {
integer pow; unsigned long int u;
if (n <= 0) {
if (n == 0 || x == 1) pow = 1;
else if (x != -1) pow = x == 0 ? 1/x : 0;
else n = -n;
}
if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
u = n;
for(pow = 1; ; ) {
if(u & 01) pow *= x;
if(u >>= 1) x *= x;
else break;
}
}
return pow;
}
static integer dmaxloc_(double *w, integer s, integer e, integer *n)
{
double m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static integer smaxloc_(float *w, integer s, integer e, integer *n)
{
float m; integer i, mi;
for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
if (w[i-1]>m) mi=i ,m=w[i-1];
return mi-s+1;
}
static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Fcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
}
}
pCf(z) = zdotc;
}
#else
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
#endif
static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Dcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
}
}
pCd(z) = zdotc;
}
#else
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
#endif
static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Fcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
}
}
pCf(z) = zdotc;
}
#else
_Complex float zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i]) * Cf(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
}
}
pCf(z) = zdotc;
}
#endif
static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
integer n = *n_, incx = *incx_, incy = *incy_, i;
#ifdef _MSC_VER
_Dcomplex zdotc = {0.0, 0.0};
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
}
}
pCd(z) = zdotc;
}
#else
_Complex double zdotc = 0.0;
if (incx == 1 && incy == 1) {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i]) * Cd(&y[i]);
}
} else {
for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
}
}
pCd(z) = zdotc;
}
#endif
/* -- translated by f2c (version 20000121).
You must link the resulting object file with the libraries:
-lf2c -lm (in that order)
*/
/* Table of constant values */
static integer c__1 = 1;
static integer c_n1 = -1;
/* > \brief \b CSYTRI_3 */
/* =========== DOCUMENTATION =========== */
/* Online html documentation available at */
/* http://www.netlib.org/lapack/explore-html/ */
/* > \htmlonly */
/* > Download CSYTRI_3 + dependencies */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/csytri_
3.f"> */
/* > [TGZ]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/csytri_
3.f"> */
/* > [ZIP]</a> */
/* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/csytri_
3.f"> */
/* > [TXT]</a> */
/* > \endhtmlonly */
/* Definition: */
/* =========== */
/* SUBROUTINE CSYTRI_3( UPLO, N, A, LDA, E, IPIV, WORK, LWORK, */
/* INFO ) */
/* CHARACTER UPLO */
/* INTEGER INFO, LDA, LWORK, N */
/* INTEGER IPIV( * ) */
/* COMPLEX A( LDA, * ), E( * ), WORK( * ) */
/* > \par Purpose: */
/* ============= */
/* > */
/* > \verbatim */
/* > CSYTRI_3 computes the inverse of a complex symmetric indefinite */
/* > matrix A using the factorization computed by CSYTRF_RK or CSYTRF_BK: */
/* > */
/* > A = P*U*D*(U**T)*(P**T) or A = P*L*D*(L**T)*(P**T), */
/* > */
/* > where U (or L) is unit upper (or lower) triangular matrix, */
/* > U**T (or L**T) is the transpose of U (or L), P is a permutation */
/* > matrix, P**T is the transpose of P, and D is symmetric and block */
/* > diagonal with 1-by-1 and 2-by-2 diagonal blocks. */
/* > */
/* > CSYTRI_3 sets the leading dimension of the workspace before calling */
/* > CSYTRI_3X that actually computes the inverse. This is the blocked */
/* > version of the algorithm, calling Level 3 BLAS. */
/* > \endverbatim */
/* Arguments: */
/* ========== */
/* > \param[in] UPLO */
/* > \verbatim */
/* > UPLO is CHARACTER*1 */
/* > Specifies whether the details of the factorization are */
/* > stored as an upper or lower triangular matrix. */
/* > = 'U': Upper triangle of A is stored; */
/* > = 'L': Lower triangle of A is stored. */
/* > \endverbatim */
/* > */
/* > \param[in] N */
/* > \verbatim */
/* > N is INTEGER */
/* > The order of the matrix A. N >= 0. */
/* > \endverbatim */
/* > */
/* > \param[in,out] A */
/* > \verbatim */
/* > A is COMPLEX array, dimension (LDA,N) */
/* > On entry, diagonal of the block diagonal matrix D and */
/* > factors U or L as computed by CSYTRF_RK and CSYTRF_BK: */
/* > a) ONLY diagonal elements of the symmetric block diagonal */
/* > matrix D on the diagonal of A, i.e. D(k,k) = A(k,k); */
/* > (superdiagonal (or subdiagonal) elements of D */
/* > should be provided on entry in array E), and */
/* > b) If UPLO = 'U': factor U in the superdiagonal part of A. */
/* > If UPLO = 'L': factor L in the subdiagonal part of A. */
/* > */
/* > On exit, if INFO = 0, the symmetric inverse of the original */
/* > matrix. */
/* > If UPLO = 'U': the upper triangular part of the inverse */
/* > is formed and the part of A below the diagonal is not */
/* > referenced; */
/* > If UPLO = 'L': the lower triangular part of the inverse */
/* > is formed and the part of A above the diagonal is not */
/* > referenced. */
/* > \endverbatim */
/* > */
/* > \param[in] LDA */
/* > \verbatim */
/* > LDA is INTEGER */
/* > The leading dimension of the array A. LDA >= f2cmax(1,N). */
/* > \endverbatim */
/* > */
/* > \param[in] E */
/* > \verbatim */
/* > E is COMPLEX array, dimension (N) */
/* > On entry, contains the superdiagonal (or subdiagonal) */
/* > elements of the symmetric block diagonal matrix D */
/* > with 1-by-1 or 2-by-2 diagonal blocks, where */
/* > If UPLO = 'U': E(i) = D(i-1,i),i=2:N, E(1) not referenced; */
/* > If UPLO = 'L': E(i) = D(i+1,i),i=1:N-1, E(N) not referenced. */
/* > */
/* > NOTE: For 1-by-1 diagonal block D(k), where */
/* > 1 <= k <= N, the element E(k) is not referenced in both */
/* > UPLO = 'U' or UPLO = 'L' cases. */
/* > \endverbatim */
/* > */
/* > \param[in] IPIV */
/* > \verbatim */
/* > IPIV is INTEGER array, dimension (N) */
/* > Details of the interchanges and the block structure of D */
/* > as determined by CSYTRF_RK or CSYTRF_BK. */
/* > \endverbatim */
/* > */
/* > \param[out] WORK */
/* > \verbatim */
/* > WORK is COMPLEX array, dimension (N+NB+1)*(NB+3). */
/* > On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */
/* > \endverbatim */
/* > */
/* > \param[in] LWORK */
/* > \verbatim */
/* > LWORK is INTEGER */
/* > The length of WORK. LWORK >= (N+NB+1)*(NB+3). */
/* > */
/* > If LDWORK = -1, then a workspace query is assumed; */
/* > the routine only calculates the optimal size of the optimal */
/* > size of the WORK array, returns this value as the first */
/* > entry of the WORK array, and no error message related to */
/* > LWORK is issued by XERBLA. */
/* > \endverbatim */
/* > */
/* > \param[out] INFO */
/* > \verbatim */
/* > INFO is INTEGER */
/* > = 0: successful exit */
/* > < 0: if INFO = -i, the i-th argument had an illegal value */
/* > > 0: if INFO = i, D(i,i) = 0; the matrix is singular and its */
/* > inverse could not be computed. */
/* > \endverbatim */
/* Authors: */
/* ======== */
/* > \author Univ. of Tennessee */
/* > \author Univ. of California Berkeley */
/* > \author Univ. of Colorado Denver */
/* > \author NAG Ltd. */
/* > \date November 2017 */
/* > \ingroup complexSYcomputational */
/* > \par Contributors: */
/* ================== */
/* > \verbatim */
/* > */
/* > November 2017, Igor Kozachenko, */
/* > Computer Science Division, */
/* > University of California, Berkeley */
/* > */
/* > \endverbatim */
/* ===================================================================== */
/* Subroutine */ int csytri_3_(char *uplo, integer *n, complex *a, integer *
lda, complex *e, integer *ipiv, complex *work, integer *lwork,
integer *info)
{
/* System generated locals */
integer a_dim1, a_offset, i__1, i__2;
/* Local variables */
extern logical lsame_(char *, char *);
extern /* Subroutine */ int csytri_3x_(char *, integer *, complex *,
integer *, complex *, integer *, complex *, integer *, integer *);
logical upper;
integer nb;
extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);
extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
integer *, integer *, ftnlen, ftnlen);
integer lwkopt;
logical lquery;
/* -- LAPACK computational routine (version 3.8.0) -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
/* November 2017 */
/* ===================================================================== */
/* Test the input parameters. */
/* Parameter adjustments */
a_dim1 = *lda;
a_offset = 1 + a_dim1 * 1;
a -= a_offset;
--e;
--ipiv;
--work;
/* Function Body */
*info = 0;
upper = lsame_(uplo, "U");
lquery = *lwork == -1;
/* Determine the block size */
/* Computing MAX */
i__1 = 1, i__2 = ilaenv_(&c__1, "CSYTRI_3", uplo, n, &c_n1, &c_n1, &c_n1,
(ftnlen)8, (ftnlen)1);
nb = f2cmax(i__1,i__2);
lwkopt = (*n + nb + 1) * (nb + 3);
if (! upper && ! lsame_(uplo, "L")) {
*info = -1;
} else if (*n < 0) {
*info = -2;
} else if (*lda < f2cmax(1,*n)) {
*info = -4;
} else if (*lwork < lwkopt && ! lquery) {
*info = -8;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("CSYTRI_3", &i__1, (ftnlen)8);
return 0;
} else if (lquery) {
work[1].r = (real) lwkopt, work[1].i = 0.f;
return 0;
}
/* Quick return if possible */
if (*n == 0) {
return 0;
}
csytri_3x_(uplo, n, &a[a_offset], lda, &e[1], &ipiv[1], &work[1], &nb,
info);
work[1].r = (real) lwkopt, work[1].i = 0.f;
return 0;
/* End of CSYTRI_3 */
} /* csytri_3__ */
|
the_stack_data/147712.c | //# Deadlock: true
//# Lockgraph:
//# - lock1 -> lock2
//# - lock2 -> lock1
//# Context-sensitive-functions: []
//# With-eva-only: true
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
pthread_mutex_t lock1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t lock2 = PTHREAD_MUTEX_INITIALIZER;
// This function is not classified as contex-sensitive since its (precise) calling context is
// included in initial states of threds thread1 and thread2
void f(pthread_mutex_t *lock1, pthread_mutex_t *lock2)
{
pthread_mutex_lock(lock1);
pthread_mutex_lock(lock2);
pthread_mutex_unlock(lock2);
pthread_mutex_unlock(lock1);
}
void *thread1(void *param)
{
pthread_mutex_t *lock = (pthread_mutex_t *) param;
f(lock, &lock2);
return NULL;
}
void *thread2(void *param)
{
pthread_mutex_t *lock = (pthread_mutex_t *) param;
f(lock, &lock1);
return NULL;
}
int main()
{
pthread_t threads[2];
pthread_create(&threads[0], NULL, thread1, &lock1);
pthread_create(&threads[1], NULL, thread2, &lock2);
pthread_join(threads[0], NULL);
pthread_join(threads[1], NULL);
return 0;
}
|
the_stack_data/165764756.c |
/* Spew out a long sequence of the byte 251. When fed to bzip2
versions 1.0.0 or 1.0.1, causes it to die with internal error
1007 in blocksort.c. This assertion misses an extremely rare
case, which is fixed in this version (1.0.2) and above.
*/
/* ------------------------------------------------------------------
This file is part of bzip2/libbzip2, a program and library for
lossless, block-sorting data compression.
bzip2/libbzip2 version 1.0.6 of 6 September 2010
Copyright (C) 1996-2010 Julian Seward <[email protected]>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
in the file LICENSE.
------------------------------------------------------------------ */
#include <stdio.h>
int main () {
int i;
for (i = 0; i < 48500000; i++)
putchar (251);
return 0;
}
|
the_stack_data/9512789.c | #include <stdio.h>
double power(double n, int p);
int main(void)
{
double x, xpow;
int exp;
printf("Enter a number and the posotive integer power");
printf(" to which\nthe number will be raised. Enter q");
printf(" to quit.\n");
while (scanf("%lf%d", &x, &exp) == 2)
{
xpow = power(x, exp);
printf("%.3g to the power %d is %.5g\n", x, exp, xpow);
printf("Enter next pair of numbers or q to quit.\n");
}
printf("Hope you enjoyed this power trip -- bye!\n");
return 0;
}
double power(double n, int p)
{
double pow=1;
int i;
for (i=1; i<=p; i++)
pow *= n;
return pow;
}
|
the_stack_data/153267977.c | #include <stdio.h>
#include <stdlib.h>
int main()
{
int m[3][3];
int t[3][3];
int i,j;
for(i=0;i<3;i++){
for(j=0;j<3;j++){
printf("digite um numero da linha %d e coluna %d\n",i+1,j+1);
scanf("%d",&m[i][j]);
}
}
for(i=0;i<3;i++){
for(j=0;j<3;j++){
printf("[%d]",m[i][j]);
}
printf("\n");
}
printf("trasformando as colunas em linhas e linhas em colunas:\n\n");
for(i=0;i<3;i++){
for(j=0;j<3;j++){
t[i][j] = m[j][i];
}
}
for(i=0;i<3;i++){
for(j=0;j<3;j++){
printf("[%d]",t[i][j]);
}
printf("\n");
}
}
|
the_stack_data/148704.c | //@ ltl invariant negative: (([] AP(x_18 - x_9 >= -19)) U (X AP(x_13 - x_1 > -10)));
float x_0;
float x_1;
float x_2;
float x_3;
float x_4;
float x_5;
float x_6;
float x_7;
float x_8;
float x_9;
float x_10;
float x_11;
float x_12;
float x_13;
float x_14;
float x_15;
float x_16;
float x_17;
float x_18;
float x_19;
float x_20;
float x_21;
float x_22;
float x_23;
float x_24;
float x_25;
float x_26;
float x_27;
float x_28;
float x_29;
float x_30;
float x_31;
int main()
{
float x_0_;
float x_1_;
float x_2_;
float x_3_;
float x_4_;
float x_5_;
float x_6_;
float x_7_;
float x_8_;
float x_9_;
float x_10_;
float x_11_;
float x_12_;
float x_13_;
float x_14_;
float x_15_;
float x_16_;
float x_17_;
float x_18_;
float x_19_;
float x_20_;
float x_21_;
float x_22_;
float x_23_;
float x_24_;
float x_25_;
float x_26_;
float x_27_;
float x_28_;
float x_29_;
float x_30_;
float x_31_;
while(1) {
x_0_ = (((((1.0 + x_0) > (3.0 + x_1)? (1.0 + x_0) : (3.0 + x_1)) > ((2.0 + x_3) > (17.0 + x_4)? (2.0 + x_3) : (17.0 + x_4))? ((1.0 + x_0) > (3.0 + x_1)? (1.0 + x_0) : (3.0 + x_1)) : ((2.0 + x_3) > (17.0 + x_4)? (2.0 + x_3) : (17.0 + x_4))) > (((2.0 + x_9) > (8.0 + x_11)? (2.0 + x_9) : (8.0 + x_11)) > ((13.0 + x_16) > (3.0 + x_18)? (13.0 + x_16) : (3.0 + x_18))? ((2.0 + x_9) > (8.0 + x_11)? (2.0 + x_9) : (8.0 + x_11)) : ((13.0 + x_16) > (3.0 + x_18)? (13.0 + x_16) : (3.0 + x_18)))? (((1.0 + x_0) > (3.0 + x_1)? (1.0 + x_0) : (3.0 + x_1)) > ((2.0 + x_3) > (17.0 + x_4)? (2.0 + x_3) : (17.0 + x_4))? ((1.0 + x_0) > (3.0 + x_1)? (1.0 + x_0) : (3.0 + x_1)) : ((2.0 + x_3) > (17.0 + x_4)? (2.0 + x_3) : (17.0 + x_4))) : (((2.0 + x_9) > (8.0 + x_11)? (2.0 + x_9) : (8.0 + x_11)) > ((13.0 + x_16) > (3.0 + x_18)? (13.0 + x_16) : (3.0 + x_18))? ((2.0 + x_9) > (8.0 + x_11)? (2.0 + x_9) : (8.0 + x_11)) : ((13.0 + x_16) > (3.0 + x_18)? (13.0 + x_16) : (3.0 + x_18)))) > ((((16.0 + x_19) > (9.0 + x_20)? (16.0 + x_19) : (9.0 + x_20)) > ((9.0 + x_21) > (1.0 + x_23)? (9.0 + x_21) : (1.0 + x_23))? ((16.0 + x_19) > (9.0 + x_20)? (16.0 + x_19) : (9.0 + x_20)) : ((9.0 + x_21) > (1.0 + x_23)? (9.0 + x_21) : (1.0 + x_23))) > (((11.0 + x_24) > (15.0 + x_26)? (11.0 + x_24) : (15.0 + x_26)) > ((14.0 + x_28) > (9.0 + x_29)? (14.0 + x_28) : (9.0 + x_29))? ((11.0 + x_24) > (15.0 + x_26)? (11.0 + x_24) : (15.0 + x_26)) : ((14.0 + x_28) > (9.0 + x_29)? (14.0 + x_28) : (9.0 + x_29)))? (((16.0 + x_19) > (9.0 + x_20)? (16.0 + x_19) : (9.0 + x_20)) > ((9.0 + x_21) > (1.0 + x_23)? (9.0 + x_21) : (1.0 + x_23))? ((16.0 + x_19) > (9.0 + x_20)? (16.0 + x_19) : (9.0 + x_20)) : ((9.0 + x_21) > (1.0 + x_23)? (9.0 + x_21) : (1.0 + x_23))) : (((11.0 + x_24) > (15.0 + x_26)? (11.0 + x_24) : (15.0 + x_26)) > ((14.0 + x_28) > (9.0 + x_29)? (14.0 + x_28) : (9.0 + x_29))? ((11.0 + x_24) > (15.0 + x_26)? (11.0 + x_24) : (15.0 + x_26)) : ((14.0 + x_28) > (9.0 + x_29)? (14.0 + x_28) : (9.0 + x_29))))? ((((1.0 + x_0) > (3.0 + x_1)? (1.0 + x_0) : (3.0 + x_1)) > ((2.0 + x_3) > (17.0 + x_4)? (2.0 + x_3) : (17.0 + x_4))? ((1.0 + x_0) > (3.0 + x_1)? (1.0 + x_0) : (3.0 + x_1)) : ((2.0 + x_3) > (17.0 + x_4)? (2.0 + x_3) : (17.0 + x_4))) > (((2.0 + x_9) > (8.0 + x_11)? (2.0 + x_9) : (8.0 + x_11)) > ((13.0 + x_16) > (3.0 + x_18)? (13.0 + x_16) : (3.0 + x_18))? ((2.0 + x_9) > (8.0 + x_11)? (2.0 + x_9) : (8.0 + x_11)) : ((13.0 + x_16) > (3.0 + x_18)? (13.0 + x_16) : (3.0 + x_18)))? (((1.0 + x_0) > (3.0 + x_1)? (1.0 + x_0) : (3.0 + x_1)) > ((2.0 + x_3) > (17.0 + x_4)? (2.0 + x_3) : (17.0 + x_4))? ((1.0 + x_0) > (3.0 + x_1)? (1.0 + x_0) : (3.0 + x_1)) : ((2.0 + x_3) > (17.0 + x_4)? (2.0 + x_3) : (17.0 + x_4))) : (((2.0 + x_9) > (8.0 + x_11)? (2.0 + x_9) : (8.0 + x_11)) > ((13.0 + x_16) > (3.0 + x_18)? (13.0 + x_16) : (3.0 + x_18))? ((2.0 + x_9) > (8.0 + x_11)? (2.0 + x_9) : (8.0 + x_11)) : ((13.0 + x_16) > (3.0 + x_18)? (13.0 + x_16) : (3.0 + x_18)))) : ((((16.0 + x_19) > (9.0 + x_20)? (16.0 + x_19) : (9.0 + x_20)) > ((9.0 + x_21) > (1.0 + x_23)? (9.0 + x_21) : (1.0 + x_23))? ((16.0 + x_19) > (9.0 + x_20)? (16.0 + x_19) : (9.0 + x_20)) : ((9.0 + x_21) > (1.0 + x_23)? (9.0 + x_21) : (1.0 + x_23))) > (((11.0 + x_24) > (15.0 + x_26)? (11.0 + x_24) : (15.0 + x_26)) > ((14.0 + x_28) > (9.0 + x_29)? (14.0 + x_28) : (9.0 + x_29))? ((11.0 + x_24) > (15.0 + x_26)? (11.0 + x_24) : (15.0 + x_26)) : ((14.0 + x_28) > (9.0 + x_29)? (14.0 + x_28) : (9.0 + x_29)))? (((16.0 + x_19) > (9.0 + x_20)? (16.0 + x_19) : (9.0 + x_20)) > ((9.0 + x_21) > (1.0 + x_23)? (9.0 + x_21) : (1.0 + x_23))? ((16.0 + x_19) > (9.0 + x_20)? (16.0 + x_19) : (9.0 + x_20)) : ((9.0 + x_21) > (1.0 + x_23)? (9.0 + x_21) : (1.0 + x_23))) : (((11.0 + x_24) > (15.0 + x_26)? (11.0 + x_24) : (15.0 + x_26)) > ((14.0 + x_28) > (9.0 + x_29)? (14.0 + x_28) : (9.0 + x_29))? ((11.0 + x_24) > (15.0 + x_26)? (11.0 + x_24) : (15.0 + x_26)) : ((14.0 + x_28) > (9.0 + x_29)? (14.0 + x_28) : (9.0 + x_29)))));
x_1_ = (((((7.0 + x_1) > (17.0 + x_4)? (7.0 + x_1) : (17.0 + x_4)) > ((17.0 + x_5) > (7.0 + x_7)? (17.0 + x_5) : (7.0 + x_7))? ((7.0 + x_1) > (17.0 + x_4)? (7.0 + x_1) : (17.0 + x_4)) : ((17.0 + x_5) > (7.0 + x_7)? (17.0 + x_5) : (7.0 + x_7))) > (((15.0 + x_8) > (7.0 + x_11)? (15.0 + x_8) : (7.0 + x_11)) > ((15.0 + x_14) > (19.0 + x_15)? (15.0 + x_14) : (19.0 + x_15))? ((15.0 + x_8) > (7.0 + x_11)? (15.0 + x_8) : (7.0 + x_11)) : ((15.0 + x_14) > (19.0 + x_15)? (15.0 + x_14) : (19.0 + x_15)))? (((7.0 + x_1) > (17.0 + x_4)? (7.0 + x_1) : (17.0 + x_4)) > ((17.0 + x_5) > (7.0 + x_7)? (17.0 + x_5) : (7.0 + x_7))? ((7.0 + x_1) > (17.0 + x_4)? (7.0 + x_1) : (17.0 + x_4)) : ((17.0 + x_5) > (7.0 + x_7)? (17.0 + x_5) : (7.0 + x_7))) : (((15.0 + x_8) > (7.0 + x_11)? (15.0 + x_8) : (7.0 + x_11)) > ((15.0 + x_14) > (19.0 + x_15)? (15.0 + x_14) : (19.0 + x_15))? ((15.0 + x_8) > (7.0 + x_11)? (15.0 + x_8) : (7.0 + x_11)) : ((15.0 + x_14) > (19.0 + x_15)? (15.0 + x_14) : (19.0 + x_15)))) > ((((15.0 + x_17) > (11.0 + x_18)? (15.0 + x_17) : (11.0 + x_18)) > ((2.0 + x_19) > (8.0 + x_20)? (2.0 + x_19) : (8.0 + x_20))? ((15.0 + x_17) > (11.0 + x_18)? (15.0 + x_17) : (11.0 + x_18)) : ((2.0 + x_19) > (8.0 + x_20)? (2.0 + x_19) : (8.0 + x_20))) > (((17.0 + x_22) > (3.0 + x_28)? (17.0 + x_22) : (3.0 + x_28)) > ((6.0 + x_30) > (5.0 + x_31)? (6.0 + x_30) : (5.0 + x_31))? ((17.0 + x_22) > (3.0 + x_28)? (17.0 + x_22) : (3.0 + x_28)) : ((6.0 + x_30) > (5.0 + x_31)? (6.0 + x_30) : (5.0 + x_31)))? (((15.0 + x_17) > (11.0 + x_18)? (15.0 + x_17) : (11.0 + x_18)) > ((2.0 + x_19) > (8.0 + x_20)? (2.0 + x_19) : (8.0 + x_20))? ((15.0 + x_17) > (11.0 + x_18)? (15.0 + x_17) : (11.0 + x_18)) : ((2.0 + x_19) > (8.0 + x_20)? (2.0 + x_19) : (8.0 + x_20))) : (((17.0 + x_22) > (3.0 + x_28)? (17.0 + x_22) : (3.0 + x_28)) > ((6.0 + x_30) > (5.0 + x_31)? (6.0 + x_30) : (5.0 + x_31))? ((17.0 + x_22) > (3.0 + x_28)? (17.0 + x_22) : (3.0 + x_28)) : ((6.0 + x_30) > (5.0 + x_31)? (6.0 + x_30) : (5.0 + x_31))))? ((((7.0 + x_1) > (17.0 + x_4)? (7.0 + x_1) : (17.0 + x_4)) > ((17.0 + x_5) > (7.0 + x_7)? (17.0 + x_5) : (7.0 + x_7))? ((7.0 + x_1) > (17.0 + x_4)? (7.0 + x_1) : (17.0 + x_4)) : ((17.0 + x_5) > (7.0 + x_7)? (17.0 + x_5) : (7.0 + x_7))) > (((15.0 + x_8) > (7.0 + x_11)? (15.0 + x_8) : (7.0 + x_11)) > ((15.0 + x_14) > (19.0 + x_15)? (15.0 + x_14) : (19.0 + x_15))? ((15.0 + x_8) > (7.0 + x_11)? (15.0 + x_8) : (7.0 + x_11)) : ((15.0 + x_14) > (19.0 + x_15)? (15.0 + x_14) : (19.0 + x_15)))? (((7.0 + x_1) > (17.0 + x_4)? (7.0 + x_1) : (17.0 + x_4)) > ((17.0 + x_5) > (7.0 + x_7)? (17.0 + x_5) : (7.0 + x_7))? ((7.0 + x_1) > (17.0 + x_4)? (7.0 + x_1) : (17.0 + x_4)) : ((17.0 + x_5) > (7.0 + x_7)? (17.0 + x_5) : (7.0 + x_7))) : (((15.0 + x_8) > (7.0 + x_11)? (15.0 + x_8) : (7.0 + x_11)) > ((15.0 + x_14) > (19.0 + x_15)? (15.0 + x_14) : (19.0 + x_15))? ((15.0 + x_8) > (7.0 + x_11)? (15.0 + x_8) : (7.0 + x_11)) : ((15.0 + x_14) > (19.0 + x_15)? (15.0 + x_14) : (19.0 + x_15)))) : ((((15.0 + x_17) > (11.0 + x_18)? (15.0 + x_17) : (11.0 + x_18)) > ((2.0 + x_19) > (8.0 + x_20)? (2.0 + x_19) : (8.0 + x_20))? ((15.0 + x_17) > (11.0 + x_18)? (15.0 + x_17) : (11.0 + x_18)) : ((2.0 + x_19) > (8.0 + x_20)? (2.0 + x_19) : (8.0 + x_20))) > (((17.0 + x_22) > (3.0 + x_28)? (17.0 + x_22) : (3.0 + x_28)) > ((6.0 + x_30) > (5.0 + x_31)? (6.0 + x_30) : (5.0 + x_31))? ((17.0 + x_22) > (3.0 + x_28)? (17.0 + x_22) : (3.0 + x_28)) : ((6.0 + x_30) > (5.0 + x_31)? (6.0 + x_30) : (5.0 + x_31)))? (((15.0 + x_17) > (11.0 + x_18)? (15.0 + x_17) : (11.0 + x_18)) > ((2.0 + x_19) > (8.0 + x_20)? (2.0 + x_19) : (8.0 + x_20))? ((15.0 + x_17) > (11.0 + x_18)? (15.0 + x_17) : (11.0 + x_18)) : ((2.0 + x_19) > (8.0 + x_20)? (2.0 + x_19) : (8.0 + x_20))) : (((17.0 + x_22) > (3.0 + x_28)? (17.0 + x_22) : (3.0 + x_28)) > ((6.0 + x_30) > (5.0 + x_31)? (6.0 + x_30) : (5.0 + x_31))? ((17.0 + x_22) > (3.0 + x_28)? (17.0 + x_22) : (3.0 + x_28)) : ((6.0 + x_30) > (5.0 + x_31)? (6.0 + x_30) : (5.0 + x_31)))));
x_2_ = (((((2.0 + x_1) > (13.0 + x_3)? (2.0 + x_1) : (13.0 + x_3)) > ((7.0 + x_7) > (16.0 + x_8)? (7.0 + x_7) : (16.0 + x_8))? ((2.0 + x_1) > (13.0 + x_3)? (2.0 + x_1) : (13.0 + x_3)) : ((7.0 + x_7) > (16.0 + x_8)? (7.0 + x_7) : (16.0 + x_8))) > (((12.0 + x_11) > (10.0 + x_12)? (12.0 + x_11) : (10.0 + x_12)) > ((6.0 + x_13) > (20.0 + x_14)? (6.0 + x_13) : (20.0 + x_14))? ((12.0 + x_11) > (10.0 + x_12)? (12.0 + x_11) : (10.0 + x_12)) : ((6.0 + x_13) > (20.0 + x_14)? (6.0 + x_13) : (20.0 + x_14)))? (((2.0 + x_1) > (13.0 + x_3)? (2.0 + x_1) : (13.0 + x_3)) > ((7.0 + x_7) > (16.0 + x_8)? (7.0 + x_7) : (16.0 + x_8))? ((2.0 + x_1) > (13.0 + x_3)? (2.0 + x_1) : (13.0 + x_3)) : ((7.0 + x_7) > (16.0 + x_8)? (7.0 + x_7) : (16.0 + x_8))) : (((12.0 + x_11) > (10.0 + x_12)? (12.0 + x_11) : (10.0 + x_12)) > ((6.0 + x_13) > (20.0 + x_14)? (6.0 + x_13) : (20.0 + x_14))? ((12.0 + x_11) > (10.0 + x_12)? (12.0 + x_11) : (10.0 + x_12)) : ((6.0 + x_13) > (20.0 + x_14)? (6.0 + x_13) : (20.0 + x_14)))) > ((((1.0 + x_16) > (16.0 + x_18)? (1.0 + x_16) : (16.0 + x_18)) > ((13.0 + x_20) > (8.0 + x_24)? (13.0 + x_20) : (8.0 + x_24))? ((1.0 + x_16) > (16.0 + x_18)? (1.0 + x_16) : (16.0 + x_18)) : ((13.0 + x_20) > (8.0 + x_24)? (13.0 + x_20) : (8.0 + x_24))) > (((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) > ((1.0 + x_29) > (19.0 + x_31)? (1.0 + x_29) : (19.0 + x_31))? ((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) : ((1.0 + x_29) > (19.0 + x_31)? (1.0 + x_29) : (19.0 + x_31)))? (((1.0 + x_16) > (16.0 + x_18)? (1.0 + x_16) : (16.0 + x_18)) > ((13.0 + x_20) > (8.0 + x_24)? (13.0 + x_20) : (8.0 + x_24))? ((1.0 + x_16) > (16.0 + x_18)? (1.0 + x_16) : (16.0 + x_18)) : ((13.0 + x_20) > (8.0 + x_24)? (13.0 + x_20) : (8.0 + x_24))) : (((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) > ((1.0 + x_29) > (19.0 + x_31)? (1.0 + x_29) : (19.0 + x_31))? ((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) : ((1.0 + x_29) > (19.0 + x_31)? (1.0 + x_29) : (19.0 + x_31))))? ((((2.0 + x_1) > (13.0 + x_3)? (2.0 + x_1) : (13.0 + x_3)) > ((7.0 + x_7) > (16.0 + x_8)? (7.0 + x_7) : (16.0 + x_8))? ((2.0 + x_1) > (13.0 + x_3)? (2.0 + x_1) : (13.0 + x_3)) : ((7.0 + x_7) > (16.0 + x_8)? (7.0 + x_7) : (16.0 + x_8))) > (((12.0 + x_11) > (10.0 + x_12)? (12.0 + x_11) : (10.0 + x_12)) > ((6.0 + x_13) > (20.0 + x_14)? (6.0 + x_13) : (20.0 + x_14))? ((12.0 + x_11) > (10.0 + x_12)? (12.0 + x_11) : (10.0 + x_12)) : ((6.0 + x_13) > (20.0 + x_14)? (6.0 + x_13) : (20.0 + x_14)))? (((2.0 + x_1) > (13.0 + x_3)? (2.0 + x_1) : (13.0 + x_3)) > ((7.0 + x_7) > (16.0 + x_8)? (7.0 + x_7) : (16.0 + x_8))? ((2.0 + x_1) > (13.0 + x_3)? (2.0 + x_1) : (13.0 + x_3)) : ((7.0 + x_7) > (16.0 + x_8)? (7.0 + x_7) : (16.0 + x_8))) : (((12.0 + x_11) > (10.0 + x_12)? (12.0 + x_11) : (10.0 + x_12)) > ((6.0 + x_13) > (20.0 + x_14)? (6.0 + x_13) : (20.0 + x_14))? ((12.0 + x_11) > (10.0 + x_12)? (12.0 + x_11) : (10.0 + x_12)) : ((6.0 + x_13) > (20.0 + x_14)? (6.0 + x_13) : (20.0 + x_14)))) : ((((1.0 + x_16) > (16.0 + x_18)? (1.0 + x_16) : (16.0 + x_18)) > ((13.0 + x_20) > (8.0 + x_24)? (13.0 + x_20) : (8.0 + x_24))? ((1.0 + x_16) > (16.0 + x_18)? (1.0 + x_16) : (16.0 + x_18)) : ((13.0 + x_20) > (8.0 + x_24)? (13.0 + x_20) : (8.0 + x_24))) > (((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) > ((1.0 + x_29) > (19.0 + x_31)? (1.0 + x_29) : (19.0 + x_31))? ((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) : ((1.0 + x_29) > (19.0 + x_31)? (1.0 + x_29) : (19.0 + x_31)))? (((1.0 + x_16) > (16.0 + x_18)? (1.0 + x_16) : (16.0 + x_18)) > ((13.0 + x_20) > (8.0 + x_24)? (13.0 + x_20) : (8.0 + x_24))? ((1.0 + x_16) > (16.0 + x_18)? (1.0 + x_16) : (16.0 + x_18)) : ((13.0 + x_20) > (8.0 + x_24)? (13.0 + x_20) : (8.0 + x_24))) : (((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) > ((1.0 + x_29) > (19.0 + x_31)? (1.0 + x_29) : (19.0 + x_31))? ((18.0 + x_27) > (12.0 + x_28)? (18.0 + x_27) : (12.0 + x_28)) : ((1.0 + x_29) > (19.0 + x_31)? (1.0 + x_29) : (19.0 + x_31)))));
x_3_ = (((((18.0 + x_1) > (20.0 + x_3)? (18.0 + x_1) : (20.0 + x_3)) > ((17.0 + x_5) > (9.0 + x_7)? (17.0 + x_5) : (9.0 + x_7))? ((18.0 + x_1) > (20.0 + x_3)? (18.0 + x_1) : (20.0 + x_3)) : ((17.0 + x_5) > (9.0 + x_7)? (17.0 + x_5) : (9.0 + x_7))) > (((18.0 + x_9) > (7.0 + x_14)? (18.0 + x_9) : (7.0 + x_14)) > ((9.0 + x_15) > (5.0 + x_16)? (9.0 + x_15) : (5.0 + x_16))? ((18.0 + x_9) > (7.0 + x_14)? (18.0 + x_9) : (7.0 + x_14)) : ((9.0 + x_15) > (5.0 + x_16)? (9.0 + x_15) : (5.0 + x_16)))? (((18.0 + x_1) > (20.0 + x_3)? (18.0 + x_1) : (20.0 + x_3)) > ((17.0 + x_5) > (9.0 + x_7)? (17.0 + x_5) : (9.0 + x_7))? ((18.0 + x_1) > (20.0 + x_3)? (18.0 + x_1) : (20.0 + x_3)) : ((17.0 + x_5) > (9.0 + x_7)? (17.0 + x_5) : (9.0 + x_7))) : (((18.0 + x_9) > (7.0 + x_14)? (18.0 + x_9) : (7.0 + x_14)) > ((9.0 + x_15) > (5.0 + x_16)? (9.0 + x_15) : (5.0 + x_16))? ((18.0 + x_9) > (7.0 + x_14)? (18.0 + x_9) : (7.0 + x_14)) : ((9.0 + x_15) > (5.0 + x_16)? (9.0 + x_15) : (5.0 + x_16)))) > ((((17.0 + x_18) > (8.0 + x_20)? (17.0 + x_18) : (8.0 + x_20)) > ((17.0 + x_21) > (1.0 + x_22)? (17.0 + x_21) : (1.0 + x_22))? ((17.0 + x_18) > (8.0 + x_20)? (17.0 + x_18) : (8.0 + x_20)) : ((17.0 + x_21) > (1.0 + x_22)? (17.0 + x_21) : (1.0 + x_22))) > (((17.0 + x_23) > (14.0 + x_26)? (17.0 + x_23) : (14.0 + x_26)) > ((14.0 + x_27) > (7.0 + x_30)? (14.0 + x_27) : (7.0 + x_30))? ((17.0 + x_23) > (14.0 + x_26)? (17.0 + x_23) : (14.0 + x_26)) : ((14.0 + x_27) > (7.0 + x_30)? (14.0 + x_27) : (7.0 + x_30)))? (((17.0 + x_18) > (8.0 + x_20)? (17.0 + x_18) : (8.0 + x_20)) > ((17.0 + x_21) > (1.0 + x_22)? (17.0 + x_21) : (1.0 + x_22))? ((17.0 + x_18) > (8.0 + x_20)? (17.0 + x_18) : (8.0 + x_20)) : ((17.0 + x_21) > (1.0 + x_22)? (17.0 + x_21) : (1.0 + x_22))) : (((17.0 + x_23) > (14.0 + x_26)? (17.0 + x_23) : (14.0 + x_26)) > ((14.0 + x_27) > (7.0 + x_30)? (14.0 + x_27) : (7.0 + x_30))? ((17.0 + x_23) > (14.0 + x_26)? (17.0 + x_23) : (14.0 + x_26)) : ((14.0 + x_27) > (7.0 + x_30)? (14.0 + x_27) : (7.0 + x_30))))? ((((18.0 + x_1) > (20.0 + x_3)? (18.0 + x_1) : (20.0 + x_3)) > ((17.0 + x_5) > (9.0 + x_7)? (17.0 + x_5) : (9.0 + x_7))? ((18.0 + x_1) > (20.0 + x_3)? (18.0 + x_1) : (20.0 + x_3)) : ((17.0 + x_5) > (9.0 + x_7)? (17.0 + x_5) : (9.0 + x_7))) > (((18.0 + x_9) > (7.0 + x_14)? (18.0 + x_9) : (7.0 + x_14)) > ((9.0 + x_15) > (5.0 + x_16)? (9.0 + x_15) : (5.0 + x_16))? ((18.0 + x_9) > (7.0 + x_14)? (18.0 + x_9) : (7.0 + x_14)) : ((9.0 + x_15) > (5.0 + x_16)? (9.0 + x_15) : (5.0 + x_16)))? (((18.0 + x_1) > (20.0 + x_3)? (18.0 + x_1) : (20.0 + x_3)) > ((17.0 + x_5) > (9.0 + x_7)? (17.0 + x_5) : (9.0 + x_7))? ((18.0 + x_1) > (20.0 + x_3)? (18.0 + x_1) : (20.0 + x_3)) : ((17.0 + x_5) > (9.0 + x_7)? (17.0 + x_5) : (9.0 + x_7))) : (((18.0 + x_9) > (7.0 + x_14)? (18.0 + x_9) : (7.0 + x_14)) > ((9.0 + x_15) > (5.0 + x_16)? (9.0 + x_15) : (5.0 + x_16))? ((18.0 + x_9) > (7.0 + x_14)? (18.0 + x_9) : (7.0 + x_14)) : ((9.0 + x_15) > (5.0 + x_16)? (9.0 + x_15) : (5.0 + x_16)))) : ((((17.0 + x_18) > (8.0 + x_20)? (17.0 + x_18) : (8.0 + x_20)) > ((17.0 + x_21) > (1.0 + x_22)? (17.0 + x_21) : (1.0 + x_22))? ((17.0 + x_18) > (8.0 + x_20)? (17.0 + x_18) : (8.0 + x_20)) : ((17.0 + x_21) > (1.0 + x_22)? (17.0 + x_21) : (1.0 + x_22))) > (((17.0 + x_23) > (14.0 + x_26)? (17.0 + x_23) : (14.0 + x_26)) > ((14.0 + x_27) > (7.0 + x_30)? (14.0 + x_27) : (7.0 + x_30))? ((17.0 + x_23) > (14.0 + x_26)? (17.0 + x_23) : (14.0 + x_26)) : ((14.0 + x_27) > (7.0 + x_30)? (14.0 + x_27) : (7.0 + x_30)))? (((17.0 + x_18) > (8.0 + x_20)? (17.0 + x_18) : (8.0 + x_20)) > ((17.0 + x_21) > (1.0 + x_22)? (17.0 + x_21) : (1.0 + x_22))? ((17.0 + x_18) > (8.0 + x_20)? (17.0 + x_18) : (8.0 + x_20)) : ((17.0 + x_21) > (1.0 + x_22)? (17.0 + x_21) : (1.0 + x_22))) : (((17.0 + x_23) > (14.0 + x_26)? (17.0 + x_23) : (14.0 + x_26)) > ((14.0 + x_27) > (7.0 + x_30)? (14.0 + x_27) : (7.0 + x_30))? ((17.0 + x_23) > (14.0 + x_26)? (17.0 + x_23) : (14.0 + x_26)) : ((14.0 + x_27) > (7.0 + x_30)? (14.0 + x_27) : (7.0 + x_30)))));
x_4_ = (((((3.0 + x_0) > (3.0 + x_1)? (3.0 + x_0) : (3.0 + x_1)) > ((11.0 + x_4) > (6.0 + x_6)? (11.0 + x_4) : (6.0 + x_6))? ((3.0 + x_0) > (3.0 + x_1)? (3.0 + x_0) : (3.0 + x_1)) : ((11.0 + x_4) > (6.0 + x_6)? (11.0 + x_4) : (6.0 + x_6))) > (((4.0 + x_7) > (11.0 + x_8)? (4.0 + x_7) : (11.0 + x_8)) > ((12.0 + x_9) > (15.0 + x_13)? (12.0 + x_9) : (15.0 + x_13))? ((4.0 + x_7) > (11.0 + x_8)? (4.0 + x_7) : (11.0 + x_8)) : ((12.0 + x_9) > (15.0 + x_13)? (12.0 + x_9) : (15.0 + x_13)))? (((3.0 + x_0) > (3.0 + x_1)? (3.0 + x_0) : (3.0 + x_1)) > ((11.0 + x_4) > (6.0 + x_6)? (11.0 + x_4) : (6.0 + x_6))? ((3.0 + x_0) > (3.0 + x_1)? (3.0 + x_0) : (3.0 + x_1)) : ((11.0 + x_4) > (6.0 + x_6)? (11.0 + x_4) : (6.0 + x_6))) : (((4.0 + x_7) > (11.0 + x_8)? (4.0 + x_7) : (11.0 + x_8)) > ((12.0 + x_9) > (15.0 + x_13)? (12.0 + x_9) : (15.0 + x_13))? ((4.0 + x_7) > (11.0 + x_8)? (4.0 + x_7) : (11.0 + x_8)) : ((12.0 + x_9) > (15.0 + x_13)? (12.0 + x_9) : (15.0 + x_13)))) > ((((2.0 + x_17) > (16.0 + x_18)? (2.0 + x_17) : (16.0 + x_18)) > ((14.0 + x_19) > (13.0 + x_22)? (14.0 + x_19) : (13.0 + x_22))? ((2.0 + x_17) > (16.0 + x_18)? (2.0 + x_17) : (16.0 + x_18)) : ((14.0 + x_19) > (13.0 + x_22)? (14.0 + x_19) : (13.0 + x_22))) > (((11.0 + x_23) > (9.0 + x_25)? (11.0 + x_23) : (9.0 + x_25)) > ((9.0 + x_27) > (6.0 + x_31)? (9.0 + x_27) : (6.0 + x_31))? ((11.0 + x_23) > (9.0 + x_25)? (11.0 + x_23) : (9.0 + x_25)) : ((9.0 + x_27) > (6.0 + x_31)? (9.0 + x_27) : (6.0 + x_31)))? (((2.0 + x_17) > (16.0 + x_18)? (2.0 + x_17) : (16.0 + x_18)) > ((14.0 + x_19) > (13.0 + x_22)? (14.0 + x_19) : (13.0 + x_22))? ((2.0 + x_17) > (16.0 + x_18)? (2.0 + x_17) : (16.0 + x_18)) : ((14.0 + x_19) > (13.0 + x_22)? (14.0 + x_19) : (13.0 + x_22))) : (((11.0 + x_23) > (9.0 + x_25)? (11.0 + x_23) : (9.0 + x_25)) > ((9.0 + x_27) > (6.0 + x_31)? (9.0 + x_27) : (6.0 + x_31))? ((11.0 + x_23) > (9.0 + x_25)? (11.0 + x_23) : (9.0 + x_25)) : ((9.0 + x_27) > (6.0 + x_31)? (9.0 + x_27) : (6.0 + x_31))))? ((((3.0 + x_0) > (3.0 + x_1)? (3.0 + x_0) : (3.0 + x_1)) > ((11.0 + x_4) > (6.0 + x_6)? (11.0 + x_4) : (6.0 + x_6))? ((3.0 + x_0) > (3.0 + x_1)? (3.0 + x_0) : (3.0 + x_1)) : ((11.0 + x_4) > (6.0 + x_6)? (11.0 + x_4) : (6.0 + x_6))) > (((4.0 + x_7) > (11.0 + x_8)? (4.0 + x_7) : (11.0 + x_8)) > ((12.0 + x_9) > (15.0 + x_13)? (12.0 + x_9) : (15.0 + x_13))? ((4.0 + x_7) > (11.0 + x_8)? (4.0 + x_7) : (11.0 + x_8)) : ((12.0 + x_9) > (15.0 + x_13)? (12.0 + x_9) : (15.0 + x_13)))? (((3.0 + x_0) > (3.0 + x_1)? (3.0 + x_0) : (3.0 + x_1)) > ((11.0 + x_4) > (6.0 + x_6)? (11.0 + x_4) : (6.0 + x_6))? ((3.0 + x_0) > (3.0 + x_1)? (3.0 + x_0) : (3.0 + x_1)) : ((11.0 + x_4) > (6.0 + x_6)? (11.0 + x_4) : (6.0 + x_6))) : (((4.0 + x_7) > (11.0 + x_8)? (4.0 + x_7) : (11.0 + x_8)) > ((12.0 + x_9) > (15.0 + x_13)? (12.0 + x_9) : (15.0 + x_13))? ((4.0 + x_7) > (11.0 + x_8)? (4.0 + x_7) : (11.0 + x_8)) : ((12.0 + x_9) > (15.0 + x_13)? (12.0 + x_9) : (15.0 + x_13)))) : ((((2.0 + x_17) > (16.0 + x_18)? (2.0 + x_17) : (16.0 + x_18)) > ((14.0 + x_19) > (13.0 + x_22)? (14.0 + x_19) : (13.0 + x_22))? ((2.0 + x_17) > (16.0 + x_18)? (2.0 + x_17) : (16.0 + x_18)) : ((14.0 + x_19) > (13.0 + x_22)? (14.0 + x_19) : (13.0 + x_22))) > (((11.0 + x_23) > (9.0 + x_25)? (11.0 + x_23) : (9.0 + x_25)) > ((9.0 + x_27) > (6.0 + x_31)? (9.0 + x_27) : (6.0 + x_31))? ((11.0 + x_23) > (9.0 + x_25)? (11.0 + x_23) : (9.0 + x_25)) : ((9.0 + x_27) > (6.0 + x_31)? (9.0 + x_27) : (6.0 + x_31)))? (((2.0 + x_17) > (16.0 + x_18)? (2.0 + x_17) : (16.0 + x_18)) > ((14.0 + x_19) > (13.0 + x_22)? (14.0 + x_19) : (13.0 + x_22))? ((2.0 + x_17) > (16.0 + x_18)? (2.0 + x_17) : (16.0 + x_18)) : ((14.0 + x_19) > (13.0 + x_22)? (14.0 + x_19) : (13.0 + x_22))) : (((11.0 + x_23) > (9.0 + x_25)? (11.0 + x_23) : (9.0 + x_25)) > ((9.0 + x_27) > (6.0 + x_31)? (9.0 + x_27) : (6.0 + x_31))? ((11.0 + x_23) > (9.0 + x_25)? (11.0 + x_23) : (9.0 + x_25)) : ((9.0 + x_27) > (6.0 + x_31)? (9.0 + x_27) : (6.0 + x_31)))));
x_5_ = (((((4.0 + x_2) > (13.0 + x_4)? (4.0 + x_2) : (13.0 + x_4)) > ((15.0 + x_5) > (11.0 + x_6)? (15.0 + x_5) : (11.0 + x_6))? ((4.0 + x_2) > (13.0 + x_4)? (4.0 + x_2) : (13.0 + x_4)) : ((15.0 + x_5) > (11.0 + x_6)? (15.0 + x_5) : (11.0 + x_6))) > (((15.0 + x_8) > (13.0 + x_10)? (15.0 + x_8) : (13.0 + x_10)) > ((7.0 + x_11) > (4.0 + x_15)? (7.0 + x_11) : (4.0 + x_15))? ((15.0 + x_8) > (13.0 + x_10)? (15.0 + x_8) : (13.0 + x_10)) : ((7.0 + x_11) > (4.0 + x_15)? (7.0 + x_11) : (4.0 + x_15)))? (((4.0 + x_2) > (13.0 + x_4)? (4.0 + x_2) : (13.0 + x_4)) > ((15.0 + x_5) > (11.0 + x_6)? (15.0 + x_5) : (11.0 + x_6))? ((4.0 + x_2) > (13.0 + x_4)? (4.0 + x_2) : (13.0 + x_4)) : ((15.0 + x_5) > (11.0 + x_6)? (15.0 + x_5) : (11.0 + x_6))) : (((15.0 + x_8) > (13.0 + x_10)? (15.0 + x_8) : (13.0 + x_10)) > ((7.0 + x_11) > (4.0 + x_15)? (7.0 + x_11) : (4.0 + x_15))? ((15.0 + x_8) > (13.0 + x_10)? (15.0 + x_8) : (13.0 + x_10)) : ((7.0 + x_11) > (4.0 + x_15)? (7.0 + x_11) : (4.0 + x_15)))) > ((((15.0 + x_16) > (17.0 + x_20)? (15.0 + x_16) : (17.0 + x_20)) > ((6.0 + x_21) > (6.0 + x_23)? (6.0 + x_21) : (6.0 + x_23))? ((15.0 + x_16) > (17.0 + x_20)? (15.0 + x_16) : (17.0 + x_20)) : ((6.0 + x_21) > (6.0 + x_23)? (6.0 + x_21) : (6.0 + x_23))) > (((1.0 + x_24) > (5.0 + x_25)? (1.0 + x_24) : (5.0 + x_25)) > ((19.0 + x_26) > (14.0 + x_29)? (19.0 + x_26) : (14.0 + x_29))? ((1.0 + x_24) > (5.0 + x_25)? (1.0 + x_24) : (5.0 + x_25)) : ((19.0 + x_26) > (14.0 + x_29)? (19.0 + x_26) : (14.0 + x_29)))? (((15.0 + x_16) > (17.0 + x_20)? (15.0 + x_16) : (17.0 + x_20)) > ((6.0 + x_21) > (6.0 + x_23)? (6.0 + x_21) : (6.0 + x_23))? ((15.0 + x_16) > (17.0 + x_20)? (15.0 + x_16) : (17.0 + x_20)) : ((6.0 + x_21) > (6.0 + x_23)? (6.0 + x_21) : (6.0 + x_23))) : (((1.0 + x_24) > (5.0 + x_25)? (1.0 + x_24) : (5.0 + x_25)) > ((19.0 + x_26) > (14.0 + x_29)? (19.0 + x_26) : (14.0 + x_29))? ((1.0 + x_24) > (5.0 + x_25)? (1.0 + x_24) : (5.0 + x_25)) : ((19.0 + x_26) > (14.0 + x_29)? (19.0 + x_26) : (14.0 + x_29))))? ((((4.0 + x_2) > (13.0 + x_4)? (4.0 + x_2) : (13.0 + x_4)) > ((15.0 + x_5) > (11.0 + x_6)? (15.0 + x_5) : (11.0 + x_6))? ((4.0 + x_2) > (13.0 + x_4)? (4.0 + x_2) : (13.0 + x_4)) : ((15.0 + x_5) > (11.0 + x_6)? (15.0 + x_5) : (11.0 + x_6))) > (((15.0 + x_8) > (13.0 + x_10)? (15.0 + x_8) : (13.0 + x_10)) > ((7.0 + x_11) > (4.0 + x_15)? (7.0 + x_11) : (4.0 + x_15))? ((15.0 + x_8) > (13.0 + x_10)? (15.0 + x_8) : (13.0 + x_10)) : ((7.0 + x_11) > (4.0 + x_15)? (7.0 + x_11) : (4.0 + x_15)))? (((4.0 + x_2) > (13.0 + x_4)? (4.0 + x_2) : (13.0 + x_4)) > ((15.0 + x_5) > (11.0 + x_6)? (15.0 + x_5) : (11.0 + x_6))? ((4.0 + x_2) > (13.0 + x_4)? (4.0 + x_2) : (13.0 + x_4)) : ((15.0 + x_5) > (11.0 + x_6)? (15.0 + x_5) : (11.0 + x_6))) : (((15.0 + x_8) > (13.0 + x_10)? (15.0 + x_8) : (13.0 + x_10)) > ((7.0 + x_11) > (4.0 + x_15)? (7.0 + x_11) : (4.0 + x_15))? ((15.0 + x_8) > (13.0 + x_10)? (15.0 + x_8) : (13.0 + x_10)) : ((7.0 + x_11) > (4.0 + x_15)? (7.0 + x_11) : (4.0 + x_15)))) : ((((15.0 + x_16) > (17.0 + x_20)? (15.0 + x_16) : (17.0 + x_20)) > ((6.0 + x_21) > (6.0 + x_23)? (6.0 + x_21) : (6.0 + x_23))? ((15.0 + x_16) > (17.0 + x_20)? (15.0 + x_16) : (17.0 + x_20)) : ((6.0 + x_21) > (6.0 + x_23)? (6.0 + x_21) : (6.0 + x_23))) > (((1.0 + x_24) > (5.0 + x_25)? (1.0 + x_24) : (5.0 + x_25)) > ((19.0 + x_26) > (14.0 + x_29)? (19.0 + x_26) : (14.0 + x_29))? ((1.0 + x_24) > (5.0 + x_25)? (1.0 + x_24) : (5.0 + x_25)) : ((19.0 + x_26) > (14.0 + x_29)? (19.0 + x_26) : (14.0 + x_29)))? (((15.0 + x_16) > (17.0 + x_20)? (15.0 + x_16) : (17.0 + x_20)) > ((6.0 + x_21) > (6.0 + x_23)? (6.0 + x_21) : (6.0 + x_23))? ((15.0 + x_16) > (17.0 + x_20)? (15.0 + x_16) : (17.0 + x_20)) : ((6.0 + x_21) > (6.0 + x_23)? (6.0 + x_21) : (6.0 + x_23))) : (((1.0 + x_24) > (5.0 + x_25)? (1.0 + x_24) : (5.0 + x_25)) > ((19.0 + x_26) > (14.0 + x_29)? (19.0 + x_26) : (14.0 + x_29))? ((1.0 + x_24) > (5.0 + x_25)? (1.0 + x_24) : (5.0 + x_25)) : ((19.0 + x_26) > (14.0 + x_29)? (19.0 + x_26) : (14.0 + x_29)))));
x_6_ = (((((18.0 + x_0) > (15.0 + x_1)? (18.0 + x_0) : (15.0 + x_1)) > ((20.0 + x_2) > (16.0 + x_3)? (20.0 + x_2) : (16.0 + x_3))? ((18.0 + x_0) > (15.0 + x_1)? (18.0 + x_0) : (15.0 + x_1)) : ((20.0 + x_2) > (16.0 + x_3)? (20.0 + x_2) : (16.0 + x_3))) > (((18.0 + x_5) > (16.0 + x_6)? (18.0 + x_5) : (16.0 + x_6)) > ((13.0 + x_7) > (1.0 + x_11)? (13.0 + x_7) : (1.0 + x_11))? ((18.0 + x_5) > (16.0 + x_6)? (18.0 + x_5) : (16.0 + x_6)) : ((13.0 + x_7) > (1.0 + x_11)? (13.0 + x_7) : (1.0 + x_11)))? (((18.0 + x_0) > (15.0 + x_1)? (18.0 + x_0) : (15.0 + x_1)) > ((20.0 + x_2) > (16.0 + x_3)? (20.0 + x_2) : (16.0 + x_3))? ((18.0 + x_0) > (15.0 + x_1)? (18.0 + x_0) : (15.0 + x_1)) : ((20.0 + x_2) > (16.0 + x_3)? (20.0 + x_2) : (16.0 + x_3))) : (((18.0 + x_5) > (16.0 + x_6)? (18.0 + x_5) : (16.0 + x_6)) > ((13.0 + x_7) > (1.0 + x_11)? (13.0 + x_7) : (1.0 + x_11))? ((18.0 + x_5) > (16.0 + x_6)? (18.0 + x_5) : (16.0 + x_6)) : ((13.0 + x_7) > (1.0 + x_11)? (13.0 + x_7) : (1.0 + x_11)))) > ((((1.0 + x_12) > (7.0 + x_16)? (1.0 + x_12) : (7.0 + x_16)) > ((8.0 + x_18) > (19.0 + x_20)? (8.0 + x_18) : (19.0 + x_20))? ((1.0 + x_12) > (7.0 + x_16)? (1.0 + x_12) : (7.0 + x_16)) : ((8.0 + x_18) > (19.0 + x_20)? (8.0 + x_18) : (19.0 + x_20))) > (((16.0 + x_23) > (20.0 + x_24)? (16.0 + x_23) : (20.0 + x_24)) > ((1.0 + x_26) > (17.0 + x_28)? (1.0 + x_26) : (17.0 + x_28))? ((16.0 + x_23) > (20.0 + x_24)? (16.0 + x_23) : (20.0 + x_24)) : ((1.0 + x_26) > (17.0 + x_28)? (1.0 + x_26) : (17.0 + x_28)))? (((1.0 + x_12) > (7.0 + x_16)? (1.0 + x_12) : (7.0 + x_16)) > ((8.0 + x_18) > (19.0 + x_20)? (8.0 + x_18) : (19.0 + x_20))? ((1.0 + x_12) > (7.0 + x_16)? (1.0 + x_12) : (7.0 + x_16)) : ((8.0 + x_18) > (19.0 + x_20)? (8.0 + x_18) : (19.0 + x_20))) : (((16.0 + x_23) > (20.0 + x_24)? (16.0 + x_23) : (20.0 + x_24)) > ((1.0 + x_26) > (17.0 + x_28)? (1.0 + x_26) : (17.0 + x_28))? ((16.0 + x_23) > (20.0 + x_24)? (16.0 + x_23) : (20.0 + x_24)) : ((1.0 + x_26) > (17.0 + x_28)? (1.0 + x_26) : (17.0 + x_28))))? ((((18.0 + x_0) > (15.0 + x_1)? (18.0 + x_0) : (15.0 + x_1)) > ((20.0 + x_2) > (16.0 + x_3)? (20.0 + x_2) : (16.0 + x_3))? ((18.0 + x_0) > (15.0 + x_1)? (18.0 + x_0) : (15.0 + x_1)) : ((20.0 + x_2) > (16.0 + x_3)? (20.0 + x_2) : (16.0 + x_3))) > (((18.0 + x_5) > (16.0 + x_6)? (18.0 + x_5) : (16.0 + x_6)) > ((13.0 + x_7) > (1.0 + x_11)? (13.0 + x_7) : (1.0 + x_11))? ((18.0 + x_5) > (16.0 + x_6)? (18.0 + x_5) : (16.0 + x_6)) : ((13.0 + x_7) > (1.0 + x_11)? (13.0 + x_7) : (1.0 + x_11)))? (((18.0 + x_0) > (15.0 + x_1)? (18.0 + x_0) : (15.0 + x_1)) > ((20.0 + x_2) > (16.0 + x_3)? (20.0 + x_2) : (16.0 + x_3))? ((18.0 + x_0) > (15.0 + x_1)? (18.0 + x_0) : (15.0 + x_1)) : ((20.0 + x_2) > (16.0 + x_3)? (20.0 + x_2) : (16.0 + x_3))) : (((18.0 + x_5) > (16.0 + x_6)? (18.0 + x_5) : (16.0 + x_6)) > ((13.0 + x_7) > (1.0 + x_11)? (13.0 + x_7) : (1.0 + x_11))? ((18.0 + x_5) > (16.0 + x_6)? (18.0 + x_5) : (16.0 + x_6)) : ((13.0 + x_7) > (1.0 + x_11)? (13.0 + x_7) : (1.0 + x_11)))) : ((((1.0 + x_12) > (7.0 + x_16)? (1.0 + x_12) : (7.0 + x_16)) > ((8.0 + x_18) > (19.0 + x_20)? (8.0 + x_18) : (19.0 + x_20))? ((1.0 + x_12) > (7.0 + x_16)? (1.0 + x_12) : (7.0 + x_16)) : ((8.0 + x_18) > (19.0 + x_20)? (8.0 + x_18) : (19.0 + x_20))) > (((16.0 + x_23) > (20.0 + x_24)? (16.0 + x_23) : (20.0 + x_24)) > ((1.0 + x_26) > (17.0 + x_28)? (1.0 + x_26) : (17.0 + x_28))? ((16.0 + x_23) > (20.0 + x_24)? (16.0 + x_23) : (20.0 + x_24)) : ((1.0 + x_26) > (17.0 + x_28)? (1.0 + x_26) : (17.0 + x_28)))? (((1.0 + x_12) > (7.0 + x_16)? (1.0 + x_12) : (7.0 + x_16)) > ((8.0 + x_18) > (19.0 + x_20)? (8.0 + x_18) : (19.0 + x_20))? ((1.0 + x_12) > (7.0 + x_16)? (1.0 + x_12) : (7.0 + x_16)) : ((8.0 + x_18) > (19.0 + x_20)? (8.0 + x_18) : (19.0 + x_20))) : (((16.0 + x_23) > (20.0 + x_24)? (16.0 + x_23) : (20.0 + x_24)) > ((1.0 + x_26) > (17.0 + x_28)? (1.0 + x_26) : (17.0 + x_28))? ((16.0 + x_23) > (20.0 + x_24)? (16.0 + x_23) : (20.0 + x_24)) : ((1.0 + x_26) > (17.0 + x_28)? (1.0 + x_26) : (17.0 + x_28)))));
x_7_ = (((((18.0 + x_0) > (10.0 + x_4)? (18.0 + x_0) : (10.0 + x_4)) > ((15.0 + x_5) > (6.0 + x_6)? (15.0 + x_5) : (6.0 + x_6))? ((18.0 + x_0) > (10.0 + x_4)? (18.0 + x_0) : (10.0 + x_4)) : ((15.0 + x_5) > (6.0 + x_6)? (15.0 + x_5) : (6.0 + x_6))) > (((4.0 + x_8) > (10.0 + x_9)? (4.0 + x_8) : (10.0 + x_9)) > ((12.0 + x_13) > (6.0 + x_15)? (12.0 + x_13) : (6.0 + x_15))? ((4.0 + x_8) > (10.0 + x_9)? (4.0 + x_8) : (10.0 + x_9)) : ((12.0 + x_13) > (6.0 + x_15)? (12.0 + x_13) : (6.0 + x_15)))? (((18.0 + x_0) > (10.0 + x_4)? (18.0 + x_0) : (10.0 + x_4)) > ((15.0 + x_5) > (6.0 + x_6)? (15.0 + x_5) : (6.0 + x_6))? ((18.0 + x_0) > (10.0 + x_4)? (18.0 + x_0) : (10.0 + x_4)) : ((15.0 + x_5) > (6.0 + x_6)? (15.0 + x_5) : (6.0 + x_6))) : (((4.0 + x_8) > (10.0 + x_9)? (4.0 + x_8) : (10.0 + x_9)) > ((12.0 + x_13) > (6.0 + x_15)? (12.0 + x_13) : (6.0 + x_15))? ((4.0 + x_8) > (10.0 + x_9)? (4.0 + x_8) : (10.0 + x_9)) : ((12.0 + x_13) > (6.0 + x_15)? (12.0 + x_13) : (6.0 + x_15)))) > ((((5.0 + x_18) > (20.0 + x_21)? (5.0 + x_18) : (20.0 + x_21)) > ((14.0 + x_22) > (13.0 + x_23)? (14.0 + x_22) : (13.0 + x_23))? ((5.0 + x_18) > (20.0 + x_21)? (5.0 + x_18) : (20.0 + x_21)) : ((14.0 + x_22) > (13.0 + x_23)? (14.0 + x_22) : (13.0 + x_23))) > (((3.0 + x_25) > (16.0 + x_26)? (3.0 + x_25) : (16.0 + x_26)) > ((7.0 + x_29) > (12.0 + x_30)? (7.0 + x_29) : (12.0 + x_30))? ((3.0 + x_25) > (16.0 + x_26)? (3.0 + x_25) : (16.0 + x_26)) : ((7.0 + x_29) > (12.0 + x_30)? (7.0 + x_29) : (12.0 + x_30)))? (((5.0 + x_18) > (20.0 + x_21)? (5.0 + x_18) : (20.0 + x_21)) > ((14.0 + x_22) > (13.0 + x_23)? (14.0 + x_22) : (13.0 + x_23))? ((5.0 + x_18) > (20.0 + x_21)? (5.0 + x_18) : (20.0 + x_21)) : ((14.0 + x_22) > (13.0 + x_23)? (14.0 + x_22) : (13.0 + x_23))) : (((3.0 + x_25) > (16.0 + x_26)? (3.0 + x_25) : (16.0 + x_26)) > ((7.0 + x_29) > (12.0 + x_30)? (7.0 + x_29) : (12.0 + x_30))? ((3.0 + x_25) > (16.0 + x_26)? (3.0 + x_25) : (16.0 + x_26)) : ((7.0 + x_29) > (12.0 + x_30)? (7.0 + x_29) : (12.0 + x_30))))? ((((18.0 + x_0) > (10.0 + x_4)? (18.0 + x_0) : (10.0 + x_4)) > ((15.0 + x_5) > (6.0 + x_6)? (15.0 + x_5) : (6.0 + x_6))? ((18.0 + x_0) > (10.0 + x_4)? (18.0 + x_0) : (10.0 + x_4)) : ((15.0 + x_5) > (6.0 + x_6)? (15.0 + x_5) : (6.0 + x_6))) > (((4.0 + x_8) > (10.0 + x_9)? (4.0 + x_8) : (10.0 + x_9)) > ((12.0 + x_13) > (6.0 + x_15)? (12.0 + x_13) : (6.0 + x_15))? ((4.0 + x_8) > (10.0 + x_9)? (4.0 + x_8) : (10.0 + x_9)) : ((12.0 + x_13) > (6.0 + x_15)? (12.0 + x_13) : (6.0 + x_15)))? (((18.0 + x_0) > (10.0 + x_4)? (18.0 + x_0) : (10.0 + x_4)) > ((15.0 + x_5) > (6.0 + x_6)? (15.0 + x_5) : (6.0 + x_6))? ((18.0 + x_0) > (10.0 + x_4)? (18.0 + x_0) : (10.0 + x_4)) : ((15.0 + x_5) > (6.0 + x_6)? (15.0 + x_5) : (6.0 + x_6))) : (((4.0 + x_8) > (10.0 + x_9)? (4.0 + x_8) : (10.0 + x_9)) > ((12.0 + x_13) > (6.0 + x_15)? (12.0 + x_13) : (6.0 + x_15))? ((4.0 + x_8) > (10.0 + x_9)? (4.0 + x_8) : (10.0 + x_9)) : ((12.0 + x_13) > (6.0 + x_15)? (12.0 + x_13) : (6.0 + x_15)))) : ((((5.0 + x_18) > (20.0 + x_21)? (5.0 + x_18) : (20.0 + x_21)) > ((14.0 + x_22) > (13.0 + x_23)? (14.0 + x_22) : (13.0 + x_23))? ((5.0 + x_18) > (20.0 + x_21)? (5.0 + x_18) : (20.0 + x_21)) : ((14.0 + x_22) > (13.0 + x_23)? (14.0 + x_22) : (13.0 + x_23))) > (((3.0 + x_25) > (16.0 + x_26)? (3.0 + x_25) : (16.0 + x_26)) > ((7.0 + x_29) > (12.0 + x_30)? (7.0 + x_29) : (12.0 + x_30))? ((3.0 + x_25) > (16.0 + x_26)? (3.0 + x_25) : (16.0 + x_26)) : ((7.0 + x_29) > (12.0 + x_30)? (7.0 + x_29) : (12.0 + x_30)))? (((5.0 + x_18) > (20.0 + x_21)? (5.0 + x_18) : (20.0 + x_21)) > ((14.0 + x_22) > (13.0 + x_23)? (14.0 + x_22) : (13.0 + x_23))? ((5.0 + x_18) > (20.0 + x_21)? (5.0 + x_18) : (20.0 + x_21)) : ((14.0 + x_22) > (13.0 + x_23)? (14.0 + x_22) : (13.0 + x_23))) : (((3.0 + x_25) > (16.0 + x_26)? (3.0 + x_25) : (16.0 + x_26)) > ((7.0 + x_29) > (12.0 + x_30)? (7.0 + x_29) : (12.0 + x_30))? ((3.0 + x_25) > (16.0 + x_26)? (3.0 + x_25) : (16.0 + x_26)) : ((7.0 + x_29) > (12.0 + x_30)? (7.0 + x_29) : (12.0 + x_30)))));
x_8_ = (((((11.0 + x_0) > (14.0 + x_1)? (11.0 + x_0) : (14.0 + x_1)) > ((13.0 + x_2) > (15.0 + x_3)? (13.0 + x_2) : (15.0 + x_3))? ((11.0 + x_0) > (14.0 + x_1)? (11.0 + x_0) : (14.0 + x_1)) : ((13.0 + x_2) > (15.0 + x_3)? (13.0 + x_2) : (15.0 + x_3))) > (((18.0 + x_4) > (15.0 + x_6)? (18.0 + x_4) : (15.0 + x_6)) > ((19.0 + x_9) > (17.0 + x_11)? (19.0 + x_9) : (17.0 + x_11))? ((18.0 + x_4) > (15.0 + x_6)? (18.0 + x_4) : (15.0 + x_6)) : ((19.0 + x_9) > (17.0 + x_11)? (19.0 + x_9) : (17.0 + x_11)))? (((11.0 + x_0) > (14.0 + x_1)? (11.0 + x_0) : (14.0 + x_1)) > ((13.0 + x_2) > (15.0 + x_3)? (13.0 + x_2) : (15.0 + x_3))? ((11.0 + x_0) > (14.0 + x_1)? (11.0 + x_0) : (14.0 + x_1)) : ((13.0 + x_2) > (15.0 + x_3)? (13.0 + x_2) : (15.0 + x_3))) : (((18.0 + x_4) > (15.0 + x_6)? (18.0 + x_4) : (15.0 + x_6)) > ((19.0 + x_9) > (17.0 + x_11)? (19.0 + x_9) : (17.0 + x_11))? ((18.0 + x_4) > (15.0 + x_6)? (18.0 + x_4) : (15.0 + x_6)) : ((19.0 + x_9) > (17.0 + x_11)? (19.0 + x_9) : (17.0 + x_11)))) > ((((12.0 + x_12) > (5.0 + x_13)? (12.0 + x_12) : (5.0 + x_13)) > ((13.0 + x_18) > (18.0 + x_20)? (13.0 + x_18) : (18.0 + x_20))? ((12.0 + x_12) > (5.0 + x_13)? (12.0 + x_12) : (5.0 + x_13)) : ((13.0 + x_18) > (18.0 + x_20)? (13.0 + x_18) : (18.0 + x_20))) > (((14.0 + x_24) > (17.0 + x_25)? (14.0 + x_24) : (17.0 + x_25)) > ((16.0 + x_28) > (9.0 + x_31)? (16.0 + x_28) : (9.0 + x_31))? ((14.0 + x_24) > (17.0 + x_25)? (14.0 + x_24) : (17.0 + x_25)) : ((16.0 + x_28) > (9.0 + x_31)? (16.0 + x_28) : (9.0 + x_31)))? (((12.0 + x_12) > (5.0 + x_13)? (12.0 + x_12) : (5.0 + x_13)) > ((13.0 + x_18) > (18.0 + x_20)? (13.0 + x_18) : (18.0 + x_20))? ((12.0 + x_12) > (5.0 + x_13)? (12.0 + x_12) : (5.0 + x_13)) : ((13.0 + x_18) > (18.0 + x_20)? (13.0 + x_18) : (18.0 + x_20))) : (((14.0 + x_24) > (17.0 + x_25)? (14.0 + x_24) : (17.0 + x_25)) > ((16.0 + x_28) > (9.0 + x_31)? (16.0 + x_28) : (9.0 + x_31))? ((14.0 + x_24) > (17.0 + x_25)? (14.0 + x_24) : (17.0 + x_25)) : ((16.0 + x_28) > (9.0 + x_31)? (16.0 + x_28) : (9.0 + x_31))))? ((((11.0 + x_0) > (14.0 + x_1)? (11.0 + x_0) : (14.0 + x_1)) > ((13.0 + x_2) > (15.0 + x_3)? (13.0 + x_2) : (15.0 + x_3))? ((11.0 + x_0) > (14.0 + x_1)? (11.0 + x_0) : (14.0 + x_1)) : ((13.0 + x_2) > (15.0 + x_3)? (13.0 + x_2) : (15.0 + x_3))) > (((18.0 + x_4) > (15.0 + x_6)? (18.0 + x_4) : (15.0 + x_6)) > ((19.0 + x_9) > (17.0 + x_11)? (19.0 + x_9) : (17.0 + x_11))? ((18.0 + x_4) > (15.0 + x_6)? (18.0 + x_4) : (15.0 + x_6)) : ((19.0 + x_9) > (17.0 + x_11)? (19.0 + x_9) : (17.0 + x_11)))? (((11.0 + x_0) > (14.0 + x_1)? (11.0 + x_0) : (14.0 + x_1)) > ((13.0 + x_2) > (15.0 + x_3)? (13.0 + x_2) : (15.0 + x_3))? ((11.0 + x_0) > (14.0 + x_1)? (11.0 + x_0) : (14.0 + x_1)) : ((13.0 + x_2) > (15.0 + x_3)? (13.0 + x_2) : (15.0 + x_3))) : (((18.0 + x_4) > (15.0 + x_6)? (18.0 + x_4) : (15.0 + x_6)) > ((19.0 + x_9) > (17.0 + x_11)? (19.0 + x_9) : (17.0 + x_11))? ((18.0 + x_4) > (15.0 + x_6)? (18.0 + x_4) : (15.0 + x_6)) : ((19.0 + x_9) > (17.0 + x_11)? (19.0 + x_9) : (17.0 + x_11)))) : ((((12.0 + x_12) > (5.0 + x_13)? (12.0 + x_12) : (5.0 + x_13)) > ((13.0 + x_18) > (18.0 + x_20)? (13.0 + x_18) : (18.0 + x_20))? ((12.0 + x_12) > (5.0 + x_13)? (12.0 + x_12) : (5.0 + x_13)) : ((13.0 + x_18) > (18.0 + x_20)? (13.0 + x_18) : (18.0 + x_20))) > (((14.0 + x_24) > (17.0 + x_25)? (14.0 + x_24) : (17.0 + x_25)) > ((16.0 + x_28) > (9.0 + x_31)? (16.0 + x_28) : (9.0 + x_31))? ((14.0 + x_24) > (17.0 + x_25)? (14.0 + x_24) : (17.0 + x_25)) : ((16.0 + x_28) > (9.0 + x_31)? (16.0 + x_28) : (9.0 + x_31)))? (((12.0 + x_12) > (5.0 + x_13)? (12.0 + x_12) : (5.0 + x_13)) > ((13.0 + x_18) > (18.0 + x_20)? (13.0 + x_18) : (18.0 + x_20))? ((12.0 + x_12) > (5.0 + x_13)? (12.0 + x_12) : (5.0 + x_13)) : ((13.0 + x_18) > (18.0 + x_20)? (13.0 + x_18) : (18.0 + x_20))) : (((14.0 + x_24) > (17.0 + x_25)? (14.0 + x_24) : (17.0 + x_25)) > ((16.0 + x_28) > (9.0 + x_31)? (16.0 + x_28) : (9.0 + x_31))? ((14.0 + x_24) > (17.0 + x_25)? (14.0 + x_24) : (17.0 + x_25)) : ((16.0 + x_28) > (9.0 + x_31)? (16.0 + x_28) : (9.0 + x_31)))));
x_9_ = (((((4.0 + x_0) > (7.0 + x_2)? (4.0 + x_0) : (7.0 + x_2)) > ((10.0 + x_3) > (6.0 + x_4)? (10.0 + x_3) : (6.0 + x_4))? ((4.0 + x_0) > (7.0 + x_2)? (4.0 + x_0) : (7.0 + x_2)) : ((10.0 + x_3) > (6.0 + x_4)? (10.0 + x_3) : (6.0 + x_4))) > (((7.0 + x_5) > (8.0 + x_6)? (7.0 + x_5) : (8.0 + x_6)) > ((2.0 + x_9) > (11.0 + x_15)? (2.0 + x_9) : (11.0 + x_15))? ((7.0 + x_5) > (8.0 + x_6)? (7.0 + x_5) : (8.0 + x_6)) : ((2.0 + x_9) > (11.0 + x_15)? (2.0 + x_9) : (11.0 + x_15)))? (((4.0 + x_0) > (7.0 + x_2)? (4.0 + x_0) : (7.0 + x_2)) > ((10.0 + x_3) > (6.0 + x_4)? (10.0 + x_3) : (6.0 + x_4))? ((4.0 + x_0) > (7.0 + x_2)? (4.0 + x_0) : (7.0 + x_2)) : ((10.0 + x_3) > (6.0 + x_4)? (10.0 + x_3) : (6.0 + x_4))) : (((7.0 + x_5) > (8.0 + x_6)? (7.0 + x_5) : (8.0 + x_6)) > ((2.0 + x_9) > (11.0 + x_15)? (2.0 + x_9) : (11.0 + x_15))? ((7.0 + x_5) > (8.0 + x_6)? (7.0 + x_5) : (8.0 + x_6)) : ((2.0 + x_9) > (11.0 + x_15)? (2.0 + x_9) : (11.0 + x_15)))) > ((((18.0 + x_16) > (17.0 + x_18)? (18.0 + x_16) : (17.0 + x_18)) > ((1.0 + x_21) > (6.0 + x_26)? (1.0 + x_21) : (6.0 + x_26))? ((18.0 + x_16) > (17.0 + x_18)? (18.0 + x_16) : (17.0 + x_18)) : ((1.0 + x_21) > (6.0 + x_26)? (1.0 + x_21) : (6.0 + x_26))) > (((4.0 + x_28) > (4.0 + x_29)? (4.0 + x_28) : (4.0 + x_29)) > ((20.0 + x_30) > (20.0 + x_31)? (20.0 + x_30) : (20.0 + x_31))? ((4.0 + x_28) > (4.0 + x_29)? (4.0 + x_28) : (4.0 + x_29)) : ((20.0 + x_30) > (20.0 + x_31)? (20.0 + x_30) : (20.0 + x_31)))? (((18.0 + x_16) > (17.0 + x_18)? (18.0 + x_16) : (17.0 + x_18)) > ((1.0 + x_21) > (6.0 + x_26)? (1.0 + x_21) : (6.0 + x_26))? ((18.0 + x_16) > (17.0 + x_18)? (18.0 + x_16) : (17.0 + x_18)) : ((1.0 + x_21) > (6.0 + x_26)? (1.0 + x_21) : (6.0 + x_26))) : (((4.0 + x_28) > (4.0 + x_29)? (4.0 + x_28) : (4.0 + x_29)) > ((20.0 + x_30) > (20.0 + x_31)? (20.0 + x_30) : (20.0 + x_31))? ((4.0 + x_28) > (4.0 + x_29)? (4.0 + x_28) : (4.0 + x_29)) : ((20.0 + x_30) > (20.0 + x_31)? (20.0 + x_30) : (20.0 + x_31))))? ((((4.0 + x_0) > (7.0 + x_2)? (4.0 + x_0) : (7.0 + x_2)) > ((10.0 + x_3) > (6.0 + x_4)? (10.0 + x_3) : (6.0 + x_4))? ((4.0 + x_0) > (7.0 + x_2)? (4.0 + x_0) : (7.0 + x_2)) : ((10.0 + x_3) > (6.0 + x_4)? (10.0 + x_3) : (6.0 + x_4))) > (((7.0 + x_5) > (8.0 + x_6)? (7.0 + x_5) : (8.0 + x_6)) > ((2.0 + x_9) > (11.0 + x_15)? (2.0 + x_9) : (11.0 + x_15))? ((7.0 + x_5) > (8.0 + x_6)? (7.0 + x_5) : (8.0 + x_6)) : ((2.0 + x_9) > (11.0 + x_15)? (2.0 + x_9) : (11.0 + x_15)))? (((4.0 + x_0) > (7.0 + x_2)? (4.0 + x_0) : (7.0 + x_2)) > ((10.0 + x_3) > (6.0 + x_4)? (10.0 + x_3) : (6.0 + x_4))? ((4.0 + x_0) > (7.0 + x_2)? (4.0 + x_0) : (7.0 + x_2)) : ((10.0 + x_3) > (6.0 + x_4)? (10.0 + x_3) : (6.0 + x_4))) : (((7.0 + x_5) > (8.0 + x_6)? (7.0 + x_5) : (8.0 + x_6)) > ((2.0 + x_9) > (11.0 + x_15)? (2.0 + x_9) : (11.0 + x_15))? ((7.0 + x_5) > (8.0 + x_6)? (7.0 + x_5) : (8.0 + x_6)) : ((2.0 + x_9) > (11.0 + x_15)? (2.0 + x_9) : (11.0 + x_15)))) : ((((18.0 + x_16) > (17.0 + x_18)? (18.0 + x_16) : (17.0 + x_18)) > ((1.0 + x_21) > (6.0 + x_26)? (1.0 + x_21) : (6.0 + x_26))? ((18.0 + x_16) > (17.0 + x_18)? (18.0 + x_16) : (17.0 + x_18)) : ((1.0 + x_21) > (6.0 + x_26)? (1.0 + x_21) : (6.0 + x_26))) > (((4.0 + x_28) > (4.0 + x_29)? (4.0 + x_28) : (4.0 + x_29)) > ((20.0 + x_30) > (20.0 + x_31)? (20.0 + x_30) : (20.0 + x_31))? ((4.0 + x_28) > (4.0 + x_29)? (4.0 + x_28) : (4.0 + x_29)) : ((20.0 + x_30) > (20.0 + x_31)? (20.0 + x_30) : (20.0 + x_31)))? (((18.0 + x_16) > (17.0 + x_18)? (18.0 + x_16) : (17.0 + x_18)) > ((1.0 + x_21) > (6.0 + x_26)? (1.0 + x_21) : (6.0 + x_26))? ((18.0 + x_16) > (17.0 + x_18)? (18.0 + x_16) : (17.0 + x_18)) : ((1.0 + x_21) > (6.0 + x_26)? (1.0 + x_21) : (6.0 + x_26))) : (((4.0 + x_28) > (4.0 + x_29)? (4.0 + x_28) : (4.0 + x_29)) > ((20.0 + x_30) > (20.0 + x_31)? (20.0 + x_30) : (20.0 + x_31))? ((4.0 + x_28) > (4.0 + x_29)? (4.0 + x_28) : (4.0 + x_29)) : ((20.0 + x_30) > (20.0 + x_31)? (20.0 + x_30) : (20.0 + x_31)))));
x_10_ = (((((14.0 + x_1) > (15.0 + x_2)? (14.0 + x_1) : (15.0 + x_2)) > ((14.0 + x_3) > (8.0 + x_7)? (14.0 + x_3) : (8.0 + x_7))? ((14.0 + x_1) > (15.0 + x_2)? (14.0 + x_1) : (15.0 + x_2)) : ((14.0 + x_3) > (8.0 + x_7)? (14.0 + x_3) : (8.0 + x_7))) > (((10.0 + x_10) > (8.0 + x_13)? (10.0 + x_10) : (8.0 + x_13)) > ((1.0 + x_14) > (4.0 + x_15)? (1.0 + x_14) : (4.0 + x_15))? ((10.0 + x_10) > (8.0 + x_13)? (10.0 + x_10) : (8.0 + x_13)) : ((1.0 + x_14) > (4.0 + x_15)? (1.0 + x_14) : (4.0 + x_15)))? (((14.0 + x_1) > (15.0 + x_2)? (14.0 + x_1) : (15.0 + x_2)) > ((14.0 + x_3) > (8.0 + x_7)? (14.0 + x_3) : (8.0 + x_7))? ((14.0 + x_1) > (15.0 + x_2)? (14.0 + x_1) : (15.0 + x_2)) : ((14.0 + x_3) > (8.0 + x_7)? (14.0 + x_3) : (8.0 + x_7))) : (((10.0 + x_10) > (8.0 + x_13)? (10.0 + x_10) : (8.0 + x_13)) > ((1.0 + x_14) > (4.0 + x_15)? (1.0 + x_14) : (4.0 + x_15))? ((10.0 + x_10) > (8.0 + x_13)? (10.0 + x_10) : (8.0 + x_13)) : ((1.0 + x_14) > (4.0 + x_15)? (1.0 + x_14) : (4.0 + x_15)))) > ((((19.0 + x_16) > (13.0 + x_18)? (19.0 + x_16) : (13.0 + x_18)) > ((5.0 + x_20) > (15.0 + x_21)? (5.0 + x_20) : (15.0 + x_21))? ((19.0 + x_16) > (13.0 + x_18)? (19.0 + x_16) : (13.0 + x_18)) : ((5.0 + x_20) > (15.0 + x_21)? (5.0 + x_20) : (15.0 + x_21))) > (((14.0 + x_22) > (19.0 + x_28)? (14.0 + x_22) : (19.0 + x_28)) > ((17.0 + x_29) > (4.0 + x_30)? (17.0 + x_29) : (4.0 + x_30))? ((14.0 + x_22) > (19.0 + x_28)? (14.0 + x_22) : (19.0 + x_28)) : ((17.0 + x_29) > (4.0 + x_30)? (17.0 + x_29) : (4.0 + x_30)))? (((19.0 + x_16) > (13.0 + x_18)? (19.0 + x_16) : (13.0 + x_18)) > ((5.0 + x_20) > (15.0 + x_21)? (5.0 + x_20) : (15.0 + x_21))? ((19.0 + x_16) > (13.0 + x_18)? (19.0 + x_16) : (13.0 + x_18)) : ((5.0 + x_20) > (15.0 + x_21)? (5.0 + x_20) : (15.0 + x_21))) : (((14.0 + x_22) > (19.0 + x_28)? (14.0 + x_22) : (19.0 + x_28)) > ((17.0 + x_29) > (4.0 + x_30)? (17.0 + x_29) : (4.0 + x_30))? ((14.0 + x_22) > (19.0 + x_28)? (14.0 + x_22) : (19.0 + x_28)) : ((17.0 + x_29) > (4.0 + x_30)? (17.0 + x_29) : (4.0 + x_30))))? ((((14.0 + x_1) > (15.0 + x_2)? (14.0 + x_1) : (15.0 + x_2)) > ((14.0 + x_3) > (8.0 + x_7)? (14.0 + x_3) : (8.0 + x_7))? ((14.0 + x_1) > (15.0 + x_2)? (14.0 + x_1) : (15.0 + x_2)) : ((14.0 + x_3) > (8.0 + x_7)? (14.0 + x_3) : (8.0 + x_7))) > (((10.0 + x_10) > (8.0 + x_13)? (10.0 + x_10) : (8.0 + x_13)) > ((1.0 + x_14) > (4.0 + x_15)? (1.0 + x_14) : (4.0 + x_15))? ((10.0 + x_10) > (8.0 + x_13)? (10.0 + x_10) : (8.0 + x_13)) : ((1.0 + x_14) > (4.0 + x_15)? (1.0 + x_14) : (4.0 + x_15)))? (((14.0 + x_1) > (15.0 + x_2)? (14.0 + x_1) : (15.0 + x_2)) > ((14.0 + x_3) > (8.0 + x_7)? (14.0 + x_3) : (8.0 + x_7))? ((14.0 + x_1) > (15.0 + x_2)? (14.0 + x_1) : (15.0 + x_2)) : ((14.0 + x_3) > (8.0 + x_7)? (14.0 + x_3) : (8.0 + x_7))) : (((10.0 + x_10) > (8.0 + x_13)? (10.0 + x_10) : (8.0 + x_13)) > ((1.0 + x_14) > (4.0 + x_15)? (1.0 + x_14) : (4.0 + x_15))? ((10.0 + x_10) > (8.0 + x_13)? (10.0 + x_10) : (8.0 + x_13)) : ((1.0 + x_14) > (4.0 + x_15)? (1.0 + x_14) : (4.0 + x_15)))) : ((((19.0 + x_16) > (13.0 + x_18)? (19.0 + x_16) : (13.0 + x_18)) > ((5.0 + x_20) > (15.0 + x_21)? (5.0 + x_20) : (15.0 + x_21))? ((19.0 + x_16) > (13.0 + x_18)? (19.0 + x_16) : (13.0 + x_18)) : ((5.0 + x_20) > (15.0 + x_21)? (5.0 + x_20) : (15.0 + x_21))) > (((14.0 + x_22) > (19.0 + x_28)? (14.0 + x_22) : (19.0 + x_28)) > ((17.0 + x_29) > (4.0 + x_30)? (17.0 + x_29) : (4.0 + x_30))? ((14.0 + x_22) > (19.0 + x_28)? (14.0 + x_22) : (19.0 + x_28)) : ((17.0 + x_29) > (4.0 + x_30)? (17.0 + x_29) : (4.0 + x_30)))? (((19.0 + x_16) > (13.0 + x_18)? (19.0 + x_16) : (13.0 + x_18)) > ((5.0 + x_20) > (15.0 + x_21)? (5.0 + x_20) : (15.0 + x_21))? ((19.0 + x_16) > (13.0 + x_18)? (19.0 + x_16) : (13.0 + x_18)) : ((5.0 + x_20) > (15.0 + x_21)? (5.0 + x_20) : (15.0 + x_21))) : (((14.0 + x_22) > (19.0 + x_28)? (14.0 + x_22) : (19.0 + x_28)) > ((17.0 + x_29) > (4.0 + x_30)? (17.0 + x_29) : (4.0 + x_30))? ((14.0 + x_22) > (19.0 + x_28)? (14.0 + x_22) : (19.0 + x_28)) : ((17.0 + x_29) > (4.0 + x_30)? (17.0 + x_29) : (4.0 + x_30)))));
x_11_ = (((((18.0 + x_0) > (16.0 + x_2)? (18.0 + x_0) : (16.0 + x_2)) > ((2.0 + x_5) > (16.0 + x_6)? (2.0 + x_5) : (16.0 + x_6))? ((18.0 + x_0) > (16.0 + x_2)? (18.0 + x_0) : (16.0 + x_2)) : ((2.0 + x_5) > (16.0 + x_6)? (2.0 + x_5) : (16.0 + x_6))) > (((5.0 + x_8) > (3.0 + x_11)? (5.0 + x_8) : (3.0 + x_11)) > ((7.0 + x_12) > (4.0 + x_15)? (7.0 + x_12) : (4.0 + x_15))? ((5.0 + x_8) > (3.0 + x_11)? (5.0 + x_8) : (3.0 + x_11)) : ((7.0 + x_12) > (4.0 + x_15)? (7.0 + x_12) : (4.0 + x_15)))? (((18.0 + x_0) > (16.0 + x_2)? (18.0 + x_0) : (16.0 + x_2)) > ((2.0 + x_5) > (16.0 + x_6)? (2.0 + x_5) : (16.0 + x_6))? ((18.0 + x_0) > (16.0 + x_2)? (18.0 + x_0) : (16.0 + x_2)) : ((2.0 + x_5) > (16.0 + x_6)? (2.0 + x_5) : (16.0 + x_6))) : (((5.0 + x_8) > (3.0 + x_11)? (5.0 + x_8) : (3.0 + x_11)) > ((7.0 + x_12) > (4.0 + x_15)? (7.0 + x_12) : (4.0 + x_15))? ((5.0 + x_8) > (3.0 + x_11)? (5.0 + x_8) : (3.0 + x_11)) : ((7.0 + x_12) > (4.0 + x_15)? (7.0 + x_12) : (4.0 + x_15)))) > ((((5.0 + x_16) > (20.0 + x_19)? (5.0 + x_16) : (20.0 + x_19)) > ((2.0 + x_21) > (17.0 + x_24)? (2.0 + x_21) : (17.0 + x_24))? ((5.0 + x_16) > (20.0 + x_19)? (5.0 + x_16) : (20.0 + x_19)) : ((2.0 + x_21) > (17.0 + x_24)? (2.0 + x_21) : (17.0 + x_24))) > (((9.0 + x_26) > (12.0 + x_28)? (9.0 + x_26) : (12.0 + x_28)) > ((12.0 + x_30) > (16.0 + x_31)? (12.0 + x_30) : (16.0 + x_31))? ((9.0 + x_26) > (12.0 + x_28)? (9.0 + x_26) : (12.0 + x_28)) : ((12.0 + x_30) > (16.0 + x_31)? (12.0 + x_30) : (16.0 + x_31)))? (((5.0 + x_16) > (20.0 + x_19)? (5.0 + x_16) : (20.0 + x_19)) > ((2.0 + x_21) > (17.0 + x_24)? (2.0 + x_21) : (17.0 + x_24))? ((5.0 + x_16) > (20.0 + x_19)? (5.0 + x_16) : (20.0 + x_19)) : ((2.0 + x_21) > (17.0 + x_24)? (2.0 + x_21) : (17.0 + x_24))) : (((9.0 + x_26) > (12.0 + x_28)? (9.0 + x_26) : (12.0 + x_28)) > ((12.0 + x_30) > (16.0 + x_31)? (12.0 + x_30) : (16.0 + x_31))? ((9.0 + x_26) > (12.0 + x_28)? (9.0 + x_26) : (12.0 + x_28)) : ((12.0 + x_30) > (16.0 + x_31)? (12.0 + x_30) : (16.0 + x_31))))? ((((18.0 + x_0) > (16.0 + x_2)? (18.0 + x_0) : (16.0 + x_2)) > ((2.0 + x_5) > (16.0 + x_6)? (2.0 + x_5) : (16.0 + x_6))? ((18.0 + x_0) > (16.0 + x_2)? (18.0 + x_0) : (16.0 + x_2)) : ((2.0 + x_5) > (16.0 + x_6)? (2.0 + x_5) : (16.0 + x_6))) > (((5.0 + x_8) > (3.0 + x_11)? (5.0 + x_8) : (3.0 + x_11)) > ((7.0 + x_12) > (4.0 + x_15)? (7.0 + x_12) : (4.0 + x_15))? ((5.0 + x_8) > (3.0 + x_11)? (5.0 + x_8) : (3.0 + x_11)) : ((7.0 + x_12) > (4.0 + x_15)? (7.0 + x_12) : (4.0 + x_15)))? (((18.0 + x_0) > (16.0 + x_2)? (18.0 + x_0) : (16.0 + x_2)) > ((2.0 + x_5) > (16.0 + x_6)? (2.0 + x_5) : (16.0 + x_6))? ((18.0 + x_0) > (16.0 + x_2)? (18.0 + x_0) : (16.0 + x_2)) : ((2.0 + x_5) > (16.0 + x_6)? (2.0 + x_5) : (16.0 + x_6))) : (((5.0 + x_8) > (3.0 + x_11)? (5.0 + x_8) : (3.0 + x_11)) > ((7.0 + x_12) > (4.0 + x_15)? (7.0 + x_12) : (4.0 + x_15))? ((5.0 + x_8) > (3.0 + x_11)? (5.0 + x_8) : (3.0 + x_11)) : ((7.0 + x_12) > (4.0 + x_15)? (7.0 + x_12) : (4.0 + x_15)))) : ((((5.0 + x_16) > (20.0 + x_19)? (5.0 + x_16) : (20.0 + x_19)) > ((2.0 + x_21) > (17.0 + x_24)? (2.0 + x_21) : (17.0 + x_24))? ((5.0 + x_16) > (20.0 + x_19)? (5.0 + x_16) : (20.0 + x_19)) : ((2.0 + x_21) > (17.0 + x_24)? (2.0 + x_21) : (17.0 + x_24))) > (((9.0 + x_26) > (12.0 + x_28)? (9.0 + x_26) : (12.0 + x_28)) > ((12.0 + x_30) > (16.0 + x_31)? (12.0 + x_30) : (16.0 + x_31))? ((9.0 + x_26) > (12.0 + x_28)? (9.0 + x_26) : (12.0 + x_28)) : ((12.0 + x_30) > (16.0 + x_31)? (12.0 + x_30) : (16.0 + x_31)))? (((5.0 + x_16) > (20.0 + x_19)? (5.0 + x_16) : (20.0 + x_19)) > ((2.0 + x_21) > (17.0 + x_24)? (2.0 + x_21) : (17.0 + x_24))? ((5.0 + x_16) > (20.0 + x_19)? (5.0 + x_16) : (20.0 + x_19)) : ((2.0 + x_21) > (17.0 + x_24)? (2.0 + x_21) : (17.0 + x_24))) : (((9.0 + x_26) > (12.0 + x_28)? (9.0 + x_26) : (12.0 + x_28)) > ((12.0 + x_30) > (16.0 + x_31)? (12.0 + x_30) : (16.0 + x_31))? ((9.0 + x_26) > (12.0 + x_28)? (9.0 + x_26) : (12.0 + x_28)) : ((12.0 + x_30) > (16.0 + x_31)? (12.0 + x_30) : (16.0 + x_31)))));
x_12_ = (((((9.0 + x_0) > (3.0 + x_2)? (9.0 + x_0) : (3.0 + x_2)) > ((4.0 + x_4) > (14.0 + x_5)? (4.0 + x_4) : (14.0 + x_5))? ((9.0 + x_0) > (3.0 + x_2)? (9.0 + x_0) : (3.0 + x_2)) : ((4.0 + x_4) > (14.0 + x_5)? (4.0 + x_4) : (14.0 + x_5))) > (((9.0 + x_7) > (14.0 + x_9)? (9.0 + x_7) : (14.0 + x_9)) > ((4.0 + x_10) > (2.0 + x_11)? (4.0 + x_10) : (2.0 + x_11))? ((9.0 + x_7) > (14.0 + x_9)? (9.0 + x_7) : (14.0 + x_9)) : ((4.0 + x_10) > (2.0 + x_11)? (4.0 + x_10) : (2.0 + x_11)))? (((9.0 + x_0) > (3.0 + x_2)? (9.0 + x_0) : (3.0 + x_2)) > ((4.0 + x_4) > (14.0 + x_5)? (4.0 + x_4) : (14.0 + x_5))? ((9.0 + x_0) > (3.0 + x_2)? (9.0 + x_0) : (3.0 + x_2)) : ((4.0 + x_4) > (14.0 + x_5)? (4.0 + x_4) : (14.0 + x_5))) : (((9.0 + x_7) > (14.0 + x_9)? (9.0 + x_7) : (14.0 + x_9)) > ((4.0 + x_10) > (2.0 + x_11)? (4.0 + x_10) : (2.0 + x_11))? ((9.0 + x_7) > (14.0 + x_9)? (9.0 + x_7) : (14.0 + x_9)) : ((4.0 + x_10) > (2.0 + x_11)? (4.0 + x_10) : (2.0 + x_11)))) > ((((18.0 + x_12) > (11.0 + x_17)? (18.0 + x_12) : (11.0 + x_17)) > ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19))? ((18.0 + x_12) > (11.0 + x_17)? (18.0 + x_12) : (11.0 + x_17)) : ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19))) > (((20.0 + x_20) > (18.0 + x_26)? (20.0 + x_20) : (18.0 + x_26)) > ((11.0 + x_28) > (16.0 + x_30)? (11.0 + x_28) : (16.0 + x_30))? ((20.0 + x_20) > (18.0 + x_26)? (20.0 + x_20) : (18.0 + x_26)) : ((11.0 + x_28) > (16.0 + x_30)? (11.0 + x_28) : (16.0 + x_30)))? (((18.0 + x_12) > (11.0 + x_17)? (18.0 + x_12) : (11.0 + x_17)) > ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19))? ((18.0 + x_12) > (11.0 + x_17)? (18.0 + x_12) : (11.0 + x_17)) : ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19))) : (((20.0 + x_20) > (18.0 + x_26)? (20.0 + x_20) : (18.0 + x_26)) > ((11.0 + x_28) > (16.0 + x_30)? (11.0 + x_28) : (16.0 + x_30))? ((20.0 + x_20) > (18.0 + x_26)? (20.0 + x_20) : (18.0 + x_26)) : ((11.0 + x_28) > (16.0 + x_30)? (11.0 + x_28) : (16.0 + x_30))))? ((((9.0 + x_0) > (3.0 + x_2)? (9.0 + x_0) : (3.0 + x_2)) > ((4.0 + x_4) > (14.0 + x_5)? (4.0 + x_4) : (14.0 + x_5))? ((9.0 + x_0) > (3.0 + x_2)? (9.0 + x_0) : (3.0 + x_2)) : ((4.0 + x_4) > (14.0 + x_5)? (4.0 + x_4) : (14.0 + x_5))) > (((9.0 + x_7) > (14.0 + x_9)? (9.0 + x_7) : (14.0 + x_9)) > ((4.0 + x_10) > (2.0 + x_11)? (4.0 + x_10) : (2.0 + x_11))? ((9.0 + x_7) > (14.0 + x_9)? (9.0 + x_7) : (14.0 + x_9)) : ((4.0 + x_10) > (2.0 + x_11)? (4.0 + x_10) : (2.0 + x_11)))? (((9.0 + x_0) > (3.0 + x_2)? (9.0 + x_0) : (3.0 + x_2)) > ((4.0 + x_4) > (14.0 + x_5)? (4.0 + x_4) : (14.0 + x_5))? ((9.0 + x_0) > (3.0 + x_2)? (9.0 + x_0) : (3.0 + x_2)) : ((4.0 + x_4) > (14.0 + x_5)? (4.0 + x_4) : (14.0 + x_5))) : (((9.0 + x_7) > (14.0 + x_9)? (9.0 + x_7) : (14.0 + x_9)) > ((4.0 + x_10) > (2.0 + x_11)? (4.0 + x_10) : (2.0 + x_11))? ((9.0 + x_7) > (14.0 + x_9)? (9.0 + x_7) : (14.0 + x_9)) : ((4.0 + x_10) > (2.0 + x_11)? (4.0 + x_10) : (2.0 + x_11)))) : ((((18.0 + x_12) > (11.0 + x_17)? (18.0 + x_12) : (11.0 + x_17)) > ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19))? ((18.0 + x_12) > (11.0 + x_17)? (18.0 + x_12) : (11.0 + x_17)) : ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19))) > (((20.0 + x_20) > (18.0 + x_26)? (20.0 + x_20) : (18.0 + x_26)) > ((11.0 + x_28) > (16.0 + x_30)? (11.0 + x_28) : (16.0 + x_30))? ((20.0 + x_20) > (18.0 + x_26)? (20.0 + x_20) : (18.0 + x_26)) : ((11.0 + x_28) > (16.0 + x_30)? (11.0 + x_28) : (16.0 + x_30)))? (((18.0 + x_12) > (11.0 + x_17)? (18.0 + x_12) : (11.0 + x_17)) > ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19))? ((18.0 + x_12) > (11.0 + x_17)? (18.0 + x_12) : (11.0 + x_17)) : ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19))) : (((20.0 + x_20) > (18.0 + x_26)? (20.0 + x_20) : (18.0 + x_26)) > ((11.0 + x_28) > (16.0 + x_30)? (11.0 + x_28) : (16.0 + x_30))? ((20.0 + x_20) > (18.0 + x_26)? (20.0 + x_20) : (18.0 + x_26)) : ((11.0 + x_28) > (16.0 + x_30)? (11.0 + x_28) : (16.0 + x_30)))));
x_13_ = (((((16.0 + x_0) > (9.0 + x_1)? (16.0 + x_0) : (9.0 + x_1)) > ((13.0 + x_3) > (12.0 + x_8)? (13.0 + x_3) : (12.0 + x_8))? ((16.0 + x_0) > (9.0 + x_1)? (16.0 + x_0) : (9.0 + x_1)) : ((13.0 + x_3) > (12.0 + x_8)? (13.0 + x_3) : (12.0 + x_8))) > (((15.0 + x_10) > (4.0 + x_13)? (15.0 + x_10) : (4.0 + x_13)) > ((16.0 + x_15) > (13.0 + x_16)? (16.0 + x_15) : (13.0 + x_16))? ((15.0 + x_10) > (4.0 + x_13)? (15.0 + x_10) : (4.0 + x_13)) : ((16.0 + x_15) > (13.0 + x_16)? (16.0 + x_15) : (13.0 + x_16)))? (((16.0 + x_0) > (9.0 + x_1)? (16.0 + x_0) : (9.0 + x_1)) > ((13.0 + x_3) > (12.0 + x_8)? (13.0 + x_3) : (12.0 + x_8))? ((16.0 + x_0) > (9.0 + x_1)? (16.0 + x_0) : (9.0 + x_1)) : ((13.0 + x_3) > (12.0 + x_8)? (13.0 + x_3) : (12.0 + x_8))) : (((15.0 + x_10) > (4.0 + x_13)? (15.0 + x_10) : (4.0 + x_13)) > ((16.0 + x_15) > (13.0 + x_16)? (16.0 + x_15) : (13.0 + x_16))? ((15.0 + x_10) > (4.0 + x_13)? (15.0 + x_10) : (4.0 + x_13)) : ((16.0 + x_15) > (13.0 + x_16)? (16.0 + x_15) : (13.0 + x_16)))) > ((((19.0 + x_17) > (8.0 + x_18)? (19.0 + x_17) : (8.0 + x_18)) > ((18.0 + x_20) > (2.0 + x_23)? (18.0 + x_20) : (2.0 + x_23))? ((19.0 + x_17) > (8.0 + x_18)? (19.0 + x_17) : (8.0 + x_18)) : ((18.0 + x_20) > (2.0 + x_23)? (18.0 + x_20) : (2.0 + x_23))) > (((14.0 + x_26) > (18.0 + x_27)? (14.0 + x_26) : (18.0 + x_27)) > ((14.0 + x_30) > (1.0 + x_31)? (14.0 + x_30) : (1.0 + x_31))? ((14.0 + x_26) > (18.0 + x_27)? (14.0 + x_26) : (18.0 + x_27)) : ((14.0 + x_30) > (1.0 + x_31)? (14.0 + x_30) : (1.0 + x_31)))? (((19.0 + x_17) > (8.0 + x_18)? (19.0 + x_17) : (8.0 + x_18)) > ((18.0 + x_20) > (2.0 + x_23)? (18.0 + x_20) : (2.0 + x_23))? ((19.0 + x_17) > (8.0 + x_18)? (19.0 + x_17) : (8.0 + x_18)) : ((18.0 + x_20) > (2.0 + x_23)? (18.0 + x_20) : (2.0 + x_23))) : (((14.0 + x_26) > (18.0 + x_27)? (14.0 + x_26) : (18.0 + x_27)) > ((14.0 + x_30) > (1.0 + x_31)? (14.0 + x_30) : (1.0 + x_31))? ((14.0 + x_26) > (18.0 + x_27)? (14.0 + x_26) : (18.0 + x_27)) : ((14.0 + x_30) > (1.0 + x_31)? (14.0 + x_30) : (1.0 + x_31))))? ((((16.0 + x_0) > (9.0 + x_1)? (16.0 + x_0) : (9.0 + x_1)) > ((13.0 + x_3) > (12.0 + x_8)? (13.0 + x_3) : (12.0 + x_8))? ((16.0 + x_0) > (9.0 + x_1)? (16.0 + x_0) : (9.0 + x_1)) : ((13.0 + x_3) > (12.0 + x_8)? (13.0 + x_3) : (12.0 + x_8))) > (((15.0 + x_10) > (4.0 + x_13)? (15.0 + x_10) : (4.0 + x_13)) > ((16.0 + x_15) > (13.0 + x_16)? (16.0 + x_15) : (13.0 + x_16))? ((15.0 + x_10) > (4.0 + x_13)? (15.0 + x_10) : (4.0 + x_13)) : ((16.0 + x_15) > (13.0 + x_16)? (16.0 + x_15) : (13.0 + x_16)))? (((16.0 + x_0) > (9.0 + x_1)? (16.0 + x_0) : (9.0 + x_1)) > ((13.0 + x_3) > (12.0 + x_8)? (13.0 + x_3) : (12.0 + x_8))? ((16.0 + x_0) > (9.0 + x_1)? (16.0 + x_0) : (9.0 + x_1)) : ((13.0 + x_3) > (12.0 + x_8)? (13.0 + x_3) : (12.0 + x_8))) : (((15.0 + x_10) > (4.0 + x_13)? (15.0 + x_10) : (4.0 + x_13)) > ((16.0 + x_15) > (13.0 + x_16)? (16.0 + x_15) : (13.0 + x_16))? ((15.0 + x_10) > (4.0 + x_13)? (15.0 + x_10) : (4.0 + x_13)) : ((16.0 + x_15) > (13.0 + x_16)? (16.0 + x_15) : (13.0 + x_16)))) : ((((19.0 + x_17) > (8.0 + x_18)? (19.0 + x_17) : (8.0 + x_18)) > ((18.0 + x_20) > (2.0 + x_23)? (18.0 + x_20) : (2.0 + x_23))? ((19.0 + x_17) > (8.0 + x_18)? (19.0 + x_17) : (8.0 + x_18)) : ((18.0 + x_20) > (2.0 + x_23)? (18.0 + x_20) : (2.0 + x_23))) > (((14.0 + x_26) > (18.0 + x_27)? (14.0 + x_26) : (18.0 + x_27)) > ((14.0 + x_30) > (1.0 + x_31)? (14.0 + x_30) : (1.0 + x_31))? ((14.0 + x_26) > (18.0 + x_27)? (14.0 + x_26) : (18.0 + x_27)) : ((14.0 + x_30) > (1.0 + x_31)? (14.0 + x_30) : (1.0 + x_31)))? (((19.0 + x_17) > (8.0 + x_18)? (19.0 + x_17) : (8.0 + x_18)) > ((18.0 + x_20) > (2.0 + x_23)? (18.0 + x_20) : (2.0 + x_23))? ((19.0 + x_17) > (8.0 + x_18)? (19.0 + x_17) : (8.0 + x_18)) : ((18.0 + x_20) > (2.0 + x_23)? (18.0 + x_20) : (2.0 + x_23))) : (((14.0 + x_26) > (18.0 + x_27)? (14.0 + x_26) : (18.0 + x_27)) > ((14.0 + x_30) > (1.0 + x_31)? (14.0 + x_30) : (1.0 + x_31))? ((14.0 + x_26) > (18.0 + x_27)? (14.0 + x_26) : (18.0 + x_27)) : ((14.0 + x_30) > (1.0 + x_31)? (14.0 + x_30) : (1.0 + x_31)))));
x_14_ = (((((2.0 + x_1) > (7.0 + x_2)? (2.0 + x_1) : (7.0 + x_2)) > ((11.0 + x_3) > (4.0 + x_4)? (11.0 + x_3) : (4.0 + x_4))? ((2.0 + x_1) > (7.0 + x_2)? (2.0 + x_1) : (7.0 + x_2)) : ((11.0 + x_3) > (4.0 + x_4)? (11.0 + x_3) : (4.0 + x_4))) > (((2.0 + x_5) > (7.0 + x_9)? (2.0 + x_5) : (7.0 + x_9)) > ((10.0 + x_13) > (9.0 + x_18)? (10.0 + x_13) : (9.0 + x_18))? ((2.0 + x_5) > (7.0 + x_9)? (2.0 + x_5) : (7.0 + x_9)) : ((10.0 + x_13) > (9.0 + x_18)? (10.0 + x_13) : (9.0 + x_18)))? (((2.0 + x_1) > (7.0 + x_2)? (2.0 + x_1) : (7.0 + x_2)) > ((11.0 + x_3) > (4.0 + x_4)? (11.0 + x_3) : (4.0 + x_4))? ((2.0 + x_1) > (7.0 + x_2)? (2.0 + x_1) : (7.0 + x_2)) : ((11.0 + x_3) > (4.0 + x_4)? (11.0 + x_3) : (4.0 + x_4))) : (((2.0 + x_5) > (7.0 + x_9)? (2.0 + x_5) : (7.0 + x_9)) > ((10.0 + x_13) > (9.0 + x_18)? (10.0 + x_13) : (9.0 + x_18))? ((2.0 + x_5) > (7.0 + x_9)? (2.0 + x_5) : (7.0 + x_9)) : ((10.0 + x_13) > (9.0 + x_18)? (10.0 + x_13) : (9.0 + x_18)))) > ((((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) > ((7.0 + x_21) > (2.0 + x_23)? (7.0 + x_21) : (2.0 + x_23))? ((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) : ((7.0 + x_21) > (2.0 + x_23)? (7.0 + x_21) : (2.0 + x_23))) > (((4.0 + x_24) > (18.0 + x_25)? (4.0 + x_24) : (18.0 + x_25)) > ((10.0 + x_27) > (4.0 + x_28)? (10.0 + x_27) : (4.0 + x_28))? ((4.0 + x_24) > (18.0 + x_25)? (4.0 + x_24) : (18.0 + x_25)) : ((10.0 + x_27) > (4.0 + x_28)? (10.0 + x_27) : (4.0 + x_28)))? (((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) > ((7.0 + x_21) > (2.0 + x_23)? (7.0 + x_21) : (2.0 + x_23))? ((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) : ((7.0 + x_21) > (2.0 + x_23)? (7.0 + x_21) : (2.0 + x_23))) : (((4.0 + x_24) > (18.0 + x_25)? (4.0 + x_24) : (18.0 + x_25)) > ((10.0 + x_27) > (4.0 + x_28)? (10.0 + x_27) : (4.0 + x_28))? ((4.0 + x_24) > (18.0 + x_25)? (4.0 + x_24) : (18.0 + x_25)) : ((10.0 + x_27) > (4.0 + x_28)? (10.0 + x_27) : (4.0 + x_28))))? ((((2.0 + x_1) > (7.0 + x_2)? (2.0 + x_1) : (7.0 + x_2)) > ((11.0 + x_3) > (4.0 + x_4)? (11.0 + x_3) : (4.0 + x_4))? ((2.0 + x_1) > (7.0 + x_2)? (2.0 + x_1) : (7.0 + x_2)) : ((11.0 + x_3) > (4.0 + x_4)? (11.0 + x_3) : (4.0 + x_4))) > (((2.0 + x_5) > (7.0 + x_9)? (2.0 + x_5) : (7.0 + x_9)) > ((10.0 + x_13) > (9.0 + x_18)? (10.0 + x_13) : (9.0 + x_18))? ((2.0 + x_5) > (7.0 + x_9)? (2.0 + x_5) : (7.0 + x_9)) : ((10.0 + x_13) > (9.0 + x_18)? (10.0 + x_13) : (9.0 + x_18)))? (((2.0 + x_1) > (7.0 + x_2)? (2.0 + x_1) : (7.0 + x_2)) > ((11.0 + x_3) > (4.0 + x_4)? (11.0 + x_3) : (4.0 + x_4))? ((2.0 + x_1) > (7.0 + x_2)? (2.0 + x_1) : (7.0 + x_2)) : ((11.0 + x_3) > (4.0 + x_4)? (11.0 + x_3) : (4.0 + x_4))) : (((2.0 + x_5) > (7.0 + x_9)? (2.0 + x_5) : (7.0 + x_9)) > ((10.0 + x_13) > (9.0 + x_18)? (10.0 + x_13) : (9.0 + x_18))? ((2.0 + x_5) > (7.0 + x_9)? (2.0 + x_5) : (7.0 + x_9)) : ((10.0 + x_13) > (9.0 + x_18)? (10.0 + x_13) : (9.0 + x_18)))) : ((((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) > ((7.0 + x_21) > (2.0 + x_23)? (7.0 + x_21) : (2.0 + x_23))? ((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) : ((7.0 + x_21) > (2.0 + x_23)? (7.0 + x_21) : (2.0 + x_23))) > (((4.0 + x_24) > (18.0 + x_25)? (4.0 + x_24) : (18.0 + x_25)) > ((10.0 + x_27) > (4.0 + x_28)? (10.0 + x_27) : (4.0 + x_28))? ((4.0 + x_24) > (18.0 + x_25)? (4.0 + x_24) : (18.0 + x_25)) : ((10.0 + x_27) > (4.0 + x_28)? (10.0 + x_27) : (4.0 + x_28)))? (((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) > ((7.0 + x_21) > (2.0 + x_23)? (7.0 + x_21) : (2.0 + x_23))? ((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) : ((7.0 + x_21) > (2.0 + x_23)? (7.0 + x_21) : (2.0 + x_23))) : (((4.0 + x_24) > (18.0 + x_25)? (4.0 + x_24) : (18.0 + x_25)) > ((10.0 + x_27) > (4.0 + x_28)? (10.0 + x_27) : (4.0 + x_28))? ((4.0 + x_24) > (18.0 + x_25)? (4.0 + x_24) : (18.0 + x_25)) : ((10.0 + x_27) > (4.0 + x_28)? (10.0 + x_27) : (4.0 + x_28)))));
x_15_ = (((((13.0 + x_1) > (6.0 + x_4)? (13.0 + x_1) : (6.0 + x_4)) > ((19.0 + x_6) > (5.0 + x_7)? (19.0 + x_6) : (5.0 + x_7))? ((13.0 + x_1) > (6.0 + x_4)? (13.0 + x_1) : (6.0 + x_4)) : ((19.0 + x_6) > (5.0 + x_7)? (19.0 + x_6) : (5.0 + x_7))) > (((10.0 + x_8) > (11.0 + x_9)? (10.0 + x_8) : (11.0 + x_9)) > ((4.0 + x_11) > (16.0 + x_16)? (4.0 + x_11) : (16.0 + x_16))? ((10.0 + x_8) > (11.0 + x_9)? (10.0 + x_8) : (11.0 + x_9)) : ((4.0 + x_11) > (16.0 + x_16)? (4.0 + x_11) : (16.0 + x_16)))? (((13.0 + x_1) > (6.0 + x_4)? (13.0 + x_1) : (6.0 + x_4)) > ((19.0 + x_6) > (5.0 + x_7)? (19.0 + x_6) : (5.0 + x_7))? ((13.0 + x_1) > (6.0 + x_4)? (13.0 + x_1) : (6.0 + x_4)) : ((19.0 + x_6) > (5.0 + x_7)? (19.0 + x_6) : (5.0 + x_7))) : (((10.0 + x_8) > (11.0 + x_9)? (10.0 + x_8) : (11.0 + x_9)) > ((4.0 + x_11) > (16.0 + x_16)? (4.0 + x_11) : (16.0 + x_16))? ((10.0 + x_8) > (11.0 + x_9)? (10.0 + x_8) : (11.0 + x_9)) : ((4.0 + x_11) > (16.0 + x_16)? (4.0 + x_11) : (16.0 + x_16)))) > ((((9.0 + x_17) > (17.0 + x_19)? (9.0 + x_17) : (17.0 + x_19)) > ((3.0 + x_20) > (19.0 + x_24)? (3.0 + x_20) : (19.0 + x_24))? ((9.0 + x_17) > (17.0 + x_19)? (9.0 + x_17) : (17.0 + x_19)) : ((3.0 + x_20) > (19.0 + x_24)? (3.0 + x_20) : (19.0 + x_24))) > (((16.0 + x_27) > (20.0 + x_28)? (16.0 + x_27) : (20.0 + x_28)) > ((17.0 + x_30) > (10.0 + x_31)? (17.0 + x_30) : (10.0 + x_31))? ((16.0 + x_27) > (20.0 + x_28)? (16.0 + x_27) : (20.0 + x_28)) : ((17.0 + x_30) > (10.0 + x_31)? (17.0 + x_30) : (10.0 + x_31)))? (((9.0 + x_17) > (17.0 + x_19)? (9.0 + x_17) : (17.0 + x_19)) > ((3.0 + x_20) > (19.0 + x_24)? (3.0 + x_20) : (19.0 + x_24))? ((9.0 + x_17) > (17.0 + x_19)? (9.0 + x_17) : (17.0 + x_19)) : ((3.0 + x_20) > (19.0 + x_24)? (3.0 + x_20) : (19.0 + x_24))) : (((16.0 + x_27) > (20.0 + x_28)? (16.0 + x_27) : (20.0 + x_28)) > ((17.0 + x_30) > (10.0 + x_31)? (17.0 + x_30) : (10.0 + x_31))? ((16.0 + x_27) > (20.0 + x_28)? (16.0 + x_27) : (20.0 + x_28)) : ((17.0 + x_30) > (10.0 + x_31)? (17.0 + x_30) : (10.0 + x_31))))? ((((13.0 + x_1) > (6.0 + x_4)? (13.0 + x_1) : (6.0 + x_4)) > ((19.0 + x_6) > (5.0 + x_7)? (19.0 + x_6) : (5.0 + x_7))? ((13.0 + x_1) > (6.0 + x_4)? (13.0 + x_1) : (6.0 + x_4)) : ((19.0 + x_6) > (5.0 + x_7)? (19.0 + x_6) : (5.0 + x_7))) > (((10.0 + x_8) > (11.0 + x_9)? (10.0 + x_8) : (11.0 + x_9)) > ((4.0 + x_11) > (16.0 + x_16)? (4.0 + x_11) : (16.0 + x_16))? ((10.0 + x_8) > (11.0 + x_9)? (10.0 + x_8) : (11.0 + x_9)) : ((4.0 + x_11) > (16.0 + x_16)? (4.0 + x_11) : (16.0 + x_16)))? (((13.0 + x_1) > (6.0 + x_4)? (13.0 + x_1) : (6.0 + x_4)) > ((19.0 + x_6) > (5.0 + x_7)? (19.0 + x_6) : (5.0 + x_7))? ((13.0 + x_1) > (6.0 + x_4)? (13.0 + x_1) : (6.0 + x_4)) : ((19.0 + x_6) > (5.0 + x_7)? (19.0 + x_6) : (5.0 + x_7))) : (((10.0 + x_8) > (11.0 + x_9)? (10.0 + x_8) : (11.0 + x_9)) > ((4.0 + x_11) > (16.0 + x_16)? (4.0 + x_11) : (16.0 + x_16))? ((10.0 + x_8) > (11.0 + x_9)? (10.0 + x_8) : (11.0 + x_9)) : ((4.0 + x_11) > (16.0 + x_16)? (4.0 + x_11) : (16.0 + x_16)))) : ((((9.0 + x_17) > (17.0 + x_19)? (9.0 + x_17) : (17.0 + x_19)) > ((3.0 + x_20) > (19.0 + x_24)? (3.0 + x_20) : (19.0 + x_24))? ((9.0 + x_17) > (17.0 + x_19)? (9.0 + x_17) : (17.0 + x_19)) : ((3.0 + x_20) > (19.0 + x_24)? (3.0 + x_20) : (19.0 + x_24))) > (((16.0 + x_27) > (20.0 + x_28)? (16.0 + x_27) : (20.0 + x_28)) > ((17.0 + x_30) > (10.0 + x_31)? (17.0 + x_30) : (10.0 + x_31))? ((16.0 + x_27) > (20.0 + x_28)? (16.0 + x_27) : (20.0 + x_28)) : ((17.0 + x_30) > (10.0 + x_31)? (17.0 + x_30) : (10.0 + x_31)))? (((9.0 + x_17) > (17.0 + x_19)? (9.0 + x_17) : (17.0 + x_19)) > ((3.0 + x_20) > (19.0 + x_24)? (3.0 + x_20) : (19.0 + x_24))? ((9.0 + x_17) > (17.0 + x_19)? (9.0 + x_17) : (17.0 + x_19)) : ((3.0 + x_20) > (19.0 + x_24)? (3.0 + x_20) : (19.0 + x_24))) : (((16.0 + x_27) > (20.0 + x_28)? (16.0 + x_27) : (20.0 + x_28)) > ((17.0 + x_30) > (10.0 + x_31)? (17.0 + x_30) : (10.0 + x_31))? ((16.0 + x_27) > (20.0 + x_28)? (16.0 + x_27) : (20.0 + x_28)) : ((17.0 + x_30) > (10.0 + x_31)? (17.0 + x_30) : (10.0 + x_31)))));
x_16_ = (((((8.0 + x_0) > (7.0 + x_2)? (8.0 + x_0) : (7.0 + x_2)) > ((19.0 + x_4) > (3.0 + x_7)? (19.0 + x_4) : (3.0 + x_7))? ((8.0 + x_0) > (7.0 + x_2)? (8.0 + x_0) : (7.0 + x_2)) : ((19.0 + x_4) > (3.0 + x_7)? (19.0 + x_4) : (3.0 + x_7))) > (((1.0 + x_9) > (12.0 + x_11)? (1.0 + x_9) : (12.0 + x_11)) > ((16.0 + x_12) > (3.0 + x_15)? (16.0 + x_12) : (3.0 + x_15))? ((1.0 + x_9) > (12.0 + x_11)? (1.0 + x_9) : (12.0 + x_11)) : ((16.0 + x_12) > (3.0 + x_15)? (16.0 + x_12) : (3.0 + x_15)))? (((8.0 + x_0) > (7.0 + x_2)? (8.0 + x_0) : (7.0 + x_2)) > ((19.0 + x_4) > (3.0 + x_7)? (19.0 + x_4) : (3.0 + x_7))? ((8.0 + x_0) > (7.0 + x_2)? (8.0 + x_0) : (7.0 + x_2)) : ((19.0 + x_4) > (3.0 + x_7)? (19.0 + x_4) : (3.0 + x_7))) : (((1.0 + x_9) > (12.0 + x_11)? (1.0 + x_9) : (12.0 + x_11)) > ((16.0 + x_12) > (3.0 + x_15)? (16.0 + x_12) : (3.0 + x_15))? ((1.0 + x_9) > (12.0 + x_11)? (1.0 + x_9) : (12.0 + x_11)) : ((16.0 + x_12) > (3.0 + x_15)? (16.0 + x_12) : (3.0 + x_15)))) > ((((6.0 + x_18) > (14.0 + x_19)? (6.0 + x_18) : (14.0 + x_19)) > ((3.0 + x_22) > (16.0 + x_24)? (3.0 + x_22) : (16.0 + x_24))? ((6.0 + x_18) > (14.0 + x_19)? (6.0 + x_18) : (14.0 + x_19)) : ((3.0 + x_22) > (16.0 + x_24)? (3.0 + x_22) : (16.0 + x_24))) > (((12.0 + x_27) > (18.0 + x_28)? (12.0 + x_27) : (18.0 + x_28)) > ((7.0 + x_29) > (9.0 + x_30)? (7.0 + x_29) : (9.0 + x_30))? ((12.0 + x_27) > (18.0 + x_28)? (12.0 + x_27) : (18.0 + x_28)) : ((7.0 + x_29) > (9.0 + x_30)? (7.0 + x_29) : (9.0 + x_30)))? (((6.0 + x_18) > (14.0 + x_19)? (6.0 + x_18) : (14.0 + x_19)) > ((3.0 + x_22) > (16.0 + x_24)? (3.0 + x_22) : (16.0 + x_24))? ((6.0 + x_18) > (14.0 + x_19)? (6.0 + x_18) : (14.0 + x_19)) : ((3.0 + x_22) > (16.0 + x_24)? (3.0 + x_22) : (16.0 + x_24))) : (((12.0 + x_27) > (18.0 + x_28)? (12.0 + x_27) : (18.0 + x_28)) > ((7.0 + x_29) > (9.0 + x_30)? (7.0 + x_29) : (9.0 + x_30))? ((12.0 + x_27) > (18.0 + x_28)? (12.0 + x_27) : (18.0 + x_28)) : ((7.0 + x_29) > (9.0 + x_30)? (7.0 + x_29) : (9.0 + x_30))))? ((((8.0 + x_0) > (7.0 + x_2)? (8.0 + x_0) : (7.0 + x_2)) > ((19.0 + x_4) > (3.0 + x_7)? (19.0 + x_4) : (3.0 + x_7))? ((8.0 + x_0) > (7.0 + x_2)? (8.0 + x_0) : (7.0 + x_2)) : ((19.0 + x_4) > (3.0 + x_7)? (19.0 + x_4) : (3.0 + x_7))) > (((1.0 + x_9) > (12.0 + x_11)? (1.0 + x_9) : (12.0 + x_11)) > ((16.0 + x_12) > (3.0 + x_15)? (16.0 + x_12) : (3.0 + x_15))? ((1.0 + x_9) > (12.0 + x_11)? (1.0 + x_9) : (12.0 + x_11)) : ((16.0 + x_12) > (3.0 + x_15)? (16.0 + x_12) : (3.0 + x_15)))? (((8.0 + x_0) > (7.0 + x_2)? (8.0 + x_0) : (7.0 + x_2)) > ((19.0 + x_4) > (3.0 + x_7)? (19.0 + x_4) : (3.0 + x_7))? ((8.0 + x_0) > (7.0 + x_2)? (8.0 + x_0) : (7.0 + x_2)) : ((19.0 + x_4) > (3.0 + x_7)? (19.0 + x_4) : (3.0 + x_7))) : (((1.0 + x_9) > (12.0 + x_11)? (1.0 + x_9) : (12.0 + x_11)) > ((16.0 + x_12) > (3.0 + x_15)? (16.0 + x_12) : (3.0 + x_15))? ((1.0 + x_9) > (12.0 + x_11)? (1.0 + x_9) : (12.0 + x_11)) : ((16.0 + x_12) > (3.0 + x_15)? (16.0 + x_12) : (3.0 + x_15)))) : ((((6.0 + x_18) > (14.0 + x_19)? (6.0 + x_18) : (14.0 + x_19)) > ((3.0 + x_22) > (16.0 + x_24)? (3.0 + x_22) : (16.0 + x_24))? ((6.0 + x_18) > (14.0 + x_19)? (6.0 + x_18) : (14.0 + x_19)) : ((3.0 + x_22) > (16.0 + x_24)? (3.0 + x_22) : (16.0 + x_24))) > (((12.0 + x_27) > (18.0 + x_28)? (12.0 + x_27) : (18.0 + x_28)) > ((7.0 + x_29) > (9.0 + x_30)? (7.0 + x_29) : (9.0 + x_30))? ((12.0 + x_27) > (18.0 + x_28)? (12.0 + x_27) : (18.0 + x_28)) : ((7.0 + x_29) > (9.0 + x_30)? (7.0 + x_29) : (9.0 + x_30)))? (((6.0 + x_18) > (14.0 + x_19)? (6.0 + x_18) : (14.0 + x_19)) > ((3.0 + x_22) > (16.0 + x_24)? (3.0 + x_22) : (16.0 + x_24))? ((6.0 + x_18) > (14.0 + x_19)? (6.0 + x_18) : (14.0 + x_19)) : ((3.0 + x_22) > (16.0 + x_24)? (3.0 + x_22) : (16.0 + x_24))) : (((12.0 + x_27) > (18.0 + x_28)? (12.0 + x_27) : (18.0 + x_28)) > ((7.0 + x_29) > (9.0 + x_30)? (7.0 + x_29) : (9.0 + x_30))? ((12.0 + x_27) > (18.0 + x_28)? (12.0 + x_27) : (18.0 + x_28)) : ((7.0 + x_29) > (9.0 + x_30)? (7.0 + x_29) : (9.0 + x_30)))));
x_17_ = (((((5.0 + x_0) > (17.0 + x_5)? (5.0 + x_0) : (17.0 + x_5)) > ((12.0 + x_9) > (8.0 + x_10)? (12.0 + x_9) : (8.0 + x_10))? ((5.0 + x_0) > (17.0 + x_5)? (5.0 + x_0) : (17.0 + x_5)) : ((12.0 + x_9) > (8.0 + x_10)? (12.0 + x_9) : (8.0 + x_10))) > (((2.0 + x_11) > (4.0 + x_12)? (2.0 + x_11) : (4.0 + x_12)) > ((12.0 + x_15) > (3.0 + x_16)? (12.0 + x_15) : (3.0 + x_16))? ((2.0 + x_11) > (4.0 + x_12)? (2.0 + x_11) : (4.0 + x_12)) : ((12.0 + x_15) > (3.0 + x_16)? (12.0 + x_15) : (3.0 + x_16)))? (((5.0 + x_0) > (17.0 + x_5)? (5.0 + x_0) : (17.0 + x_5)) > ((12.0 + x_9) > (8.0 + x_10)? (12.0 + x_9) : (8.0 + x_10))? ((5.0 + x_0) > (17.0 + x_5)? (5.0 + x_0) : (17.0 + x_5)) : ((12.0 + x_9) > (8.0 + x_10)? (12.0 + x_9) : (8.0 + x_10))) : (((2.0 + x_11) > (4.0 + x_12)? (2.0 + x_11) : (4.0 + x_12)) > ((12.0 + x_15) > (3.0 + x_16)? (12.0 + x_15) : (3.0 + x_16))? ((2.0 + x_11) > (4.0 + x_12)? (2.0 + x_11) : (4.0 + x_12)) : ((12.0 + x_15) > (3.0 + x_16)? (12.0 + x_15) : (3.0 + x_16)))) > ((((8.0 + x_17) > (6.0 + x_18)? (8.0 + x_17) : (6.0 + x_18)) > ((19.0 + x_21) > (3.0 + x_22)? (19.0 + x_21) : (3.0 + x_22))? ((8.0 + x_17) > (6.0 + x_18)? (8.0 + x_17) : (6.0 + x_18)) : ((19.0 + x_21) > (3.0 + x_22)? (19.0 + x_21) : (3.0 + x_22))) > (((18.0 + x_23) > (16.0 + x_24)? (18.0 + x_23) : (16.0 + x_24)) > ((10.0 + x_26) > (20.0 + x_27)? (10.0 + x_26) : (20.0 + x_27))? ((18.0 + x_23) > (16.0 + x_24)? (18.0 + x_23) : (16.0 + x_24)) : ((10.0 + x_26) > (20.0 + x_27)? (10.0 + x_26) : (20.0 + x_27)))? (((8.0 + x_17) > (6.0 + x_18)? (8.0 + x_17) : (6.0 + x_18)) > ((19.0 + x_21) > (3.0 + x_22)? (19.0 + x_21) : (3.0 + x_22))? ((8.0 + x_17) > (6.0 + x_18)? (8.0 + x_17) : (6.0 + x_18)) : ((19.0 + x_21) > (3.0 + x_22)? (19.0 + x_21) : (3.0 + x_22))) : (((18.0 + x_23) > (16.0 + x_24)? (18.0 + x_23) : (16.0 + x_24)) > ((10.0 + x_26) > (20.0 + x_27)? (10.0 + x_26) : (20.0 + x_27))? ((18.0 + x_23) > (16.0 + x_24)? (18.0 + x_23) : (16.0 + x_24)) : ((10.0 + x_26) > (20.0 + x_27)? (10.0 + x_26) : (20.0 + x_27))))? ((((5.0 + x_0) > (17.0 + x_5)? (5.0 + x_0) : (17.0 + x_5)) > ((12.0 + x_9) > (8.0 + x_10)? (12.0 + x_9) : (8.0 + x_10))? ((5.0 + x_0) > (17.0 + x_5)? (5.0 + x_0) : (17.0 + x_5)) : ((12.0 + x_9) > (8.0 + x_10)? (12.0 + x_9) : (8.0 + x_10))) > (((2.0 + x_11) > (4.0 + x_12)? (2.0 + x_11) : (4.0 + x_12)) > ((12.0 + x_15) > (3.0 + x_16)? (12.0 + x_15) : (3.0 + x_16))? ((2.0 + x_11) > (4.0 + x_12)? (2.0 + x_11) : (4.0 + x_12)) : ((12.0 + x_15) > (3.0 + x_16)? (12.0 + x_15) : (3.0 + x_16)))? (((5.0 + x_0) > (17.0 + x_5)? (5.0 + x_0) : (17.0 + x_5)) > ((12.0 + x_9) > (8.0 + x_10)? (12.0 + x_9) : (8.0 + x_10))? ((5.0 + x_0) > (17.0 + x_5)? (5.0 + x_0) : (17.0 + x_5)) : ((12.0 + x_9) > (8.0 + x_10)? (12.0 + x_9) : (8.0 + x_10))) : (((2.0 + x_11) > (4.0 + x_12)? (2.0 + x_11) : (4.0 + x_12)) > ((12.0 + x_15) > (3.0 + x_16)? (12.0 + x_15) : (3.0 + x_16))? ((2.0 + x_11) > (4.0 + x_12)? (2.0 + x_11) : (4.0 + x_12)) : ((12.0 + x_15) > (3.0 + x_16)? (12.0 + x_15) : (3.0 + x_16)))) : ((((8.0 + x_17) > (6.0 + x_18)? (8.0 + x_17) : (6.0 + x_18)) > ((19.0 + x_21) > (3.0 + x_22)? (19.0 + x_21) : (3.0 + x_22))? ((8.0 + x_17) > (6.0 + x_18)? (8.0 + x_17) : (6.0 + x_18)) : ((19.0 + x_21) > (3.0 + x_22)? (19.0 + x_21) : (3.0 + x_22))) > (((18.0 + x_23) > (16.0 + x_24)? (18.0 + x_23) : (16.0 + x_24)) > ((10.0 + x_26) > (20.0 + x_27)? (10.0 + x_26) : (20.0 + x_27))? ((18.0 + x_23) > (16.0 + x_24)? (18.0 + x_23) : (16.0 + x_24)) : ((10.0 + x_26) > (20.0 + x_27)? (10.0 + x_26) : (20.0 + x_27)))? (((8.0 + x_17) > (6.0 + x_18)? (8.0 + x_17) : (6.0 + x_18)) > ((19.0 + x_21) > (3.0 + x_22)? (19.0 + x_21) : (3.0 + x_22))? ((8.0 + x_17) > (6.0 + x_18)? (8.0 + x_17) : (6.0 + x_18)) : ((19.0 + x_21) > (3.0 + x_22)? (19.0 + x_21) : (3.0 + x_22))) : (((18.0 + x_23) > (16.0 + x_24)? (18.0 + x_23) : (16.0 + x_24)) > ((10.0 + x_26) > (20.0 + x_27)? (10.0 + x_26) : (20.0 + x_27))? ((18.0 + x_23) > (16.0 + x_24)? (18.0 + x_23) : (16.0 + x_24)) : ((10.0 + x_26) > (20.0 + x_27)? (10.0 + x_26) : (20.0 + x_27)))));
x_18_ = (((((9.0 + x_0) > (3.0 + x_1)? (9.0 + x_0) : (3.0 + x_1)) > ((8.0 + x_8) > (13.0 + x_9)? (8.0 + x_8) : (13.0 + x_9))? ((9.0 + x_0) > (3.0 + x_1)? (9.0 + x_0) : (3.0 + x_1)) : ((8.0 + x_8) > (13.0 + x_9)? (8.0 + x_8) : (13.0 + x_9))) > (((10.0 + x_10) > (12.0 + x_12)? (10.0 + x_10) : (12.0 + x_12)) > ((13.0 + x_14) > (10.0 + x_16)? (13.0 + x_14) : (10.0 + x_16))? ((10.0 + x_10) > (12.0 + x_12)? (10.0 + x_10) : (12.0 + x_12)) : ((13.0 + x_14) > (10.0 + x_16)? (13.0 + x_14) : (10.0 + x_16)))? (((9.0 + x_0) > (3.0 + x_1)? (9.0 + x_0) : (3.0 + x_1)) > ((8.0 + x_8) > (13.0 + x_9)? (8.0 + x_8) : (13.0 + x_9))? ((9.0 + x_0) > (3.0 + x_1)? (9.0 + x_0) : (3.0 + x_1)) : ((8.0 + x_8) > (13.0 + x_9)? (8.0 + x_8) : (13.0 + x_9))) : (((10.0 + x_10) > (12.0 + x_12)? (10.0 + x_10) : (12.0 + x_12)) > ((13.0 + x_14) > (10.0 + x_16)? (13.0 + x_14) : (10.0 + x_16))? ((10.0 + x_10) > (12.0 + x_12)? (10.0 + x_10) : (12.0 + x_12)) : ((13.0 + x_14) > (10.0 + x_16)? (13.0 + x_14) : (10.0 + x_16)))) > ((((16.0 + x_19) > (12.0 + x_21)? (16.0 + x_19) : (12.0 + x_21)) > ((8.0 + x_22) > (15.0 + x_24)? (8.0 + x_22) : (15.0 + x_24))? ((16.0 + x_19) > (12.0 + x_21)? (16.0 + x_19) : (12.0 + x_21)) : ((8.0 + x_22) > (15.0 + x_24)? (8.0 + x_22) : (15.0 + x_24))) > (((13.0 + x_26) > (15.0 + x_27)? (13.0 + x_26) : (15.0 + x_27)) > ((17.0 + x_30) > (16.0 + x_31)? (17.0 + x_30) : (16.0 + x_31))? ((13.0 + x_26) > (15.0 + x_27)? (13.0 + x_26) : (15.0 + x_27)) : ((17.0 + x_30) > (16.0 + x_31)? (17.0 + x_30) : (16.0 + x_31)))? (((16.0 + x_19) > (12.0 + x_21)? (16.0 + x_19) : (12.0 + x_21)) > ((8.0 + x_22) > (15.0 + x_24)? (8.0 + x_22) : (15.0 + x_24))? ((16.0 + x_19) > (12.0 + x_21)? (16.0 + x_19) : (12.0 + x_21)) : ((8.0 + x_22) > (15.0 + x_24)? (8.0 + x_22) : (15.0 + x_24))) : (((13.0 + x_26) > (15.0 + x_27)? (13.0 + x_26) : (15.0 + x_27)) > ((17.0 + x_30) > (16.0 + x_31)? (17.0 + x_30) : (16.0 + x_31))? ((13.0 + x_26) > (15.0 + x_27)? (13.0 + x_26) : (15.0 + x_27)) : ((17.0 + x_30) > (16.0 + x_31)? (17.0 + x_30) : (16.0 + x_31))))? ((((9.0 + x_0) > (3.0 + x_1)? (9.0 + x_0) : (3.0 + x_1)) > ((8.0 + x_8) > (13.0 + x_9)? (8.0 + x_8) : (13.0 + x_9))? ((9.0 + x_0) > (3.0 + x_1)? (9.0 + x_0) : (3.0 + x_1)) : ((8.0 + x_8) > (13.0 + x_9)? (8.0 + x_8) : (13.0 + x_9))) > (((10.0 + x_10) > (12.0 + x_12)? (10.0 + x_10) : (12.0 + x_12)) > ((13.0 + x_14) > (10.0 + x_16)? (13.0 + x_14) : (10.0 + x_16))? ((10.0 + x_10) > (12.0 + x_12)? (10.0 + x_10) : (12.0 + x_12)) : ((13.0 + x_14) > (10.0 + x_16)? (13.0 + x_14) : (10.0 + x_16)))? (((9.0 + x_0) > (3.0 + x_1)? (9.0 + x_0) : (3.0 + x_1)) > ((8.0 + x_8) > (13.0 + x_9)? (8.0 + x_8) : (13.0 + x_9))? ((9.0 + x_0) > (3.0 + x_1)? (9.0 + x_0) : (3.0 + x_1)) : ((8.0 + x_8) > (13.0 + x_9)? (8.0 + x_8) : (13.0 + x_9))) : (((10.0 + x_10) > (12.0 + x_12)? (10.0 + x_10) : (12.0 + x_12)) > ((13.0 + x_14) > (10.0 + x_16)? (13.0 + x_14) : (10.0 + x_16))? ((10.0 + x_10) > (12.0 + x_12)? (10.0 + x_10) : (12.0 + x_12)) : ((13.0 + x_14) > (10.0 + x_16)? (13.0 + x_14) : (10.0 + x_16)))) : ((((16.0 + x_19) > (12.0 + x_21)? (16.0 + x_19) : (12.0 + x_21)) > ((8.0 + x_22) > (15.0 + x_24)? (8.0 + x_22) : (15.0 + x_24))? ((16.0 + x_19) > (12.0 + x_21)? (16.0 + x_19) : (12.0 + x_21)) : ((8.0 + x_22) > (15.0 + x_24)? (8.0 + x_22) : (15.0 + x_24))) > (((13.0 + x_26) > (15.0 + x_27)? (13.0 + x_26) : (15.0 + x_27)) > ((17.0 + x_30) > (16.0 + x_31)? (17.0 + x_30) : (16.0 + x_31))? ((13.0 + x_26) > (15.0 + x_27)? (13.0 + x_26) : (15.0 + x_27)) : ((17.0 + x_30) > (16.0 + x_31)? (17.0 + x_30) : (16.0 + x_31)))? (((16.0 + x_19) > (12.0 + x_21)? (16.0 + x_19) : (12.0 + x_21)) > ((8.0 + x_22) > (15.0 + x_24)? (8.0 + x_22) : (15.0 + x_24))? ((16.0 + x_19) > (12.0 + x_21)? (16.0 + x_19) : (12.0 + x_21)) : ((8.0 + x_22) > (15.0 + x_24)? (8.0 + x_22) : (15.0 + x_24))) : (((13.0 + x_26) > (15.0 + x_27)? (13.0 + x_26) : (15.0 + x_27)) > ((17.0 + x_30) > (16.0 + x_31)? (17.0 + x_30) : (16.0 + x_31))? ((13.0 + x_26) > (15.0 + x_27)? (13.0 + x_26) : (15.0 + x_27)) : ((17.0 + x_30) > (16.0 + x_31)? (17.0 + x_30) : (16.0 + x_31)))));
x_19_ = (((((8.0 + x_0) > (2.0 + x_1)? (8.0 + x_0) : (2.0 + x_1)) > ((14.0 + x_4) > (15.0 + x_13)? (14.0 + x_4) : (15.0 + x_13))? ((8.0 + x_0) > (2.0 + x_1)? (8.0 + x_0) : (2.0 + x_1)) : ((14.0 + x_4) > (15.0 + x_13)? (14.0 + x_4) : (15.0 + x_13))) > (((17.0 + x_14) > (16.0 + x_15)? (17.0 + x_14) : (16.0 + x_15)) > ((15.0 + x_16) > (3.0 + x_18)? (15.0 + x_16) : (3.0 + x_18))? ((17.0 + x_14) > (16.0 + x_15)? (17.0 + x_14) : (16.0 + x_15)) : ((15.0 + x_16) > (3.0 + x_18)? (15.0 + x_16) : (3.0 + x_18)))? (((8.0 + x_0) > (2.0 + x_1)? (8.0 + x_0) : (2.0 + x_1)) > ((14.0 + x_4) > (15.0 + x_13)? (14.0 + x_4) : (15.0 + x_13))? ((8.0 + x_0) > (2.0 + x_1)? (8.0 + x_0) : (2.0 + x_1)) : ((14.0 + x_4) > (15.0 + x_13)? (14.0 + x_4) : (15.0 + x_13))) : (((17.0 + x_14) > (16.0 + x_15)? (17.0 + x_14) : (16.0 + x_15)) > ((15.0 + x_16) > (3.0 + x_18)? (15.0 + x_16) : (3.0 + x_18))? ((17.0 + x_14) > (16.0 + x_15)? (17.0 + x_14) : (16.0 + x_15)) : ((15.0 + x_16) > (3.0 + x_18)? (15.0 + x_16) : (3.0 + x_18)))) > ((((3.0 + x_21) > (8.0 + x_22)? (3.0 + x_21) : (8.0 + x_22)) > ((2.0 + x_23) > (2.0 + x_25)? (2.0 + x_23) : (2.0 + x_25))? ((3.0 + x_21) > (8.0 + x_22)? (3.0 + x_21) : (8.0 + x_22)) : ((2.0 + x_23) > (2.0 + x_25)? (2.0 + x_23) : (2.0 + x_25))) > (((17.0 + x_27) > (10.0 + x_29)? (17.0 + x_27) : (10.0 + x_29)) > ((20.0 + x_30) > (4.0 + x_31)? (20.0 + x_30) : (4.0 + x_31))? ((17.0 + x_27) > (10.0 + x_29)? (17.0 + x_27) : (10.0 + x_29)) : ((20.0 + x_30) > (4.0 + x_31)? (20.0 + x_30) : (4.0 + x_31)))? (((3.0 + x_21) > (8.0 + x_22)? (3.0 + x_21) : (8.0 + x_22)) > ((2.0 + x_23) > (2.0 + x_25)? (2.0 + x_23) : (2.0 + x_25))? ((3.0 + x_21) > (8.0 + x_22)? (3.0 + x_21) : (8.0 + x_22)) : ((2.0 + x_23) > (2.0 + x_25)? (2.0 + x_23) : (2.0 + x_25))) : (((17.0 + x_27) > (10.0 + x_29)? (17.0 + x_27) : (10.0 + x_29)) > ((20.0 + x_30) > (4.0 + x_31)? (20.0 + x_30) : (4.0 + x_31))? ((17.0 + x_27) > (10.0 + x_29)? (17.0 + x_27) : (10.0 + x_29)) : ((20.0 + x_30) > (4.0 + x_31)? (20.0 + x_30) : (4.0 + x_31))))? ((((8.0 + x_0) > (2.0 + x_1)? (8.0 + x_0) : (2.0 + x_1)) > ((14.0 + x_4) > (15.0 + x_13)? (14.0 + x_4) : (15.0 + x_13))? ((8.0 + x_0) > (2.0 + x_1)? (8.0 + x_0) : (2.0 + x_1)) : ((14.0 + x_4) > (15.0 + x_13)? (14.0 + x_4) : (15.0 + x_13))) > (((17.0 + x_14) > (16.0 + x_15)? (17.0 + x_14) : (16.0 + x_15)) > ((15.0 + x_16) > (3.0 + x_18)? (15.0 + x_16) : (3.0 + x_18))? ((17.0 + x_14) > (16.0 + x_15)? (17.0 + x_14) : (16.0 + x_15)) : ((15.0 + x_16) > (3.0 + x_18)? (15.0 + x_16) : (3.0 + x_18)))? (((8.0 + x_0) > (2.0 + x_1)? (8.0 + x_0) : (2.0 + x_1)) > ((14.0 + x_4) > (15.0 + x_13)? (14.0 + x_4) : (15.0 + x_13))? ((8.0 + x_0) > (2.0 + x_1)? (8.0 + x_0) : (2.0 + x_1)) : ((14.0 + x_4) > (15.0 + x_13)? (14.0 + x_4) : (15.0 + x_13))) : (((17.0 + x_14) > (16.0 + x_15)? (17.0 + x_14) : (16.0 + x_15)) > ((15.0 + x_16) > (3.0 + x_18)? (15.0 + x_16) : (3.0 + x_18))? ((17.0 + x_14) > (16.0 + x_15)? (17.0 + x_14) : (16.0 + x_15)) : ((15.0 + x_16) > (3.0 + x_18)? (15.0 + x_16) : (3.0 + x_18)))) : ((((3.0 + x_21) > (8.0 + x_22)? (3.0 + x_21) : (8.0 + x_22)) > ((2.0 + x_23) > (2.0 + x_25)? (2.0 + x_23) : (2.0 + x_25))? ((3.0 + x_21) > (8.0 + x_22)? (3.0 + x_21) : (8.0 + x_22)) : ((2.0 + x_23) > (2.0 + x_25)? (2.0 + x_23) : (2.0 + x_25))) > (((17.0 + x_27) > (10.0 + x_29)? (17.0 + x_27) : (10.0 + x_29)) > ((20.0 + x_30) > (4.0 + x_31)? (20.0 + x_30) : (4.0 + x_31))? ((17.0 + x_27) > (10.0 + x_29)? (17.0 + x_27) : (10.0 + x_29)) : ((20.0 + x_30) > (4.0 + x_31)? (20.0 + x_30) : (4.0 + x_31)))? (((3.0 + x_21) > (8.0 + x_22)? (3.0 + x_21) : (8.0 + x_22)) > ((2.0 + x_23) > (2.0 + x_25)? (2.0 + x_23) : (2.0 + x_25))? ((3.0 + x_21) > (8.0 + x_22)? (3.0 + x_21) : (8.0 + x_22)) : ((2.0 + x_23) > (2.0 + x_25)? (2.0 + x_23) : (2.0 + x_25))) : (((17.0 + x_27) > (10.0 + x_29)? (17.0 + x_27) : (10.0 + x_29)) > ((20.0 + x_30) > (4.0 + x_31)? (20.0 + x_30) : (4.0 + x_31))? ((17.0 + x_27) > (10.0 + x_29)? (17.0 + x_27) : (10.0 + x_29)) : ((20.0 + x_30) > (4.0 + x_31)? (20.0 + x_30) : (4.0 + x_31)))));
x_20_ = (((((20.0 + x_0) > (4.0 + x_3)? (20.0 + x_0) : (4.0 + x_3)) > ((20.0 + x_4) > (18.0 + x_5)? (20.0 + x_4) : (18.0 + x_5))? ((20.0 + x_0) > (4.0 + x_3)? (20.0 + x_0) : (4.0 + x_3)) : ((20.0 + x_4) > (18.0 + x_5)? (20.0 + x_4) : (18.0 + x_5))) > (((14.0 + x_6) > (16.0 + x_9)? (14.0 + x_6) : (16.0 + x_9)) > ((13.0 + x_11) > (3.0 + x_12)? (13.0 + x_11) : (3.0 + x_12))? ((14.0 + x_6) > (16.0 + x_9)? (14.0 + x_6) : (16.0 + x_9)) : ((13.0 + x_11) > (3.0 + x_12)? (13.0 + x_11) : (3.0 + x_12)))? (((20.0 + x_0) > (4.0 + x_3)? (20.0 + x_0) : (4.0 + x_3)) > ((20.0 + x_4) > (18.0 + x_5)? (20.0 + x_4) : (18.0 + x_5))? ((20.0 + x_0) > (4.0 + x_3)? (20.0 + x_0) : (4.0 + x_3)) : ((20.0 + x_4) > (18.0 + x_5)? (20.0 + x_4) : (18.0 + x_5))) : (((14.0 + x_6) > (16.0 + x_9)? (14.0 + x_6) : (16.0 + x_9)) > ((13.0 + x_11) > (3.0 + x_12)? (13.0 + x_11) : (3.0 + x_12))? ((14.0 + x_6) > (16.0 + x_9)? (14.0 + x_6) : (16.0 + x_9)) : ((13.0 + x_11) > (3.0 + x_12)? (13.0 + x_11) : (3.0 + x_12)))) > ((((15.0 + x_13) > (17.0 + x_14)? (15.0 + x_13) : (17.0 + x_14)) > ((6.0 + x_15) > (3.0 + x_16)? (6.0 + x_15) : (3.0 + x_16))? ((15.0 + x_13) > (17.0 + x_14)? (15.0 + x_13) : (17.0 + x_14)) : ((6.0 + x_15) > (3.0 + x_16)? (6.0 + x_15) : (3.0 + x_16))) > (((3.0 + x_20) > (5.0 + x_27)? (3.0 + x_20) : (5.0 + x_27)) > ((3.0 + x_30) > (3.0 + x_31)? (3.0 + x_30) : (3.0 + x_31))? ((3.0 + x_20) > (5.0 + x_27)? (3.0 + x_20) : (5.0 + x_27)) : ((3.0 + x_30) > (3.0 + x_31)? (3.0 + x_30) : (3.0 + x_31)))? (((15.0 + x_13) > (17.0 + x_14)? (15.0 + x_13) : (17.0 + x_14)) > ((6.0 + x_15) > (3.0 + x_16)? (6.0 + x_15) : (3.0 + x_16))? ((15.0 + x_13) > (17.0 + x_14)? (15.0 + x_13) : (17.0 + x_14)) : ((6.0 + x_15) > (3.0 + x_16)? (6.0 + x_15) : (3.0 + x_16))) : (((3.0 + x_20) > (5.0 + x_27)? (3.0 + x_20) : (5.0 + x_27)) > ((3.0 + x_30) > (3.0 + x_31)? (3.0 + x_30) : (3.0 + x_31))? ((3.0 + x_20) > (5.0 + x_27)? (3.0 + x_20) : (5.0 + x_27)) : ((3.0 + x_30) > (3.0 + x_31)? (3.0 + x_30) : (3.0 + x_31))))? ((((20.0 + x_0) > (4.0 + x_3)? (20.0 + x_0) : (4.0 + x_3)) > ((20.0 + x_4) > (18.0 + x_5)? (20.0 + x_4) : (18.0 + x_5))? ((20.0 + x_0) > (4.0 + x_3)? (20.0 + x_0) : (4.0 + x_3)) : ((20.0 + x_4) > (18.0 + x_5)? (20.0 + x_4) : (18.0 + x_5))) > (((14.0 + x_6) > (16.0 + x_9)? (14.0 + x_6) : (16.0 + x_9)) > ((13.0 + x_11) > (3.0 + x_12)? (13.0 + x_11) : (3.0 + x_12))? ((14.0 + x_6) > (16.0 + x_9)? (14.0 + x_6) : (16.0 + x_9)) : ((13.0 + x_11) > (3.0 + x_12)? (13.0 + x_11) : (3.0 + x_12)))? (((20.0 + x_0) > (4.0 + x_3)? (20.0 + x_0) : (4.0 + x_3)) > ((20.0 + x_4) > (18.0 + x_5)? (20.0 + x_4) : (18.0 + x_5))? ((20.0 + x_0) > (4.0 + x_3)? (20.0 + x_0) : (4.0 + x_3)) : ((20.0 + x_4) > (18.0 + x_5)? (20.0 + x_4) : (18.0 + x_5))) : (((14.0 + x_6) > (16.0 + x_9)? (14.0 + x_6) : (16.0 + x_9)) > ((13.0 + x_11) > (3.0 + x_12)? (13.0 + x_11) : (3.0 + x_12))? ((14.0 + x_6) > (16.0 + x_9)? (14.0 + x_6) : (16.0 + x_9)) : ((13.0 + x_11) > (3.0 + x_12)? (13.0 + x_11) : (3.0 + x_12)))) : ((((15.0 + x_13) > (17.0 + x_14)? (15.0 + x_13) : (17.0 + x_14)) > ((6.0 + x_15) > (3.0 + x_16)? (6.0 + x_15) : (3.0 + x_16))? ((15.0 + x_13) > (17.0 + x_14)? (15.0 + x_13) : (17.0 + x_14)) : ((6.0 + x_15) > (3.0 + x_16)? (6.0 + x_15) : (3.0 + x_16))) > (((3.0 + x_20) > (5.0 + x_27)? (3.0 + x_20) : (5.0 + x_27)) > ((3.0 + x_30) > (3.0 + x_31)? (3.0 + x_30) : (3.0 + x_31))? ((3.0 + x_20) > (5.0 + x_27)? (3.0 + x_20) : (5.0 + x_27)) : ((3.0 + x_30) > (3.0 + x_31)? (3.0 + x_30) : (3.0 + x_31)))? (((15.0 + x_13) > (17.0 + x_14)? (15.0 + x_13) : (17.0 + x_14)) > ((6.0 + x_15) > (3.0 + x_16)? (6.0 + x_15) : (3.0 + x_16))? ((15.0 + x_13) > (17.0 + x_14)? (15.0 + x_13) : (17.0 + x_14)) : ((6.0 + x_15) > (3.0 + x_16)? (6.0 + x_15) : (3.0 + x_16))) : (((3.0 + x_20) > (5.0 + x_27)? (3.0 + x_20) : (5.0 + x_27)) > ((3.0 + x_30) > (3.0 + x_31)? (3.0 + x_30) : (3.0 + x_31))? ((3.0 + x_20) > (5.0 + x_27)? (3.0 + x_20) : (5.0 + x_27)) : ((3.0 + x_30) > (3.0 + x_31)? (3.0 + x_30) : (3.0 + x_31)))));
x_21_ = (((((9.0 + x_0) > (4.0 + x_4)? (9.0 + x_0) : (4.0 + x_4)) > ((20.0 + x_5) > (9.0 + x_8)? (20.0 + x_5) : (9.0 + x_8))? ((9.0 + x_0) > (4.0 + x_4)? (9.0 + x_0) : (4.0 + x_4)) : ((20.0 + x_5) > (9.0 + x_8)? (20.0 + x_5) : (9.0 + x_8))) > (((10.0 + x_10) > (19.0 + x_15)? (10.0 + x_10) : (19.0 + x_15)) > ((17.0 + x_17) > (4.0 + x_18)? (17.0 + x_17) : (4.0 + x_18))? ((10.0 + x_10) > (19.0 + x_15)? (10.0 + x_10) : (19.0 + x_15)) : ((17.0 + x_17) > (4.0 + x_18)? (17.0 + x_17) : (4.0 + x_18)))? (((9.0 + x_0) > (4.0 + x_4)? (9.0 + x_0) : (4.0 + x_4)) > ((20.0 + x_5) > (9.0 + x_8)? (20.0 + x_5) : (9.0 + x_8))? ((9.0 + x_0) > (4.0 + x_4)? (9.0 + x_0) : (4.0 + x_4)) : ((20.0 + x_5) > (9.0 + x_8)? (20.0 + x_5) : (9.0 + x_8))) : (((10.0 + x_10) > (19.0 + x_15)? (10.0 + x_10) : (19.0 + x_15)) > ((17.0 + x_17) > (4.0 + x_18)? (17.0 + x_17) : (4.0 + x_18))? ((10.0 + x_10) > (19.0 + x_15)? (10.0 + x_10) : (19.0 + x_15)) : ((17.0 + x_17) > (4.0 + x_18)? (17.0 + x_17) : (4.0 + x_18)))) > ((((3.0 + x_19) > (11.0 + x_21)? (3.0 + x_19) : (11.0 + x_21)) > ((12.0 + x_23) > (9.0 + x_24)? (12.0 + x_23) : (9.0 + x_24))? ((3.0 + x_19) > (11.0 + x_21)? (3.0 + x_19) : (11.0 + x_21)) : ((12.0 + x_23) > (9.0 + x_24)? (12.0 + x_23) : (9.0 + x_24))) > (((5.0 + x_26) > (5.0 + x_27)? (5.0 + x_26) : (5.0 + x_27)) > ((19.0 + x_30) > (9.0 + x_31)? (19.0 + x_30) : (9.0 + x_31))? ((5.0 + x_26) > (5.0 + x_27)? (5.0 + x_26) : (5.0 + x_27)) : ((19.0 + x_30) > (9.0 + x_31)? (19.0 + x_30) : (9.0 + x_31)))? (((3.0 + x_19) > (11.0 + x_21)? (3.0 + x_19) : (11.0 + x_21)) > ((12.0 + x_23) > (9.0 + x_24)? (12.0 + x_23) : (9.0 + x_24))? ((3.0 + x_19) > (11.0 + x_21)? (3.0 + x_19) : (11.0 + x_21)) : ((12.0 + x_23) > (9.0 + x_24)? (12.0 + x_23) : (9.0 + x_24))) : (((5.0 + x_26) > (5.0 + x_27)? (5.0 + x_26) : (5.0 + x_27)) > ((19.0 + x_30) > (9.0 + x_31)? (19.0 + x_30) : (9.0 + x_31))? ((5.0 + x_26) > (5.0 + x_27)? (5.0 + x_26) : (5.0 + x_27)) : ((19.0 + x_30) > (9.0 + x_31)? (19.0 + x_30) : (9.0 + x_31))))? ((((9.0 + x_0) > (4.0 + x_4)? (9.0 + x_0) : (4.0 + x_4)) > ((20.0 + x_5) > (9.0 + x_8)? (20.0 + x_5) : (9.0 + x_8))? ((9.0 + x_0) > (4.0 + x_4)? (9.0 + x_0) : (4.0 + x_4)) : ((20.0 + x_5) > (9.0 + x_8)? (20.0 + x_5) : (9.0 + x_8))) > (((10.0 + x_10) > (19.0 + x_15)? (10.0 + x_10) : (19.0 + x_15)) > ((17.0 + x_17) > (4.0 + x_18)? (17.0 + x_17) : (4.0 + x_18))? ((10.0 + x_10) > (19.0 + x_15)? (10.0 + x_10) : (19.0 + x_15)) : ((17.0 + x_17) > (4.0 + x_18)? (17.0 + x_17) : (4.0 + x_18)))? (((9.0 + x_0) > (4.0 + x_4)? (9.0 + x_0) : (4.0 + x_4)) > ((20.0 + x_5) > (9.0 + x_8)? (20.0 + x_5) : (9.0 + x_8))? ((9.0 + x_0) > (4.0 + x_4)? (9.0 + x_0) : (4.0 + x_4)) : ((20.0 + x_5) > (9.0 + x_8)? (20.0 + x_5) : (9.0 + x_8))) : (((10.0 + x_10) > (19.0 + x_15)? (10.0 + x_10) : (19.0 + x_15)) > ((17.0 + x_17) > (4.0 + x_18)? (17.0 + x_17) : (4.0 + x_18))? ((10.0 + x_10) > (19.0 + x_15)? (10.0 + x_10) : (19.0 + x_15)) : ((17.0 + x_17) > (4.0 + x_18)? (17.0 + x_17) : (4.0 + x_18)))) : ((((3.0 + x_19) > (11.0 + x_21)? (3.0 + x_19) : (11.0 + x_21)) > ((12.0 + x_23) > (9.0 + x_24)? (12.0 + x_23) : (9.0 + x_24))? ((3.0 + x_19) > (11.0 + x_21)? (3.0 + x_19) : (11.0 + x_21)) : ((12.0 + x_23) > (9.0 + x_24)? (12.0 + x_23) : (9.0 + x_24))) > (((5.0 + x_26) > (5.0 + x_27)? (5.0 + x_26) : (5.0 + x_27)) > ((19.0 + x_30) > (9.0 + x_31)? (19.0 + x_30) : (9.0 + x_31))? ((5.0 + x_26) > (5.0 + x_27)? (5.0 + x_26) : (5.0 + x_27)) : ((19.0 + x_30) > (9.0 + x_31)? (19.0 + x_30) : (9.0 + x_31)))? (((3.0 + x_19) > (11.0 + x_21)? (3.0 + x_19) : (11.0 + x_21)) > ((12.0 + x_23) > (9.0 + x_24)? (12.0 + x_23) : (9.0 + x_24))? ((3.0 + x_19) > (11.0 + x_21)? (3.0 + x_19) : (11.0 + x_21)) : ((12.0 + x_23) > (9.0 + x_24)? (12.0 + x_23) : (9.0 + x_24))) : (((5.0 + x_26) > (5.0 + x_27)? (5.0 + x_26) : (5.0 + x_27)) > ((19.0 + x_30) > (9.0 + x_31)? (19.0 + x_30) : (9.0 + x_31))? ((5.0 + x_26) > (5.0 + x_27)? (5.0 + x_26) : (5.0 + x_27)) : ((19.0 + x_30) > (9.0 + x_31)? (19.0 + x_30) : (9.0 + x_31)))));
x_22_ = (((((12.0 + x_2) > (18.0 + x_4)? (12.0 + x_2) : (18.0 + x_4)) > ((5.0 + x_5) > (17.0 + x_6)? (5.0 + x_5) : (17.0 + x_6))? ((12.0 + x_2) > (18.0 + x_4)? (12.0 + x_2) : (18.0 + x_4)) : ((5.0 + x_5) > (17.0 + x_6)? (5.0 + x_5) : (17.0 + x_6))) > (((13.0 + x_12) > (20.0 + x_13)? (13.0 + x_12) : (20.0 + x_13)) > ((5.0 + x_15) > (17.0 + x_16)? (5.0 + x_15) : (17.0 + x_16))? ((13.0 + x_12) > (20.0 + x_13)? (13.0 + x_12) : (20.0 + x_13)) : ((5.0 + x_15) > (17.0 + x_16)? (5.0 + x_15) : (17.0 + x_16)))? (((12.0 + x_2) > (18.0 + x_4)? (12.0 + x_2) : (18.0 + x_4)) > ((5.0 + x_5) > (17.0 + x_6)? (5.0 + x_5) : (17.0 + x_6))? ((12.0 + x_2) > (18.0 + x_4)? (12.0 + x_2) : (18.0 + x_4)) : ((5.0 + x_5) > (17.0 + x_6)? (5.0 + x_5) : (17.0 + x_6))) : (((13.0 + x_12) > (20.0 + x_13)? (13.0 + x_12) : (20.0 + x_13)) > ((5.0 + x_15) > (17.0 + x_16)? (5.0 + x_15) : (17.0 + x_16))? ((13.0 + x_12) > (20.0 + x_13)? (13.0 + x_12) : (20.0 + x_13)) : ((5.0 + x_15) > (17.0 + x_16)? (5.0 + x_15) : (17.0 + x_16)))) > ((((18.0 + x_17) > (10.0 + x_18)? (18.0 + x_17) : (10.0 + x_18)) > ((20.0 + x_19) > (16.0 + x_22)? (20.0 + x_19) : (16.0 + x_22))? ((18.0 + x_17) > (10.0 + x_18)? (18.0 + x_17) : (10.0 + x_18)) : ((20.0 + x_19) > (16.0 + x_22)? (20.0 + x_19) : (16.0 + x_22))) > (((19.0 + x_23) > (2.0 + x_24)? (19.0 + x_23) : (2.0 + x_24)) > ((5.0 + x_27) > (9.0 + x_31)? (5.0 + x_27) : (9.0 + x_31))? ((19.0 + x_23) > (2.0 + x_24)? (19.0 + x_23) : (2.0 + x_24)) : ((5.0 + x_27) > (9.0 + x_31)? (5.0 + x_27) : (9.0 + x_31)))? (((18.0 + x_17) > (10.0 + x_18)? (18.0 + x_17) : (10.0 + x_18)) > ((20.0 + x_19) > (16.0 + x_22)? (20.0 + x_19) : (16.0 + x_22))? ((18.0 + x_17) > (10.0 + x_18)? (18.0 + x_17) : (10.0 + x_18)) : ((20.0 + x_19) > (16.0 + x_22)? (20.0 + x_19) : (16.0 + x_22))) : (((19.0 + x_23) > (2.0 + x_24)? (19.0 + x_23) : (2.0 + x_24)) > ((5.0 + x_27) > (9.0 + x_31)? (5.0 + x_27) : (9.0 + x_31))? ((19.0 + x_23) > (2.0 + x_24)? (19.0 + x_23) : (2.0 + x_24)) : ((5.0 + x_27) > (9.0 + x_31)? (5.0 + x_27) : (9.0 + x_31))))? ((((12.0 + x_2) > (18.0 + x_4)? (12.0 + x_2) : (18.0 + x_4)) > ((5.0 + x_5) > (17.0 + x_6)? (5.0 + x_5) : (17.0 + x_6))? ((12.0 + x_2) > (18.0 + x_4)? (12.0 + x_2) : (18.0 + x_4)) : ((5.0 + x_5) > (17.0 + x_6)? (5.0 + x_5) : (17.0 + x_6))) > (((13.0 + x_12) > (20.0 + x_13)? (13.0 + x_12) : (20.0 + x_13)) > ((5.0 + x_15) > (17.0 + x_16)? (5.0 + x_15) : (17.0 + x_16))? ((13.0 + x_12) > (20.0 + x_13)? (13.0 + x_12) : (20.0 + x_13)) : ((5.0 + x_15) > (17.0 + x_16)? (5.0 + x_15) : (17.0 + x_16)))? (((12.0 + x_2) > (18.0 + x_4)? (12.0 + x_2) : (18.0 + x_4)) > ((5.0 + x_5) > (17.0 + x_6)? (5.0 + x_5) : (17.0 + x_6))? ((12.0 + x_2) > (18.0 + x_4)? (12.0 + x_2) : (18.0 + x_4)) : ((5.0 + x_5) > (17.0 + x_6)? (5.0 + x_5) : (17.0 + x_6))) : (((13.0 + x_12) > (20.0 + x_13)? (13.0 + x_12) : (20.0 + x_13)) > ((5.0 + x_15) > (17.0 + x_16)? (5.0 + x_15) : (17.0 + x_16))? ((13.0 + x_12) > (20.0 + x_13)? (13.0 + x_12) : (20.0 + x_13)) : ((5.0 + x_15) > (17.0 + x_16)? (5.0 + x_15) : (17.0 + x_16)))) : ((((18.0 + x_17) > (10.0 + x_18)? (18.0 + x_17) : (10.0 + x_18)) > ((20.0 + x_19) > (16.0 + x_22)? (20.0 + x_19) : (16.0 + x_22))? ((18.0 + x_17) > (10.0 + x_18)? (18.0 + x_17) : (10.0 + x_18)) : ((20.0 + x_19) > (16.0 + x_22)? (20.0 + x_19) : (16.0 + x_22))) > (((19.0 + x_23) > (2.0 + x_24)? (19.0 + x_23) : (2.0 + x_24)) > ((5.0 + x_27) > (9.0 + x_31)? (5.0 + x_27) : (9.0 + x_31))? ((19.0 + x_23) > (2.0 + x_24)? (19.0 + x_23) : (2.0 + x_24)) : ((5.0 + x_27) > (9.0 + x_31)? (5.0 + x_27) : (9.0 + x_31)))? (((18.0 + x_17) > (10.0 + x_18)? (18.0 + x_17) : (10.0 + x_18)) > ((20.0 + x_19) > (16.0 + x_22)? (20.0 + x_19) : (16.0 + x_22))? ((18.0 + x_17) > (10.0 + x_18)? (18.0 + x_17) : (10.0 + x_18)) : ((20.0 + x_19) > (16.0 + x_22)? (20.0 + x_19) : (16.0 + x_22))) : (((19.0 + x_23) > (2.0 + x_24)? (19.0 + x_23) : (2.0 + x_24)) > ((5.0 + x_27) > (9.0 + x_31)? (5.0 + x_27) : (9.0 + x_31))? ((19.0 + x_23) > (2.0 + x_24)? (19.0 + x_23) : (2.0 + x_24)) : ((5.0 + x_27) > (9.0 + x_31)? (5.0 + x_27) : (9.0 + x_31)))));
x_23_ = (((((5.0 + x_1) > (9.0 + x_3)? (5.0 + x_1) : (9.0 + x_3)) > ((17.0 + x_4) > (11.0 + x_8)? (17.0 + x_4) : (11.0 + x_8))? ((5.0 + x_1) > (9.0 + x_3)? (5.0 + x_1) : (9.0 + x_3)) : ((17.0 + x_4) > (11.0 + x_8)? (17.0 + x_4) : (11.0 + x_8))) > (((8.0 + x_10) > (2.0 + x_11)? (8.0 + x_10) : (2.0 + x_11)) > ((3.0 + x_12) > (13.0 + x_14)? (3.0 + x_12) : (13.0 + x_14))? ((8.0 + x_10) > (2.0 + x_11)? (8.0 + x_10) : (2.0 + x_11)) : ((3.0 + x_12) > (13.0 + x_14)? (3.0 + x_12) : (13.0 + x_14)))? (((5.0 + x_1) > (9.0 + x_3)? (5.0 + x_1) : (9.0 + x_3)) > ((17.0 + x_4) > (11.0 + x_8)? (17.0 + x_4) : (11.0 + x_8))? ((5.0 + x_1) > (9.0 + x_3)? (5.0 + x_1) : (9.0 + x_3)) : ((17.0 + x_4) > (11.0 + x_8)? (17.0 + x_4) : (11.0 + x_8))) : (((8.0 + x_10) > (2.0 + x_11)? (8.0 + x_10) : (2.0 + x_11)) > ((3.0 + x_12) > (13.0 + x_14)? (3.0 + x_12) : (13.0 + x_14))? ((8.0 + x_10) > (2.0 + x_11)? (8.0 + x_10) : (2.0 + x_11)) : ((3.0 + x_12) > (13.0 + x_14)? (3.0 + x_12) : (13.0 + x_14)))) > ((((17.0 + x_15) > (2.0 + x_17)? (17.0 + x_15) : (2.0 + x_17)) > ((20.0 + x_21) > (1.0 + x_22)? (20.0 + x_21) : (1.0 + x_22))? ((17.0 + x_15) > (2.0 + x_17)? (17.0 + x_15) : (2.0 + x_17)) : ((20.0 + x_21) > (1.0 + x_22)? (20.0 + x_21) : (1.0 + x_22))) > (((19.0 + x_24) > (7.0 + x_27)? (19.0 + x_24) : (7.0 + x_27)) > ((2.0 + x_28) > (18.0 + x_30)? (2.0 + x_28) : (18.0 + x_30))? ((19.0 + x_24) > (7.0 + x_27)? (19.0 + x_24) : (7.0 + x_27)) : ((2.0 + x_28) > (18.0 + x_30)? (2.0 + x_28) : (18.0 + x_30)))? (((17.0 + x_15) > (2.0 + x_17)? (17.0 + x_15) : (2.0 + x_17)) > ((20.0 + x_21) > (1.0 + x_22)? (20.0 + x_21) : (1.0 + x_22))? ((17.0 + x_15) > (2.0 + x_17)? (17.0 + x_15) : (2.0 + x_17)) : ((20.0 + x_21) > (1.0 + x_22)? (20.0 + x_21) : (1.0 + x_22))) : (((19.0 + x_24) > (7.0 + x_27)? (19.0 + x_24) : (7.0 + x_27)) > ((2.0 + x_28) > (18.0 + x_30)? (2.0 + x_28) : (18.0 + x_30))? ((19.0 + x_24) > (7.0 + x_27)? (19.0 + x_24) : (7.0 + x_27)) : ((2.0 + x_28) > (18.0 + x_30)? (2.0 + x_28) : (18.0 + x_30))))? ((((5.0 + x_1) > (9.0 + x_3)? (5.0 + x_1) : (9.0 + x_3)) > ((17.0 + x_4) > (11.0 + x_8)? (17.0 + x_4) : (11.0 + x_8))? ((5.0 + x_1) > (9.0 + x_3)? (5.0 + x_1) : (9.0 + x_3)) : ((17.0 + x_4) > (11.0 + x_8)? (17.0 + x_4) : (11.0 + x_8))) > (((8.0 + x_10) > (2.0 + x_11)? (8.0 + x_10) : (2.0 + x_11)) > ((3.0 + x_12) > (13.0 + x_14)? (3.0 + x_12) : (13.0 + x_14))? ((8.0 + x_10) > (2.0 + x_11)? (8.0 + x_10) : (2.0 + x_11)) : ((3.0 + x_12) > (13.0 + x_14)? (3.0 + x_12) : (13.0 + x_14)))? (((5.0 + x_1) > (9.0 + x_3)? (5.0 + x_1) : (9.0 + x_3)) > ((17.0 + x_4) > (11.0 + x_8)? (17.0 + x_4) : (11.0 + x_8))? ((5.0 + x_1) > (9.0 + x_3)? (5.0 + x_1) : (9.0 + x_3)) : ((17.0 + x_4) > (11.0 + x_8)? (17.0 + x_4) : (11.0 + x_8))) : (((8.0 + x_10) > (2.0 + x_11)? (8.0 + x_10) : (2.0 + x_11)) > ((3.0 + x_12) > (13.0 + x_14)? (3.0 + x_12) : (13.0 + x_14))? ((8.0 + x_10) > (2.0 + x_11)? (8.0 + x_10) : (2.0 + x_11)) : ((3.0 + x_12) > (13.0 + x_14)? (3.0 + x_12) : (13.0 + x_14)))) : ((((17.0 + x_15) > (2.0 + x_17)? (17.0 + x_15) : (2.0 + x_17)) > ((20.0 + x_21) > (1.0 + x_22)? (20.0 + x_21) : (1.0 + x_22))? ((17.0 + x_15) > (2.0 + x_17)? (17.0 + x_15) : (2.0 + x_17)) : ((20.0 + x_21) > (1.0 + x_22)? (20.0 + x_21) : (1.0 + x_22))) > (((19.0 + x_24) > (7.0 + x_27)? (19.0 + x_24) : (7.0 + x_27)) > ((2.0 + x_28) > (18.0 + x_30)? (2.0 + x_28) : (18.0 + x_30))? ((19.0 + x_24) > (7.0 + x_27)? (19.0 + x_24) : (7.0 + x_27)) : ((2.0 + x_28) > (18.0 + x_30)? (2.0 + x_28) : (18.0 + x_30)))? (((17.0 + x_15) > (2.0 + x_17)? (17.0 + x_15) : (2.0 + x_17)) > ((20.0 + x_21) > (1.0 + x_22)? (20.0 + x_21) : (1.0 + x_22))? ((17.0 + x_15) > (2.0 + x_17)? (17.0 + x_15) : (2.0 + x_17)) : ((20.0 + x_21) > (1.0 + x_22)? (20.0 + x_21) : (1.0 + x_22))) : (((19.0 + x_24) > (7.0 + x_27)? (19.0 + x_24) : (7.0 + x_27)) > ((2.0 + x_28) > (18.0 + x_30)? (2.0 + x_28) : (18.0 + x_30))? ((19.0 + x_24) > (7.0 + x_27)? (19.0 + x_24) : (7.0 + x_27)) : ((2.0 + x_28) > (18.0 + x_30)? (2.0 + x_28) : (18.0 + x_30)))));
x_24_ = (((((7.0 + x_2) > (19.0 + x_3)? (7.0 + x_2) : (19.0 + x_3)) > ((8.0 + x_4) > (14.0 + x_5)? (8.0 + x_4) : (14.0 + x_5))? ((7.0 + x_2) > (19.0 + x_3)? (7.0 + x_2) : (19.0 + x_3)) : ((8.0 + x_4) > (14.0 + x_5)? (8.0 + x_4) : (14.0 + x_5))) > (((16.0 + x_6) > (9.0 + x_7)? (16.0 + x_6) : (9.0 + x_7)) > ((2.0 + x_8) > (14.0 + x_9)? (2.0 + x_8) : (14.0 + x_9))? ((16.0 + x_6) > (9.0 + x_7)? (16.0 + x_6) : (9.0 + x_7)) : ((2.0 + x_8) > (14.0 + x_9)? (2.0 + x_8) : (14.0 + x_9)))? (((7.0 + x_2) > (19.0 + x_3)? (7.0 + x_2) : (19.0 + x_3)) > ((8.0 + x_4) > (14.0 + x_5)? (8.0 + x_4) : (14.0 + x_5))? ((7.0 + x_2) > (19.0 + x_3)? (7.0 + x_2) : (19.0 + x_3)) : ((8.0 + x_4) > (14.0 + x_5)? (8.0 + x_4) : (14.0 + x_5))) : (((16.0 + x_6) > (9.0 + x_7)? (16.0 + x_6) : (9.0 + x_7)) > ((2.0 + x_8) > (14.0 + x_9)? (2.0 + x_8) : (14.0 + x_9))? ((16.0 + x_6) > (9.0 + x_7)? (16.0 + x_6) : (9.0 + x_7)) : ((2.0 + x_8) > (14.0 + x_9)? (2.0 + x_8) : (14.0 + x_9)))) > ((((10.0 + x_10) > (3.0 + x_12)? (10.0 + x_10) : (3.0 + x_12)) > ((20.0 + x_13) > (4.0 + x_14)? (20.0 + x_13) : (4.0 + x_14))? ((10.0 + x_10) > (3.0 + x_12)? (10.0 + x_10) : (3.0 + x_12)) : ((20.0 + x_13) > (4.0 + x_14)? (20.0 + x_13) : (4.0 + x_14))) > (((10.0 + x_20) > (10.0 + x_21)? (10.0 + x_20) : (10.0 + x_21)) > ((19.0 + x_29) > (20.0 + x_30)? (19.0 + x_29) : (20.0 + x_30))? ((10.0 + x_20) > (10.0 + x_21)? (10.0 + x_20) : (10.0 + x_21)) : ((19.0 + x_29) > (20.0 + x_30)? (19.0 + x_29) : (20.0 + x_30)))? (((10.0 + x_10) > (3.0 + x_12)? (10.0 + x_10) : (3.0 + x_12)) > ((20.0 + x_13) > (4.0 + x_14)? (20.0 + x_13) : (4.0 + x_14))? ((10.0 + x_10) > (3.0 + x_12)? (10.0 + x_10) : (3.0 + x_12)) : ((20.0 + x_13) > (4.0 + x_14)? (20.0 + x_13) : (4.0 + x_14))) : (((10.0 + x_20) > (10.0 + x_21)? (10.0 + x_20) : (10.0 + x_21)) > ((19.0 + x_29) > (20.0 + x_30)? (19.0 + x_29) : (20.0 + x_30))? ((10.0 + x_20) > (10.0 + x_21)? (10.0 + x_20) : (10.0 + x_21)) : ((19.0 + x_29) > (20.0 + x_30)? (19.0 + x_29) : (20.0 + x_30))))? ((((7.0 + x_2) > (19.0 + x_3)? (7.0 + x_2) : (19.0 + x_3)) > ((8.0 + x_4) > (14.0 + x_5)? (8.0 + x_4) : (14.0 + x_5))? ((7.0 + x_2) > (19.0 + x_3)? (7.0 + x_2) : (19.0 + x_3)) : ((8.0 + x_4) > (14.0 + x_5)? (8.0 + x_4) : (14.0 + x_5))) > (((16.0 + x_6) > (9.0 + x_7)? (16.0 + x_6) : (9.0 + x_7)) > ((2.0 + x_8) > (14.0 + x_9)? (2.0 + x_8) : (14.0 + x_9))? ((16.0 + x_6) > (9.0 + x_7)? (16.0 + x_6) : (9.0 + x_7)) : ((2.0 + x_8) > (14.0 + x_9)? (2.0 + x_8) : (14.0 + x_9)))? (((7.0 + x_2) > (19.0 + x_3)? (7.0 + x_2) : (19.0 + x_3)) > ((8.0 + x_4) > (14.0 + x_5)? (8.0 + x_4) : (14.0 + x_5))? ((7.0 + x_2) > (19.0 + x_3)? (7.0 + x_2) : (19.0 + x_3)) : ((8.0 + x_4) > (14.0 + x_5)? (8.0 + x_4) : (14.0 + x_5))) : (((16.0 + x_6) > (9.0 + x_7)? (16.0 + x_6) : (9.0 + x_7)) > ((2.0 + x_8) > (14.0 + x_9)? (2.0 + x_8) : (14.0 + x_9))? ((16.0 + x_6) > (9.0 + x_7)? (16.0 + x_6) : (9.0 + x_7)) : ((2.0 + x_8) > (14.0 + x_9)? (2.0 + x_8) : (14.0 + x_9)))) : ((((10.0 + x_10) > (3.0 + x_12)? (10.0 + x_10) : (3.0 + x_12)) > ((20.0 + x_13) > (4.0 + x_14)? (20.0 + x_13) : (4.0 + x_14))? ((10.0 + x_10) > (3.0 + x_12)? (10.0 + x_10) : (3.0 + x_12)) : ((20.0 + x_13) > (4.0 + x_14)? (20.0 + x_13) : (4.0 + x_14))) > (((10.0 + x_20) > (10.0 + x_21)? (10.0 + x_20) : (10.0 + x_21)) > ((19.0 + x_29) > (20.0 + x_30)? (19.0 + x_29) : (20.0 + x_30))? ((10.0 + x_20) > (10.0 + x_21)? (10.0 + x_20) : (10.0 + x_21)) : ((19.0 + x_29) > (20.0 + x_30)? (19.0 + x_29) : (20.0 + x_30)))? (((10.0 + x_10) > (3.0 + x_12)? (10.0 + x_10) : (3.0 + x_12)) > ((20.0 + x_13) > (4.0 + x_14)? (20.0 + x_13) : (4.0 + x_14))? ((10.0 + x_10) > (3.0 + x_12)? (10.0 + x_10) : (3.0 + x_12)) : ((20.0 + x_13) > (4.0 + x_14)? (20.0 + x_13) : (4.0 + x_14))) : (((10.0 + x_20) > (10.0 + x_21)? (10.0 + x_20) : (10.0 + x_21)) > ((19.0 + x_29) > (20.0 + x_30)? (19.0 + x_29) : (20.0 + x_30))? ((10.0 + x_20) > (10.0 + x_21)? (10.0 + x_20) : (10.0 + x_21)) : ((19.0 + x_29) > (20.0 + x_30)? (19.0 + x_29) : (20.0 + x_30)))));
x_25_ = (((((18.0 + x_0) > (3.0 + x_3)? (18.0 + x_0) : (3.0 + x_3)) > ((19.0 + x_5) > (19.0 + x_7)? (19.0 + x_5) : (19.0 + x_7))? ((18.0 + x_0) > (3.0 + x_3)? (18.0 + x_0) : (3.0 + x_3)) : ((19.0 + x_5) > (19.0 + x_7)? (19.0 + x_5) : (19.0 + x_7))) > (((3.0 + x_12) > (19.0 + x_13)? (3.0 + x_12) : (19.0 + x_13)) > ((20.0 + x_14) > (18.0 + x_15)? (20.0 + x_14) : (18.0 + x_15))? ((3.0 + x_12) > (19.0 + x_13)? (3.0 + x_12) : (19.0 + x_13)) : ((20.0 + x_14) > (18.0 + x_15)? (20.0 + x_14) : (18.0 + x_15)))? (((18.0 + x_0) > (3.0 + x_3)? (18.0 + x_0) : (3.0 + x_3)) > ((19.0 + x_5) > (19.0 + x_7)? (19.0 + x_5) : (19.0 + x_7))? ((18.0 + x_0) > (3.0 + x_3)? (18.0 + x_0) : (3.0 + x_3)) : ((19.0 + x_5) > (19.0 + x_7)? (19.0 + x_5) : (19.0 + x_7))) : (((3.0 + x_12) > (19.0 + x_13)? (3.0 + x_12) : (19.0 + x_13)) > ((20.0 + x_14) > (18.0 + x_15)? (20.0 + x_14) : (18.0 + x_15))? ((3.0 + x_12) > (19.0 + x_13)? (3.0 + x_12) : (19.0 + x_13)) : ((20.0 + x_14) > (18.0 + x_15)? (20.0 + x_14) : (18.0 + x_15)))) > ((((8.0 + x_18) > (19.0 + x_21)? (8.0 + x_18) : (19.0 + x_21)) > ((9.0 + x_22) > (11.0 + x_24)? (9.0 + x_22) : (11.0 + x_24))? ((8.0 + x_18) > (19.0 + x_21)? (8.0 + x_18) : (19.0 + x_21)) : ((9.0 + x_22) > (11.0 + x_24)? (9.0 + x_22) : (11.0 + x_24))) > (((7.0 + x_26) > (14.0 + x_28)? (7.0 + x_26) : (14.0 + x_28)) > ((16.0 + x_30) > (12.0 + x_31)? (16.0 + x_30) : (12.0 + x_31))? ((7.0 + x_26) > (14.0 + x_28)? (7.0 + x_26) : (14.0 + x_28)) : ((16.0 + x_30) > (12.0 + x_31)? (16.0 + x_30) : (12.0 + x_31)))? (((8.0 + x_18) > (19.0 + x_21)? (8.0 + x_18) : (19.0 + x_21)) > ((9.0 + x_22) > (11.0 + x_24)? (9.0 + x_22) : (11.0 + x_24))? ((8.0 + x_18) > (19.0 + x_21)? (8.0 + x_18) : (19.0 + x_21)) : ((9.0 + x_22) > (11.0 + x_24)? (9.0 + x_22) : (11.0 + x_24))) : (((7.0 + x_26) > (14.0 + x_28)? (7.0 + x_26) : (14.0 + x_28)) > ((16.0 + x_30) > (12.0 + x_31)? (16.0 + x_30) : (12.0 + x_31))? ((7.0 + x_26) > (14.0 + x_28)? (7.0 + x_26) : (14.0 + x_28)) : ((16.0 + x_30) > (12.0 + x_31)? (16.0 + x_30) : (12.0 + x_31))))? ((((18.0 + x_0) > (3.0 + x_3)? (18.0 + x_0) : (3.0 + x_3)) > ((19.0 + x_5) > (19.0 + x_7)? (19.0 + x_5) : (19.0 + x_7))? ((18.0 + x_0) > (3.0 + x_3)? (18.0 + x_0) : (3.0 + x_3)) : ((19.0 + x_5) > (19.0 + x_7)? (19.0 + x_5) : (19.0 + x_7))) > (((3.0 + x_12) > (19.0 + x_13)? (3.0 + x_12) : (19.0 + x_13)) > ((20.0 + x_14) > (18.0 + x_15)? (20.0 + x_14) : (18.0 + x_15))? ((3.0 + x_12) > (19.0 + x_13)? (3.0 + x_12) : (19.0 + x_13)) : ((20.0 + x_14) > (18.0 + x_15)? (20.0 + x_14) : (18.0 + x_15)))? (((18.0 + x_0) > (3.0 + x_3)? (18.0 + x_0) : (3.0 + x_3)) > ((19.0 + x_5) > (19.0 + x_7)? (19.0 + x_5) : (19.0 + x_7))? ((18.0 + x_0) > (3.0 + x_3)? (18.0 + x_0) : (3.0 + x_3)) : ((19.0 + x_5) > (19.0 + x_7)? (19.0 + x_5) : (19.0 + x_7))) : (((3.0 + x_12) > (19.0 + x_13)? (3.0 + x_12) : (19.0 + x_13)) > ((20.0 + x_14) > (18.0 + x_15)? (20.0 + x_14) : (18.0 + x_15))? ((3.0 + x_12) > (19.0 + x_13)? (3.0 + x_12) : (19.0 + x_13)) : ((20.0 + x_14) > (18.0 + x_15)? (20.0 + x_14) : (18.0 + x_15)))) : ((((8.0 + x_18) > (19.0 + x_21)? (8.0 + x_18) : (19.0 + x_21)) > ((9.0 + x_22) > (11.0 + x_24)? (9.0 + x_22) : (11.0 + x_24))? ((8.0 + x_18) > (19.0 + x_21)? (8.0 + x_18) : (19.0 + x_21)) : ((9.0 + x_22) > (11.0 + x_24)? (9.0 + x_22) : (11.0 + x_24))) > (((7.0 + x_26) > (14.0 + x_28)? (7.0 + x_26) : (14.0 + x_28)) > ((16.0 + x_30) > (12.0 + x_31)? (16.0 + x_30) : (12.0 + x_31))? ((7.0 + x_26) > (14.0 + x_28)? (7.0 + x_26) : (14.0 + x_28)) : ((16.0 + x_30) > (12.0 + x_31)? (16.0 + x_30) : (12.0 + x_31)))? (((8.0 + x_18) > (19.0 + x_21)? (8.0 + x_18) : (19.0 + x_21)) > ((9.0 + x_22) > (11.0 + x_24)? (9.0 + x_22) : (11.0 + x_24))? ((8.0 + x_18) > (19.0 + x_21)? (8.0 + x_18) : (19.0 + x_21)) : ((9.0 + x_22) > (11.0 + x_24)? (9.0 + x_22) : (11.0 + x_24))) : (((7.0 + x_26) > (14.0 + x_28)? (7.0 + x_26) : (14.0 + x_28)) > ((16.0 + x_30) > (12.0 + x_31)? (16.0 + x_30) : (12.0 + x_31))? ((7.0 + x_26) > (14.0 + x_28)? (7.0 + x_26) : (14.0 + x_28)) : ((16.0 + x_30) > (12.0 + x_31)? (16.0 + x_30) : (12.0 + x_31)))));
x_26_ = (((((14.0 + x_1) > (14.0 + x_5)? (14.0 + x_1) : (14.0 + x_5)) > ((20.0 + x_6) > (7.0 + x_9)? (20.0 + x_6) : (7.0 + x_9))? ((14.0 + x_1) > (14.0 + x_5)? (14.0 + x_1) : (14.0 + x_5)) : ((20.0 + x_6) > (7.0 + x_9)? (20.0 + x_6) : (7.0 + x_9))) > (((14.0 + x_13) > (19.0 + x_14)? (14.0 + x_13) : (19.0 + x_14)) > ((8.0 + x_15) > (20.0 + x_17)? (8.0 + x_15) : (20.0 + x_17))? ((14.0 + x_13) > (19.0 + x_14)? (14.0 + x_13) : (19.0 + x_14)) : ((8.0 + x_15) > (20.0 + x_17)? (8.0 + x_15) : (20.0 + x_17)))? (((14.0 + x_1) > (14.0 + x_5)? (14.0 + x_1) : (14.0 + x_5)) > ((20.0 + x_6) > (7.0 + x_9)? (20.0 + x_6) : (7.0 + x_9))? ((14.0 + x_1) > (14.0 + x_5)? (14.0 + x_1) : (14.0 + x_5)) : ((20.0 + x_6) > (7.0 + x_9)? (20.0 + x_6) : (7.0 + x_9))) : (((14.0 + x_13) > (19.0 + x_14)? (14.0 + x_13) : (19.0 + x_14)) > ((8.0 + x_15) > (20.0 + x_17)? (8.0 + x_15) : (20.0 + x_17))? ((14.0 + x_13) > (19.0 + x_14)? (14.0 + x_13) : (19.0 + x_14)) : ((8.0 + x_15) > (20.0 + x_17)? (8.0 + x_15) : (20.0 + x_17)))) > ((((4.0 + x_18) > (19.0 + x_19)? (4.0 + x_18) : (19.0 + x_19)) > ((8.0 + x_22) > (17.0 + x_24)? (8.0 + x_22) : (17.0 + x_24))? ((4.0 + x_18) > (19.0 + x_19)? (4.0 + x_18) : (19.0 + x_19)) : ((8.0 + x_22) > (17.0 + x_24)? (8.0 + x_22) : (17.0 + x_24))) > (((11.0 + x_25) > (6.0 + x_27)? (11.0 + x_25) : (6.0 + x_27)) > ((17.0 + x_30) > (4.0 + x_31)? (17.0 + x_30) : (4.0 + x_31))? ((11.0 + x_25) > (6.0 + x_27)? (11.0 + x_25) : (6.0 + x_27)) : ((17.0 + x_30) > (4.0 + x_31)? (17.0 + x_30) : (4.0 + x_31)))? (((4.0 + x_18) > (19.0 + x_19)? (4.0 + x_18) : (19.0 + x_19)) > ((8.0 + x_22) > (17.0 + x_24)? (8.0 + x_22) : (17.0 + x_24))? ((4.0 + x_18) > (19.0 + x_19)? (4.0 + x_18) : (19.0 + x_19)) : ((8.0 + x_22) > (17.0 + x_24)? (8.0 + x_22) : (17.0 + x_24))) : (((11.0 + x_25) > (6.0 + x_27)? (11.0 + x_25) : (6.0 + x_27)) > ((17.0 + x_30) > (4.0 + x_31)? (17.0 + x_30) : (4.0 + x_31))? ((11.0 + x_25) > (6.0 + x_27)? (11.0 + x_25) : (6.0 + x_27)) : ((17.0 + x_30) > (4.0 + x_31)? (17.0 + x_30) : (4.0 + x_31))))? ((((14.0 + x_1) > (14.0 + x_5)? (14.0 + x_1) : (14.0 + x_5)) > ((20.0 + x_6) > (7.0 + x_9)? (20.0 + x_6) : (7.0 + x_9))? ((14.0 + x_1) > (14.0 + x_5)? (14.0 + x_1) : (14.0 + x_5)) : ((20.0 + x_6) > (7.0 + x_9)? (20.0 + x_6) : (7.0 + x_9))) > (((14.0 + x_13) > (19.0 + x_14)? (14.0 + x_13) : (19.0 + x_14)) > ((8.0 + x_15) > (20.0 + x_17)? (8.0 + x_15) : (20.0 + x_17))? ((14.0 + x_13) > (19.0 + x_14)? (14.0 + x_13) : (19.0 + x_14)) : ((8.0 + x_15) > (20.0 + x_17)? (8.0 + x_15) : (20.0 + x_17)))? (((14.0 + x_1) > (14.0 + x_5)? (14.0 + x_1) : (14.0 + x_5)) > ((20.0 + x_6) > (7.0 + x_9)? (20.0 + x_6) : (7.0 + x_9))? ((14.0 + x_1) > (14.0 + x_5)? (14.0 + x_1) : (14.0 + x_5)) : ((20.0 + x_6) > (7.0 + x_9)? (20.0 + x_6) : (7.0 + x_9))) : (((14.0 + x_13) > (19.0 + x_14)? (14.0 + x_13) : (19.0 + x_14)) > ((8.0 + x_15) > (20.0 + x_17)? (8.0 + x_15) : (20.0 + x_17))? ((14.0 + x_13) > (19.0 + x_14)? (14.0 + x_13) : (19.0 + x_14)) : ((8.0 + x_15) > (20.0 + x_17)? (8.0 + x_15) : (20.0 + x_17)))) : ((((4.0 + x_18) > (19.0 + x_19)? (4.0 + x_18) : (19.0 + x_19)) > ((8.0 + x_22) > (17.0 + x_24)? (8.0 + x_22) : (17.0 + x_24))? ((4.0 + x_18) > (19.0 + x_19)? (4.0 + x_18) : (19.0 + x_19)) : ((8.0 + x_22) > (17.0 + x_24)? (8.0 + x_22) : (17.0 + x_24))) > (((11.0 + x_25) > (6.0 + x_27)? (11.0 + x_25) : (6.0 + x_27)) > ((17.0 + x_30) > (4.0 + x_31)? (17.0 + x_30) : (4.0 + x_31))? ((11.0 + x_25) > (6.0 + x_27)? (11.0 + x_25) : (6.0 + x_27)) : ((17.0 + x_30) > (4.0 + x_31)? (17.0 + x_30) : (4.0 + x_31)))? (((4.0 + x_18) > (19.0 + x_19)? (4.0 + x_18) : (19.0 + x_19)) > ((8.0 + x_22) > (17.0 + x_24)? (8.0 + x_22) : (17.0 + x_24))? ((4.0 + x_18) > (19.0 + x_19)? (4.0 + x_18) : (19.0 + x_19)) : ((8.0 + x_22) > (17.0 + x_24)? (8.0 + x_22) : (17.0 + x_24))) : (((11.0 + x_25) > (6.0 + x_27)? (11.0 + x_25) : (6.0 + x_27)) > ((17.0 + x_30) > (4.0 + x_31)? (17.0 + x_30) : (4.0 + x_31))? ((11.0 + x_25) > (6.0 + x_27)? (11.0 + x_25) : (6.0 + x_27)) : ((17.0 + x_30) > (4.0 + x_31)? (17.0 + x_30) : (4.0 + x_31)))));
x_27_ = (((((17.0 + x_0) > (6.0 + x_1)? (17.0 + x_0) : (6.0 + x_1)) > ((17.0 + x_2) > (10.0 + x_3)? (17.0 + x_2) : (10.0 + x_3))? ((17.0 + x_0) > (6.0 + x_1)? (17.0 + x_0) : (6.0 + x_1)) : ((17.0 + x_2) > (10.0 + x_3)? (17.0 + x_2) : (10.0 + x_3))) > (((15.0 + x_6) > (13.0 + x_11)? (15.0 + x_6) : (13.0 + x_11)) > ((15.0 + x_13) > (9.0 + x_15)? (15.0 + x_13) : (9.0 + x_15))? ((15.0 + x_6) > (13.0 + x_11)? (15.0 + x_6) : (13.0 + x_11)) : ((15.0 + x_13) > (9.0 + x_15)? (15.0 + x_13) : (9.0 + x_15)))? (((17.0 + x_0) > (6.0 + x_1)? (17.0 + x_0) : (6.0 + x_1)) > ((17.0 + x_2) > (10.0 + x_3)? (17.0 + x_2) : (10.0 + x_3))? ((17.0 + x_0) > (6.0 + x_1)? (17.0 + x_0) : (6.0 + x_1)) : ((17.0 + x_2) > (10.0 + x_3)? (17.0 + x_2) : (10.0 + x_3))) : (((15.0 + x_6) > (13.0 + x_11)? (15.0 + x_6) : (13.0 + x_11)) > ((15.0 + x_13) > (9.0 + x_15)? (15.0 + x_13) : (9.0 + x_15))? ((15.0 + x_6) > (13.0 + x_11)? (15.0 + x_6) : (13.0 + x_11)) : ((15.0 + x_13) > (9.0 + x_15)? (15.0 + x_13) : (9.0 + x_15)))) > ((((20.0 + x_16) > (2.0 + x_20)? (20.0 + x_16) : (2.0 + x_20)) > ((10.0 + x_23) > (20.0 + x_24)? (10.0 + x_23) : (20.0 + x_24))? ((20.0 + x_16) > (2.0 + x_20)? (20.0 + x_16) : (2.0 + x_20)) : ((10.0 + x_23) > (20.0 + x_24)? (10.0 + x_23) : (20.0 + x_24))) > (((10.0 + x_26) > (11.0 + x_29)? (10.0 + x_26) : (11.0 + x_29)) > ((10.0 + x_30) > (17.0 + x_31)? (10.0 + x_30) : (17.0 + x_31))? ((10.0 + x_26) > (11.0 + x_29)? (10.0 + x_26) : (11.0 + x_29)) : ((10.0 + x_30) > (17.0 + x_31)? (10.0 + x_30) : (17.0 + x_31)))? (((20.0 + x_16) > (2.0 + x_20)? (20.0 + x_16) : (2.0 + x_20)) > ((10.0 + x_23) > (20.0 + x_24)? (10.0 + x_23) : (20.0 + x_24))? ((20.0 + x_16) > (2.0 + x_20)? (20.0 + x_16) : (2.0 + x_20)) : ((10.0 + x_23) > (20.0 + x_24)? (10.0 + x_23) : (20.0 + x_24))) : (((10.0 + x_26) > (11.0 + x_29)? (10.0 + x_26) : (11.0 + x_29)) > ((10.0 + x_30) > (17.0 + x_31)? (10.0 + x_30) : (17.0 + x_31))? ((10.0 + x_26) > (11.0 + x_29)? (10.0 + x_26) : (11.0 + x_29)) : ((10.0 + x_30) > (17.0 + x_31)? (10.0 + x_30) : (17.0 + x_31))))? ((((17.0 + x_0) > (6.0 + x_1)? (17.0 + x_0) : (6.0 + x_1)) > ((17.0 + x_2) > (10.0 + x_3)? (17.0 + x_2) : (10.0 + x_3))? ((17.0 + x_0) > (6.0 + x_1)? (17.0 + x_0) : (6.0 + x_1)) : ((17.0 + x_2) > (10.0 + x_3)? (17.0 + x_2) : (10.0 + x_3))) > (((15.0 + x_6) > (13.0 + x_11)? (15.0 + x_6) : (13.0 + x_11)) > ((15.0 + x_13) > (9.0 + x_15)? (15.0 + x_13) : (9.0 + x_15))? ((15.0 + x_6) > (13.0 + x_11)? (15.0 + x_6) : (13.0 + x_11)) : ((15.0 + x_13) > (9.0 + x_15)? (15.0 + x_13) : (9.0 + x_15)))? (((17.0 + x_0) > (6.0 + x_1)? (17.0 + x_0) : (6.0 + x_1)) > ((17.0 + x_2) > (10.0 + x_3)? (17.0 + x_2) : (10.0 + x_3))? ((17.0 + x_0) > (6.0 + x_1)? (17.0 + x_0) : (6.0 + x_1)) : ((17.0 + x_2) > (10.0 + x_3)? (17.0 + x_2) : (10.0 + x_3))) : (((15.0 + x_6) > (13.0 + x_11)? (15.0 + x_6) : (13.0 + x_11)) > ((15.0 + x_13) > (9.0 + x_15)? (15.0 + x_13) : (9.0 + x_15))? ((15.0 + x_6) > (13.0 + x_11)? (15.0 + x_6) : (13.0 + x_11)) : ((15.0 + x_13) > (9.0 + x_15)? (15.0 + x_13) : (9.0 + x_15)))) : ((((20.0 + x_16) > (2.0 + x_20)? (20.0 + x_16) : (2.0 + x_20)) > ((10.0 + x_23) > (20.0 + x_24)? (10.0 + x_23) : (20.0 + x_24))? ((20.0 + x_16) > (2.0 + x_20)? (20.0 + x_16) : (2.0 + x_20)) : ((10.0 + x_23) > (20.0 + x_24)? (10.0 + x_23) : (20.0 + x_24))) > (((10.0 + x_26) > (11.0 + x_29)? (10.0 + x_26) : (11.0 + x_29)) > ((10.0 + x_30) > (17.0 + x_31)? (10.0 + x_30) : (17.0 + x_31))? ((10.0 + x_26) > (11.0 + x_29)? (10.0 + x_26) : (11.0 + x_29)) : ((10.0 + x_30) > (17.0 + x_31)? (10.0 + x_30) : (17.0 + x_31)))? (((20.0 + x_16) > (2.0 + x_20)? (20.0 + x_16) : (2.0 + x_20)) > ((10.0 + x_23) > (20.0 + x_24)? (10.0 + x_23) : (20.0 + x_24))? ((20.0 + x_16) > (2.0 + x_20)? (20.0 + x_16) : (2.0 + x_20)) : ((10.0 + x_23) > (20.0 + x_24)? (10.0 + x_23) : (20.0 + x_24))) : (((10.0 + x_26) > (11.0 + x_29)? (10.0 + x_26) : (11.0 + x_29)) > ((10.0 + x_30) > (17.0 + x_31)? (10.0 + x_30) : (17.0 + x_31))? ((10.0 + x_26) > (11.0 + x_29)? (10.0 + x_26) : (11.0 + x_29)) : ((10.0 + x_30) > (17.0 + x_31)? (10.0 + x_30) : (17.0 + x_31)))));
x_28_ = (((((18.0 + x_0) > (1.0 + x_2)? (18.0 + x_0) : (1.0 + x_2)) > ((17.0 + x_5) > (11.0 + x_7)? (17.0 + x_5) : (11.0 + x_7))? ((18.0 + x_0) > (1.0 + x_2)? (18.0 + x_0) : (1.0 + x_2)) : ((17.0 + x_5) > (11.0 + x_7)? (17.0 + x_5) : (11.0 + x_7))) > (((4.0 + x_9) > (12.0 + x_11)? (4.0 + x_9) : (12.0 + x_11)) > ((20.0 + x_12) > (12.0 + x_13)? (20.0 + x_12) : (12.0 + x_13))? ((4.0 + x_9) > (12.0 + x_11)? (4.0 + x_9) : (12.0 + x_11)) : ((20.0 + x_12) > (12.0 + x_13)? (20.0 + x_12) : (12.0 + x_13)))? (((18.0 + x_0) > (1.0 + x_2)? (18.0 + x_0) : (1.0 + x_2)) > ((17.0 + x_5) > (11.0 + x_7)? (17.0 + x_5) : (11.0 + x_7))? ((18.0 + x_0) > (1.0 + x_2)? (18.0 + x_0) : (1.0 + x_2)) : ((17.0 + x_5) > (11.0 + x_7)? (17.0 + x_5) : (11.0 + x_7))) : (((4.0 + x_9) > (12.0 + x_11)? (4.0 + x_9) : (12.0 + x_11)) > ((20.0 + x_12) > (12.0 + x_13)? (20.0 + x_12) : (12.0 + x_13))? ((4.0 + x_9) > (12.0 + x_11)? (4.0 + x_9) : (12.0 + x_11)) : ((20.0 + x_12) > (12.0 + x_13)? (20.0 + x_12) : (12.0 + x_13)))) > ((((6.0 + x_14) > (1.0 + x_16)? (6.0 + x_14) : (1.0 + x_16)) > ((2.0 + x_18) > (13.0 + x_25)? (2.0 + x_18) : (13.0 + x_25))? ((6.0 + x_14) > (1.0 + x_16)? (6.0 + x_14) : (1.0 + x_16)) : ((2.0 + x_18) > (13.0 + x_25)? (2.0 + x_18) : (13.0 + x_25))) > (((20.0 + x_26) > (19.0 + x_28)? (20.0 + x_26) : (19.0 + x_28)) > ((19.0 + x_29) > (11.0 + x_30)? (19.0 + x_29) : (11.0 + x_30))? ((20.0 + x_26) > (19.0 + x_28)? (20.0 + x_26) : (19.0 + x_28)) : ((19.0 + x_29) > (11.0 + x_30)? (19.0 + x_29) : (11.0 + x_30)))? (((6.0 + x_14) > (1.0 + x_16)? (6.0 + x_14) : (1.0 + x_16)) > ((2.0 + x_18) > (13.0 + x_25)? (2.0 + x_18) : (13.0 + x_25))? ((6.0 + x_14) > (1.0 + x_16)? (6.0 + x_14) : (1.0 + x_16)) : ((2.0 + x_18) > (13.0 + x_25)? (2.0 + x_18) : (13.0 + x_25))) : (((20.0 + x_26) > (19.0 + x_28)? (20.0 + x_26) : (19.0 + x_28)) > ((19.0 + x_29) > (11.0 + x_30)? (19.0 + x_29) : (11.0 + x_30))? ((20.0 + x_26) > (19.0 + x_28)? (20.0 + x_26) : (19.0 + x_28)) : ((19.0 + x_29) > (11.0 + x_30)? (19.0 + x_29) : (11.0 + x_30))))? ((((18.0 + x_0) > (1.0 + x_2)? (18.0 + x_0) : (1.0 + x_2)) > ((17.0 + x_5) > (11.0 + x_7)? (17.0 + x_5) : (11.0 + x_7))? ((18.0 + x_0) > (1.0 + x_2)? (18.0 + x_0) : (1.0 + x_2)) : ((17.0 + x_5) > (11.0 + x_7)? (17.0 + x_5) : (11.0 + x_7))) > (((4.0 + x_9) > (12.0 + x_11)? (4.0 + x_9) : (12.0 + x_11)) > ((20.0 + x_12) > (12.0 + x_13)? (20.0 + x_12) : (12.0 + x_13))? ((4.0 + x_9) > (12.0 + x_11)? (4.0 + x_9) : (12.0 + x_11)) : ((20.0 + x_12) > (12.0 + x_13)? (20.0 + x_12) : (12.0 + x_13)))? (((18.0 + x_0) > (1.0 + x_2)? (18.0 + x_0) : (1.0 + x_2)) > ((17.0 + x_5) > (11.0 + x_7)? (17.0 + x_5) : (11.0 + x_7))? ((18.0 + x_0) > (1.0 + x_2)? (18.0 + x_0) : (1.0 + x_2)) : ((17.0 + x_5) > (11.0 + x_7)? (17.0 + x_5) : (11.0 + x_7))) : (((4.0 + x_9) > (12.0 + x_11)? (4.0 + x_9) : (12.0 + x_11)) > ((20.0 + x_12) > (12.0 + x_13)? (20.0 + x_12) : (12.0 + x_13))? ((4.0 + x_9) > (12.0 + x_11)? (4.0 + x_9) : (12.0 + x_11)) : ((20.0 + x_12) > (12.0 + x_13)? (20.0 + x_12) : (12.0 + x_13)))) : ((((6.0 + x_14) > (1.0 + x_16)? (6.0 + x_14) : (1.0 + x_16)) > ((2.0 + x_18) > (13.0 + x_25)? (2.0 + x_18) : (13.0 + x_25))? ((6.0 + x_14) > (1.0 + x_16)? (6.0 + x_14) : (1.0 + x_16)) : ((2.0 + x_18) > (13.0 + x_25)? (2.0 + x_18) : (13.0 + x_25))) > (((20.0 + x_26) > (19.0 + x_28)? (20.0 + x_26) : (19.0 + x_28)) > ((19.0 + x_29) > (11.0 + x_30)? (19.0 + x_29) : (11.0 + x_30))? ((20.0 + x_26) > (19.0 + x_28)? (20.0 + x_26) : (19.0 + x_28)) : ((19.0 + x_29) > (11.0 + x_30)? (19.0 + x_29) : (11.0 + x_30)))? (((6.0 + x_14) > (1.0 + x_16)? (6.0 + x_14) : (1.0 + x_16)) > ((2.0 + x_18) > (13.0 + x_25)? (2.0 + x_18) : (13.0 + x_25))? ((6.0 + x_14) > (1.0 + x_16)? (6.0 + x_14) : (1.0 + x_16)) : ((2.0 + x_18) > (13.0 + x_25)? (2.0 + x_18) : (13.0 + x_25))) : (((20.0 + x_26) > (19.0 + x_28)? (20.0 + x_26) : (19.0 + x_28)) > ((19.0 + x_29) > (11.0 + x_30)? (19.0 + x_29) : (11.0 + x_30))? ((20.0 + x_26) > (19.0 + x_28)? (20.0 + x_26) : (19.0 + x_28)) : ((19.0 + x_29) > (11.0 + x_30)? (19.0 + x_29) : (11.0 + x_30)))));
x_29_ = (((((6.0 + x_0) > (17.0 + x_2)? (6.0 + x_0) : (17.0 + x_2)) > ((6.0 + x_8) > (10.0 + x_9)? (6.0 + x_8) : (10.0 + x_9))? ((6.0 + x_0) > (17.0 + x_2)? (6.0 + x_0) : (17.0 + x_2)) : ((6.0 + x_8) > (10.0 + x_9)? (6.0 + x_8) : (10.0 + x_9))) > (((3.0 + x_10) > (14.0 + x_11)? (3.0 + x_10) : (14.0 + x_11)) > ((13.0 + x_16) > (8.0 + x_17)? (13.0 + x_16) : (8.0 + x_17))? ((3.0 + x_10) > (14.0 + x_11)? (3.0 + x_10) : (14.0 + x_11)) : ((13.0 + x_16) > (8.0 + x_17)? (13.0 + x_16) : (8.0 + x_17)))? (((6.0 + x_0) > (17.0 + x_2)? (6.0 + x_0) : (17.0 + x_2)) > ((6.0 + x_8) > (10.0 + x_9)? (6.0 + x_8) : (10.0 + x_9))? ((6.0 + x_0) > (17.0 + x_2)? (6.0 + x_0) : (17.0 + x_2)) : ((6.0 + x_8) > (10.0 + x_9)? (6.0 + x_8) : (10.0 + x_9))) : (((3.0 + x_10) > (14.0 + x_11)? (3.0 + x_10) : (14.0 + x_11)) > ((13.0 + x_16) > (8.0 + x_17)? (13.0 + x_16) : (8.0 + x_17))? ((3.0 + x_10) > (14.0 + x_11)? (3.0 + x_10) : (14.0 + x_11)) : ((13.0 + x_16) > (8.0 + x_17)? (13.0 + x_16) : (8.0 + x_17)))) > ((((16.0 + x_19) > (6.0 + x_21)? (16.0 + x_19) : (6.0 + x_21)) > ((17.0 + x_22) > (11.0 + x_24)? (17.0 + x_22) : (11.0 + x_24))? ((16.0 + x_19) > (6.0 + x_21)? (16.0 + x_19) : (6.0 + x_21)) : ((17.0 + x_22) > (11.0 + x_24)? (17.0 + x_22) : (11.0 + x_24))) > (((1.0 + x_25) > (9.0 + x_27)? (1.0 + x_25) : (9.0 + x_27)) > ((11.0 + x_29) > (19.0 + x_30)? (11.0 + x_29) : (19.0 + x_30))? ((1.0 + x_25) > (9.0 + x_27)? (1.0 + x_25) : (9.0 + x_27)) : ((11.0 + x_29) > (19.0 + x_30)? (11.0 + x_29) : (19.0 + x_30)))? (((16.0 + x_19) > (6.0 + x_21)? (16.0 + x_19) : (6.0 + x_21)) > ((17.0 + x_22) > (11.0 + x_24)? (17.0 + x_22) : (11.0 + x_24))? ((16.0 + x_19) > (6.0 + x_21)? (16.0 + x_19) : (6.0 + x_21)) : ((17.0 + x_22) > (11.0 + x_24)? (17.0 + x_22) : (11.0 + x_24))) : (((1.0 + x_25) > (9.0 + x_27)? (1.0 + x_25) : (9.0 + x_27)) > ((11.0 + x_29) > (19.0 + x_30)? (11.0 + x_29) : (19.0 + x_30))? ((1.0 + x_25) > (9.0 + x_27)? (1.0 + x_25) : (9.0 + x_27)) : ((11.0 + x_29) > (19.0 + x_30)? (11.0 + x_29) : (19.0 + x_30))))? ((((6.0 + x_0) > (17.0 + x_2)? (6.0 + x_0) : (17.0 + x_2)) > ((6.0 + x_8) > (10.0 + x_9)? (6.0 + x_8) : (10.0 + x_9))? ((6.0 + x_0) > (17.0 + x_2)? (6.0 + x_0) : (17.0 + x_2)) : ((6.0 + x_8) > (10.0 + x_9)? (6.0 + x_8) : (10.0 + x_9))) > (((3.0 + x_10) > (14.0 + x_11)? (3.0 + x_10) : (14.0 + x_11)) > ((13.0 + x_16) > (8.0 + x_17)? (13.0 + x_16) : (8.0 + x_17))? ((3.0 + x_10) > (14.0 + x_11)? (3.0 + x_10) : (14.0 + x_11)) : ((13.0 + x_16) > (8.0 + x_17)? (13.0 + x_16) : (8.0 + x_17)))? (((6.0 + x_0) > (17.0 + x_2)? (6.0 + x_0) : (17.0 + x_2)) > ((6.0 + x_8) > (10.0 + x_9)? (6.0 + x_8) : (10.0 + x_9))? ((6.0 + x_0) > (17.0 + x_2)? (6.0 + x_0) : (17.0 + x_2)) : ((6.0 + x_8) > (10.0 + x_9)? (6.0 + x_8) : (10.0 + x_9))) : (((3.0 + x_10) > (14.0 + x_11)? (3.0 + x_10) : (14.0 + x_11)) > ((13.0 + x_16) > (8.0 + x_17)? (13.0 + x_16) : (8.0 + x_17))? ((3.0 + x_10) > (14.0 + x_11)? (3.0 + x_10) : (14.0 + x_11)) : ((13.0 + x_16) > (8.0 + x_17)? (13.0 + x_16) : (8.0 + x_17)))) : ((((16.0 + x_19) > (6.0 + x_21)? (16.0 + x_19) : (6.0 + x_21)) > ((17.0 + x_22) > (11.0 + x_24)? (17.0 + x_22) : (11.0 + x_24))? ((16.0 + x_19) > (6.0 + x_21)? (16.0 + x_19) : (6.0 + x_21)) : ((17.0 + x_22) > (11.0 + x_24)? (17.0 + x_22) : (11.0 + x_24))) > (((1.0 + x_25) > (9.0 + x_27)? (1.0 + x_25) : (9.0 + x_27)) > ((11.0 + x_29) > (19.0 + x_30)? (11.0 + x_29) : (19.0 + x_30))? ((1.0 + x_25) > (9.0 + x_27)? (1.0 + x_25) : (9.0 + x_27)) : ((11.0 + x_29) > (19.0 + x_30)? (11.0 + x_29) : (19.0 + x_30)))? (((16.0 + x_19) > (6.0 + x_21)? (16.0 + x_19) : (6.0 + x_21)) > ((17.0 + x_22) > (11.0 + x_24)? (17.0 + x_22) : (11.0 + x_24))? ((16.0 + x_19) > (6.0 + x_21)? (16.0 + x_19) : (6.0 + x_21)) : ((17.0 + x_22) > (11.0 + x_24)? (17.0 + x_22) : (11.0 + x_24))) : (((1.0 + x_25) > (9.0 + x_27)? (1.0 + x_25) : (9.0 + x_27)) > ((11.0 + x_29) > (19.0 + x_30)? (11.0 + x_29) : (19.0 + x_30))? ((1.0 + x_25) > (9.0 + x_27)? (1.0 + x_25) : (9.0 + x_27)) : ((11.0 + x_29) > (19.0 + x_30)? (11.0 + x_29) : (19.0 + x_30)))));
x_30_ = (((((8.0 + x_0) > (1.0 + x_1)? (8.0 + x_0) : (1.0 + x_1)) > ((2.0 + x_2) > (10.0 + x_4)? (2.0 + x_2) : (10.0 + x_4))? ((8.0 + x_0) > (1.0 + x_1)? (8.0 + x_0) : (1.0 + x_1)) : ((2.0 + x_2) > (10.0 + x_4)? (2.0 + x_2) : (10.0 + x_4))) > (((12.0 + x_7) > (16.0 + x_8)? (12.0 + x_7) : (16.0 + x_8)) > ((7.0 + x_9) > (11.0 + x_11)? (7.0 + x_9) : (11.0 + x_11))? ((12.0 + x_7) > (16.0 + x_8)? (12.0 + x_7) : (16.0 + x_8)) : ((7.0 + x_9) > (11.0 + x_11)? (7.0 + x_9) : (11.0 + x_11)))? (((8.0 + x_0) > (1.0 + x_1)? (8.0 + x_0) : (1.0 + x_1)) > ((2.0 + x_2) > (10.0 + x_4)? (2.0 + x_2) : (10.0 + x_4))? ((8.0 + x_0) > (1.0 + x_1)? (8.0 + x_0) : (1.0 + x_1)) : ((2.0 + x_2) > (10.0 + x_4)? (2.0 + x_2) : (10.0 + x_4))) : (((12.0 + x_7) > (16.0 + x_8)? (12.0 + x_7) : (16.0 + x_8)) > ((7.0 + x_9) > (11.0 + x_11)? (7.0 + x_9) : (11.0 + x_11))? ((12.0 + x_7) > (16.0 + x_8)? (12.0 + x_7) : (16.0 + x_8)) : ((7.0 + x_9) > (11.0 + x_11)? (7.0 + x_9) : (11.0 + x_11)))) > ((((3.0 + x_16) > (1.0 + x_19)? (3.0 + x_16) : (1.0 + x_19)) > ((4.0 + x_21) > (13.0 + x_22)? (4.0 + x_21) : (13.0 + x_22))? ((3.0 + x_16) > (1.0 + x_19)? (3.0 + x_16) : (1.0 + x_19)) : ((4.0 + x_21) > (13.0 + x_22)? (4.0 + x_21) : (13.0 + x_22))) > (((20.0 + x_23) > (14.0 + x_25)? (20.0 + x_23) : (14.0 + x_25)) > ((3.0 + x_28) > (15.0 + x_30)? (3.0 + x_28) : (15.0 + x_30))? ((20.0 + x_23) > (14.0 + x_25)? (20.0 + x_23) : (14.0 + x_25)) : ((3.0 + x_28) > (15.0 + x_30)? (3.0 + x_28) : (15.0 + x_30)))? (((3.0 + x_16) > (1.0 + x_19)? (3.0 + x_16) : (1.0 + x_19)) > ((4.0 + x_21) > (13.0 + x_22)? (4.0 + x_21) : (13.0 + x_22))? ((3.0 + x_16) > (1.0 + x_19)? (3.0 + x_16) : (1.0 + x_19)) : ((4.0 + x_21) > (13.0 + x_22)? (4.0 + x_21) : (13.0 + x_22))) : (((20.0 + x_23) > (14.0 + x_25)? (20.0 + x_23) : (14.0 + x_25)) > ((3.0 + x_28) > (15.0 + x_30)? (3.0 + x_28) : (15.0 + x_30))? ((20.0 + x_23) > (14.0 + x_25)? (20.0 + x_23) : (14.0 + x_25)) : ((3.0 + x_28) > (15.0 + x_30)? (3.0 + x_28) : (15.0 + x_30))))? ((((8.0 + x_0) > (1.0 + x_1)? (8.0 + x_0) : (1.0 + x_1)) > ((2.0 + x_2) > (10.0 + x_4)? (2.0 + x_2) : (10.0 + x_4))? ((8.0 + x_0) > (1.0 + x_1)? (8.0 + x_0) : (1.0 + x_1)) : ((2.0 + x_2) > (10.0 + x_4)? (2.0 + x_2) : (10.0 + x_4))) > (((12.0 + x_7) > (16.0 + x_8)? (12.0 + x_7) : (16.0 + x_8)) > ((7.0 + x_9) > (11.0 + x_11)? (7.0 + x_9) : (11.0 + x_11))? ((12.0 + x_7) > (16.0 + x_8)? (12.0 + x_7) : (16.0 + x_8)) : ((7.0 + x_9) > (11.0 + x_11)? (7.0 + x_9) : (11.0 + x_11)))? (((8.0 + x_0) > (1.0 + x_1)? (8.0 + x_0) : (1.0 + x_1)) > ((2.0 + x_2) > (10.0 + x_4)? (2.0 + x_2) : (10.0 + x_4))? ((8.0 + x_0) > (1.0 + x_1)? (8.0 + x_0) : (1.0 + x_1)) : ((2.0 + x_2) > (10.0 + x_4)? (2.0 + x_2) : (10.0 + x_4))) : (((12.0 + x_7) > (16.0 + x_8)? (12.0 + x_7) : (16.0 + x_8)) > ((7.0 + x_9) > (11.0 + x_11)? (7.0 + x_9) : (11.0 + x_11))? ((12.0 + x_7) > (16.0 + x_8)? (12.0 + x_7) : (16.0 + x_8)) : ((7.0 + x_9) > (11.0 + x_11)? (7.0 + x_9) : (11.0 + x_11)))) : ((((3.0 + x_16) > (1.0 + x_19)? (3.0 + x_16) : (1.0 + x_19)) > ((4.0 + x_21) > (13.0 + x_22)? (4.0 + x_21) : (13.0 + x_22))? ((3.0 + x_16) > (1.0 + x_19)? (3.0 + x_16) : (1.0 + x_19)) : ((4.0 + x_21) > (13.0 + x_22)? (4.0 + x_21) : (13.0 + x_22))) > (((20.0 + x_23) > (14.0 + x_25)? (20.0 + x_23) : (14.0 + x_25)) > ((3.0 + x_28) > (15.0 + x_30)? (3.0 + x_28) : (15.0 + x_30))? ((20.0 + x_23) > (14.0 + x_25)? (20.0 + x_23) : (14.0 + x_25)) : ((3.0 + x_28) > (15.0 + x_30)? (3.0 + x_28) : (15.0 + x_30)))? (((3.0 + x_16) > (1.0 + x_19)? (3.0 + x_16) : (1.0 + x_19)) > ((4.0 + x_21) > (13.0 + x_22)? (4.0 + x_21) : (13.0 + x_22))? ((3.0 + x_16) > (1.0 + x_19)? (3.0 + x_16) : (1.0 + x_19)) : ((4.0 + x_21) > (13.0 + x_22)? (4.0 + x_21) : (13.0 + x_22))) : (((20.0 + x_23) > (14.0 + x_25)? (20.0 + x_23) : (14.0 + x_25)) > ((3.0 + x_28) > (15.0 + x_30)? (3.0 + x_28) : (15.0 + x_30))? ((20.0 + x_23) > (14.0 + x_25)? (20.0 + x_23) : (14.0 + x_25)) : ((3.0 + x_28) > (15.0 + x_30)? (3.0 + x_28) : (15.0 + x_30)))));
x_31_ = (((((19.0 + x_1) > (4.0 + x_3)? (19.0 + x_1) : (4.0 + x_3)) > ((8.0 + x_4) > (16.0 + x_9)? (8.0 + x_4) : (16.0 + x_9))? ((19.0 + x_1) > (4.0 + x_3)? (19.0 + x_1) : (4.0 + x_3)) : ((8.0 + x_4) > (16.0 + x_9)? (8.0 + x_4) : (16.0 + x_9))) > (((9.0 + x_10) > (16.0 + x_13)? (9.0 + x_10) : (16.0 + x_13)) > ((2.0 + x_14) > (4.0 + x_15)? (2.0 + x_14) : (4.0 + x_15))? ((9.0 + x_10) > (16.0 + x_13)? (9.0 + x_10) : (16.0 + x_13)) : ((2.0 + x_14) > (4.0 + x_15)? (2.0 + x_14) : (4.0 + x_15)))? (((19.0 + x_1) > (4.0 + x_3)? (19.0 + x_1) : (4.0 + x_3)) > ((8.0 + x_4) > (16.0 + x_9)? (8.0 + x_4) : (16.0 + x_9))? ((19.0 + x_1) > (4.0 + x_3)? (19.0 + x_1) : (4.0 + x_3)) : ((8.0 + x_4) > (16.0 + x_9)? (8.0 + x_4) : (16.0 + x_9))) : (((9.0 + x_10) > (16.0 + x_13)? (9.0 + x_10) : (16.0 + x_13)) > ((2.0 + x_14) > (4.0 + x_15)? (2.0 + x_14) : (4.0 + x_15))? ((9.0 + x_10) > (16.0 + x_13)? (9.0 + x_10) : (16.0 + x_13)) : ((2.0 + x_14) > (4.0 + x_15)? (2.0 + x_14) : (4.0 + x_15)))) > ((((13.0 + x_16) > (12.0 + x_18)? (13.0 + x_16) : (12.0 + x_18)) > ((19.0 + x_21) > (20.0 + x_23)? (19.0 + x_21) : (20.0 + x_23))? ((13.0 + x_16) > (12.0 + x_18)? (13.0 + x_16) : (12.0 + x_18)) : ((19.0 + x_21) > (20.0 + x_23)? (19.0 + x_21) : (20.0 + x_23))) > (((18.0 + x_24) > (8.0 + x_26)? (18.0 + x_24) : (8.0 + x_26)) > ((18.0 + x_28) > (11.0 + x_29)? (18.0 + x_28) : (11.0 + x_29))? ((18.0 + x_24) > (8.0 + x_26)? (18.0 + x_24) : (8.0 + x_26)) : ((18.0 + x_28) > (11.0 + x_29)? (18.0 + x_28) : (11.0 + x_29)))? (((13.0 + x_16) > (12.0 + x_18)? (13.0 + x_16) : (12.0 + x_18)) > ((19.0 + x_21) > (20.0 + x_23)? (19.0 + x_21) : (20.0 + x_23))? ((13.0 + x_16) > (12.0 + x_18)? (13.0 + x_16) : (12.0 + x_18)) : ((19.0 + x_21) > (20.0 + x_23)? (19.0 + x_21) : (20.0 + x_23))) : (((18.0 + x_24) > (8.0 + x_26)? (18.0 + x_24) : (8.0 + x_26)) > ((18.0 + x_28) > (11.0 + x_29)? (18.0 + x_28) : (11.0 + x_29))? ((18.0 + x_24) > (8.0 + x_26)? (18.0 + x_24) : (8.0 + x_26)) : ((18.0 + x_28) > (11.0 + x_29)? (18.0 + x_28) : (11.0 + x_29))))? ((((19.0 + x_1) > (4.0 + x_3)? (19.0 + x_1) : (4.0 + x_3)) > ((8.0 + x_4) > (16.0 + x_9)? (8.0 + x_4) : (16.0 + x_9))? ((19.0 + x_1) > (4.0 + x_3)? (19.0 + x_1) : (4.0 + x_3)) : ((8.0 + x_4) > (16.0 + x_9)? (8.0 + x_4) : (16.0 + x_9))) > (((9.0 + x_10) > (16.0 + x_13)? (9.0 + x_10) : (16.0 + x_13)) > ((2.0 + x_14) > (4.0 + x_15)? (2.0 + x_14) : (4.0 + x_15))? ((9.0 + x_10) > (16.0 + x_13)? (9.0 + x_10) : (16.0 + x_13)) : ((2.0 + x_14) > (4.0 + x_15)? (2.0 + x_14) : (4.0 + x_15)))? (((19.0 + x_1) > (4.0 + x_3)? (19.0 + x_1) : (4.0 + x_3)) > ((8.0 + x_4) > (16.0 + x_9)? (8.0 + x_4) : (16.0 + x_9))? ((19.0 + x_1) > (4.0 + x_3)? (19.0 + x_1) : (4.0 + x_3)) : ((8.0 + x_4) > (16.0 + x_9)? (8.0 + x_4) : (16.0 + x_9))) : (((9.0 + x_10) > (16.0 + x_13)? (9.0 + x_10) : (16.0 + x_13)) > ((2.0 + x_14) > (4.0 + x_15)? (2.0 + x_14) : (4.0 + x_15))? ((9.0 + x_10) > (16.0 + x_13)? (9.0 + x_10) : (16.0 + x_13)) : ((2.0 + x_14) > (4.0 + x_15)? (2.0 + x_14) : (4.0 + x_15)))) : ((((13.0 + x_16) > (12.0 + x_18)? (13.0 + x_16) : (12.0 + x_18)) > ((19.0 + x_21) > (20.0 + x_23)? (19.0 + x_21) : (20.0 + x_23))? ((13.0 + x_16) > (12.0 + x_18)? (13.0 + x_16) : (12.0 + x_18)) : ((19.0 + x_21) > (20.0 + x_23)? (19.0 + x_21) : (20.0 + x_23))) > (((18.0 + x_24) > (8.0 + x_26)? (18.0 + x_24) : (8.0 + x_26)) > ((18.0 + x_28) > (11.0 + x_29)? (18.0 + x_28) : (11.0 + x_29))? ((18.0 + x_24) > (8.0 + x_26)? (18.0 + x_24) : (8.0 + x_26)) : ((18.0 + x_28) > (11.0 + x_29)? (18.0 + x_28) : (11.0 + x_29)))? (((13.0 + x_16) > (12.0 + x_18)? (13.0 + x_16) : (12.0 + x_18)) > ((19.0 + x_21) > (20.0 + x_23)? (19.0 + x_21) : (20.0 + x_23))? ((13.0 + x_16) > (12.0 + x_18)? (13.0 + x_16) : (12.0 + x_18)) : ((19.0 + x_21) > (20.0 + x_23)? (19.0 + x_21) : (20.0 + x_23))) : (((18.0 + x_24) > (8.0 + x_26)? (18.0 + x_24) : (8.0 + x_26)) > ((18.0 + x_28) > (11.0 + x_29)? (18.0 + x_28) : (11.0 + x_29))? ((18.0 + x_24) > (8.0 + x_26)? (18.0 + x_24) : (8.0 + x_26)) : ((18.0 + x_28) > (11.0 + x_29)? (18.0 + x_28) : (11.0 + x_29)))));
x_0 = x_0_;
x_1 = x_1_;
x_2 = x_2_;
x_3 = x_3_;
x_4 = x_4_;
x_5 = x_5_;
x_6 = x_6_;
x_7 = x_7_;
x_8 = x_8_;
x_9 = x_9_;
x_10 = x_10_;
x_11 = x_11_;
x_12 = x_12_;
x_13 = x_13_;
x_14 = x_14_;
x_15 = x_15_;
x_16 = x_16_;
x_17 = x_17_;
x_18 = x_18_;
x_19 = x_19_;
x_20 = x_20_;
x_21 = x_21_;
x_22 = x_22_;
x_23 = x_23_;
x_24 = x_24_;
x_25 = x_25_;
x_26 = x_26_;
x_27 = x_27_;
x_28 = x_28_;
x_29 = x_29_;
x_30 = x_30_;
x_31 = x_31_;
}
return 0;
}
|
the_stack_data/9513401.c | // Check that SDKROOT is used to define the default for -isysroot on Darwin.
//
// RUN: rm -rf %t.tmpdir
// RUN: mkdir -p %t.tmpdir
// RUN: env SDKROOT=%t.tmpdir %clang -target x86_64-apple-darwin10 \
// RUN: -c %s -### 2> %t.log
// RUN: FileCheck --check-prefix=CHECK-BASIC < %t.log %s
//
// CHECK-BASIC: clang
// CHECK-BASIC: "-cc1"
// CHECK-BASIC: "-isysroot" "{{.*tmpdir}}"
// Check that we don't use SDKROOT as the default if it is not a valid path.
// RUN: rm -rf %t.nonpath
// RUN: env SDKROOT=%t.nonpath %clang -target x86_64-apple-darwin10 \
// RUN: -c %s -### 2> %t.log
// RUN: FileCheck --check-prefix=CHECK-NONPATH < %t.log %s
//
// CHECK-NONPATH: clang
// CHECK-NONPATH: "-cc1"
// CHECK-NONPATH-NOT: "-isysroot"
|
the_stack_data/106988.c | #include <stdio.h>
#define true (0 == 0)
static int c;
int main(void) {
do {
c = getchar();
if (c == EOF) { putchar('\n'); return 0; }
if (c == ' ') putchar('\n');
else putchar(c);
} while (true);
}
|
the_stack_data/31388985.c | /**
******************************************************************************
* @file stm32f2xx_ll_spi.c
* @author MCD Application Team
* @version V1.2.1
* @date 14-April-2017
* @brief SPI LL module driver.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#if defined(USE_FULL_LL_DRIVER)
/* Includes ------------------------------------------------------------------*/
#include "stm32f2xx_ll_spi.h"
#include "stm32f2xx_ll_bus.h"
#include "stm32f2xx_ll_rcc.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif
/** @addtogroup STM32F2xx_LL_Driver
* @{
*/
#if defined (SPI1) || defined (SPI2) || defined (SPI3)
/** @addtogroup SPI_LL
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/** @defgroup SPI_LL_Private_Constants SPI Private Constants
* @{
*/
/* SPI registers Masks */
#define SPI_CR1_CLEAR_MASK (SPI_CR1_CPHA | SPI_CR1_CPOL | SPI_CR1_MSTR | \
SPI_CR1_BR | SPI_CR1_LSBFIRST | SPI_CR1_SSI | \
SPI_CR1_SSM | SPI_CR1_RXONLY | SPI_CR1_DFF | \
SPI_CR1_CRCNEXT | SPI_CR1_CRCEN | SPI_CR1_BIDIOE | \
SPI_CR1_BIDIMODE)
/**
* @}
*/
/* Private macros ------------------------------------------------------------*/
/** @defgroup SPI_LL_Private_Macros SPI Private Macros
* @{
*/
#define IS_LL_SPI_TRANSFER_DIRECTION(__VALUE__) (((__VALUE__) == LL_SPI_FULL_DUPLEX) \
|| ((__VALUE__) == LL_SPI_SIMPLEX_RX) \
|| ((__VALUE__) == LL_SPI_HALF_DUPLEX_RX) \
|| ((__VALUE__) == LL_SPI_HALF_DUPLEX_TX))
#define IS_LL_SPI_MODE(__VALUE__) (((__VALUE__) == LL_SPI_MODE_MASTER) \
|| ((__VALUE__) == LL_SPI_MODE_SLAVE))
#define IS_LL_SPI_DATAWIDTH(__VALUE__) (((__VALUE__) == LL_SPI_DATAWIDTH_8BIT) \
|| ((__VALUE__) == LL_SPI_DATAWIDTH_16BIT))
#define IS_LL_SPI_POLARITY(__VALUE__) (((__VALUE__) == LL_SPI_POLARITY_LOW) \
|| ((__VALUE__) == LL_SPI_POLARITY_HIGH))
#define IS_LL_SPI_PHASE(__VALUE__) (((__VALUE__) == LL_SPI_PHASE_1EDGE) \
|| ((__VALUE__) == LL_SPI_PHASE_2EDGE))
#define IS_LL_SPI_NSS(__VALUE__) (((__VALUE__) == LL_SPI_NSS_SOFT) \
|| ((__VALUE__) == LL_SPI_NSS_HARD_INPUT) \
|| ((__VALUE__) == LL_SPI_NSS_HARD_OUTPUT))
#define IS_LL_SPI_BAUDRATE(__VALUE__) (((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV2) \
|| ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV4) \
|| ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV8) \
|| ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV16) \
|| ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV32) \
|| ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV64) \
|| ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV128) \
|| ((__VALUE__) == LL_SPI_BAUDRATEPRESCALER_DIV256))
#define IS_LL_SPI_BITORDER(__VALUE__) (((__VALUE__) == LL_SPI_LSB_FIRST) \
|| ((__VALUE__) == LL_SPI_MSB_FIRST))
#define IS_LL_SPI_CRCCALCULATION(__VALUE__) (((__VALUE__) == LL_SPI_CRCCALCULATION_ENABLE) \
|| ((__VALUE__) == LL_SPI_CRCCALCULATION_DISABLE))
#define IS_LL_SPI_CRC_POLYNOMIAL(__VALUE__) ((__VALUE__) >= 0x1U)
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup SPI_LL_Exported_Functions
* @{
*/
/** @addtogroup SPI_LL_EF_Init
* @{
*/
/**
* @brief De-initialize the SPI registers to their default reset values.
* @param SPIx SPI Instance
* @retval An ErrorStatus enumeration value:
* - SUCCESS: SPI registers are de-initialized
* - ERROR: SPI registers are not de-initialized
*/
ErrorStatus LL_SPI_DeInit(SPI_TypeDef *SPIx)
{
ErrorStatus status = ERROR;
/* Check the parameters */
assert_param(IS_SPI_ALL_INSTANCE(SPIx));
#if defined(SPI1)
if (SPIx == SPI1)
{
/* Force reset of SPI clock */
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_SPI1);
/* Release reset of SPI clock */
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_SPI1);
status = SUCCESS;
}
#endif /* SPI1 */
#if defined(SPI2)
if (SPIx == SPI2)
{
/* Force reset of SPI clock */
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_SPI2);
/* Release reset of SPI clock */
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_SPI2);
status = SUCCESS;
}
#endif /* SPI2 */
#if defined(SPI3)
if (SPIx == SPI3)
{
/* Force reset of SPI clock */
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_SPI3);
/* Release reset of SPI clock */
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_SPI3);
status = SUCCESS;
}
#endif /* SPI3 */
return status;
}
/**
* @brief Initialize the SPI registers according to the specified parameters in SPI_InitStruct.
* @note As some bits in SPI configuration registers can only be written when the SPI is disabled (SPI_CR1_SPE bit =0),
* SPI IP should be in disabled state prior calling this function. Otherwise, ERROR result will be returned.
* @param SPIx SPI Instance
* @param SPI_InitStruct pointer to a @ref LL_SPI_InitTypeDef structure
* @retval An ErrorStatus enumeration value. (Return always SUCCESS)
*/
ErrorStatus LL_SPI_Init(SPI_TypeDef *SPIx, LL_SPI_InitTypeDef *SPI_InitStruct)
{
ErrorStatus status = ERROR;
/* Check the SPI Instance SPIx*/
assert_param(IS_SPI_ALL_INSTANCE(SPIx));
/* Check the SPI parameters from SPI_InitStruct*/
assert_param(IS_LL_SPI_TRANSFER_DIRECTION(SPI_InitStruct->TransferDirection));
assert_param(IS_LL_SPI_MODE(SPI_InitStruct->Mode));
assert_param(IS_LL_SPI_DATAWIDTH(SPI_InitStruct->DataWidth));
assert_param(IS_LL_SPI_POLARITY(SPI_InitStruct->ClockPolarity));
assert_param(IS_LL_SPI_PHASE(SPI_InitStruct->ClockPhase));
assert_param(IS_LL_SPI_NSS(SPI_InitStruct->NSS));
assert_param(IS_LL_SPI_BAUDRATE(SPI_InitStruct->BaudRate));
assert_param(IS_LL_SPI_BITORDER(SPI_InitStruct->BitOrder));
assert_param(IS_LL_SPI_CRCCALCULATION(SPI_InitStruct->CRCCalculation));
if (LL_SPI_IsEnabled(SPIx) == 0x00000000U)
{
/*---------------------------- SPIx CR1 Configuration ------------------------
* Configure SPIx CR1 with parameters:
* - TransferDirection: SPI_CR1_BIDIMODE, SPI_CR1_BIDIOE and SPI_CR1_RXONLY bits
* - Master/Slave Mode: SPI_CR1_MSTR bit
* - DataWidth: SPI_CR1_DFF bit
* - ClockPolarity: SPI_CR1_CPOL bit
* - ClockPhase: SPI_CR1_CPHA bit
* - NSS management: SPI_CR1_SSM bit
* - BaudRate prescaler: SPI_CR1_BR[2:0] bits
* - BitOrder: SPI_CR1_LSBFIRST bit
* - CRCCalculation: SPI_CR1_CRCEN bit
*/
MODIFY_REG(SPIx->CR1,
SPI_CR1_CLEAR_MASK,
SPI_InitStruct->TransferDirection | SPI_InitStruct->Mode | SPI_InitStruct->DataWidth |
SPI_InitStruct->ClockPolarity | SPI_InitStruct->ClockPhase |
SPI_InitStruct->NSS | SPI_InitStruct->BaudRate |
SPI_InitStruct->BitOrder | SPI_InitStruct->CRCCalculation);
/*---------------------------- SPIx CR2 Configuration ------------------------
* Configure SPIx CR2 with parameters:
* - NSS management: SSOE bit
*/
MODIFY_REG(SPIx->CR2, SPI_CR2_SSOE, (SPI_InitStruct->NSS >> 16U));
/*---------------------------- SPIx CRCPR Configuration ----------------------
* Configure SPIx CRCPR with parameters:
* - CRCPoly: CRCPOLY[15:0] bits
*/
if (SPI_InitStruct->CRCCalculation == LL_SPI_CRCCALCULATION_ENABLE)
{
assert_param(IS_LL_SPI_CRC_POLYNOMIAL(SPI_InitStruct->CRCPoly));
LL_SPI_SetCRCPolynomial(SPIx, SPI_InitStruct->CRCPoly);
}
status = SUCCESS;
}
/* Activate the SPI mode (Reset I2SMOD bit in I2SCFGR register) */
CLEAR_BIT(SPIx->I2SCFGR, SPI_I2SCFGR_I2SMOD);
return status;
}
/**
* @brief Set each @ref LL_SPI_InitTypeDef field to default value.
* @param SPI_InitStruct pointer to a @ref LL_SPI_InitTypeDef structure
* whose fields will be set to default values.
* @retval None
*/
void LL_SPI_StructInit(LL_SPI_InitTypeDef *SPI_InitStruct)
{
/* Set SPI_InitStruct fields to default values */
SPI_InitStruct->TransferDirection = LL_SPI_FULL_DUPLEX;
SPI_InitStruct->Mode = LL_SPI_MODE_SLAVE;
SPI_InitStruct->DataWidth = LL_SPI_DATAWIDTH_8BIT;
SPI_InitStruct->ClockPolarity = LL_SPI_POLARITY_LOW;
SPI_InitStruct->ClockPhase = LL_SPI_PHASE_1EDGE;
SPI_InitStruct->NSS = LL_SPI_NSS_HARD_INPUT;
SPI_InitStruct->BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2;
SPI_InitStruct->BitOrder = LL_SPI_MSB_FIRST;
SPI_InitStruct->CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
SPI_InitStruct->CRCPoly = 7U;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/** @addtogroup I2S_LL
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/** @defgroup I2S_LL_Private_Constants I2S Private Constants
* @{
*/
/* I2S registers Masks */
#define I2S_I2SCFGR_CLEAR_MASK (SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN | \
SPI_I2SCFGR_CKPOL | SPI_I2SCFGR_I2SSTD | \
SPI_I2SCFGR_I2SCFG | SPI_I2SCFGR_I2SMOD )
#define I2S_I2SPR_CLEAR_MASK 0x0002U
/**
* @}
*/
/* Private macros ------------------------------------------------------------*/
/** @defgroup I2S_LL_Private_Macros I2S Private Macros
* @{
*/
#define IS_LL_I2S_DATAFORMAT(__VALUE__) (((__VALUE__) == LL_I2S_DATAFORMAT_16B) \
|| ((__VALUE__) == LL_I2S_DATAFORMAT_16B_EXTENDED) \
|| ((__VALUE__) == LL_I2S_DATAFORMAT_24B) \
|| ((__VALUE__) == LL_I2S_DATAFORMAT_32B))
#define IS_LL_I2S_CPOL(__VALUE__) (((__VALUE__) == LL_I2S_POLARITY_LOW) \
|| ((__VALUE__) == LL_I2S_POLARITY_HIGH))
#define IS_LL_I2S_STANDARD(__VALUE__) (((__VALUE__) == LL_I2S_STANDARD_PHILIPS) \
|| ((__VALUE__) == LL_I2S_STANDARD_MSB) \
|| ((__VALUE__) == LL_I2S_STANDARD_LSB) \
|| ((__VALUE__) == LL_I2S_STANDARD_PCM_SHORT) \
|| ((__VALUE__) == LL_I2S_STANDARD_PCM_LONG))
#define IS_LL_I2S_MODE(__VALUE__) (((__VALUE__) == LL_I2S_MODE_SLAVE_TX) \
|| ((__VALUE__) == LL_I2S_MODE_SLAVE_RX) \
|| ((__VALUE__) == LL_I2S_MODE_MASTER_TX) \
|| ((__VALUE__) == LL_I2S_MODE_MASTER_RX))
#define IS_LL_I2S_MCLK_OUTPUT(__VALUE__) (((__VALUE__) == LL_I2S_MCLK_OUTPUT_ENABLE) \
|| ((__VALUE__) == LL_I2S_MCLK_OUTPUT_DISABLE))
#define IS_LL_I2S_AUDIO_FREQ(__VALUE__) ((((__VALUE__) >= LL_I2S_AUDIOFREQ_8K) \
&& ((__VALUE__) <= LL_I2S_AUDIOFREQ_192K)) \
|| ((__VALUE__) == LL_I2S_AUDIOFREQ_DEFAULT))
#define IS_LL_I2S_PRESCALER_LINEAR(__VALUE__) ((__VALUE__) >= 0x2U)
#define IS_LL_I2S_PRESCALER_PARITY(__VALUE__) (((__VALUE__) == LL_I2S_PRESCALER_PARITY_EVEN) \
|| ((__VALUE__) == LL_I2S_PRESCALER_PARITY_ODD))
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup I2S_LL_Exported_Functions
* @{
*/
/** @addtogroup I2S_LL_EF_Init
* @{
*/
/**
* @brief De-initialize the SPI/I2S registers to their default reset values.
* @param SPIx SPI Instance
* @retval An ErrorStatus enumeration value:
* - SUCCESS: SPI registers are de-initialized
* - ERROR: SPI registers are not de-initialized
*/
ErrorStatus LL_I2S_DeInit(SPI_TypeDef *SPIx)
{
return LL_SPI_DeInit(SPIx);
}
/**
* @brief Initializes the SPI/I2S registers according to the specified parameters in I2S_InitStruct.
* @note As some bits in SPI configuration registers can only be written when the SPI is disabled (SPI_CR1_SPE bit =0),
* SPI IP should be in disabled state prior calling this function. Otherwise, ERROR result will be returned.
* @param SPIx SPI Instance
* @param I2S_InitStruct pointer to a @ref LL_I2S_InitTypeDef structure
* @retval An ErrorStatus enumeration value:
* - SUCCESS: SPI registers are Initialized
* - ERROR: SPI registers are not Initialized
*/
ErrorStatus LL_I2S_Init(SPI_TypeDef *SPIx, LL_I2S_InitTypeDef *I2S_InitStruct)
{
uint16_t i2sdiv = 2U, i2sodd = 0U, packetlength = 1U;
uint32_t tmp = 0U;
uint32_t sourceclock = 0U;
ErrorStatus status = ERROR;
/* Check the I2S parameters */
assert_param(IS_I2S_ALL_INSTANCE(SPIx));
assert_param(IS_LL_I2S_MODE(I2S_InitStruct->Mode));
assert_param(IS_LL_I2S_STANDARD(I2S_InitStruct->Standard));
assert_param(IS_LL_I2S_DATAFORMAT(I2S_InitStruct->DataFormat));
assert_param(IS_LL_I2S_MCLK_OUTPUT(I2S_InitStruct->MCLKOutput));
assert_param(IS_LL_I2S_AUDIO_FREQ(I2S_InitStruct->AudioFreq));
assert_param(IS_LL_I2S_CPOL(I2S_InitStruct->ClockPolarity));
if (LL_I2S_IsEnabled(SPIx) == 0x00000000U)
{
/*---------------------------- SPIx I2SCFGR Configuration --------------------
* Configure SPIx I2SCFGR with parameters:
* - Mode: SPI_I2SCFGR_I2SCFG[1:0] bit
* - Standard: SPI_I2SCFGR_I2SSTD[1:0] and SPI_I2SCFGR_PCMSYNC bits
* - DataFormat: SPI_I2SCFGR_CHLEN and SPI_I2SCFGR_DATLEN bits
* - ClockPolarity: SPI_I2SCFGR_CKPOL bit
*/
/* Write to SPIx I2SCFGR */
MODIFY_REG(SPIx->I2SCFGR,
I2S_I2SCFGR_CLEAR_MASK,
I2S_InitStruct->Mode | I2S_InitStruct->Standard |
I2S_InitStruct->DataFormat | I2S_InitStruct->ClockPolarity |
SPI_I2SCFGR_I2SMOD);
/*---------------------------- SPIx I2SPR Configuration ----------------------
* Configure SPIx I2SPR with parameters:
* - MCLKOutput: SPI_I2SPR_MCKOE bit
* - AudioFreq: SPI_I2SPR_I2SDIV[7:0] and SPI_I2SPR_ODD bits
*/
/* If the requested audio frequency is not the default, compute the prescaler (i2sodd, i2sdiv)
* else, default values are used: i2sodd = 0U, i2sdiv = 2U.
*/
if (I2S_InitStruct->AudioFreq != LL_I2S_AUDIOFREQ_DEFAULT)
{
/* Check the frame length (For the Prescaler computing)
* Default value: LL_I2S_DATAFORMAT_16B (packetlength = 1U).
*/
if (I2S_InitStruct->DataFormat != LL_I2S_DATAFORMAT_16B)
{
/* Packet length is 32 bits */
packetlength = 2U;
}
/* If an external I2S clock has to be used, the specific define should be set
in the project configuration or in the stm32f2xx_ll_rcc.h file */
/* Get the I2S source clock value */
sourceclock = LL_RCC_GetI2SClockFreq(LL_RCC_I2S1_CLKSOURCE);
/* Compute the Real divider depending on the MCLK output state with a floating point */
if (I2S_InitStruct->MCLKOutput == LL_I2S_MCLK_OUTPUT_ENABLE)
{
/* MCLK output is enabled */
tmp = (uint16_t)(((((sourceclock / 256U) * 10U) / I2S_InitStruct->AudioFreq)) + 5U);
}
else
{
/* MCLK output is disabled */
tmp = (uint16_t)(((((sourceclock / (32U * packetlength)) * 10U) / I2S_InitStruct->AudioFreq)) + 5U);
}
/* Remove the floating point */
tmp = tmp / 10U;
/* Check the parity of the divider */
i2sodd = (uint16_t)(tmp & (uint16_t)0x0001U);
/* Compute the i2sdiv prescaler */
i2sdiv = (uint16_t)((tmp - i2sodd) / 2U);
/* Get the Mask for the Odd bit (SPI_I2SPR[8]) register */
i2sodd = (uint16_t)(i2sodd << 8U);
}
/* Test if the divider is 1 or 0 or greater than 0xFF */
if ((i2sdiv < 2U) || (i2sdiv > 0xFFU))
{
/* Set the default values */
i2sdiv = 2U;
i2sodd = 0U;
}
/* Write to SPIx I2SPR register the computed value */
WRITE_REG(SPIx->I2SPR, i2sdiv | i2sodd | I2S_InitStruct->MCLKOutput);
status = SUCCESS;
}
return status;
}
/**
* @brief Set each @ref LL_I2S_InitTypeDef field to default value.
* @param I2S_InitStruct pointer to a @ref LL_I2S_InitTypeDef structure
* whose fields will be set to default values.
* @retval None
*/
void LL_I2S_StructInit(LL_I2S_InitTypeDef *I2S_InitStruct)
{
/*--------------- Reset I2S init structure parameters values -----------------*/
I2S_InitStruct->Mode = LL_I2S_MODE_SLAVE_TX;
I2S_InitStruct->Standard = LL_I2S_STANDARD_PHILIPS;
I2S_InitStruct->DataFormat = LL_I2S_DATAFORMAT_16B;
I2S_InitStruct->MCLKOutput = LL_I2S_MCLK_OUTPUT_DISABLE;
I2S_InitStruct->AudioFreq = LL_I2S_AUDIOFREQ_DEFAULT;
I2S_InitStruct->ClockPolarity = LL_I2S_POLARITY_LOW;
}
/**
* @brief Set linear and parity prescaler.
* @note To calculate value of PrescalerLinear(I2SDIV[7:0] bits) and PrescalerParity(ODD bit)\n
* Check Audio frequency table and formulas inside Reference Manual (SPI/I2S).
* @param SPIx SPI Instance
* @param PrescalerLinear value: Min_Data=0x02 and Max_Data=0xFF.
* @param PrescalerParity This parameter can be one of the following values:
* @arg @ref LL_I2S_PRESCALER_PARITY_EVEN
* @arg @ref LL_I2S_PRESCALER_PARITY_ODD
* @retval None
*/
void LL_I2S_ConfigPrescaler(SPI_TypeDef *SPIx, uint32_t PrescalerLinear, uint32_t PrescalerParity)
{
/* Check the I2S parameters */
assert_param(IS_I2S_ALL_INSTANCE(SPIx));
assert_param(IS_LL_I2S_PRESCALER_LINEAR(PrescalerLinear));
assert_param(IS_LL_I2S_PRESCALER_PARITY(PrescalerParity));
/* Write to SPIx I2SPR */
MODIFY_REG(SPIx->I2SPR, SPI_I2SPR_I2SDIV | SPI_I2SPR_ODD, PrescalerLinear | (PrescalerParity << 8U));
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#endif /* defined (SPI1) || defined (SPI2) || defined (SPI3) */
/**
* @}
*/
#endif /* USE_FULL_LL_DRIVER */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
the_stack_data/243892545.c | #include <ncurses.h>
WINDOW *create_newwin(int height, int width, int starty, int startx);
void destroy_win(WINDOW *local_win);
int main(int argc, char *argv[])
{
WINDOW *my_win;
int startx, starty, width, height;
int ch;
initscr(); /* Start curses mode */
noecho();
cbreak(); /* Line buffering disabled, Pass on
* everty thing to me */
keypad(stdscr, TRUE); /* I need that nifty F1 */
height = 3;
width = 10;
starty = (LINES - height) / 2; /* Calculating for a center placement */
startx = (COLS - width) / 2; /* of the window */
printw("Press F1 to exit");
refresh();
my_win = create_newwin(height, width, starty, startx);
while((ch = getch()) != KEY_F(1))
{
switch(ch)
{
case KEY_LEFT:
case 'h':
destroy_win(my_win);
my_win = create_newwin(height, width, starty,--startx);
break;
case KEY_RIGHT:
case 'l':
destroy_win(my_win);
my_win = create_newwin(height, width, starty,++startx);
break;
case KEY_UP:
case 'k':
destroy_win(my_win);
my_win = create_newwin(height, width, --starty,startx);
break;
case KEY_DOWN:
case 'j':
destroy_win(my_win);
my_win = create_newwin(height, width, ++starty,startx);
break;
}
}
endwin(); /* End curses mode */
return 0;
}
WINDOW *create_newwin(int height, int width, int starty, int startx)
{
WINDOW *local_win;
local_win = newwin(height, width, starty, startx);
box(local_win, 0 , 0); /* 0, 0 gives default characters
* for the vertical and horizontal
* lines */
wrefresh(local_win); /* Show that box */
return local_win;
}
void destroy_win(WINDOW *local_win)
{
/* box(local_win, ' ', ' '); : This won't produce the desired
* result of erasing the window. It will leave it's four corners
* and so an ugly remnant of window.
*/
wborder(local_win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
/* The parameters taken are
* 1. win: the window on which to operate
* 2. ls: character to be used for the left side of the window
* 3. rs: character to be used for the right side of the window
* 4. ts: character to be used for the top side of the window
* 5. bs: character to be used for the bottom side of the window
* 6. tl: character to be used for the top left corner of the window
* 7. tr: character to be used for the top right corner of the window
* 8. bl: character to be used for the bottom left corner of the window
* 9. br: character to be used for the bottom right corner of the window
*/
wrefresh(local_win);
delwin(local_win);
}
|
the_stack_data/3262466.c | /*
* Copyright (c) 2012-2016, Juniper Networks, Inc.
* All rights reserved.
*
* You may distribute under the terms of :
*
* the BSD 2-Clause license
*
* Any patches released for this software are to be released under these
* same license terms.
*
* BSD 2-Clause license:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /* HAVE_CONFIG_H */
#ifdef HAVE_THREAD_DB_H
#include <proc_service.h>
#include "global.h"
#include "thread_db_priv.h"
ps_err_e ps_lcontinue(struct ps_prochandle *ph, lwpid_t lwpid)
{
return PS_ERR;
}
ps_err_e ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lwpid,
prfpregset_t *fpregs)
{
return PS_ERR;
}
ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lwpid,
prgregset_t gregs)
{
return PS_ERR;
}
ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lwpid,
const prfpregset_t *fpregs)
{
return PS_ERR;
}
ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lwpid,
const prgregset_t gregs)
{
return PS_ERR;
}
#ifdef __i386__
ps_err_e ps_lgetxmmregs (struct ps_prochandle *ph, lwpid_t lwpid,
char *xmmregs)
{
return PS_ERR;
}
ps_err_e ps_lsetxmmregs (struct ps_prochandle *ph, lwpid_t lwpid,
const char *xmmregs)
{
return PS_ERR;
}
#endif
ps_err_e ps_lstop(struct ps_prochandle *ph, lwpid_t lwpid)
{
return PS_ERR;
}
ps_err_e ps_linfo(struct ps_prochandle *ph, lwpid_t lwpid, void *buf)
{
return PS_ERR;
}
ps_err_e ps_pcontinue(struct ps_prochandle *ph)
{
return PS_ERR;
}
ps_err_e ps_pdmodel(struct ps_prochandle *ph, int *mod)
{
return PS_ERR;
}
ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *obj,
const char *sym, psaddr_t *addr)
{
uintptr_t sym_addr;
if (symbol_lookup(sym, &sym_addr) == RET_ERR)
return PS_NOSYM;
*addr = (psaddr_t) sym_addr;
return PS_OK;
}
void ps_plog(const char *fmt, ...)
{
}
ps_err_e ps_pread(struct ps_prochandle *ph, psaddr_t addr, void *buf,
size_t size)
{
size_t read_size;
if (ph->target->read_mem(ph->pid, (uint64_t) addr, (uint8_t*) buf, size,
&read_size) == RET_ERR) {
return PS_ERR;
}
if (size != read_size)
return PS_ERR;
return PS_OK;
}
ps_err_e ps_pstop(struct ps_prochandle *ph)
{
return PS_ERR;
}
ps_err_e ps_pwrite(struct ps_prochandle *ph, psaddr_t addr, const void *buf,
size_t size)
{
if (ph->target->write_mem(ph->pid, (uint64_t) addr, (uint8_t*) buf,
size) == RET_ERR) {
return PS_ERR;
}
return PS_OK;
}
#endif /* HAVE_THREAD_DB_H */
|
the_stack_data/6176.c | #include<stdio.h>
#define MAXLINE 1000
#define BASELINE 80
int getline2(char line[], int lim);
void copy2(char to[], char from[]);
int main()
{
int len;
char line[MAXLINE];
while ((len = getline2(line, MAXLINE)) > 0) {
if (len > BASELINE) {
printf("%s", line);
}
}
return 0;
}
int getline2(char line[], int lim)
{
int i, c;
for (i = 0; i < lim-1 && (c = getchar()) != EOF && c != '\n'; ++i)
line[i] = c;
if (c == '\n') {
line[i++] = c;
}
line[i] = '\0';
return i;
}
void copy2(char to[], char from[])
{
int i;
i = 0;
while ((to[i] = from[i]) != '\0')
++i;
}
|
the_stack_data/79737.c | // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -std=c99 -verify %s
void clang_analyzer_eval(int);
void array_init(void) {
int a[5] = {[4] = 29, [2] = 15, [0] = 4};
clang_analyzer_eval(a[0] == 4); // expected-warning{{TRUE}}
clang_analyzer_eval(a[1] == 0); // expected-warning{{TRUE}}
clang_analyzer_eval(a[2] == 15); // expected-warning{{TRUE}}
clang_analyzer_eval(a[3] == 0); // expected-warning{{TRUE}}
clang_analyzer_eval(a[4] == 29); // expected-warning{{TRUE}}
int b[5] = {[0 ... 2] = 1, [4] = 5};
clang_analyzer_eval(b[0] == 1); // expected-warning{{TRUE}}
clang_analyzer_eval(b[1] == 1); // expected-warning{{TRUE}}
clang_analyzer_eval(b[2] == 1); // expected-warning{{TRUE}}
clang_analyzer_eval(b[3] == 0); // expected-warning{{TRUE}}
clang_analyzer_eval(b[4] == 5); // expected-warning{{TRUE}}
}
struct point {
int x, y;
};
void struct_init(void) {
struct point p = {.y = 5, .x = 3};
clang_analyzer_eval(p.x == 3); // expected-warning{{TRUE}}
clang_analyzer_eval(p.y == 5); // expected-warning{{TRUE}}
}
void array_of_struct(void) {
struct point ptarray[3] = { [2].y = 1, [2].x = 2, [0].x = 3 };
clang_analyzer_eval(ptarray[0].x == 3); // expected-warning{{TRUE}}
clang_analyzer_eval(ptarray[0].y == 0); // expected-warning{{TRUE}}
clang_analyzer_eval(ptarray[1].x == 0); // expected-warning{{TRUE}}
clang_analyzer_eval(ptarray[1].y == 0); // expected-warning{{TRUE}}
clang_analyzer_eval(ptarray[2].x == 2); // expected-warning{{TRUE}}
clang_analyzer_eval(ptarray[2].y == 1); // expected-warning{{TRUE}}
}
|
the_stack_data/140765831.c | /* Test for recognition of digraphs: should be recognized in C94 and C99
mode, but not in C90 mode. Also check correct stringizing.
*/
/* Origin: Joseph Myers <[email protected]> */
/* { dg-do run } */
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
#define str(x) xstr(x)
#define xstr(x) #x
#define foo(p, q) str(p %:%: q)
extern void abort (void);
extern int strcmp (const char *, const char *);
int
main (void)
{
const char *t = foo (1, 2);
const char *u = str (<:);
if (strcmp (t, "1 %:%: 2") || strcmp (u, "<:"))
abort ();
else
return 0;
}
|
the_stack_data/658143.c | #include <stdlib.h>
#include <string.h>
#define max(a, b) (((a) > (b)) ? (a) : (b))
// HASH
#define HASH_TABLE_SIZE (1 << 7)
typedef struct HashNode
{
char *key;
struct HashNode *next;
} HashNode;
HashNode *HashTable[HASH_TABLE_SIZE];
void hash_init()
{
memset(HashTable, 0, sizeof(HashTable));
}
void hash_release()
{
for (int i = 0; i < HASH_TABLE_SIZE; ++i)
{
HashNode *node = HashTable[i];
while (node)
{
HashNode *deletenode = node;
node = node->next;
free(deletenode);
}
}
}
HashNode *hash_createNode(char *key)
{
HashNode *node = (HashNode *)malloc(sizeof(HashNode));
node->key = key;
node->next = NULL;
return node;
}
void hash_set(char *key)
{
int bucket = (key[0] & (HASH_TABLE_SIZE - 1));
HashNode *head = HashTable[bucket];
while (head)
{
if (strcmp(head->key, key) == 0)
return;
head = head->next;
}
head = hash_createNode(key);
head->next = HashTable[bucket];
HashTable[bucket] = head;
}
HashNode *hash_get(char *key)
{
int bucket = (key[0] & (HASH_TABLE_SIZE - 1));
HashNode *head = HashTable[bucket];
while (head)
{
if (strcmp(head->key, key) == 0)
break;
head = head->next;
}
return head;
}
void hash_erase(char *key)
{
int bucket = (key[0] & (HASH_TABLE_SIZE - 1));
HashNode **head = &HashTable[bucket];
while (*head)
{
if (strcmp((*head)->key, key) == 0)
{
*head = (*head)->next;
break;
}
head = &(*head)->next;
}
}
/********end of HASH********/
void dfs(char *s, int index, int size, int *res)
{
char data[20] = {0};
if (!s[index])
*res = max(*res, size);
for (int i = index; s[i]; ++i)
{
strncpy(data, &s[index], i - index + 1);
HashNode *node = hash_get(data);
if (!node)
{
hash_set(strdup(data));
dfs(s, i + 1, size + 1, res);
hash_erase(data);
}
}
}
int maxUniqueSplit(char *s)
{
hash_init();
int res = 0;
dfs(s, 0, 0, &res);
return res;
} |
the_stack_data/62638482.c | /**
******************************************************************************
* @file stm32f7xx_ll_dma.c
* @author MCD Application Team
* @brief DMA LL module driver.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
#if defined(USE_FULL_LL_DRIVER)
/* Includes ------------------------------------------------------------------*/
#include "stm32f7xx_ll_dma.h"
#include "stm32f7xx_ll_bus.h"
#ifdef USE_FULL_ASSERT
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
#endif
/** @addtogroup STM32F7xx_LL_Driver
* @{
*/
#if defined (DMA1) || defined (DMA2)
/** @defgroup DMA_LL DMA
* @{
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/** @addtogroup DMA_LL_Private_Macros
* @{
*/
#define IS_LL_DMA_DIRECTION(__VALUE__) (((__VALUE__) == LL_DMA_DIRECTION_PERIPH_TO_MEMORY) || \
((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_PERIPH) || \
((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_MEMORY))
#define IS_LL_DMA_MODE(__VALUE__) (((__VALUE__) == LL_DMA_MODE_NORMAL) || \
((__VALUE__) == LL_DMA_MODE_CIRCULAR) || \
((__VALUE__) == LL_DMA_MODE_PFCTRL))
#define IS_LL_DMA_PERIPHINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_PERIPH_INCREMENT) || \
((__VALUE__) == LL_DMA_PERIPH_NOINCREMENT))
#define IS_LL_DMA_MEMORYINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_MEMORY_INCREMENT) || \
((__VALUE__) == LL_DMA_MEMORY_NOINCREMENT))
#define IS_LL_DMA_PERIPHDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_PDATAALIGN_BYTE) || \
((__VALUE__) == LL_DMA_PDATAALIGN_HALFWORD) || \
((__VALUE__) == LL_DMA_PDATAALIGN_WORD))
#define IS_LL_DMA_MEMORYDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_MDATAALIGN_BYTE) || \
((__VALUE__) == LL_DMA_MDATAALIGN_HALFWORD) || \
((__VALUE__) == LL_DMA_MDATAALIGN_WORD))
#define IS_LL_DMA_NBDATA(__VALUE__) ((__VALUE__) <= 0x0000FFFFU)
#if defined(DMA_CHANNEL_SELECTION_8_15)
#define IS_LL_DMA_CHANNEL(__VALUE__) (((__VALUE__) == LL_DMA_CHANNEL_0) || \
((__VALUE__) == LL_DMA_CHANNEL_1) || \
((__VALUE__) == LL_DMA_CHANNEL_2) || \
((__VALUE__) == LL_DMA_CHANNEL_3) || \
((__VALUE__) == LL_DMA_CHANNEL_4) || \
((__VALUE__) == LL_DMA_CHANNEL_5) || \
((__VALUE__) == LL_DMA_CHANNEL_6) || \
((__VALUE__) == LL_DMA_CHANNEL_7) || \
((__VALUE__) == LL_DMA_CHANNEL_8) || \
((__VALUE__) == LL_DMA_CHANNEL_9) || \
((__VALUE__) == LL_DMA_CHANNEL_10) || \
((__VALUE__) == LL_DMA_CHANNEL_11) || \
((__VALUE__) == LL_DMA_CHANNEL_12) || \
((__VALUE__) == LL_DMA_CHANNEL_13) || \
((__VALUE__) == LL_DMA_CHANNEL_14) || \
((__VALUE__) == LL_DMA_CHANNEL_15))
#else
#define IS_LL_DMA_CHANNEL(__VALUE__) (((__VALUE__) == LL_DMA_CHANNEL_0) || \
((__VALUE__) == LL_DMA_CHANNEL_1) || \
((__VALUE__) == LL_DMA_CHANNEL_2) || \
((__VALUE__) == LL_DMA_CHANNEL_3) || \
((__VALUE__) == LL_DMA_CHANNEL_4) || \
((__VALUE__) == LL_DMA_CHANNEL_5) || \
((__VALUE__) == LL_DMA_CHANNEL_6) || \
((__VALUE__) == LL_DMA_CHANNEL_7))
#endif /* DMA_CHANNEL_SELECTION_8_15 */
#define IS_LL_DMA_PRIORITY(__VALUE__) (((__VALUE__) == LL_DMA_PRIORITY_LOW) || \
((__VALUE__) == LL_DMA_PRIORITY_MEDIUM) || \
((__VALUE__) == LL_DMA_PRIORITY_HIGH) || \
((__VALUE__) == LL_DMA_PRIORITY_VERYHIGH))
#define IS_LL_DMA_ALL_STREAM_INSTANCE(INSTANCE, STREAM) ((((INSTANCE) == DMA1) && \
(((STREAM) == LL_DMA_STREAM_0) || \
((STREAM) == LL_DMA_STREAM_1) || \
((STREAM) == LL_DMA_STREAM_2) || \
((STREAM) == LL_DMA_STREAM_3) || \
((STREAM) == LL_DMA_STREAM_4) || \
((STREAM) == LL_DMA_STREAM_5) || \
((STREAM) == LL_DMA_STREAM_6) || \
((STREAM) == LL_DMA_STREAM_7) || \
((STREAM) == LL_DMA_STREAM_ALL))) ||\
(((INSTANCE) == DMA2) && \
(((STREAM) == LL_DMA_STREAM_0) || \
((STREAM) == LL_DMA_STREAM_1) || \
((STREAM) == LL_DMA_STREAM_2) || \
((STREAM) == LL_DMA_STREAM_3) || \
((STREAM) == LL_DMA_STREAM_4) || \
((STREAM) == LL_DMA_STREAM_5) || \
((STREAM) == LL_DMA_STREAM_6) || \
((STREAM) == LL_DMA_STREAM_7) || \
((STREAM) == LL_DMA_STREAM_ALL))))
#define IS_LL_DMA_FIFO_MODE_STATE(STATE) (((STATE) == LL_DMA_FIFOMODE_DISABLE ) || \
((STATE) == LL_DMA_FIFOMODE_ENABLE))
#define IS_LL_DMA_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_1_4) || \
((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_1_2) || \
((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_3_4) || \
((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_FULL))
#define IS_LL_DMA_MEMORY_BURST(BURST) (((BURST) == LL_DMA_MBURST_SINGLE) || \
((BURST) == LL_DMA_MBURST_INC4) || \
((BURST) == LL_DMA_MBURST_INC8) || \
((BURST) == LL_DMA_MBURST_INC16))
#define IS_LL_DMA_PERIPHERAL_BURST(BURST) (((BURST) == LL_DMA_PBURST_SINGLE) || \
((BURST) == LL_DMA_PBURST_INC4) || \
((BURST) == LL_DMA_PBURST_INC8) || \
((BURST) == LL_DMA_PBURST_INC16))
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup DMA_LL_Exported_Functions
* @{
*/
/** @addtogroup DMA_LL_EF_Init
* @{
*/
/**
* @brief De-initialize the DMA registers to their default reset values.
* @param DMAx DMAx Instance
* @param Stream This parameter can be one of the following values:
* @arg @ref LL_DMA_STREAM_0
* @arg @ref LL_DMA_STREAM_1
* @arg @ref LL_DMA_STREAM_2
* @arg @ref LL_DMA_STREAM_3
* @arg @ref LL_DMA_STREAM_4
* @arg @ref LL_DMA_STREAM_5
* @arg @ref LL_DMA_STREAM_6
* @arg @ref LL_DMA_STREAM_7
* @arg @ref LL_DMA_STREAM_ALL
* @retval An ErrorStatus enumeration value:
* - SUCCESS: DMA registers are de-initialized
* - ERROR: DMA registers are not de-initialized
*/
uint32_t LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Stream)
{
DMA_Stream_TypeDef *tmp = (DMA_Stream_TypeDef *)DMA1_Stream0;
ErrorStatus status = SUCCESS;
/* Check the DMA Instance DMAx and Stream parameters*/
assert_param(IS_LL_DMA_ALL_STREAM_INSTANCE(DMAx, Stream));
if (Stream == LL_DMA_STREAM_ALL)
{
if (DMAx == DMA1)
{
/* Force reset of DMA clock */
LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA1);
/* Release reset of DMA clock */
LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA1);
}
else if (DMAx == DMA2)
{
/* Force reset of DMA clock */
LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA2);
/* Release reset of DMA clock */
LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA2);
}
else
{
status = ERROR;
}
}
else
{
/* Disable the selected Stream */
LL_DMA_DisableStream(DMAx,Stream);
/* Get the DMA Stream Instance */
tmp = (DMA_Stream_TypeDef *)(__LL_DMA_GET_STREAM_INSTANCE(DMAx, Stream));
/* Reset DMAx_Streamy configuration register */
LL_DMA_WriteReg(tmp, CR, 0U);
/* Reset DMAx_Streamy remaining bytes register */
LL_DMA_WriteReg(tmp, NDTR, 0U);
/* Reset DMAx_Streamy peripheral address register */
LL_DMA_WriteReg(tmp, PAR, 0U);
/* Reset DMAx_Streamy memory address register */
LL_DMA_WriteReg(tmp, M0AR, 0U);
/* Reset DMAx_Streamy memory address register */
LL_DMA_WriteReg(tmp, M1AR, 0U);
/* Reset DMAx_Streamy FIFO control register */
LL_DMA_WriteReg(tmp, FCR, 0x00000021U);
/* Reset Channel register field for DMAx Stream*/
LL_DMA_SetChannelSelection(DMAx, Stream, LL_DMA_CHANNEL_0);
if(Stream == LL_DMA_STREAM_0)
{
/* Reset the Stream0 pending flags */
DMAx->LIFCR = 0x0000003FU;
}
else if(Stream == LL_DMA_STREAM_1)
{
/* Reset the Stream1 pending flags */
DMAx->LIFCR = 0x00000F40U;
}
else if(Stream == LL_DMA_STREAM_2)
{
/* Reset the Stream2 pending flags */
DMAx->LIFCR = 0x003F0000U;
}
else if(Stream == LL_DMA_STREAM_3)
{
/* Reset the Stream3 pending flags */
DMAx->LIFCR = 0x0F400000U;
}
else if(Stream == LL_DMA_STREAM_4)
{
/* Reset the Stream4 pending flags */
DMAx->HIFCR = 0x0000003FU;
}
else if(Stream == LL_DMA_STREAM_5)
{
/* Reset the Stream5 pending flags */
DMAx->HIFCR = 0x00000F40U;
}
else if(Stream == LL_DMA_STREAM_6)
{
/* Reset the Stream6 pending flags */
DMAx->HIFCR = 0x003F0000U;
}
else if(Stream == LL_DMA_STREAM_7)
{
/* Reset the Stream7 pending flags */
DMAx->HIFCR = 0x0F400000U;
}
else
{
status = ERROR;
}
}
return status;
}
/**
* @brief Initialize the DMA registers according to the specified parameters in DMA_InitStruct.
* @note To convert DMAx_Streamy Instance to DMAx Instance and Streamy, use helper macros :
* @arg @ref __LL_DMA_GET_INSTANCE
* @arg @ref __LL_DMA_GET_STREAM
* @param DMAx DMAx Instance
* @param Stream This parameter can be one of the following values:
* @arg @ref LL_DMA_STREAM_0
* @arg @ref LL_DMA_STREAM_1
* @arg @ref LL_DMA_STREAM_2
* @arg @ref LL_DMA_STREAM_3
* @arg @ref LL_DMA_STREAM_4
* @arg @ref LL_DMA_STREAM_5
* @arg @ref LL_DMA_STREAM_6
* @arg @ref LL_DMA_STREAM_7
* @param DMA_InitStruct pointer to a @ref LL_DMA_InitTypeDef structure.
* @retval An ErrorStatus enumeration value:
* - SUCCESS: DMA registers are initialized
* - ERROR: Not applicable
*/
uint32_t LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Stream, LL_DMA_InitTypeDef *DMA_InitStruct)
{
/* Check the DMA Instance DMAx and Stream parameters*/
assert_param(IS_LL_DMA_ALL_STREAM_INSTANCE(DMAx, Stream));
/* Check the DMA parameters from DMA_InitStruct */
assert_param(IS_LL_DMA_DIRECTION(DMA_InitStruct->Direction));
assert_param(IS_LL_DMA_MODE(DMA_InitStruct->Mode));
assert_param(IS_LL_DMA_PERIPHINCMODE(DMA_InitStruct->PeriphOrM2MSrcIncMode));
assert_param(IS_LL_DMA_MEMORYINCMODE(DMA_InitStruct->MemoryOrM2MDstIncMode));
assert_param(IS_LL_DMA_PERIPHDATASIZE(DMA_InitStruct->PeriphOrM2MSrcDataSize));
assert_param(IS_LL_DMA_MEMORYDATASIZE(DMA_InitStruct->MemoryOrM2MDstDataSize));
assert_param(IS_LL_DMA_NBDATA(DMA_InitStruct->NbData));
assert_param(IS_LL_DMA_CHANNEL(DMA_InitStruct->Channel));
assert_param(IS_LL_DMA_PRIORITY(DMA_InitStruct->Priority));
assert_param(IS_LL_DMA_FIFO_MODE_STATE(DMA_InitStruct->FIFOMode));
/* Check the memory burst, peripheral burst and FIFO threshold parameters only
when FIFO mode is enabled */
if(DMA_InitStruct->FIFOMode != LL_DMA_FIFOMODE_DISABLE)
{
assert_param(IS_LL_DMA_FIFO_THRESHOLD(DMA_InitStruct->FIFOThreshold));
assert_param(IS_LL_DMA_MEMORY_BURST(DMA_InitStruct->MemBurst));
assert_param(IS_LL_DMA_PERIPHERAL_BURST(DMA_InitStruct->PeriphBurst));
}
/*---------------------------- DMAx SxCR Configuration ------------------------
* Configure DMAx_Streamy: data transfer direction, data transfer mode,
* peripheral and memory increment mode,
* data size alignment and priority level with parameters :
* - Direction: DMA_SxCR_DIR[1:0] bits
* - Mode: DMA_SxCR_CIRC bit
* - PeriphOrM2MSrcIncMode: DMA_SxCR_PINC bit
* - MemoryOrM2MDstIncMode: DMA_SxCR_MINC bit
* - PeriphOrM2MSrcDataSize: DMA_SxCR_PSIZE[1:0] bits
* - MemoryOrM2MDstDataSize: DMA_SxCR_MSIZE[1:0] bits
* - Priority: DMA_SxCR_PL[1:0] bits
*/
LL_DMA_ConfigTransfer(DMAx, Stream, DMA_InitStruct->Direction | \
DMA_InitStruct->Mode | \
DMA_InitStruct->PeriphOrM2MSrcIncMode | \
DMA_InitStruct->MemoryOrM2MDstIncMode | \
DMA_InitStruct->PeriphOrM2MSrcDataSize | \
DMA_InitStruct->MemoryOrM2MDstDataSize | \
DMA_InitStruct->Priority
);
if(DMA_InitStruct->FIFOMode != LL_DMA_FIFOMODE_DISABLE)
{
/*---------------------------- DMAx SxFCR Configuration ------------------------
* Configure DMAx_Streamy: fifo mode and fifo threshold with parameters :
* - FIFOMode: DMA_SxFCR_DMDIS bit
* - FIFOThreshold: DMA_SxFCR_FTH[1:0] bits
*/
LL_DMA_ConfigFifo(DMAx, Stream, DMA_InitStruct->FIFOMode, DMA_InitStruct->FIFOThreshold);
/*---------------------------- DMAx SxCR Configuration --------------------------
* Configure DMAx_Streamy: memory burst transfer with parameters :
* - MemBurst: DMA_SxCR_MBURST[1:0] bits
*/
LL_DMA_SetMemoryBurstxfer(DMAx,Stream,DMA_InitStruct->MemBurst);
/*---------------------------- DMAx SxCR Configuration --------------------------
* Configure DMAx_Streamy: peripheral burst transfer with parameters :
* - PeriphBurst: DMA_SxCR_PBURST[1:0] bits
*/
LL_DMA_SetPeriphBurstxfer(DMAx,Stream,DMA_InitStruct->PeriphBurst);
}
/*-------------------------- DMAx SxM0AR Configuration --------------------------
* Configure the memory or destination base address with parameter :
* - MemoryOrM2MDstAddress: DMA_SxM0AR_M0A[31:0] bits
*/
LL_DMA_SetMemoryAddress(DMAx, Stream, DMA_InitStruct->MemoryOrM2MDstAddress);
/*-------------------------- DMAx SxPAR Configuration ---------------------------
* Configure the peripheral or source base address with parameter :
* - PeriphOrM2MSrcAddress: DMA_SxPAR_PA[31:0] bits
*/
LL_DMA_SetPeriphAddress(DMAx, Stream, DMA_InitStruct->PeriphOrM2MSrcAddress);
/*--------------------------- DMAx SxNDTR Configuration -------------------------
* Configure the peripheral base address with parameter :
* - NbData: DMA_SxNDT[15:0] bits
*/
LL_DMA_SetDataLength(DMAx, Stream, DMA_InitStruct->NbData);
/*--------------------------- DMA SxCR_CHSEL Configuration ----------------------
* Configure the peripheral base address with parameter :
* - PeriphRequest: DMA_SxCR_CHSEL[3:0] bits
*/
LL_DMA_SetChannelSelection(DMAx, Stream, DMA_InitStruct->Channel);
return SUCCESS;
}
/**
* @brief Set each @ref LL_DMA_InitTypeDef field to default value.
* @param DMA_InitStruct Pointer to a @ref LL_DMA_InitTypeDef structure.
* @retval None
*/
void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct)
{
/* Set DMA_InitStruct fields to default values */
DMA_InitStruct->PeriphOrM2MSrcAddress = 0x00000000U;
DMA_InitStruct->MemoryOrM2MDstAddress = 0x00000000U;
DMA_InitStruct->Direction = LL_DMA_DIRECTION_PERIPH_TO_MEMORY;
DMA_InitStruct->Mode = LL_DMA_MODE_NORMAL;
DMA_InitStruct->PeriphOrM2MSrcIncMode = LL_DMA_PERIPH_NOINCREMENT;
DMA_InitStruct->MemoryOrM2MDstIncMode = LL_DMA_MEMORY_NOINCREMENT;
DMA_InitStruct->PeriphOrM2MSrcDataSize = LL_DMA_PDATAALIGN_BYTE;
DMA_InitStruct->MemoryOrM2MDstDataSize = LL_DMA_MDATAALIGN_BYTE;
DMA_InitStruct->NbData = 0x00000000U;
DMA_InitStruct->Channel = LL_DMA_CHANNEL_0;
DMA_InitStruct->Priority = LL_DMA_PRIORITY_LOW;
DMA_InitStruct->FIFOMode = LL_DMA_FIFOMODE_DISABLE;
DMA_InitStruct->FIFOThreshold = LL_DMA_FIFOTHRESHOLD_1_4;
DMA_InitStruct->MemBurst = LL_DMA_MBURST_SINGLE;
DMA_InitStruct->PeriphBurst = LL_DMA_PBURST_SINGLE;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#endif /* DMA1 || DMA2 */
/**
* @}
*/
#endif /* USE_FULL_LL_DRIVER */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
the_stack_data/99271.c | #include <stdio.h>
int main()
{
int i = 0;
int number = 1;
int count = 0;
printf(" Prime Number from 1 to 100 are: \n");
while (number <= 100)
{
count = 0;
i = 2;
while (i <= number / 2)
{
if (number % i == 0)
{
count++;
}
i++;
}
if (count == 0 && number != 1)
{
printf(" %i ", number);
}
number++;
}
return 0;
} |
the_stack_data/154893.c | #define _GNU_SOURCE
#include <stdio.h>
#include <sched.h>
int
main( int argc, char ** argv ) {
int cpu = sched_getcpu();
if ( cpu == -1 ) {
perror( "unable to determine CPU:" );
return 1;
}
printf( "%d\n", cpu );
return 0;
}
|
the_stack_data/34514093.c | /*
* Copyright 2013-2017 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
/*
* A minimal program to serve an SSL connection. It uses blocking. It uses
* the SSL_CONF API with a configuration file. cc -I../../include saccept.c
* -L../.. -lssl -lcrypto -ldl
*/
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <openssl/conf.h>
int main(int argc, char *argv[])
{
char *port = "*:4433";
BIO *in = NULL;
BIO *ssl_bio, *tmp;
SSL_CTX *ctx;
SSL_CONF_CTX *cctx = NULL;
CONF *conf = NULL;
STACK_OF(CONF_VALUE) *sect = NULL;
CONF_VALUE *cnf;
long errline = -1;
char buf[512];
int ret = EXIT_FAILURE, i;
ctx = SSL_CTX_new(TLS_server_method());
conf = NCONF_new(NULL);
if (NCONF_load(conf, "accept.cnf", &errline) <= 0) {
if (errline <= 0)
fprintf(stderr, "Error processing config file\n");
else
fprintf(stderr, "Error on line %ld\n", errline);
goto err;
}
sect = NCONF_get_section(conf, "default");
if (sect == NULL) {
fprintf(stderr, "Error retrieving default section\n");
goto err;
}
cctx = SSL_CONF_CTX_new();
SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_SERVER);
SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_CERTIFICATE);
SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_FILE);
SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
for (i = 0; i < sk_CONF_VALUE_num(sect); i++) {
int rv;
cnf = sk_CONF_VALUE_value(sect, i);
rv = SSL_CONF_cmd(cctx, cnf->name, cnf->value);
if (rv > 0)
continue;
if (rv != -2) {
fprintf(stderr, "Error processing %s = %s\n",
cnf->name, cnf->value);
ERR_print_errors_fp(stderr);
goto err;
}
if (strcmp(cnf->name, "Port") == 0) {
port = cnf->value;
} else {
fprintf(stderr, "Unknown configuration option %s\n", cnf->name);
goto err;
}
}
if (!SSL_CONF_CTX_finish(cctx)) {
fprintf(stderr, "Finish error\n");
ERR_print_errors_fp(stderr);
goto err;
}
/* Setup server side SSL bio */
ssl_bio = BIO_new_ssl(ctx, 0);
if ((in = BIO_new_accept(port)) == NULL)
goto err;
/*
* This means that when a new connection is accepted on 'in', The ssl_bio
* will be 'duplicated' and have the new socket BIO push into it.
* Basically it means the SSL BIO will be automatically setup
*/
BIO_set_accept_bios(in, ssl_bio);
again:
/*
* The first call will setup the accept socket, and the second will get a
* socket. In this loop, the first actual accept will occur in the
* BIO_read() function.
*/
if (BIO_do_accept(in) <= 0)
goto err;
for (;;) {
i = BIO_read(in, buf, 512);
if (i == 0) {
/*
* If we have finished, remove the underlying BIO stack so the
* next time we call any function for this BIO, it will attempt
* to do an accept
*/
printf("Done\n");
tmp = BIO_pop(in);
BIO_free_all(tmp);
goto again;
}
if (i < 0) {
if (BIO_should_retry(in))
continue;
goto err;
}
fwrite(buf, 1, i, stdout);
fflush(stdout);
}
ret = EXIT_SUCCESS;
err:
if (ret != EXIT_SUCCESS)
ERR_print_errors_fp(stderr);
BIO_free(in);
return ret;
}
|
the_stack_data/159514443.c | /* This File is Part of LibFalcon.
* Copyright (c) 2018, Syed Nasim
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of LibFalcon nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if defined(__cplusplus)
extern "C" {
#endif
#include <stdlib.h>
#include <stdint.h>
#include <ctype.h>
long atol(const char *s) {
long n=0;
int neg=0;
while (isspace(*s)) s++;
switch (*s) {
case '-':
neg=1;
case '+':
s++;
}
while (isdigit(*s))
n = 10*n - (*s++ - '0');
return neg ? n : -n;
}
#if defined(__cplusplus)
}
#endif
|
the_stack_data/29823970.c | /******************************************************************************
*
* Copyright (C) 2014 - 2015 Xilinx, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* Use of the Software is limited solely to applications:
* (a) running on a Xilinx device, or
* (b) that interact with a Xilinx device through a bus or interconnect.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
*
******************************************************************************/
/*****************************************************************************/
/**
*
* @file initialise_monitor_handles.c
*
* Contains blank function to avoid compilation error
*
* @note
*
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver Who Date Changes
* ----- -------- -------- -----------------------------------------------
* 5.00 pkp 05/29/14 First release
* </pre>
******************************************************************************/
__attribute__((weak)) void initialise_monitor_handles(){
}
|
the_stack_data/13026.c | #include <stdio.h>
void func3()
{
int i = 11;
printf("\t\t\t[in func3] i = %d\n", i);
}
void func2()
{
int i = 7;
printf("\t\t[in func2] i = %d\n", i);
func3();
printf("\t\t[back in func2] i = %d\n", i);
}
void func1()
{
int i = 5;
printf("\t[in func1] i = %d\n", i);
func2();
printf("\t[back in func1] i = %d\n", i);
}
int main()
{
int i = 3;
printf("[in main] i = %d\n", i);
func1();
printf("[back in main] i = %d\n", i);
}
|
the_stack_data/1185300.c | typedef struct {
long int p_x, p_y;
} Point;
void
bar ()
{
}
void
f (p0, p1, p2, p3, p4, p5)
Point p0, p1, p2, p3, p4, p5;
{
if (p0.p_x != 0 || p0.p_y != 1
|| p1.p_x != -1 || p1.p_y != 0
|| p2.p_x != 1 || p2.p_y != -1
|| p3.p_x != -1 || p3.p_y != 1
|| p4.p_x != 0 || p4.p_y != -1
|| p5.p_x != 1 || p5.p_y != 0)
abort ();
}
void
foo ()
{
Point p0, p1, p2, p3, p4, p5;
bar();
p0.p_x = 0;
p0.p_y = 1;
p1.p_x = -1;
p1.p_y = 0;
p2.p_x = 1;
p2.p_y = -1;
p3.p_x = -1;
p3.p_y = 1;
p4.p_x = 0;
p4.p_y = -1;
p5.p_x = 1;
p5.p_y = 0;
f (p0, p1, p2, p3, p4, p5);
}
int
main()
{
foo();
exit(0);
}
|
the_stack_data/34760.c | #include <stdio.h>
#include <stdlib.h>
typedef struct Test Test;
struct Test
{
int len;
int array[];
};
int main()
{
// Al declarar una variable tipo Test se le dice cuanto ocupa su array.
// Se pueden declarar tantas como se quiera, ej con diferente tamaño cada una.
Test *T= (Test *) malloc(sizeof(Test)+10*sizeof(int)); // para array de 10
T->len= 10;
for( int i=0; i<T->len; i++)
T->array[i]=i;
for(int i=0; i<T->len; i++)
printf("%d ", T->array[i]);
free(T);
T=NULL;
return 0;
}
|
the_stack_data/43888983.c | /* { dg-do run } */
/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable" } */
/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable -Wno-volatile" { target c++ } } */
#define INT_MAX __INT_MAX__
#define INT_MIN (-__INT_MAX__ - 1)
#define LONG_MAX __LONG_MAX__
#define LONG_MIN (-__LONG_MAX__ - 1L)
#define LLONG_MAX __LONG_LONG_MAX__
#define LLONG_MIN (-__LONG_LONG_MAX__ - 1L)
int
main (void)
{
volatile int j = INT_MAX;
volatile int i = 1;
volatile int k = j + i;
k = i + j;
j++;
j = INT_MAX - 100;
j += (1 << 10);
j = INT_MIN;
i = -1;
k = i + j;
k = j + i;
j = INT_MIN + 100;
j += -(1 << 10);
volatile long int m = LONG_MAX;
volatile long int n = 1;
volatile long int o = m + n;
o = n + m;
m++;
m = LONG_MAX - 100;
m += (1 << 10);
m = LONG_MIN;
n = -1;
o = m + n;
o = n + m;
m = LONG_MIN + 100;
m += -(1 << 10);
return 0;
}
/* { dg-output "signed integer overflow: 2147483647 \\+ 1 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: 1 \\+ 2147483647 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: 2147483647 \\+ 1 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: 2147483547 \\+ 1024 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: -1 \\+ -2147483648 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: -2147483648 \\+ -1 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: -2147483548 \\+ -1024 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: \[^\n\r]* \\+ 1 cannot be represented in type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: 1 \\+ \[^\n\r]* cannot be represented in type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: \[^\n\r]* \\+ 1 cannot be represented in type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: \[^\n\r]* \\+ 1024 cannot be represented in type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: -\[^\n\r]* \\+ -1 cannot be represented in type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: -1 \\+ -\[^\n\r]* cannot be represented in type 'long int'\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*signed integer overflow: -\[^\n\r]* \\+ -1024 cannot be represented in type 'long int'" } */
|
the_stack_data/534971.c | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
//Port Generator by Forsaken.
int main(void) {
const int port_max = 65535;
srand((unsigned )time(NULL));
printf("%d\n", rand() % port_max);
return 0;
} |
the_stack_data/70449941.c |
/*
*
* This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
*
* Copyright 2007-2019 Broadcom Inc. All rights reserved.
*
* File: mpls.c
* Purpose: Manages common MPLS functions
*/
#ifdef INCLUDE_L3
#include <sal/core/libc.h>
#include <soc/drv.h>
#include <soc/mem.h>
#include <soc/l2u.h>
#include <soc/util.h>
#include <soc/debug.h>
#include <bcm/l2.h>
#include <bcm/l3.h>
#include <bcm/port.h>
#include <bcm/error.h>
#include <bcm/vlan.h>
#include <bcm/rate.h>
#include <bcm/ipmc.h>
#include <bcm/mpls.h>
#include <bcm/stack.h>
#include <bcm/topo.h>
#include <bcm/stat.h>
/*
* Function:
* bcm_mpls_port_t_init
* Purpose:
* Initialize the MPLS port struct
* Parameters:
* port_info - Pointer to the struct to be init'ed
*/
void
bcm_mpls_port_t_init(bcm_mpls_port_t *port_info)
{
if (port_info != NULL) {
sal_memset(port_info, 0, sizeof(*port_info));
port_info->port = BCM_GPORT_INVALID;
port_info->match_vlan = BCM_VLAN_INVALID;
port_info->match_inner_vlan = BCM_VLAN_INVALID;
port_info->egress_service_vlan = BCM_VLAN_INVALID;
port_info->egress_class_id = BCM_CLASS_ID_INVALID;
port_info->pw_seq_number = 1;
port_info->inlif_counting_profile = BCM_STAT_LIF_COUNTING_PROFILE_NONE;
bcm_mpls_egress_label_t_init(&port_info->egress_label);
bcm_mpls_egress_label_t_init(&port_info->egress_tunnel_label);
}
return;
}
/*
* Function:
* bcm_mpls_egress_label_t_init
* Purpose:
* Initialize MPLS egress label object struct.
* Parameters:
* label - Pointer to MPLS egress label object struct.
*/
void
bcm_mpls_egress_label_t_init(bcm_mpls_egress_label_t *label)
{
if (label != NULL) {
sal_memset(label, 0, sizeof(*label));
label->label = BCM_MPLS_LABEL_INVALID;
label->outlif_counting_profile = BCM_STAT_LIF_COUNTING_PROFILE_NONE;
label->egress_qos_model.egress_qos = bcmQosEgressModelUniform;
label->egress_qos_model.egress_ttl = bcmQosEgressModelUniform;
}
return;
}
/*
* Function:
* bcm_mpls_tunnel_switch_t_init
* Purpose:
* Initialize MPLS tunnel switch object struct.
* Parameters:
* switch - Pointer to MPLS tunnel switch object struct.
*/
void
bcm_mpls_tunnel_switch_t_init(bcm_mpls_tunnel_switch_t *info)
{
if (info != NULL) {
sal_memset(info, 0, sizeof(*info));
info->label = BCM_MPLS_LABEL_INVALID;
info->action = BCM_MPLS_SWITCH_ACTION_INVALID;
info->action_if_bos = info->action_if_not_bos = info->action;
info->inlif_counting_profile = BCM_STAT_LIF_COUNTING_PROFILE_NONE;
bcm_mpls_egress_label_t_init(&info->egress_label);
info->tunnel_if = BCM_IF_INVALID;
}
return;
}
/*
* Function:
* bcm_mpls_entropy_identifier_t_init
* Purpose:
* Initialize MPLS entropy identifier object struct.
* Parameters:
* switch - Pointer to MPLS entropy identifier object struct.
*/
void
bcm_mpls_entropy_identifier_t_init(bcm_mpls_entropy_identifier_t *info)
{
if (info != NULL) {
sal_memset(info, 0, sizeof(*info));
info->label = BCM_MPLS_LABEL_INVALID;
}
return;
}
/*
* Function:
* bcm_mpls_exp_map_t_init
* Purpose:
* Initialize MPLS EXP map object struct.
* Parameters:
* exp_map - Pointer to MPLS EXP map object struct.
*/
void
bcm_mpls_exp_map_t_init(bcm_mpls_exp_map_t *exp_map)
{
if (exp_map != NULL) {
sal_memset(exp_map, 0, sizeof(*exp_map));
}
return;
}
/*
* Function:
* bcm_mpls_vpn_config_t_init
* Purpose:
* Initialize the MPLS VPN config structure
* Parameters:
* info - Pointer to the struct to be init'ed
*/
void
bcm_mpls_vpn_config_t_init(bcm_mpls_vpn_config_t *info)
{
if (info != NULL) {
sal_memset(info, 0, sizeof(*info));
}
return;
}
/*
* Function:
* bcm_mpls_range_action_t_init
* Purpose:
* Initialize the MPLS Range action structure
* Parameters:
* info - Pointer to the struct to be init'ed
*/
void
bcm_mpls_range_action_t_init(bcm_mpls_range_action_t *info)
{
if (info != NULL) {
sal_memset(info, 0, sizeof(*info));
}
return;
}
/*
* Function:
* bcm_mpls_stat_info_t_init
* Purpose:
* Initialize the MPLS tunnel Stat info structure
* Parameters:
* stat_info - Pointer to the MPLS tunnel stat struct to be init'ed
*/
void
bcm_mpls_stat_info_t_init(bcm_mpls_stat_info_t *stat_info)
{
if (stat_info != NULL) {
sal_memset(stat_info, 0, sizeof(*stat_info));
}
return;
}
/*
* Function:
* bcm_mpls_special_label_t_init
* Purpose:
* Initialize the MPLS special label structure
* Parameters:
* stat_info - Pointer to the MPLS special label struct to be init'ed
*/
void
bcm_mpls_special_label_t_init(bcm_mpls_special_label_t *label_info)
{
if (label_info != NULL) {
sal_memset(label_info, 0, sizeof(*label_info));
label_info->label_value = BCM_MPLS_LABEL_INVALID;
}
return;
}
/*
* Function:
* bcm_mpls_special_label_push_element_init
* Purpose:
* Initialize the MPLS special label element structure
* Parameters:
* stat_info - Pointer to the MPLS special label element
* struct to be init'ed
*/
void
bcm_mpls_special_label_push_element_t_init(
bcm_mpls_special_label_push_element_t *element)
{
if (element != NULL) {
sal_memset(element, 0, sizeof(*element));
element->gport = BCM_GPORT_INVALID;
}
return;
}
/*
* Function:
* bcm_mpls_esi_info_t_init
* Purpose:
* Initialize the ESI info structure
* Parameters:
* esi_info - Pointer to the Esi info
* struct to be init'ed
*/
void
bcm_mpls_esi_info_t_init(
bcm_mpls_esi_info_t *esi_info)
{
if (esi_info != NULL) {
sal_memset(esi_info, 0, sizeof(*esi_info));
esi_info->src_port = BCM_GPORT_INVALID;
}
return;
}
#else
int _bcm_mpls_not_empty;
#endif /* INCLUDE_L3 */
|
the_stack_data/957976.c | int printf();
void* malloc();
int main() {
int a=100;;
printf("%d\n", a += 2);
printf("%d\n", a -= 2);
printf("%d\n", a *= 2);
printf("%d\n", a /= 2);
int* b = malloc(16);
b[0]=1;
b[1]=2;
b[2]=3;
b[3]=4;
b += 2;
printf("%d\n", b[0]);
b -= 1;
printf("%d\n", b[0]);
return 0;
}
|
the_stack_data/105753.c | #if 0
#include <stddef.h>
#include "RTE_Components.h"
#include CMSIS_device_header
#include "irq_ctrl.h"
#if defined(__GIC_PRESENT) && (__GIC_PRESENT == 1U)
/// Number of implemented interrupt lines
#ifndef IRQ_GIC_LINE_COUNT
#define IRQ_GIC_LINE_COUNT (1020U)
#endif
static IRQHandler_t IRQTable[IRQ_GIC_LINE_COUNT] = { 0U };
static uint32_t IRQ_ID0;
/// Initialize interrupt controller.
__WEAK int32_t IRQ_Initialize (void) {
uint32_t i;
for (i = 0U; i < IRQ_GIC_LINE_COUNT; i++) {
IRQTable[i] = (IRQHandler_t)NULL;
}
GIC_Enable();
return (0);
}
/// Register interrupt handler.
__WEAK int32_t IRQ_SetHandler (IRQn_ID_t irqn, IRQHandler_t handler) {
int32_t status;
if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
IRQTable[irqn] = handler;
status = 0;
} else {
status = -1;
}
return (status);
}
/// Get the registered interrupt handler.
__WEAK IRQHandler_t IRQ_GetHandler (IRQn_ID_t irqn) {
IRQHandler_t h;
// Ignore CPUID field (software generated interrupts)
irqn &= 0x3FFU;
if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
h = IRQTable[irqn];
} else {
h = (IRQHandler_t)0;
}
return (h);
}
/// Enable interrupt.
__WEAK int32_t IRQ_Enable (IRQn_ID_t irqn) {
int32_t status;
if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
GIC_EnableIRQ ((IRQn_Type)irqn);
status = 0;
} else {
status = -1;
}
return (status);
}
/// Disable interrupt.
__WEAK int32_t IRQ_Disable (IRQn_ID_t irqn) {
int32_t status;
if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
GIC_DisableIRQ ((IRQn_Type)irqn);
status = 0;
} else {
status = -1;
}
return (status);
}
/// Get interrupt enable state.
__WEAK uint32_t IRQ_GetEnableState (IRQn_ID_t irqn) {
uint32_t enable;
if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
enable = GIC_GetEnableIRQ((IRQn_Type)irqn);
} else {
enable = 0U;
}
return (enable);
}
/// Configure interrupt request mode.
__WEAK int32_t IRQ_SetMode (IRQn_ID_t irqn, uint32_t mode) {
uint32_t val;
uint8_t cfg;
uint8_t secure;
uint8_t cpu;
int32_t status = 0;
if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
// Check triggering mode
val = (mode & IRQ_MODE_TRIG_Msk);
if (val == IRQ_MODE_TRIG_LEVEL) {
cfg = 0x00U;
} else if (val == IRQ_MODE_TRIG_EDGE) {
cfg = 0x02U;
} else {
cfg = 0x00U;
status = -1;
}
// Check interrupt type
val = mode & IRQ_MODE_TYPE_Msk;
if (val != IRQ_MODE_TYPE_IRQ) {
status = -1;
}
// Check interrupt domain
val = mode & IRQ_MODE_DOMAIN_Msk;
if (val == IRQ_MODE_DOMAIN_NONSECURE) {
secure = 0U;
} else {
// Check security extensions support
val = GIC_DistributorInfo() & (1UL << 10U);
if (val != 0U) {
// Security extensions are supported
secure = 1U;
} else {
secure = 0U;
status = -1;
}
}
// Check interrupt CPU targets
val = mode & IRQ_MODE_CPU_Msk;
if (val == IRQ_MODE_CPU_ALL) {
cpu = 0xFFU;
} else {
cpu = val >> IRQ_MODE_CPU_Pos;
}
// Apply configuration if no mode error
if (status == 0) {
GIC_SetConfiguration((IRQn_Type)irqn, cfg);
GIC_SetTarget ((IRQn_Type)irqn, cpu);
if (secure != 0U) {
GIC_SetGroup ((IRQn_Type)irqn, secure);
}
}
}
return (status);
}
/// Get interrupt mode configuration.
__WEAK uint32_t IRQ_GetMode (IRQn_ID_t irqn) {
uint32_t mode;
uint32_t val;
if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
mode = IRQ_MODE_TYPE_IRQ;
// Get trigger mode
val = GIC_GetConfiguration((IRQn_Type)irqn);
if ((val & 2U) != 0U) {
// Corresponding interrupt is edge triggered
mode |= IRQ_MODE_TRIG_EDGE;
} else {
// Corresponding interrupt is level triggered
mode |= IRQ_MODE_TRIG_LEVEL;
}
// Get interrupt CPU targets
mode |= GIC_GetTarget ((IRQn_Type)irqn) << IRQ_MODE_CPU_Pos;
} else {
mode = IRQ_MODE_ERROR;
}
return (mode);
}
/// Get ID number of current interrupt request (IRQ).
__WEAK IRQn_ID_t IRQ_GetActiveIRQ (void) {
IRQn_ID_t irqn;
uint32_t prio;
/* Dummy read to avoid GIC 390 errata 801120 */
GIC_GetHighPendingIRQ();
irqn = GIC_AcknowledgePending();
__DSB();
/* Workaround GIC 390 errata 733075 (GIC-390_Errata_Notice_v6.pdf, 09-Jul-2014) */
/* The following workaround code is for a single-core system. It would be */
/* different in a multi-core system. */
/* If the ID is 0 or 0x3FE or 0x3FF, then the GIC CPU interface may be locked-up */
/* so unlock it, otherwise service the interrupt as normal. */
/* Special IDs 1020=0x3FC and 1021=0x3FD are reserved values in GICv1 and GICv2 */
/* so will not occur here. */
if ((irqn == 0) || (irqn >= 0x3FE)) {
/* Unlock the CPU interface with a dummy write to Interrupt Priority Register */
prio = GIC_GetPriority((IRQn_Type)0);
GIC_SetPriority ((IRQn_Type)0, prio);
__DSB();
if ((irqn == 0U) && ((GIC_GetIRQStatus ((IRQn_Type)irqn) & 1U) != 0U) && (IRQ_ID0 == 0U)) {
/* If the ID is 0, is active and has not been seen before */
IRQ_ID0 = 1U;
}
/* End of Workaround GIC 390 errata 733075 */
}
return (irqn);
}
/// Get ID number of current fast interrupt request (FIQ).
__WEAK IRQn_ID_t IRQ_GetActiveFIQ (void) {
return ((IRQn_ID_t)-1);
}
/// Signal end of interrupt processing.
__WEAK int32_t IRQ_EndOfInterrupt (IRQn_ID_t irqn) {
int32_t status;
IRQn_Type irq = (IRQn_Type)irqn;
irqn &= 0x3FFU;
if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
GIC_EndInterrupt (irq);
if (irqn == 0) {
IRQ_ID0 = 0U;
}
status = 0;
} else {
status = -1;
}
return (status);
}
/// Set interrupt pending flag.
__WEAK int32_t IRQ_SetPending (IRQn_ID_t irqn) {
int32_t status;
if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
GIC_SetPendingIRQ ((IRQn_Type)irqn);
status = 0;
} else {
status = -1;
}
return (status);
}
/// Get interrupt pending flag.
__WEAK uint32_t IRQ_GetPending (IRQn_ID_t irqn) {
uint32_t pending;
if ((irqn >= 16) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
pending = GIC_GetPendingIRQ ((IRQn_Type)irqn);
} else {
pending = 0U;
}
return (pending & 1U);
}
/// Clear interrupt pending flag.
__WEAK int32_t IRQ_ClearPending (IRQn_ID_t irqn) {
int32_t status;
if ((irqn >= 16) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
GIC_ClearPendingIRQ ((IRQn_Type)irqn);
status = 0;
} else {
status = -1;
}
return (status);
}
/// Set interrupt priority value.
__WEAK int32_t IRQ_SetPriority (IRQn_ID_t irqn, uint32_t priority) {
int32_t status;
if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
GIC_SetPriority ((IRQn_Type)irqn, priority);
status = 0;
} else {
status = -1;
}
return (status);
}
/// Get interrupt priority.
__WEAK uint32_t IRQ_GetPriority (IRQn_ID_t irqn) {
uint32_t priority;
if ((irqn >= 0) && (irqn < (IRQn_ID_t)IRQ_GIC_LINE_COUNT)) {
priority = GIC_GetPriority ((IRQn_Type)irqn);
} else {
priority = IRQ_PRIORITY_ERROR;
}
return (priority);
}
/// Set priority masking threshold.
__WEAK int32_t IRQ_SetPriorityMask (uint32_t priority) {
GIC_SetInterfacePriorityMask (priority);
return (0);
}
/// Get priority masking threshold
__WEAK uint32_t IRQ_GetPriorityMask (void) {
return GIC_GetInterfacePriorityMask();
}
/// Set priority grouping field split point
__WEAK int32_t IRQ_SetPriorityGroupBits (uint32_t bits) {
int32_t status;
if (bits == IRQ_PRIORITY_Msk) {
bits = 7U;
}
if (bits < 8U) {
GIC_SetBinaryPoint (7U - bits);
status = 0;
} else {
status = -1;
}
return (status);
}
/// Get priority grouping field split point
__WEAK uint32_t IRQ_GetPriorityGroupBits (void) {
uint32_t bp;
bp = GIC_GetBinaryPoint() & 0x07U;
return (7U - bp);
}
#endif
#endif |
the_stack_data/162644015.c | #include <stdio.h>
#include <errno.h>
//System (3)
#include <stdlib.h>
int main(int argc, char **argv) {
//printf("\n[%s][%s][%s]\n", argv[0], argv[1], argv[2]);
printf("\nComando introducido: %s\n", argv[1]);
int i = system(argv[1]);
if (i == -1) {
printf("ERROR: el comando no se ha ejecutado correctamente!");
}
else {
printf("El comando terminó de ejecutarse\n");
}
return 0;
} |
the_stack_data/48575608.c | #include <stdio.h>
void testFunc(int a, int b, int c) {
printf("Arg1: %d\n", a);
printf("Arg2: %d\n", b);
printf("Arg3: %d\n", c);
}
int main(){
int num1 = 1;
int num2 = 2;
int num3 = 3;
testFunc(num1, num2, num3);
//TestFunc should print Arg1: 1 Arg2: 2 Arg3: (modified value)
return 0;
} |
the_stack_data/122015.c | extern const unsigned char udacityappVersionString[];
extern const double udacityappVersionNumber;
const unsigned char udacityappVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:udacityapp PROJECT:udacityapp-1" "\n";
const double udacityappVersionNumber __attribute__ ((used)) = (double)1.;
|
the_stack_data/231392543.c | /*
* Copyright (c) 2002-2007 Niels Provos <[email protected]>
* Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "event2/event-config.h"
#ifdef WIN32
#include <winsock2.h>
#else
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef _EVENT_HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef _EVENT_HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <event.h>
#include <evutil.h>
#ifdef _EVENT___func__
#define __func__ _EVENT___func__
#endif
int test_okay = 1;
int called = 0;
struct timeval timeout = {60, 0};
static void
read_cb(evutil_socket_t fd, short event, void *arg)
{
char buf[256];
int len;
if (EV_TIMEOUT & event) {
printf("%s: Timeout!\n", __func__);
exit(1);
}
len = recv(fd, buf, sizeof(buf), 0);
printf("%s: read %d%s\n", __func__,
len, len ? "" : " - means EOF");
if (len) {
if (!called)
event_add(arg, &timeout);
} else if (called == 1)
test_okay = 0;
called++;
}
#ifndef SHUT_WR
#define SHUT_WR 1
#endif
int
main(int argc, char **argv)
{
struct event ev;
const char *test = "test string";
evutil_socket_t pair[2];
#ifdef WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD(2, 2);
err = WSAStartup(wVersionRequested, &wsaData);
#endif
if (evutil_socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1)
return (1);
send(pair[0], test, (int)strlen(test)+1, 0);
shutdown(pair[0], SHUT_WR);
/* Initalize the event library */
event_init();
/* Initalize one event */
event_set(&ev, pair[1], EV_READ | EV_TIMEOUT, read_cb, &ev);
event_add(&ev, &timeout);
event_dispatch();
return (test_okay);
}
|
the_stack_data/9511952.c | /*
* ferror .c - test if an error on a stream occurred
*/
/* $Header$ */
#include <stdio.h>
int
(ferror)(FILE *stream)
{
return ferror(stream);
}
|
the_stack_data/48574580.c | /* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "3.0.4"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 0
/* Push parsers. */
#define YYPUSH 0
/* Pull parsers. */
#define YYPULL 1
/* Copy the first part of user declarations. */
#line 67 "y.tab.c" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# else
# define YY_NULLPTR 0
# endif
# endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif
/* In a future release of Bison, this section will be replaced
by #include "y.tab.h". */
#ifndef YY_YY_Y_TAB_H_INCLUDED
# define YY_YY_Y_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* "%code requires" blocks. */
#line 1 "decaf.y" /* yacc.c:355 */
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
int tabCount;
typedef struct tnode{
struct tnode ** childs;
char *token;
int size;
} tnode;
tnode * ProgramNode(char *token, tnode *child);
tnode * merge(tnode *addchild, tnode *child);
tnode * NewNodeWithLabel(char *token,tnode ** arr, int size);
tnode * emptyNode();
void printtree(tnode *tree);
#line 117 "y.tab.c" /* yacc.c:355 */
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
T_STRINGCONSTANT = 258,
T_CHARCONSTANT = 259,
T_BOOLEANCONSTANT = 260,
T_INTCONSTANT = 261,
T_DOUBLECONSTANT = 262,
T_ID = 263,
T_VOID = 264,
T_STRINGTYPE = 265,
T_THIS = 266,
T_WHILE = 267,
T_BREAK = 268,
T_READINTEGER = 269,
T_INTTYPE = 270,
T_CLASS = 271,
T_EXTENDS = 272,
T_IF = 273,
T_NEW = 274,
T_READLINE = 275,
T_DOUBLE = 276,
T_INTERFACE = 277,
T_IMPLEMENTS = 278,
T_ELSE = 279,
T_NEWARRAY = 280,
T_BOOLTYPE = 281,
T_NULL = 282,
T_FOR = 283,
T_RETURN = 284,
T_PRINT = 285,
T_CONTINUE = 286,
T_EXTERN = 287,
T_WHITESPACE = 288,
T_COMMENT = 289,
T_PLUS = 290,
T_MINUS = 291,
T_AND = 292,
T_ASSIGN = 293,
T_COMMA = 294,
T_DIV = 295,
T_DOT = 296,
T_EQ = 297,
T_GEQ = 298,
T_GT = 299,
T_LEFTSHIFT = 300,
T_LEQ = 301,
T_LPAREN = 302,
T_RPAREN = 303,
T_LT = 304,
T_MOD = 305,
T_MULT = 306,
T_NEQ = 307,
T_NOT = 308,
T_OR = 309,
T_RIGHTSHIFT = 310,
T_SEMICOLON = 311,
T_LCB = 312,
T_RCB = 313,
T_LSB = 314,
T_RSB = 315,
LOWER_THAN_ELSE = 316,
UMINUS = 317
};
#endif
/* Tokens. */
#define T_STRINGCONSTANT 258
#define T_CHARCONSTANT 259
#define T_BOOLEANCONSTANT 260
#define T_INTCONSTANT 261
#define T_DOUBLECONSTANT 262
#define T_ID 263
#define T_VOID 264
#define T_STRINGTYPE 265
#define T_THIS 266
#define T_WHILE 267
#define T_BREAK 268
#define T_READINTEGER 269
#define T_INTTYPE 270
#define T_CLASS 271
#define T_EXTENDS 272
#define T_IF 273
#define T_NEW 274
#define T_READLINE 275
#define T_DOUBLE 276
#define T_INTERFACE 277
#define T_IMPLEMENTS 278
#define T_ELSE 279
#define T_NEWARRAY 280
#define T_BOOLTYPE 281
#define T_NULL 282
#define T_FOR 283
#define T_RETURN 284
#define T_PRINT 285
#define T_CONTINUE 286
#define T_EXTERN 287
#define T_WHITESPACE 288
#define T_COMMENT 289
#define T_PLUS 290
#define T_MINUS 291
#define T_AND 292
#define T_ASSIGN 293
#define T_COMMA 294
#define T_DIV 295
#define T_DOT 296
#define T_EQ 297
#define T_GEQ 298
#define T_GT 299
#define T_LEFTSHIFT 300
#define T_LEQ 301
#define T_LPAREN 302
#define T_RPAREN 303
#define T_LT 304
#define T_MOD 305
#define T_MULT 306
#define T_NEQ 307
#define T_NOT 308
#define T_OR 309
#define T_RIGHTSHIFT 310
#define T_SEMICOLON 311
#define T_LCB 312
#define T_RCB 313
#define T_LSB 314
#define T_RSB 315
#define LOWER_THAN_ELSE 316
#define UMINUS 317
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 21 "decaf.y" /* yacc.c:355 */
int rvalue; //real values
int bvalue; //boolean values
char *svalue; //string values
double dvalue; //double values
char *name; // +1 for terminating null
tnode * NTnode;
#line 263 "y.tab.c" /* yacc.c:355 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_Y_TAB_H_INCLUDED */
/* Copy the second part of user declarations. */
#line 280 "y.tab.c" /* yacc.c:358 */
#ifdef short
# undef short
#endif
#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#else
typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short int yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short int yytype_int16;
#endif
#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
# elif ! defined YYSIZE_T
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
# define YYSIZE_T unsigned int
# endif
#endif
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
# define YY_(Msgid) Msgid
# endif
#endif
#ifndef YY_ATTRIBUTE
# if (defined __GNUC__ \
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
# define YY_ATTRIBUTE(Spec) /* empty */
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
#if !defined _Noreturn \
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E) /* empty */
#endif
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# elif defined __BUILTIN_VA_ARG_INCR
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
# elif defined _AIX
# define YYSTACK_ALLOC __alloca
# elif defined _MSC_VER
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
/* Pacify GCC's 'empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
to allow for a few compiler-allocated temporary stack slots. */
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
# endif
# else
# define YYSTACK_ALLOC YYMALLOC
# define YYSTACK_FREE YYFREE
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 20
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 476
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 63
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 36
/* YYNRULES -- Number of rules. */
#define YYNRULES 99
/* YYNSTATES -- Number of states. */
#define YYNSTATES 198
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 317
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, without out-of-bounds checking. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 65, 65, 71, 73, 75, 77, 80, 81, 83,
86, 87, 89, 94, 95, 97, 98, 99, 100, 101,
103, 113, 125, 126, 128, 141, 144, 146, 147, 149,
153, 156, 158, 161, 162, 164, 169, 176, 185, 186,
188, 192, 194, 196, 198, 200, 202, 204, 206, 209,
210, 212, 213, 219, 224, 229, 231, 233, 235, 236,
238, 240, 241, 243, 245, 246, 247, 248, 249, 250,
251, 252, 253, 254, 255, 256, 257, 258, 259, 260,
261, 262, 265, 267, 268, 270, 271, 273, 278, 282,
287, 290, 294, 295, 297, 298, 299, 300, 301, 302
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"$end", "error", "$undefined", "T_STRINGCONSTANT", "T_CHARCONSTANT",
"T_BOOLEANCONSTANT", "T_INTCONSTANT", "T_DOUBLECONSTANT", "T_ID",
"T_VOID", "T_STRINGTYPE", "T_THIS", "T_WHILE", "T_BREAK",
"T_READINTEGER", "T_INTTYPE", "T_CLASS", "T_EXTENDS", "T_IF", "T_NEW",
"T_READLINE", "T_DOUBLE", "T_INTERFACE", "T_IMPLEMENTS", "T_ELSE",
"T_NEWARRAY", "T_BOOLTYPE", "T_NULL", "T_FOR", "T_RETURN", "T_PRINT",
"T_CONTINUE", "T_EXTERN", "T_WHITESPACE", "T_COMMENT", "T_PLUS",
"T_MINUS", "T_AND", "T_ASSIGN", "T_COMMA", "T_DIV", "T_DOT", "T_EQ",
"T_GEQ", "T_GT", "T_LEFTSHIFT", "T_LEQ", "T_LPAREN", "T_RPAREN", "T_LT",
"T_MOD", "T_MULT", "T_NEQ", "T_NOT", "T_OR", "T_RIGHTSHIFT",
"T_SEMICOLON", "T_LCB", "T_RCB", "T_LSB", "T_RSB", "LOWER_THAN_ELSE",
"UMINUS", "$accept", "program", "Decl", "MDecl", "VariableDecl",
"VariableDeclStar", "Variable", "MVariable", "Type", "FunctionDecl",
"Formals", "ClassDecl", "EFirst", "IFirst", "MImplement", "Field",
"FieldStar", "InterfaceDecl", "Prototype", "PrototypeStar", "StmtBlock",
"Stmt", "StmtStar", "IfStmt", "WhileStmt", "ForStmt", "ReturnStmt",
"BreakStmt", "PrintStmt", "Expr", "MExpr", "ExprFirst", "LValue", "Call",
"Actuals", "Constant", YY_NULLPTR
};
#endif
# ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
315, 316, 317
};
# endif
#define YYPACT_NINF -162
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-162)))
#define YYTABLE_NINF -87
#define yytable_value_is_error(Yytable_value) \
(!!((Yytable_value) == (-87)))
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
static const yytype_int16 yypact[] =
{
109, 5, -162, -162, 8, -162, 13, -162, 26, 109,
-162, -162, -16, -6, -162, -162, -162, -8, 25, -14,
-162, -162, -162, -3, -11, 160, 42, 40, 10, 160,
-162, 27, -162, -2, 17, -162, 63, 33, -162, 74,
3, 10, 38, 43, 160, -162, 41, 58, 159, 60,
68, -162, -162, 41, -162, 160, -162, 40, -162, -162,
159, 47, 160, 160, -162, 160, 81, -162, -162, -162,
75, 78, -162, -162, -162, -162, -162, -162, 69, -162,
80, 72, 85, 86, 89, 98, 99, -162, 104, 191,
105, 191, 191, 191, -162, 81, 95, -162, -162, -162,
-162, -162, -162, 357, 101, 120, -162, -162, 103, 106,
191, 191, -162, 112, 191, 163, 119, 191, 191, -162,
191, -36, 226, -36, -162, -162, 191, 191, 191, 191,
165, 191, 191, 191, 191, 191, 191, 191, 191, 191,
191, -162, 191, -162, -162, 246, -162, 128, 271, -162,
291, 129, -162, 312, 123, 134, -162, 62, 62, 179,
-36, 140, 397, 417, 417, 417, 417, -36, -36, 397,
377, 205, 357, 191, -162, 136, 136, -162, 160, 191,
127, 191, -162, -162, -162, 164, -41, 332, -162, 142,
136, -162, 191, -162, -162, 143, 136, -162
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE does not specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
0, 0, 18, 16, 0, 15, 0, 17, 0, 8,
2, 3, 0, 0, 4, 5, 6, 0, 26, 0,
1, 7, 9, 12, 0, 23, 0, 28, 39, 23,
19, 14, 22, 0, 0, 25, 0, 0, 27, 0,
0, 39, 0, 0, 0, 12, 0, 30, 34, 0,
0, 38, 35, 0, 13, 11, 21, 0, 31, 32,
34, 0, 23, 23, 20, 11, 50, 29, 33, 24,
0, 0, 10, 97, 98, 96, 94, 95, 87, 61,
0, 0, 0, 0, 0, 0, 0, 99, 0, 86,
0, 0, 0, 0, 48, 50, 0, 42, 43, 44,
46, 45, 47, 85, 0, 60, 62, 59, 0, 0,
0, 0, 56, 0, 0, 0, 0, 0, 86, 55,
0, 69, 0, 78, 49, 40, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 41, 0, 37, 36, 84, 92, 0, 0, 79,
0, 0, 80, 0, 0, 0, 63, 64, 65, 76,
67, 88, 74, 72, 73, 71, 70, 68, 66, 75,
77, 0, 58, 0, 90, 86, 86, 81, 0, 0,
0, 0, 89, 83, 53, 51, 0, 0, 57, 0,
86, 82, 0, 91, 52, 0, 86, 54
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-162, -162, -162, 183, -1, 135, -17, 157, 0, -38,
-25, -162, -162, -162, 146, -162, 144, -162, -162, 166,
-29, -161, 111, -162, -162, -162, -162, -162, -162, -59,
-117, -88, -162, -162, 28, -162
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 8, 9, 10, 11, 66, 12, 32, 33, 14,
34, 15, 27, 37, 38, 60, 61, 16, 41, 42,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
146, 104, 105, 106, 147, 107
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule whose
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int16 yytable[] =
{
13, 119, 23, 155, 43, 130, 45, 191, 31, 13,
59, 50, 31, 17, 184, 185, 18, 56, 24, 39,
2, 19, 59, 140, 64, 3, 20, 31, 40, 194,
154, 5, 121, 122, 123, 197, 7, 70, 71, 25,
22, 40, 26, 28, 29, 31, 31, 58, 13, 30,
35, 145, 148, 24, 65, 150, 183, 24, 153, 58,
13, 145, 24, 36, 65, 46, 44, 157, 158, 159,
160, 47, 162, 163, 164, 165, 166, 167, 168, 169,
170, 171, 49, 172, 73, 74, 75, 76, 77, 78,
48, 53, 79, 80, 81, 82, 52, 57, 55, 83,
84, 85, 129, 130, 195, 69, 86, 62, 87, 88,
89, 90, 136, 137, 145, 63, 110, 91, 1, 2,
187, 140, 145, 108, 3, 4, 109, 111, 112, 92,
5, 6, 113, 114, 93, 7, 115, -86, 55, 73,
74, 75, 76, 77, 78, 116, 117, 79, 80, 81,
82, 118, 120, 125, 83, 84, 85, 141, 142, 143,
149, 86, 144, 87, 88, 89, 90, 152, 1, 2,
2, 151, 91, 161, 3, 3, 174, 177, 186, 179,
5, 5, 180, 188, 92, 7, 7, 181, 190, 93,
193, 196, 21, 55, 73, 74, 75, 76, 77, 78,
72, 54, 79, 67, 68, 82, 124, 51, 0, 189,
84, 85, 0, 0, 126, 127, 86, 0, 87, 129,
130, 131, 132, 133, 0, 134, 0, 91, 135, 136,
137, 138, 0, 0, 0, 0, 0, 0, 140, 92,
126, 127, 128, 0, 93, 129, 130, 131, 132, 133,
0, 134, 0, 0, 135, 136, 137, 138, 0, 139,
0, 126, 127, 128, 140, 182, 129, 130, 131, 132,
133, 0, 134, 156, 0, 135, 136, 137, 138, 0,
139, 126, 127, 128, 0, 140, 129, 130, 131, 132,
133, 0, 134, 0, 0, 135, 136, 137, 138, 0,
139, 0, 173, 0, 0, 140, 126, 127, 128, 0,
0, 129, 130, 131, 132, 133, 0, 134, 0, 175,
135, 136, 137, 138, 0, 139, 126, 127, 128, 0,
140, 129, 130, 131, 132, 133, 0, 134, 0, 176,
135, 136, 137, 138, 0, 139, 0, 126, 127, 128,
140, 178, 129, 130, 131, 132, 133, 0, 134, 0,
0, 135, 136, 137, 138, 0, 139, 126, 127, 128,
0, 140, 129, 130, 131, 132, 133, 0, 134, 0,
0, 135, 136, 137, 138, 0, 139, 0, 192, 0,
0, 140, 126, 127, 128, 0, 0, 129, 130, 131,
132, 133, 0, 134, 0, 0, 135, 136, 137, 138,
0, 139, 126, 127, 128, 0, 140, 129, 130, 131,
132, 133, 0, 134, 0, 0, 135, 136, 137, 138,
0, 0, 126, 127, 0, 0, 140, 129, 130, -87,
132, 133, 0, 134, 0, 0, 135, 136, 137, -87,
0, 0, 126, 127, 0, 0, 140, 129, 130, 0,
-87, -87, 0, -87, 0, 0, -87, 136, 137, 0,
0, 0, 0, 0, 0, 0, 140
};
static const yytype_int16 yycheck[] =
{
0, 89, 8, 120, 29, 41, 8, 48, 25, 9,
48, 8, 29, 8, 175, 176, 8, 46, 59, 9,
10, 8, 60, 59, 53, 15, 0, 44, 28, 190,
118, 21, 91, 92, 93, 196, 26, 62, 63, 47,
56, 41, 17, 57, 47, 62, 63, 48, 48, 60,
8, 110, 111, 59, 55, 114, 173, 59, 117, 60,
60, 120, 59, 23, 65, 48, 39, 126, 127, 128,
129, 8, 131, 132, 133, 134, 135, 136, 137, 138,
139, 140, 8, 142, 3, 4, 5, 6, 7, 8,
57, 48, 11, 12, 13, 14, 58, 39, 57, 18,
19, 20, 40, 41, 192, 58, 25, 47, 27, 28,
29, 30, 50, 51, 173, 47, 47, 36, 9, 10,
179, 59, 181, 48, 15, 16, 48, 47, 56, 48,
21, 22, 47, 47, 53, 26, 47, 56, 57, 3,
4, 5, 6, 7, 8, 47, 47, 11, 12, 13,
14, 47, 47, 58, 18, 19, 20, 56, 38, 56,
48, 25, 56, 27, 28, 29, 30, 48, 9, 10,
10, 8, 36, 8, 15, 15, 48, 48, 178, 56,
21, 21, 48, 56, 48, 26, 26, 47, 24, 53,
48, 48, 9, 57, 3, 4, 5, 6, 7, 8,
65, 44, 11, 57, 60, 14, 95, 41, -1, 181,
19, 20, -1, -1, 35, 36, 25, -1, 27, 40,
41, 42, 43, 44, -1, 46, -1, 36, 49, 50,
51, 52, -1, -1, -1, -1, -1, -1, 59, 48,
35, 36, 37, -1, 53, 40, 41, 42, 43, 44,
-1, 46, -1, -1, 49, 50, 51, 52, -1, 54,
-1, 35, 36, 37, 59, 60, 40, 41, 42, 43,
44, -1, 46, 47, -1, 49, 50, 51, 52, -1,
54, 35, 36, 37, -1, 59, 40, 41, 42, 43,
44, -1, 46, -1, -1, 49, 50, 51, 52, -1,
54, -1, 56, -1, -1, 59, 35, 36, 37, -1,
-1, 40, 41, 42, 43, 44, -1, 46, -1, 48,
49, 50, 51, 52, -1, 54, 35, 36, 37, -1,
59, 40, 41, 42, 43, 44, -1, 46, -1, 48,
49, 50, 51, 52, -1, 54, -1, 35, 36, 37,
59, 39, 40, 41, 42, 43, 44, -1, 46, -1,
-1, 49, 50, 51, 52, -1, 54, 35, 36, 37,
-1, 59, 40, 41, 42, 43, 44, -1, 46, -1,
-1, 49, 50, 51, 52, -1, 54, -1, 56, -1,
-1, 59, 35, 36, 37, -1, -1, 40, 41, 42,
43, 44, -1, 46, -1, -1, 49, 50, 51, 52,
-1, 54, 35, 36, 37, -1, 59, 40, 41, 42,
43, 44, -1, 46, -1, -1, 49, 50, 51, 52,
-1, -1, 35, 36, -1, -1, 59, 40, 41, 42,
43, 44, -1, 46, -1, -1, 49, 50, 51, 52,
-1, -1, 35, 36, -1, -1, 59, 40, 41, -1,
43, 44, -1, 46, -1, -1, 49, 50, 51, -1,
-1, -1, -1, -1, -1, -1, 59
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 9, 10, 15, 16, 21, 22, 26, 64, 65,
66, 67, 69, 71, 72, 74, 80, 8, 8, 8,
0, 66, 56, 8, 59, 47, 17, 75, 57, 47,
60, 69, 70, 71, 73, 8, 23, 76, 77, 9,
71, 81, 82, 73, 39, 8, 48, 8, 57, 8,
8, 82, 58, 48, 70, 57, 83, 39, 67, 72,
78, 79, 47, 47, 83, 67, 68, 77, 79, 58,
73, 73, 68, 3, 4, 5, 6, 7, 8, 11,
12, 13, 14, 18, 19, 20, 25, 27, 28, 29,
30, 36, 48, 53, 83, 84, 85, 86, 87, 88,
89, 90, 91, 92, 94, 95, 96, 98, 48, 48,
47, 47, 56, 47, 47, 47, 47, 47, 47, 94,
47, 92, 92, 92, 85, 58, 35, 36, 37, 40,
41, 42, 43, 44, 46, 49, 50, 51, 52, 54,
59, 56, 38, 56, 56, 92, 93, 97, 92, 48,
92, 8, 48, 92, 94, 93, 47, 92, 92, 92,
92, 8, 92, 92, 92, 92, 92, 92, 92, 92,
92, 92, 92, 56, 48, 48, 48, 48, 39, 56,
48, 47, 60, 93, 84, 84, 71, 92, 56, 97,
24, 48, 56, 48, 84, 94, 48, 84
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
0, 63, 64, 65, 65, 65, 65, 66, 66, 67,
68, 68, 69, 70, 70, 71, 71, 71, 71, 71,
72, 72, 73, 73, 74, 75, 75, 76, 76, 77,
77, 78, 78, 79, 79, 80, 81, 81, 82, 82,
83, 84, 84, 84, 84, 84, 84, 84, 84, 85,
85, 86, 86, 87, 88, 89, 90, 91, 92, 92,
92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
92, 92, 92, 93, 93, 94, 94, 95, 95, 95,
96, 96, 97, 97, 98, 98, 98, 98, 98, 98
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 1, 1, 1, 1, 1, 2, 1, 2,
2, 0, 2, 3, 1, 1, 1, 1, 1, 3,
6, 6, 1, 0, 7, 2, 0, 1, 0, 4,
2, 1, 1, 2, 0, 5, 6, 6, 2, 0,
4, 2, 1, 1, 1, 1, 1, 1, 1, 2,
0, 5, 7, 5, 9, 2, 2, 5, 3, 1,
1, 1, 1, 3, 3, 3, 3, 3, 3, 2,
3, 3, 3, 3, 3, 3, 3, 3, 2, 3,
3, 4, 6, 3, 1, 1, 0, 1, 3, 4,
4, 6, 1, 0, 1, 1, 1, 1, 1, 1
};
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror (YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (0)
/* Error token number */
#define YYTERROR 1
#define YYERRCODE 256
/* Enable debugging if requested. */
#if YYDEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
/* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
Type, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
/*----------------------------------------.
| Print this symbol's value on YYOUTPUT. |
`----------------------------------------*/
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
{
FILE *yyo = yyoutput;
YYUSE (yyo);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
YYUSE (yytype);
}
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
{
YYFPRINTF (yyoutput, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
YYFPRINTF (yyoutput, ")");
}
/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included). |
`------------------------------------------------------------------*/
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
{
int yybot = *yybottom;
YYFPRINTF (stderr, " %d", yybot);
}
YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
static void
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
{
unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
&(yyvsp[(yyi + 1) - (yynrhs)])
);
YYFPRINTF (stderr, "\n");
}
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (yyssp, yyvsp, Rule); \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
#if YYERROR_VERBOSE
# ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
static YYSIZE_T
yystrlen (const char *yystr)
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
continue;
return yylen;
}
# endif
# endif
# ifndef yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
static char *
yystpcpy (char *yydest, const char *yysrc)
{
char *yyd = yydest;
const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
# endif
# endif
# ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
quotes and backslashes, so that it's suitable for yyerror. The
heuristic is that double-quoting is unnecessary unless the string
contains an apostrophe, a comma, or backslash (other than
backslash-backslash). YYSTR is taken from yytname. If YYRES is
null, do not copy; instead, return the length of what the result
would have been. */
static YYSIZE_T
yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
YYSIZE_T yyn = 0;
char const *yyp = yystr;
for (;;)
switch (*++yyp)
{
case '\'':
case ',':
goto do_not_strip_quotes;
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
/* Fall through. */
default:
if (yyres)
yyres[yyn] = *yyp;
yyn++;
break;
case '"':
if (yyres)
yyres[yyn] = '\0';
return yyn;
}
do_not_strip_quotes: ;
}
if (! yyres)
return yystrlen (yystr);
return yystpcpy (yyres, yystr) - yyres;
}
# endif
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
about the unexpected token YYTOKEN for the state stack whose top is
YYSSP.
Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
not large enough to hold the message. In that case, also set
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
required number of bytes is too large to store. */
static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
break;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
}
#endif /* YYERROR_VERBOSE */
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
{
YYUSE (yyvaluep);
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YYUSE (yytype);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
/* The lookahead symbol. */
int yychar;
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
/* Number of syntax errors so far. */
int yynerrs;
/*----------.
| yyparse. |
`----------*/
int
yyparse (void)
{
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* The stacks and their tools:
'yyss': related to states.
'yyvs': related to semantic values.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss;
yytype_int16 *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
YYSIZE_T yystacksize;
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
int yytoken = 0;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
yyssp = yyss = yyssa;
yyvsp = yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate. |
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
yysetstate:
*yyssp = yystate;
if (yyss + yystacksize - 1 <= yyssp)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
yyss = yyss1;
yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
goto yyexhaustedlab;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
{
yytype_int16 *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
if (yystate == YYFINAL)
YYACCEPT;
goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = yylex ();
}
if (yychar <= YYEOF)
{
yychar = yytoken = YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
yytoken = YYTRANSLATE (yychar);
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
}
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
yyn += yytoken;
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
{
if (yytable_value_is_error (yyn))
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
/* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
/* Discard the shifted token. */
yychar = YYEMPTY;
yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
goto yynewstate;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
'$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 2:
#line 65 "decaf.y" /* yacc.c:1646 */
{
tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("Program", a, 1);
tabCount = 0;
printtree((yyval.NTnode));}
#line 1561 "y.tab.c" /* yacc.c:1646 */
break;
case 3:
#line 71 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1568 "y.tab.c" /* yacc.c:1646 */
break;
case 4:
#line 73 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1575 "y.tab.c" /* yacc.c:1646 */
break;
case 5:
#line 75 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1582 "y.tab.c" /* yacc.c:1646 */
break;
case 6:
#line 77 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1589 "y.tab.c" /* yacc.c:1646 */
break;
case 7:
#line 80 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = merge((yyvsp[-1].NTnode), (yyvsp[0].NTnode));}
#line 1595 "y.tab.c" /* yacc.c:1646 */
break;
case 8:
#line 81 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = (yyvsp[0].NTnode);}
#line 1601 "y.tab.c" /* yacc.c:1646 */
break;
case 9:
#line 83 "decaf.y" /* yacc.c:1646 */
{ tnode * a[1] = {(yyvsp[-1].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("VarDef",a, 1);}
#line 1608 "y.tab.c" /* yacc.c:1646 */
break;
case 10:
#line 86 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = merge((yyvsp[-1].NTnode), (yyvsp[0].NTnode));}
#line 1614 "y.tab.c" /* yacc.c:1646 */
break;
case 11:
#line 87 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = emptyNode();}
#line 1620 "y.tab.c" /* yacc.c:1646 */
break;
case 12:
#line 89 "decaf.y" /* yacc.c:1646 */
{
tnode * a[0] = {};
tnode *b[2] = {(yyvsp[-1].NTnode), NewNodeWithLabel((yyvsp[0].name),a , 0)};
(yyval.NTnode) = NewNodeWithLabel("",b, 2);}
#line 1629 "y.tab.c" /* yacc.c:1646 */
break;
case 13:
#line 94 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = merge((yyvsp[-2].NTnode), (yyvsp[0].NTnode));}
#line 1635 "y.tab.c" /* yacc.c:1646 */
break;
case 14:
#line 95 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = (yyvsp[0].NTnode);}
#line 1641 "y.tab.c" /* yacc.c:1646 */
break;
case 15:
#line 97 "decaf.y" /* yacc.c:1646 */
{tnode * a[0] = {}; (yyval.NTnode) = NewNodeWithLabel("DoubleType",a, 0);}
#line 1647 "y.tab.c" /* yacc.c:1646 */
break;
case 16:
#line 98 "decaf.y" /* yacc.c:1646 */
{tnode * a[0] = {}; (yyval.NTnode) = NewNodeWithLabel("IntType",a, 0);}
#line 1653 "y.tab.c" /* yacc.c:1646 */
break;
case 17:
#line 99 "decaf.y" /* yacc.c:1646 */
{tnode * a[0] = {}; (yyval.NTnode) = NewNodeWithLabel("BooleanType",a, 0);}
#line 1659 "y.tab.c" /* yacc.c:1646 */
break;
case 18:
#line 100 "decaf.y" /* yacc.c:1646 */
{tnode * a[0] = {}; (yyval.NTnode) = NewNodeWithLabel("StringType",a, 0);}
#line 1665 "y.tab.c" /* yacc.c:1646 */
break;
case 19:
#line 101 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[-2].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("[]",a, 1);}
#line 1671 "y.tab.c" /* yacc.c:1646 */
break;
case 20:
#line 104 "decaf.y" /* yacc.c:1646 */
{
tnode * a[1] = {(yyvsp[-2].NTnode)};
(yyvsp[-2].NTnode) = NewNodeWithLabel("VarDef", a, 1);
tnode * b[1] = {(yyvsp[0].NTnode)};
(yyvsp[0].NTnode) = NewNodeWithLabel("Body", b, 1);
tnode * c[0] = {};
tnode * d[4] = {(yyvsp[-5].NTnode), NewNodeWithLabel((yyvsp[-4].name),c,0), (yyvsp[-2].NTnode), (yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("FuncDef",d, 4);
}
#line 1685 "y.tab.c" /* yacc.c:1646 */
break;
case 21:
#line 114 "decaf.y" /* yacc.c:1646 */
{
tnode * a[1] = {(yyvsp[-2].NTnode)};
(yyvsp[-2].NTnode) = NewNodeWithLabel("VarDef", a, 1);
tnode * b[1] = {(yyvsp[0].NTnode)};
(yyvsp[0].NTnode) = NewNodeWithLabel("Body", b, 1);
tnode * c[0] = {};
(yyvsp[-5].NTnode) = NewNodeWithLabel("VoidType", c, 0);
tnode * d[4] = {(yyvsp[-5].NTnode), NewNodeWithLabel((yyvsp[-4].name),c,0), (yyvsp[-2].NTnode), (yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("FuncDef",d, 4);
}
#line 1700 "y.tab.c" /* yacc.c:1646 */
break;
case 22:
#line 125 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = (yyvsp[0].NTnode);}
#line 1706 "y.tab.c" /* yacc.c:1646 */
break;
case 23:
#line 126 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = emptyNode();}
#line 1712 "y.tab.c" /* yacc.c:1646 */
break;
case 24:
#line 129 "decaf.y" /* yacc.c:1646 */
{
tnode * a[1] = {(yyvsp[-4].NTnode)};
(yyvsp[-4].NTnode) = NewNodeWithLabel("extends", a, 1);
tnode * b[1] = {(yyvsp[-3].NTnode)};
// $4 = NewNodeWithLabel("implement", b, 1);
tnode * c[0] = {};
tnode * d[4] = {NewNodeWithLabel((yyvsp[-5].name),c, 0), (yyvsp[-4].NTnode), (yyvsp[-3].NTnode), (yyvsp[-1].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("Class",d, 4);
}
#line 1728 "y.tab.c" /* yacc.c:1646 */
break;
case 25:
#line 141 "decaf.y" /* yacc.c:1646 */
{
tnode * c[0] = {};
(yyval.NTnode) = NewNodeWithLabel((yyvsp[0].name),c , 0);}
#line 1736 "y.tab.c" /* yacc.c:1646 */
break;
case 26:
#line 144 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = emptyNode();}
#line 1742 "y.tab.c" /* yacc.c:1646 */
break;
case 27:
#line 146 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = (yyvsp[0].NTnode);}
#line 1748 "y.tab.c" /* yacc.c:1646 */
break;
case 28:
#line 147 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = emptyNode();}
#line 1754 "y.tab.c" /* yacc.c:1646 */
break;
case 29:
#line 149 "decaf.y" /* yacc.c:1646 */
{
tnode * c[0] = {};
(yyval.NTnode) = merge( NewNodeWithLabel((yyvsp[-2].name),c, 0), (yyvsp[0].NTnode));}
#line 1763 "y.tab.c" /* yacc.c:1646 */
break;
case 30:
#line 153 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};
(yyval.NTnode) = NewNodeWithLabel((yyvsp[0].name),c, 0);}
#line 1770 "y.tab.c" /* yacc.c:1646 */
break;
case 31:
#line 156 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1777 "y.tab.c" /* yacc.c:1646 */
break;
case 32:
#line 158 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1784 "y.tab.c" /* yacc.c:1646 */
break;
case 33:
#line 161 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = merge((yyvsp[-1].NTnode), (yyvsp[0].NTnode));}
#line 1790 "y.tab.c" /* yacc.c:1646 */
break;
case 34:
#line 162 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = emptyNode();}
#line 1796 "y.tab.c" /* yacc.c:1646 */
break;
case 35:
#line 164 "decaf.y" /* yacc.c:1646 */
{
tnode * c[0] = {};
tnode * a[2] = {NewNodeWithLabel((yyvsp[-3].name),c, 0), (yyvsp[-1].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("interface", a, 2);}
#line 1805 "y.tab.c" /* yacc.c:1646 */
break;
case 36:
#line 169 "decaf.y" /* yacc.c:1646 */
{
tnode * c[0] = {};
tnode * a[1] = {(yyvsp[-2].NTnode)};
(yyvsp[-2].NTnode) = NewNodeWithLabel("VarDef", a, 1);
tnode * b[3] = {(yyvsp[-5].NTnode), NewNodeWithLabel((yyvsp[-4].name),c, 0), (yyvsp[-2].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("Prototype", b, 3);
}
#line 1817 "y.tab.c" /* yacc.c:1646 */
break;
case 37:
#line 176 "decaf.y" /* yacc.c:1646 */
{
tnode * c[0] = {};
(yyvsp[-5].NTnode) = NewNodeWithLabel("VoidType",c, 0);
tnode * a[1] = {(yyvsp[-2].NTnode)};
(yyvsp[-2].NTnode) = NewNodeWithLabel("VarDef", a, 1);
tnode * b[3] = {(yyvsp[-5].NTnode), NewNodeWithLabel((yyvsp[-4].name),c, 0), (yyvsp[-2].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("Prototype", b, 3);
}
#line 1830 "y.tab.c" /* yacc.c:1646 */
break;
case 38:
#line 185 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = merge((yyvsp[-1].NTnode), (yyvsp[0].NTnode));}
#line 1836 "y.tab.c" /* yacc.c:1646 */
break;
case 39:
#line 186 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = emptyNode();}
#line 1842 "y.tab.c" /* yacc.c:1646 */
break;
case 40:
#line 188 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[-1].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("StmtBlock",c, 2);
}
#line 1850 "y.tab.c" /* yacc.c:1646 */
break;
case 41:
#line 192 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[-1].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1857 "y.tab.c" /* yacc.c:1646 */
break;
case 42:
#line 194 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1864 "y.tab.c" /* yacc.c:1646 */
break;
case 43:
#line 196 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1871 "y.tab.c" /* yacc.c:1646 */
break;
case 44:
#line 198 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1878 "y.tab.c" /* yacc.c:1646 */
break;
case 45:
#line 200 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1885 "y.tab.c" /* yacc.c:1646 */
break;
case 46:
#line 202 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1892 "y.tab.c" /* yacc.c:1646 */
break;
case 47:
#line 204 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1899 "y.tab.c" /* yacc.c:1646 */
break;
case 48:
#line 206 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1906 "y.tab.c" /* yacc.c:1646 */
break;
case 49:
#line 209 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = merge((yyvsp[-1].NTnode), (yyvsp[0].NTnode));}
#line 1912 "y.tab.c" /* yacc.c:1646 */
break;
case 50:
#line 210 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = emptyNode();}
#line 1918 "y.tab.c" /* yacc.c:1646 */
break;
case 51:
#line 212 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)};(yyval.NTnode) = NewNodeWithLabel("If", c, 2);}
#line 1924 "y.tab.c" /* yacc.c:1646 */
break;
case 52:
#line 213 "decaf.y" /* yacc.c:1646 */
{
tnode * c[1] = {(yyvsp[0].NTnode)};
(yyvsp[0].NTnode) = NewNodeWithLabel("Else", c, 1);
tnode * a[3] = {(yyvsp[-4].NTnode), (yyvsp[-2].NTnode), (yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("If", a, 3);}
#line 1934 "y.tab.c" /* yacc.c:1646 */
break;
case 53:
#line 219 "decaf.y" /* yacc.c:1646 */
{
tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("while", c, 2);
}
#line 1943 "y.tab.c" /* yacc.c:1646 */
break;
case 54:
#line 225 "decaf.y" /* yacc.c:1646 */
{
tnode * c[4] = {(yyvsp[-6].NTnode), (yyvsp[-4].NTnode), (yyvsp[-2].NTnode), (yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("for", c, 4);}
#line 1951 "y.tab.c" /* yacc.c:1646 */
break;
case 55:
#line 229 "decaf.y" /* yacc.c:1646 */
{tnode * c[1] = {(yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("return", c, 1);}
#line 1957 "y.tab.c" /* yacc.c:1646 */
break;
case 56:
#line 231 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {}; (yyval.NTnode) = NewNodeWithLabel("break", c, 0);}
#line 1963 "y.tab.c" /* yacc.c:1646 */
break;
case 57:
#line 233 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {}; (yyval.NTnode) = NewNodeWithLabel("print", c, 0);}
#line 1969 "y.tab.c" /* yacc.c:1646 */
break;
case 58:
#line 235 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("assign", c, 2);}
#line 1975 "y.tab.c" /* yacc.c:1646 */
break;
case 59:
#line 236 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1982 "y.tab.c" /* yacc.c:1646 */
break;
case 60:
#line 238 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 1989 "y.tab.c" /* yacc.c:1646 */
break;
case 61:
#line 240 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};(yyval.NTnode) = NewNodeWithLabel("this", c,0);}
#line 1995 "y.tab.c" /* yacc.c:1646 */
break;
case 62:
#line 241 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[0].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 2002 "y.tab.c" /* yacc.c:1646 */
break;
case 63:
#line 243 "decaf.y" /* yacc.c:1646 */
{tnode * a[1] = {(yyvsp[-1].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("",a, 1);}
#line 2009 "y.tab.c" /* yacc.c:1646 */
break;
case 64:
#line 245 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("+", c, 2);}
#line 2015 "y.tab.c" /* yacc.c:1646 */
break;
case 65:
#line 246 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("-", c, 2);}
#line 2021 "y.tab.c" /* yacc.c:1646 */
break;
case 66:
#line 247 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("*", c, 2);}
#line 2027 "y.tab.c" /* yacc.c:1646 */
break;
case 67:
#line 248 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("/", c, 2);}
#line 2033 "y.tab.c" /* yacc.c:1646 */
break;
case 68:
#line 249 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("%", c, 2);}
#line 2039 "y.tab.c" /* yacc.c:1646 */
break;
case 69:
#line 250 "decaf.y" /* yacc.c:1646 */
{tnode * c[1] = {(yyvsp[0].NTnode)};(yyval.NTnode) = NewNodeWithLabel("-",c, 1);}
#line 2045 "y.tab.c" /* yacc.c:1646 */
break;
case 70:
#line 251 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("<", c, 2);}
#line 2051 "y.tab.c" /* yacc.c:1646 */
break;
case 71:
#line 252 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("<=", c, 2);}
#line 2057 "y.tab.c" /* yacc.c:1646 */
break;
case 72:
#line 253 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel(">=", c, 2);}
#line 2063 "y.tab.c" /* yacc.c:1646 */
break;
case 73:
#line 254 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel(">", c, 2);}
#line 2069 "y.tab.c" /* yacc.c:1646 */
break;
case 74:
#line 255 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("==", c, 2);}
#line 2075 "y.tab.c" /* yacc.c:1646 */
break;
case 75:
#line 256 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("!=", c, 2);}
#line 2081 "y.tab.c" /* yacc.c:1646 */
break;
case 76:
#line 257 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("&&", c, 2);}
#line 2087 "y.tab.c" /* yacc.c:1646 */
break;
case 77:
#line 258 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-2].NTnode), (yyvsp[0].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("||", c, 2);}
#line 2093 "y.tab.c" /* yacc.c:1646 */
break;
case 78:
#line 259 "decaf.y" /* yacc.c:1646 */
{tnode * c[1] = {(yyvsp[0].NTnode)};(yyval.NTnode) = NewNodeWithLabel("!",c, 1);}
#line 2099 "y.tab.c" /* yacc.c:1646 */
break;
case 79:
#line 260 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};(yyval.NTnode) = NewNodeWithLabel("ReadInteger", c, 0);}
#line 2105 "y.tab.c" /* yacc.c:1646 */
break;
case 80:
#line 261 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};(yyval.NTnode) = NewNodeWithLabel("ReadLine", c, 0);}
#line 2111 "y.tab.c" /* yacc.c:1646 */
break;
case 81:
#line 262 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};
tnode * d[1] = {NewNodeWithLabel((yyvsp[-1].name), c, 0)};
(yyval.NTnode) = NewNodeWithLabel("New",c, 1);}
#line 2119 "y.tab.c" /* yacc.c:1646 */
break;
case 82:
#line 265 "decaf.y" /* yacc.c:1646 */
{tnode * c[2] = {(yyvsp[-3].NTnode), (yyvsp[-1].NTnode)}; (yyval.NTnode) = NewNodeWithLabel("NewArray", c, 2);}
#line 2125 "y.tab.c" /* yacc.c:1646 */
break;
case 83:
#line 267 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = merge((yyvsp[-2].NTnode), (yyvsp[0].NTnode));}
#line 2131 "y.tab.c" /* yacc.c:1646 */
break;
case 84:
#line 268 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = (yyvsp[0].NTnode);}
#line 2137 "y.tab.c" /* yacc.c:1646 */
break;
case 85:
#line 270 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = (yyvsp[0].NTnode);}
#line 2143 "y.tab.c" /* yacc.c:1646 */
break;
case 86:
#line 271 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = emptyNode();}
#line 2149 "y.tab.c" /* yacc.c:1646 */
break;
case 87:
#line 273 "decaf.y" /* yacc.c:1646 */
{
tnode * c[0] = {};
tnode * d[1] = {NewNodeWithLabel((yyvsp[0].name), c, 0)};
(yyval.NTnode) = NewNodeWithLabel("LValue", d, 1);
}
#line 2159 "y.tab.c" /* yacc.c:1646 */
break;
case 88:
#line 278 "decaf.y" /* yacc.c:1646 */
{
tnode * c[0] = {};
tnode * d[2] = {(yyvsp[-2].NTnode), NewNodeWithLabel((yyvsp[0].name), c, 0)};
(yyval.NTnode) = NewNodeWithLabel("LValue",d,2);}
#line 2168 "y.tab.c" /* yacc.c:1646 */
break;
case 89:
#line 282 "decaf.y" /* yacc.c:1646 */
{
tnode * c[2] = {(yyvsp[-3].NTnode), (yyvsp[-1].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("LValue",c,2);
}
#line 2177 "y.tab.c" /* yacc.c:1646 */
break;
case 90:
#line 287 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};
tnode * d[2] = {NewNodeWithLabel((yyvsp[-3].name), c, 0), (yyvsp[-1].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("Call", d, 2);}
#line 2185 "y.tab.c" /* yacc.c:1646 */
break;
case 91:
#line 290 "decaf.y" /* yacc.c:1646 */
{
tnode * c[0] = {};
tnode * d[3] = {(yyvsp[-5].NTnode), NewNodeWithLabel((yyvsp[-3].name), c, 0), (yyvsp[-1].NTnode)};
(yyval.NTnode) = NewNodeWithLabel("Call", d, 3);}
#line 2194 "y.tab.c" /* yacc.c:1646 */
break;
case 92:
#line 294 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = (yyvsp[0].NTnode);}
#line 2200 "y.tab.c" /* yacc.c:1646 */
break;
case 93:
#line 295 "decaf.y" /* yacc.c:1646 */
{(yyval.NTnode) = emptyNode();}
#line 2206 "y.tab.c" /* yacc.c:1646 */
break;
case 94:
#line 297 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};(yyval.NTnode) = NewNodeWithLabel("IntConstant", c, 0);}
#line 2212 "y.tab.c" /* yacc.c:1646 */
break;
case 95:
#line 298 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};(yyval.NTnode) = NewNodeWithLabel("DoubleConstant", c, 0);}
#line 2218 "y.tab.c" /* yacc.c:1646 */
break;
case 96:
#line 299 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};(yyval.NTnode) = NewNodeWithLabel("BoolConstant", c, 0);}
#line 2224 "y.tab.c" /* yacc.c:1646 */
break;
case 97:
#line 300 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};(yyval.NTnode) = NewNodeWithLabel("StringConstant", c, 0);}
#line 2230 "y.tab.c" /* yacc.c:1646 */
break;
case 98:
#line 301 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};(yyval.NTnode) = NewNodeWithLabel("CharConstant", c, 0);}
#line 2236 "y.tab.c" /* yacc.c:1646 */
break;
case 99:
#line 302 "decaf.y" /* yacc.c:1646 */
{tnode * c[0] = {};(yyval.NTnode) = NewNodeWithLabel("NullConstant", c, 0);}
#line 2242 "y.tab.c" /* yacc.c:1646 */
break;
#line 2246 "y.tab.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
that yytoken be updated with the new translation. We take the
approach of translating immediately before every use of yytoken.
One alternative is translating here after every semantic action,
but that translation would be missed if the semantic action invokes
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
incorrect destructor might then be invoked immediately. In the
case of YYERROR or YYBACKUP, subsequent parser actions might lead
to an incorrect destructor call or verbose syntax error message
before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
/* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTOKENS];
goto yynewstate;
/*--------------------------------------.
| yyerrlab -- here on detecting error. |
`--------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#if ! YYERROR_VERBOSE
yyerror (YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
{
char const *yymsgp = YY_("syntax error");
int yysyntax_error_status;
yysyntax_error_status = YYSYNTAX_ERROR;
if (yysyntax_error_status == 0)
yymsgp = yymsg;
else if (yysyntax_error_status == 1)
{
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
if (!yymsg)
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
yysyntax_error_status = 2;
}
else
{
yysyntax_error_status = YYSYNTAX_ERROR;
yymsgp = yymsg;
}
}
yyerror (yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
}
# undef YYSYNTAX_ERROR
#endif
}
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
{
/* Return failure if at end of input. */
if (yychar == YYEOF)
YYABORT;
}
else
{
yydestruct ("Error: discarding",
yytoken, &yylval);
yychar = YYEMPTY;
}
}
/* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
/* Pacify compilers like GCC when the user code never invokes
YYERROR and the label yyerrorlab therefore never appears in user
code. */
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
yystate = *yyssp;
goto yyerrlab1;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
YYABORT;
yydestruct ("Error: popping",
yystos[yystate], yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
yyexhaustedlab:
yyerror (YY_("memory exhausted"));
yyresult = 2;
/* Fall through. */
#endif
yyreturn:
if (yychar != YYEMPTY)
{
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = YYTRANSLATE (yychar);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
}
/* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
return yyresult;
}
#line 304 "decaf.y" /* yacc.c:1906 */
struct tnode ** push(int size, struct tnode ** childs, struct tnode * child){
struct tnode ** newchilds = (struct tnode **)malloc(sizeof(tnode *) * (size + 1));
for(int i = 0; i < size; i++){
newchilds[i] = childs[i];
}
newchilds[size] = child;
return newchilds;
}
tnode * ProgramNode(char *token, tnode *child){
child->token = token;
return child;
}
tnode * merge(tnode *child, tnode *addchild){
//printf("%s, %s", child->token, addchild->token);
for(int i = 0; i < addchild->size; i++){
child->childs = push(child->size ,child->childs, addchild->childs[i]);
child->size++;
}
return child;
}
tnode * NewNodeWithLabel(char *token,tnode ** arr, int size){
tnode *newnode = (tnode *)malloc(sizeof(tnode));
newnode->size = 0;
char *newstr = (char *)malloc(strlen(token)+1);
strcpy(newstr, token);
newnode->token = newstr;
for(int i = 0; i < size; i++){
newnode->childs = push(newnode->size,newnode->childs, arr[i]);
newnode->size++;
}
return(newnode);
}
tnode * emptyNode(){
char token[2] = "";
tnode *newnode = (tnode *)malloc(sizeof(tnode));
char *newstr = (char *)malloc(strlen(token)+1);
strcpy(newstr, token);
newnode->token = newstr;
newnode->size = 0;
return(newnode);
}
void printtree(tnode *tree){
tabCount++;
if(strcmp(tree->token, "")){
for(int j = 0; j < tabCount - 1; j++){
printf("\t");
}
printf("%s\n", tree->token);
}else{
tabCount--;
}
for(int i = 0; i < tree->size; i++){
if (tree->childs[i]){
printtree(tree->childs[i]);
}
}
if(strcmp(tree->token, "")){
//printf(")");
}else{
tabCount++;
}
tabCount--;
}
/*void printtree(tnode *tree){
printf("%d %s\n", tree->size,tree->token);
if(strcmp(tree->token, "")){
for(int j = 0; j < tabCount - 1; j++){
//printf("\t");
}
}
for(int i = 0; i < tree->size; i++){
if (tree->childs[i]){
printtree(tree->childs[i]);
}
}
if(strcmp(tree->token, "")){
//printf(")");
}
tabCount--;
}
*/
|
the_stack_data/90764683.c | #include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define STORAGE_ID1 "/SHM_USER1"
#define STORAGE_ID2 "/SHM_USER2"
#define STORAGE_SIZE 32
int main(int argc, char *argv[])
{
char message1[STORAGE_SIZE];
char message2[STORAGE_SIZE];
int fd1 = shm_open(STORAGE_ID1, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
int fd2 = shm_open(STORAGE_ID2, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
if ((fd1 == -1) || (fd2 == -1))
{
perror("open");
return 10;
}
// extend shared memory object as by default it's initialized with size 0
int res1 = ftruncate(fd1, STORAGE_SIZE);
if (res1 == -1)
{
perror("ftruncate");
return 20;
}
// map shared memory to process address space
void *addr1 = mmap(NULL, STORAGE_SIZE, PROT_WRITE, MAP_SHARED, fd1, 0);
void *addr2 = mmap(NULL, STORAGE_SIZE, PROT_WRITE, MAP_SHARED, fd2, 0);
if ((addr1 == MAP_FAILED) || (addr2 == MAP_FAILED))
{
perror("mmap");
return 30;
}
while (1)
{
// WRITE
printf("USER 1: ");
fgets(message1, STORAGE_SIZE, stdin);
int len = strlen(message1) + 1;
memcpy(addr1, message1, len);
// READ
printf("USER 2 (enter to get the message):"); getchar();
memcpy(message2, addr2, STORAGE_SIZE);
printf("%s\n", message2);
}
return 0;
}
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.