text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<!DOCTYPE module PUBLIC
    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<!--  Checkstyle configuration for Apache Drill -->

<module name="Checker">

  <module name="TreeWalker">

    <module name="IllegalImport">
      <property name="illegalPkgs" value="com.google.hive12,com.beust.jcommander.internal,jersey.repackaged"/>
    </module>

    <module name="AvoidStarImport">
      <property name="allowStaticMemberImports" value="true"/>
    </module>

  </module>
</module>


text:
import acspytest__POA
from Acspy.Servants.ContainerServices  import ContainerServices
from Acspy.Servants.ComponentLifecycle import ComponentLifecycle
from Acspy.Servants.ACSComponent       import ACSComponent
from CORBA import TRUE, FALSE
#*******************************************************************************
# ALMA - Atacama Large Millimiter Array
# (c) Associated Universities Inc., 2002
# (c) European Southern Observatory, 2002
# Copyright by ESO (in the framework of the ALMA collaboration)
# and Cosylab 2002, All rights reserved
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307  USA
#
#------------------------------------------------------------------------------
'''
Module designed to test the full functionality of the Python Container.  Since
Python is not a compiled language, its vital that everything be tested.
'''
#------------------------------------------------------------------------------
class PyTestNestedModule(acspytest__POA.nested.PyTestNestedModule,
             ACSComponent,  #Base IDL interface
             ContainerServices,  #Developer niceties
             ComponentLifecycle):  #HLA stuff

    def __init__(self):
        ACSComponent.__init__(self)
        ContainerServices.__init__(self)
        return

    '''
    Component designed to test the functionality of the Python container.
    '''
    def test(self):
        '''
        Python implementation of IDL method.
        '''
        print "Testing method from component in a nested module."
        return

#------------------------------------------------------------------------------
if __name__ == "__main__":
    print "Creating an object"
    g = PyTestNestedModule()
    g.test()
    print "Done..."

redpajama_set_name: RedPajamaGithub


text:
#include "stdafx.h"

/////////////////////////////////////////////////////////////////////////////
// WinApp features for new and open

void CWinApp::OnFileNew()
{
	if (m_pDocManager != NULL)
		m_pDocManager->OnFileNew();
}

/////////////////////////////////////////////////////////////////////////////

void CWinApp::OnFileOpen()
{
	ENSURE(m_pDocManager != NULL);
	m_pDocManager->OnFileOpen();
}

// prompt for file name - used for open and save as
BOOL CWinApp::DoPromptFileName(CString& fileName, UINT nIDSTitle, DWORD lFlags,
	BOOL bOpenFileDialog, CDocTemplate* pTemplate)
		// if pTemplate==NULL => all document templates
{
	ENSURE(m_pDocManager != NULL);
	return m_pDocManager->DoPromptFileName(fileName, nIDSTitle, lFlags,
		bOpenFileDialog, pTemplate);
}

/////////////////////////////////////////////////////////////////////////////


text:
package me.alivecode.algs4;

import java.util.*;

/**
 * The {@code MinPQ} class represents an priority queue
 * which is minimum first.
 * For maximum first priority queue see {@link MaxPQ}.
 */
public class MinPQ<Key extends Comparable<Key>> implements Iterable<Key>{
    private Key[] pq;
    private int N;
    //private Comparator<Key> comparator;

    /**
     * Initializes an empty minimum priority queue.
     */
    public MinPQ() {
        this(4);
    }

    /**
     * Initializes an empty minimum priority queue
     * with capacity of {@code initCapacity}.
     *
     * @param initCapacity the initialized capacity.
     */
    public MinPQ(int initCapacity) {
        this.pq = (Key[]) new Comparable[initCapacity + 1];
        N = 0;
    }

    /**
     * Initializes an priority queue with {@code keys}.
     *
     * @param keys the keys.
     */
    public MinPQ(Key[] keys) {
        N = keys.length;
        pq = (Key[]) new Comparable[N+1];
        for(int i = 0; i < keys.length; i++) {
            pq[i+1] = keys[i];
        }

        for(int k = N/2; k >= 1; k--) {
            sink(k);
        }
        assert isMinHeap(1);
    }

    /**
     * Inserts the {@code key} to the queue.
     *
     * @param key the key.
     */
    public void insert(Key key) {
        if (N == pq.length - 1) resize(pq.length * 2);
        pq[++N] = key;
        swim(N);
        assert isMinHeap(1);
    }

    /**
     * Returns the smallest key in the queue.
     *
     * @return the smallest key in the queue.
     */
    public Key min(){
        if (isEmpty()) throw new NoSuchElementException("Priority heap underflow");
        return pq[1];
    }

    /**
     * Is the queue empty?
     *
     * @return {@code true} if the queue is empty,
     * {@code false} otherwise.
     */
    public boolean isEmpty() {
        return N == 0;
    }

    /**
     * Returns the number of keys in the queue.
     *
     * @return the number of keys in the queue.
     */
    public int size() {
        return N;
    }

    /**
     * Remove the smallest key from the queue and returns it.
     *
     * @return the smallest key.
     */
    public Key delMin() {
        if (N == 0) throw new NoSuchElementException("Priority heap underflow");

        exch(1, N);
        Key min = pq[N--];
        sink(1);
        pq[N+1] = null;
        if (N > 0 && N == (pq.length-1) / 4) resize(pq.length/2 + 1);
        return min;
    }

    // move the kth key up to where it is larger than its children and
    // smaller than its parent.
    private void swim(int k) {
        while(k > 1) {
            int j = k / 2;
            if (!greater(j, k)) break;
            exch(k, j);
            k = j;
        }
    }

    // move the kth key down to where it is smaller than its parent
    // and larger than its children.
    private void sink(int k) {
       while(2*k <= N) {
           int j = 2*k;
           // j=left child, j+1=right child.
           if (j < N && greater(j, j+1)) j++;
           if (!greater(k, j)) break;;
           exch(k, j);
           k = j;
       }
    }

    private void exch(int j, int k) {
        Key tmp = pq[j];
        pq[j] = pq[k];
        pq[k] = tmp;
    }

    private boolean greater(int l, int r) {
        if (pq[l].compareTo(pq[r]) == 1) return true;
        else return false;
    }

    // Check if kth key and its children in heap order.
    private boolean isMinHeap(int k) {
        if (k > N) return true;

        int left = 2*k;
        int right = 2*k + 1;
        if (left <= N && greater(k, left)) return false;
        else if (right <= N && greater(k, right)) return false;
        else return isMinHeap(left) && isMinHeap(right);
    }

    private void resize(int capacity) {
        assert capacity > N;
        Key[] tmp = (Key[])new Comparable[capacity];

        /*
        for (int i = 1; i <= N; i++) {
            tmp[i] = pq[i];
        }
        */
        System.arraycopy(pq, 1, tmp, 1, N);
        pq = tmp;
    }

    public Iterator<Key> iterator() {
        return new ListIterator();
    }

    private class ListIterator implements Iterator<Key> {
        private MinPQ<Key> copy;

        public ListIterator() {
            Key[] keys = (Key[]) new Comparable[pq.length-1];
            // pq is one-based
            for(int i = 1; i < pq.length; i++) {
                keys[i-1] = pq[i];
            }
            copy = new MinPQ<Key>(keys);
        }

        public boolean hasNext() {
            return copy.isEmpty();
        }

        public Key next() {
            if (!hasNext()) throw new NoSuchElementException();
            return copy.delMin();
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    }
}


text:
package org.apache.taverna.mobile.data.remote;

import org.apache.taverna.mobile.data.model.DetailAnnouncement;
import org.apache.taverna.mobile.data.model.Announcements;

import retrofit2.http.GET;
import retrofit2.http.Query;
import rx.Observable;

/**
 * Created by Sagar
 */

public interface TavernaService {

    @GET("/announcements.xml")
    Observable<Announcements> getAllAnnouncements(@Query("page") int pageNumber);

    @GET("/announcement.xml")
    Observable<DetailAnnouncement> getAnnouncement(@Query("id") String id);
}


text:
#include <stdio.h>
#include "state.h"
#include "state/cr_statetypes.h"
#include "state_internals.h"
#include "cr_error.h"
#include "cr_mem.h"

/**
 * \mainpage state_tracker
 *
 * \section StateTrackerIntroduction Introduction
 *
 * Chromium consists of all the top-level files in the cr
 * directory.  The state_tracker module basically takes care of API dispatch,
 * and OpenGL state management.
 *
 *
 */
void crStateAttribInit (CRAttribState *a)
{
	int i;
	a->attribStackDepth = 0;
	a->accumBufferStackDepth = 0;
	a->colorBufferStackDepth = 0;
	a->currentStackDepth = 0;
	a->depthBufferStackDepth = 0;
	a->enableStackDepth = 0;
	for ( i = 0 ; i < CR_MAX_ATTRIB_STACK_DEPTH ; i++)
	{
		a->enableStack[i].clip = NULL;
		a->enableStack[i].light = NULL;
		a->lightingStack[i].light = NULL;
		a->transformStack[i].clip = NULL;
		a->transformStack[i].clipPlane = NULL;
	}
	a->evalStackDepth = 0;
	a->fogStackDepth = 0;
	a->lightingStackDepth = 0;
	a->lineStackDepth = 0;
	a->listStackDepth = 0;
	a->pixelModeStackDepth = 0;
	a->pointStackDepth = 0;
	a->polygonStackDepth = 0;
	a->polygonStippleStackDepth = 0;
	a->scissorStackDepth = 0;
	a->stencilBufferStackDepth = 0;
	a->textureStackDepth = 0;
	a->transformStackDepth = 0;
	a->viewportStackDepth = 0;
}

static void
copy_texunit(CRTextureUnit *dest, const CRTextureUnit *src)
{
	dest->enabled1D = src->enabled1D;
	dest->enabled2D = src->enabled2D;
	dest->enabled3D = src->enabled3D;
	dest->enabledCubeMap = src->enabledCubeMap;
	dest->envMode = src->envMode;
	dest->envColor = src->envColor;
	dest->textureGen = src->textureGen;
	dest->objSCoeff = src->objSCoeff;
	dest->objTCoeff = src->objTCoeff;
	dest->objRCoeff = src->objRCoeff;
	dest->objQCoeff = src->objQCoeff;
	dest->eyeSCoeff = src->eyeSCoeff;
	dest->eyeTCoeff = src->eyeTCoeff;
	dest->eyeRCoeff = src->eyeRCoeff;
	dest->eyeQCoeff = src->eyeQCoeff;
	dest->gen = src->gen;
	dest->currentTexture1D = src->currentTexture1D;
	dest->currentTexture2D = src->currentTexture2D;
	dest->currentTexture3D = src->currentTexture3D;
	dest->currentTextureCubeMap = src->currentTextureCubeMap;
}

static void
copy_texobj(CRTextureObj *dest, const CRTextureObj *src, GLboolean copyName)
{
	if (copyName)
		dest->name = src->name;
	dest->borderColor = src->borderColor;
	dest->wrapS = src->wrapS;
	dest->wrapT = src->wrapT;
	dest->minFilter = src->minFilter;
	dest->magFilter = src->magFilter;
#ifdef CR_OPENGL_VERSION_1_2
	dest->priority = src->priority;
	dest->wrapR = src->wrapR;
	dest->minLod = src->minLod;
	dest->maxLod = src->maxLod;
	dest->baseLevel = src->baseLevel;
	dest->maxLevel = src->maxLevel;
#endif
#ifdef CR_EXT_texture_filter_anisotropic
	dest->maxAnisotropy = src->maxAnisotropy;
#endif
}

void STATE_APIENTRY crStatePushAttrib(GLbitfield mask)
{
	CRContext *g = GetCurrentContext();
	CRAttribState *a = &(g->attrib);
	CRStateBits *sb = GetCurrentBits();
	CRAttribBits *ab = &(sb->attrib);
	unsigned int i;

	if (g->current.inBeginEnd)
	{
		crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glPushAttrib called in Begin/End");
		return;
	}

	if (a->attribStackDepth == CR_MAX_ATTRIB_STACK_DEPTH - 1)
	{
		crStateError(__LINE__, __FILE__, GL_STACK_OVERFLOW, "glPushAttrib called with a full stack!" );
		return;
	}

	FLUSH();

	a->pushMaskStack[a->attribStackDepth++] = mask;

	if (mask & GL_ACCUM_BUFFER_BIT)
	{
		a->accumBufferStack[a->accumBufferStackDepth].accumClearValue = g->buffer.accumClearValue;
		a->accumBufferStackDepth++;
	}
	if (mask & GL_COLOR_BUFFER_BIT)
	{
		a->colorBufferStack[a->colorBufferStackDepth].alphaTest = g->buffer.alphaTest;
		a->colorBufferStack[a->colorBufferStackDepth].alphaTestFunc = g->buffer.alphaTestFunc;
		a->colorBufferStack[a->colorBufferStackDepth].alphaTestRef = g->buffer.alphaTestRef;
		a->colorBufferStack[a->colorBufferStackDepth].blend = g->buffer.blend;
		a->colorBufferStack[a->colorBufferStackDepth].blendSrcRGB = g->buffer.blendSrcRGB;
		a->colorBufferStack[a->colorBufferStackDepth].blendDstRGB = g->buffer.blendDstRGB;
#if defined(CR_EXT_blend_func_separate)
		a->colorBufferStack[a->colorBufferStackDepth].blendSrcA = g->buffer.blendSrcA;
		a->colorBufferStack[a->colorBufferStackDepth].blendDstA = g->buffer.blendDstA;
#endif
#ifdef CR_EXT_blend_color
		a->colorBufferStack[a->colorBufferStackDepth].blendColor = g->buffer.blendColor;
#endif
#if defined(CR_EXT_blend_minmax) || defined(CR_EXT_blend_subtract) || defined(CR_EXT_blend_logic_op)
		a->colorBufferStack[a->colorBufferStackDepth].blendEquation = g->buffer.blendEquation;
#endif
		a->colorBufferStack[a->colorBufferStackDepth].dither = g->buffer.dither;
		a->colorBufferStack[a->colorBufferStackDepth].drawBuffer = g->buffer.drawBuffer;
		a->colorBufferStack[a->colorBufferStackDepth].logicOp = g->buffer.logicOp;
		a->colorBufferStack[a->colorBufferStackDepth].indexLogicOp = g->buffer.indexLogicOp;
		a->colorBufferStack[a->colorBufferStackDepth].logicOpMode = g->buffer.logicOpMode;
		a->colorBufferStack[a->colorBufferStackDepth].colorClearValue = g->buffer.colorClearValue;
		a->colorBufferStack[a->colorBufferStackDepth].indexClearValue = g->buffer.indexClearValue;
		a->colorBufferStack[a->colorBufferStackDepth].colorWriteMask = g->buffer.colorWriteMask;
		a->colorBufferStack[a->colorBufferStackDepth].indexWriteMask = g->buffer.indexWriteMask;
		a->colorBufferStackDepth++;
	}
	if (mask & GL_CURRENT_BIT)
	{
		for (i = 0 ; i < CR_MAX_VERTEX_ATTRIBS ; i++)
		{
			COPY_4V(a->currentStack[a->currentStackDepth].attrib[i] , g->current.vertexAttrib[i]);
			COPY_4V(a->currentStack[a->currentStackDepth].rasterAttrib[i] , g->current.rasterAttrib[i]);
		}
		a->currentStack[a->currentStackDepth].rasterValid = g->current.rasterValid;
		a->currentStack[a->currentStackDepth].edgeFlag = g->current.edgeFlag;
		a->currentStack[a->currentStackDepth].colorIndex = g->current.colorIndex;
		a->currentStackDepth++;
	}
	if (mask & GL_DEPTH_BUFFER_BIT)
	{
		a->depthBufferStack[a->depthBufferStackDepth].depthTest = g->buffer.depthTest;
		a->depthBufferStack[a->depthBufferStackDepth].depthFunc = g->buffer.depthFunc;
		a->depthBufferStack[a->depthBufferStackDepth].depthClearValue = g->buffer.depthClearValue;
		a->depthBufferStack[a->depthBufferStackDepth].depthMask = g->buffer.depthMask;
		a->depthBufferStackDepth++;
	}
	if (mask & GL_ENABLE_BIT)
	{
		if (a->enableStack[a->enableStackDepth].clip == NULL)
		{
			a->enableStack[a->enableStackDepth].clip = (GLboolean *) crCalloc( g->limits.maxClipPlanes * sizeof( GLboolean ));
		}
		if (a->enableStack[a->enableStackDepth].light == NULL)
		{
			a->enableStack[a->enableStackDepth].light = (GLboolean *) crCalloc( g->limits.maxLights * sizeof( GLboolean ));
		}
		a->enableStack[a->enableStackDepth].alphaTest = g->buffer.alphaTest;
		a->enableStack[a->enableStackDepth].autoNormal = g->eval.autoNormal;
		a->enableStack[a->enableStackDepth].blend = g->buffer.blend;
		for (i = 0 ; i < g->limits.maxClipPlanes ; i++)
		{
			a->enableStack[a->enableStackDepth].clip[i] = g->transform.clip[i];
		}
		a->enableStack[a->enableStackDepth].colorMaterial = g->lighting.colorMaterial;
		a->enableStack[a->enableStackDepth].cullFace = g->polygon.cullFace;
		a->enableStack[a->enableStackDepth].depthTest = g->buffer.depthTest;
		a->enableStack[a->enableStackDepth].dither = g->buffer.dither;
		a->enableStack[a->enableStackDepth].fog = g->fog.enable;
		for (i = 0 ; i < g->limits.maxLights ; i++)
		{
			a->enableStack[a->enableStackDepth].light[i] = g->lighting.light[i].enable;
		}
		a->enableStack[a->enableStackDepth].lighting = g->lighting.lighting;
		a->enableStack[a->enableStackDepth].lineSmooth = g->line.lineSmooth;
		a->enableStack[a->enableStackDepth].lineStipple = g->line.lineStipple;
		a->enableStack[a->enableStackDepth].logicOp = g->buffer.logicOp;
		a->enableStack[a->enableStackDepth].indexLogicOp = g->buffer.indexLogicOp;
		for (i = 0 ; i < GLEVAL_TOT ; i++)
		{
			a->enableStack[a->enableStackDepth].map1[i] = g->eval.enable1D[i];
			a->enableStack[a->enableStackDepth].map2[i] = g->eval.enable2D[i];
		}
		a->enableStack[a->enableStackDepth].normalize = g->transform.normalize;
		a->enableStack[a->enableStackDepth].pointSmooth = g->point.pointSmooth;
#if CR_ARB_point_sprite
		a->enableStack[a->enableStackDepth].pointSprite = g->point.pointSprite;
		for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++)
			a->enableStack[a->enableStackDepth].coordReplacement[i] = g->point.coordReplacement[i];
#endif
		a->enableStack[a->enableStackDepth].polygonOffsetLine = g->polygon.polygonOffsetLine;
		a->enableStack[a->enableStackDepth].polygonOffsetFill = g->polygon.polygonOffsetFill;
		a->enableStack[a->enableStackDepth].polygonOffsetPoint = g->polygon.polygonOffsetPoint;
		a->enableStack[a->enableStackDepth].polygonSmooth = g->polygon.polygonSmooth;
		a->enableStack[a->enableStackDepth].polygonStipple = g->polygon.polygonStipple;
#ifdef CR_OPENGL_VERSION_1_2
		a->enableStack[a->enableStackDepth].rescaleNormals = g->transform.rescaleNormals;
#endif
		a->enableStack[a->enableStackDepth].scissorTest = g->viewport.scissorTest;
		a->enableStack[a->enableStackDepth].stencilTest = g->stencil.stencilTest;
		for (i = 0 ; i < g->limits.maxTextureUnits; i++)
		{
			a->enableStack[a->enableStackDepth].texture1D[i] = g->texture.unit[i].enabled1D;
			a->enableStack[a->enableStackDepth].texture2D[i] = g->texture.unit[i].enabled2D;
#ifdef CR_OPENGL_VERSION_1_2
			a->enableStack[a->enableStackDepth].texture3D[i] = g->texture.unit[i].enabled3D;
#endif
#ifdef CR_ARB_texture_cube_map
			a->enableStack[a->enableStackDepth].textureCubeMap[i] = g->texture.unit[i].enabledCubeMap;
#endif
#ifdef CR_NV_texture_rectangle
			a->enableStack[a->enableStackDepth].textureRect[i] = g->texture.unit[i].enabledRect;
#endif
			a->enableStack[a->enableStackDepth].textureGenS[i] = g->texture.unit[i].textureGen.s;
			a->enableStack[a->enableStackDepth].textureGenT[i] = g->texture.unit[i].textureGen.t;
			a->enableStack[a->enableStackDepth].textureGenR[i] = g->texture.unit[i].textureGen.r;
			a->enableStack[a->enableStackDepth].textureGenQ[i] = g->texture.unit[i].textureGen.q;
		}
		a->enableStackDepth++;
	}
	if (mask & GL_EVAL_BIT)
	{
		for (i = 0 ; i < GLEVAL_TOT ; i++)
		{
			int size1 = g->eval.eval1D[i].order * gleval_sizes[i] *
					sizeof (GLfloat);
			int size2 = g->eval.eval2D[i].uorder * g->eval.eval2D[i].vorder *
					gleval_sizes[i] * sizeof (GLfloat);
			a->evalStack[a->evalStackDepth].enable1D[i] = g->eval.enable1D[i];
			a->evalStack[a->evalStackDepth].enable2D[i] = g->eval.enable2D[i];
			a->evalStack[a->evalStackDepth].eval1D[i].u1 = g->eval.eval1D[i].u1;
			a->evalStack[a->evalStackDepth].eval1D[i].u2 = g->eval.eval1D[i].u2;
			a->evalStack[a->evalStackDepth].eval1D[i].order = g->eval.eval1D[i].order;
			a->evalStack[a->evalStackDepth].eval1D[i].coeff = (GLfloat*)crCalloc(size1);
			crMemcpy(a->evalStack[a->evalStackDepth].eval1D[i].coeff, g->eval.eval1D[i].coeff, size1);
			a->evalStack[a->evalStackDepth].eval2D[i].u1 = g->eval.eval2D[i].u1;
			a->evalStack[a->evalStackDepth].eval2D[i].u2 = g->eval.eval2D[i].u2;
			a->evalStack[a->evalStackDepth].eval2D[i].v1 = g->eval.eval2D[i].v1;
			a->evalStack[a->evalStackDepth].eval2D[i].v2 = g->eval.eval2D[i].v2;
			a->evalStack[a->evalStackDepth].eval2D[i].uorder = g->eval.eval2D[i].uorder;
			a->evalStack[a->evalStackDepth].eval2D[i].vorder = g->eval.eval2D[i].vorder;
			a->evalStack[a->evalStackDepth].eval2D[i].coeff = (GLfloat*)crCalloc(size2);
			crMemcpy(a->evalStack[a->evalStackDepth].eval2D[i].coeff, g->eval.eval2D[i].coeff, size2);
		}
		a->evalStack[a->evalStackDepth].autoNormal = g->eval.autoNormal;
		a->evalStack[a->evalStackDepth].un1D = g->eval.un1D;
		a->evalStack[a->evalStackDepth].u11D = g->eval.u11D;
		a->evalStack[a->evalStackDepth].u21D = g->eval.u21D;
		a->evalStack[a->evalStackDepth].un2D = g->eval.un2D;
		a->evalStack[a->evalStackDepth].u12D = g->eval.u12D;
		a->evalStack[a->evalStackDepth].u22D = g->eval.u22D;
		a->evalStack[a->evalStackDepth].vn2D = g->eval.vn2D;
		a->evalStack[a->evalStackDepth].v12D = g->eval.v12D;
		a->evalStack[a->evalStackDepth].v22D = g->eval.v22D;
		a->evalStackDepth++;
	}
	if (mask & GL_FOG_BIT)
	{
		a->fogStack[a->fogStackDepth].enable = g->fog.enable;
		a->fogStack[a->fogStackDepth].color = g->fog.color;
		a->fogStack[a->fogStackDepth].density = g->fog.density;
		a->fogStack[a->fogStackDepth].start = g->fog.start;
		a->fogStack[a->fogStackDepth].end = g->fog.end;
		a->fogStack[a->fogStackDepth].index = g->fog.index;
		a->fogStack[a->fogStackDepth].mode = g->fog.mode;
		a->fogStackDepth++;
	}
	if (mask & GL_HINT_BIT)
	{
		a->hintStack[a->hintStackDepth].perspectiveCorrection = g->hint.perspectiveCorrection;
		a->hintStack[a->hintStackDepth].pointSmooth = g->hint.pointSmooth;
		a->hintStack[a->hintStackDepth].lineSmooth = g->hint.lineSmooth;
		a->hintStack[a->hintStackDepth].polygonSmooth = g->hint.polygonSmooth;
		a->hintStack[a->hintStackDepth].fog = g->hint.fog;
#ifdef CR_EXT_clip_volume_hint
		a->hintStack[a->hintStackDepth].clipVolumeClipping = g->hint.clipVolumeClipping;
#endif
#ifdef CR_ARB_texture_compression
		a->hintStack[a->hintStackDepth].textureCompression = g->hint.textureCompression;
#endif
#ifdef CR_SGIS_generate_mipmap
		a->hintStack[a->hintStackDepth].generateMipmap = g->hint.generateMipmap;
#endif
		a->hintStackDepth++;
	}
	if (mask & GL_LIGHTING_BIT)
	{
		if (a->lightingStack[a->lightingStackDepth].light == NULL)
		{
			a->lightingStack[a->lightingStackDepth].light = (CRLight *) crCalloc( g->limits.maxLights * sizeof( CRLight ));
		}
		a->lightingStack[a->lightingStackDepth].lightModelAmbient = g->lighting.lightModelAmbient;
		a->lightingStack[a->lightingStackDepth].lightModelLocalViewer = g->lighting.lightModelLocalViewer;
		a->lightingStack[a->lightingStackDepth].lightModelTwoSide = g->lighting.lightModelTwoSide;
#if defined(CR_EXT_separate_specular_color) || defined(CR_OPENGL_VERSION_1_2)
		a->lightingStack[a->lightingStackDepth].lightModelColorControlEXT = g->lighting.lightModelColorControlEXT;
#endif
		a->lightingStack[a->lightingStackDepth].lighting = g->lighting.lighting;
		a->lightingStack[a->lightingStackDepth].colorMaterial = g->lighting.colorMaterial;
		a->lightingStack[a->lightingStackDepth].colorMaterialMode = g->lighting.colorMaterialMode;
		a->lightingStack[a->lightingStackDepth].colorMaterialFace = g->lighting.colorMaterialFace;
		for (i = 0 ; i < g->limits.maxLights; i++)
		{
			a->lightingStack[a->lightingStackDepth].light[i].enable = g->lighting.light[i].enable;
			a->lightingStack[a->lightingStackDepth].light[i].ambient = g->lighting.light[i].ambient;
			a->lightingStack[a->lightingStackDepth].light[i].diffuse = g->lighting.light[i].diffuse;
			a->lightingStack[a->lightingStackDepth].light[i].specular = g->lighting.light[i].specular;
			a->lightingStack[a->lightingStackDepth].light[i].spotDirection = g->lighting.light[i].spotDirection;
			a->lightingStack[a->lightingStackDepth].light[i].position = g->lighting.light[i].position;
			a->lightingStack[a->lightingStackDepth].light[i].spotExponent = g->lighting.light[i].spotExponent;
			a->lightingStack[a->lightingStackDepth].light[i].spotCutoff = g->lighting.light[i].spotCutoff;
			a->lightingStack[a->lightingStackDepth].light[i].constantAttenuation = g->lighting.light[i].constantAttenuation;
			a->lightingStack[a->lightingStackDepth].light[i].linearAttenuation = g->lighting.light[i].linearAttenuation;
			a->lightingStack[a->lightingStackDepth].light[i].quadraticAttenuation = g->lighting.light[i].quadraticAttenuation;
		}
		for (i = 0 ; i < 2 ; i++)
		{
			a->lightingStack[a->lightingStackDepth].ambient[i] = g->lighting.ambient[i];
			a->lightingStack[a->lightingStackDepth].diffuse[i] = g->lighting.diffuse[i];
			a->lightingStack[a->lightingStackDepth].specular[i] = g->lighting.specular[i];
			a->lightingStack[a->lightingStackDepth].emission[i] = g->lighting.emission[i];
			a->lightingStack[a->lightingStackDepth].shininess[i] = g->lighting.shininess[i];
			a->lightingStack[a->lightingStackDepth].indexes[i][0] = g->lighting.indexes[i][0];
			a->lightingStack[a->lightingStackDepth].indexes[i][1] = g->lighting.indexes[i][1];
			a->lightingStack[a->lightingStackDepth].indexes[i][2] = g->lighting.indexes[i][2];
		}
		a->lightingStack[a->lightingStackDepth].shadeModel = g->lighting.shadeModel;
		a->lightingStackDepth++;
	}
	if (mask & GL_LINE_BIT)
	{
		a->lineStack[a->lineStackDepth].lineSmooth = g->line.lineSmooth;
		a->lineStack[a->lineStackDepth].lineStipple = g->line.lineStipple;
		a->lineStack[a->lineStackDepth].pattern = g->line.pattern;
		a->lineStack[a->lineStackDepth].repeat = g->line.repeat;
		a->lineStack[a->lineStackDepth].width = g->line.width;
		a->lineStackDepth++;
	}
	if (mask & GL_LIST_BIT)
	{
		a->listStack[a->listStackDepth].base = g->lists.base;
		a->listStackDepth++;
	}
	if (mask & GL_PIXEL_MODE_BIT)
	{
		a->pixelModeStack[a->pixelModeStackDepth].bias = g->pixel.bias;
		a->pixelModeStack[a->pixelModeStackDepth].scale = g->pixel.scale;
		a->pixelModeStack[a->pixelModeStackDepth].indexOffset = g->pixel.indexOffset;
		a->pixelModeStack[a->pixelModeStackDepth].indexShift = g->pixel.indexShift;
		a->pixelModeStack[a->pixelModeStackDepth].mapColor = g->pixel.mapColor;
		a->pixelModeStack[a->pixelModeStackDepth].mapStencil = g->pixel.mapStencil;
		a->pixelModeStack[a->pixelModeStackDepth].xZoom = g->pixel.xZoom;
		a->pixelModeStack[a->pixelModeStackDepth].yZoom = g->pixel.yZoom;
		a->pixelModeStack[a->pixelModeStackDepth].readBuffer = g->buffer.readBuffer;
		a->pixelModeStackDepth++;
	}
	if (mask & GL_POINT_BIT)
	{
		a->pointStack[a->pointStackDepth].pointSmooth = g->point.pointSmooth;
#if CR_ARB_point_sprite
		a->pointStack[a->pointStackDepth].pointSprite = g->point.pointSprite;
		for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++)
			a->pointStack[a->enableStackDepth].coordReplacement[i] = g->point.coordReplacement[i];
#endif
		a->pointStack[a->pointStackDepth].pointSize = g->point.pointSize;
		a->pointStackDepth++;
	}
	if (mask & GL_POLYGON_BIT)
	{
		a->polygonStack[a->polygonStackDepth].cullFace = g->polygon.cullFace;
		a->polygonStack[a->polygonStackDepth].cullFaceMode = g->polygon.cullFaceMode;
		a->polygonStack[a->polygonStackDepth].frontFace = g->polygon.frontFace;
		a->polygonStack[a->polygonStackDepth].frontMode = g->polygon.frontMode;
		a->polygonStack[a->polygonStackDepth].backMode = g->polygon.backMode;
		a->polygonStack[a->polygonStackDepth].polygonSmooth = g->polygon.polygonSmooth;
		a->polygonStack[a->polygonStackDepth].polygonStipple = g->polygon.polygonStipple;
		a->polygonStack[a->polygonStackDepth].polygonOffsetFill = g->polygon.polygonOffsetFill;
		a->polygonStack[a->polygonStackDepth].polygonOffsetLine = g->polygon.polygonOffsetLine;
		a->polygonStack[a->polygonStackDepth].polygonOffsetPoint = g->polygon.polygonOffsetPoint;
		a->polygonStack[a->polygonStackDepth].offsetFactor = g->polygon.offsetFactor;
		a->polygonStack[a->polygonStackDepth].offsetUnits = g->polygon.offsetUnits;
		a->polygonStackDepth++;
	}
	if (mask & GL_POLYGON_STIPPLE_BIT)
	{
		crMemcpy( a->polygonStippleStack[a->polygonStippleStackDepth].pattern, g->polygon.stipple, 32*sizeof(GLint) );
		a->polygonStippleStackDepth++;
	}
	if (mask & GL_SCISSOR_BIT)
	{
		a->scissorStack[a->scissorStackDepth].scissorTest = g->viewport.scissorTest;
		a->scissorStack[a->scissorStackDepth].scissorX = g->viewport.scissorX;
		a->scissorStack[a->scissorStackDepth].scissorY = g->viewport.scissorY;
		a->scissorStack[a->scissorStackDepth].scissorW = g->viewport.scissorW;
		a->scissorStack[a->scissorStackDepth].scissorH = g->viewport.scissorH;
		a->scissorStackDepth++;
	}
	if (mask & GL_STENCIL_BUFFER_BIT)
	{
		a->stencilBufferStack[a->stencilBufferStackDepth].stencilTest = g->stencil.stencilTest;
		a->stencilBufferStack[a->stencilBufferStackDepth].func = g->stencil.func;
		a->stencilBufferStack[a->stencilBufferStackDepth].mask = g->stencil.mask;
		a->stencilBufferStack[a->stencilBufferStackDepth].ref = g->stencil.ref;
		a->stencilBufferStack[a->stencilBufferStackDepth].fail = g->stencil.fail;
		a->stencilBufferStack[a->stencilBufferStackDepth].passDepthFail = g->stencil.passDepthFail;
		a->stencilBufferStack[a->stencilBufferStackDepth].passDepthPass = g->stencil.passDepthPass;
		a->stencilBufferStack[a->stencilBufferStackDepth].clearValue = g->stencil.clearValue;
		a->stencilBufferStack[a->stencilBufferStackDepth].writeMask = g->stencil.writeMask;
		a->stencilBufferStackDepth++;
	}
	if (mask & GL_TEXTURE_BIT)
	{
		CRTextureStack *tState = a->textureStack + a->textureStackDepth;
		tState->curTextureUnit = g->texture.curTextureUnit;
		for (i = 0 ; i < g->limits.maxTextureUnits ; i++)
		{
			/* per-unit state */
			copy_texunit(&tState->unit[i], &g->texture.unit[i]);
			/* texture object state */
			copy_texobj(&tState->unit[i].Saved1D, g->texture.unit[i].currentTexture1D, GL_TRUE);
			copy_texobj(&tState->unit[i].Saved2D, g->texture.unit[i].currentTexture2D, GL_TRUE);
#ifdef CR_OPENGL_VERSION_1_2
			copy_texobj(&tState->unit[i].Saved3D, g->texture.unit[i].currentTexture3D, GL_TRUE);
#endif
#ifdef CR_ARB_texture_cube_map
			copy_texobj(&tState->unit[i].SavedCubeMap, g->texture.unit[i].currentTextureCubeMap, GL_TRUE);
#endif
#ifdef CR_NV_texture_rectangle
			copy_texobj(&tState->unit[i].SavedRect, g->texture.unit[i].currentTextureRect, GL_TRUE);
#endif
		}
		a->textureStackDepth++;
	}
	if (mask & GL_TRANSFORM_BIT)
	{
		if (a->transformStack[a->transformStackDepth].clip == NULL)
		{
			a->transformStack[a->transformStackDepth].clip = (GLboolean *) crCalloc( g->limits.maxClipPlanes * sizeof( GLboolean ));
		}
		if (a->transformStack[a->transformStackDepth].clipPlane == NULL)
		{
			a->transformStack[a->transformStackDepth].clipPlane = (GLvectord *) crCalloc( g->limits.maxClipPlanes * sizeof( GLvectord ));
		}
		a->transformStack[a->transformStackDepth].matrixMode = g->transform.matrixMode;
		for (i = 0 ; i < g->limits.maxClipPlanes ; i++)
		{
			a->transformStack[a->transformStackDepth].clip[i] = g->transform.clip[i];
			a->transformStack[a->transformStackDepth].clipPlane[i] = g->transform.clipPlane[i];
		}
		a->transformStack[a->transformStackDepth].normalize = g->transform.normalize;
#ifdef CR_OPENGL_VERSION_1_2
		a->transformStack[a->transformStackDepth].rescaleNormals = g->transform.rescaleNormals;
#endif
		a->transformStackDepth++;
	}
	if (mask & GL_VIEWPORT_BIT)
	{
		a->viewportStack[a->viewportStackDepth].viewportX = g->viewport.viewportX;
		a->viewportStack[a->viewportStackDepth].viewportY = g->viewport.viewportY;
		a->viewportStack[a->viewportStackDepth].viewportW = g->viewport.viewportW;
		a->viewportStack[a->viewportStackDepth].viewportH = g->viewport.viewportH;
		a->viewportStack[a->viewportStackDepth].nearClip = g->viewport.nearClip;
		a->viewportStack[a->viewportStackDepth].farClip = g->viewport.farClip;
		a->viewportStackDepth++;
	}

	DIRTY(ab->dirty, g->neg_bitid);
}

void STATE_APIENTRY crStatePopAttrib(void)
{
	CRContext *g = GetCurrentContext();
	CRAttribState *a = &(g->attrib);
	CRStateBits *sb = GetCurrentBits();
	CRAttribBits *ab = &(sb->attrib);
	CRbitvalue mask;
	unsigned int i;

	if (g->current.inBeginEnd)
	{
		crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glPopAttrib called in Begin/End");
		return;
	}

	if (a->attribStackDepth == 0)
	{
		crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty stack!" );
		return;
	}

	FLUSH();

	mask = a->pushMaskStack[--a->attribStackDepth];

	if (mask & GL_ACCUM_BUFFER_BIT)
	{
		if (a->accumBufferStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty accum buffer stack!" );
			return;
		}
		a->accumBufferStackDepth--;
		g->buffer.accumClearValue = a->accumBufferStack[a->accumBufferStackDepth].accumClearValue;
		DIRTY(sb->buffer.dirty, g->neg_bitid);
		DIRTY(sb->buffer.clearAccum, g->neg_bitid);
	}
	if (mask & GL_COLOR_BUFFER_BIT)
	{
		if (a->colorBufferStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty color buffer stack!" );
			return;
		}
		a->colorBufferStackDepth--;
		g->buffer.alphaTest = a->colorBufferStack[a->colorBufferStackDepth].alphaTest;
		g->buffer.alphaTestFunc = a->colorBufferStack[a->colorBufferStackDepth].alphaTestFunc;
		g->buffer.alphaTestRef = a->colorBufferStack[a->colorBufferStackDepth].alphaTestRef;
		g->buffer.blend = a->colorBufferStack[a->colorBufferStackDepth].blend;
		g->buffer.blendSrcRGB = a->colorBufferStack[a->colorBufferStackDepth].blendSrcRGB;
		g->buffer.blendDstRGB = a->colorBufferStack[a->colorBufferStackDepth].blendDstRGB;
#if defined(CR_EXT_blend_func_separate)
		g->buffer.blendSrcA = a->colorBufferStack[a->colorBufferStackDepth].blendSrcA;
		g->buffer.blendDstA = a->colorBufferStack[a->colorBufferStackDepth].blendDstA;
#endif
#ifdef CR_EXT_blend_color
		g->buffer.blendColor = a->colorBufferStack[a->colorBufferStackDepth].blendColor;
#endif
#if defined(CR_EXT_blend_minmax) || defined(CR_EXT_blend_subtract) || defined(CR_EXT_blend_logic_op)
		g->buffer.blendEquation = a->colorBufferStack[a->colorBufferStackDepth].blendEquation;
#endif
		g->buffer.dither = a->colorBufferStack[a->colorBufferStackDepth].dither;
		g->buffer.drawBuffer = a->colorBufferStack[a->colorBufferStackDepth].drawBuffer;
		g->buffer.logicOp = a->colorBufferStack[a->colorBufferStackDepth].logicOp;
	 	g->buffer.indexLogicOp = a->colorBufferStack[a->colorBufferStackDepth].indexLogicOp;
		g->buffer.logicOpMode = a->colorBufferStack[a->colorBufferStackDepth].logicOpMode;
		g->buffer.colorClearValue = a->colorBufferStack[a->colorBufferStackDepth].colorClearValue;
		g->buffer.indexClearValue = a->colorBufferStack[a->colorBufferStackDepth].indexClearValue;
		g->buffer.colorWriteMask = a->colorBufferStack[a->colorBufferStackDepth].colorWriteMask;
		g->buffer.indexWriteMask = a->colorBufferStack[a->colorBufferStackDepth].indexWriteMask;
		DIRTY(sb->buffer.dirty, g->neg_bitid);
		DIRTY(sb->buffer.enable, g->neg_bitid);
		DIRTY(sb->buffer.alphaFunc, g->neg_bitid);
		DIRTY(sb->buffer.blendFunc, g->neg_bitid);
#ifdef CR_EXT_blend_color
		DIRTY(sb->buffer.blendColor, g->neg_bitid);
#endif
#if defined(CR_EXT_blend_minmax) || defined(CR_EXT_blend_subtract) || defined(CR_EXT_blend_logic_op)
		DIRTY(sb->buffer.blendEquation, g->neg_bitid);
#endif
		DIRTY(sb->buffer.drawBuffer, g->neg_bitid);
		DIRTY(sb->buffer.logicOp, g->neg_bitid);
		DIRTY(sb->buffer.indexLogicOp, g->neg_bitid);
		DIRTY(sb->buffer.clearColor, g->neg_bitid);
		DIRTY(sb->buffer.clearIndex, g->neg_bitid);
		DIRTY(sb->buffer.colorWriteMask, g->neg_bitid);
		DIRTY(sb->buffer.indexMask, g->neg_bitid);
	}
	if (mask & GL_CURRENT_BIT)
	{
		if (a->currentStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty current stack!" );
			return;
		}
		a->currentStackDepth--;
		for (i = 0 ; i < CR_MAX_VERTEX_ATTRIBS ; i++)
		{
			COPY_4V(g->current.vertexAttrib[i], a->currentStack[a->currentStackDepth].attrib[i]);
			COPY_4V(g->current.rasterAttrib[i],  a->currentStack[a->currentStackDepth].rasterAttrib[i]);
			DIRTY(sb->current.vertexAttrib[i], g->neg_bitid);
		}
		g->current.rasterValid = a->currentStack[a->currentStackDepth].rasterValid;
		g->current.edgeFlag = a->currentStack[a->currentStackDepth].edgeFlag;
		g->current.colorIndex = a->currentStack[a->currentStackDepth].colorIndex;
		DIRTY(sb->current.dirty, g->neg_bitid);
		DIRTY(sb->current.edgeFlag, g->neg_bitid);
		DIRTY(sb->current.colorIndex, g->neg_bitid);
		DIRTY(sb->current.rasterPos, g->neg_bitid);
	}
	if (mask & GL_DEPTH_BUFFER_BIT)
	{
		if (a->depthBufferStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty depth buffer stack!" );
			return;
		}
		a->depthBufferStackDepth--;
		g->buffer.depthTest = a->depthBufferStack[a->depthBufferStackDepth].depthTest;
		g->buffer.depthFunc = a->depthBufferStack[a->depthBufferStackDepth].depthFunc;
		g->buffer.depthClearValue = a->depthBufferStack[a->depthBufferStackDepth].depthClearValue;
		g->buffer.depthMask = a->depthBufferStack[a->depthBufferStackDepth].depthMask;
		DIRTY(sb->buffer.dirty, g->neg_bitid);
		DIRTY(sb->buffer.enable, g->neg_bitid);
		DIRTY(sb->buffer.depthFunc, g->neg_bitid);
		DIRTY(sb->buffer.clearDepth, g->neg_bitid);
		DIRTY(sb->buffer.depthMask, g->neg_bitid);
	}
	if (mask & GL_ENABLE_BIT)
	{
		if (a->enableStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty enable stack!" );
			return;
		}
		a->enableStackDepth--;
		g->buffer.alphaTest = a->enableStack[a->enableStackDepth].alphaTest;
		g->eval.autoNormal = a->enableStack[a->enableStackDepth].autoNormal;
		g->buffer.blend = a->enableStack[a->enableStackDepth].blend;
		for (i = 0 ; i < g->limits.maxClipPlanes ; i++)
		{
			g->transform.clip[i] = a->enableStack[a->enableStackDepth].clip[i];
		}
		g->lighting.colorMaterial = a->enableStack[a->enableStackDepth].colorMaterial;
		g->polygon.cullFace = a->enableStack[a->enableStackDepth].cullFace;
		g->buffer.depthTest = a->enableStack[a->enableStackDepth].depthTest;
		g->buffer.dither = a->enableStack[a->enableStackDepth].dither;
		g->fog.enable = a->enableStack[a->enableStackDepth].fog;
		for (i = 0 ; i < g->limits.maxLights ; i++)
		{
			g->lighting.light[i].enable = a->enableStack[a->enableStackDepth].light[i];
		}
		g->lighting.lighting = a->enableStack[a->enableStackDepth].lighting;
		g->line.lineSmooth = a->enableStack[a->enableStackDepth].lineSmooth;
		g->line.lineStipple = a->enableStack[a->enableStackDepth].lineStipple;
		g->buffer.logicOp = a->enableStack[a->enableStackDepth].logicOp;
		g->buffer.indexLogicOp = a->enableStack[a->enableStackDepth].indexLogicOp;
		for (i = 0 ; i < GLEVAL_TOT ; i++)
		{
			g->eval.enable1D[i] = a->enableStack[a->enableStackDepth].map1[i];
			g->eval.enable2D[i] = a->enableStack[a->enableStackDepth].map2[i];
		}
		g->transform.normalize = a->enableStack[a->enableStackDepth].normalize;
		g->point.pointSmooth = a->enableStack[a->enableStackDepth].pointSmooth;
#ifdef CR_ARB_point_sprite
		g->point.pointSprite = a->enableStack[a->enableStackDepth].pointSprite;
		for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++)
			g->point.coordReplacement[i] = a->enableStack[a->enableStackDepth].coordReplacement[i];
#endif
		g->polygon.polygonOffsetLine = a->enableStack[a->enableStackDepth].polygonOffsetLine;
		g->polygon.polygonOffsetFill = a->enableStack[a->enableStackDepth].polygonOffsetFill;
		g->polygon.polygonOffsetPoint = a->enableStack[a->enableStackDepth].polygonOffsetPoint;
		g->polygon.polygonSmooth = a->enableStack[a->enableStackDepth].polygonSmooth;
		g->polygon.polygonStipple = a->enableStack[a->enableStackDepth].polygonStipple;
#ifdef CR_OPENGL_VERSION_1_2
		g->transform.rescaleNormals = a->enableStack[a->enableStackDepth].rescaleNormals;
#endif
		g->viewport.scissorTest = a->enableStack[a->enableStackDepth].scissorTest;
		g->stencil.stencilTest = a->enableStack[a->enableStackDepth].stencilTest;
		for (i = 0 ; i < g->limits.maxTextureUnits; i++)
		{
			g->texture.unit[i].enabled1D = a->enableStack[a->enableStackDepth].texture1D[i];
			g->texture.unit[i].enabled2D = a->enableStack[a->enableStackDepth].texture2D[i];
#ifdef CR_OPENGL_VERSION_1_2
			g->texture.unit[i].enabled3D = a->enableStack[a->enableStackDepth].texture3D[i];
#endif
#ifdef CR_ARB_texture_cube_map
			g->texture.unit[i].enabledCubeMap = a->enableStack[a->enableStackDepth].textureCubeMap[i];
#endif
#ifdef CR_NV_texture_rectangle
			g->texture.unit[i].enabledRect = a->enableStack[a->enableStackDepth].textureRect[i];
#endif
			g->texture.unit[i].textureGen.s = a->enableStack[a->enableStackDepth].textureGenS[i];
			g->texture.unit[i].textureGen.t = a->enableStack[a->enableStackDepth].textureGenT[i];
			g->texture.unit[i].textureGen.r = a->enableStack[a->enableStackDepth].textureGenR[i];
			g->texture.unit[i].textureGen.q = a->enableStack[a->enableStackDepth].textureGenQ[i];
		}
		DIRTY(sb->buffer.dirty, g->neg_bitid);
		DIRTY(sb->eval.dirty, g->neg_bitid);
		DIRTY(sb->transform.dirty, g->neg_bitid);
		DIRTY(sb->lighting.dirty, g->neg_bitid);
		DIRTY(sb->fog.dirty, g->neg_bitid);
		DIRTY(sb->line.dirty, g->neg_bitid);
		DIRTY(sb->polygon.dirty, g->neg_bitid);
		DIRTY(sb->viewport.dirty, g->neg_bitid);
		DIRTY(sb->stencil.dirty, g->neg_bitid);
		DIRTY(sb->texture.dirty, g->neg_bitid);

		DIRTY(sb->buffer.enable, g->neg_bitid);
		DIRTY(sb->eval.enable, g->neg_bitid);
		DIRTY(sb->transform.enable, g->neg_bitid);
		DIRTY(sb->lighting.enable, g->neg_bitid);
		DIRTY(sb->fog.enable, g->neg_bitid);
		DIRTY(sb->line.enable, g->neg_bitid);
		DIRTY(sb->polygon.enable, g->neg_bitid);
		DIRTY(sb->viewport.enable, g->neg_bitid);
		DIRTY(sb->stencil.enable, g->neg_bitid);
		for (i = 0 ; i < g->limits.maxTextureUnits ; i++)
		{
			DIRTY(sb->texture.enable[i], g->neg_bitid);
		}
	}
	if (mask & GL_EVAL_BIT)
	{
		if (a->evalStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty eval stack!" );
			return;
		}
		a->evalStackDepth--;
		for (i = 0 ; i < GLEVAL_TOT ; i++)
		{
			int size1 = a->evalStack[a->evalStackDepth].eval1D[i].order * gleval_sizes[i] * sizeof(GLfloat);
			int size2 = a->evalStack[a->evalStackDepth].eval2D[i].uorder * a->evalStack[a->evalStackDepth].eval2D[i].vorder * gleval_sizes[i] * sizeof (GLfloat);
			g->eval.enable1D[i] = a->evalStack[a->evalStackDepth].enable1D[i];
			g->eval.enable2D[i] = a->evalStack[a->evalStackDepth].enable2D[i];
			g->eval.eval1D[i].u1 = a->evalStack[a->evalStackDepth].eval1D[i].u1;
			g->eval.eval1D[i].u2 = a->evalStack[a->evalStackDepth].eval1D[i].u2;
			g->eval.eval1D[i].order = a->evalStack[a->evalStackDepth].eval1D[i].order;
			crMemcpy((char*)g->eval.eval1D[i].coeff, a->evalStack[a->evalStackDepth].eval1D[i].coeff, size1);
			crFree(a->evalStack[a->evalStackDepth].eval1D[i].coeff);
			g->eval.eval2D[i].u1 = a->evalStack[a->evalStackDepth].eval2D[i].u1;
			g->eval.eval2D[i].u2 = a->evalStack[a->evalStackDepth].eval2D[i].u2;
			g->eval.eval2D[i].v1 = a->evalStack[a->evalStackDepth].eval2D[i].v1;
			g->eval.eval2D[i].v2 = a->evalStack[a->evalStackDepth].eval2D[i].v2;
			g->eval.eval2D[i].uorder = a->evalStack[a->evalStackDepth].eval2D[i].uorder;
			g->eval.eval2D[i].vorder = a->evalStack[a->evalStackDepth].eval2D[i].vorder;
			crMemcpy((char*)g->eval.eval2D[i].coeff, a->evalStack[a->evalStackDepth].eval2D[i].coeff, size2);
			crFree(a->evalStack[a->evalStackDepth].eval2D[i].coeff);
		}
		g->eval.autoNormal = a->evalStack[a->evalStackDepth].autoNormal;
		g->eval.un1D = a->evalStack[a->evalStackDepth].un1D;
		g->eval.u11D = a->evalStack[a->evalStackDepth].u11D;
		g->eval.u21D = a->evalStack[a->evalStackDepth].u21D;
		g->eval.un2D = a->evalStack[a->evalStackDepth].un2D;
		g->eval.u12D = a->evalStack[a->evalStackDepth].u12D;
		g->eval.u22D = a->evalStack[a->evalStackDepth].u22D;
		g->eval.vn2D = a->evalStack[a->evalStackDepth].vn2D;
		g->eval.v12D = a->evalStack[a->evalStackDepth].v12D;
		g->eval.v22D = a->evalStack[a->evalStackDepth].v22D;
		for (i = 0; i < GLEVAL_TOT; i++) {
   			DIRTY(sb->eval.eval1D[i], g->neg_bitid);
   			DIRTY(sb->eval.eval2D[i], g->neg_bitid);
		}
   		DIRTY(sb->eval.dirty, g->neg_bitid);
		DIRTY(sb->eval.grid1D, g->neg_bitid);
		DIRTY(sb->eval.grid2D, g->neg_bitid);
		DIRTY(sb->eval.enable, g->neg_bitid);
	}
	if (mask & GL_FOG_BIT)
	{
		if (a->fogStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty fog stack!" );
			return;
		}
		a->fogStackDepth--;
		g->fog.enable = a->fogStack[a->fogStackDepth].enable;
		g->fog.color = a->fogStack[a->fogStackDepth].color;
		g->fog.density = a->fogStack[a->fogStackDepth].density;
		g->fog.start = a->fogStack[a->fogStackDepth].start;
		g->fog.end = a->fogStack[a->fogStackDepth].end;
		g->fog.index = a->fogStack[a->fogStackDepth].index;
		g->fog.mode = a->fogStack[a->fogStackDepth].mode;
		DIRTY(sb->fog.dirty, g->neg_bitid);
		DIRTY(sb->fog.color, g->neg_bitid);
		DIRTY(sb->fog.index, g->neg_bitid);
		DIRTY(sb->fog.density, g->neg_bitid);
		DIRTY(sb->fog.start, g->neg_bitid);
		DIRTY(sb->fog.end, g->neg_bitid);
		DIRTY(sb->fog.mode, g->neg_bitid);
		DIRTY(sb->fog.enable, g->neg_bitid);
	}
	if (mask & GL_HINT_BIT)
	{
		if (a->hintStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty hint stack!" );
			return;
		}
		a->hintStackDepth--;
		g->hint.perspectiveCorrection = a->hintStack[a->hintStackDepth].perspectiveCorrection;
		g->hint.pointSmooth = a->hintStack[a->hintStackDepth].pointSmooth;
		g->hint.lineSmooth = a->hintStack[a->hintStackDepth].lineSmooth;
		g->hint.polygonSmooth = a->hintStack[a->hintStackDepth].polygonSmooth;
		g->hint.fog = a->hintStack[a->hintStackDepth].fog;
		DIRTY(sb->hint.dirty, g->neg_bitid);
		DIRTY(sb->hint.perspectiveCorrection, g->neg_bitid);
		DIRTY(sb->hint.pointSmooth, g->neg_bitid);
		DIRTY(sb->hint.lineSmooth, g->neg_bitid);
		DIRTY(sb->hint.polygonSmooth, g->neg_bitid);
#ifdef CR_EXT_clip_volume_hint
		g->hint.clipVolumeClipping = a->hintStack[a->hintStackDepth].clipVolumeClipping;
		DIRTY(sb->hint.clipVolumeClipping, g->neg_bitid);
#endif
#ifdef CR_ARB_texture_compression
		g->hint.textureCompression = a->hintStack[a->hintStackDepth].textureCompression;
		DIRTY(sb->hint.textureCompression, g->neg_bitid);
#endif
#ifdef CR_SGIS_generate_mipmap
		g->hint.generateMipmap = a->hintStack[a->hintStackDepth].generateMipmap;
		DIRTY(sb->hint.generateMipmap, g->neg_bitid);
#endif
	}
	if (mask & GL_LIGHTING_BIT)
	{
		if (a->lightingStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty lighting stack!" );
			return;
		}
		a->lightingStackDepth--;
		g->lighting.lightModelAmbient = a->lightingStack[a->lightingStackDepth].lightModelAmbient;
		g->lighting.lightModelLocalViewer = a->lightingStack[a->lightingStackDepth].lightModelLocalViewer;
		g->lighting.lightModelTwoSide = a->lightingStack[a->lightingStackDepth].lightModelTwoSide;
#if defined(CR_EXT_separate_specular_color) || defined(CR_OPENGL_VERSION_1_2)
		g->lighting.lightModelColorControlEXT = a->lightingStack[a->lightingStackDepth].lightModelColorControlEXT;
#endif
		g->lighting.lighting = a->lightingStack[a->lightingStackDepth].lighting;
		g->lighting.colorMaterial = a->lightingStack[a->lightingStackDepth].colorMaterial;
		g->lighting.colorMaterialMode = a->lightingStack[a->lightingStackDepth].colorMaterialMode;
		g->lighting.colorMaterialFace = a->lightingStack[a->lightingStackDepth].colorMaterialFace;
		for (i = 0 ; i < g->limits.maxLights; i++)
		{
			g->lighting.light[i].enable = a->lightingStack[a->lightingStackDepth].light[i].enable;
			g->lighting.light[i].ambient = a->lightingStack[a->lightingStackDepth].light[i].ambient;
			g->lighting.light[i].diffuse = a->lightingStack[a->lightingStackDepth].light[i].diffuse;
			g->lighting.light[i].specular = a->lightingStack[a->lightingStackDepth].light[i].specular;
			g->lighting.light[i].spotDirection = a->lightingStack[a->lightingStackDepth].light[i].spotDirection;
			g->lighting.light[i].position = a->lightingStack[a->lightingStackDepth].light[i].position;
			g->lighting.light[i].spotExponent = a->lightingStack[a->lightingStackDepth].light[i].spotExponent;
			g->lighting.light[i].spotCutoff = a->lightingStack[a->lightingStackDepth].light[i].spotCutoff;
			g->lighting.light[i].constantAttenuation = a->lightingStack[a->lightingStackDepth].light[i].constantAttenuation;
			g->lighting.light[i].linearAttenuation = a->lightingStack[a->lightingStackDepth].light[i].linearAttenuation;
			g->lighting.light[i].quadraticAttenuation = a->lightingStack[a->lightingStackDepth].light[i].quadraticAttenuation;
		}
		for (i = 0 ; i < 2 ; i++)
		{
			g->lighting.ambient[i] = a->lightingStack[a->lightingStackDepth].ambient[i];
			g->lighting.diffuse[i] = a->lightingStack[a->lightingStackDepth].diffuse[i];
			g->lighting.specular[i] = a->lightingStack[a->lightingStackDepth].specular[i];
			g->lighting.emission[i] = a->lightingStack[a->lightingStackDepth].emission[i];
			g->lighting.shininess[i] = a->lightingStack[a->lightingStackDepth].shininess[i];
			g->lighting.indexes[i][0] = a->lightingStack[a->lightingStackDepth].indexes[i][0];
			g->lighting.indexes[i][1] = a->lightingStack[a->lightingStackDepth].indexes[i][1];
			g->lighting.indexes[i][2] = a->lightingStack[a->lightingStackDepth].indexes[i][2];
		}
		g->lighting.shadeModel = a->lightingStack[a->lightingStackDepth].shadeModel;
		DIRTY(sb->lighting.dirty, g->neg_bitid);
		DIRTY(sb->lighting.shadeModel, g->neg_bitid);
		DIRTY(sb->lighting.lightModel, g->neg_bitid);
		DIRTY(sb->lighting.material, g->neg_bitid);
		DIRTY(sb->lighting.enable, g->neg_bitid);
		for (i = 0 ; i < g->limits.maxLights; i++)
		{
			DIRTY(sb->lighting.light[i].dirty, g->neg_bitid);
			DIRTY(sb->lighting.light[i].enable, g->neg_bitid);
			DIRTY(sb->lighting.light[i].ambient, g->neg_bitid);
			DIRTY(sb->lighting.light[i].diffuse, g->neg_bitid);
			DIRTY(sb->lighting.light[i].specular, g->neg_bitid);
			DIRTY(sb->lighting.light[i].position, g->neg_bitid);
			DIRTY(sb->lighting.light[i].attenuation, g->neg_bitid);
			DIRTY(sb->lighting.light[i].spot, g->neg_bitid);
		}
	}
	if (mask & GL_LINE_BIT)
	{
		if (a->lineStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty line stack!" );
			return;
		}
		a->lineStackDepth--;
		g->line.lineSmooth = a->lineStack[a->lineStackDepth].lineSmooth;
		g->line.lineStipple = a->lineStack[a->lineStackDepth].lineStipple;
		g->line.pattern = a->lineStack[a->lineStackDepth].pattern;
		g->line.repeat = a->lineStack[a->lineStackDepth].repeat;
		g->line.width = a->lineStack[a->lineStackDepth].width;
		DIRTY(sb->line.dirty, g->neg_bitid);
		DIRTY(sb->line.enable, g->neg_bitid);
		DIRTY(sb->line.width, g->neg_bitid);
		DIRTY(sb->line.stipple, g->neg_bitid);
	}
	if (mask & GL_LIST_BIT)
	{
		if (a->listStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty list stack!" );
			return;
		}
		a->listStackDepth--;
		g->lists.base = a->listStack[a->listStackDepth].base;
		DIRTY(sb->lists.dirty, g->neg_bitid);
	}
	if (mask & GL_PIXEL_MODE_BIT)
	{
		if (a->pixelModeStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty pixel mode stack!" );
			return;
		}
		a->pixelModeStackDepth--;
		g->pixel.bias = a->pixelModeStack[a->pixelModeStackDepth].bias;
		g->pixel.scale = a->pixelModeStack[a->pixelModeStackDepth].scale;
		g->pixel.indexOffset = a->pixelModeStack[a->pixelModeStackDepth].indexOffset;
		g->pixel.indexShift = a->pixelModeStack[a->pixelModeStackDepth].indexShift;
		g->pixel.mapColor = a->pixelModeStack[a->pixelModeStackDepth].mapColor;
		g->pixel.mapStencil = a->pixelModeStack[a->pixelModeStackDepth].mapStencil;
		g->pixel.xZoom = a->pixelModeStack[a->pixelModeStackDepth].xZoom;
		g->pixel.yZoom = a->pixelModeStack[a->pixelModeStackDepth].yZoom;
		g->buffer.readBuffer = a->pixelModeStack[a->pixelModeStackDepth].readBuffer;
		DIRTY(sb->pixel.dirty, g->neg_bitid);
		DIRTY(sb->pixel.transfer, g->neg_bitid);
		DIRTY(sb->pixel.zoom, g->neg_bitid);
		DIRTY(sb->buffer.dirty, g->neg_bitid);
		DIRTY(sb->buffer.readBuffer, g->neg_bitid);
	}
	if (mask & GL_POINT_BIT)
	{
		if (a->pointStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty point stack!" );
			return;
		}
		a->pointStackDepth--;
		g->point.pointSmooth = a->pointStack[a->pointStackDepth].pointSmooth;
		g->point.pointSize = a->pointStack[a->pointStackDepth].pointSize;
#if GL_ARB_point_sprite
		g->point.pointSprite = a->pointStack[a->pointStackDepth].pointSprite;
		DIRTY(sb->point.enableSprite, g->neg_bitid);
		for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++) {
			g->point.coordReplacement[i] = a->enableStack[a->enableStackDepth].coordReplacement[i];
			DIRTY(sb->point.coordReplacement[i], g->neg_bitid);
		}
#endif
		DIRTY(sb->point.dirty, g->neg_bitid);
		DIRTY(sb->point.size, g->neg_bitid);
		DIRTY(sb->point.enableSmooth, g->neg_bitid);
	}
	if (mask & GL_POLYGON_BIT)
	{
		if (a->polygonStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty polygon stack!" );
			return;
		}
		a->polygonStackDepth--;
		g->polygon.cullFace = a->polygonStack[a->polygonStackDepth].cullFace;
		g->polygon.cullFaceMode = a->polygonStack[a->polygonStackDepth].cullFaceMode;
		g->polygon.frontFace = a->polygonStack[a->polygonStackDepth].frontFace;
		g->polygon.frontMode = a->polygonStack[a->polygonStackDepth].frontMode;
		g->polygon.backMode = a->polygonStack[a->polygonStackDepth].backMode;
		g->polygon.polygonSmooth = a->polygonStack[a->polygonStackDepth].polygonSmooth;
		g->polygon.polygonStipple = a->polygonStack[a->polygonStackDepth].polygonStipple;
		g->polygon.polygonOffsetFill = a->polygonStack[a->polygonStackDepth].polygonOffsetFill;
		g->polygon.polygonOffsetLine = a->polygonStack[a->polygonStackDepth].polygonOffsetLine;
		g->polygon.polygonOffsetPoint = a->polygonStack[a->polygonStackDepth].polygonOffsetPoint;
		g->polygon.offsetFactor = a->polygonStack[a->polygonStackDepth].offsetFactor;
		g->polygon.offsetUnits = a->polygonStack[a->polygonStackDepth].offsetUnits;
		DIRTY(sb->polygon.dirty, g->neg_bitid);
		DIRTY(sb->polygon.enable, g->neg_bitid);
		DIRTY(sb->polygon.offset, g->neg_bitid);
		DIRTY(sb->polygon.mode, g->neg_bitid);
		DIRTY(sb->polygon.stipple, g->neg_bitid);
	}
	if (mask & GL_POLYGON_STIPPLE_BIT)
	{
		if (a->polygonStippleStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty polygon stipple stack!" );
			return;
		}
		a->polygonStippleStackDepth--;
		crMemcpy( g->polygon.stipple, a->polygonStippleStack[a->polygonStippleStackDepth].pattern, 32*sizeof(GLint) );
		DIRTY(sb->polygon.dirty, g->neg_bitid);
		DIRTY(sb->polygon.stipple, g->neg_bitid);
	}
	if (mask & GL_SCISSOR_BIT)
	{
		if (a->scissorStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty scissor stack!" );
			return;
		}
		a->scissorStackDepth--;
		g->viewport.scissorTest = a->scissorStack[a->scissorStackDepth].scissorTest;
		g->viewport.scissorX = a->scissorStack[a->scissorStackDepth].scissorX;
		g->viewport.scissorY = a->scissorStack[a->scissorStackDepth].scissorY;
		g->viewport.scissorW = a->scissorStack[a->scissorStackDepth].scissorW;
		g->viewport.scissorH = a->scissorStack[a->scissorStackDepth].scissorH;
		DIRTY(sb->viewport.dirty, g->neg_bitid);
		DIRTY(sb->viewport.enable, g->neg_bitid);
		DIRTY(sb->viewport.s_dims, g->neg_bitid);
	}
	if (mask & GL_STENCIL_BUFFER_BIT)
	{
		if (a->stencilBufferStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty stencil stack!" );
			return;
		}
		a->stencilBufferStackDepth--;
		g->stencil.stencilTest = a->stencilBufferStack[a->stencilBufferStackDepth].stencilTest;
		g->stencil.func = a->stencilBufferStack[a->stencilBufferStackDepth].func;
		g->stencil.mask = a->stencilBufferStack[a->stencilBufferStackDepth].mask;
		g->stencil.ref = a->stencilBufferStack[a->stencilBufferStackDepth].ref;
		g->stencil.fail = a->stencilBufferStack[a->stencilBufferStackDepth].fail;
		g->stencil.passDepthFail = a->stencilBufferStack[a->stencilBufferStackDepth].passDepthFail;
		g->stencil.passDepthPass = a->stencilBufferStack[a->stencilBufferStackDepth].passDepthPass;
		g->stencil.clearValue = a->stencilBufferStack[a->stencilBufferStackDepth].clearValue;
		g->stencil.writeMask = a->stencilBufferStack[a->stencilBufferStackDepth].writeMask;
		DIRTY(sb->stencil.dirty, g->neg_bitid);
		DIRTY(sb->stencil.enable, g->neg_bitid);
		DIRTY(sb->stencil.func, g->neg_bitid);
		DIRTY(sb->stencil.op, g->neg_bitid);
		DIRTY(sb->stencil.clearValue, g->neg_bitid);
		DIRTY(sb->stencil.writeMask, g->neg_bitid);
	}
	if (mask & GL_TEXTURE_BIT)
	{
		CRTextureStack *tState;
		if (a->textureStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty texture stack!" );
			return;
		}
		a->textureStackDepth--;
		tState = a->textureStack + a->textureStackDepth;

		g->texture.curTextureUnit = tState->curTextureUnit;
		for (i = 0 ; i < g->limits.maxTextureUnits ; i++)
		{
			copy_texunit(&g->texture.unit[i], &tState->unit[i]);
			/* first, restore the bindings! */
			g->texture.unit[i].currentTexture1D = crStateTextureGet(GL_TEXTURE_1D, tState->unit[i].Saved1D.name);
			copy_texobj(g->texture.unit[i].currentTexture1D, &tState->unit[i].Saved1D, GL_FALSE);
			g->texture.unit[i].currentTexture2D = crStateTextureGet(GL_TEXTURE_2D, tState->unit[i].Saved2D.name);
			copy_texobj(g->texture.unit[i].currentTexture2D, &tState->unit[i].Saved2D, GL_FALSE);
#ifdef CR_OPENGL_VERSION_1_2
			g->texture.unit[i].currentTexture3D = crStateTextureGet(GL_TEXTURE_3D, tState->unit[i].Saved3D.name);
			copy_texobj(g->texture.unit[i].currentTexture3D, &tState->unit[i].Saved3D, GL_FALSE);
#endif
#ifdef CR_ARB_texture_cube_map
			g->texture.unit[i].currentTextureCubeMap = crStateTextureGet(GL_TEXTURE_CUBE_MAP_ARB, tState->unit[i].SavedCubeMap.name);
			copy_texobj(g->texture.unit[i].currentTextureCubeMap, &tState->unit[i].SavedCubeMap, GL_FALSE);
#endif
#ifdef CR_NV_texture_rectangle
			g->texture.unit[i].currentTextureRect = crStateTextureGet(GL_TEXTURE_CUBE_MAP_ARB, tState->unit[i].SavedRect.name);
			copy_texobj(g->texture.unit[i].currentTextureRect, &tState->unit[i].SavedRect, GL_FALSE);
#endif
		}
		DIRTY(sb->texture.dirty, g->neg_bitid);
		for (i = 0 ; i < g->limits.maxTextureUnits ; i++)
		{
			DIRTY(sb->texture.enable[i], g->neg_bitid);
			DIRTY(sb->texture.current[i], g->neg_bitid);
			DIRTY(sb->texture.objGen[i], g->neg_bitid);
			DIRTY(sb->texture.eyeGen[i], g->neg_bitid);
			DIRTY(sb->texture.envBit[i], g->neg_bitid);
			DIRTY(sb->texture.genMode[i], g->neg_bitid);
		}

		for (i = 0 ; i < g->limits.maxTextureUnits ; i++)
		{
			DIRTY(g->texture.unit[i].currentTexture1D->dirty, g->neg_bitid);
			DIRTY(g->texture.unit[i].currentTexture2D->dirty, g->neg_bitid);
			DIRTY(g->texture.unit[i].currentTexture3D->dirty, g->neg_bitid);
#ifdef CR_ARB_texture_cube_map
			DIRTY(g->texture.unit[i].currentTextureCubeMap->dirty, g->neg_bitid);
#endif
#ifdef CR_NV_texture_rectangle
			DIRTY(g->texture.unit[i].currentTextureRect->dirty, g->neg_bitid);
#endif
			DIRTY(g->texture.unit[i].currentTexture1D->paramsBit[i], g->neg_bitid);
			DIRTY(g->texture.unit[i].currentTexture2D->paramsBit[i], g->neg_bitid);
			DIRTY(g->texture.unit[i].currentTexture3D->paramsBit[i], g->neg_bitid);
#ifdef CR_ARB_texture_cube_map
			DIRTY(g->texture.unit[i].currentTextureCubeMap->paramsBit[i], g->neg_bitid);
#endif
#ifdef CR_NV_texture_rectangle
			DIRTY(g->texture.unit[i].currentTextureRect->paramsBit[i], g->neg_bitid);
#endif
		}
	}
	if (mask & GL_TRANSFORM_BIT)
	{
		if (a->transformStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty transform stack!" );
			return;
		}
		a->transformStackDepth--;
		g->transform.matrixMode = a->transformStack[a->transformStackDepth].matrixMode;
		crStateMatrixMode(g->transform.matrixMode);
		for (i = 0 ; i < g->limits.maxClipPlanes ; i++)
		{
			g->transform.clip[i] = a->transformStack[a->transformStackDepth].clip[i];
			g->transform.clipPlane[i] = a->transformStack[a->transformStackDepth].clipPlane[i];
		}
		g->transform.normalize = a->transformStack[a->transformStackDepth].normalize;
#ifdef CR_OPENGL_VERSION_1_2
		g->transform.rescaleNormals = a->transformStack[a->transformStackDepth].rescaleNormals;
#endif
		DIRTY(sb->transform.dirty, g->neg_bitid);
		DIRTY(sb->transform.matrixMode, g->neg_bitid);
		DIRTY(sb->transform.clipPlane, g->neg_bitid);
		DIRTY(sb->transform.enable, g->neg_bitid);
	}
	if (mask & GL_VIEWPORT_BIT)
	{
		if (a->viewportStackDepth == 0)
		{
			crStateError(__LINE__, __FILE__, GL_STACK_UNDERFLOW, "glPopAttrib called with an empty viewport stack!" );
			return;
		}
		a->viewportStackDepth--;
		g->viewport.viewportX = a->viewportStack[a->viewportStackDepth].viewportX;
		g->viewport.viewportY = a->viewportStack[a->viewportStackDepth].viewportY;
		g->viewport.viewportW = a->viewportStack[a->viewportStackDepth].viewportW;
		g->viewport.viewportH = a->viewportStack[a->viewportStackDepth].viewportH;
		g->viewport.nearClip = a->viewportStack[a->viewportStackDepth].nearClip;
		g->viewport.farClip = a->viewportStack[a->viewportStackDepth].farClip;
		DIRTY(sb->viewport.dirty, g->neg_bitid);
		DIRTY(sb->viewport.v_dims, g->neg_bitid);
		DIRTY(sb->viewport.depth, g->neg_bitid);
	}
	DIRTY(ab->dirty, g->neg_bitid);
}

void crStateAttribSwitch( CRAttribBits *bb, CRbitvalue *bitID,
                          CRContext *fromCtx, CRContext *toCtx )
{
	CRAttribState *to = &(toCtx->attrib);
	CRAttribState *from = &(fromCtx->attrib);
	if (to->attribStackDepth != 0 || from->attribStackDepth != 0)
	{
		crWarning( "Trying to switch contexts when the attribute stacks "
							 "weren't empty.  Currently, this is not supported." );
	}
	(void) bb;
	(void) bitID;
}


text:
/*	$NetBSD: config.h,v 1.9 2012/12/13 15:36:36 roy Exp $	*/
/*	$KAME: config.h,v 1.9 2003/08/06 04:19:40 ono Exp $	*/

/*
 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE 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:
 * 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 the project 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 PROJECT 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 PROJECT 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.
 */

extern void free_rainfo(struct rainfo *);
extern void getconfig(const char *, int);
extern void delete_prefix(struct prefix *);
extern void invalidate_prefix(struct prefix *);
extern void update_prefix(struct prefix *);
extern void make_prefix(struct rainfo *, int, struct in6_addr *, int);
extern void make_packet(struct rainfo *);
extern void get_prefix(struct rainfo *);

/*
 * it is highly unlikely to have 100 information options,
 * so it should be okay to limit it
 */
#define MAXPREFIX	100
#define MAXROUTE	100
#define MAXRDNSS	100
#define MAXDNSSL	100


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><meta name=keywords content=Concord Airbus></meta>
<link rel=stylesheet type=text/css href=styles.css></link>

Posts about: "Airbus" [Posts: 64 Pages: 4]

Page Links: First
 Previous
 1
 2
 3
 4

 Last
 Index Page

AirborneAgain
8th Jan 2014, 08:23
permalink
 Post: 1771

    Quote:

      The problem with software systems is that [...] you cannot prove them to be correct

  Yes,

   you can

  , and in safety-critical applications you frequently do. (See e.g.

   this presentation from Airbus

  and

   this one from Rockwell-Collins

  .)

    Quote:

      hence the triplication, heavy emphasis on configuration control and high cost.

  Triplication (or duplication) doesn't help against software problems unless the software itself is triplicated (which happens).

DozyWannabe
9th Jan 2014, 01:07
permalink
 Post: 1772

    Quote:

       Originally Posted by

        msbbarratt

       Safety critical analogue control systems are far easier to maintain and repair over extended periods of time than their digital equivalents.

  Hardware-wise, maybe. In most other aspects, absolutely not - otherwise the transition from analogue to digital would not have happened.

    Quote:

      There's also no need for triplication for a start, at least not from the point of view establishing correct system output.

  "Triplication"? I'm unsure as to what you're referring to. If you're referring to the two disparate software implementations used in the Airbus FBW systems of the A320 and her descendants, then there were only two - not three - distinct implementations, and they were not so much a necessity as a "belt-and-braces" failsafe, given that the A320 was the first implementation of its type.

    Quote:

      All that an analogue control system is doing is implementing a series of differential equations.

  Software likewise, as AirborneAgain alludes to.

    Quote:

      The problem with software systems is that they're way too complex

  Not necessarily - see AirborneAgain's post.

    Quote:

      Analogue control circuits are also largely immune to component selection ... a capacitor is still a capacitor. Obsolescence is a significantly reduced problem.

  But in a software-based system, the logical functions can be replaced simply by replacing a ROM IC or by re-writing to an EPROM IC - a much less problematic process than re-jigging discrete hardware across hundreds of airframes.

    Quote:

      We won't be seeing A380s, etc. flying once the spares run out.

  Airbus/Boeing FBW systems use hardened versions of obsolete commodity hardware - the suppliers won't stop making them as long as there's a demand.

pattern_is_full
25th Jul 2014, 03:35
permalink
 Post: 1824

  I just have a problem with studies that try to analyze human activities with reductionist statistics and math. Most of human achievement comes not from the masses (which perhaps can be studied that way) but from the outliers, the screwballs, the few who, through enhanced human cussedness and stubbornness, decide NOT to stay with the obvious, efficient or safe thing.

  Concorde was a political animal, heavily subsidized because someone want it to happen, regardless of efficiency.

  But then, ALL advances in transportation have been - and often still are - political animals, subsidized because someone with money and power wants it to happen, regardless of efficiency.

  Columbus and Magellan were subsidized, to head straight out to sea when everyone else was sticking close to the coastlines. Look up the land grants to U.S. trans-continental railroads. Or the Air Mail contracts that supported the fledgling American air transport industry (and if you think "that was then, and this is now," - consider the budget of the FAA and NTSB and TSA, and the military contracts to Boeing and its suppliers.)

  Cars? Consider how much tax money goes to build and maintain highway systems.

  And consider the man who stood up in the U.S. Capitol and declared, "I believe that this nation should commit itself to achieving the goal, before this decade is out, of landing a man on the moon and returning him safely to the earth."

  Concorde failed because it lost political support** - just like Apollo and the Space Shuttle. But most of the other aircraft on those charts would also be, or have been, far rarer in the skies (or never appeared) if they lost (or never had) their own political backing and subsidies, direct and indirect.

  **If the French government had felt it was in France's interest for Concorde to continue, I'm sure money for, and political pressure on, Airbus would have been found to keep her flying.

  And Concorde also faced substantial political opposition - its market viability would have been much higher if U.S. authorities had been as lenient with its "furrin" sonic booms as they had been with our own home-grown booms ("The Sound of Freedom!", it was called.)

  Now - Concorde's technology was pushing 40, and no doubt that particular airframe would have faded away, just like the 727 and the other designs from the 1960's. To be replaced with something newer. But the future of supersonic transport in general was cut short not because of some statistical failing, but simply because it no longer shared the same political support as subsonic aviation.

balaton
25th Feb 2016, 13:01
permalink
 Post: 1931

   Tiny Items

  Hi Dear Guys,

  Amazing thread on an amazing aircraft! Red through all the posts. What an immense amount of knowledge/experience on this bird! Your valuable inputs triggerd my curiousity to the extent that I have started to study Concorde manuals trying to understand systems and operating details. Not an easy job! I think a more detailed Traning Manual would help me greatly.

  Here is my question:

  Going through the FM exterior inspection chapter I have run into tiny details what are really hard to find even on close-up external photos. Just to name a few: "nose gear free fall dump valve vent", "engine oil tank vent" or "hydraulic-driven fuel transfer pump drain". Was there a "pictorial" external inspection guide available on the Concorde for crew training (similar to Boeing or Airbus training aids)? If yes, could somehow, somebody send me a copy of that?

  Appreciate your help,

  Tamas

Page Links: First
 Previous
 1
 2
 3
 4

 Last
 Index Page


text:
<doctype html>

      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="Header.css">

	  MySite.com
      Home
	  Services
      About Us
      Contact Us
      Feedback
	  Register
	  Login


text:
Treconomics3 is a web application that harnesses the power of A/B testing
to evaluate whether snippet length in search engine result pages (SERPs) has
any significant effect on user behaviour or performance.
It heavily builds on previous applications developed by Leif Azzopardi and David Maxwell.

## Installation

These are the initial steps you required before you can run the application on your machine.

### Prerequisites
`Python 2.7`, `pip` package manager, `virtualenv` or `pyenv`, `git`
Clone the repository to a preferred location
```
git clone https://github.com/leifos/ifind/
```

### Dependencies
Navigate to the `treconomics_project3` folder
Run the `requirements.txt` file which will download and install all dependencies.
```
pip install -r requirements.txt
```

### Database population
Create a database with the predefined models (old synchronize)
```
python manage.py migrate
```

Use the `populate_treconomics_db.py` to add data
```
python populate_treconomics_db.py
```

This will create test accounts with the following format
```
username: testX
password: X
```
where X is a number between 1-23

### Importing `ifind`
Finally you will need to add `ifind` to your `PYTHONPATH`
which you can do by insert the following line at the bottom of your `.bashrc`

```
export PYTHONPATH=/Users/mickeypash/ifind/:/Users/mickeypash/ifind/applications/slowsearch_project:$PYTHONPATH
```

### Downloading the NLTK corpus
```
python -c "import nltk; nltk.download()"
```
A GUI window should pop-up with download options.
Alternatively you will see a CLI which will require you to specify and option.
Type `d` for Download and then `book` to download the book corpus (that is all you need).
You could also select  `all` and install the whole corpus (this will take a few minutes).

The files will be installed in
 + `/Users/<username>/nltk_data` (Mac)
 + `/usr/share/nltk_data` (Unix)
 + `C:\nltk_data` (Windows)

## Deployment

In order to run the application
```
python manage.py runserver
```

Simply navigate to [http://localhost:8000](http://localhost:8000)


text:
from __future__ import unicode_literals
from django.db import models
from datetime import date, datetime
from django.core.validators import RegexValidator
from django.contrib.auth.models import User
from jsonfield import JSONField

from django.conf import settings

class Campus(models.Model):
    CAMPUS = (
        ('AR', 'Araba'),
        ('GI', 'Gipuzkoa'),
        ('BI', 'Bizkaia'),
    )
    nombre = models.CharField(max_length=10, choices=CAMPUS)
    codigo = models.CharField(max_length=10)
    def __str__(self):
        return self.nombre

class Facultad(models.Model):
    nombre = models.CharField(max_length=50)
    campus = models.ForeignKey(Campus)
    def __str__(self):
        return self.nombre

class Grado(models.Model):
    nombre = models.CharField(max_length=50)
    codigo = models.CharField(max_length=10)
    # {'especialidades': ['xxx', 'yyyy', 'zzz']}
    especialidades = JSONField(blank=True)
    def __str__(self):
        return self.nombre

class NivelCurso(models.Model):
    #Validador para normalizar las fechas
    fecha_regex = RegexValidator(regex=r'((JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC) ([0-2][0-9]|3(0|1)), 20[1-9][0-9])', message="Tiene que seguir el siguiente ejemplo: 'FEB 28, 2016' ")

    curso = models.CharField(max_length=10)
    inicioCuatrimestreUno = models.CharField(validators=[fecha_regex], blank=True, max_length=15)
    inicioCuatrimestreDos = models.CharField(validators=[fecha_regex], blank=True, max_length=15)
    finCuatrimestreUno = models.CharField(validators=[fecha_regex], blank=True, max_length=15)
    finCuatrimestreDos = models.CharField(validators=[fecha_regex], blank=True, max_length=15)
    grado = models.ForeignKey(Grado)

    def __str__(self):
        return self.curso

class Asignatura(models.Model):

    codigo = models.IntegerField()
    cuatrimestre = models.CharField(max_length=10)
    curso = models.ForeignKey(NivelCurso)

    def __str__(self):
        return self.codigo

class GrupoIdioma(models.Model):
    IDIOMA = (
        ('EU', 'Euskera'),
        ('EN', 'Ingles'),
        ('ES', 'Castellano'),
    )
    nombreIdioma = models.CharField(max_length=10, choices=IDIOMA)
    acronimoAsignatura = models.CharField(max_length=10)
    nombreAsignatura = models.CharField(max_length=50)
    asignatura = models.ForeignKey(Asignatura)
    def __str__(self):
        return self.acronimoAsignatura

class DatosTemporales(models.Model):
    grupoIdioma = models.OneToOneField(GrupoIdioma, related_name='datostemporales')
    def __str__(self):
        return self.grupoIdioma

class Grupo(models.Model):
    nombre = models.IntegerField()
    # {
    # 'Examenes': [{''Nombre': xxx, 'Dia': xxx (Tipo DATEJS), 'HInicio': xxx, 'HFin': xxx}, {..}, {..}],
    # 'Clases': [{'Dia': xxx (Tipo DATEJS), 'HInicio': xxx, 'HFin': xxx}, {..}, {..}],
    # 'Tareas': [{'id', xxx, 'Titulo': xxx, 'Descripcion': xxx, 'HFin': xxx, 'Creador': user.id}, {..}, {..}],
    # }
    eventos = JSONField(blank=True)
    datosTemporales = models.ForeignKey(DatosTemporales)
    def __str__(self):
        return self.nombre

class Tarea(models.Model):
    descripcion = models.CharField(max_length=140)
    titulo = models.CharField(max_length=50)
    Hora = models.TimeField(auto_now=False, blank=True)
    puntuacion = models.IntegerField(default=0)
    grupo = models.ForeignKey(Grupo)
    autor = models.ForeignKey(User)
    def __str__(self):
        return self.titulo

class ValoracionAsignatura(models.Model):
    valoracion = models.IntegerField(default=0)
    argumento = models.CharField(max_length=140, blank=True)
    asignatura = models.ForeignKey(Asignatura)
    autor = models.ForeignKey(User)
    def __str__(self):
        return self.id

class MeGustaTarea(models.Model):
    valor = models.IntegerField(default=0)
    autor = models.ForeignKey(User)
    tarea = models.ForeignKey(Tarea)
    def __str__(self):
        return self.tarea.titulo

class Comentario(models.Model):
    contenido = models.CharField(max_length=140)
    fechaCreacion = models.DateField(default=date.today, blank=True)
    fechaUltimaModificacion = models.DateField(default=date.today, blank=True)
    puntuacion = models.IntegerField(default=0)
    autor = models.ForeignKey(User)
    grupoIdioma = models.ForeignKey(GrupoIdioma)
    def __str__(self):
        return self.autor.username

class MeGustaComentario(models.Model):
    valor = models.IntegerField(default=0)
    autor = models.ForeignKey(User)
    comentario = models.ForeignKey(Comentario)
    def __str__(self):
        return self.comentario

class Logs(models.Model):
    data = models.CharField(max_length=255)
    grado = models.ForeignKey(Grado)
    usuario = models.ForeignKey(User)
    def __str__(self):
        return self.grado.nombre

class SubscripcionGrupo(models.Model):
    usuario = models.ForeignKey(User)
    grupo = models.ForeignKey(Grupo)
    def __str__(self):
        return self.usuario.username

class Matricula(models.Model):
    usuario = models.ForeignKey(User)
    grupo = models.ForeignKey(Grupo)
    grado = models.ForeignKey(Grado)

class calendar(models.Model):
    DIAS = (
        ('1', '1'),
        ('2', '2'),
        ('3', '3'),
        ('4', '4'),
        ('5', '5'),
        ('6', '6'),
        ('7', '7'),
        ('8', '8'),
        ('9', '9'),
        ('10', '10'),
        ('11', '11'),
        ('12', '12'),
        ('13', '13'),
        ('14', '14'),
        ('15', '15'),
        ('16', '16'),
        ('17', '17'),
        ('18', '18'),
        ('19', '19'),
        ('20', '20'),
        ('21', '21'),
        ('22', '22'),
        ('23', '23'),
        ('24', '24'),
        ('25', '25'),
        ('26', '26'),
        ('27', '27'),
        ('28', '28'),
        ('29', '29'),
        ('30', '30'),
        ('31', '31')
    )
    MESES = (
        ('1', 'Enero'),
        ('2', 'Febrero'),
        ('3', 'Marzo'),
        ('4', 'Abril'),
        ('5', 'Mayo'),
        ('6', 'Junio'),
        ('7', 'Julio'),
        ('8', 'Agosto'),
        ('9', 'Septiembre'),
        ('10', 'Octubre'),
        ('11', 'Noviembre'),
        ('12', 'Diciembre')
    )

    CURSOS = (
        ('2016/2017', '16/17'),
        ('2017/2018', '17/18')
    )

    cursoAcademico = models.IntegerField(choices=CURSOS, blank=True)
    inicioPrimerCuatrimestreDia = models.IntegerField(choices=DIAS, blank=True)
    inicioPrimerCuatrimestreMes = models.IntegerField(choices=MESES, blank=True)
    finPrimerCuatrimestreDia = models.IntegerField(choices=DIAS, blank=True)
    finPrimerCuatrimestreMes = models.IntegerField(choices=MESES, blank=True)
    inicioSegundoCuatrimestreDia = models.IntegerField(choices=DIAS, blank=True)
    inicioSegundoCuatrimestreMes = models.IntegerField(choices=MESES, blank=True)
    finSegundoCuatrimestreDia = models.IntegerField(choices=DIAS, blank=True)
    finSegundoCuatrimestreMes = models.IntegerField(choices=MESES, blank=True)


text:
'use strict'

class SiteManager extends SuperClass {
    autoSetupFromConfig() {
        super.autoSetupFromConfig()
        const config = this.getConfig('servers')

        if (config.redis) {
            const _this = this
            process.nextTick(function() {
                _this.setupRedis(config.redis)
            })
        }
    }

    /**
    * Setup a redis connection that will be used by the api's
    * @param config {Object}
    */
    setupRedis(config) {
        this.connections = this.connections || {}

        try {
            if (config === undefined)
                config = this.getConfig('servers').redis

            const Redis = plugins.require('redis/Redis')

            this.connections.redis = new Redis(config)
            this.sessionsManager.setupRedis()

            this.onRedisBroadcast('SMBroadcast', ({ api, data, selector }) => {
                super.broadcast(api, data, selector)
            })
        } catch (e) {
            console.error('{setupRedis}', e)
        }
    }

    broadcast(api, data, selector) {
        if(this.connections && this.connections.redis) {
            return this.broadcastToRedis('SMBroadcast', {
                api,
                data,
                selector
            })
        }

        return super.broadcast(api, data, selector)
    }

    /**
    * Broadcast a message over a channel using the redis service
    * @param channel {String}
    * @param msg {String|Object}
    */
    broadcastToRedis(channel, msg) {
        this.connections = this.connections || {}

        try {
            if(!this.connections.redis) {
                console.warn('Cannot broadcast redis event, redis server not instantiated')
                return
            }

            this.connections.redis.emit(channel, msg)
        } catch(e) {
            console.error('{broadcastToRedis}', e)
        }
    }

    /**
    * Listen to a redis broadcast channel
    * @param channel {String}
    * @param callback {Function}
    */
    onRedisBroadcast(channel, cb) {
        this.connections = this.connections || {}

        if (!this.connections.redis)
            return console.error('Please instantiate a redis server before listening some broadcast events')

        this.connections.redis.onChannel(channel, cb)
    }

}

module.exports = SiteManager