Exemple #1
0
    FUNCTION  static  CODE open_msg(

    struct  PARBLK	*parblk,		/* in: parameter block 	*/
    struct  SFILE	*sfile, 		/* out: message file SFILE 	*/
    struct  FSBLOCK	*fsblock,		/* out: FSBLOCK for message file */
    FUNINT		lun			/* in: lun to use for file i/o */
    )

    {
    TEXT		file_spec[FSPECSIZ+1];	/* input file spec	*/
    COUNT		count;
    CODE		code;
    TEXT		**fvector;		/* pointer to string vector OM*/
    TEXT		errstr[STRINGSIZ+1];
    static TEXT		null[] = "";

    code = p_string(parblk, "FILE", &fvector, &count);	/* get file spec from parblk */
    s_copy(fvector[0], file_spec);
    f_crack(file_spec, null, null, MSG_TYPE, fsblock, errstr);	/* break to components */
    if (!s_equal((*fsblock).type, MSG_TYPE))		
	{
	parm_err("File type should be '%s'.", "TAE-BADTYPE", (uintptr_t)MSG_TYPE,0,0);	
	return(FAIL);
	}
    
    code = f_opnblk(sfile, lun, fsblock, F_READ);	/* open file directly */
    if (code == F_FILERR)
	parm_err("Could not open file '%s.%s' in library '%s'.", "TAE-MSGOPEN",
		(uintptr_t)(*fsblock).name, (uintptr_t)(*fsblock).type, (uintptr_t)(*fsblock).libr);
    else if (code == F_NOFILE)
	parm_err("Could not find file '%s.%s' in library '%s'.", "TAE-NOFILE", 
		(uintptr_t)(*fsblock).name, (uintptr_t)(*fsblock).type, (uintptr_t)(*fsblock).libr);
    return(code);
    }
Exemple #2
0
Fichier : draw.c Projet : kahrs/cda
void
main(int argc, char **argv)
{
	int n;
	int dopts = 0;
	int dovb = 0;
	int dosigs = 0;
	extern int optind;

	chname = 0;
	while((n = getopt(argc, argv, "bfkprstv")) != -1)
		switch(n)
		{
		case 'k':	chname = 1; break;
		case 't':	chname = -1; break;
		case 'p':	dopts = 1; break;
		case 'v':	dovb = 1; break;
		case 'b':	boxed = 1; break;
		case 'r':	ruled = 0; break;
		case 'f':	framed = 1; break;
		case 's':	dosigs = 1; break;
		case '?':	break;
		}
	fizzinit();
	f_init(&b);
	if(optind == argc)
		argv[--optind] = "/dev/stdin";
	for(; optind < argc; optind++)
		if(n = f_crack(argv[optind], &b)){
			fprint(1, "%s: %d errors\n", *argv, n);
			exit(1);
		}
	fizzplane(&b);
	if(n = fizzplace()){
		/* complain but don't exit */
		fprint(2, "%d chips unplaced\n", n);
	}
	if(fizzprewrap())
		dosigs = 0;
	draw(dopts, dovb);
	if(dosigs){
		extern Signal *maxsig;
		extern void tsp(Signal *);

		symtraverse(S_SIGNAL, netlen);
		if(maxsig && ((maxsig->type & VSIG) != VSIG) && (maxsig->n >= MAXNET)){
			fprint(1, "net %s is too big (%d>=%d)\n", maxsig->name,
				maxsig->n, MAXNET);
			exits("bignet");
		}
		wwires = 0;
		wwraplen = 0;
		symtraverse(S_SIGNAL, tsp);
		symtraverse(S_SIGNAL, drawsig);
	}
	exit(0);
}
Exemple #3
0
void
main(int argc, char **argv)
{
	Board b;
	int n;
	char *fname;

	ARGBEGIN{
	case 'b':
		++bflag;	/* show bottom view */
		break;
	case 'g':
		++gflag;	/* show 100 mil grid */
		break;
	case 'p':
		if(npkg < NPKG)
			pkgnames[npkg++] = ARGF();
		break;
	default:
		fprint(2, "usage: %s [-b] [-p name] [files...]\n", argv0);
		exits("usage");
	}ARGEND
	f_init(&b);
#ifdef PLAN9
	if(*argv)
		fname = *argv++;
	else
		fname = "/fd/0";
#endif
#ifndef PLAN9
	if(*argv)
		fname = *argv++;
	else
		fname = "/dev/stdin";
#endif
	do{
		if(n = f_crack(fname, &b)){
			fprint(2, "%s: %d errors\n", fname, n);
			exits("errors");
		}
	}while(fname = *argv++);	/* assign = */
	symtraverse(S_PACKAGE, picpr);
	exits(0);
}
Exemple #4
0
void
main(int argc, char **argv)
{
	int n;
	extern long nph;
	int doundef = 0;
	int dow = 0;
	char *chname = 0;
	char *pkname = 0;
	extern int optind;
	extern char *optarg;
	extern Signal *maxsig;

	while((n = getopt(argc, argv, "uwp:c:")) != -1)
		switch(n)
		{
		case 'u':	doundef = 1; break;
		case 'w':	dow = 1; break;
		case 'c':	chname = optarg; break;
		case 'p':	pkname = optarg; break;
		case '?':	break;
		}
	fizzinit();
	f_init(&b);
	if(optind == argc)
		argv[--optind] = "/dev/stdin";
	for(; optind < argc; optind++)
		if(n = f_crack(argv[optind], &b)){
			fprint(1, "%s: %d errors\n", argv[optind], n);
			exit(1);
		}
	if(b.name)
		fprint(1, "Board %s:\n", b.name);
	else
		fprint(1, "Warning: no board name\n");
	if(n = fizzplace()){
		fprint(1, "%d chips unplaced\n", n);
		if(doundef)
			symtraverse(S_CHIP, prundef);
		exit(1);
	}
	cutout(&b);
	fizzplane(&b);
	if(pkname)
		prpkg((Package *)symlook(pkname, S_PACKAGE, (void *)0));
	if(chname)
		prchip((Chip *)symlook(chname, S_CHIP, (void *)0));
	if(dow){
		if(fizzprewrap())
			exit(1);
		symtraverse(S_SIGNAL, netlen);
		if(maxsig && ((maxsig->type & VSIG) != VSIG) && (maxsig->n >= MAXNET)){
			fprint(1, "net %s is too big (%d>=%d)\n", maxsig->name,
				maxsig->n, MAXNET);
			exit(1);
		}
		setup();
		symtraverse(S_CHIP, chkpins);
	}
	symtraverse(S_PACKAGE, chkpkgpins);
	exit(0);
}
Exemple #5
0
void
main(int argc, char **argv)
{
    char *fname;
    int n;

    Binit(&out, 1, OWRITE);
    ARGBEGIN{
    case 'b':
        boxed = 1;
        break;
    case 'c':
        docpins = 1;
        break;
    case 'd':
        dodatums = 1;
        break;
    case 'H':
        noheader = 1;
        break;
    case 'k':
        chname = 1;
        break;	/* package */
    case 'l':
        landscape = 1;
        break;
    case 'p':
        dopts = 1;
        break;
    case 'r':
        nortext = 1;
        break;
    case 't':
        chname = -1;
        break;	/* type */
    case 'v':
        dovb = 1;
        break;
    case 'h':
        hfile = ARGF();		/* icon-style hole file */
        break;
    case 'w':
        wfile = ARGF();		/* icon-style wire file */
        break;
    default:
        fprint(2, "usage: %s [-cdHklprtv] [-h file] [-w file] [files...]\n", argv0);
        exits("usage");
    } ARGEND
    USED(argc);
    if(wfile || hfile)
        dodatums = 1;
    if(wfile && !hfile)
        docpins = 1;
    fizzinit();
    f_init(&b);
    if(*argv)
        fname = *argv++;
    else
        fname = "/fd/0";
    do {
        if(n = f_crack(fname, &b)) {
            fprint(2, "%s: %d errors\n", fname, n);
            exits("crack");
        }
    } while(fname = *argv++);	/* assign = */
    fizzplane(&b);
    if(n = fizzplace()) {
        fprint(2, "warning: %d chip%s unplaced\n",
               n, n==1?"":"s");
    }
    if(fizzprewrap())
        exits("prewrap");
    draw(dopts, dovb);
    exits(0);
}
Exemple #6
0
/*	bld_tcl.   Builds TCL portion of
 *	.job file for batch and async jobs.
 *
 *	The caller has already opened the job file.
 *
 */
FUNCTION CODE bld_tcl
(
    struct CONTXT	*cmdctx,	/* in: command context 		*/
    struct SFILE	*job,		/* in/out: SFILE for job	*/
    FUNINT		run_type	/* in: type of job:		*/
    /*     ASYNC or BATCH		*/

)
{
    IMPORT struct CONTXT	primctx;
    IMPORT struct SYMTAB	glbtab;

    TEXT		jen_spec[FSPECSIZ+2];
    TEXT		job_spec[FSPECSIZ+2];
    struct FSBLOCK	jen_fsblock;
    struct FSBLOCK	locpdf;
    CODE		code;
    struct	SFILE	jen;
    TEXT		proc_cmd[STRINGSIZ+1];
    TEXT		errstr[STRINGSIZ+1];
    struct VARIABLE	*rt;
    BOOL		deleteFiles ;	/* when RUNTYPE=(BATCH,NORUN)	*/
    /* do not delete .jen and .job  */

    /*
    	Here, we create parameter file for parameters, level 0 locals,
        and all globals.   The file name is the same as the
    	job file, but with a type of JEN_TYPE.   Note that
        the VMS version number ("attribute") is also the same
    to prevent racing with other users logged into the
        current account.
    */
    
    deleteFiles = TRUE;			/* assume .jen and .job should go */
    if (run_type == ASYNC)
        f_write (job, "ASYNC   !tell TAE Monitor the mode");
    else
    {
        rt = lookex(&(*cmdctx).qualst, "RUNTYPE");
        if (rt && (*rt).v_count >= 2 && s_equal(SVAL(*rt,1), "NORUN"))
            deleteFiles = FALSE;
        f_write (job, "BATCH   !tell TAE Monitor the mode");
    }
    f_write (job, (*cmdctx).pdf.name);		/* tell job name */
    f_write (job, "slogon");
    f_crack ((*job).full_spec, "", "", "", &jen_fsblock, errstr);
    s_copy (JEN_TYPE, jen_fsblock.type);
    code = f_opnblk (&jen, SAVELUN, &jen_fsblock, F_OVER);
    if (code != SUCCESS)
    {
        tmmsg (PROCFAIL, "Unable to create parameter file. %s.",
               "TAE-PARCREATE", (uintptr_t) jen.errmsg, 0, 0, 0, 0);
        return (code);
    }
    code = save_pfile (&jen, 0, NULL, 0, &(*cmdctx).parmst,
                       &primctx.locst,
                       &glbtab);
    if (code != SUCCESS)
    {
        tmmsg (PROCFAIL, "Unable to create parameter file. %s.",
               "TAE-PARCREATE", (uintptr_t) jen.errmsg, 0, 0, 0, 0);
        f_close (&jen, F_KEEP);
        return (code);
    }
    f_close (&jen, F_KEEP);
    /*
    	Write TCL commands to job file for restoration of the
        current level 0 environment and execution of the
        target command.
    */
    s_copy ("\t", jen_spec);			/* tab before...	*/
    s_append (jen.full_spec, jen_spec);		/* PAR file spec	*/
    f_write (job, "RESTORE-GLOBAL +	!restore global environment");
    f_write (job, jen_spec);
    f_write (job, "RESTORE-LOCAL +	!restore level 0 locals");
    f_write (job, jen_spec);
    f_write (job, "DISPLAY  !display level 0 locals and globals");
    f_write (job, "DISPLAY-PARFILE CLASS=PARMS FILE=+   !display parameters");
    f_write (job, jen_spec);
    job_ins1 (job, cmdctx);			/* installation exit	*/
    /*
        Build and write the proc execution line.
    */
    f_write (job, " ");				/* spacer line		*/
    f_write(job,
            "write \"************* Execute The Proc ********************  \"");
    MOVE_STRUCT ((*cmdctx).pdf, locpdf);
    if (s_equal(locpdf.libr, "/LOCAL/")) 	/* proc is internal	*/
        locpdf.libr[0] = EOS;
    f_spec (&locpdf, proc_cmd);			/* full PDF spec	*/
    if (!NULLSTR((*cmdctx).subcmd))		/* if subcmd needed	*/
    {
        s_append ("-", proc_cmd);
        s_append ((*cmdctx).subcmd, proc_cmd);
    }
    s_append ("| RESTORE = ", proc_cmd);
    s_append (jen.full_spec, proc_cmd);
    s_append (" |", proc_cmd);
    f_write (job, proc_cmd);
    /*
    Wrapup, cleanup, housekeep, and miscellaneous job administration
    */
    f_write (job, " ");				/* spacer line		*/
    f_write (job, "DISPLAY ($SFI, $SKEY)	!show proc status");
    f_write (job, "LOCAL _SFI INTEGER INITIAL=&$SFI ! remember return code");
    if (run_type == ASYNC)
        f_write (job, "EMIT $SFI=&_SFI		!send final status");
    if (deleteFiles)
    {
        f_write (job, DELETE_CMD);		/* "DCL DELETE +"	*/
        f_write (job, jen_spec);		/* delete .jen file	*/
        f_write (job, DELETE_CMD);		/* "DCL DELETE +"	*/
        s_copy ("\t", job_spec);
        s_append ((*job).full_spec, job_spec);
        f_write (job, job_spec);		/* delete .job file	*/
    }
    f_write (job, "LOGOFF $SFI=&_SFI  ! return proc's $sfi to host");
    return (SUCCESS);
}
Exemple #7
0
Fichier : ring.c Projet : kahrs/cda
void
main(int argc, char **argv)
{
	int n;
	extern long nph;
	int doundef = 0;
	int dow = 0;
	int dosignal = 0;
	float ratio;
	extern int optind;
	extern char *optarg;
	extern Signal *maxsig;

	while((n = getopt(argc, argv, "lqsuvz:adkw:c:")) != -1)
		switch(n)
		{
		case 'k':	konstant = atof(optarg); break;
		case 'a':	width = AWG(atof(optarg)); break;
		case 'd':	epsilon = atof(optarg); break;
		case 'l':	dolength = 1; break;
		case 'q':	quiet = 1; break;
		case 's':	dosignal = 1; break;
		case 'u':	doundef = 1; break;
		case 'v':	dow = 1; break;
		case 'w':	width = atof(optarg); break;
		case 'z':	Z0 = atof(optarg); break;
		case '?':	break;
		}
	fizzinit();
	f_init(&b);
	if(optind == argc)
		argv[--optind] = "/dev/stdin";
	for(; optind < argc; optind++)
		if(n = f_crack(argv[optind], &b)){
			fprint(1, "%s: %d errors\n", argv[optind], n);
			exit(1);
		}
	if(b.name)
		fprint(1, "Board %s:\n", b.name);
	else
		fprint(1, "Warning: no board name\n");
	if(n = fizzplace()){
		fprint(1, "%d chips unplaced\n", n);
		if(doundef)
			symtraverse(S_CHIP, prundef);
		exit(1);
	}
	cutout(&b);
	fizzplane(&b);
	if (fizzprewrap())
		exit(1);
	if (dow) symtraverse(S_SIGNAL, prwires);
	symtraverse(S_SIGNAL, calclength);
	if (dosignal) symtraverse(S_SIGNAL, prsignal);
	pininit();
	symtraverse(S_SIGNAL, insertpins);
/*
 * ratio is 2 * h / d from Shibata & Ryuiti;
 * L0 is from Terman's classic, but neglects skin effect (in microhenries / ft)
 */
	ratio = exp((Z0 - 17.08) / 34.83);
	L0 = 0.1404 * log10(2.0 * ratio) * 83.3333;
	C0 = L0 / square(Z0);
fprint(2, "Capacitance=%f, inductance=%f, ns/ft=%f\n", C0, L0, 12.0*sqrt(C0*L0));
	symtraverse(S_SIGNAL, cksignal);
	exit(0);
}
Exemple #8
0
    FUNCTION CODE old_Co_ReadFile (

    	Id 			c,		/* in: existing collection  */
        TEXT			*filespec,	/* in: name of file to read */
	CODE			mode		/* in: mode for the vm objs */
    )
    {
    struct SFILE	f;
    union {
          struct PARHDR	ph;			/* standard header          */	
	  TEXT		padding[300];		/* in case reading new file */
	  } headBuffer;
    CODE		code;
    COUNT		recsize;
    Id			vm;
    TEXT		record [STRINGSIZ+2];
    BOOL		archive;
    TEXT		fullSpec[STRINGSIZ+1];
    struct	FSBLOCK fsblock;		/* to dig out file name     */
    TEXT		errstr[STRINGSIZ+1];
    COUNT		islash;

#ifdef UNIX
    union 
        {
	TEXT record [STRINGSIZ+1];		/* padding for long records */
	struct ar_hdr header;			/* the real archive header  */
	} hdrRecord;
#endif


    code = f_opnspc (&f, 1, filespec, "", "", "res", F_READ);
    if (code != SUCCESS)
	{
        x_error(mode, "Unable to open resource file '%s'.  %s.", "TAE-PFOPN",
	    (uintptr_t)filespec, (uintptr_t)f.errmsg, 0);
        return (FAIL);	
	}

    /*	determine whether file is concatenated or archive format */
    code = f_read (&f, record);
    if (code == SUCCESS  &&  s_equal (record, AR_SENTINEL)) 
	archive = TRUE;
    else
	{
	archive = FALSE;	
	f_rewind (&f);				/* re-start at beginning  */
	}

    /*	read each Vm object from the file */

    while (FOREVER)
	{
	if (archive)					/* skip header 	    */
	    {
#ifdef UNIX
	    code = f_read (&f, (TEXT *)&hdrRecord);	/* read hdr or pad  */
	    if (code == SUCCESS  &&  hdrRecord.record[0] == EOS)
		code = f_read (&f, (TEXT *)&hdrRecord);	/* skip EOF padding */
	    if (code == F_EOF)
	   	{
		code = SUCCESS;
		break;
		}
	    else if (code != SUCCESS)
		{
	        f_close(&f, F_KEEP);
	        x_error (mode, "File '%s' not correctly formatted.",
			 "TAE-RESFORMAT", (uintptr_t)filespec, 0, 0);
	        return (FAIL);
		}
#ifdef AIX
	    s_bcopy (hdrRecord.header._ar_name.ar_name, fullSpec,
                               sizeof(hdrRecord.header._ar_name.ar_name));
#else
	    s_bcopy (hdrRecord.header.ar_name, fullSpec, 
				sizeof(hdrRecord.header.ar_name));
#endif
	    s_strip (fullSpec);		/* remove trailing blanks */
	    islash = s_index (fullSpec, '/');		/*  HP (and others?)  */
	    if (islash >= 0)				/* term with slash    */
		fullSpec[islash] = EOS;			/* clip at slash      */
	    f_crack (fullSpec, "", "", "", &fsblock, errstr);     /* dig name */
#else
	    x_error (mode, "File '%s' not correctly formatted.",
			"TAE-RESFORMAT", filespec, 0, 0);
	    return (FAIL);
#endif
	    }
	code = f_bread (&f, (GENPTR)&headBuffer, sizeof (headBuffer), &recsize);
	if (code == F_EOF)
	    {
	    code = SUCCESS;			/* normal end-of-file	*/
	    break;
	    }
	else if (code == SUCCESS && 
		s_equal (headBuffer.ph.sentinel, "<<new par-file>>"))
	    {
	    f_close(&f, F_KEEP);
	    x_error(mode, "Resource file '%s' has already been converted.", 
		"TAE-VNEWFORMAT", (uintptr_t)filespec, 0, 0);
	    return (FAIL);
	    }
	else if(code != SUCCESS || !s_equal(headBuffer.ph.sentinel, P_SENTINEL))
            {
	    f_close(&f, F_KEEP);
	    x_error(mode, "Error reading resource file '%s'.  %s.", "TAE-PFRD",
		(uintptr_t)filespec, (uintptr_t)f.errmsg, 0);
	    return (FAIL);
            }
	vm = Vm_New (mode);			/* create new vm object   */
	code = Vm_ReadVm ((struct VM_STRUCT *)vm, &f); 		/* read parblk records    */
	if (code != SUCCESS)
	    break;				/* x_error already called */
	if (archive)
	    old_Co_Add ((struct COLLECTION *)c, vm, fsblock.name, C_VM);
	else	
	    old_Co_Add ((struct COLLECTION *)c, vm, headBuffer.ph.filename, C_VM);
	}    
    f_close (&f, F_KEEP);
    return (code);
    }