Beispiel #1
0
static void get_gw_data(char *username, char *device, JsonNode *last)
{
	JsonNode *array;
	static char *types[] = { "batt", "ext", "status", NULL };
	char **t, *js;
	static UT_string *ts = NULL, *u = NULL, *d = NULL;

	if (last == NULL || last->tag != JSON_OBJECT)
		return;


	for (t = types; t && *t; t++) {
		utstring_renew(u);
		utstring_renew(d);
		utstring_printf(u, "%s", username);
		utstring_printf(d, "%s", device);
		lowercase(UB(u));
		lowercase(UB(d));
		utstring_renew(ts);
		utstring_printf(ts, "%s/last/%s/%s/%s.json",
					STORAGEDIR,
					UB(u),
					UB(d),
					*t);

		/* Read file into JSON array and append to `last' object */
		if ((js = slurp_file(UB(ts), TRUE)) != NULL) {
			if ((array = json_decode(js)) != NULL) {
				json_append_member(last, *t, array);
			}
			free(js);
		}
	}
}
Beispiel #2
0
JsonNode *lister(char *user, char *device, time_t s_lo, time_t s_hi, int reverse)
{
	JsonNode *json = json_mkobject();
	UT_string *path = NULL;
	char *bp;

	utstring_renew(path);

	for (bp = user; bp && *bp; bp++) {
		if (isupper(*bp))
			*bp = tolower(*bp);
	}
	for (bp = device; bp && *bp; bp++) {
		if (isupper(*bp))
			*bp = tolower(*bp);
	}

	if (!user && !device) {
		utstring_printf(path, "%s/rec", STORAGEDIR);
		ls(UB(path), json);
	} else if (!device) {
		utstring_printf(path, "%s/rec/%s", STORAGEDIR, user);
		ls(UB(path), json);
	} else {
		utstring_printf(path, "%s/rec/%s/%s",
			STORAGEDIR, user, device);
		lsscan(UB(path), s_lo, s_hi, json, reverse);
	}

	return (json);
}
Beispiel #3
0
FILE *pathn(char *mode, char *prefix, UT_string *user, UT_string *device, char *suffix)
{
        static UT_string *path = NULL;
	time_t now;

        utstring_renew(path);

        ut_lower(user);

	if (device) {
		ut_lower(device);
		utstring_printf(path, "%s/%s/%s/%s", STORAGEDIR, prefix, UB(user), UB(device));
	} else {
		utstring_printf(path, "%s/%s/%s", STORAGEDIR, prefix, UB(user));
	}

        ut_clean(path);

        if (mkpath(UB(path)) < 0) {
                olog(LOG_ERR, "Cannot create directory at %s: %m", UB(path));
                return (NULL);
        }


#if 0
	if (device) {
		utstring_printf(path, "/%s-%s.%s",
			UB(user), UB(device), suffix);
	} else {
		utstring_printf(path, "/%s.%s",
			UB(user), suffix);
	}
#endif

	if (strcmp(prefix, "rec") == 0) {
		time(&now);
		utstring_printf(path, "/%s.%s", yyyymm(now), suffix);
	} else {
		utstring_printf(path, "/%s.%s",
			UB(user), suffix);
	}

        ut_clean(path);

        return (fopen(UB(path), mode));

}
Beispiel #4
0
static void ut_clean(UT_string *us)
{
        char *p;

        for (p = UB(us); p && *p; p++) {
                if (isspace(*p))
                        *p = '-';
        }
}
Beispiel #5
0
static void ut_lower(UT_string *us)
{
        char *p;

        for (p = UB(us); p && *p; p++) {
                if (!isalnum(*p) || isspace(*p))
                        *p = '-';
                else if (isupper(*p))
                        *p = tolower(*p);

        }
}
Beispiel #6
0
static void lsscan(char *pathpat, time_t s_lo, time_t s_hi, JsonNode *obj, int reverse)
{
	struct dirent **namelist;
	int i, n;
	JsonNode *jarr = json_mkarray();
	static UT_string *path = NULL;

	if (obj == NULL || obj->tag != JSON_OBJECT)
		return;

	utstring_renew(path);

	/* Set global t_ values */
	t_lo = s_lo;
	t_hi = s_hi;

	if ((n = scandir(pathpat, &namelist, filter_filename, cmp)) < 0) {
		json_append_member(obj, "error", json_mkstring("Cannot lsscan requested directory"));
                return;
	}

	if (reverse) {
		for (i = n - 1; i >= 0; i--) {
			utstring_clear(path);
			utstring_printf(path, "%s/%s", pathpat, namelist[i]->d_name);
			json_append_element(jarr, json_mkstring(UB(path)));
			free(namelist[i]);
		}
	} else {
		for (i = 0; i < n; i++) {
			utstring_clear(path);
			utstring_printf(path, "%s/%s", pathpat, namelist[i]->d_name);
			json_append_element(jarr, json_mkstring(UB(path)));
			free(namelist[i]);
		}
	}
	free(namelist);

	json_append_member(obj, "results", jarr);
}
Beispiel #7
0
void monitorhook(struct udata *userdata, time_t now, char *topic)
{
	// struct udata *ud = (struct udata *)userdata;

	/* TODO: add monitor hook to a "monitor" key in LMDB ? */

	char mpath[BUFSIZ];
	static UT_string *us = NULL;

	utstring_renew(us);
	utstring_printf(us, "%ld %s\n", now, topic);

	snprintf(mpath, sizeof(mpath), "%s/monitor", STORAGEDIR);
	safewrite(mpath, UB(us));
}
Beispiel #8
0
void olog(int level, char *fmt, ...)
{
	va_list ap;
	static UT_string *u = NULL;

	va_start(ap, fmt);
	utstring_renew(u);

	utstring_printf_va(u, fmt, ap);

	// fprintf(stderr, "+++++ [%s]\n", UB(u));
	syslog(level, "%s", UB(u));

	va_end(ap);
}
Beispiel #9
0
char *bindump(char *buf, long buflen)
{
	static UT_string *out = NULL;
	int i, ch;

	utstring_renew(out);

	for (i = 0; i < buflen; i++) {
		ch = buf[i];
		if (isprint(ch)) {
			utstring_printf(out, "%c", ch);
		} else {
			utstring_printf(out, " %02X ", ch & 0xFF);
		}
	}
	return (UB(out));
}
Beispiel #10
0
void debug(struct udata *ud, char *fmt, ...)
{
	va_list ap;
	static UT_string *u = NULL;

	if (ud->debug == FALSE)
		return;

	va_start(ap, fmt);
	utstring_renew(u);

	utstring_printf_va(u, fmt, ap);

	fprintf(stderr, "+++++ [%s]\n", UB(u));

	va_end(ap);
}
Beispiel #11
0
static uint16 DB(t_value arg) 
{
  return UB(arg);
}
Beispiel #12
0
double SVM::train()
{
	Array X(input, nInstances, nVars);
	Array y(response, nInstances);
	Array K;
	
	if(opt->kernel == SVM_RBF)
	{
		K = kernelRBF(X, X, opt->sigma);
	}
	else if(opt->kernel == SVM_LINEAR)
	{
		K = kernelLinear(X, X);
	}
	else{
		exit(-1);
	}
	
	// K must be a symmetric matrix
	assert(K.rows == K.cols);
	
	double *_K = K.getData();

	Array A(K.rows, K.cols);
	double *_A = A.getData();
	double *_y = y.getData();
	
	int step = A.cols;
	for(int i = 0;i < K.rows; i++)
	{
		for(int j = 0;j < K.cols;j++)
			_A[i * step + j] = _y[i] * _y[j] * _K[i * step + j];
	}	
	
	Array LB(nInstances);
	Array UB(nInstances);
	
	double *_LB = LB.getData();
	double *_UB = UB.getData();
	
	for(int i = 0;i < UB.size;i++)
		_UB[i] = opt->C;
		
	for(int i = 0;i < LB.size;i++)
		_LB[i] = 0;

	Array x(nInstances);
	x.setZeros();
	
#ifdef DEBUG
	opt->minconf_opt.verbose = 3;
#endif

	minConf_TMP trainer(x, LB, UB, &(opt->minconf_opt));
	trainer.loadData(nInstances, nInstances, _A, _y);
	trainer.process();
	
	trainErr = getTrainErr(x, y, K);
	
	alpha = x.getData();
	
	// Release memory.
	A.release();
	K.release();
	LB.release();
	UB.release();
	
	return trainErr;
}
  /** Execute the algorithm.
   */
  void FindUBUsingIndexedPeaks::exec()
  {
    PeaksWorkspace_sptr ws;
    ws = boost::dynamic_pointer_cast<PeaksWorkspace>(
         AnalysisDataService::Instance().retrieve(this->getProperty("PeaksWorkspace")) );

    if (!ws)
    {
      throw std::runtime_error("Could not read the peaks workspace");
    }

    std::vector<Peak> peaks = ws->getPeaks();
    size_t n_peaks = ws->getNumberPeaks();

    std::vector<V3D>  q_vectors;
    std::vector<V3D>  hkl_vectors;

    q_vectors.reserve( n_peaks );
    hkl_vectors.reserve( n_peaks );

    size_t indexed_count = 0;
    for ( size_t i = 0; i < n_peaks; i++ )
    {
      V3D hkl( peaks[i].getH(), peaks[i].getK(), peaks[i].getL() );    // ##### KEEP
      if ( IndexingUtils::ValidIndex( hkl, 1.0 ) )    // use tolerance == 1 to 
                                                      // just check for (0,0,0) 
      {
        q_vectors.push_back( peaks[i].getQSampleFrame() );
        V3D miller_ind( round(hkl[0]), round(hkl[1]), round(hkl[2]) );
        hkl_vectors.push_back( V3D(miller_ind) );
        indexed_count++;
      }
    }

    if ( indexed_count < 3 ) 
    { 
      throw std::runtime_error(
            "At least three linearly independent indexed peaks are needed.");
    }

    Matrix<double> UB(3,3,false);
    double error = IndexingUtils::Optimize_UB( UB, hkl_vectors, q_vectors );

    std::cout << "Error = " << error << std::endl;
    std::cout << "UB = " << UB << std::endl;

    if ( ! IndexingUtils::CheckUB( UB ) ) // UB not found correctly
    {
      g_log.notice( std::string(
         "Found Invalid UB...peaks used might not be linearly independent") );
      g_log.notice( std::string(
         "UB NOT SAVED.") );
    }
    else                                 // tell user how many would be indexed
    {                                    // from the full list of peaks, and  
      q_vectors.clear();                 // save the UB in the sample
      q_vectors.reserve( n_peaks );
      for ( size_t i = 0; i < n_peaks; i++ )
      {
        q_vectors.push_back( peaks[i].getQSampleFrame() );
      }
      double tolerance = 0.1;
      int num_indexed = IndexingUtils::NumberIndexed(UB, q_vectors, tolerance);

      char logInfo[200];
      sprintf( logInfo,
               std::string("New UB will index %1d Peaks out of %1d with tolerance %5.3f").c_str(),
               num_indexed, n_peaks, tolerance);
      g_log.notice( std::string(logInfo) );

      OrientedLattice o_lattice;
      o_lattice.setUB( UB );
      double calc_a = o_lattice.a();
      double calc_b = o_lattice.b();
      double calc_c = o_lattice.c();
      double calc_alpha = o_lattice.alpha();
      double calc_beta  = o_lattice.beta();
      double calc_gamma = o_lattice.gamma();
                                       // Show the modified lattice parameters
      sprintf( logInfo, 
               std::string("Lattice Parameters: %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f").c_str(),
               calc_a, calc_b, calc_c, calc_alpha, calc_beta, calc_gamma);
      g_log.notice( std::string(logInfo) );

      ws->mutableSample().setOrientedLattice( new OrientedLattice(o_lattice) );
    }
  }
Beispiel #14
0
STATIC IPTR _OM_SET(Class *cl, Object *o,struct opSet *msg)
{
    IPTR retval = (IPTR)0;

    const struct TagItem *tag, *tstate;
    struct LVData *data;

    EnterFunc(bug("ListView::OM_SET\n"));

    data = INST_DATA(cl, o);
    tstate = msg->ops_AttrList;

    /* Set to 1 to signal visual changes */
    while ((tag = NextTagItem(&tstate)) != NULL)
    {
	switch (tag->ti_Tag)
	{
	    case AROSA_Listview_DisplayHook:
		data->lvd_DisplayHook = (struct Hook *)tag->ti_Data;
		retval = 1UL;
		break;

	    case AROSA_Listview_FrontPen:
		data->lvd_FrontPen = (UBYTE)tag->ti_Data;
		retval = 1UL;
		break;

	    case AROSA_Listview_BackPen:
		data->lvd_BackPen = (UBYTE)tag->ti_Data;
		retval = 1UL;
		break;


	    case AROSA_Listview_Visible:
	    case AROSA_Listview_Total:
	    {
		struct TagItem tags[] =
		{
		    {tag->ti_Tag,	tag->ti_Data},
		    {TAG_END}
		};

		NotifyAttrs(cl, o, msg, tags);
	    } break;

	    case AROSA_Listview_List:
	    {

		ULONG numentries;

		struct TagItem tags[] =
		{
		    {AROSA_Listview_First,	0},
		    {AROSA_Listview_Total,	0},
		    {TAG_END}
		};

		data->lvd_List = (Object *)tag->ti_Data;

		GetAttr(AROSA_List_Entries, data->lvd_List, (IPTR *)&numentries);
		SetAttrs(data->lvd_List,
			AROSA_List_Active, AROSV_List_Active_None,
			TAG_END);

		tags[1].ti_Data = numentries;
		DoMethod(o, OM_SET, (IPTR) tags, (IPTR) msg->ops_GInfo);

		retval = 1UL;
	    } break;


	    case AROSA_Listview_HorSpacing:
		data->lvd_HorSpacing = (UBYTE)tag->ti_Data;
		retval = 1UL;
		break;

	    case AROSA_Listview_VertSpacing:
		data->lvd_VertSpacing = (UBYTE)tag->ti_Data;

		ReCalcEntryHeight(data);
		retval = 1UL;
		break;

	    case AROSA_Listview_Format:
	    {
		struct ColumnAttrs *colattrs = data->lvd_ColAttrs;
		ULONG colattrsz = UB(&colattrs[data->lvd_MaxColumns]) - UB(&colattrs[0]);

		memset(colattrs, 0, colattrsz);
		ParseFormatString((STRPTR)tag->ti_Data, data);
		retval = 1UL;
	    } break;

	    case AROSA_Listview_First:
	    {
		struct TagItem tags[] =
		{
		    {AROSA_Listview_First, tag->ti_Data},
		    {TAG_END}
		};

		LONG old = data->lvd_First;

#if DEBUG
		if (msg->MethodID == OM_SET)
                {
			D(bug("_First OM_SET\n"));
		} else
                {
			D(bug("_First OM_UPDATEd, lvd_NC=%d\n",
				data->lvd_NotifyCount));
                }
#endif

		retval = 1UL;
		data->lvd_First = (LONG)tag->ti_Data;

		if (    ( msg->MethodID == OM_UPDATE )
		     && ( old  != data->lvd_First ))
		{
		    struct RastPort *rp;
		    WORD steps;
		    UWORD visible, abs_steps;
		    struct IBox box;

		    steps = tag->ti_Data - old;
		    abs_steps = steps < 0 ? -steps : steps;

		    GetGadgetIBox(o, msg->ops_GInfo, &box);
		    visible = NumVisible(&box, data->lvd_EntryHeight);

		    if (abs_steps < visible >> 1)
		    {
			if ((rp = ObtainGIRPort(msg->ops_GInfo)) != NULL)
			{
			    LONG dy;
			    /* We make the assumption that the listview
			    ** is alvays 'full'. If it isn't, the
			    ** Scroll gadget won't be scrollable, and
			    ** we won't receive any OM_UPDATEs.
			    */

			    dy = steps * data->lvd_EntryHeight;


			    ScrollRaster(rp, 0, dy,
				box.Left + LV_BORDERWIDTH_X,
				box.Top  + LV_BORDERWIDTH_Y,
				box.Left + box.Width  - 1 - LV_BORDERWIDTH_X,
				box.Top  + LV_BORDERWIDTH_Y + visible * data->lvd_EntryHeight);

			    data->lvd_DamageOffset = ((steps > 0) ?
					visible - abs_steps : 0);

			    data->lvd_NumDamaged = abs_steps;

			    DoMethod(o, GM_RENDER, (IPTR) msg->ops_GInfo, (IPTR) rp, GREDRAW_UPDATE);
			    ReleaseGIRPort(rp);
			    retval = 0UL;



			} /* if (ObtainGIRPort succeed) */

		    } /* if (at most half the visible entries scrolled out) */

		} /* if (msg is of type OM_UPDATE) */


		/* Notify change */
		NotifyAttrs(cl, o, msg, tags);

	    } break;

	    case AROSA_Listview_RenderHook:
		data->lvd_RenderHook = (struct Hook *)data->lvd_RenderHook;
		retval = 1UL;
		break;

	    case AROSA_Listview_MultiSelect:
		SETFLAG(data->lvd_Flags, tag->ti_Data, LVFLG_MULTISELECT);
		break;

	    case GA_TextAttr:
	    {
		struct TextFont *tf;

		tf = OpenFont((struct TextAttr *)tag->ti_Data);
		if (tf)
		{
		    if (data->lvd_Font)
		    {
			CloseFont(data->lvd_Font);
		    }
		    data->lvd_Font = tf;
		}
		ReCalcEntryHeight(data);

	     } break;


	    default:
		break;

	} /* switch (tag->ti_Tag) */

    } /* while (more tags to iterate) */

    ReturnPtr("ListView::OM_SET", IPTR, retval);
}
Beispiel #15
0
bool LatticeCoordinates
( const Matrix<F>& B,
  const Matrix<F>& y,
        Matrix<F>& x ) 
{
    DEBUG_CSE
    typedef Base<F> Real;
    const Int m = B.Height();
    const Int n = B.Width();
    if( y.Height() != m || y.Width() != 1 )
        LogicError("y should have been an ",m," x 1 vector");

    if( FrobeniusNorm(y) == Real(0) )
    {
        Zeros( x, n, 1 );
        return true;
    }
    
    Matrix<F> BRed( B );
    Matrix<F> UB, RB;
    auto infoB = LLL( BRed, UB, RB );
    auto MB = BRed( ALL, IR(0,infoB.rank) );

    Matrix<F> A;
    Zeros( A, m, infoB.rank+1 );
    {
        auto AL = A( ALL, IR(0,infoB.rank) ); 
        auto aR = A( ALL, IR(infoB.rank) );
        AL = MB;
        aR = y;
    }
    // Reduce A in-place
    Matrix<F> UA, RA;
    auto infoA = LLL( A, UA, RA );
    if( infoA.nullity != 1 )
        return false;

    // Solve for x_M such that M_B x_M = y
    // NOTE: The last column of U_A should hold the coordinates of the single
    //       member of the null-space of (the original) A
    Matrix<F> xM;
    xM = UA( IR(0,infoA.rank), IR(infoB.rank) );
    const F gamma = UA(infoA.rank,infoB.rank);
    if( Abs(gamma) != Real(1) )
        LogicError("Invalid member of null space");
    else
        xM *= -Conj(gamma);

    // Map xM back to the original coordinates using the portion of the 
    // unimodular transformation of B (U_B) which produced the image of B 
    auto UBM = UB( ALL, IR(0,infoB.rank) );
    Zeros( x, n, 1 );
    Gemv( NORMAL, F(1), UBM, xM, F(0), x );
    
    /*
    if( infoB.nullity != 0 )
    {
        Matrix<F> C;
        Zeros( C, m, infoB.nullity+1 );
        auto cL = C( ALL, IR(infoB.rank-1) );
        auto CR = C( ALL, IR(infoB.rank,END) );

        // Reduce the kernel of B
        CR = UB( ALL, IR(infoB.rank,END) );
        LLL( CR );

        // Attempt to reduce the (reduced) kernel out of the coordinates
        // TODO: Which column to grab from the result?!?
        cL = x;
        LLL( C );
        x = cL;
    }
    */

    return true;
}
Beispiel #16
0
t_stat fprint_sym_m (FILE *of, t_addr addr, t_value *val,
    UNIT *uptr, int32 sw)
{
  uint16 op, arg1, arg2, arg3;
  int16 sarg;
  t_stat size = 0;
  int optype, sz;
  t_bool hexdec = (sw & SWMASK('H')) ? TRUE : FALSE;
  addr = ADDR_OFF(addr);

  op = val[0];
  if (op > 0xe7) return SCPE_ARG;

  optype = optable[op].flags;
  if (optype > OP_ERROR) {
    fprintf(of,"%-8s", optable[op].name);
    switch (optype) {
    case OP_NULL:
      break;
    case OP_UB:
      size = 1; arg1 = UB(val[1]);
      print_hd(of, arg1, hexdec, FALSE);
      break;
    case OP_W:
      size = 2; sarg = W(val[1],val[2]);
      print_hd(of, sarg, hexdec, FALSE);
      break;
    case OP_AB:
      arg1 = B(val[1],val[2], &sz); size = sz;
      fprintf(of,"#%x", arg1*2);
      break;
    case OP_B:
      arg1 = B(val[1],val[2], &sz); size = sz;
      print_hd(of, arg1, hexdec, FALSE);
      break;
    case OP_DBB:
      arg1 = DB(val[1]);
      arg2 = B(val[2],val[3], &sz); size = sz+1;
      print_hd(of, arg1, hexdec, TRUE); fputc(',',of); 
      print_hd(of, arg2, hexdec, FALSE);
      break;
    case OP_UBB:
      arg1 = UB(val[1]);
      arg2 = B(val[2],val[3], &sz); size = sz+1;
      print_hd(of, arg1, hexdec, TRUE); fputc(',',of); 
      print_hd(of, arg2, hexdec, FALSE);
      break;
    case OP_BUB:
      arg1 = B(val[1],val[2], &sz); size = sz+1;
      arg2 = UB(val[sz+1]);
      print_hd(of, arg1, hexdec, FALSE); fputc(',',of); 
      print_hd(of, arg2, hexdec, TRUE);
      break;
    case OP_SB:
      size = 1; sarg = SB(val[1]);
      fprintf(of,"#%x", addr+sarg+2);
      break;
    case OP_SW:
      size = 2; sarg = SW(val[1],val[2]);
      fprintf(of,"#%x", addr+sarg+3);
      break;
    case OP_DBUB:
      size = 2; arg1 = DB(val[1]);
      arg2 = UB(val[2]);
      print_hd(of, arg1, hexdec, TRUE); fputc(',',of); 
      print_hd(of, arg2, hexdec, TRUE);
      break;
    case OP_UBUB:
      size = 2; arg1 = UB(val[1]);
      arg2 = UB(val[2]);
      print_hd(of, arg1, hexdec, TRUE); fputc(',',of); 
      print_hd(of, arg2, hexdec, TRUE);
      break;
    case OP_UBDBUB:
      size  = 3; arg1 = UB(val[1]);
      arg2 = DB(val[2]);
      arg3 = UB(val[3]);
      print_hd(of, arg1, hexdec, TRUE); fputc(',',of); 
      print_hd(of, arg2, hexdec, TRUE); fputc(',',of); 
      print_hd(of, arg3, hexdec, TRUE);
      break;
    case OP_DB:
      size = 1; arg1 = DB(val[1]);
      print_hd(of, arg1, hexdec, TRUE);
      break;
    }
    return -size;
  } else {
    fprintf(of,"%-8s","DB"); print_hd(of, op, hexdec, TRUE);
    return SCPE_OK;
  }
}
Beispiel #17
0
#define B(f) ((f) * 0x7F)
#define UB(f) ((f) * 0xFF)
#define S(f) ((f) * 0x7FFF)
#define US(f) ((f) * 0xFFFF)
#define I(f) ((double)(f) * 0x7FFFFFFF)
#define UI(f) ((double)(f) * 0xFFFFFFFF)

/* GL 2.0 */
/* XXX This list is incomplete. */
DEFINE_TEST(glColor3b,,  (B(x), B(y), B(z)),		"gl_Color", RGB, FLOAT_TYPE, "")
DEFINE_TEST(glColor3d,,  (x, y, z),			"gl_Color", RGB, FLOAT_TYPE, "")
DEFINE_TEST(glColor3f,,  (x, y, z),			"gl_Color", RGB, FLOAT_TYPE, "")
DEFINE_TEST(glColor3i,,  (I(x), I(y), I(z)),		"gl_Color", RGB, FLOAT_TYPE, "")
DEFINE_TEST(glColor3s,,  (S(x), S(y), S(z)),		"gl_Color", RGB, FLOAT_TYPE, "")
DEFINE_TEST(glColor3ub,, (UB(x), UB(y), UB(z)),		"gl_Color", RGB, FLOAT_TYPE, "")
DEFINE_TEST(glColor3ui,, (UI(x), UI(y), UI(z)),		"gl_Color", RGB, FLOAT_TYPE, "")
DEFINE_TEST(glColor3us,, (US(x), US(y), US(z)),		"gl_Color", RGB, FLOAT_TYPE, "")
DEFINE_TEST(glColor4b,,  (B(x), B(y), B(z), B(w)),	"gl_Color", RGBA, FLOAT_TYPE, "")
DEFINE_TEST(glColor4d,,  (x, y, z, w),			"gl_Color", RGBA, FLOAT_TYPE, "")
DEFINE_TEST(glColor4f,,  (x, y, z, w),			"gl_Color", RGBA, FLOAT_TYPE, "")
DEFINE_TEST(glColor4i,,  (I(x), I(y), I(z), I(w)),	"gl_Color", RGBA, FLOAT_TYPE, "")
DEFINE_TEST(glColor4s,,  (S(x), S(y), S(z), S(w)),	"gl_Color", RGBA, FLOAT_TYPE, "")
DEFINE_TEST(glColor4ub,, (UB(x), UB(y), UB(z), UB(w)),	"gl_Color", RGBA, FLOAT_TYPE, "")
DEFINE_TEST(glColor4ui,, (UI(x), UI(y), UI(z), UI(w)),	"gl_Color", RGBA, FLOAT_TYPE, "")
DEFINE_TEST(glColor4us,, (US(x), US(y), US(z), US(w)),	"gl_Color",RGBA, FLOAT_TYPE, "")
DEFINE_TEST(glVertexAttrib1d,, (1, x),			"attr",	R, FLOAT_TYPE, "")
DEFINE_TEST(glVertexAttrib1f,, (1, x),			"attr", R, FLOAT_TYPE, "")
DEFINE_TEST(glVertexAttrib1s,, (1, S(x)),		"attr * vec4(1.0/32768.0, 1.0, 1.0, 1.0)", R, FLOAT_TYPE, "")
DEFINE_TEST(glVertexAttrib2d,, (1, x, y),		"attr", RG, FLOAT_TYPE, "")
DEFINE_TEST(glVertexAttrib2f,, (1, x, y),		"attr", RG, FLOAT_TYPE, "")