Пример #1
0
pad_common(Extsym *c)
#endif
{
	register chainp cvl;
	register Namep v;
	long L = c->maxleng;
	int type;
	struct Dimblock *t;
	int szshort = typesize[TYSHORT];

	for(cvl = c->allextp; cvl; cvl = cvl->nextp)
		if (commlen((chainp)cvl->datap) >= L)
			return;
	v = ALLOC(Nameblock);
	v->vtype = type = L % szshort ? TYCHAR
				      : type_choice[L/szshort % 4];
	v->vstg = STGCOMMON;
	v->vclass = CLVAR;
	v->tag = TNAME;
	v->vdim = t = ALLOC(Dimblock);
	t->ndim = 1;
	t->dims[0].dimsize = ICON(L / typesize[type]);
	v->fvarname = v->cvarname = "eqv_pad";
	if (type == TYCHAR)
		v->vleng = ICON(1);
	c->allextp = mkchain((char *)mkchain((char *)v, CHNULL), c->allextp);
	}
Пример #2
0
int main()
{ 
    int i,n,j,a[CON(SIZE)+1]={0};
    n=(int)ceil(sqrt(SIZE));n=CON(n);
    for(i=0;i<n;i++)
    {
        if(a[i]==0)   
            for(j=CON2(i);j<CON(SIZE);j+=ICON(i))
                a[j]=1;
    } 
    j=0; 
    for(i=0;i<=CON(SIZE);i++)
       if(a[i]==0)    
          {
            prime[j]=ICON(i);
            j++;
          }
    int t,m,f;
    scanf("%d",&t);
    while(t--)
    {
        int b[100010]={0},s=0;
        scanf("%d%d",&m,&n);
  		if(m<=2)printf("2\n"),m=3;      
		if(m%2==0)m++;
        if(n%2==0)n--;   
        f=(int)sqrt(n);
        for(i=0;i<3401;i++)
        {  
            if(prime[i]>f)break;          
			int start;
			if(m>=prime[i])
			{
				start=m+prime[i]-m%prime[i];
            	if(start%2==0)start+=prime[i];         
       			start-=m;
            	if(m%prime[i]==0 &&m!=prime[i])start=0;
			}
			else start=prime[i]*prime[i]-m;
            for(j=CONN(start);j<=(n-m)/2;j+=prime[i]) 
                b[j]=1;
        } 
        for(i=0;i<=(n-m)/2;i++)
            if(b[i]==0)
             // s++;
          printf("%d\n",ICON2(i)+m);
       // printf("%d\n",s);
            printf("\n");
    }
    return 0;
}
Пример #3
0
void VisualToolDrag::UpdateToggleButtons() {
	bool to_move = true;
	if (active_line) {
		Vector2D p1, p2;
		int t1, t2;
		to_move = !GetLineMove(active_line, p1, p2, t1, t2);
	}

	if (to_move == button_is_move) return;

	toolbar->SetToolNormalBitmap(toolbar->GetToolByPos(0)->GetId(),
		to_move ? ICON(visual_move_conv_move) : ICON(visual_move_conv_pos));
	button_is_move = to_move;
}
Пример #4
0
SubPanel *
subPanelNew(int type)
{
    SubPanel *p = NULL;

    /* Create new panel */
    p = PANEL(subSharedMemoryAlloc(1, sizeof(SubPanel)));
    p->flags = (SUB_TYPE_PANEL|type);

    /* Handle panel item type */
    switch(p->flags & (SUB_PANEL_ICON|SUB_PANEL_SUBLET|SUB_PANEL_VIEWS))
    {
    case SUB_PANEL_ICON: /* {{{ */
        p->icon = ICON(subSharedMemoryAlloc(1, sizeof(SubIcon)));
        break; /* }}} */
    case SUB_PANEL_SUBLET: /* {{{ */
        p->sublet = SUBLET(subSharedMemoryAlloc(1, sizeof(SubSublet)));

        /* Sublet specific */
        p->sublet->time   = subSubtleTime();
        p->sublet->text   = subSharedTextNew();
        p->sublet->style  = -1;
        break; /* }}} */
    case SUB_PANEL_VIEWS: /* {{{ */
        p->flags |= SUB_PANEL_DOWN;
        break; /* }}} */
    }

    subSharedLogDebugSubtle("new=panel, type=%s\n",
                            SUB_PANEL_VIEWS == type ? "views" : "title");

    return p;
} /* }}} */
Пример #5
0
void
wxMFrame::Create(const String &framename, wxWindow *parent)
{
   wxCHECK_RET( !m_initialised, _T("wxMFrame created twice") );

   SetName(framename);

   int xpos, ypos, width, height;
   bool startIconised, startMaximised;
   RestorePosition(MFrameBase::GetName(), &xpos, &ypos, &width, &height,
                   &startIconised, &startMaximised);

   // use name as default title
   if ( !wxFrame::Create(parent, -1, framename,
                         wxPoint(xpos, ypos), wxSize(width,height)) )
   {
      wxFAIL_MSG( _T("Failed to create a frame!") );

      return;
   }

   SetIcon(ICON(_T("MFrame")));

   // no "else": a frame can be maximized and iconized, meaning that it will
   // become maximized when restored
   if ( startMaximised )
      Maximize();
   if ( startIconised )
      Iconize();

   m_initialised = true;
   SetMenuBar(new wxMenuBar(wxMB_DOCKABLE));
}
Пример #6
0
void VisualToolDrag::SetToolbar(wxToolBar *tb) {
	toolbar = tb;
	toolbar->AddTool(-1, _("Toggle between \\move and \\pos"), ICON(visual_move_conv_move));
	toolbar->Realize();
	toolbar->Show(true);

	toolbar->Bind(wxEVT_COMMAND_TOOL_CLICKED, &VisualToolDrag::OnSubTool, this);
}
Пример #7
0
static void
media_init(struct media *media, NVGcontext *vg)
{
    /* load media */
    struct icons *icons = &media->icons;

    /* icons */
    icons->home = ICON(vg, "../icons/home.png");
    icons->directory = ICON(vg, "../icons/directory.png");
    icons->computer = ICON(vg, "../icons/computer.png");
    icons->desktop = ICON(vg, "../icons/desktop.png");
    icons->default_file = ICON(vg, "../icons/default.png");
    icons->text_file = ICON(vg, "../icons/text.png");
    icons->music_file = ICON(vg, "../icons/music.png");
    icons->font_file =  ICON(vg, "../icons/font.png");
    icons->img_file = ICON(vg, "../icons/img.png");
    icons->movie_file = ICON(vg, "../icons/movie.png");

    /* file groups */
    media->group[FILE_GROUP_DEFAULT] = FILE_GROUP(FILE_GROUP_DEFAULT,"default",&icons->default_file);
    media->group[FILE_GROUP_TEXT] = FILE_GROUP(FILE_GROUP_TEXT, "textual", &icons->text_file);
    media->group[FILE_GROUP_MUSIC] = FILE_GROUP(FILE_GROUP_MUSIC, "music", &icons->music_file);
    media->group[FILE_GROUP_FONT] = FILE_GROUP(FILE_GROUP_FONT, "font", &icons->font_file);
    media->group[FILE_GROUP_IMAGE] = FILE_GROUP(FILE_GROUP_IMAGE, "image", &icons->img_file);
    media->group[FILE_GROUP_MOVIE] = FILE_GROUP(FILE_GROUP_MOVIE, "movie", &icons->movie_file);

    /* files */
    media->files[FILE_DEFAULT] = FILE_DEF(FILE_DEFAULT, NULL, FILE_GROUP_DEFAULT);
    media->files[FILE_TEXT] = FILE_DEF(FILE_TEXT, "txt", FILE_GROUP_TEXT);
    media->files[FILE_C_SOURCE] = FILE_DEF(FILE_C_SOURCE, "c", FILE_GROUP_TEXT);
    media->files[FILE_CPP_SOURCE] = FILE_DEF(FILE_CPP_SOURCE, "cpp", FILE_GROUP_TEXT);
    media->files[FILE_HEADER] = FILE_DEF(FILE_HEADER, "h", FILE_GROUP_TEXT);
    media->files[FILE_MP3] = FILE_DEF(FILE_MP3, "mp3", FILE_GROUP_MUSIC);
    media->files[FILE_WAV] = FILE_DEF(FILE_WAV, "wav", FILE_GROUP_MUSIC);
    media->files[FILE_OGG] = FILE_DEF(FILE_OGG, "ogg", FILE_GROUP_MUSIC);
    media->files[FILE_TTF] = FILE_DEF(FILE_TTF, "ttf", FILE_GROUP_FONT);
    media->files[FILE_BMP] = FILE_DEF(FILE_BMP, "bmp", FILE_GROUP_IMAGE);
    media->files[FILE_PNG] = FILE_DEF(FILE_PNG, "png", FILE_GROUP_IMAGE);
    media->files[FILE_JPEG] = FILE_DEF(FILE_JPEG, "jpg", FILE_GROUP_IMAGE);
    media->files[FILE_PCX] = FILE_DEF(FILE_PCX, "pcx", FILE_GROUP_IMAGE);
    media->files[FILE_TGA] = FILE_DEF(FILE_TGA, "tga", FILE_GROUP_IMAGE);
    media->files[FILE_GIF] = FILE_DEF(FILE_GIF, "gif", FILE_GROUP_IMAGE);
}
Пример #8
0
autovar(register int nelt0, register int t, expptr lengp, char *name)
#endif
{
	ftnint leng;
	register Addrp q;
	register int nelt = nelt0 > 0 ? nelt0 : 1;
	extern char *av_pfix[];

	if(t == TYCHAR)
		if( ISICON(lengp) )
			leng = lengp->constblock.Const.ci;
		else	{
			Fatal("automatic variable of nonconstant length");
		}
	else
		leng = typesize[t];

	q = ALLOC(Addrblock);
	q->tag = TADDR;
	q->vtype = t;
	if(t == TYCHAR)
	{
		q->vleng = ICON(leng);
		q->varleng = leng;
	}
	q->vstg = STGAUTO;
	q->ntempelt = nelt;
	q->isarray = (nelt > 1);
	q->memoffset = ICON(0);

	/* kludge for nls so we can have ret_val rather than ret_val_4 */
	if (*name == ' ')
		unamstring(q, name);
	else {
		q->uname_tag = UNAM_IDENT;
		temp_name(av_pfix[t], ++autonum[t], q->user.ident);
		}
	if (nelt0 > 0)
		declare_new_addr (q);
	return(q);
}
Пример #9
0
void DkTransferToolBar::createIcons() {

    // user needs to decide...
    //this->setIconSize(QSize(16,16));

    toolBarIcons.resize(icon_toolbar_end);

    toolBarIcons[icon_toolbar_reset] = ICON("", ":/nomacs/img/gradient-reset.png");
    toolBarIcons[icon_toolbar_pipette] = ICON("", ":/nomacs/img/pipette.png");
    toolBarIcons[icon_toolbar_save] = ICON("", ":/nomacs/img/save.png");

    if (!DkSettings::display.defaultIconColor || DkSettings::app.privateMode) {
        // now colorize the icons
        toolBarIcons[icon_toolbar_reset].addPixmap(DkImage::colorizePixmap(toolBarIcons[icon_toolbar_reset].pixmap(100, QIcon::Normal, QIcon::Off), DkSettings::display.iconColor), QIcon::Normal, QIcon::Off);
        toolBarIcons[icon_toolbar_pipette].addPixmap(DkImage::colorizePixmap(toolBarIcons[icon_toolbar_pipette].pixmap(100, QIcon::Normal, QIcon::Off), DkSettings::display.iconColor), QIcon::Normal, QIcon::Off);
        toolBarIcons[icon_toolbar_save].addPixmap(DkImage::colorizePixmap(toolBarIcons[icon_toolbar_save].pixmap(100, QIcon::Normal, QIcon::Off), DkSettings::display.iconColor), QIcon::Normal, QIcon::Off);
    }

    toolBarActions.resize(toolbar_end);
    toolBarActions[toolbar_reset] = new QAction(toolBarIcons[icon_toolbar_reset], tr("Reset"), this);
    toolBarActions[toolbar_reset]->setStatusTip(tr("Resets the Pseudo Color function"));
    connect(toolBarActions[toolbar_reset], SIGNAL(triggered()), this, SLOT(resetGradient()));

    //toolBarActions[toolbar_reset]->setToolTip("was geht?");

    toolBarActions[toolbar_pipette] = new QAction(toolBarIcons[icon_toolbar_pipette], tr("Select Color"), this);
    toolBarActions[toolbar_pipette]->setStatusTip(tr("Adds a slider at the selected color value"));
    toolBarActions[toolbar_pipette]->setCheckable(true);
    toolBarActions[toolbar_pipette]->setChecked(false);
    connect(toolBarActions[toolbar_pipette], SIGNAL(triggered(bool)), this, SLOT(pickColor(bool)));

    toolBarActions[toolbar_save] = new QAction(toolBarIcons[icon_toolbar_save], tr("Save Gradient"), this);
    toolBarActions[toolbar_save]->setStatusTip(tr("Saves the current Gradient"));
    connect(toolBarActions[toolbar_save], SIGNAL(triggered()), this, SLOT(saveGradient()));

    addActions(toolBarActions.toList());

}
Пример #10
0
 LOCAL void
epicode(Void)
{
	extern int lastwasbranch;

	if(procclass==CLPROC)
	{
		if(proctype==TYSUBR)
		{

/* Return a zero only when the alternate return mechanism has been
   specified in the function header */

			if ((substars || Ansi) && lastwasbranch != YES)
			    p1_subr_ret (ICON(0));
		}
		else if (!multitype && lastwasbranch != YES)
			retval(proctype);
	}
	else if (procclass == CLMAIN && Ansi && lastwasbranch != YES)
		p1_subr_ret (ICON(0));
	lastwasbranch = NO;
}
Пример #11
0
wr_nv_ident_help(FILE *outfile, struct Addrblock *addrp)
#endif
{
    int eltcount = 0;

    if (addrp == (struct Addrblock *) NULL)
	return;

    if (addrp -> isarray) {
	frexpr (addrp -> memoffset);
	addrp -> memoffset = ICON(0);
	eltcount = addrp -> ntempelt;
	addrp -> ntempelt = 0;
	addrp -> isarray = 0;
    } /* if */
    out_addr (outfile, addrp);
    if (eltcount)
	nice_printf (outfile, "[%d]", eltcount);
} /* wr_nv_ident_help */
Пример #12
0
make_param(register struct Paramblock *p, expptr e)
#endif
{
    register expptr q;
    struct Constblock qc;

    p->vclass = CLPARAM;
    impldcl((Namep)p);
    if (e->headblock.vtype != TYCHAR)
        e = putx(fixtype(e));
    p->paramval = q = mkconv(p->vtype, e);
    if (p->vtype == TYCHAR) {
        if (q->tag == TEXPR)
            p->paramval = q = fixexpr((Exprp)q);
        if (q->tag == TADDR && q->addrblock.uname_tag == UNAM_CONST) {
            qc.Const = q->addrblock.user.Const;
            qc.tag = TCONST;
            qc.vtype = q->addrblock.vtype;
            qc.vleng = q->addrblock.vleng;
            q = (expptr)&qc;
        }
        if (!ISCONST(q) || q->constblock.vtype != TYCHAR) {
            errstr("invalid value for character parameter %s",
                   p->fvarname);
            return;
        }
        if (!(e = p->vleng))
            p->vleng = ICON(q->constblock.vleng->constblock.Const.ci
                            + q->constblock.Const.ccp1.blanks);
        else if (q->constblock.vleng->constblock.Const.ci
                 > e->constblock.Const.ci) {
            q->constblock.vleng->constblock.Const.ci
                = e->constblock.Const.ci;
            q->constblock.Const.ccp1.blanks = 0;
        }
        else
            q->constblock.Const.ccp1.blanks
                = e->constblock.Const.ci
                  - q->constblock.vleng->constblock.Const.ci;
    }
}
Пример #13
0
 void
freetemps(Void)
{
	register chainp p, p1;
	register Addrp q;
	register int t;

	p1 = holdtemps;
	while(p = p1) {
		q = (Addrp)p->datap;
		t = q->vtype;
		if (t == TYCHAR && q->varleng != 0) {
			/* restore clobbered character string lengths */
			frexpr(q->vleng);
			q->vleng = ICON(q->varleng);
			}
		p1 = p->nextp;
		p->nextp = templist[t];
		templist[t] = p;
		}
	holdtemps = 0;
	}
Пример #14
0
putconst(register Constp p)
#endif
{
	register Addrp q;
	struct Literal *litp, *lastlit;
	int k, len, type;
	int litflavor;
	double cd[2];
	ftnint nblanks;
	char *strp;
	char cdsbuf0[64], cdsbuf1[64], *ds[2];

	if (p->tag != TCONST)
		badtag("putconst", p->tag);

	q = ALLOC(Addrblock);
	q->tag = TADDR;
	type = p->vtype;
	q->vtype = ( type==TYADDR ? tyint : type );
	q->vleng = (expptr) cpexpr(p->vleng);
	q->vstg = STGCONST;

/* Create the new label for the constant.  This is wasteful of labels
   because when the constant value already exists in the literal pool,
   this label gets thrown away and is never reclaimed.  It might be
   cleaner to move this down past the first   switch()   statement below */

	q->memno = newlabel();
	q->memoffset = ICON(0);
	q -> uname_tag = UNAM_CONST;

/* Copy the constant info into the Addrblock; do this by copying the
   largest storage elts */

	q -> user.Const = p -> Const;
	q->user.kludge.vstg1 = p->vstg;	/* distinguish string from binary fp */

	/* check for value in literal pool, and update pool if necessary */

	k = 1;
	switch(type)
	{
	case TYCHAR:
		if (halign) {
			strp = p->Const.ccp;
			nblanks = p->Const.ccp1.blanks;
			len = p->vleng->constblock.Const.ci;
			litflavor = LIT_CHAR;
			goto loop;
			}
		else
			q->memno = BAD_MEMNO;
		break;
	case TYCOMPLEX:
	case TYDCOMPLEX:
		k = 2;
		if (p->vstg)
			cd[1] = atof(ds[1] = p->Const.cds[1]);
		else
			ds[1] = cds(dtos(cd[1] = p->Const.cd[1]), cdsbuf1);
	case TYREAL:
	case TYDREAL:
		litflavor = LIT_FLOAT;
		if (p->vstg)
			cd[0] = atof(ds[0] = p->Const.cds[0]);
		else
			ds[0] = cds(dtos(cd[0] = p->Const.cd[0]), cdsbuf0);
		goto loop;

	case TYLOGICAL1:
	case TYLOGICAL2:
	case TYLOGICAL:
		type = tylogical;
		goto lit_int_flavor;
	case TYLONG:
		type = tyint;
	case TYSHORT:
	case TYINT1:
#ifdef TYQUAD
	case TYQUAD:
#endif
 lit_int_flavor:
		litflavor = LIT_INT;

/* Scan the literal pool for this constant value.  If this same constant
   has been assigned before, use the same label.  Note that this routine
   does NOT consider two differently-typed constants with the same bit
   pattern to be the same constant */

 loop:
		lastlit = litpool + nliterals;
		for(litp = litpool ; litp<lastlit ; ++litp)

/* Remove this type checking to ensure that all bit patterns are reused */

			if(type == litp->littype) switch(litflavor)
			{
			case LIT_CHAR:
				if (len == (int)litp->litval.litival2[0]
				&& nblanks == litp->litval.litival2[1]
				&& !memcmp(strp, litp->cds[0], len)) {
					q->memno = litp->litnum;
					frexpr((expptr)p);
					q->user.Const.ccp1.ccp0 = litp->cds[0];
					return(q);
					}
				break;
			case LIT_FLOAT:
				if(cd[0] == litp->litval.litdval[0]
				&& !strcmp(ds[0], litp->cds[0])
				&& (k == 1 ||
				    cd[1] == litp->litval.litdval[1]
				    && !strcmp(ds[1], litp->cds[1]))) {
ret:
					q->memno = litp->litnum;
					frexpr((expptr)p);
					return(q);
					}
				break;

			case LIT_INT:
				if(p->Const.ci == litp->litval.litival)
					goto ret;
				break;
			}

/* If there's room in the literal pool, add this new value to the pool */

		if(nliterals < maxliterals)
		{
			++nliterals;

			/* litp   now points to the next free elt */

			litp->littype = type;
			litp->litnum = q->memno;
			switch(litflavor)
			{
			case LIT_CHAR:
				litp->litval.litival2[0] = len;
				litp->litval.litival2[1] = nblanks;
				q->user.Const.ccp = litp->cds[0] =
					memcpy(gmem(len,0), strp, len);
				break;

			case LIT_FLOAT:
				litp->litval.litdval[0] = cd[0];
				litp->cds[0] = copys(ds[0]);
				if (k == 2) {
					litp->litval.litdval[1] = cd[1];
					litp->cds[1] = copys(ds[1]);
					}
				break;

			case LIT_INT:
				litp->litval.litival = p->Const.ci;
				break;
			} /* switch (litflavor) */
		}
		else
			many("literal constants", 'L', maxliterals);

		break;
	case TYADDR:
	    break;
	default:
		badtype ("putconst", p -> vtype);
		break;
	} /* switch */

	if (type != TYCHAR || halign)
	    frexpr((expptr)p);
	return( q );
}
Пример #15
0
setdata(register Addrp varp, register Constp valp, ftnint elen)
#endif
{
    struct Constblock con;
    register int type;
    int i, k, valtype;
    ftnint offset;
    char *varname;
    static Addrp badvar;
    register unsigned char *s;
    static int last_lineno;
    static char *last_varname;

    if (varp->vstg == STGCOMMON) {
        if (!(dfile = blkdfile))
            dfile = blkdfile = opf(blkdfname, textwrite);
    }
    else {
        if (procclass == CLBLOCK) {
            if (varp != badvar) {
                badvar = varp;
                warn1("%s is not in a COMMON block",
                      varp->uname_tag == UNAM_NAME
                      ? varp->user.name->fvarname
                      : "???");
            }
            return;
        }
        if (!(dfile = initfile))
            dfile = initfile = opf(initfname, textwrite);
    }
    varname = dataname(varp->vstg, varp->memno);
    offset = varp->memoffset->constblock.Const.ci;
    type = varp->vtype;
    valtype = valp->vtype;
    if(type!=TYCHAR && valtype==TYCHAR)
    {
        if(! ftn66flag
                && (last_varname != cur_varname || last_lineno != lineno)) {
            /* prevent multiple warnings */
            last_lineno = lineno;
            warn1(
                "non-character datum %.42s initialized with character string",
                last_varname = cur_varname);
        }
        varp->vleng = ICON(typesize[type]);
        varp->vtype = type = TYCHAR;
    }
    else if( (type==TYCHAR && valtype!=TYCHAR) ||
             (cktype(OPASSIGN,type,valtype) == TYERROR) )
    {
        err("incompatible types in initialization");
        return;
    }
    if(type == TYADDR)
        con.Const.ci = valp->Const.ci;
    else if(type != TYCHAR)
    {
        if(valtype == TYUNKNOWN)
            con.Const.ci = valp->Const.ci;
        else	consconv(type, &con, valp);
    }

    k = 1;

    switch(type)
    {
    case TYLOGICAL:
    case TYINT1:
    case TYLOGICAL1:
    case TYLOGICAL2:
    case TYSHORT:
    case TYLONG:
#ifdef TYQUAD
    case TYQUAD:
#endif
        dataline(varname, offset, type);
        prconi(dfile, con.Const.ci);
        break;

    case TYADDR:
        dataline(varname, offset, type);
        prcona(dfile, con.Const.ci);
        break;

    case TYCOMPLEX:
    case TYDCOMPLEX:
        k = 2;
    case TYREAL:
    case TYDREAL:
        dataline(varname, offset, type);
        prconr(dfile, &con, k);
        break;

    case TYCHAR:
        k = valp -> vleng -> constblock.Const.ci;
        if (elen < k)
            k = elen;
        s = (unsigned char *)valp->Const.ccp;
        for(i = 0 ; i < k ; ++i) {
            dataline(varname, offset++, TYCHAR);
            fprintf(dfile, "\t%d\n", *s++);
        }
        k = elen - valp->vleng->constblock.Const.ci;
        if(k > 0) {
            dataline(varname, offset, TYBLANK);
            fprintf(dfile, "\t%d\n", k);
        }
        break;

    default:
        badtype("setdata", type);
    }

}
Пример #16
0
settype(register Namep v, register int type, register ftnint length)
#endif
{
	int type1;

	if(type == TYUNKNOWN)
		return;

	if(type==TYSUBR && v->vtype!=TYUNKNOWN && v->vstg==STGARG)
	{
		v->vtype = TYSUBR;
		frexpr(v->vleng);
		v->vleng = 0;
		v->vimpltype = 0;
	}
	else if(type < 0)	/* storage class set */
	{
		if(v->vstg == STGUNKNOWN)
			v->vstg = - type;
		else if(v->vstg != -type)
			dclerr("incompatible storage declarations", v);
	}
	else if(v->vtype == TYUNKNOWN
		|| v->vtype != type
			&& (v->vimpltype || v->vinftype || v->vinfproc))
	{
		if( (v->vtype = lengtype(type, length))==TYCHAR )
			if (length>=0)
				v->vleng = ICON(length);
			else if (parstate >= INDATA)
				v->vleng = ICON(1);	/* avoid a memory fault */
		v->vimpltype = 0;
		v->vinftype = 0; /* 19960709 */
		v->vinfproc = 0; /* 19960709 */

		if (v->vclass == CLPROC) {
			if (v->vstg == STGEXT
			 && (type1 = extsymtab[v->vardesc.varno].extype)
			 &&  type1 != v->vtype)
				changedtype(v);
			else if (v->vprocclass == PTHISPROC
					&& (parstate >= INDATA
						|| procclass == CLMAIN)
					&& !xretslot[type]) {
				xretslot[type] = autovar(ONEOF(type,
					MSKCOMPLEX|MSKCHAR) ? 0 : 1, type,
					v->vleng, " ret_val");
				if (procclass == CLMAIN)
					errstr(
				"illegal use of %.60s (main program name)",
					v->fvarname);
				/* not completely right, but enough to */
				/* avoid memory faults; we won't */
				/* emit any C as we have illegal Fortran */
				}
			}
	}
	else if(v->vtype != type && v->vtype != lengtype(type, length)) {
 incompat:
		dclerr("incompatible type declarations", v);
		}
	else if (type==TYCHAR)
		if (v->vleng && v->vleng->constblock.Const.ci != length)
			goto incompat;
		else if (parstate >= INDATA)
			v->vleng = ICON(1);	/* avoid a memory fault */
}
Пример #17
0
wr_globals(FILE *outfile)
#endif
{
    struct Literal *litp, *lastlit;
    extern int hsize;
    char *litname;
    int did_one, t;
    struct Constblock cb;
    ftnint x, y;

    if (nliterals == 0)
	return;

    lastlit = litpool + nliterals;
    did_one = 0;
    for (litp = litpool; litp < lastlit; litp++) {
	if (!litp->lituse)
		continue;
	litname = lit_name(litp);
	if (!did_one) {
		margin_printf(outfile, "/* Table of constant values */\n\n");
		did_one = 1;
		}
	cb.vtype = litp->littype;
	if (litp->littype == TYCHAR) {
		x = litp->litval.litival2[0] + litp->litval.litival2[1];
		if (y = x % hsize)
			x += y = hsize - y;
		nice_printf(outfile,
			"static struct { %s fill; char val[%ld+1];", halign, x);
		nice_printf(outfile, " char fill2[%ld];", hsize - 1);
		nice_printf(outfile, " } %s_st = { 0,", litname);
		cb.vleng = ICON(litp->litval.litival2[0]);
		cb.Const.ccp = litp->cds[0];
		cb.Const.ccp1.blanks = litp->litval.litival2[1] + y;
		cb.vtype = TYCHAR;
		out_const(outfile, &cb);
		frexpr(cb.vleng);
		nice_printf(outfile, " };\n");
		nice_printf(outfile, "#define %s %s_st.val\n", litname, litname);
		continue;
		}
	nice_printf(outfile, "static %s %s = ",
		c_type_decl(litp->littype,0), litname);

	t = litp->littype;
	if (ONEOF(t, MSKREAL|MSKCOMPLEX)) {
		cb.vstg = 1;
		cb.Const.cds[0] = litp->cds[0];
		cb.Const.cds[1] = litp->cds[1];
		}
	else {
		memcpy((char *)&cb.Const, (char *)&litp->litval,
			sizeof(cb.Const));
		cb.vstg = 0;
		}
	out_const(outfile, &cb);

	nice_printf (outfile, ";\n");
    } /* for */
    if (did_one)
    	nice_printf (outfile, "\n");
} /* wr_globals */
Пример #18
0
setbound(Namep v, int nd, struct Dims *dims)
#endif
{
	expptr q, q0, t;
	struct Dimblock *p;
	int i;
	extern chainp new_vars;
	char buf[256];

	if(v->vclass == CLUNKNOWN)
		v->vclass = CLVAR;
	else if(v->vclass != CLVAR)
	{
		dclerr("only variables may be arrays", v);
		return;
	}

	v->vdim = p = (struct Dimblock *)
	    ckalloc( sizeof(int) + (3+2*nd)*sizeof(expptr) );
	p->ndim = nd--;
	p->nelt = ICON(1);
	doin_setbound = 1;

	if (noextflag)
		for(i = 0; i <= nd; i++)
			if (((q = dims[i].lb) && !ISINT(q->headblock.vtype))
			 || ((q = dims[i].ub) && !ISINT(q->headblock.vtype))) {
				sprintf(buf, "dimension %d of %s is not an integer.",
					i+1, v->fvarname);
				errext(buf);
				break;
				}

	for(i = 0; i <= nd; i++) {
		if (((q = dims[i].lb) && !ISINT(q->headblock.vtype)))
			dims[i].lb = mkconv(TYINT, q);
		if (((q = dims[i].ub) && !ISINT(q->headblock.vtype)))
			dims[i].ub = mkconv(TYINT, q);
		}

	for(i = 0; i <= nd; ++i)
	{
		if( (q = dims[i].ub) == NULL)
		{
			if(i == nd)
			{
				frexpr(p->nelt);
				p->nelt = NULL;
			}
			else
				err("only last bound may be asterisk");
			p->dims[i].dimsize = ICON(1);
			p->dims[i].dimexpr = NULL;
		}
		else
		{

			if(dims[i].lb)
			{
				q = mkexpr(OPMINUS, q, cpexpr(dims[i].lb));
				q = mkexpr(OPPLUS, q, ICON(1) );
			}
			if( ISCONST(q) )
			{
				p->dims[i].dimsize = q;
				p->dims[i].dimexpr = (expptr) PNULL;
			}
			else {
				sprintf(buf, " %s_dim%d", v->fvarname, i+1);
				p->dims[i].dimsize = (expptr)
					autovar(1, tyint, EXNULL, buf);
				p->dims[i].dimexpr = q;
				if (i == nd)
					v->vlastdim = new_vars;
				v->vdimfinish = 1;
			}
			if(p->nelt)
				p->nelt = mkexpr(OPSTAR, p->nelt,
				    cpexpr(p->dims[i].dimsize) );
		}
	}

	q = dims[nd].lb;
	q0 = 0;
	if(q == NULL)
		q = q0 = ICON(1);

	for(i = nd-1 ; i>=0 ; --i)
	{
		t = dims[i].lb;
		if(t == NULL)
			t = ICON(1);
		if(p->dims[i].dimsize) {
			if (q == q0) {
				q0 = 0;
				frexpr(q);
				q = cpexpr(p->dims[i].dimsize);
				}
			else
				q = mkexpr(OPSTAR, cpexpr(p->dims[i].dimsize), q);
			q = mkexpr(OPPLUS, t, q);
			}
	}

	if( ISCONST(q) )
	{
		p->baseoffset = q;
		p->basexpr = NULL;
	}
	else
	{
		sprintf(buf, " %s_offset", v->fvarname);
		p->baseoffset = (expptr) autovar(1, tyint, EXNULL, buf);
		p->basexpr = q;
		v->vdimfinish = 1;
	}
	doin_setbound = 0;
}
Пример #19
0
doentry(struct Entrypoint *ep)
#endif
{
	register int type;
	register Namep np;
	chainp p, p1;
	register Namep q;
	Addrp rs;
	int it, k;
	extern char dflttype[26];
	Extsym *entryname = ep->entryname;

	if (++nentry > 1)
		p1_label((long)(extsymtab - entryname - 1));

/* The main program isn't allowed to have parameters, so any given
   parameters are ignored */

	if(procclass == CLMAIN && !ep->arglist || procclass == CLBLOCK)
		return;

	/* Entry points in MAIN are an error, but we process them here */
	/* to prevent faults elsewhere. */

/* So now we're working with something other than CLMAIN or CLBLOCK.
   Determine the type of its return value. */

	impldcl( np = mkname(entryname->fextname) );
	type = np->vtype;
	proc_argchanges = prev_proc && type != entryname->extype;
	entryname->extseen = 1;
	if(proctype == TYUNKNOWN)
		if( (proctype = type) == TYCHAR)
			procleng = np->vleng ? np->vleng->constblock.Const.ci
					     : (ftnint) (-1);

	if(proctype == TYCHAR)
	{
		if(type != TYCHAR)
			err("noncharacter entry of character function");

/* Functions returning type   char   can only have multiple entries if all
   entries return the same length */

		else if( (np->vleng ? np->vleng->constblock.Const.ci :
		    (ftnint) (-1)) != procleng)
			err("mismatched character entry lengths");
	}
	else if(type == TYCHAR)
		err("character entry of noncharacter function");
	else if(type != proctype)
		multitype = YES;
	if(rtvlabel[type] == 0)
		rtvlabel[type] = (int)newlabel();
	ep->typelabel = rtvlabel[type];

	if(type == TYCHAR)
	{
		if(chslot < 0)
		{
			chslot = nextarg(TYADDR);
			chlgslot = nextarg(TYLENG);
		}
		np->vstg = STGARG;

/* Put a new argument in the function, one which will hold the result of
   a character function.  This will have to be named sometime, probably in
   mkarg(). */

		if(procleng < 0) {
			np->vleng = (expptr) mkarg(TYLENG, chlgslot);
			np->vleng->addrblock.uname_tag = UNAM_IDENT;
			strcpy (np -> vleng -> addrblock.user.ident,
				new_func_length());
			}
		if (!xretslot[TYCHAR]) {
			xretslot[TYCHAR] = rs =
				autovar(0, type, ISCONST(np->vleng)
					? np->vleng : ICON(0), "");
			strcpy(rs->user.ident, "ret_val");
			}
	}

/* Handle a   complex   return type -- declare a new parameter (pointer to
   a complex value) */

	else if( ISCOMPLEX(type) ) {
		if (!xretslot[type])
			xretslot[type] =
				autovar(0, type, EXNULL, " ret_val");
				/* the blank is for use in out_addr */
		np->vstg = STGARG;
		if(cxslot < 0)
			cxslot = nextarg(TYADDR);
		}
	else if (type != TYSUBR) {
		if (type == TYUNKNOWN) {
			dclerr("untyped function", np);
			proctype = type = np->vtype =
				dflttype[letter(np->fvarname[0])];
			}
		if (!xretslot[type])
			xretslot[type] = retslot =
				autovar(1, type, EXNULL, " ret_val");
				/* the blank is for use in out_addr */
		np->vstg = STGAUTO;
		}

	for(p = ep->arglist ; p ; p = p->nextp)
		if(! (( q = (Namep) (p->datap) )->vknownarg) ) {
			q->vknownarg = 1;
			q->vardesc.varno = nextarg(TYADDR);
			allargs = mkchain((char *)q, allargs);
			q->argno = nallargs++;
			}
		else if (nentry == 1)
			duparg(q);
		else for(p1 = ep->arglist ; p1 != p; p1 = p1->nextp)
			if ((Namep)p1->datap == q)
				duparg(q);

	k = 0;
	for(p = ep->arglist ; p ; p = p->nextp) {
		if(! (( q = (Namep) (p->datap) )->vdcldone) )
			{
			impldcl(q);
			q->vdcldone = YES;
			if(q->vtype == TYCHAR)
				{

/* If we don't know the length of a char*(*) (i.e. a string), we must add
   in this additional length argument. */

				++nallchargs;
				if (q->vclass == CLPROC)
					nallchargs--;
				else if (q->vleng == NULL) {
					/* character*(*) */
					q->vleng = (expptr)
					    mkarg(TYLENG, nextarg(TYLENG) );
					unamstring((Addrp)q->vleng,
						new_arg_length(q));
					}
				}
			}
		if (q->vdimfinish)
			dim_finish(q);
		if (q->vtype == TYCHAR && q->vclass != CLPROC)
			k++;
		}

	if (entryname->extype != type)
		changedtype(np);

	/* save information for checking consistency of arg lists */

	it = infertypes;
	if (entryname->exproto)
		infertypes = 1;
	save_argtypes(ep->arglist, &entryname->arginfo, &np->arginfo,
			0, np->fvarname, STGEXT, k, np->vtype, 2);
	infertypes = it;
}
Пример #20
0
  STATIC DATA
-----------------------------------------------------------------------------*/

typedef struct {
  char *bits;
  int width, height;
} BitmapRec;

#ifdef __STDC__
#define ICON(x) { x##_bits, x##_width, x##_height }
#else
#define ICON(x) { x/**/_bits, x/**/_width, x/**/_height }
#endif

static BitmapRec bitmaps[2] = {
    ICON(xfm_watch), ICON(xfm_watchmsk)
};

static char **pixmaps[] = {
  files_xpm, folder_xpm, folder_up_xpm, file_xpm,
  app_xpm, file_link_xpm, folder_link_xpm, app_link_xpm,
  file_link_bad_xpm, folder_xpm, stuff_xpm, stuff_xpm, floppy_xpm,
  recycle_button_xpm, home_button_xpm, folder_button_xpm, stuff_button_xpm, folder_up_button_xpm, backarr_xpm
};

/*-----------------------------------------------------------------------------
  PUBLIC DATA
-----------------------------------------------------------------------------*/

IconRec *icons;
Cursor cur;
Пример #21
0
/* called at end of declarations section to process chains
   created by EQUIVALENCE statements
 */
 void
doequiv(Void)
{
	register int i;
	int inequiv;			/* True if one namep occurs in
					   several EQUIV declarations */
	int comno;		/* Index into Extsym table of the last
				   COMMON block seen (implicitly assuming
				   that only one will be given) */
	int ovarno;
	ftnint comoffset;	/* Index into the COMMON block */
	ftnint offset;		/* Offset from array base */
	ftnint leng;
	register struct Equivblock *equivdecl;
	register struct Eqvchain *q;
	struct Primblock *primp;
	register Namep np;
	int k, k1, ns, pref, t;
	chainp cp;
	extern int type_pref[];
	char *s;

	for(i = 0 ; i < nequiv ; ++i)
	{

/* Handle each equivalence declaration */

		equivdecl = &eqvclass[i];
		equivdecl->eqvbottom = equivdecl->eqvtop = 0;
		comno = -1;



		for(q = equivdecl->equivs ; q ; q = q->eqvnextp)
		{
			offset = 0;
			if (!(primp = q->eqvitem.eqvlhs))
				continue;
			vardcl(np = primp->namep);
			if(primp->argsp || primp->fcharp)
			{
				expptr offp;

/* Pad ones onto the end of an array declaration when needed */

				if(np->vdim!=NULL && np->vdim->ndim>1 &&
				    nsubs(primp->argsp)==1 )
				{
					if(! ftn66flag)
						warni
			("1-dim subscript in EQUIVALENCE, %d-dim declared",
						    np -> vdim -> ndim);
					cp = NULL;
					ns = np->vdim->ndim;
					while(--ns > 0)
						cp = mkchain((char *)ICON(1), cp);
					primp->argsp->listp->nextp = cp;
				}

				offp = suboffset(primp);
				if(ISICON(offp))
					offset = offp->constblock.Const.ci;
				else	{
					dclerr
			("nonconstant subscript in equivalence ",
					    np);
					np = NULL;
				}
				frexpr(offp);
			}

/* Free up the primblock, since we now have a hash table (Namep) entry */

			frexpr((expptr)primp);

			if(np && (leng = iarrlen(np))<0)
			{
				dclerr("adjustable in equivalence", np);
				np = NULL;
			}

			if(np) switch(np->vstg)
			{
			case STGUNKNOWN:
			case STGBSS:
			case STGEQUIV:
				break;

			case STGCOMMON:

/* The code assumes that all COMMON references in a given EQUIVALENCE will
   be to the same COMMON block, and will all be consistent */

				comno = np->vardesc.varno;
				comoffset = np->voffset + offset;
				break;

			default:
				dclerr("bad storage class in equivalence", np);
				np = NULL;
				break;
			}

			if(np)
			{
				q->eqvoffset = offset;

/* eqvbottom   gets the largest difference between the array base address
   and the address specified in the EQUIV declaration */

				equivdecl->eqvbottom =
				    lmin(equivdecl->eqvbottom, -offset);

/* eqvtop   gets the largest difference between the end of the array and
   the address given in the EQUIVALENCE */

				equivdecl->eqvtop =
				    lmax(equivdecl->eqvtop, leng-offset);
			}
			q->eqvitem.eqvname = np;
		}

/* Now all equivalenced variables are in the hash table with the proper
   offset, and   eqvtop and eqvbottom   are set. */

		if(comno >= 0)

/* Get rid of all STGEQUIVS, they will be mapped onto STGCOMMON variables
   */

			eqvcommon(equivdecl, comno, comoffset);
		else for(q = equivdecl->equivs ; q ; q = q->eqvnextp)
		{
			if(np = q->eqvitem.eqvname)
			{
				inequiv = NO;
				if(np->vstg==STGEQUIV)
					if( (ovarno = np->vardesc.varno) == i)
					{

/* Can't EQUIV different elements of the same array */

						if(np->voffset + q->eqvoffset != 0)
							dclerr
			("inconsistent equivalence", np);
					}
					else	{
						offset = np->voffset;
						inequiv = YES;
					}

				np->vstg = STGEQUIV;
				np->vardesc.varno = i;
				np->voffset = - q->eqvoffset;

				if(inequiv)

/* Combine 2 equivalence declarations */

					eqveqv(i, ovarno, q->eqvoffset + offset);
			}
		}
	}

/* Now each equivalence declaration is distinct (all connections have been
   merged in eqveqv()), and some may be empty. */

	for(i = 0 ; i < nequiv ; ++i)
	{
		equivdecl = & eqvclass[i];
		if(equivdecl->eqvbottom!=0 || equivdecl->eqvtop!=0) {

/* a live chain */

			k = TYCHAR;
			pref = 1;
			for(q = equivdecl->equivs ; q; q = q->eqvnextp)
			    if ((np = q->eqvitem.eqvname)
			    		&& !np->veqvadjust) {
				np->veqvadjust = 1;
				np->voffset -= equivdecl->eqvbottom;
				t = typealign[k1 = np->vtype];
				if (pref < type_pref[k1]) {
					k = k1;
					pref = type_pref[k1];
					}
				if(np->voffset % t != 0) {
					dclerr("bad alignment forced by equivalence", np);
					--nerr; /* don't give bad return code for this */
					}
				}
			equivdecl->eqvtype = k;
		}
		freqchain(equivdecl);
	}
}
Пример #22
0
void MainWindow::createActions()
{
	openAct = new QAction(tr("&Open..."), this);
	openAct->setShortcuts(QKeySequence::Open);
	openAct->setIcon(QIcon(ICON(open.png)));
	openAct->setStatusTip(tr("Open an existing file"));
	connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

	saveAct = new QAction(tr("&Save..."), this);
	saveAct->setShortcuts(QKeySequence::Save);
	saveAct->setIcon(QIcon(ICON(save.png)));
	saveAct->setStatusTip(tr("Save an existing file"));
	connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));

	exitAct = new QAction(tr("E&xit"), this);
	exitAct->setShortcuts(QKeySequence::Quit);
	exitAct->setIcon(QIcon(ICON(exit.png)));
	exitAct->setStatusTip(tr("Exit the application"));
	connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));

	removeAllWidget = new QAction(tr("Clear"), this);
	removeAllWidget->setShortcuts(QKeySequence::Quit);
	removeAllWidget->setStatusTip(tr("Remove all widget from the buffer store"));
	connect(removeAllWidget, SIGNAL(triggered()), this, SLOT(clearBufor()));

	zoomInAct = new QAction(tr("Zoom In"), this);
	zoomInAct->setShortcut(tr("Ctrl++"));
	zoomInAct->setIcon(QIcon(ICON(ZoomIn.png)));
	zoomInAct->setStatusTip(tr("Zoom in an image"));

	zoomOutAct = new QAction(tr("Zoom Out"), this);
	zoomOutAct->setShortcut(tr("Ctrl+-"));
	zoomOutAct->setIcon(QIcon(ICON(zoomout.png)));
	zoomOutAct->setStatusTip(tr("Zoom out an image"));

	zoomResetAct = new QAction(tr("Normal Size"), this);
	zoomResetAct->setShortcut(tr("Ctrl+="));

	fitToWindowAct = new QAction(tr("Fit to Window"), this);
	fitToWindowAct->setCheckable(true);
	fitToWindowAct->setShortcut(tr("Ctrl+F"));

	openAllAct = new QAction(tr("Open the selected windows"), this);
	openAllAct->setCheckable(true);
	connect(openAllAct, SIGNAL(triggered()), this, SLOT(showItem()));

	closeAct = new QAction(tr("Cl&ose"), this);
	closeAct->setStatusTip(tr("Close the active window"));
	connect(closeAct, SIGNAL(triggered()), mdiArea, SLOT(closeActiveSubWindow()));

	closeAllAct = new QAction(tr("Close &All"), this);
	closeAllAct->setStatusTip(tr("Close all the windows"));
	connect(closeAllAct, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows()));

	tileAct = new QAction(tr("&Tile"), this);
	tileAct->setStatusTip(tr("Tile the windows"));
	connect(tileAct, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows()));

	cascadeAct = new QAction(tr("&Cascade"), this);
	cascadeAct->setStatusTip(tr("Cascade the windows"));
	connect(cascadeAct, SIGNAL(triggered()), mdiArea, SLOT(cascadeSubWindows()));

	nextAct = new QAction(tr("Ne&xt"), this);
	nextAct->setShortcuts(QKeySequence::NextChild);
	nextAct->setStatusTip(tr("Move the focus to the next window"));
	connect(nextAct, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow()));

	previousAct = new QAction(tr("Pre&vious"), this);
	previousAct->setShortcuts(QKeySequence::PreviousChild);
	previousAct->setStatusTip(tr("Move the focus to the previous "
		"window"));
	connect(previousAct, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow()));

	windowActionGroup = new QActionGroup(this); //tylko jedna pozycja w menu jest sprawdzana

	separatorAct = new QAction(this);
	separatorAct->setSeparator(true);
}