Exemplo n.º 1
0
entry_goto(FILE *outfile)
#endif
{
	struct Entrypoint *e = entries;
	int k = 0;

	nice_printf(outfile, "switch(n__) {\n");
	next_tab(outfile);
	while(e = e->entnextp)
		nice_printf(outfile, "case %d: goto %s;\n", ++k,
			user_label((long)(extsymtab - e->entryname - 1)));
	nice_printf(outfile, "}\n\n");
	prev_tab(outfile);
	}
Exemplo n.º 2
0
// move cursor to next tabstop
void cursor_tab(termstate_t *term)
{
    // if there are no tabs defined, use tab = 8 chars
    // note: this is not requested by the standard
    if (term->tabs[0]==0 && term->tab_last == -1)
    {
        term->cur_x = ((term->cur_x + 8) / 8) * 8;
        if (term->cur_x > term->w)
            cursor_nl(term);
    }
    else // go to next tab in tab array
    {
        term->cur_x = next_tab( term, term->cur_x );
    }
}
Exemplo n.º 3
0
wr_common_decls(FILE *outfile)
#endif
{
    Extsym *ext;
    extern int extcomm;
    static char *Extern[4] = {"", "Extern ", "extern "};
    char *E, *E0 = Extern[extcomm];
    int did_one = 0;

    for (ext = extsymtab; ext < nextext; ext++) {
	if (ext -> extstg == STGCOMMON && ext->allextp) {
	    chainp comm;
	    int count = 1;
	    int which;			/* which display to use;
					   ONE_STRUCT, UNION or INIT */

	    if (!did_one)
		nice_printf (outfile, "/* Common Block Declarations */\n\n");

	    pad_common(ext);

/* Construct the proper, condensed list of structs; eliminate duplicates
   from the initial list   ext -> allextp   */

	    comm = ext->allextp = revchain(ext->allextp);

	    if (ext -> extinit)
		which = INIT_STRUCT;
	    else if (comm->nextp) {
		which = UNION_STRUCT;
		nice_printf (outfile, "%sunion {\n", E0);
		next_tab (outfile);
		E = "";
		}
	    else {
		which = ONE_STRUCT;
		E = E0;
		}

	    for (; comm; comm = comm -> nextp, count++) {

		if (which == INIT_STRUCT)
		    nice_printf (outfile, "struct %s%d_ {\n",
			    ext->cextname, count);
		else
		    nice_printf (outfile, "%sstruct {\n", E);

		next_tab (c_file);

		wr_struct (outfile, (chainp) comm -> datap);

		prev_tab (c_file);
		if (which == UNION_STRUCT)
		    nice_printf (outfile, "} _%d;\n", count);
		else if (which == ONE_STRUCT)
		    nice_printf (outfile, "} %s;\n", ext->cextname);
		else
		    nice_printf (outfile, "};\n");
	    } /* for */

	    if (which == UNION_STRUCT) {
		prev_tab (c_file);
		nice_printf (outfile, "} %s;\n", ext->cextname);
	    } /* if */
	    did_one = 1;
	    nice_printf (outfile, "\n");

	    for (count = 1, comm = ext -> allextp; comm;
		    comm = comm -> nextp, count++) {
		def_start(outfile, ext->cextname,
			comm_union_name(count), "");
		switch (which) {
		    case ONE_STRUCT:
		        extern_out (outfile, ext);
		        break;
		    case UNION_STRUCT:
		        nice_printf (outfile, "(");
			extern_out (outfile, ext);
			nice_printf(outfile, "._%d)", count);
		        break;
		    case INIT_STRUCT:
			nice_printf (outfile, "(*(struct ");
			extern_out (outfile, ext);
			nice_printf (outfile, "%d_ *) &", count);
			extern_out (outfile, ext);
			nice_printf (outfile, ")");
		        break;
		} /* switch */
		nice_printf (outfile, "\n");
	    } /* for count = 1, comm = ext -> allextp */
	    nice_printf (outfile, "\n");
	} /* if ext -> extstg == STGCOMMON */
    } /* for ext = extsymtab */
} /* wr_common_decls */
Exemplo n.º 4
0
putentries(FILE *outfile)
#endif
	/* put out wrappers for multiple entries */
{
	char base[IDENT_LEN];
	struct Entrypoint *e;
	Namep *A, *Ae, *Ae1, **Alp, *a, **a1, np;
	chainp args, lengths;
	int i, k, mt, nL, type;
	extern char *dfltarg[], **dfltproc;

	e = entries;
	if (!e->enamep) /* only possible with erroneous input */
		return;
	nL = (nallargs + nallchargs) * sizeof(Namep *);
	A = (Namep *)ckalloc(nL + nallargs*sizeof(Namep **));
	Ae = A + nallargs;
	Alp = (Namep **)(Ae1 = Ae + nallchargs);
	i = k = 0;
	for(a1 = Alp, args = allargs; args; a1++, args = args->nextp) {
		np = (Namep)args->datap;
		if (np->vtype == TYCHAR && np->vclass != CLPROC)
			*a1 = &Ae[i++];
		}

	mt = multitype;
	multitype = 0;
	sprintf(base, "%s0_", e->enamep->cvarname);
	do {
		np = e->enamep;
		lengths = length_comp(e, 0);
		proctype = type = np->vtype;
		if (protofile)
			protowrite(protofile, type, np->cvarname, e, lengths);
		nice_printf(outfile, "\n%s ", c_type_decl(type, 1));
		nice_printf(outfile, "%s", np->cvarname);
		if (!Ansi) {
			listargs(outfile, e, 0, lengths);
			nice_printf(outfile, "\n");
			}
	    	list_arg_types(outfile, e, lengths, 0, "\n");
		nice_printf(outfile, "{\n");
		frchain(&lengths);
		next_tab(outfile);
		if (mt)
			nice_printf(outfile,
				"Multitype ret_val;\n%s(%d, &ret_val",
				base, k); /*)*/
		else if (ISCOMPLEX(type))
			nice_printf(outfile, "%s(%d,%s", base, k,
				xretslot[type]->user.ident); /*)*/
		else if (type == TYCHAR)
			nice_printf(outfile,
				"%s(%d, ret_val, ret_val_len", base, k); /*)*/
		else
			nice_printf(outfile, "return %s(%d", base, k); /*)*/
		k++;
		memset((char *)A, 0, nL);
		for(args = e->arglist; args; args = args->nextp) {
			np = (Namep)args->datap;
			A[np->argno] = np;
			if (np->vtype == TYCHAR && np->vclass != CLPROC)
				*Alp[np->argno] = np;
			}
		args = allargs;
		for(a = A; a < Ae; a++, args = args->nextp)
			nice_printf(outfile, ", %s", (np = *a)
				? np->cvarname
				: ((Namep)args->datap)->vclass == CLPROC
				? dfltproc[((Namep)args->datap)->vtype]
				: dfltarg[((Namep)args->datap)->vtype]);
		for(; a < Ae1; a++)
			if (np = *a)
				nice_printf(outfile, ", %s_len", np->fvarname);
			else
				nice_printf(outfile, ", (ftnint)0");
		nice_printf(outfile, /*(*/ ");\n");
		if (mt) {
			if (type == TYCOMPLEX)
				nice_printf(outfile,
		    "r_v->r = ret_val.c.r; r_v->i = ret_val.c.i;\n");
			else if (type == TYDCOMPLEX)
				nice_printf(outfile,
		    "r_v->r = ret_val.z.r; r_v->i = ret_val.z.i;\n");
			else if (type <= TYLOGICAL)
				nice_printf(outfile, "return ret_val.%s;\n",
					postfix[type-TYINT1]);
			}
		nice_printf(outfile, "}\n");
		prev_tab(outfile);
		}
		while(e = e->entnextp);
	free((char *)A);
	}
Exemplo n.º 5
0
ToolBox::ToolBox(/*LayersManager* layersManager,*/ QWidget *parent)
{
    this->setParent(parent);
    ui.setupUi(this);

    //this->status = UwStatus::getInstance();
    //debug = status->debug();
    //  this->settingsManager = SettingsManager::getInstance();

    //loadStyleSheet();

    //this->layersManager = layersManager;
    //   this->dataSimulator = DataSimulator::getInstance();

    this->actual_profile = NULL;
    ui.upButton->setEnabled(false);
    ui.downButton->setEnabled(false);

    connect(Tab::group,SIGNAL(buttonClicked(QAbstractButton*)),
            this,SLOT(change_profile_menu(QAbstractButton*)));

    connect(ui.downButton,SIGNAL(clicked()),this,SLOT(next_tab()));
    connect(ui.upButton,SIGNAL(clicked()),this,SLOT(previous_tab()));

    ui.spoilgrnd_rCB->setEnabled(false);
    ui.dock_rCB->setEnabled(false);
    ui.closinglne_lCB->setEnabled(false);
    ui.ferry_lCB->setEnabled(false);
    ui.rock_pCB->setEnabled(false); //this should be undisabled
    ui.checkpoint_pCB->setEnabled(false);
    ui.fortstruct_pCB->setEnabled(false);
    ui.obstacles_CB->setEnabled( false);

    ui.lockButton->setEnabled( true);
    ui.destinyButton->setEnabled( true);
    ui.zoomBoatButton->setEnabled( true);
    ui.obstaclesButton->setEnabled( false);
    ui.polarDiagramNamesComboBox->setEnabled( false);
    ui.simPosButton->setEnabled( false);
    ui.simRouteButton->setEnabled( false);

    QStringList routeOptions;
    routeOptions << "The Shortest Route" << "The Fastest Route";
    ui.routeComboBox->addItems(routeOptions);
    ui.routeComboBox->setCurrentIndex(0);
    ui.routeComboBox->setEnabled(false);
    ui.routeButton->setEnabled(false);

    connect( ui.zoomInButton, SIGNAL( clicked() ), this, SIGNAL( zoomInS() ) );
    connect( ui.zoomOutButton, SIGNAL( clicked() ), this, SIGNAL( zoomOutS() ) );
    connect( ui.rotateLeftButton, SIGNAL( clicked() ), this, SIGNAL( rotateLeftS() ) );
    connect( ui.rotateRightButton, SIGNAL( clicked() ), this, SIGNAL( rotateRightS() ) );
    connect( ui.zoomChartButton, SIGNAL( clicked() ), this, SIGNAL( zoomChart()));
    connect( ui.zoomBoatButton, SIGNAL( clicked() ), this, SIGNAL( zoomBoat()));
    connect( ui.zoomToolButton, SIGNAL( clicked() ), this, SLOT(on_zoomToolButton_clicked()));

    connect( ui.obstacles_CB, SIGNAL( stateChanged(int) ), this, SLOT( obstacles_CBChanged(int) ) );
    connect( ui.generarea_rCB, SIGNAL( stateChanged(int) ), this, SLOT( generarea_rCBChanged(int) ) );
    connect( ui.deptharea_rCB, SIGNAL( stateChanged(int) ), this, SLOT( deptharea_rCBChanged(int) ) );
    connect( ui.lake_rCB, SIGNAL( stateChanged(int) ), this, SLOT( lake_rCBChanged(int) ) );
    connect( ui.spoilgrnd_rCB, SIGNAL( stateChanged(int) ), this, SLOT( spoilgrnd_rCBChanged(int) ) );
    connect( ui.limit_rCB, SIGNAL( stateChanged(int) ), this, SLOT( limit_rCBChanged(int) ) );
    connect( ui.builtupare_rCB, SIGNAL( stateChanged(int) ), this, SLOT( builtupare_rCBChanged(int) ) );
    connect( ui.fwayarea_rCB, SIGNAL( stateChanged(int) ), this, SLOT( fwayarea_rCBChanged(int) ) );
    connect( ui.survqual_rCB, SIGNAL( stateChanged(int) ), this, SLOT( survqual_rCBChanged(int) ) );
    connect( ui.building_rCB, SIGNAL( stateChanged(int) ), this, SLOT( building_rCBChanged(int) ) );
    connect( ui.dock_rCB, SIGNAL( stateChanged(int) ), this, SLOT( dock_rCBChanged(int) ) );
    connect( ui.depthcont_lCB, SIGNAL( stateChanged(int) ), this, SLOT( depthcont_lCBChanged(int) ) );
    connect( ui.coastline_lCB, SIGNAL( stateChanged(int) ), this, SLOT( coastline_lCBChanged(int) ) );
    connect( ui.closinglne_lCB, SIGNAL( stateChanged(int) ), this, SLOT( closinglne_lCBChanged(int) ) );
    connect( ui.navigline_lCB, SIGNAL( stateChanged(int) ), this, SLOT( navigline_lCBChanged(int) ) );
    connect( ui.ferry_lCB, SIGNAL( stateChanged(int) ), this, SLOT( ferry_lCBChanged(int) ) );
    connect( ui.limit_lCB, SIGNAL( stateChanged(int) ), this, SLOT( limit_lCBChanged(int) ) );
    connect( ui.heightcont_lCB, SIGNAL( stateChanged(int) ), this, SLOT( heightcont_lCBChanged(int) ) );
    connect( ui.leadinglne_lCB, SIGNAL( stateChanged(int) ), this, SLOT( leadinglne_lCBChanged(int) ) );
    connect( ui.lockndam_lCB, SIGNAL( stateChanged(int) ), this, SLOT( lockndam_lCBChanged(int) ) );
    connect( ui.pipeline_lCB, SIGNAL( stateChanged(int) ), this, SLOT( pipeline_lCBChanged(int) ) );
    connect( ui.submcable_lCB, SIGNAL( stateChanged(int) ), this, SLOT( submcable_lCBChanged(int) ) );
    connect( ui.roadnrailw_lCB, SIGNAL( stateChanged(int) ), this, SLOT( roadnrailw_lCBChanged(int) ) );
    connect( ui.bridge_lCB, SIGNAL( stateChanged(int) ), this, SLOT( bridge_lCBChanged(int) ) );
    connect( ui.transmline_lCB, SIGNAL( stateChanged(int) ), this, SLOT( transmline_lCBChanged(int) ) );
    connect( ui.river_lCB, SIGNAL( stateChanged(int) ), this, SLOT( river_lCBChanged(int) ) );
    connect( ui.shlnecon_lCB, SIGNAL( stateChanged(int) ), this, SLOT( shlnecon_lCBChanged(int) ) );
    connect( ui.navaid_pCB, SIGNAL( stateChanged(int) ), this, SLOT( navaid_pCBChanged(int) ) );
    connect( ui.limit_pCB, SIGNAL( stateChanged(int) ), this, SLOT( limit_pCBChanged(int) ) );
    connect( ui.towernmast_pCB, SIGNAL( stateChanged(int) ), this, SLOT( towernmast_pCBChanged(int) ) );
    connect( ui.signsound_pCB, SIGNAL( stateChanged(int) ), this, SLOT( signsound_pCBChanged(int) ) );
    connect( ui.ctext_pCB, SIGNAL( stateChanged(int) ), this, SLOT( ctext_pCBChanged(int) ) );
    connect( ui.vegetation_pCB, SIGNAL( stateChanged(int) ), this, SLOT( vegetation_pCBChanged(int) ) );
    connect( ui.moorfacil_pCB, SIGNAL( stateChanged(int) ), this, SLOT( moorfacil_pCBChanged(int) ) );
    connect( ui.natseabed_pCB, SIGNAL( stateChanged(int) ), this, SLOT( natseabed_pCBChanged(int) ) );
    connect( ui.obstruct_pCB, SIGNAL( stateChanged(int) ), this, SLOT( obstruct_pCBChanged(int) ) );
    connect( ui.harbour_pCB, SIGNAL( stateChanged(int) ), this, SLOT( harbour_pCBChanged(int) ) );
    connect( ui.marservice_pCB, SIGNAL( stateChanged(int) ), this, SLOT( marservice_pCBChanged(int) ) );
    connect( ui.wreck_pCB, SIGNAL( stateChanged(int) ), this, SLOT( wreck_pCBChanged(int) ) );
    connect( ui.building_pCB, SIGNAL( stateChanged(int) ), this, SLOT( building_pCBChanged(int) ) );
    connect( ui.rock_pCB, SIGNAL( stateChanged(int) ), this, SLOT( rock_pCBChanged(int) ) );
    connect( ui.checkpoint_pCB, SIGNAL( stateChanged(int) ), this, SLOT( checkpoint_pCBChanged(int) ) );
    connect( ui.fortstruct_pCB, SIGNAL( stateChanged(int) ), this, SLOT( fortstruct_pCBChanged(int) ) );
    connect( ui.lightsCB, SIGNAL( stateChanged(int) ), this, SLOT( lightsCBChanged(int) ) );

    connect( ui.spinBox, SIGNAL(valueChanged(int)), this, SLOT(brightnessChanged(int)));

    this->initializeInstruments();
    this->initializeLayerBoxes();
}
Exemplo n.º 6
0
prolog(FILE *outfile, register chainp p)
#endif
{
	int addif, addif0, i, nd;
	ftnint size;
	int *ac;
	register Namep q;
	register struct Dimblock *dp;
	chainp p0, p1;

	if(procclass == CLBLOCK)
		return;
	p0 = p;
	p1 = p = argsort(p);
	wrote_comment = 0;
	comment_file = outfile;
	ac = 0;

/* Compute the base addresses and offsets for the array parameters, and
   assign these values to local variables */

	addif = addif0 = nentry > 1;
	for(; p ; p = p->nextp)
	{
	    q = (Namep) p->datap;
	    if(dp = q->vdim)	/* if this param is an array ... */
	    {
		expptr Q, expr;

		/* See whether to protect the following with an if. */
		/* This only happens when there are multiple entries. */

		nd = dp->ndim - 1;
		if (addif0) {
			if (!ac)
				ac = count_args();
			if (ac[q->argno] == nentry)
				addif = 0;
			else if (dp->basexpr
				    || dp->baseoffset->constblock.Const.ci)
				addif = 1;
			else for(addif = i = 0; i <= nd; i++)
				if (dp->dims[i].dimexpr
				&& (i < nd || !q->vlastdim)) {
					addif = 1;
					break;
					}
			if (addif) {
				write_comment();
				nice_printf(outfile, "if (%s) {\n", /*}*/
						q->cvarname);
				next_tab(outfile);
				}
			}
		for(i = 0 ; i <= nd; ++i)

/* Store the variable length of each dimension (which is fixed upon
   runtime procedure entry) into a local variable */

		    if ((Q = dp->dims[i].dimexpr)
			&& (i < nd || !q->vlastdim)) {
			expr = (expptr)cpexpr(Q);
			write_comment();
			out_and_free_statement (outfile, mkexpr (OPASSIGN,
				fixtype(cpexpr(dp->dims[i].dimsize)), expr));
		    } /* if dp -> dims[i].dimexpr */

/* size   will equal the size of a single element, or -1 if the type is
   variable length character type */

		size = typesize[ q->vtype ];
		if(q->vtype == TYCHAR)
		    if( ISICON(q->vleng) )
			size *= q->vleng->constblock.Const.ci;
		    else
			size = -1;

		/* Fudge the argument pointers for arrays so subscripts
		 * are 0-based. Not done if array bounds are being checked.
		 */
		if(dp->basexpr) {

/* Compute the base offset for this procedure */

		    write_comment();
		    out_and_free_statement (outfile, mkexpr (OPASSIGN,
			    cpexpr(fixtype(dp->baseoffset)),
			    cpexpr(fixtype(dp->basexpr))));
		} /* if dp -> basexpr */

		if(! checksubs) {
		    if(dp->basexpr) {
			expptr tp;

/* If the base of this array has a variable adjustment ... */

			tp = (expptr) cpexpr (dp -> baseoffset);
			if(size < 0 || q -> vtype == TYCHAR)
			    tp = mkexpr (OPSTAR, tp, cpexpr (q -> vleng));

			write_comment();
			tp = mkexpr (OPMINUSEQ,
				mkconv (TYADDR, (expptr)p->datap),
				mkconv(TYINT, fixtype
				(fixtype (tp))));
/* Avoid type clash by removing the type conversion */
			tp = prune_left_conv (tp);
			out_and_free_statement (outfile, tp);
		    } else if(dp->baseoffset->constblock.Const.ci != 0) {

/* if the base of this array has a nonzero constant adjustment ... */

			expptr tp;

			write_comment();
			if(size > 0 && q -> vtype != TYCHAR) {
			    tp = prune_left_conv (mkexpr (OPMINUSEQ,
				    mkconv (TYADDR, (expptr)p->datap),
				    mkconv (TYINT, fixtype
				    (cpexpr (dp->baseoffset)))));
			    out_and_free_statement (outfile, tp);
			} else {
			    tp = prune_left_conv (mkexpr (OPMINUSEQ,
				    mkconv (TYADDR, (expptr)p->datap),
				    mkconv (TYINT, fixtype
				    (mkexpr (OPSTAR, cpexpr (dp -> baseoffset),
				    cpexpr (q -> vleng))))));
			    out_and_free_statement (outfile, tp);
			} /* else */
		    } /* if dp -> baseoffset -> const */
		} /* if !checksubs */

		if (addif) {
			nice_printf(outfile, /*{*/ "}\n");
			prev_tab(outfile);
			}
	    }
	}
	if (wrote_comment)
	    nice_printf (outfile, "\n/* Function Body */\n");
	if (ac)
		free((char *)ac);
	if (p0 != p1)
		frchain(&p1);
} /* prolog */