xsmc-calc/0040755000000000000000000000000007371516210011434 5ustar rootrootxsmc-calc/Makefile0100644000000000000000000000114007367615132013075 0ustar rootrootall: xsmc xsmc: smc.o calc.o draw.o dialog.o gcc -lm -oxsmc -Wall -lX11 -lm -L/usr/X11R6/lib\ smc.o calc.o draw.o dialog.o { gzip *.1*; true; } # smc.o: smc.c gcc -Wall -c smc.c calc.o: calc.c gcc -Wall -c calc.c draw.o: draw.c gcc -Wall -c draw.c dialog.o: dialog.c gcc -Wall -c dialog.c # # clean: rm -f *~ rm -f *.o distclean: clean rm -f xsmc arch: distclean rm -f xsmc-calc.1.0.0.tgz cd ..; tar czvf xsmc-calc.1.0.0.tgz xsmc-calc/ install: install -m 755 ./xsmc /usr/bin/ install -m 644 ./xsmc.1.gz /usr/man/man1 uninstall: rm -f /usr/bin/xsmc rm -f ($MANDIR)/man1/xsmc.1.*xsmc-calc/dialog.c0100644000000000000000000002146707370041204013041 0ustar rootroot/* * XSMC-CALC: Smith Chart Calculator program for X * * * by Lapo Pieri (IK5NAX) 2000-2001 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Send bugs reports, comments, critique, etc, to ik5nax@amsat.org */ #include #include #include #include #include #include #include #include #include "smc.h" extern Display *display; extern GC gc; extern Window window; extern XEvent event; extern Pixmap schart; extern XFontStruct *fontdialogname; extern unsigned long numcolors, colorBLACK, colorWHITE, colorBG, colorZ, colorY, colorRHO, colorQ, colorSI, colorDW; extern unsigned int wdim, scdim; extern SMCDATA smcdata; void dialogwin(char *head, char *menu, char *choice, char *b) { int i, needupdate=1; char c[3]; const int DWLEN=15; XSetFont(display, gc, fontdialogname->fid); XSetForeground(display, gc, colorBLACK); XDrawString(display, schart, gc, 0.04*wdim+scdim+3, 0.05*wdim+scdim-1+fontdialogname->ascent+fontdialogname->descent, head, strlen(head)); if(strlen(menu)!=0) { XDrawString(display, schart, gc, 0.04*wdim+scdim+3, 0.05*wdim+scdim-1+0.3*(0.98*wdim-scdim-1) +fontdialogname->ascent+fontdialogname->descent, menu, strlen(menu)); XCopyArea(display,schart, window, gc, 0, 0, wdim, wdim, 0, 0); XFlush(display); do { XNextEvent(display, &event); } while (event.type==NoExpose || event.type==KeyRelease); if(event.type!=KeyPress) { b[0]='\0'; *choice='\0'; return; } i=XKeycodeToKeysym(display, event.xkey.keycode,event.xkey.state); *choice=(char)(i&0x00ff); XSetForeground(display, gc, colorWHITE); XFillRectangle(display, schart, gc, 0.04*wdim+scdim+1, 0.05*wdim+scdim+1+0.3*(0.98*wdim-scdim-1), 0.8*(0.98*wdim-scdim-1), 0.2*(0.98*wdim-scdim-1)); sprintf(c, "%c", *choice); XSetForeground(display, gc, colorBLACK); XDrawString(display, schart, gc, 0.04*wdim+scdim+3, 0.05*wdim+scdim-1+0.3*(0.98*wdim-scdim-1) +fontdialogname->ascent+fontdialogname->descent, c, strlen(c)); } else choice[0]='\0'; b[0]='\0'; while(1) { if(needupdate){ XCopyArea(display,schart, window, gc, 0, 0, wdim, wdim, 0, 0); XFlush(display); needupdate=0; } XNextEvent(display, &event); switch(event.type){ case KeyPress: i=XKeycodeToKeysym(display, event.xkey.keycode,event.xkey.state); if(i==XK_Return) { /* Repaint the dialog window */ XSetForeground(display, gc, colorDW); XFillRectangle(display, schart, gc, 0.02*wdim+scdim+1, 0.02*wdim+scdim+1, 0.98*wdim-scdim-1, 0.98*wdim-scdim-1); XSetForeground(display, gc, colorWHITE); XFillRectangle(display, schart, gc, 0.04*wdim+scdim+1, 0.05*wdim+scdim+1, 0.8*(0.98*wdim-scdim-1), 0.2*(0.98*wdim-scdim-1)); XFillRectangle(display, schart, gc, 0.04*wdim+scdim+1, 0.05*wdim+scdim+1+0.3*(0.98*wdim-scdim-1), 0.8*(0.98*wdim-scdim-1), 0.2*(0.98*wdim-scdim-1)); XFillRectangle(display, schart, gc, 0.04*wdim+scdim+1, 0.05*wdim+scdim+1+0.6*(0.98*wdim-scdim-1), 0.8*(0.98*wdim-scdim-1), 0.2*(0.98*wdim-scdim-1)); XCopyArea(display,schart, window, gc, 0, 0, wdim, wdim, 0, 0); XFlush(display); return; } if(i==XK_BackSpace) { b[strlen(b)-1]='\0'; i=0; needupdate=1; } if(i>0xff) continue; if(strlen(b)ascent+fontdialogname->descent, c, strlen(c)); XSetForeground(display, gc, colorBLACK); XDrawString(display, schart, gc, 0.04*wdim+scdim+3, 0.05*wdim+scdim-1+0.6*(0.98*wdim-scdim-1)+ fontdialogname->ascent+fontdialogname->descent, b, strlen(b)); needupdate=1; } case NoExpose: break; case KeyRelease: break; default: b[0]='\0'; /* Repaint the dialog window */ XSetForeground(display, gc, colorDW); XFillRectangle(display, schart, gc, 0.02*wdim+scdim+1, 0.02*wdim+scdim+1, 0.98*wdim-scdim-1, 0.98*wdim-scdim-1); XSetForeground(display, gc, colorWHITE); XFillRectangle(display, schart, gc, 0.04*wdim+scdim+1, 0.05*wdim+scdim+1, 0.8*(0.98*wdim-scdim-1), 0.2*(0.98*wdim-scdim-1)); XFillRectangle(display, schart, gc, 0.04*wdim+scdim+1, 0.05*wdim+scdim+1+0.3*(0.98*wdim-scdim-1), 0.8*(0.98*wdim-scdim-1), 0.2*(0.98*wdim-scdim-1)); XFillRectangle(display, schart, gc, 0.04*wdim+scdim+1, 0.05*wdim+scdim+1+0.6*(0.98*wdim-scdim-1), 0.8*(0.98*wdim-scdim-1), 0.2*(0.98*wdim-scdim-1)); XCopyArea(display,schart, window, gc, 0, 0, wdim, wdim, 0, 0); XFlush(display); return; } } } int entrystringdecode(char *is, float *re, float *im){ int i, fn, err; char *b; /* Remove initial spaces, it will be usefull later */ b=is; while(b[0]==' ' || b[0]=='\t') b++; err=0; for(i=0; i "12 +56" */ if(b[i]=='j') { /* Except if 'j' is the first character as in "j78.34" */ if(i!=0) { b[i]=b[i-1]; b[i-1]=' '; } else b[0]=' '; /* The string is ready to be read by a scanf, but if only one field is found this mean that it's a pure immaginary number */ if(sscanf(b, "%f %f", re, im)<2) { *im=*re; *re=0; } break; } } /* If no 'j' are found there may be one or more field separated by space or tab*/ if(i==strlen(b)) { if(strlen(b)==0) err=1; else fn=1; /* Search for field delimiter */ for(i=0; i'9' || b[i]<'0') && b[i]!='.' && b[i]!='-' && b[i]!='+') break; if(i!=strlen(b)) switch(b[i]) { case 'f': pf=1.e-15; break; case 'p': pf=1.e-12; break; case 'n': pf=1.e-9; break; case 'u': pf=1.e-6; break; case 'm': pf=1.e-3; break; case 'k': pf=1.e+3; break; case 'M': pf=1.e+6; break; case 'G': pf=1.e+9; break; case 'T': pf=1.e+12; break; case ' ': pf=1.; break; default: fprintf(stderr, "Invalid prefix (%c)\n", b[i]); return(0.); } strncpy(b2, b, i+2); sscanf(b2, "%f", &v); return (v*pf); } xsmc-calc/smc.c0100644000000000000000000004416007370041157012366 0ustar rootroot/* * XSMC-CALC: Smith Chart Calculator program for X * * * by Lapo Pieri (IK5NAX) 2000-2001 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Send bugs reports, comments, critique, etc, to ik5nax@amsat.org */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "smc.h" #include "xsmc.xbm" Display *display; Window window, root_win; GC gc; Colormap colormap; Drawable drawable; Pixmap schart, icon; Cursor main_curs; XEvent event; XWindowAttributes winattr; char initflag=0; XFontStruct *fontdialogname, *fontchartname; XWMHints *xwmhints; SMCDATA smcdata; char appname[80]; unsigned long numcolors, colorBLACK, colorWHITE, colorBG, colorZ, colorY, colorRHO, colorQ, colorSI, colorDW; unsigned int wdim=520, scdim; const float tunesteptab[6]={1.01, 1.02, 1.05, 1.1, 1.2, 1.5}; float tunestep; int Zcirc=1, Ycirc=0, RHOcirc=0, Qcirc=0; int main(int argc, char** argv) { int clo, needupdate=1, i, tsidx=3, Keyshift=0, x, y, curswhere=0; char b[40], c; float re, im, val0, val1, val2; scdim=0.7*wdim; /* Command line scan*/ if(argc>1) { while(1){ clo=getopt(argc, argv, "h?v"); if(clo==-1) break; switch(clo){ case 'h': case '?': printf("\nX Smith Chart Calculator\n"); printf("for doing calculation on Smith Chart under X\n"); printf("\n -h\n -? This simple help\n"); printf(" -v Current version\n\n"); printf("Released under GNU/GPL by Lapo Pieri (ik5nax@amsat.org)\n\n"); return(0); case 'v': printf("\nX Smith Chart Calculator\n"); printf("version %s\n\n", __VERSION); return (0); } } } display = XOpenDisplay(""); if (display == NULL) { fprintf(stderr, "Cannot connect to X server.\n"); return(1); } /* Init data */ smcdata.z0=50.; smcdata.f0=1e6; smcdata.rerhoSP=0.; smcdata.imrhoSP=0.; smcdata.ne=0; smcdata.neidx=0; tsidx=3; tunestep=tunesteptab[tsidx]; root_win=RootWindow(display, DefaultScreen(display)); createcolors(); window=XCreateSimpleWindow(display, root_win, 0, 0, wdim, wdim, 10, colorBLACK, colorBG ); XMapWindow(display, window); XStoreName(display, window, "X Smith Chart Calculator"); main_curs=XCreateFontCursor(display, XC_X_cursor); XDefineCursor(display, window, main_curs); icon=XCreateBitmapFromData(display, window, icon_bits, icon_width, icon_height); if(!icon) fprintf(stderr, "Unable to set icon\n"); else { xwmhints=XAllocWMHints(); if(!xwmhints) fprintf(stderr, "Unable to allocate memory for windows hints\n"); else { xwmhints->flags=IconPixmapHint; xwmhints->icon_pixmap=icon; XSetWMHints(display, window, xwmhints); XFree(xwmhints); } } XFlush(display); gc=XCreateGC(display, window, 0, 0); fontdialogname=XLoadQueryFont(display, "*-helvetica-medium-r-normal--12*"); if(!fontdialogname) fprintf(stderr, "Unable to load font\n"); fontchartname=XLoadQueryFont(display, "*helvetica*6*"); if(!fontchartname) fprintf(stderr, "Unable to load font\n"); XSelectInput(display, window, ExposureMask|KeyPressMask|KeyReleaseMask|PointerMotionMask); schart=XCreatePixmap(display, DefaultRootWindow(display), wdim, wdim, DefaultDepth(display, DefaultScreen(display))); XSetLineAttributes(display, gc, 1, LineSolid, CapButt, JoinBevel); drawchart(); XCopyArea(display,schart, window, gc, 0, 0, wdim, wdim, 0, 0); XFlush(display); while(1){ if(needupdate){ XCopyArea(display,schart, window, gc, 0, 0, wdim, wdim, 0, 0); XFlush(display); needupdate=0; } XNextEvent(display, &event); switch(event.type){ case Expose: XGetWindowAttributes(display, window, &winattr); if(winattr.width!=wdim || winattr.height!=wdim) { if(winattr.widthwinattr.height) { winattr.width=winattr.height; XResizeWindow(display, window, winattr.width, winattr.height); } wdim=winattr.width; scdim=0.7*wdim; drawchart(); } needupdate=1; break; case KeyPress: switch((i=XKeycodeToKeysym(display, event.xkey.keycode, event.xkey.state))) { case XK_q: /* Exiting */ XUndefineCursor(display, window); XFreePixmap(display, schart); XCloseDisplay(display); return 0; case XK_1: /* Toggle Z circle */ Zcirc^=1; drawchart(); needupdate=1; break; case XK_2: /* Toggle Y circle */ Ycirc^=1; drawchart(); needupdate=1; break; case XK_3: /* Toggle RHO circle */ RHOcirc^=1; drawchart(); needupdate=1; break; case XK_4: /* Toggle Q circle */ Qcirc^=1; drawchart(); needupdate=1; break; case XK_s: /* Insert start point */ dialogwin("Start Point", "Z Y Rho", &c, b); if(entrystringdecode(b, &re, &im)==0) { switch(c) { case 'z': case 'Z': smcdata.rezSP=re; smcdata.imzSP=im; smcdata.SPtype=c; break; case 'y': case 'Y': smcdata.reySP=re; smcdata.imySP=im; smcdata.SPtype=c; break; case 'r': case 'R': smcdata.rerhoSP=re; smcdata.imrhoSP=im; smcdata.SPtype=c; break; default: fprintf(stderr, "Invalid start point\n"); } recalc(); } else fprintf(stderr, "Invalid start point\n"); drawchart(); needupdate=1; break; case XK_0: /* Insert characteristic impedance (Z0) */ dialogwin("Z0", "", &c, b); if(entrystringdecode(b, &re, &im)==0) { if(re<=0.) fprintf(stderr, "Invalid characteristic impedance value\n"); else { smcdata.z0=re; recalc(); drawchart(); needupdate=1; } } else fprintf(stderr, "Invalid characteristic impedance\n"); break; case XK_f: /* Insert main frequency (f0) */ dialogwin("f0", "", &c, b); smcdata.f0=psdec(b); recalc(); drawchart(); needupdate=1; break; case XK_a: /* Add a network component */ if(smcdata.ne=smcdata.neidx; i--) { smcdata.ELtype[i+1]=smcdata.ELtype[i]; smcdata.ELval0[i+1]=smcdata.ELval0[i]; smcdata.ELval1[i+1]=smcdata.ELval1[i]; smcdata.ELval2[i+1]=smcdata.ELval2[i]; smcdata.ELplace[i+1]=smcdata.ELplace[i]; smcdata.rerhoIP[i+1]=smcdata.rerhoIP[i]; smcdata.imrhoIP[i+1]=smcdata.imrhoIP[i]; } smcdata.ne++; /* and then add the network element in the place just freed */ dialogwin("Insert", "R L C T", &c, b); if(tolower(c)=='r' || tolower(c)=='l' || tolower(c)=='c' || tolower(c)=='t') { smcdata.ELtype[smcdata.neidx]=c; if(componentvaluestringdecode(b, &val0, &val1, &val2, &c)==0) { smcdata.ELplace[smcdata.neidx]=c; smcdata.ELval0[smcdata.neidx]=val0; smcdata.ELval1[smcdata.neidx]=val1; smcdata.ELval2[smcdata.neidx]=val2; recalc(); } else removene(); } else { fprintf(stderr, "Unknown component type\n"); removene(); } } else fprintf(stderr, "No more space left for component\n"); drawchart(); needupdate=1; break; case XK_d: /* Remove a network component */ removene(); recalc(); drawchart(); needupdate=1; break; case XK_Up: if(smcdata.neidx>1) { smcdata.neidx--; drawdata(); needupdate=1; } break; case XK_Down: if(smcdata.neidx0) tsidx--; tunestep=tunesteptab[tsidx]; drawdata(); needupdate=1; break; case XK_w: dialogwin("Write network", "Spice Rfcs", &c, b); switch(tolower(c)) { case 's': writespice(b); break; case 'r': writerfcs(b); break; default: fprintf(stderr, "Unknown format\n"); } break; case XK_equal: if(smcdata.neidx>0) { dialogwin("New val & placement", "", &c, b); if(componentvaluestringdecode(b, &val0, &val1, &val2, &c)==0) { smcdata.ELplace[smcdata.neidx]=c; smcdata.ELval0[smcdata.neidx]=val0; recalc(); drawchart(); needupdate=1; } else { fprintf(stderr, "Invalid value\n"); } } break; case XK_o: optimize(); break; case XK_p: printf("Printing not yet implemented\n"); break; default: } break; case KeyRelease: switch((i=XKeycodeToKeysym(display, event.xkey.keycode, event.xkey.state))) { case XK_Shift_L: case XK_Shift_R: Keyshift=0; break; default: } break; case MotionNotify: x=event.xmotion.x; y=event.xmotion.y; if(xsmcdata.ne) smcdata.neidx--; } void writespice(char *b) { FILE *spf; int i, nr=0, nc=0, nl=0, nt=0, nod=0, nos=0, node=0; float vr, vi; char buff[40]; if((spf=fopen(b, "w"))==NULL) { fprintf(stderr, "Unable to open file %s for writing\n", b); return; } fprintf(spf, "Network generated by X Smith Chart Calculator\n"); fprintf(spf, "* Check/modify this file before simulation\n\n"); /* Start impedance is saved as a series of a resistance and a reactance and as a parallel network, the last is commented */ rho2z(smcdata.rerhoIP[0], smcdata.imrhoIP[0], &vr, &vi); node++; float2prefs(vr*smcdata.z0, buff, 1); fprintf(spf, "rsp %d %d %s\n", node-1, node, buff); node++; if(vi<0.) { float2prefs(-1./(2.*M_PI*smcdata.f0*vi*smcdata.z0), buff, 1); fprintf(spf, "csp %d %d %s\n", node-1, node, buff); } else { float2prefs(vi*smcdata.z0/(2.*M_PI*smcdata.f0) ,buff, 1); fprintf(spf, "lsp %d %d %s\n", node-1, node, buff); } rho2y(smcdata.rerhoIP[0], smcdata.imrhoIP[0], &vr, &vi); float2prefs(smcdata.z0/vr ,buff, 1); fprintf(spf, "* rsp %d %d %s\n", node, 0, buff); if(vi>=0.) { float2prefs(vi/smcdata.z0/(2.*M_PI*smcdata.f0), buff, 1); fprintf(spf, "* csp %d %d %s\n", node, 0, buff); } else { float2prefs(-1./(2.*M_PI*smcdata.f0*vi/smcdata.z0), buff, 1); fprintf(spf, "* lsp %d %d %s\n", node, 0, buff); } for(i=1; i<=smcdata.ne; i++) { switch(tolower(smcdata.ELtype[i])) { case 'r': nr++; if(smcdata.ELplace[i]=='s') { node++; float2prefs(smcdata.ELval0[i], buff, 1); fprintf(spf, "r%d %d %d %s\n", nr, node-1, node, buff); } else { float2prefs(smcdata.ELval0[i], buff, 1); fprintf(spf, "r%d %d %d %s\n", nr, node, 0, buff); } break; case 'l': nl++; if(smcdata.ELplace[i]=='s') { node++; float2prefs(smcdata.ELval0[i], buff, 1); fprintf(spf, "l%d %d %d %s\n", nl, node-1, node, buff); } else { float2prefs(smcdata.ELval0[i], buff, 1); fprintf(spf, "l%d %d %d %s\n", nl, node, 0, buff); } break; case 'c': nc++; if(smcdata.ELplace[i]=='s') { node++; float2prefs(smcdata.ELval0[i], buff, 1); fprintf(spf, "c%d %d %d %s\n", nc, node-1, node, buff); } else { float2prefs(smcdata.ELval0[i], buff, 1); fprintf(spf, "c%d %d %d %s\n", nc, node, 0, buff); } break; case 't': nt++; switch(tolower(smcdata.ELplace[i])) { case 't': node++; float2prefs(smcdata.ELval1[i], buff, 1); fprintf(spf, "t%d %d %d %d %d z0=%s ", nt, node-1, 0, node, 0, buff); float2prefs(smcdata.f0, buff, 1); fprintf(spf, "f=%s nl=%f\n", buff, smcdata.ELval0[i]/360.); break; case 'o': nod+=2; float2prefs(smcdata.ELval1[i], buff, 1); fprintf(spf, "t%d %d %d %dd %dd z0=%s ", nt, node, 0, nod-1, nod, buff); float2prefs(smcdata.f0, buff, 1); fprintf(spf, "f=%s nl=%f\n", buff, smcdata.ELval0[i]/360.); break; case 'c': nos++; float2prefs(smcdata.ELval1[i], buff, 1); fprintf(spf, "t%d %d %d %dd %dd z0=%s ", nt, node, 0, nos, nos, buff); float2prefs(smcdata.f0, buff, 1); fprintf(spf, "f=%s nl=%f\n", buff, smcdata.ELval0[i]/360.); break; case 'l': node++; nos++; float2prefs(smcdata.ELval1[i], buff, 1); fprintf(spf, "t%d %d %d %dd %dd z0=%s ", nt, node-1, node, nos, nos, buff); float2prefs(smcdata.f0, buff, 1); fprintf(spf, "f=%s nl=%f\n", buff, smcdata.ELval0[i]/360.); break; case 'a': node++; nos+=2; float2prefs(smcdata.ELval1[i], buff, 1); fprintf(spf, "t%d %d %d %dd %dd z0=%s ", nt, node-1, node, nos-1, nos, buff); float2prefs(smcdata.f0, buff, 1); fprintf(spf, "f=%s nl=%f\n", buff, smcdata.ELval0[i]/360.); break; } break; default: fprintf(spf, "* Unknown component '%c'\n", smcdata.ELtype[i]); } } node++; float2prefs(smcdata.z0, buff, 1); fprintf(spf, "r0 %d %d %s\n", node-1, node, buff); fprintf(spf, "v1 %d %d dc 0 ac 1\n", node, 0); float2prefs(smcdata.f0, buff, 1); fprintf(spf, "\n.ac lin 1 %s %s\n", buff, buff); fprintf(spf, ".end\n"); fclose(spf); } void writerfcs(char *b) { fprintf(stderr, "Unsupported yet\n"); } void optimize(void) { int i=1; float diff, olddiff; olddiff=(smcdata.rerhoIP[smcdata.ne]-50.)*(smcdata.rerhoIP[smcdata.ne]-50.)+ (smcdata.imrhoIP[smcdata.ne]-0.)*(smcdata.imrhoIP[smcdata.ne]-0.); while(1) { /* Check if user stop optimization with ESC */ if(XCheckWindowEvent(display, window, KeyPressMask, &event)) { if(XKeycodeToKeysym(display, event.xkey.keycode, event.xkey.state)==XK_Escape) return; } /* Search for better value, that's the optimization core */ smcdata.ELval0[i]*=1.01; recalc(); diff=(smcdata.rerhoIP[smcdata.ne]-50.)*(smcdata.rerhoIP[smcdata.ne]-50.)+ (smcdata.imrhoIP[smcdata.ne]-0.)*(smcdata.imrhoIP[smcdata.ne]-0.); if(olddiff #include #include #include #include #include #include #include #include #include "smc.h" extern Display *display; extern GC gc; extern Pixmap schart; extern XFontStruct *fontdialogname; extern unsigned long numcolors, colorBLACK, colorWHITE, colorBG, colorZ, colorY, colorRHO, colorQ, colorSI, colorDW; extern unsigned int wdim, scdim; extern SMCDATA smcdata; extern float tunestep; extern int Zcirc, Ycirc, RHOcirc, Qcirc; void drawchart(void) { int i, n, step; float R, X, G, B, sa, ea, a; float rer, imr, rer1, imr1, rer2, imr2; XSetForeground(display, gc, colorBG); XFillRectangle(display, schart, gc, 0, 0, wdim, wdim); /* Lines between Smith chart and number */ XSetForeground(display, gc, colorBLACK); XDrawLine(display, schart, gc, 0.02*wdim+scdim, 0, 0.02*wdim+scdim, wdim); XDrawLine(display, schart, gc, 0, 0.02*wdim+scdim, wdim, 0.02*wdim+scdim); /* Dialog window */ XSetForeground(display, gc, colorDW); XFillRectangle(display, schart, gc, 0.02*wdim+scdim+1, 0.02*wdim+scdim+1, 0.98*wdim-scdim-1, 0.98*wdim-scdim-1); /* and dialog entry point */ XSetForeground(display, gc, colorWHITE); XFillRectangle(display, schart, gc, 0.04*wdim+scdim+1, 0.05*wdim+scdim+1, 0.8*(0.98*wdim-scdim-1), 0.2*(0.98*wdim-scdim-1)); XFillRectangle(display, schart, gc, 0.04*wdim+scdim+1, 0.05*wdim+scdim+1+0.3*(0.98*wdim-scdim-1), 0.8*(0.98*wdim-scdim-1), 0.2*(0.98*wdim-scdim-1)); XFillRectangle(display, schart, gc, 0.04*wdim+scdim+1, 0.05*wdim+scdim+1+0.6*(0.98*wdim-scdim-1), 0.8*(0.98*wdim-scdim-1), 0.2*(0.98*wdim-scdim-1)); XSetForeground(display, gc, colorBLACK); XDrawArc(display, schart, gc, /* Main circle */ 0.01*wdim, wdim*0.01, scdim, scdim, 0, 360*64); XDrawArc(display, schart, gc, /* Central dot */ wdim*0.01+scdim/2-1, wdim*0.01+scdim/2-1, 2, 2, 0, 360*64); if(Zcirc) { drawRk(display, schart, gc, 0.5); drawRk(display, schart, gc, 1.); drawRk(display, schart, gc, 2.); drawXk(display, schart, gc, 0.); drawXk(display, schart, gc, -1.); drawXk(display, schart, gc, 1.); drawXk(display, schart, gc, -0.5); drawXk(display, schart, gc, 0.5); drawXk(display, schart, gc, -2.); drawXk(display, schart, gc, 2.); } if(Ycirc) { drawGk(display, schart, gc, 0.5); drawGk(display, schart, gc, 1.); drawGk(display, schart, gc, 2.); drawBk(display, schart, gc, 0.); drawBk(display, schart, gc, -1.); drawBk(display, schart, gc, 1.); drawBk(display, schart, gc, -0.5); drawBk(display, schart, gc, 0.5); drawBk(display, schart, gc, -2.); drawBk(display, schart, gc, 2.); } if(RHOcirc) { drawRHOk(display, schart, gc, 0.2); drawRHOk(display, schart, gc, 0.5); drawRHOk(display, schart, gc, 0.75); } if(Qcirc) { drawQk(display, schart, gc, 0.); drawQk(display, schart, gc, 1.); drawQk(display, schart, gc, 2.); drawQk(display, schart, gc, 0.5); drawQk(display, schart, gc, 5.); } drawSP(display, schart, gc, smcdata.rerhoSP, smcdata.imrhoSP); /* Draw arcs */ for(i=1; i<=smcdata.ne; i++) { /* Series placed element, that could be an R, L, or C */ switch(smcdata.ELplace[i]) { case 's': rho2z(smcdata.rerhoIP[i], smcdata.imrhoIP[i], &R, &X); if(smcdata.ELtype[i]=='r') { if(fabs(X)>QZ) { sa=thetaonX(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], X)*180/M_PI; ea=thetaonX(smcdata.rerhoIP[i], smcdata.imrhoIP[i], X)*180/M_PI; if(ea<0.) ea+=360; if(sa<0.) sa+=360; drawX(display, schart, gc, X, sa, ea-sa); } else drawX(display, schart, gc, X, smcdata.rerhoIP[i-1], smcdata.rerhoIP[i]); } else if(smcdata.ELtype[i]=='l' || smcdata.ELtype[i]=='c') { sa=thetaonR(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], R)*180/M_PI; ea=thetaonR(smcdata.rerhoIP[i], smcdata.imrhoIP[i], R)*180/M_PI; if(ea<0.) ea+=360; if(sa<0.) sa+=360; drawR(display, schart, gc, R, sa, ea-sa); } break; /* Parallel placed element, that could be an R, L, or C */ case'p': rho2y(smcdata.rerhoIP[i], smcdata.imrhoIP[i], &G, &B); if(smcdata.ELtype[i]=='r') { if(fabs(B)>QZ) { sa=thetaonB(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], B)*180/M_PI; ea=thetaonB(smcdata.rerhoIP[i], smcdata.imrhoIP[i], B)*180/M_PI; drawB(display, schart, gc, B, sa, ea-sa); } else drawB(display, schart, gc, B, smcdata.rerhoIP[i-1], smcdata.rerhoIP[i]); } else if(smcdata.ELtype[i]=='l' || smcdata.ELtype[i]=='c') { sa=thetaonG(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], G)*180/M_PI; ea=thetaonG(smcdata.rerhoIP[i], smcdata.imrhoIP[i], G)*180/M_PI; drawG(display, schart, gc, G, sa, ea-sa); } break; /* The rest are for transmission line */ case 't': rer1=smcdata.rerhoIP[i-1]; imr1=smcdata.imrhoIP[i-1]; step=36*(1+(int)(smcdata.ELval0[i]/360)); a=smcdata.ELval0[i]/180.*M_PI/step; for(n=0; nQZ) { xc=1.; yc=1./X; r=1./fabs(X); x=(int)((xc+1.)/2.*scdim); y=(int)((1.-yc)/2.*scdim); w=(int)(r*scdim); h=(int)(r*scdim); XDrawArc(display, drawable, gc, x-w/2+wdim*0.01, y-h/2+wdim*0.01, w, h, sa*64, al*64); } else { yc=X/2.; y=(int)((1.-yc)/2.*scdim); yc=0; h=(int)((1.-yc)/2.*scdim); xc=sa; x=(int)((xc+1.)/2.*scdim); xc=al; w=(int)((xc+1.)/2.*scdim); XDrawLine(display, drawable, gc, x+wdim*0.01, y+wdim*0.01, w+wdim*0.01, h+wdim*0.01); } XSetLineAttributes(display, gc, 1, LineSolid, CapRound, JoinRound); } void drawG(Display *display, Drawable drawable, GC gc, float G, float sa, float al){ float xc, yc, r; int x, y, w, h; XSetForeground(display, gc, colorBLACK); XSetLineAttributes(display, gc, 2, LineSolid, CapRound, JoinRound); xc=-G/(1.+G); yc=0; r=1./(1.+G); x=(int)((xc+1.)/2.*scdim); y=(int)((1.-yc)/2.*scdim); w=(int)(r*scdim); h=(int)(r*scdim); XDrawArc(display, drawable, gc, x-w/2+wdim*0.01, y-h/2+wdim*0.01, w, h, sa*64, al*64); XSetLineAttributes(display, gc, 1, LineSolid, CapRound, JoinRound); } void drawB(Display *display, Drawable drawable, GC gc, float B, float sa, float al) { float xc, yc, r; int x, y, w, h; XSetForeground(display, gc, colorBLACK); XSetLineAttributes(display, gc, 2, LineSolid, CapRound, JoinRound); if(fabs(B)>QZ) { xc=-1.; yc=-1./B; r=1./fabs(B); x=(int)((xc+1.)/2.*scdim); y=(int)((1.-yc)/2.*scdim); w=(int)(r*scdim); h=(int)(r*scdim); XDrawArc(display, drawable, gc, x-w/2+wdim*0.01, y-h/2+wdim*0.01, w, h, sa*64, al*64); } else { yc=-B/2.; y=(int)((1.-yc)/2.*scdim); yc=0; h=(int)((1.-yc)/2.*scdim); xc=sa; x=(int)((xc+1.)/2.*scdim); xc=al; w=(int)((xc+1.)/2.*scdim); XDrawLine(display, drawable, gc, x+wdim*0.01, y+wdim*0.01, w+wdim*0.01, h+wdim*0.01); } XSetLineAttributes(display, gc, 1, LineSolid, CapRound, JoinRound); } void drawRHO(Display *display, Drawable drawable, GC gc, float RHO, float sa, float ea) { float xc, yc, r; int x, y, w, h; XSetForeground(display, gc, colorBLACK); XSetLineAttributes(display, gc, 2, LineSolid, CapRound, JoinRound); xc=0; yc=0; r=RHO; x=(int)((xc+1.)/2.*scdim); y=(int)((yc+1.)/2.*scdim); w=(int)(r*scdim); h=(int)(r*scdim); XDrawArc(display, drawable, gc, x-w/2+wdim*0.01, y-h/2+wdim*0.01, w, h, sa*64, ea*64); XSetLineAttributes(display, gc, 1, LineSolid, CapRound, JoinRound); } void drawLINE(Display *display, Drawable drawable, GC gc, float rerhoi, float imrhoi, float rerhof, float imrhof) { int x1, y1, x2, y2; XSetForeground(display, gc, colorBLACK); XSetLineAttributes(display, gc, 2, LineSolid, CapRound, JoinRound); x1=(int)((rerhoi+1.)/2.*scdim); y1=(int)((1.-imrhoi)/2.*scdim); x2=(int)((rerhof+1.)/2.*scdim); y2=(int)((1.-imrhof)/2.*scdim); XDrawLine(display, drawable, gc, x1+wdim*0.01, y1+wdim*0.01, x2+wdim*0.01, y2+wdim*0.01); XSetLineAttributes(display, gc, 1, LineSolid, CapRound, JoinRound); } void drawdata(void) { char b[80], b2[80]; int chrh, ls, i; float r, j; /* Setup font and get some dimension in pixel */ XSetFont(display, gc, fontdialogname->fid); chrh=fontdialogname->ascent+fontdialogname->descent; ls=chrh*1.2; /* Write the vertical bar */ /* Clear first */ XSetForeground(display, gc, colorWHITE); XFillRectangle(display, schart, gc, 0.02*wdim+scdim+1, 0, scdim-1-0.02*wdim, scdim+0.02*wdim); /* Display general data */ XSetForeground(display, gc, colorBLACK); sprintf(b, "Z0=%4.0f", smcdata.z0); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, ls, b, strlen(b)); sprintf(b, "f0= "); float2prefs(smcdata.f0, b2, 0); strcat(b, b2); strcat(b, "Hz"); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 2*ls, b, strlen(b)); /* Start point */ rho2z(smcdata.rerhoIP[0], smcdata.imrhoIP[0], &r, &j); r*=smcdata.z0; j*=smcdata.z0; sprintf(b, "zSP="); float2prefs(r, b2, 0); strcat(b, b2); sprintf(b2, "%cj", j>0. ? '+' : '-'); strcat(b, b2); float2prefs(fabs(j), b2, 0); strcat(b, b2); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 4*ls, b, strlen(b)); rho2y(smcdata.rerhoIP[0], smcdata.imrhoIP[0], &r, &j); r/=smcdata.z0; j/=smcdata.z0; sprintf(b, "ySP="); float2prefs(r, b2, 0); strcat(b, b2); sprintf(b2, "%cj", j>0. ? '+' : '-'); strcat(b, b2); float2prefs(fabs(j), b2, 0); strcat(b, b2); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 5*ls, b, strlen(b)); r=smcdata.rerhoIP[0]; j=smcdata.imrhoIP[0]; sprintf(b, "rhoSP="); float2prefs(r, b2, 0); strcat(b, b2); sprintf(b2, "%cj", j>0. ? '+' : '-'); strcat(b, b2); float2prefs(fabs(j), b2, 0); strcat(b, b2); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 6*ls, b, strlen(b)); r=sqrt((smcdata.rerhoIP[0]*smcdata.rerhoIP[0])+ (smcdata.imrhoIP[0]*smcdata.imrhoIP[0])); sprintf(b, "SWR= %5.2f", (1.+r)/(1.-r)); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 7*ls, b, strlen(b)); /* End point */ rho2z(smcdata.rerhoIP[smcdata.ne], smcdata.imrhoIP[smcdata.ne], &r, &j); r*=smcdata.z0; j*=smcdata.z0; sprintf(b, "zEP="); float2prefs(r, b2, 0); strcat(b, b2); sprintf(b2, "%cj", j>0. ? '+' : '-'); strcat(b, b2); float2prefs(fabs(j), b2, 0); strcat(b, b2); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 9*ls, b, strlen(b)); rho2y(smcdata.rerhoIP[smcdata.ne], smcdata.imrhoIP[smcdata.ne], &r, &j); r/=smcdata.z0; j/=smcdata.z0; sprintf(b, "yEP="); float2prefs(r, b2, 0); strcat(b, b2); sprintf(b2, "%cj", j>0. ? '+' : '-'); strcat(b, b2); float2prefs(fabs(j), b2, 0); strcat(b, b2); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 10*ls, b, strlen(b)); r=smcdata.rerhoIP[smcdata.ne]; j=smcdata.imrhoIP[smcdata.ne]; sprintf(b, "rhoEP="); float2prefs(r, b2, 0); strcat(b, b2); sprintf(b2, "%cj", j>0. ? '+' : '-'); strcat(b, b2); float2prefs(fabs(j), b2, 0); strcat(b, b2); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 11*ls, b, strlen(b)); r=sqrt((smcdata.rerhoIP[smcdata.ne]*smcdata.rerhoIP[smcdata.ne])+ (smcdata.imrhoIP[smcdata.ne]*smcdata.imrhoIP[smcdata.ne])); sprintf(b, "SWR= %5.2f", (1.+r)/(1.-r)); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 12*ls, b, strlen(b)); /* Other data */ sprintf(b, "tunestep %3.0f%%", (tunestep-1.)*100.); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 15*ls, b, strlen(b)); /* End point */ rho2z(smcdata.rerhoCU, smcdata.imrhoCU, &r, &j); r*=smcdata.z0; j*=smcdata.z0; sprintf(b, "zCU="); float2prefs(r, b2, 0); strcat(b, b2); sprintf(b2, "%cj", j>0. ? '+' : '-'); strcat(b, b2); float2prefs(fabs(j), b2, 0); strcat(b, b2); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 18*ls, b, strlen(b)); rho2y(smcdata.rerhoCU, smcdata.imrhoCU, &r, &j); r/=smcdata.z0; j/=smcdata.z0; sprintf(b, "yCU="); float2prefs(r, b2, 0); strcat(b, b2); sprintf(b2, "%cj", j>0. ? '+' : '-'); strcat(b, b2); float2prefs(fabs(j), b2, 0); strcat(b, b2); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 19*ls, b, strlen(b)); r=smcdata.rerhoCU; j=smcdata.imrhoCU; sprintf(b, "rhoCU="); float2prefs(r, b2, 0); strcat(b, b2); sprintf(b2, "%cj", j>0. ? '+' : '-'); strcat(b, b2); float2prefs(fabs(j), b2, 0); strcat(b, b2); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 20*ls, b, strlen(b)); r=sqrt((smcdata.rerhoCU*smcdata.rerhoCU)+ (smcdata.imrhoCU*smcdata.imrhoCU)); sprintf(b, "SWR= %5.2f", (1.+r)/(1.-r)); XDrawString(display, schart, gc, 0.02*wdim+scdim+8, 21*ls, b, strlen(b)); /* Write the horizontal bar */ /* Clear first */ XSetForeground(display, gc, colorWHITE); XFillRectangle(display, schart, gc, 1, 0.02*wdim+scdim+1, scdim-1+0.02*wdim, wdim); /* Display network description */ XSetForeground(display, gc, colorBLACK); for(i=1; i<=smcdata.ne; i++) { switch(smcdata.ELtype[i]) { case 'r': case 'l': case 'c': if(i==smcdata.neidx) { XSetForeground(display, gc, colorDW); XFillRectangle(display, schart, gc, ls/4, 0.02*wdim+scdim+ls*(i-1)+ls/4, 5/4*ls, ls); XSetForeground(display, gc, colorBLACK); } sprintf(b, "#%d:", i); XDrawString(display, schart, gc, ls/4, 0.02*wdim+scdim+ls*i, b, strlen(b)); sprintf(b, "%c", toupper(smcdata.ELtype[i])); XDrawString(display, schart, gc, ls/4+2*ls, 0.02*wdim+scdim+ls*i, b, strlen(b)); sprintf(b, "%c", smcdata.ELplace[i]); XDrawString(display, schart, gc, ls/4+4*ls, 0.02*wdim+scdim+ls*i, b, strlen(b)); float2prefs(smcdata.ELval0[i], b, 0); XDrawString(display, schart, gc, ls/4+6*ls, 0.02*wdim+scdim+ls*i, b, strlen(b)); break; case 't': if(i==smcdata.neidx) { XSetForeground(display, gc, colorDW); XFillRectangle(display, schart, gc, ls/4, 0.02*wdim+scdim+ls*(i-1)+ls/4, 5/4*ls, ls); XSetForeground(display, gc, colorBLACK); } sprintf(b, "#%d:", i); XDrawString(display, schart, gc, ls/4, 0.02*wdim+scdim+ls*i, b, strlen(b)); sprintf(b, "%c", toupper(smcdata.ELtype[i])); XDrawString(display, schart, gc, ls/4+2*ls, 0.02*wdim+scdim+ls*i, b, strlen(b)); sprintf(b, "%c", smcdata.ELplace[i]); XDrawString(display, schart, gc, ls/4+4*ls, 0.02*wdim+scdim+ls*i, b, strlen(b)); float2prefs(smcdata.ELval0[i], b, 0); XDrawString(display, schart, gc, ls/4+6*ls, 0.02*wdim+scdim+ls*i, b, strlen(b)); float2prefs(smcdata.ELval1[i], b, 0); XDrawString(display, schart, gc, ls/4+11*ls, 0.02*wdim+scdim+ls*i, b, strlen(b)); break; default: } } } xsmc-calc/calc.c0100644000000000000000000001730607370041231012501 0ustar rootroot/* * XSMC-CALC: Smith Chart Calculator program for X * * * by Lapo Pieri (IK5NAX) 2000-2001 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Send bugs reports, comments, critique, etc, to ik5nax@amsat.org */ #include #include #include #include #include #include #include #include #include "smc.h" extern SMCDATA smcdata; void rhoz1z2(float *rerho, float *imrho, float z1, float z2) { float A, B, x, y; A=z1-z2; B=z1+z2; x=*rerho; y=*imrho; *rerho=(A*B*(1+x*x+y*y)+x*(A*A+B*B))/((B+A*x)*(B+A*x)+A*A*y*y); *imrho=(y*(B*B-A*A))/((B+A*x)*(B+A*x)+A*A*y*y); } void z2rho(float r, float x, float *rerho, float *imrho) { *rerho=(r*r+x*x-1)/((r+1)*(r+1)+x*x); *imrho=2*x/((r+1)*(r+1)+x*x); } void y2rho(float g, float b, float *rerho, float *imrho) { *rerho=(1-g*g-b*b)/((1+g)*(1+g)+b*b); *imrho=-2*b/((1+g)*(1+g)+b*b); } void rho2z(float rerho, float imrho, float *r, float *x) { *r=(1-rerho*rerho-imrho*imrho)/((1-rerho)*(1-rerho)+imrho*imrho); *x=2*imrho/((1-rerho)*(1-rerho)+imrho*imrho); } void rho2y(float rerho, float imrho, float *g, float *b) { *g=(1-rerho*rerho-imrho*imrho)/((1+rerho)*(1+rerho)+imrho*imrho); *b=-2*imrho/((1+rerho)*(1+rerho)+imrho*imrho); } float thetaonR(float rerho, float imrho, float R) { return (atan2(imrho, rerho-R/(1.+R))); } float thetaonX(float rerho, float imrho, float X) { if(X!=0.) return atan2(imrho-1./X, rerho-1.); else return 0; } float thetaonG(float rerho, float imrho, float G) { return (atan2(imrho, rerho+G/(1.+G))); } float thetaonB(float rerho, float imrho, float B) { if(B!=0.) return atan2(imrho+1./B, rerho+1.); else return 0; } /* Polar to rectangular conversion; angle in degrees */ void polar2rect(float *a, float *b) { float re, im; re=*a*cos(*b/180.*M_PI); im=*a*sin(*b/180.*M_PI); *a=re; *b=im; } /* Polar to rectangular conversion; angle in degrees */ void rect2polar(float *a, float *b) { float mod, arg; mod=sqrt(*a**a+*b**b); arg=atan2(*b, *a); *a=mod; *b=arg; } /* Do recalculation when some of data in smcdata are changed */ void recalc(void){ int i; float reap, imap; /* Recalculate start point rho */ switch(smcdata.SPtype) { case 'z': case 'Z': z2rho(smcdata.rezSP/smcdata.z0, smcdata.imzSP/smcdata.z0, &smcdata.rerhoSP, &smcdata.imrhoSP); break; case 'y': case 'Y': y2rho(smcdata.rezSP*smcdata.z0, smcdata.imzSP*smcdata.z0, &smcdata.rerhoSP, &smcdata.imrhoSP); break; case 'r': case 'R': break; } /* Recalculation of impedance when component value are given */ smcdata.rerhoIP[0]=smcdata.rerhoSP; smcdata.imrhoIP[0]=smcdata.imrhoSP; for(i=1; i<=smcdata.ne; i++) { switch(smcdata.ELtype[i]) { case 'r': if(smcdata.ELplace[i]=='s') { rho2z(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], &reap, &imap); reap+=smcdata.ELval0[i]/smcdata.z0; z2rho(reap, imap, &smcdata.rerhoIP[i], &smcdata.imrhoIP[i]); } else if(smcdata.ELplace[i]=='p') { rho2y(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], &reap, &imap); reap+=smcdata.z0/smcdata.ELval0[i]; y2rho(reap, imap, &smcdata.rerhoIP[i], &smcdata.imrhoIP[i]); } else { fprintf(stderr, "Impossible connection\n"); } break; case 'l': if(smcdata.ELplace[i]=='s') { rho2z(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], &reap, &imap); imap+=2*M_PI*smcdata.f0*smcdata.ELval0[i]/smcdata.z0; z2rho(reap, imap, &smcdata.rerhoIP[i], &smcdata.imrhoIP[i]); } else if(smcdata.ELplace[i]=='p') { rho2y(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], &reap, &imap); imap-=smcdata.z0/(2*M_PI*smcdata.f0*smcdata.ELval0[i]); y2rho(reap, imap, &smcdata.rerhoIP[i], &smcdata.imrhoIP[i]); } else { fprintf(stderr, "Impossible connection\n"); } break; case 'c': if(smcdata.ELplace[i]=='s') { rho2z(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], &reap, &imap); imap-=1./(2*M_PI*smcdata.f0*smcdata.ELval0[i])/smcdata.z0; z2rho(reap, imap, &smcdata.rerhoIP[i], &smcdata.imrhoIP[i]); } else if(smcdata.ELplace[i]=='p') { rho2y(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], &reap, &imap); imap+=2*M_PI*smcdata.f0*smcdata.ELval0[i]*smcdata.z0; y2rho(reap, imap, &smcdata.rerhoIP[i], &smcdata.imrhoIP[i]); } else { fprintf(stderr, "Impossible connection\n"); } break; case 't': switch(smcdata.ELplace[i]) { case 't': /* Trasmission line */ reap=smcdata.rerhoIP[i-1]; imap=smcdata.imrhoIP[i-1]; rhoz1z2(&reap, &imap, smcdata.z0, smcdata.ELval1[i]); smcdata.rerhoIP[i]=reap*cos(2.*smcdata.ELval0[i]/180.*M_PI)+ imap*sin(2.*smcdata.ELval0[i]/180.*M_PI); smcdata.imrhoIP[i]=-reap*sin(2.*smcdata.ELval0[i]/180.*M_PI)+ imap*cos(2.*smcdata.ELval0[i]/180.*M_PI); rhoz1z2(&smcdata.rerhoIP[i], &smcdata.imrhoIP[i], smcdata.ELval1[i], smcdata.z0); break; case 'o': /* Open parallel stub */ rho2y(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], &reap, &imap); imap+=tan(smcdata.ELval0[i]/180.*M_PI)/smcdata.ELval1[i]*smcdata.z0; y2rho(reap, imap, &smcdata.rerhoIP[i], &smcdata.imrhoIP[i]); break; case 'c': /* Short parallel stub */ rho2y(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], &reap, &imap); imap+=-1./tan(smcdata.ELval0[i]/180.*M_PI)/ smcdata.ELval1[i]*smcdata.z0; y2rho(reap, imap, &smcdata.rerhoIP[i], &smcdata.imrhoIP[i]); break; case 'l': /* Short serial stub */ rho2z(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], &reap, &imap); imap+=smcdata.ELval1[i]*tan(smcdata.ELval0[i]/180.*M_PI)/smcdata.z0; z2rho(reap, imap, &smcdata.rerhoIP[i], &smcdata.imrhoIP[i]); break; case 'a': /* Open serial syub */ rho2z(smcdata.rerhoIP[i-1], smcdata.imrhoIP[i-1], &reap, &imap); imap+=-smcdata.ELval1[i]/tan(smcdata.ELval0[i]/180.*M_PI)/smcdata.z0; z2rho(reap, imap, &smcdata.rerhoIP[i], &smcdata.imrhoIP[i]); break; default: fprintf(stderr, "Impossible connection\n"); } } } /* for(i=0; i<=smcdata.ne; i++) printf("%f %f\n", smcdata.rerhoIP[i], smcdata.imrhoIP[i]); printf("\n"); */ } void float2prefs(float v, char *b, int isspice) { float p; p=log10(v); if(p>=-18. && p<-15.) sprintf(b, "%6.2fa", v*1e18); else if(p>=-15. && p<-12.) sprintf(b, "%6.2ff", v*1e15); else if(p>=-12. && p<-9.) sprintf(b, "%6.2fp", v*1e12); else if(p>=-9. && p<-6.) sprintf(b, "%6.2fn", v*1e9); else if(p>=-6. && p<-3.) sprintf(b, "%6.2fu", v*1e6); else if(p>=-3. && p<0.) sprintf(b, "%6.2fm", v*1e3); else if(p>=0. && p<3.) sprintf(b, "%6.2f ", v); else if(p>=3. && p<6.) sprintf(b, "%6.2fk", v*1e-3); else if(p>=6. && p<9.) { if(isspice) sprintf(b, "%6.2fMEG", v*1e-6); else sprintf(b, "%6.2fM", v*1e-6); } else if(p>=9. && p<12.) sprintf(b, "%6.2fG", v*1e-9); else if(p>=12. && p<15.) sprintf(b, "%6.2fT", v*1e-12); else sprintf(b, "%6.2g\n", v); } xsmc-calc/xsmc.xbm0100644000000000000000000000156407363430760013127 0ustar rootroot#define icon_width 32 #define icon_height 32 static unsigned char icon_bits[] = { 0x00, 0x3e, 0x00, 0x00, 0xc0, 0xd1, 0x01, 0x00, 0x20, 0x10, 0x02, 0x24, 0x18, 0x10, 0x0c, 0x2c, 0x18, 0x10, 0x08, 0x34, 0x24, 0x20, 0x12, 0x24, 0x42, 0xe0, 0x3d, 0x00, 0x82, 0x61, 0x20, 0x3c, 0x02, 0x56, 0x60, 0x24, 0x01, 0xf8, 0x41, 0x3c, 0x01, 0x10, 0x46, 0x24, 0xff, 0xff, 0xff, 0x00, 0x01, 0x10, 0x4e, 0x24, 0x01, 0xf8, 0x41, 0x18, 0x02, 0xd6, 0x60, 0x18, 0x82, 0x61, 0x20, 0x24, 0x42, 0xe0, 0x3d, 0x00, 0x24, 0x10, 0x12, 0x00, 0x18, 0x10, 0x08, 0x00, 0x18, 0x10, 0x0c, 0x00, 0x20, 0x08, 0x02, 0x00, 0xc0, 0xc9, 0x01, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x0c, 0x11, 0x07, 0x28, 0x12, 0x9b, 0x08, 0x10, 0x04, 0x95, 0x00, 0x10, 0x08, 0x91, 0x00, 0x28, 0x12, 0x91, 0x08, 0x44, 0x0c, 0x11, 0x07, 0x00, 0x00, 0x00, 0x00}; xsmc-calc/keystroke.txt0100644000000000000000000000402707366161546014231 0ustar rootroot------------------------- X Smith Chart Calculator --------------------------- v 0.1.0 Keystroke list ============== q - Quit 1 - Toggle visualization of impedance (Z) circle 2 - Toggle visualization of admittance (Y) circle 3 - Toggle visualization of reflection coefficient (RHO) circle 4 - Toggle visualization of constant Q circle s - Set start point z: set start point as impedance y: set start point as admittance r: set start point as refletction coefficient 0 - (zero) Set characteristic impedance z0 f - Set frequency (f0) a - Add a network element (see dialog window explaination): r: add a resistor l: add an inductor c: add a capacitor t: add a transmission line or stub i - Insert a network element before the highlighted element, as in 'a' d - Delete the currently highligthed element Curs Up - Highlight previous element Curs Down - Highlight next element Curs Left - Decrease the first field of currently highlighted element Curs Rigth - Increase the first field of currently highlighted element Shift+Curs Left - Decrease the second field of currently highlighted element Shift+Curs Rigth - Increase the second field of currently highlighted element Page Up - Increase the tuning increment Page Down - Decrease the tuning increment w - Write network file: s: spice format r: RFCS format (to be implemented, when RFCS will exist) = - Change first field and placement of currently highlighted element *** Of future implementation *** o - Start optimization, ESC to stop. l - Lock currently highlighted element for optimization p - Print smitchart on a postscript file Component placement =================== s - Series placement p - Parallel placement t - Trasmission line placed in trasmissive mode, i.e. as a quadrupole o - Open parallel stub c - Short parallel stub a - Open series stub l - Short series stub ----- To get information write me: Lapo Pieri via A. dei Corbizi, 9 I-50127 FIRENZE ITALY T. +39 055 410209 ik5nax@amsat.org xsmc-calc/mini-xsmc.xpm0100644000000000000000000000066107366073553014102 0ustar rootroot/* XPM */ static char * mini-mix_xpm[] = { "16 16 4 1", " c None s None", ". c black", "r c red", "y c green", " .... ", " .. r .. ", " . r . ", " . r . ", " . r ... . ", " . .ryyy.. ", ". .yryyy..", ". .yyyrryy.", ".............rrr", ". .yyyrryy.", " . .yryyy. ", " . ryyy.. ", " . r .... ", " . r . ", " .. r .. ", " .... "}; xsmc-calc/net1.cir0100644000000000000000000000040007366141374013002 0ustar rootrootNetwork generated by X Smith Chart Calculator * Check/modify this file before simulation rsp 0 1 10.00 csp 1 2 293.37p * rsp 2 0 132.50 * csp 2 0 271.23p l1 2 3 560.00n c1 3 0 390.00p r0 3 4 50.00 v1 4 0 dc 0 ac 1 .ac lin 1 15.50MEG 15.50MEG .end xsmc-calc/README0100644000000000000000000000274207367614201012322 0ustar rootroot------------------------- X Smith Chart Calculator --------------------------- v 0.1.0 This program is intended for who known Smith Chart and its use in radiofrequency calculation and need to do such calculation under Unix platform. xsmc is written to run under X, so it's possible to use it on every unix machine that run an X server, but also remotely using an X emulator and a machine where the client can run (though I haven't test this mode). Many other program exist with the same purpose, but I'm not able to find one that work under GNU/Linux, so I decide to write one. More this software is free, refer to GNU/GPL license (www.gnu.org) to know more, but the real important things about free software is that you can use it, copy it, modify it and redistributed, since the source code is provvided. This program has been developed under GNU/Linux and X, but should be portable on most Unix system running X, porting on other system should be difficult, and unusfull since many other similar program exist for DOS/Win and are good one and free. I'd like to know if you like xsmc, if bugs are found or if some function is not usefull or other should be important, so send me every comment, criticism, bugs, impression, etc..., you can reach me: Lapo Pieri (IK5NAX) Home address: via A. dei Corbizi 9 I-50127 Firenze Italy Phone: +39 055 410209 e-mail: ik5nax@amsat.org packet radio: ik5nax@ik5skv.#fi.itos.ita.eu website: www.qsl.net/ik5nax Have a nice calculation! Lapo Pierixsmc-calc/INSTALL0100644000000000000000000000335007367614644012502 0ustar rootroot------------------------- X Smith Chart Calculator --------------------------- v 0.1.0 xsmc is easy to compile and install, unpack the archive xsmc-calc.x.x.x.tgz and enter the xsmc-calc dir: tar xzvf xsmc-calc.x.x.x.tgz cd xsmc-calc where x.x.x is the current version number. Than xsmc has to be compile, just do make if everything goes well (no error message are reported) xsmc can be installed doing: make install Uninstallation is possible doing make uninstall Now xsmc is ready to run; the above operation don't require running X, thought X must be installed with developing tools too (check your distribution instruction to setup this), but to use xsmc an X server must be running the command should be startx & On an xterm or rxvt window run xsmc & and the xsmc window will appear. (The program can be used before installation, issuing ./xsmc if you want to check how it work or if you don't have enough file permission). Once installed the distribution directory can be removed, the only part of the distribution that could be usefull before removing is the mini-icon called mini-xsmc.xpm, I use it for fvwm2 Minibuttons. Before to use it should be good to read the manual with man xsmc or at least, if you are so impatient, read the section of the manual titled 'EXAMPLE OF USE' or better print it to have something to refer when the window of xsmc is in front of you waiting for a key. Let me know if something goes wrong, comment, bug report, criticism, etc are welcome, if you want to contact me: Lapo Pieri (IK5NAX) Home address: via A. dei Corbizi 9 I-50127 Firenze Italy Phone: +39 055 410209 e-mail: ik5nax@amsat.org packet radio: ik5nax@ik5skv.#fi.itos.ita.eu website: www.qsl.net/ik5nax xsmc-calc/COPYING0100644000000000000000000004307607370040773012503 0ustar rootroot GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. xsmc-calc/xsmc.1.gz0100644000000000000000000001145307370042134013106 0ustar rootroot\D;xsmc.1ZkwǑ+z' |Z),_!N`z<[U݃HĶGu=nݪo=}[VSYt\ Ӭө~0~so9=~O?e|uu槳;}ӗ.otKeK}ed/ՙz>/zYtnZLKRsMMX0u2wL)gx4Vß4m#f):ލnG7\@SKL|Z,K]{z3NL(4 ϹU:b,nwN\dV|sI,us7Y@%;w7[C!ucAƶBV{>& իsI嫓:D=lKc$9 *Ūk?)OJLvNRxv)BbmG /G0T8ͥ<\aXbH"S~E؉{[v˹3CyHNjY4eIǰҠӦ.^7k3?eޝ9yvZ KRZS4SWRf);p{u#{oM%\e 鿼k2+[ޚekl$.tcۓ wy}R\z݉gW۴%NܝNL# GL?|Wc_ࡂ} &l<5 z.t6- u5rJJWԬW%#>N.o>G׽ȉf@4J1r"sejjY`(O4EApf<9u *RrLB4&6b #8P%ŏ|YK,ŤXz&tX ;C*f!:>96=nJ@UM2CydJL&Tp?h`'1@%¨وAߌ>sQ *`8 nG^#&tJ wSiow8Ld UQ,&@Buafh 9- lVaQ~F+ОԔLu aX᱄+ }fqvv$0h cְW_ -pr,|XgvMþ+l3CYJ=Ho*I>O~ڲ?ݢsjpf8j^[pvxr)@ OE/@tN t TغlVBgnQ+5ujV?oKFɋdw܎ Z^\B2 , lKpQa_tJ0NAsu\uylC0]s)Oi꺅쮺X@. m]Cb"H.0F3,E{b̕_C^"GA *CAXwePS_,4o#Q7W t&yMqi{u#%(W(2Cgxrog'9$LF BNLݣKEmSp뫮;]AV\]l=CgR$S&ɩںQF`Z%9( `RxI8 !@1i&öң#C^ln?qtqℼ yJQ$~M_MP\~ لm锡<6/'Wg\KKrd&OAjne$PaS_<1zxIG[G{ݣ_sA躬 GWKiRQn P(EƦduw}k],SpC`(ZhQP̷T_Le0iOwkʏZa-j".ӬKSzG]ș3 BZ߯ !+2|[R{W!qLSWVNTSEZ]xjW?Eğ$Xcc\I-tҽ_5j9E\Ҍt-') A!ד 5!9q0̖gni%*TM^&hVbEڛrRՂhFAl[vjP 4ҭ+,- 鯫E]\0We/n[ U!C"^~5 6:0օtmJXъh^%'tAJdU{Tάܕ YwUp'ȕKAc ւO-zEtZX%'~2!Щ){v}q.r, 61ۢूi<U{ )ô-!**2~P˟9ңw6e 4ܺ[;Zm>q\I֪%5WD(!Q ;/w*,#:vH`6lF}>ݟV1XMDqv 5/P\ƅ]h BH*Bv5I `bRΧzݕ^vZn@0.^2^ԮXt_A]F1T%ﵧ_НڮO0_)[3 0P'q%{fs~ΐ]"%8 qdˁ['JGissyw#T<03x)xO>3RN艋%6tOmCE?Kv S~n~me8p,6655&w53Z O3L.fD Ά mX'*?XB샿x&a9]>H,c߄k ,~l.-3PeBe #(oCПzteΤ#%Sw&|.˳.,}uA`[j`Kn֔:j"@9GI|R>؈[0p Z.XQ\9UVbP^&B\i{Tttr]?|T!'nlwÎg\_]߿/]srt5XzE`A(䩪V&ӷ|ỗr&jX)^ :~Mh06DF3>'1 O_>~ۙ4FuSgfQ *1IB M$?Ԅ,