FreeCalypso > hg > ueda-linux
view ifctf-part-lib/uschem-symbols/mkheader.c @ 24:7e8a2cb54b6b
started implementing unet-destar
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Thu, 06 Aug 2015 20:20:11 +0000 |
parents | cd92449fdb51 |
children |
line wrap: on
line source
/* * This program generates a uschem (subset of gschem) symbol * for a dual-row header. Can also be used for board-to-board connectors. */ #include <stdio.h> #include <strings.h> #include <ctype.h> int npins, btb; int pinlength = 300, vstep = 400, boxwidth = 800; int textoff_x = 75, textoff_y = 50; int curpin, ycoord; doit() { ycoord = npins / 2 * vstep; printf("B %d 0 %d %d 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1\n", pinlength, boxwidth, ycoord); if (!btb) printf("L %d %d %d 0 3 0 0 0 -1 -1\n", pinlength + boxwidth / 2, ycoord, pinlength + boxwidth / 2); for (curpin = 1; curpin <= npins; ) { ycoord -= vstep / 2; printf("P 0 %d %d %d 1 0 0\n{\n", ycoord, pinlength, ycoord); printf("T %d %d 5 8 1 1 0 6 1\n", pinlength - textoff_x, ycoord + textoff_y); printf("pinnumber=%d\n}\n", curpin++); printf("P %d %d %d %d 1 0 1\n{\n", pinlength + boxwidth, ycoord, pinlength * 2 + boxwidth, ycoord); printf("T %d %d 5 8 1 1 0 0 1\n", pinlength + boxwidth + textoff_x, ycoord + textoff_y); printf("pinnumber=%d\n}\n", curpin); ycoord -= vstep / 2; if (!btb && curpin < npins) printf("L %d %d %d %d 3 0 0 0 -1 -1\n", pinlength, ycoord, pinlength + boxwidth, ycoord); curpin++; } } main(argc, argv) char **argv; { char **ap; ap = argv + 1; if (*ap && !strcmp(*ap, "-b")) { ap++; btb = 1; } if (!*ap || !isdigit(**ap)) { fprintf(stderr, "usage: %s [-b] npins\n", argv[0]); exit(1); } npins = atoi(*ap); if (npins < 2 || npins & 1) { fprintf(stderr, "%s: invalid npins argument\n", argv[0]); exit(1); } doit(); exit(0); }