Example #1
0
bool hBoxAddChildImpl(widget *self, widget *child)
{
	// We want to add the child to the next free column
	const int column = tableGetColumnCount(TABLE(self)) + 1;

	// Delegate to tableAddChild with row = 1
	return tableAddChild(TABLE(self), child, 1, column);
}
static void
table_print (repv stream, repv arg)
{
    rep_stream_puts (stream, "#<table ", -1, rep_FALSE);
    rep_princ_val (stream, TABLE(arg)->hash_fun);
    rep_stream_putc (stream, ' ');
    rep_princ_val (stream, TABLE(arg)->compare_fun);
    rep_stream_putc (stream, '>');
}
Example #3
0
void tableDestroyImpl(widget *self)
{
	// Destroy child positional info
	vectorMapAndDestroy(TABLE(self)->childPositions, free);
	
	// Call our parents destructor
	widgetDestroyImpl(self);
}
Example #4
0
 table_primary_t() : Table() {
     table[0x004] = TABLE(get_table4);
     table[0x013] = TABLE(get_table19);
     table[0x01E] = TABLE(get_table30);
     table[0x01F] = TABLE(get_table31);
     table[0x03A] = TABLE(get_table58);
     table[0x03B] = TABLE(get_table59);
     table[0x03E] = TABLE(get_table62);
     table[0x03F] = TABLE(get_table63);
     table[0x002] = INSTRUCTION(tdi);
     table[0x003] = INSTRUCTION(twi);
     table[0x007] = INSTRUCTION(mulli);
     table[0x008] = INSTRUCTION(subfic);
     table[0x00A] = INSTRUCTION(cmpli);
     table[0x00B] = INSTRUCTION(cmpi);
     table[0x00C] = INSTRUCTION(addic);
     table[0x00D] = INSTRUCTION(addic_);
     table[0x00E] = INSTRUCTION(addi);
     table[0x00F] = INSTRUCTION(addis);
     table[0x010] = INSTRUCTION(bcx);
     table[0x011] = INSTRUCTION(sc);
     table[0x012] = INSTRUCTION(bx);
     table[0x014] = INSTRUCTION(rlwimix);
     table[0x015] = INSTRUCTION(rlwinmx);
     table[0x017] = INSTRUCTION(rlwnmx);
     table[0x018] = INSTRUCTION(ori);
     table[0x019] = INSTRUCTION(oris);
     table[0x01A] = INSTRUCTION(xori);
     table[0x01B] = INSTRUCTION(xoris);
     table[0x01C] = INSTRUCTION(andi_);
     table[0x01D] = INSTRUCTION(andis_);
     table[0x020] = INSTRUCTION(lwz);
     table[0x021] = INSTRUCTION(lwzu);
     table[0x022] = INSTRUCTION(lbz);
     table[0x023] = INSTRUCTION(lbzu);
     table[0x024] = INSTRUCTION(stw);
     table[0x025] = INSTRUCTION(stwu);
     table[0x026] = INSTRUCTION(stb);
     table[0x027] = INSTRUCTION(stbu);
     table[0x028] = INSTRUCTION(lhz);
     table[0x029] = INSTRUCTION(lhzu);
     table[0x02A] = INSTRUCTION(lha);
     table[0x02B] = INSTRUCTION(lhau);
     table[0x02C] = INSTRUCTION(sth);
     table[0x02D] = INSTRUCTION(sthu);
     table[0x02E] = INSTRUCTION(lmw);
     table[0x02F] = INSTRUCTION(stmw);
     table[0x030] = INSTRUCTION(lfs);
     table[0x031] = INSTRUCTION(lfsu);
     table[0x032] = INSTRUCTION(lfd);
     table[0x033] = INSTRUCTION(lfdu);
     table[0x034] = INSTRUCTION(stfs);
     table[0x035] = INSTRUCTION(stfsu);
     table[0x036] = INSTRUCTION(stfd);
     table[0x037] = INSTRUCTION(stfdu);
 }
Example #5
0
size tableGetMaxSizeImpl(widget *self)
{
	size maxSize;
	
	const int numRows = tableGetRowCount(TABLE(self));
	const int numColumns = tableGetColumnCount(TABLE(self));
	
	int *maxRowHeight = alloca(sizeof(int) * numRows);
	int *maxColumnWidth = alloca(sizeof(int) * numColumns);
	
	tableGetMaximumCellSizes(TABLE(self), maxRowHeight, maxColumnWidth);
	
	// Sum up the widths and the heights to get the table size
	maxSize.x = tablePartialSum(maxColumnWidth, 0, numColumns);
	maxSize.y = tablePartialSum(maxRowHeight, 0, numRows);
	
	return maxSize;
}
Example #6
0
void tableRemoveChildImpl(widget *self, widget *child)
{
	// If we are not the childs parent, delegate to widgetRemoveChildImpl
	if (self != child->parent)
	{
		widgetRemoveChildImpl(self, child);
	}
	// We are the childs parent, so there is some bookkeeping to tend to
	else
	{
		int i;
		
		// Find the index of the child
		for (i = 0; i < vectorSize(self->children); i++)
		{
			if (child == vectorAt(self->children, i))
			{
				break;
			}
		}
		
		// Call the child's destructor and remove it
		widgetDestroy(vectorAt(self->children, i));
		vectorRemoveAt(self->children, i);
		
		// Remove the childs positional information
		free(vectorAt(TABLE(self)->childPositions, i));
		vectorRemoveAt(TABLE(self)->childPositions, i);
		
		// Remove any empty rows/columns
		tableRemoveEmptyRows(TABLE(self));
		tableRemoveEmptyColumns(TABLE(self));
		
		// Redo the layout of the window
		if (self->size.x != -1 && self->size.y != -1)
		{
			widgetDoLayout(widgetGetRoot(self));
		}
	}
}
Example #7
0
/**
 * @overload sudukutree.h
 */
void checkRow(Suduku* suduku, SlotIndex* index, int* possibleValues)
{
	int i;
	int slotVal;
	for(i = 0; i<suduku->tableSize; i++)
	{
		slotVal = suduku->table[TABLE(suduku->tableSize, index->row, i)];
		if(slotVal != EMPTY_SLOT_VAL)
		{
			possibleValues[slotVal - 1]++;
		}
	}
}
Example #8
0
static void
table_init (const struct ecc_curve *ecc,
	    mp_limb_t *table, unsigned bits,
	    const mp_limb_t *p,
	    mp_limb_t *scratch)
{
  unsigned size = 1 << bits;
  unsigned j;

  mpn_zero (TABLE(0), 3*ecc->p.size);
  TABLE(0)[ecc->p.size] = TABLE(0)[2*ecc->p.size] = 1;

  ecc_a_to_j (ecc, TABLE(1), p);

  for (j = 2; j < size; j += 2)
    {
      ecc_dup_eh (ecc, TABLE(j), TABLE(j/2), scratch);
      ecc_add_ehh (ecc, TABLE(j+1), TABLE(j), TABLE(1), scratch);
    }
}
Example #9
0
/**
 * @def firstEmptySlot
 * @brief finds the first empty slot in the table
 * @param Suduku* suduku the table
 * @param SlotIndex* slotIndex - the index that will update by the first empty slot index
 */
void firstEmptySlot(Suduku* suduku, SlotIndex* slotIndex)
{
	int rowIndex, colIndex;
	
	for(rowIndex = 0; rowIndex < suduku->tableSize; rowIndex++)
	{ 		
		 for(colIndex = 0; colIndex < suduku->tableSize; colIndex++)
		 {
			 if(suduku->table[TABLE(suduku->tableSize, rowIndex, colIndex)] == 0)
			 {
				 slotIndex->row = rowIndex;
				 slotIndex->col = colIndex;
				 return;
			 }
		 }
	}
	return;
}
Example #10
0
static void
table_init (const struct ecc_curve *ecc,
	    mp_limb_t *table, unsigned bits,
	    int initial, const mp_limb_t *p,
	    mp_limb_t *scratch)
{
  unsigned size = 1 << bits;
  unsigned j;

  mpn_zero (TABLE(0), 3*ecc->size);
  ecc_a_to_j (ecc, initial, TABLE(1), p);

  for (j = 2; j < size; j += 2)
    {
      ecc_dup_jj (ecc, TABLE(j), TABLE(j/2), scratch);
      ecc_add_jja (ecc, TABLE(j+1), TABLE(j), TABLE(1), scratch);
    }  
}
Example #11
0
/**
 * @overload sudukutree.h
 */
void checksubSqure(Suduku* suduku, SlotIndex* index, int* possibleValues)
{
	// we want to find the root of the sub string to check for PossibleValues
	int sqrt = findSqrt(suduku->tableSize); 
	
	int subSqureRow = (int)(index->row / sqrt)*(sqrt);
	int subSqureCol = (int)(index->col / sqrt)*(sqrt);
	
	int col, row, slotVal;
	for(row = subSqureRow; row < subSqureRow + sqrt; row++)
	{
		for(col = subSqureCol; col < subSqureCol + sqrt; col++)
		{
			slotVal = suduku->table[TABLE(suduku->tableSize, row, col)];
			if(slotVal != EMPTY_SLOT_VAL)
			{
				possibleValues[slotVal - 1]++;
			}
		}
	}
}
Example #12
0
static void hBoxInitVtbl(hBox *self)
{
	static bool initialised = false;

	if (!initialised)
	{
		// Copy our parents vtable into ours
		vtbl.tableVtbl = *(TABLE(self)->vtbl);

		// Overload widget's destroy and addChild methods
		vtbl.tableVtbl.widgetVtbl.destroy     = hBoxDestroyImpl;
		vtbl.tableVtbl.widgetVtbl.addChild    = hBoxAddChildImpl;

		initialised = true;
	}

	// Replace our parents vtable with our own
	WIDGET(self)->vtbl = &vtbl.tableVtbl.widgetVtbl;

	// Set our vtable
	self->vtbl = &vtbl;
}
static void
table_mark (repv val)
{
    int i;
    for (i = 0; i < TABLE(val)->total_buckets; i++)
    {
	node *n;
	for (n = TABLE(val)->buckets[i]; n != 0; n = n->next)
	{
	    if (!TABLE(val)->guardian)
		rep_MARKVAL(n->key);
	    rep_MARKVAL(n->value);
	}
    }
    rep_MARKVAL(TABLE(val)->hash_fun);
    rep_MARKVAL(TABLE(val)->compare_fun);
    rep_MARKVAL(TABLE(val)->guardian);
}
Example #14
0
namespace Security
{

ModuleNexus<MDSModule> MDSModule::mModuleNexus;

// Names and IDs of tables used in the MDS databases

#define TABLE(t) { t, #t }

/*
 * For now, to allow compatibility with AppleFileDL, we use the same record IDs
 * it uses when constructing an AppleDatabaseManager. See Radar 2817921 for details.
 * The fix requires that AppleDatabase be able to fetch its meta-table relationIDs
 * from an existing DB at DbOpen time; I'm not sure that's possible.
 */
#define USE_FILE_DL_TABLES		1

static const AppleDatabaseTableName kTableNames[] = {
    // the meta-tables. the parsing module is not used by MDS, but is required
    // by the implementation of the database
#if USE_FILE_DL_TABLES
    TABLE(CSSM_DL_DB_SCHEMA_INFO),
    TABLE(CSSM_DL_DB_SCHEMA_ATTRIBUTES),
    TABLE(CSSM_DL_DB_SCHEMA_INDEXES),
#else
    TABLE(MDS_CDSADIR_MDS_SCHEMA_RELATIONS),
    TABLE(MDS_CDSADIR_MDS_SCHEMA_ATTRIBUTES),
    TABLE(MDS_CDSADIR_MDS_SCHEMA_INDEXES),
#endif
    TABLE(CSSM_DL_DB_SCHEMA_PARSING_MODULE),

    // the MDS-specific tables
    TABLE(MDS_OBJECT_RECORDTYPE),
    TABLE(MDS_CDSADIR_CSSM_RECORDTYPE),
    TABLE(MDS_CDSADIR_KRMM_RECORDTYPE),
    TABLE(MDS_CDSADIR_EMM_RECORDTYPE),
    TABLE(MDS_CDSADIR_COMMON_RECORDTYPE),
    TABLE(MDS_CDSADIR_CSP_PRIMARY_RECORDTYPE),
    TABLE(MDS_CDSADIR_CSP_CAPABILITY_RECORDTYPE),
    TABLE(MDS_CDSADIR_CSP_ENCAPSULATED_PRODUCT_RECORDTYPE),
    TABLE(MDS_CDSADIR_CSP_SC_INFO_RECORDTYPE),
    TABLE(MDS_CDSADIR_DL_PRIMARY_RECORDTYPE),
    TABLE(MDS_CDSADIR_DL_ENCAPSULATED_PRODUCT_RECORDTYPE),
    TABLE(MDS_CDSADIR_CL_PRIMARY_RECORDTYPE),
    TABLE(MDS_CDSADIR_CL_ENCAPSULATED_PRODUCT_RECORDTYPE),
    TABLE(MDS_CDSADIR_TP_PRIMARY_RECORDTYPE),
    TABLE(MDS_CDSADIR_TP_OIDS_RECORDTYPE),
    TABLE(MDS_CDSADIR_TP_ENCAPSULATED_PRODUCT_RECORDTYPE),
    TABLE(MDS_CDSADIR_EMM_PRIMARY_RECORDTYPE),
    TABLE(MDS_CDSADIR_AC_PRIMARY_RECORDTYPE),
    TABLE(MDS_CDSADIR_KR_PRIMARY_RECORDTYPE),

    // marker for the end of the list
    { ~0UL, NULL }
};

MDSModule &
MDSModule::get ()
{
    return mModuleNexus ();
}

MDSModule::MDSModule ()
    :	mDatabaseManager(kTableNames),
      mLastScanTime((time_t)0),
      mServerMode(false)
{
    mDbPath[0] = '\0';
}

/*
 * Called upon unload or process death by CleanModuleNexus.
 */
MDSModule::~MDSModule ()
{
    /* TBD - close all DBs */
}

void MDSModule::lastScanIsNow()
{
    mLastScanTime = Time::now();
}

double MDSModule::timeSinceLastScan()
{
    Time::Interval delta = Time::now() - mLastScanTime;
    return delta.seconds();
}

void MDSModule::getDbPath(
    char *path)
{
    StLock<Mutex> _(mDbPathLock);
    strcpy(path, mDbPath);
}

void MDSModule::setDbPath(const char *path)
{
    StLock<Mutex> _(mDbPathLock);
    /* caller assures this, and this is private to this module */
    assert(strlen(path) <= MAXPATHLEN);
    strcpy(mDbPath, path);
}

void MDSModule::setServerMode()
{
    secdebug("MDSModule", "setting global server mode");
    mServerMode = true;
}

} // end namespace Security
Example #15
0
bool hBoxSetPadding(hBox *self, int padding)
{
	return tableSetPadding(TABLE(self), padding, 0);
}
Example #16
0
void hBoxSetVAlign(hBox *self, vAlign v)
{
	// Set the new alignment scheme
	tableSetDefaultAlign(TABLE(self), LEFT, v);
}
Example #17
0
/**
 * @overload sudukutree.h
 */
int getNodeChildren(void* suduku, void*** optionalSolutions)
{
	
	Suduku* tempSuduku = (Suduku*)suduku;
	SlotIndex emptySlotIndex = {DEFAULT_ROW_INDEX, DEFAULT_COL_INDEX};
	firstEmptySlot(tempSuduku, &emptySlotIndex);
	
	//reach to the end of the table
	if(emptySlotIndex.col == DEFAULT_COL_INDEX || emptySlotIndex.row == DEFAULT_ROW_INDEX)
	{
		return 0;
	}
	
	int* possibleValues = (int*)malloc(tempSuduku->tableSize * sizeof(int));
	if(possibleValues == NULL)
	{
		//allocation faild
		return 0;
	}
	int index;
	//initalize possibleValues array 
	for(index = 0; index < tempSuduku->tableSize; index++)
	{
		*(possibleValues + index) = POSSIBLE_VALUE_INITIALIZE;
	}
	//check for valid possible Values 
	checkCol(suduku, &emptySlotIndex, possibleValues);
	checkRow(suduku, &emptySlotIndex, possibleValues);
	checksubSqure(suduku, &emptySlotIndex, possibleValues);
	
	//check how mach possible Values the are
	int childrenCounter = 0;
	for(index = 0; index < tempSuduku->tableSize; index++)
	{
		if(*(possibleValues + index) == POSSIBLE_VALUE_INITIALIZE)
		{
			childrenCounter++;	
		}
	}
	
	//create an array of children - each children is the suduku table with different possible value
	Suduku** childrenArray;
	
	childrenArray = (Suduku**)malloc(childrenCounter * sizeof(Suduku*));
	//need to check for faild allocation
	if(childrenArray == NULL)
	{
		//allocation faild
		return 0;
	}
	
	*optionalSolutions = (void**)childrenArray;
	
	Suduku* child = NULL;
	
	for(index = 0; index < tempSuduku->tableSize; index++)
	{
		//if current value is optional
		if(*(possibleValues + index) == POSSIBLE_VALUE_INITIALIZE)
		{
			child = (Suduku*)copyNode(tempSuduku);
			child->table[TABLE(tempSuduku->tableSize, emptySlotIndex.row, emptySlotIndex.col)] = \
			index + 1;
			child->fullSlots++;
			*childrenArray = child;
			childrenArray++;
			
		}	
	}
	
	free(possibleValues);
	possibleValues = NULL;
	
	return childrenCounter;	
}
Example #18
0
bool tableDoLayoutImpl(widget *self)
{
	table *selfTable = TABLE(self);
	
	const int numChildren = vectorSize(self->children);
	
	const int numRows = tableGetRowCount(selfTable);
	const int numColumns = tableGetColumnCount(selfTable);
	
	int i;
	int dx, dy;
	
	int *minColumnWidth = alloca(sizeof(int) * numColumns);
	int *maxColumnWidth = alloca(sizeof(int) * numColumns);
	
	int *minRowHeight = alloca(sizeof(int) * numRows);
	int *maxRowHeight = alloca(sizeof(int) * numRows);
	
	// Syntatic sugar
	int *columnWidth = minColumnWidth;
	int *rowHeight = minRowHeight;
	
	// Get the minimum and maximum cell sizes
	tableGetMinimumCellSizes(selfTable, minRowHeight, minColumnWidth);
	tableGetMaximumCellSizes(selfTable, maxRowHeight, maxColumnWidth);
	
	// Calculate how much space we have left to fill
	dx = self->size.x - tablePartialSum(minColumnWidth, 0, numColumns);
	dy = self->size.y - tablePartialSum(minRowHeight, 0, numRows);
	
	// Increase the column size until we run out of space
	for (i = 0; dx; i = (i + 1) % numColumns)
	{
		// If the column is not maxed out, increases its size by one
		if (columnWidth[i] < maxColumnWidth[i])
		{
			columnWidth[i]++;
			dx--;
		}
	}
	
	// Increase the row size until we run out of space
	for (i = 0; dy; i = (i + 1) % numRows)
	{
		// If the row is not maxed out, increase its size by one
		if (rowHeight[i] < minRowHeight[i])
		{
			rowHeight[i]++;
			dy--;
		}
	}
	
	// Now we need to position the children, taking padding into account
	for (i = 0; i < numChildren; i++)
	{
		// Get the child and its position info
		widget *child = vectorAt(self->children, i);
		const childPositionInfo *pos = vectorAt(selfTable->childPositions, i);
		size maxChildSize = widgetGetMaxSize(child);
		
		// left is the sum of all of the preceding columns
		int left = tablePartialSum(columnWidth, 0, pos->column);
		
		// top is the sum of all of the preceding rows
		int top = tablePartialSum(rowHeight, 0, pos->row);
		
		// cellWidth is the sum of the columns we span
		int cellWidth = tablePartialSum(columnWidth, pos->column - 1, pos->colspan);
		
		// cellHeight is the sum of the rows we span
		int cellHeight = tablePartialSum(rowHeight, pos->row - 1, pos->rowspan);
		
		// Final width and height of the child
		int w, h;
		
		// Final x,y offsets of the child
		int x, y;
		
		// If we are not the last row/column, subtract the row/column padding
		if (pos->column + pos->colspan - 1 != numColumns)
		{
			cellWidth -= selfTable->columnPadding;
		}
		if (pos->row + pos->rowspan - 1 != numRows)
		{
			cellHeight -= selfTable->rowPadding;
		}
		
		// Compute the final width and height of the child
		w = MIN(cellWidth, maxChildSize.x);
		h = MIN(cellHeight, maxChildSize.y);
		
		// Pad out any remaining space
		switch (pos->hAlignment)
		{
			case LEFT:
				x = left;
				break;
			case CENTRE:
				x = left + (cellWidth - w) / 2;
				break;
			case RIGHT:
				x = left + cellWidth - w;
				break;
		}
		
		switch (pos->vAlignment)
		{
			case TOP:
				y = top;
				break;
			case MIDDLE:
				y = top + (cellHeight - h) / 2;
				break;
			case BOTTOM:
				y = top + cellHeight - h;
				break;
		}
		
		// Resize and reposition the widget
		widgetResize(child, w, h);
		widgetReposition(child, x, y);
	}
	
	return true;
}
Example #19
0
			spot_undo(UNDO_PAL);
		}
		shifter_set_palette(dt, dt->frame[0]);
		update_stuff(UPD_PAL);
	}
}


#undef _
#define _(X) X

#define WBbase shifter_dd
static void *shifter_code[] = {
	WINDOWm(_("Palette Shifter")),
	XVBOXB, // !!! Originally the main vbox was that way
	TABLE(4, 9),
	BORDER(LABEL, 0),
	uSPIN(row, 0, 7), EVENT(CHANGE, shifter_moved), EVENT(MULTI, shift_all),
	TLLABELx(_("Start"), 1, 0, 0, 0, 5),
		uSPIN(sfd[0], 0, 255), EVENT(CHANGE, shifter_moved),
	TLLABELx(_("Finish"), 2, 0, 0, 0, 5),
		uSPIN(sfd[1], 0, 255), EVENT(CHANGE, shifter_moved),
	TLLABELx(_("Delay"), 3, 0, 0, 0, 5),
		uSPIN(sfd[2], 0, 255), EVENT(CHANGE, shifter_moved),
	DEFBORDER(LABEL),
	TLTEXT("0\n1\n2\n3\n4\n5\n6\n7", 0, 1),
	REF(spinpack), TLSPINPACKv(spins, 3 * NSHIFT, shifter_moved, 3, 1, 1),
	TRIGGER,
	WDONE,
	HBOX,
	UTOGGLEv(_("Play"), shift_play_state, shift_btn), UNNAME,
Example #20
0
/*! bondwire model number */
enum bondwiremodel {
  FREESPACE,       /*!< fresspace model */
  MIRROR,          /*!< mirror plane model */
  DESCHARLES       /*!< Descharles Algani Mercier Alquie model */
};

/*! model number to string matching table definition */
struct modeltable_t { 
  const char * name; 
  int model;
};

/*! model number to string matching table implementation */
static const modeltable_t modeltable[] = {
  TABLE(FREESPACE),
  TABLE(MIRROR),
};


/*!\brief Get properties from model.
 * Get properties and fill the class.
 *  
 *  \todo check values
 */
void bondwire::getProperties (void) {
  unsigned int i;

  R = 0;
  l = getPropertyDouble ("L");
  d = getPropertyDouble ("D");
Example #21
0
int GameLayerMapBorder::initQuadMap()
{
    if(_isInitQuadMap)return 0;
    _isInitQuadMap = true;
    memset(&_sRawQuad, 0, sizeof(_sRawQuad));
    QuadVec quad;
    Size unit = GameRuntime::getInstance()->getMapGridUnitPixelSize();
    quad.rb = Vec3(2*unit.width,0,0);
    quad.rt = Vec3(2*unit.width,unit.height,0);
    quad.lb = quad.rb + Vec3(-BORDER_WIDTH,0,0);
    quad.lt = quad.rt + Vec3(-BORDER_WIDTH,0,0);
    TABLE(r_rb_rt);
    ////
    quad.rb = Vec3(2*unit.width,0,0);
    quad.rt = quad.rb;
    quad.lb = quad.rb + Vec3(-BORDER_WIDTH,0,0);
    quad.lt = MathHelper::getRotatePosition(quad.rb, quad.lb, 45);
    TABLE(r_rb);
    ////
    quad.rb = Vec3(unit.width,-unit.width,0);
    quad.rt = Vec3(2* unit.width,0,0);
    quad.lb = quad.rb + Vec3(-BORDER_WIDTH,0,0);
    quad.lb = MathHelper::getRotatePosition(quad.rb,quad.lb,45);
    quad.lt = quad.rt + Vec3(-BORDER_WIDTH,0,0);
    quad.lt = MathHelper::getRotatePosition(quad.rt,quad.lt,45);
    TABLE(rb_r_b);
    ////
    quad.rb = Vec3(unit.width,-unit.width,0);
    quad.rt = quad.rb;
    quad.lb = quad.rb + Vec3(-BORDER_WIDTH,0,0);
    quad.lb = MathHelper::getRotatePosition(quad.rb,quad.lb,45);
    quad.lt = quad.rt + Vec3(0,BORDER_WIDTH,0);
    TABLE(b_rb);
    ///
    
    quad.rb = Vec3(0,-unit.width,0);
    quad.rt =  Vec3(unit.width,-unit.width,0);
    quad.lb = quad.rb + Vec3(0,BORDER_WIDTH,0);
    quad.lt = quad.rt + Vec3(0,BORDER_WIDTH,0);
    TABLE(b_lb_rb);
    ///
    
    
    quad.rb = Vec3(0,-unit.width,0);
    quad.rt = quad.rb ;
    quad.lb = quad.rb + Vec3(0,BORDER_WIDTH,0);
    quad.lt = MathHelper::getRotatePosition(quad.rb,quad.lb,45);
    TABLE(b_lb);
    ///
    
    quad.rb = Vec3(-unit.width,0,0);
    quad.rt = Vec3(0,-unit.height,0);
    quad.lb = quad.rb + Vec3(0,BORDER_WIDTH,0);
    quad.lb = MathHelper::getRotatePosition(quad.rb,quad.lb,45);
    quad.lt = quad.rt + Vec3(0,BORDER_WIDTH,0);
    quad.lt = MathHelper::getRotatePosition(quad.rt,quad.lt,45);
    TABLE(lb_l_b);
    ///
    
    quad.rb = Vec3(-unit.width,0,0);
    quad.rt = quad.rb;
    quad.lb = quad.rb + Vec3(0,BORDER_WIDTH,0);
    quad.lb = MathHelper::getRotatePosition(quad.rb,quad.lb,45);
    quad.lt = quad.rt + Vec3(BORDER_WIDTH,0,0);
    TABLE(l_lb);
    ///
    
    quad.rb = Vec3(-unit.width,unit.width,0);
    quad.rt = Vec3(-unit.width,0,0);
    quad.lb = quad.rb + Vec3(BORDER_WIDTH,0,0);
    quad.lt = quad.rt + Vec3(BORDER_WIDTH,0,0);
    TABLE(l_lb_lt);
    ///
    
    quad.rb = Vec3(-unit.width,unit.width,0);
    quad.rt = quad.rb;
    quad.lb = quad.rb + Vec3(BORDER_WIDTH,0,0);
    quad.lt = MathHelper::getRotatePosition(quad.rb,quad.lb,45);
    TABLE(l_lt);
    ///
    
    quad.rb = Vec3(0,2*unit.width,0);
    quad.rt = Vec3(-unit.width,unit.width,0);
    
    quad.lb = quad.rb + Vec3(BORDER_WIDTH,0,0);
    quad.lb = MathHelper::getRotatePosition(quad.rb,quad.lb,45);
    quad.lt = quad.rt + Vec3(BORDER_WIDTH,0,0);
    quad.lt = MathHelper::getRotatePosition(quad.rt,quad.lt,45);
    TABLE(lt_l_t);
    ///
    
    
    quad.rb = Vec3(0,2*unit.width,0);
    quad.rt = quad.rb;
    quad.lb = quad.rb + Vec3(BORDER_WIDTH,0,0);
    quad.lb = MathHelper::getRotatePosition(quad.rb,quad.lb,45);
    quad.lt = quad.rt + Vec3(0,-BORDER_WIDTH,0);
    TABLE(t_lt);
    ///
    
    quad.rb = Vec3(unit.width,2*unit.width,0);
    quad.rt = Vec3(0,2*unit.width,0);
    quad.lb = quad.rb + Vec3(0,-BORDER_WIDTH,0);
    quad.lt = quad.rt + Vec3(0,-BORDER_WIDTH,0);
    TABLE(t_lt_rt);
    ///
    
    quad.rb = Vec3(unit.width,2*unit.width,0);
    quad.rt = quad.rb;
    quad.lb = quad.rb + Vec3(0,-BORDER_WIDTH,0);
    quad.lt = MathHelper::getRotatePosition(quad.rb,quad.lb,45);
    TABLE(t_rt);
    ///
    
    quad.rb = Vec3(2*unit.width,unit.width,0);
    quad.rt = Vec3(unit.width,2*unit.width,0);
    quad.lb = quad.rb + Vec3(0,-BORDER_WIDTH,0);
    quad.lb = MathHelper::getRotatePosition(quad.rb,quad.lb,45);
    quad.lt = quad.rt + Vec3(0,-BORDER_WIDTH,0);
    quad.lt = MathHelper::getRotatePosition(quad.rt,quad.lt,45);
    TABLE(rt_r_t);
    ///
    quad.rb = Vec3(2*unit.width,unit.width,0);
    quad.rt = quad.rb;
    quad.lb = quad.rb + Vec3(0,-BORDER_WIDTH,0);
    quad.lb = MathHelper::getRotatePosition(quad.rb,quad.lb,45);
    quad.lt = quad.rt + Vec3(-BORDER_WIDTH,0,0);
    TABLE(r_rt);
    ///
    //////////////
    
    quad.rb = Vec3(unit.width,2*unit.width,0);
    quad.rt = Vec3(-unit.width,unit.width,0);
    quad.lb = quad.rb + Vec3(0,-BORDER_WIDTH,0);
    quad.lt = quad.lb;
    TABLE(lt_l_t_rt);
    /////
    quad.rb = Vec3(0,2*unit.width,0);
    quad.rt = Vec3(-unit.width,0,0);
    quad.lb = quad.rt + Vec3(BORDER_WIDTH,0,0);
    quad.lt = quad.lb;
    TABLE(lt_l_t_lb);
    ///
    
    quad.rb = Vec3(2*unit.width,unit.width,0);
    quad.rt = Vec3(0,2*unit.width,0);
    quad.lb = quad.rt + Vec3(0,-BORDER_WIDTH,0);
    quad.lt = quad.lb;
    TABLE(rt_r_t_lt);
    /////
    
    quad.rb = Vec3(2*unit.width,0,0);
    quad.rt = Vec3(unit.width,2*unit.width,0);
    quad.lb = quad.rb + Vec3(-BORDER_WIDTH,0,0);
    quad.lt = quad.lb;
    TABLE(rt_r_t_rb);
    ///
    
    quad.rb = Vec3(-unit.width,0,0);
    quad.rt = Vec3(unit.width,-unit.width,0);
    quad.lb = quad.rt + Vec3(0,BORDER_WIDTH,0);
    quad.lt = quad.lb;
    TABLE(lb_l_b_rb);
    /////
    quad.rb = Vec3(-unit.width,unit.width,0);
    quad.rt = Vec3(0,-unit.width,0);
    quad.lb = quad.rb + Vec3(BORDER_WIDTH,0,0);
    quad.lt = quad.lb;
    TABLE(lb_l_b_lt);
    ///

    
    quad.rb = Vec3(0,-unit.width,0);
    quad.rt = Vec3(2*unit.width,0,0);
    quad.lb = quad.rb + Vec3(0,BORDER_WIDTH,0);
    quad.lt = quad.lb;
    TABLE(rb_r_b_lb);
    /////
    
    quad.rb = Vec3(unit.width,-unit.width,0);
    quad.rt = Vec3(2*unit.width,unit.width,0);
    quad.lb = quad.rt + Vec3(-BORDER_WIDTH,0,0);
    quad.lt = quad.lb;
    TABLE(rb_r_b_rt);
    /////
    
    quad.rb = Vec3(unit.width,2*unit.width,0);
    quad.rt = Vec3(-unit.width,0,0);
    quad.lb = quad.rt + Vec3(BORDER_WIDTH,0,0);
    quad.lt = quad.lb;
    TABLE(lt_l_t_lb_rt);
    
    quad.rb = Vec3(-unit.width,unit.width,0);
    quad.rt = Vec3(unit.width,-unit.width,0);
    quad.lb = quad.rb + Vec3(BORDER_WIDTH,0,0);
    quad.lt = quad.rt + Vec3(0,BORDER_WIDTH,0);
    TABLE(lb_l_b_lt_rb);
    
    
    quad.rb = Vec3(0,-unit.width,0);
    quad.rt = Vec3(unit.width*2,unit.width,0);
    quad.lb = quad.rb + Vec3(0,BORDER_WIDTH,0);
    quad.lt = quad.rt + Vec3(-BORDER_WIDTH,0,0);
    TABLE(rb_r_b_lb_rt);
    
    quad.rb = Vec3(2*unit.width,0,0);
    quad.rt = Vec3(0,unit.width*2,0);
    quad.lb = quad.rb + Vec3(-BORDER_WIDTH,0,0);
    quad.lt = quad.rt + Vec3(0,-BORDER_WIDTH,0);
    TABLE(rt_r_t_rb_lt);
    return 0;
}