Esempio n. 1
0
void ASTConsumer::AddFieldDecl(clang::NamedDecl* decl, const std::string& name, const std::string& parent_name, const clang::ASTRecordLayout* layout)
{
	// Cast to a field
	clang::FieldDecl* field_decl = llvm::dyn_cast<clang::FieldDecl>(decl);
	assert(field_decl != 0 && "Failed to cast to field declaration");

	// These are implicitly generated by clang so skip them
	if (field_decl->isAnonymousStructOrUnion())
		return;

	// Parse and add the field
	cldb::Field field;
	cldb::u32 offset = layout->getFieldOffset(field_decl->getFieldIndex()) / 8;
	std::string field_name = field_decl->getName().str();
	Status status = MakeField(*this, field_decl->getType(), field_name.c_str(), parent_name, offset, field, MF_CHECK_TYPE_IS_REFLECTED);
	if (status.HasWarnings())
	{
		status.Print(field_decl->getLocation(), m_ASTContext.getSourceManager(), va("Failed to reflect field in '%s'", parent_name.c_str()));
		return;
	}

	LOG(ast, INFO, "Field: %s%s%s %s\n",
		field.qualifier.is_const ? "const " : "",
		field.type.text.c_str(),
		field.qualifier.op == cldb::Qualifier::POINTER ? "*" : field.qualifier.op == cldb::Qualifier::REFERENCE ? "&" : "",
		field.name.text.c_str());
	m_DB.AddPrimitive(field);
}
Esempio n. 2
0
void ASTConsumer::AddMethodDecl(clang::NamedDecl* decl, const std::string& name, const std::string& parent_name)
{
	// Cast to a method
	clang::CXXMethodDecl* method_decl = llvm::dyn_cast<clang::CXXMethodDecl>(decl);
	assert(method_decl != 0 && "Failed to cast to C++ method declaration");

	// Ignore overloaded operators for now
	if (method_decl->isOverloadedOperator())
		return;

	std::vector<cldb::Field> parameters;
	if (method_decl->isInstance())
	{
		// Parse the 'this' type, treating it as the first parameter to the method
		cldb::Field this_param;
		Status status = MakeField(*this, method_decl->getThisType(m_ASTContext), "this", name, 0, this_param, MF_CHECK_TYPE_IS_REFLECTED);
		if (status.HasWarnings())
		{
			status.Print(method_decl->getLocation(), m_ASTContext.getSourceManager(), va("Failed to reflect method '%s' due to invalid 'this' type", name.c_str()));
			return;
		}
		parameters.push_back(this_param);
	}

	// Parse and add the method
	MakeFunction(decl, name, parent_name, parameters);
}
Esempio n. 3
0
static JSVAL fetch_field_direct(JSARGS args) {
	HandleScope scope;
	MYSQL_RES *res = (MYSQL_RES *) args[0]->IntegerValue();
	MYSQL_FIELD *f = mysql_fetch_field_direct(res, args[1]->IntegerValue());
    JSOBJ o = Object::New();
	MakeField(f, o);
    return scope.Close(o);
}
Esempio n. 4
0
static JSVAL fetch_fields(JSARGS args) {
	HandleScope scope;
	MYSQL_RES *result = (MYSQL_RES *) args[0]->IntegerValue();
	unsigned int num_fields = mysql_num_fields(result);
	MYSQL_FIELD *fields = mysql_fetch_fields(result);
	JSARRAY a = Array::New();;
	for (unsigned int i=0; i<num_fields; i++) {
		JSOBJ o = Object::New();
		MakeField(&fields[i], o);
		a->Set(i, o);
	}
	return scope.Close(a);
}
Esempio n. 5
0
string DSVWriteCommand :: MakeDSV( const CSVRow & in )  {

    CSVRow row;
    BuildCSVRow( in, row );

    string line;
    for ( unsigned int i = 0; i < row.size(); i++ ) {
        line += MakeField( row[i] );
        if ( i != row.size() - 1 ) {
            line += Delim();
        }
    }
    return line;
}
Esempio n. 6
0
void ASTConsumer::MakeFunction(clang::NamedDecl* decl, const std::string& function_name, const std::string& parent_name, std::vector<cldb::Field>& parameters)
{
	// Cast to a function
	clang::FunctionDecl* function_decl = llvm::dyn_cast<clang::FunctionDecl>(decl);
	assert(function_decl != 0 && "Failed to cast to function declaration");

	// Only add the function once
	if (!function_decl->isFirstDeclaration())
		return;

	// Parse the return type - named as a reserved keyword so it won't clash with user symbols
	cldb::Field return_parameter;
	Status status = MakeField(*this, function_decl->getResultType(), "return", function_name, -1, return_parameter, 0);
	if (status.HasWarnings())
	{
		status.Print(function_decl->getLocation(), m_ASTContext.getSourceManager(), va("Failed to reflect function '%s' due to invalid return type", function_name.c_str()));
		return;
	}

	// Try to gather every parameter successfully before adding the function
	int index = parameters.size();
	for (clang::FunctionDecl::param_iterator i = function_decl->param_begin(); i != function_decl->param_end(); ++i)
	{
		clang::ParmVarDecl* param_decl = *i;

		// Check for unnamed parameters
		llvm::StringRef param_name = param_decl->getName();
		if (param_name.empty())
		{
			Status().Print(function_decl->getLocation(), m_ASTContext.getSourceManager(), va("Unnamed function parameters not supported - skipping reflection of '%s'", function_name.c_str()));
			return;
		}

		// Collect a list of constructed parameters in case evaluating one of them fails
		cldb::Field parameter;
		std::string param_name_str = param_name.str();
		status = MakeField(*this, param_decl->getType(), param_name_str.c_str(), function_name, index++, parameter, 0);
		if (status.HasWarnings())
		{
			status.Print(function_decl->getLocation(), m_ASTContext.getSourceManager(), va("Failed to reflection function '%s'", function_name.c_str()));
			return;
		}
		parameters.push_back(parameter);
	}

	// Generate a hash unique to this function among other functions of the same name
	// This is so that its parameters can re-parent themselves correctly
	cldb::u32 unique_id = cldb::CalculateFunctionUniqueID(parameters);

	// Parent each parameter to the function
	return_parameter.parent_unique_id = unique_id;
	for (size_t i = 0; i < parameters.size(); i++)
		parameters[i].parent_unique_id = unique_id;

	// Add the function
	LOG(ast, INFO, "function %s\n", function_name.c_str());
	m_DB.AddPrimitive(cldb::Function(
		m_DB.GetName(function_name.c_str()),
		m_DB.GetName(parent_name.c_str()),
		unique_id));

	LOG_PUSH_INDENT(ast);

	// Only add the return parameter if it's non-void
	if (return_parameter.type.text != "void")
	{
		LOG(ast, INFO, "Returns: %s%s%s\n",
			return_parameter.qualifier.is_const ? "const " : "",
			return_parameter.type.text.c_str(),
			return_parameter.qualifier.op == cldb::Qualifier::POINTER ? "*" : return_parameter.qualifier.op == cldb::Qualifier::REFERENCE ? "&" : "");
		m_DB.AddPrimitive(return_parameter);
	}
	else
	{
		LOG(ast, INFO, "Returns: void (not added)\n");
	}

	// Add the parameters
	for (std::vector<cldb::Field>::iterator i = parameters.begin(); i != parameters.end(); ++i)
	{
		LOG(ast, INFO, "%s%s%s %s\n",
			i->qualifier.is_const ? "const " : "",
			i->type.text.c_str(),
			i->qualifier.op == cldb::Qualifier::POINTER ? "*" : i->qualifier.op == cldb::Qualifier::REFERENCE ? "&" : "",
			i->name.text.c_str());
		m_DB.AddPrimitive(*i);
	}

	LOG_POP_INDENT(ast);
}
Esempio n. 7
0
void ConfigDialog::AddControls()
{
	Container* parent = new Container( this );
	parent->setLayout( new GridBagLayout() );

	Container* fieldsPanel = new Container();
	fieldsPanel->setLayout( new GridBagLayout() );

	GridBagConstraints c; 
	c.gridwidth = 1;  c.insets = Insets( 5,5, 5,5 );
	c.fill = GridBagConstraints::HORIZONTAL;
	int rmd = GridBagConstraints::REMAINDER;
	int y = 0;

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1,"hgap:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpHgap ),  &c ); c.gridwidth = 1;  

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "vgap:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpVgap ),  &c ); c.gridwidth = 1;  

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "inset.left:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpLeft ),        &c ); c.gridwidth = 1;        

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "insets.right:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpRight ),         &c ); c.gridwidth = 1;         

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "insets.top:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpTop ),         &c ); c.gridwidth = 1;         

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "insets.bottom:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpBottom ),         &c  ); c.gridwidth = 1;         

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "Grid-rows:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpRowCount ),   &c  ); c.gridwidth = 1;   

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "Grid-cols:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpColCount ),   &c  ); c.gridwidth = 1;   

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "Panel-font:" ), &c ); c.gridwidth = 1;   c.weightx = 1.0;
	fieldsPanel->add( MakeField( mpFont ),        &c ); c.gridwidth = rmd; c.weightx = 0.0;

	fieldsPanel->add( MakeButton( "Select &font...", ID_SELECT_FONT ), &c  ); c.gridwidth = 1;

	Container* checkPanel1 = new Container();
	Container* checkPanel2 = new Container();
	Container* checkPanel3 = new Container();
	Container* btnPanel    = new Container();

	c.weightx = 1.0;

	c.gridx = 0; c.gridy = y++; 
	parent->add( fieldsPanel, &c ); c.gridwidth = rmd;

	c.insets.left = 10;	c.gridx = 0; 
	
	c.gridy = y++; parent->add( checkPanel1, &c ); c.gridwidth = rmd;

	c.gridy = y++; parent->add( checkPanel2, &c );

	c.gridy = y++; parent->add( checkPanel3, &c );

	c.gridy = y++; parent->add( new wxStaticText( this,-1, 
								"(Note: this dialog is also resizable)" ), &c );

	c.gridy = y++; 
	parent->add( btnPanel, &c );

	checkPanel1->setLayout( new BoxLayout( BoxLayout::X_AXIS ) );
	checkPanel2->setLayout( new BoxLayout( BoxLayout::X_AXIS ) );
	checkPanel3->setLayout( new BoxLayout( BoxLayout::X_AXIS ) );

	c.insets.left = 10;
	checkPanel1->add( MakeCheckBox( "Use light-wieght comp. ",   mpUseLightWeight ) );
	checkPanel1->add( MakeCheckBox( "Use double-buffering.",    mpUseDoubleBuf ) );
	checkPanel2->add( MakeCheckBox( "Show source for layout.",  mpShowSrcCode ) );
	checkPanel2->add( MakeCheckBox( "Auto-pack layout.",        mpAutoPack ) );
	checkPanel3->add( MakeCheckBox( "Enable \"2-Phase layouting\" feature.", mpUseTwoPhase ) );

	btnPanel->setLayout( new FlowLayout() );

	btnPanel->add( MakeButton( "&Apply", wxID_APPLY ) );
	btnPanel->add( MakeButton( "Apply && &return", ID_APPLY_AND_EXIT ) );
	btnPanel->add( MakeButton( "&Cancel", wxID_CANCEL ) );
	btnPanel->add( MakeButton( "&View dlg-source", ID_SHOW_DLG_SOURCE ) );

	mpFont->Enable( FALSE ); 
									 
	if ( !_gCfgDlgSizeAdjusted ) 
	{
		// for packing dialog initially use only 1-phase layouting
		// to let buttons in FlowLayout'ed btnPanel strech within\ in a single row

		parent->setTwoPhaseLayoutingGlobally(FALSE);

		parent->pack();

		// for the other resizing do it the "featured" way

		parent->setTwoPhaseLayoutingGlobally(TRUE);
	}
}
void main(void){
	//verifica mouse
	//status = initmouse();
	initmouse();
	
	/* VAMOS VER TESTE DE ARQUIVO AQUI */
	/*printf("%d", defHour(atoi("11"), atoi("30"))); getchar();*/
	
	//mostra mouse para inicializar e esconder
	showmouseptr();
	hidemouseptr();
	//desenha logo unifenas
	DrawLogoChar(1, 1);
	showmouseptr();
	
	//janela de login � uma particularidade tem que ser construida aqui
	//janela principal de senha
	MakeWindow(55, 10, 23, 8, "Login", WHITE, BLACK, WINLOGIN);
		MakeField(4, 3, 15, "Usuario", BLACK, WHITE, CHARS, WINLOGIN);
		MakeField(4, 5, 15, "Senha", BLACK, WHITE, PASS, WINLOGIN);
		MakeButton(12, 7, 10, "Entra", MAGENTA, WHITE, WINLOGIN);
	OpenDB(WINROOM); //primeira vez que entra cria arquivo
	OpenDB(AGEND); //primeira vez que entra vais
	WinListener(WINLOGIN);
	
	//depois da tela de login � preciso limpar a tela
	hidemouseptr();
	WinDefault(); clrscr();
	showmouseptr();
	//nessa parcularidade � preciso esconder o mouse tbm
	
	if(pexit != true){
		/* FAZ MENU */
				MakeMenu(2, 3, 12, 2, "Salas", MAGENTA, WHITE, LIGHTGREEN, WHITE, 1);
					MakeSubMenu(1, "Nova");
					MakeSubMenu(1, "Editar");
					MakeSubMenu(1, "Apagar");
					MakeSubMenu(1, "Sair");
				MakeMenu(2, 7, 12, 2, "Agendamento", MAGENTA, WHITE, LIGHTGREEN, WHITE, 2);
					MakeSubMenu(2, "Novo");
					MakeSubMenu(2, "Mostrar");
					MakeSubMenu(2, "Apagar");
					MakeSubMenu(2, "Sair");
				MakeMenu(2, 11, 12, 2, "Relatorios", MAGENTA, WHITE, LIGHTGREEN, WHITE, 3);
					MakeSubMenu(3, "Salas");
					MakeSubMenu(3, "Agenda");
					MakeSubMenu(3, "Sair");
				MakeMenu(2, 15, 12, 2, "Sair", MAGENTA, WHITE, LIGHTGREEN, WHITE, 4);
					MakeSubMenu(4, "Sim");
					MakeSubMenu(4, "Nao");
		/* FAZ MENU */
	
		do{ //e que comece a comer recursos
			mexit = false;
			//mostra o mouse
			showmouseptr();
			MenuListener();
		}while(pexit != true);
	}//se o programa pedir pra ser fechado feche
	
	//limpa a tela
	WinDefault();
	textcolor(WHITE); textbackground(BLACK);
	clrscr();
}
void getBt(int Id, int ind){
	int cod, getOK = false;
	char dado[50], codi;
	switch(Id){
		
		case WINLOGIN: //janela de login
			switch(ind){
				case 1: //bot�o entrar
					if((strcmp(win.id[Id].fd[1].text, "MATHEUS") == 0) && (strcmp(win.id[Id].fd[2].text, "123") == 0)){
						win.id[Id].act = false;
						//refaz o palco
						hidemouseptr();
						RemakeStage();
						showmouseptr();
						//tira o listener da janela
						mexit = true;
					}else{
						MsgLine("Senha ou Usuario nao comferem!", "Incorreto", ERRO);
					}
				break;
			}
		break;
		
		case WINROOM: //janela de entrada de salas
			switch(ind){
				case 1: //botão salvar
					cod = setRoom();
					WinClose(WINROOM);
					MsgLine("Nova Sala incluida! cod: ", "Sucesso!", ALERTA);
					cprintf("%d", cod);
				break;
			}
		break;
		
		case GOOGLE:
			switch(ind){
				case 1: //botão buscar
					if(strtol(win.id[GOOGLE].fd[1].text, NULL, 10) <= recordsDB(WINROOM)-1){
						hidemouseptr();
						//chama cabe�alho da janela de edição
						MakeWindow(27, 4, 43, 13, "Edita Sala", WHITE, BLACK, WINROOME);
							MakeField(4, 3, 4, "Numero:", BLACK, WHITE, NUMBERS, WINROOME);
							MakeField(15, 3, 2, "Bloco:", BLACK, WHITE, NUMBERS, WINROOME);
							MakeField(25, 3, 3, "Lotacao:", BLACK, WHITE, NUMBERS, WINROOME);
							MakeField(4, 7, 2, "Data Show:", BLACK, WHITE, CHECK, WINROOME);
							MakeField(15, 7, 2, "Lousa Digital:", BLACK, WHITE, CHECK, WINROOME);
							MakeField(4, 10, 2, "Ar Cond.:", BLACK, WHITE, CHECK, WINROOME);
							MakeField(15, 10, 2, "Computador:", BLACK, WHITE, CHECK, WINROOME);
							MakeField(30, 7, 2, "Ventilador:", BLACK, WHITE, NUMBERS, WINROOME);
							MakeField(30, 10, 2, "Tomadas:", BLACK, WHITE, NUMBERS, WINROOME);
							MakeButton(31, 12, 10, "Salva", MAGENTA, WHITE, WINROOME);
							MakeButton(19, 12, 3, "<-", MAGENTA, WHITE, WINROOME);
							MakeButton(25, 12, 3, "->", MAGENTA, WHITE, WINROOME);
						//agora preenche campos
						if(getRoom(win.id[GOOGLE].fd[1].text) == true){
							showmouseptr();
							last = c;
							WinListener(WINROOME);
							WinClose(GOOGLE);
						}else{
							WinClose(WINROOME);
							WinClose(GOOGLE);
							showmouseptr();
							MsgLine("Registro nao encontrado!", "405!", ERRO);
						}
						//cprintf("Acabou o listener");
					}else{
						MsgLine("Registro nao encontrado!", "404!", ERRO);
					}
				break;
			}
		break;
		
		case GOOGLE1:
			switch(ind){
				case 1: //botão buscar
					if(strtol(win.id[GOOGLE1].fd[1].text, NULL, 10) <= recordsDB(AGEND)-1){
						hidemouseptr();
						//chama cabe�alho da janela de novo agendamento
						MakeWindow(27, 4, 43, 16, "Novo Agendamento", WHITE, BLACK, AGENDE);
							MakeField(4, 3, 4, "Sala:", BLACK, WHITE, NUMBERS, AGENDE);
							MakeField(4, 6, 2, "Dia:", BLACK, WHITE, NUMBERS, AGENDE);
							MakeField(8, 6, 2, "Mes:", BLACK, WHITE, NUMBERS, AGENDE);
							MakeField(12, 6, 4, "Ano:", BLACK, WHITE, NUMBERS, AGENDE);
							MakeField(4, 9, 5, "Hora Ini.:", BLACK, WHITE, HORAS, AGENDE);
							MakeField(16, 9, 5, "Hora Fin.:", BLACK, WHITE, HORAS, AGENDE);
							MakeField(4, 12, 35, "Responsavel:", BLACK, WHITE, CHARS, AGENDE);
							MakeButton(18, 15, 3, "<-", MAGENTA, WHITE, AGENDE);
							MakeButton(24, 15, 3, "->", MAGENTA, WHITE, AGENDE);
						//agora preenche campos
						if(getAgend(win.id[GOOGLE1].fd[1].text) == true){
							showmouseptr();
							last = c;
							WinListener(AGENDE);
							WinClose(GOOGLE1);
						}else{
							WinClose(AGENDE);
							WinClose(GOOGLE1);
							showmouseptr();
							MsgLine("Registro nao encontrado!", "405!", ERRO);
						}
					}else{
						MsgLine("Registro nao encontrado!", "404!", ERRO);
					}
				break;
			}	
		break;
		
		case DELROOM:
			switch(ind){
				case 1: //apagar
					delay(200);
					hidemouseptr();
					//chama cabe�alho da janela de edição
					MakeWindow(35, 6, 23, 7, "Certeza!?", WHITE, BLACK, SHURE);
						MakeField(5, 4, 4, "Deseja Apagar?", WHITE, YELLOW, NUMBERS, SHURE);
						MakeButton(5, 6, 5, "Sim", MAGENTA, WHITE, SHURE);
						MakeButton(13, 6, 5, "Nao", MAGENTA, WHITE, SHURE);
						showmouseptr();
					WinListener(SHURE);
					strcpy(&dado, win.id[DELROOM].fd[1].text);
					WinClose(DELROOM);
					if(deler == true){
						if(delRoom(dado) == true){
							MsgLine("Registro removido com sucesso!", "Sucesso!", ALERTA);
						}else{
							MsgLine("Registro nao encontrado!", "404!", ERRO);
						}
					}
				break;
			}
		break;
		
		case SHURE:
			switch(ind){
				case 1: //sim
					WinClose(SHURE);
					deler = true;	
				break;
				case 2: //não
					WinClose(SHURE);
					deler = false;
				break;
			}
		break;
		
		case WINROOME:
			switch(ind){
				case 1: //salvar
					//cprintf("Agora sim...");
					if(editRoom(c) == true)
						MsgLine("Editado com Sucesso!", "Sucesso!", ALERTA);
					else
						MsgLine("Erro ao Editar Arquivo!", "500!", ERRO);
					delay(130);	
				break;
				case 2: //para frente
					if(c >= 1){
						cod = c-1;
						if(cod >= 1){
							//pega codigo
							sprintf(&dado, "%d", cod);
							//limpa campos
							TrashField(WINROOME);
							getOK = getRoom(dado);
							//agora preenche campos
							while((getOK == false) && (cod >= 1)){
								c --; cod = c;
								sprintf(&dado, "%d", cod);
								getOK = getRoom(dado); //e manda de novo
							}
							if(getOK == true){
								last = c;
								//cprintf("manolo %d", last); getchar();
								sprintf(&dado, "Edita Sala cod: %d", c);
								strcpy(&win.id[Id].label, dado);
								//refaz tuto
								hidemouseptr();
								RemakeStage();
								showmouseptr();
							}else{
								cod = last;
								//cprintf("manolo %d", last); getchar();
								sprintf(&dado, "%d", cod);
								getOK = getRoom(dado); //e manda de novo
								sprintf(&dado, "Edita Sala cod: %d", c);
								strcpy(&win.id[Id].label, dado);
								//refaz tuto
								hidemouseptr();
								RemakeStage();
								showmouseptr();
								MsgLine("Comeco dos Registros", "Total!", ALERTA);
							}	
						}else{
							MsgLine("Comeco dos Registros", "Total!", ALERTA);
						}
						delay(120);
					}
				break;
				case 3: //para trás gambiarra lembra m = variavel global
					if(c < recordsDB(WINROOM)){
						cod = c+1;
						if(cod < recordsDB(WINROOM)){
							//pega codigo
							sprintf(&dado, "%d", cod);
							//limpa campos
							TrashField(WINROOME);
							//agora preenche campos
							getOK = getRoom(dado);
							//verifica se existe mesmo
							while((getOK == false) && (cod < recordsDB(WINROOM))){
								c++; cod = c;
								sprintf(&dado, "%d", cod);
								getOK = getRoom(dado); //e manda de novo
							}
							if(getOK == true){
								last = c;
								//cprintf("manolo %d", last); getchar();
								sprintf(&dado, "Edita Sala cod: %d", c);
								strcpy(&win.id[Id].label, dado);
								//refaz tuto
								hidemouseptr();
								RemakeStage();
								showmouseptr();
							}else{
								cod = last;
								//cprintf("manolo %d", last); getchar();
								sprintf(&dado, "%d", cod);
								getOK = getRoom(dado); //e manda de novo
								sprintf(&dado, "Edita Sala cod: %d", c);
								strcpy(&win.id[Id].label, dado);
								//refaz tuto
								hidemouseptr();
								RemakeStage();
								showmouseptr();
								MsgLine("Fim dos Registros", "Total!", ALERTA);
							}
						}else{
							MsgLine("Fim dos Registros", "Total!", ALERTA);
						}
						delay(120);
					}
				break;
			}
		break;
		
		case AGENDE:
			switch(ind){
				case 1: //para frente
					if(c >= 1){
						cod = c-1;
						if(cod >= 1){
							//pega codigo
							sprintf(&dado, "%d", cod);
							//limpa campos
							TrashField(AGENDE);
							getOK = getAgend(dado);
							//agora preenche campos
							while((getOK == false) && (cod >= 1)){
								c --; cod = c;
								sprintf(&dado, "%d", cod);
								getOK = getAgend(dado); //e manda de novo
							}
							if(getOK == true){
								last = c;
								//cprintf("manolo %d", last); getchar();
								sprintf(&dado, "Mostra Agendamento cod: %d", c);
								strcpy(&win.id[Id].label, dado);
								//refaz tuto
								hidemouseptr();
								RemakeStage();
								showmouseptr();
							}else{
								cod = last;
								//cprintf("manolo %d", last); getchar();
								sprintf(&dado, "%d", cod);
								getOK = getAgend(dado); //e manda de novo
								sprintf(&dado, "Mosta Agendamento cod: %d", c);
								strcpy(&win.id[Id].label, dado);
								//refaz tuto
								hidemouseptr();
								RemakeStage();
								showmouseptr();
								MsgLine("Comeco dos Registros", "Total!", ALERTA);
							}	
						}else{
							MsgLine("Comeco dos Registros", "Total!", ALERTA);
						}
						delay(120);
					}
				break;
				case 2: //para trás gambiarra lembra m = variavel global
					if(c < recordsDB(AGEND)){
						cod = c+1;
						if(cod < recordsDB(AGEND)){
							//pega codigo
							sprintf(&dado, "%d", cod);
							//limpa campos
							TrashField(AGENDE);
							//agora preenche campos
							getOK = getAgend(dado);
							//verifica se existe mesmo
							while((getOK == false) && (cod < recordsDB(AGEND))){
								c++; cod = c;
								sprintf(&dado, "%d", cod);
								getOK = getAgend(dado); //e manda de novo
							}
							if(getOK == true){
								last = c;
								//cprintf("manolo %d", last); getchar();
								sprintf(&dado, "Mostra Agendamento cod: %d", c);
								strcpy(win.id[Id].label, dado);
								//refaz tuto
								hidemouseptr();
								RemakeStage();
								showmouseptr();
							}else{
								cod = last;
								//cprintf("manolo %d", last); getchar();
								sprintf(dado, "%d", cod);
								getOK = getRoom(dado); //e manda de novo
								sprintf(&dado, "Mostra Agendamento cod: %d", c);
								strcpy(&win.id[Id].label, dado);
								//refaz tuto
								hidemouseptr();
								RemakeStage();
								showmouseptr();
								MsgLine("Fim dos Registros", "Total!", ALERTA);
							}
						}else{
							MsgLine("Fim dos Registros", "Total!", ALERTA);
						}
						delay(120);
					}
				break;
			}	
		break;
		
		case DELAGEND:
			switch(ind){
				case 1: //apagar
					delay(200);
					hidemouseptr();
					//chama cabe�alho da janela de edição
					MakeWindow(35, 6, 23, 7, "Certeza!?", WHITE, BLACK, SHURE);
						MakeField(5, 4, 4, "Deseja Apagar?", WHITE, YELLOW, NUMBERS, SHURE);
						MakeButton(5, 6, 5, "Sim", MAGENTA, WHITE, SHURE);
						MakeButton(13, 6, 5, "Nao", MAGENTA, WHITE, SHURE);
						showmouseptr();
					WinListener(SHURE);
					strcpy(dado, win.id[DELAGEND].fd[1].text);
					WinClose(DELAGEND);
					if(deler == true){
						if(delAgend(dado) == true){
							MsgLine("Registro removido com sucesso!", "Sucesso!", ALERTA);
						}else{
							MsgLine("Registro nao encontrado!", "404!", ERRO);
						}
					}
				break;
			}
		break;
		
		case AGEND:
			switch(ind){
				case 1: //botao salvar
					//cod = setAgend();
					codi = setAgend();
					if(codi == 'S'){
						WinClose(AGEND);
						MsgLine("Novo Agendamento incluido! cod: ", "Sucesso!", ALERTA);
						cprintf("%d", recordsDB(AGEND)-1);
					}else if(codi == 'N'){
						MsgLine("Sala nao existe! ", "Inexistente!", ERRO);
						//cprintf("%c", codi);
					}else if(codi == 'H'){
						MsgLine("Horario ja esta em uso!", "Ocupado!", ERRO);
					}else{
						MsgLine("Erro Indeterminado!", "GATES!", ERRO);
					}
				break;
			}
		break;
		
		case RELATR:
			funcRelar(ind);
		break;
	}
}
void getSm(int Id, int ind){
	switch(Id){
		
		case 1: //menu 1 salas
			switch(ind){
				case 1: //nova sala
					//refaz menu
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					//desfaz subs
					actMN = false;
					//chama cabe�alho da janela de nova sala
					MakeWindow(27, 4, 43, 13, "Nova Sala", WHITE, BLACK, WINROOM);
						MakeField(4, 3, 4, "Numero:", BLACK, WHITE, NUMBERS, WINROOM);
						MakeField(15, 3, 2, "Bloco:", BLACK, WHITE, NUMBERS, WINROOM);
						MakeField(25, 3, 3, "Lotacao:", BLACK, WHITE, NUMBERS, WINROOM);
						MakeField(4, 7, 2, "Data Show:", BLACK, WHITE, CHECK, WINROOM);
						MakeField(15, 7, 2, "Lousa Digital:", BLACK, WHITE, CHECK, WINROOM);
						MakeField(4, 10, 2, "Ar Cond.:", BLACK, WHITE, CHECK, WINROOM);
						MakeField(15, 10, 2, "Computador:", BLACK, WHITE, CHECK, WINROOM);
						MakeField(30, 7, 2, "Ventilador:", BLACK, WHITE, NUMBERS, WINROOM);
						MakeField(30, 10, 2, "Tomadas:", BLACK, WHITE, NUMBERS, WINROOM);
						MakeButton(31, 12, 10, "Salva", MAGENTA, WHITE, WINROOM);
					WinListener(WINROOM);
				break;
				case 2: //editar sala
					//refaz menu
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					//desfaz subs
					actMN = false;
					//nesse caso vamos ter que apresentar a janela de busca
					MakeWindow(35, 6, 23, 7, "Busca Registro", WHITE, BLACK, GOOGLE);
						MakeField(9, 3, 4, "Cod:", BLACK, WHITE, NUMBERS, GOOGLE);
						MakeButton(11, 6, 10, "Busca", MAGENTA, WHITE, GOOGLE);
					WinListener(GOOGLE);
				break;
				case 3: //apagar código
					//refaz menu
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					//desfaz subs
					actMN = false;
					//nesse caso vamos ter que apresentar a janela de busca
					MakeWindow(35, 6, 23, 7, "Apagar Registro", WHITE, BLACK, DELROOM);
						MakeField(9, 3, 4, "Cod:", BLACK, WHITE, NUMBERS, DELROOM);
						MakeButton(11, 6, 10, "Apagar", MAGENTA, WHITE, DELROOM);
					WinListener(DELROOM);
				break;
				case 4: //sair menu salas
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					actMN = false;
				break;
			}
		break;
		
		case 2: //menu agendamentos
			switch(ind){
				case 1: //novo agendamento
					//refaz menu
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					//desfaz subs
					actMN = false;
					//chama cabe�alho da janela de novo agendamento
					MakeWindow(27, 4, 43, 16, "Novo Agendamento", WHITE, BLACK, AGEND);
						MakeField(4, 3, 4, "Sala:", BLACK, WHITE, NUMBERS, AGEND);
						MakeField(4, 6, 2, "Dia:", BLACK, WHITE, NUMBERS, AGEND);
						MakeField(8, 6, 2, "Mes:", BLACK, WHITE, NUMBERS, AGEND);
						MakeField(12, 6, 4, "Ano:", BLACK, WHITE, NUMBERS, AGEND);
						MakeField(4, 9, 5, "Hora Ini.:", BLACK, WHITE, HORAS, AGEND);
						MakeField(16, 9, 5, "Hora Fin.:", BLACK, WHITE, HORAS, AGEND);
						MakeField(4, 12, 35, "Responsavel:", BLACK, WHITE, CHARS, AGEND);
						MakeButton(31, 15, 10, "Salva", MAGENTA, WHITE, AGEND);
					WinListener(AGEND);
				break;
				case 3: //apagar código
					//refaz menu
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					//desfaz subs
					actMN = false;
					//nesse caso vamos ter que apresentar a janela de busca
					MakeWindow(35, 6, 23, 7, "Apagar Registro", WHITE, BLACK, DELAGEND);
						MakeField(9, 3, 4, "Cod:", BLACK, WHITE, NUMBERS, DELAGEND);
						MakeButton(11, 6, 10, "Apagar", MAGENTA, WHITE, DELAGEND);
					WinListener(DELAGEND);
				break;
				case 2: //menu de editar
					//refaz menu
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					//desfaz subs
					actMN = false;
					//nesse caso vamos ter que apresentar a janela de busca
					MakeWindow(35, 6, 23, 7, "Busca Registro", WHITE, BLACK, GOOGLE1);
						MakeField(9, 3, 4, "Cod:", BLACK, WHITE, NUMBERS, GOOGLE1);
						MakeButton(11, 6, 10, "Busca", MAGENTA, WHITE, GOOGLE1);
					WinListener(GOOGLE1);
				break;
				case 4: //sair menu agendamentos
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					actMN = false;
				break;
			}
		break;
		
		case 3: //menu de relatorios
			switch(ind){
				case 1: //relatorios de salas
					//refaz menu
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					//desfaz subs
					actMN = false;
					//chama relatorios
					relataRoom();
				break;
				case 2: //relatorios de agendamentos
					//refaz menu
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					//desfaz subs
					actMN = false;
					//chama relatorios
					relataAgend();
				break;
				case 3:
					//refaz menu e sai
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					actMN = false;
				break;
			}
		break;
		
		case 4: //menu 4 sair
			switch(ind){
				case 1: //sim
					mexit = true;
					pexit = true;
				break;
				case 2: //n�o
					hidemouseptr();
					RemakeStage();
					showmouseptr();
					actMN = false;
				break;
			}
		break;
	}
}