Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 8e0892f437dcb3d5ba77a29c8d5dce6e6e765928
  • master par défaut protégée
  • dev
  • dev-admin
  • migration-pg
  • dev-partie
  • dev-deplacement-msg-erreurs
  • dev-jeux-favoris
  • dev-update-forms
  • dev-header-profil-deconnexion
  • dev-contact
  • dev_page_accueil
  • dev-edit-profil
  • dev-classement
  • dev_espace_membre
  • dev-images
  • javascript_valid_form
  • application_design_views
  • dev-table
  • dev-nestor
20 résultats

ProfilController.php

Blame
  • tool.c 3,74 Kio
    
    #include <utils/p2c.h>
    #include <graphics/newkbd.h>
    #include "logdef.h"
    #include "logglobals.h"
    #include "utils.h"
    #include "node.h"
    
    void newtool(log_tool **t, char *name)
    {
    	log_tool *t2;
    
    	*t = (log_tool *)Malloc(sizeof(log_tool));
    	strcpy((*t)->name, name);
    	(*t)->ready = false;
    	(*t)->simulator = false;
    	(*t)->keep = false;
    	(*t)->nostatus = false;
    	(*t)->fname = NULL;
    	(*t)->comment = (char *)Malloc(256);
    	*(*t)->comment = '\0';
    	(*t)->info = (na_long)0;
    	(*t)->nlbl = NULL;
    	(*t)->hlbl = NULL;
    	(*t)->shortname = (char *)Malloc(33);
    	strcpy((*t)->shortname, name);
    	stamp(&(*t)->netstamp);
    	(*t)->deltatime = 0.0;
    	t2 = gg.toolbase;
    	while (t2 != NULL && t2->next != NULL)
    		t2 = t2->next;
    	if (t2 == NULL)
    		gg.toolbase = *t;
    	else
    		t2->next = *t;
    	(*t)->next = NULL;
    }
    
    
    log_tool *findtool(char *name_)
    {
    	log_tool *Result;
    	char name[17];
    	log_tool *lp;
    	char savefunc[17];
    	char saveargs[256];
    	char suffix[51];
    	void (*proc) (log_action_t *act);
    	int ready;
    	cnfrec *cnfp;
    
    	strcpy(name, name_);
    	strcpy(savefunc, gg.func);
    	strcpy(saveargs, gg.funcarg);
    	lp = gg.toolbase;
    	while (lp != NULL && strcmp(lp->name, name))
    		lp = lp->next;
    	if (lp == NULL)
    		newtool(&lp, name);
    	if (!lp->ready)
    	{
    		sprintf(suffix, "LOG_%s_PROC", name);
    		ready = findprocedure(suffix, (void(**) ())(&proc));
    		if (gg.traceflag)
    			fprintf(tracefile, "Findtool to load: %s -  %s.\n", suffix, lp->fname);
    
    		if (!ready && lp->fname != NULL)
    		{
    			TRY(try2);
    			newci_fixfname(lp->fname, "code", "");
    			if (gg.traceflag)
    				fprintf(tracefile, "Findtool, loading %s\n", lp->fname);
    			//newci_loadprogram(lp->fname); << do nothing
    			RECOVER(try2);
    			if (P_escapecode == -20)
    				_Escape(P_escapecode);
    			ENDTRY(try2);
    			ready = findprocedure(suffix, (void(**) ())(&proc));
    			if (gg.traceflag)
    				fprintf(tracefile, "Findtool, ready=%s\n", ready ? " TRUE" : "FALSE");
    		}
    
    		if (ready)
    		{
    			lp->proc = proc;
    			gg.action = act_init;
    			gg.acttool = lp;
    			(*proc)(&gg);
    			if (lp->ready)
    			{
    				cnfp = cnfbase;
    				while (cnfp != NULL)
    				{
    					if (!strcmp(cnfp->tool, name))
    					{
    						doingcnffunction = true;
    						gg.action = act_cnf;
    						strcpy(gg.funcarg, cnfp->s);
    						getword(gg.funcarg, gg.func);
    						(*proc)(&gg);
    						doingcnffunction = false;
    					}
    					cnfp = cnfp->next;
    				}
    				gg.action = act_color;
    				(*proc)(&gg);
    				gg.action = act_endinit;
    				(*proc)(&gg);
    				lp->nexttstep = 0.0;
    				lp->nnumattrs = 0;
    				lp->nattr = NULL;
    				if (lp->nlbl != NULL)
    					parselabel(&lp->nlbl, &lp->nnumattrs, &lp->nattr);
    				lp->hnumattrs = 0;
    				lp->hattr = NULL;
    				if (lp->hlbl != NULL)
    					parselabel(&lp->hlbl, &lp->hnumattrs, &lp->hattr);
    			}
    		}
    	}
    	Result = lp;
    	strcpy(gg.func, savefunc);
    	strcpy(gg.funcarg, saveargs);
    	return Result;
    }
    
    
    void calltool(log_tool *t, log_actionkinds act)
    {
    	log_tool *savetool;
    
    	savetool = gg.acttool;
    	gg.action = act;
    	gg.acttool = t;
    	(*t->proc)(&gg);
    	gg.acttool = savetool;
    }
    
    
    void calltoolgate(log_grec *g, log_actionkinds act)
    {
    	gg.actgate = g;
    	calltool(g->kind->simtype, act);
    }
    
    
    void calltoolnode(log_nrec *n, log_actionkinds act)
    {
    	gg.actnode = n;
    	calltool(n->simtype, act);
    }
    
    void calltoolkind(log_krec *k, log_actionkinds act)
    {
    	gg.actkind = k;
    	calltool(k->simtype, act);
    }
    
    void calltools(log_actionkinds act)
    {
    	log_tool *tp;
    
    	tp = gg.toolbase;
    	while (tp != NULL)
    	{
    		if (tp->ready)
    			calltool(tp, act);
    		tp = tp->next;
    	}
    }
    
    
    void callsimtools(log_actionkinds act)
    {
    	log_tool *tp;
    
    	tp = gg.toolbase;
    	while (tp != NULL)
    	{
    		if (tp->ready && tp->simulator)
    			calltool(tp, act);
    		tp = tp->next;
    	}
    }
    
    void closetool(log_tool *tp)
    {
    	if (tp->ready)
    		calltool(tp, act_exit);
    	tp->ready = false;
    }
    
    
    void closetools()
    {
    	log_tool *tp;
    
    	tp = gg.toolbase;
    	while (tp != NULL)
    	{
    		closetool(tp);
    		tp = tp->next;
    	}
    }