nrn-iv/000775 001750 001750 00000000000 15004571024 013755 5ustar00matthiasmatthias000000 000000 nrn-iv/src/000775 001750 001750 00000000000 15004571024 014544 5ustar00matthiasmatthias000000 000000 nrn-iv/src/lib/000775 001750 001750 00000000000 15004571024 015312 5ustar00matthiasmatthias000000 000000 nrn-iv/src/lib/x11_dynam/000775 001750 001750 00000000000 15004571024 017113 5ustar00matthiasmatthias000000 000000 nrn-iv/src/lib/x11_dynam/x11_used_funs000755 001750 001750 00000003367 15004571024 021534 0ustar00matthiasmatthias000000 000000 XAllocColor XAllocWMHints XAutoRepeatOff XAutoRepeatOn XBell XChangeGC XChangeKeyboardControl XChangePointerControl XChangeProperty XCloseDisplay XCopyArea XCopyGC XCopyPlane XCreateBitmapFromData XCreateColormap XCreateFontCursor XCreateGC XCreateGlyphCursor XCreatePixmap XCreatePixmapCursor XCreateRegion XCreateSimpleWindow XCreateWindow XDefineCursor XDestroyRegion XDestroyWindow XDrawArc XDrawImageString XDrawLine XDrawLines XDrawPoint XDrawPoints XDrawRectangle XDrawString XDrawString16 XDrawText XEmptyRegion XEventsQueued XFillArc XFillPolygon XFillRectangle XFlush XFree XFreeCursor XFreeFont XFreeFontNames XFreeGC XFreePixmap XGetAtomName XGetErrorText XGetFontProperty XGetImage XGetVisualInfo XGetWindowAttributes XGetWindowProperty XGetWMHints XGrabPointer XInstallColormap XInternAtom XIntersectRegion XListFonts XLoadQueryFont XLookupKeysym XLookupString XLowerWindow XMapRaised XMapWindow XMoveResizeWindow XMoveWindow XNextEvent XOpenDisplay XParseColor XParseGeometry XPending XPolygonRegion XPutBackEvent XPutImage XQueryColor XQueryColors XQueryPointer XQueryTree XRaiseWindow XReadBitmapFile XRecolorCursor XResizeWindow XResourceManagerString XSelectInput XSendEvent XSetBackground XSetClassHint XSetClipMask XSetClipOrigin XSetClipRectangles XSetCommand XSetDashes XSetErrorHandler XSetFillStyle XSetFont XSetForeground XSetFunction XSetGraphicsExposures XSetIconName XSetLineAttributes XSetNormalHints XSetPlaneMask XSetRegion XSetSelectionOwner XSetStipple XSetSubwindowMode XSetTransientForHint XSetWindowBackground XSetWMHints XSetWMProtocols XStoreName XSync XSynchronize XTextExtents XTextExtents16 XTextWidth XTextWidth16 XTranslateCoordinates XUndefineCursor XUngrabPointer XUnionRectWithRegion XUnionRegion XUnmapWindow XWarpPointer XWindowEvent nrn-iv/src/lib/x11_dynam/mkdynam.py000664 001750 001750 00000016217 15004571024 021134 0ustar00matthiasmatthias000000 000000 # create include files that allows interviews to dynamically load # /usr/X11/lib/libX11.dylib # or, not, if XQuartz is not installed. # The overall strategy is, for every XFoo function used in InterViews, # (listed in x11_used_funs), # declare a (*iv_dynam_pXFoo) with proper prototype from the corresponding # XFoo in X11/Xlib.h, and fill in # the pointer when libX11.dylib is dynamically loaded. # Actually, we declare a pointer to every extern declared in Xlib.h, etc. ivinc = '../../include/IV-X11' xlibs = ["Xlib.h", "Xutil.h"] xincdir = '/usr/X11/include/X11' # my Mac, but see below. import sys if len(sys.argv) > 2: # see args of custom command in ../CMakeLists.txt ivinc = sys.argv[1] xincdir = sys.argv[2]+'/X11' print ("ivinc " + ivinc) print ("xincdir " + xincdir) exceptions_ = ['XSupportsLocale', 'XDefaultString', 'XKeycodeToKeysym'] def exception(line): for i in exceptions_: if i in line: return True return False #do not understand regular expression prog split. But note that our # prog.split(line) yields for the main cases... ''' ['extern int ', 'XWMGeometry', '(', '\n'] extern int XWMGeometry( ['extern int ', '_Xdebug', ';', '\n'] extern int _Xdebug; ['extern ', 'int', ' (', '*', 'XSynchronize', '(', '\n'] extern int (*XSynchronize( ['extern char **', 'XGetFontPath', '(', '\n'] extern char **XGetFontPath( ''' # Fortunately the X11 include files are formatted in such a uniform way # that simple regular expressions are sufficient for analysis and we can # avoid using full c language parsing. # Notice that name is always -3 in the list # that if -2 is ';' then it is a variable # and if -2 is a '(' then it is usually a function with just a few exceptions # ie. a '(' prior in the list to the name means the name is a function pointer. # In the variable case, the replacement for name is *ivdynam_name # and the assignment is ivdynam_name = &name; # In the function case, the replacement is (*ivdynam_name) # and the assignment is ivdynam_name = name; # In the function pointer case, the replacement for name is ivdynam_name_t # with the extern replaced by typedef and the line after the ';' is # ivdynam_name_t ivdyname_name; # with or without the extern # and the assignment is ivdynam_name = name; def x11_used_funs_(): lines = [i.rstrip() for i in open("x11_used_funs", "r").readlines()] return set(lines) x11_used_funs = x11_used_funs_() def varstyle(a): if ';' in a[-2]: s = 'var' elif '(' in ''.join(a[:-3]): s = 'pfun' else: s = 'fun' return s # assignment line def assign(a): name = a[-3] s = varstyle(a); if s == 'var': return 'ivdynam_%s = &%s;' % (name, name) return 'ivdynam_%s = %s;' % (name, name) # #define line def redef(a): name = a[-3] return '#undef %s\n#define %s (*ivdynam_%s)' % (name, name, name) #first line def declaration(a): s = varstyle(a) name = 'ivdynam_' + a[-3] if s == 'var': name = '*' + name elif s == 'fun': name = ('(*' + name + ')') elif s == 'pfun': name = name + '_t' line = ' '.join(a[0:-3] + [name, a[-2]]) if s == 'pfun': # replace extern by typedef line = 'typedef ' + ' '.join(line.split()[1:]) # will declare on line after ';' return line #first line def definition(a): if varstyle(a) == 'pfun': return declaration(a) # will define on line after ';' # remove the 'extern' return "IVX11EXTERN " + " ".join(declaration(a).split()[1:]) # these will be included in every file that calls an X11 function. declare_f = None # this will also contain a copy of all struct etc. redef_f = None # eg, #define XQueryFont (*ivdynam_XQueryFont) # these are used to create the file that associated every function with # a pointer. Note that define_f allows an earlier #include # since it does not (re)define structs. define_f = None # limited to the extern names. No define or struct assign_f = None # eg, ivdynam_XQueryFont = XQueryFont; def f_begin(prefix): f = open(ivinc+'/'+prefix+".h", "w") f.write(''' /* automatically generated by mkdynam.py */ #ifndef %s_h #define %s_h \n''' % (prefix, prefix)) return f def f_write(f, text): f.write(text + '\n') def f_end(f): f.write(''' #endif ''') f.close() def x11_externs_(lib): ivdynam_Xlib_h = [] import re prog = re.compile(r"([a-zA-Z0-9_]*)( *\(|;.*)") lines = open(lib, "r").readlines() state = 'looking for extern' declare_on = True for i, line in enumerate(lines): if "_X_DEPRECATED" in line: # Following is XKeycodeToKeysym, which is exception, and when # removed the following XLookupKeysym would be deprecated. # So just skip this. continue if "extern" in line and state == 'looking for extern': # exceptions where regex doesn't handle format declare_on = True if exception(line): declare_on = False # no output til after next ; for declare_f state = 'looking for ;' basename = None continue # assuming form 'extern type name(or;...' with some variation result = prog.search(line) if result: a = prog.split(line) name = a[-3] if name in x11_used_funs: x11_used_funs.remove(name) state = 'looking for ;' if ';' in line: state = 'looking for extern' if ';' in a[-2]: pass else: assert('(' in a[-2]) basename = a[-3] if varstyle(a) == 'pfun' else None f_write(redef_f, redef(a)) f_write(assign_f, assign(a)) f_write(define_f, definition(a)) f_write(declare_f, declaration(a)) else: # extern with no name. treat as exception declare_on = False state = 'looking for ;' basename = None elif state == 'looking for ;': if declare_on: f_write(define_f, line.rstrip()) f_write(declare_f, line.rstrip()) if ';' in line: state = 'looking for extern' declare_on = True if basename != None: s = 'ivdynam_%s_t* ivdynam_%s;' % (basename, basename) basename = None f_write(define_f, "IVX11EXTERN " + s) f_write(declare_f, 'extern ' + s) else: if declare_on: # only if not in an exception f_write(declare_f, line.rstrip()) # because we don't write to define_f here, that file # contains only the full declarations pass def mk(): global redef_f, assign_f, define_f, declare_f redef_f = f_begin("ivx11_redef") assign_f = f_begin("ivx11_assign") define_f = f_begin("ivx11_define") declare_f = f_begin("ivx11_declare") n = len(x11_used_funs) for lib in xlibs: z=x11_externs_(xincdir+'/'+lib) print (n) print (len(x11_used_funs)) f_end(redef_f) f_end(assign_f) f_end(define_f) f_end(declare_f) mk() nrn-iv/src/lib/x11_dynam/ivx11_dynamlib.cpp000664 001750 001750 00000000614 15004571024 022447 0ustar00matthiasmatthias000000 000000 extern "C" { /* all X11 structures, declarations, etc. */ #define XUTIL_DEFINE_FUNCTIONS #include #include /* just the pointer declarations corresponding to all extern X globals. */ #define IVX11EXTERN extern #include void ivx11_assign() { /* assign the X globals to the pointers */ #include } } /* extern "C" */ nrn-iv/src/lib/x11_dynam/ivx11_dynam.cpp000664 001750 001750 00000005273 15004571024 021766 0ustar00matthiasmatthias000000 000000 extern "C" { /* All X11 structures, declarations, etc. */ /* Do not know if this is needed here. */ #define XUTIL_DEFINE_FUNCTIONS /* X11 structures, #define, and pointer definitions corresponding * to all extern X globals. */ #include #define IVX11EXTERN /**/ #include } #include #include #include #include static void (*p_ivx11_assign)(); /** @brief dlopen libivx11dynam.so and call its ivx11_assign. * The library must be in the same directory as the shared library * that contains the address of ivx11_dyload. */ int ivx11_dyload() { // return 0 on success /* only load once */ if (p_ivx11_assign) { return 0; } /* see if ivx11_assign already loaded and if so use that */ p_ivx11_assign = (void(*)())dlsym(RTLD_DEFAULT, "ivx11_assign"); if (p_ivx11_assign) { (*p_ivx11_assign)(); return 0; } /* dynamically load libivx11dynam.so and call its ivx11_assign() */ /* figure out path of libivx11dynam.so * Assumes that library is in the same location as the library containing * this function. */ Dl_info info; int rval = dladdr((void*)ivx11_dyload, &info); std::string name; if (rval) { if (info.dli_fname) { name = info.dli_fname; if (info.dli_fname[0] == '/') { // likely full path // dlopen this with RTLD_GLOBAL to make sure the dlopen of libivx11dynam // will get its externs resolved (needed when launch python). if (!dlopen(name.c_str(), RTLD_NOW | RTLD_NOLOAD | RTLD_GLOBAL)) { printf("%s: RTLD_GLOBAL for %s\n", dlerror(), name.c_str()); return -1; } /* From the last '/' to the next '.' gets replaced by libivx11dynam */ size_t last_slash = name.rfind("/"); size_t dot = name.find(".", last_slash); if (dot == std::string::npos) { printf("Can't determine the basename (last '/' to next '.') in \"%s\"\n", name.c_str()); return -1; } size_t len = dot - (last_slash + 1); name.replace(last_slash+1, len, "libivx11dynam"); // keeps the .so or .dylib }else{ printf("Not a full path \"%s\"\n", name.c_str()); return -1; } }else{ printf("dladdr no DL_info.dli_fname\n"); return -1; } }else{ printf("%s\n", dlerror()); return -1; } int flag = RTLD_NOW | RTLD_GLOBAL; void* handle = dlopen(name.c_str(), flag); if (!handle) { //be quiet //printf("%s: for %s\n", dlerror(), name.c_str()); return -1; } p_ivx11_assign = (void(*)())dlsym(handle, "ivx11_assign"); if (p_ivx11_assign) { (*p_ivx11_assign)(); }else{ return -1; } return 0; } nrn-iv/src/lib/app-defaults/000775 001750 001750 00000000000 15004571024 017677 5ustar00matthiasmatthias000000 000000 nrn-iv/src/lib/app-defaults/InterViews000755 001750 001750 00000000345 15004571024 021724 0ustar00matthiasmatthias000000 000000 *PopupWindow*overlay: true *PopupWindow*saveUnder: on *TransientWindow*saveUnder: on *background: #ffffff *brush_width: 0 *double_buffered: on *flat: #aaaaaa *font: fixed *foreground: #000000 *synchronous: off *malloc_debug: off nrn-iv/src/lib/app-defaults/Idemo000755 001750 001750 00000000573 15004571024 020665 0ustar00matthiasmatthias000000 000000 Idemo*background: #7d9ec0 Idemo*font: *-helvetica-medium-r-*-*-*-120-* Idemo*rotation: 90 Idemo*title*foreground: gray20 Idemo*title*font: *-helvetica-medium-o-normal-*-*-120-* large*font: *-helvetica-medium-r-*-*-*-180-* large*title*font: *-helvetica-medium-o-normal-*-*-180-* Large*font: *-helvetica-medium-r-*-*-*-240-* Large*title*font: *-helvetica-medium-o-normal-*-*-240-* nrn-iv/src/lib/app-defaults/Doc000755 001750 001750 00000023343 15004571024 020335 0ustar00matthiasmatthias000000 000000 Doc*default_text_menubar: text_menubar Doc*text_menubar:\ (menu text_file_menu) File\n\ (menu text_edit_menu) Edit\n\ (menu text_font_menu) Font\n\ (menu text_size_menu) Size\n\ (menu text_color_menu) Color\n\ (menu text_align_menu) Alignment\n\ (menu text_macro_menu) Macro\n\ (menu text_item_menu) Item\n\ (menu text_special_menu) Special Doc*text_file_menu:\ [] (viewer new) New\\hfil\n\ [] (viewer open) Open ...\\hfil\n\ [] (viewer save) Save\\hfil\\quad^S\n\ [] (viewer saveas) Save as ...\\hfil\n\ [] (viewer print) Print\\hfil\n\ \n\ [] (viewer view) New view\\hfil\n\ [] (viewer close) Close\\hfil\n\ [] (application quit) Quit\\hfil Doc*text_edit_menu:\ [] (clip cut) Cut\\hfil\\quad^X\n\ [] (clip copy) Copy\\hfil\\quad^C\n\ [] (clip paste) Paste\\hfil\\quad^V\n\ \n\ [] (select all) Select all\\hfil\n\ [] (select paragraph) Select paragraph\\hfil\\quad^U\n\ [] (select word) Select word\\hfil\\quad^W\n\ \n\ [] (go beginning) Go to beginning\\hfil\n\ [] (go end) Go to end\\hfil Doc*text_font_menu:\ (font Times-Roman)\ Times Roman\\hfil\\quad\\size{14}\\font{Times-Roman}Gnu\n\ (font Times-Bold)\ Times Bold\\hfil\\quad\\size{14}\\font{Times-Bold}Gnu\n\ (font Times-Italic)\ Times Italic\\hfil\\quad\\size{14}\\font{Times-Italic} Gnu\n\ (font Courier)\ Courier\\hfil\\quad\\size{14}\\font{Courier} Gnu\n\ (font Helvetica)\ Helvetica\\hfil\\quad\\size{14}\\font{Helvetica} Gnu\n\ (font Symbol)\ Symbol\\hfil\\quad\\size{14}\\font{Symbol} Gnu\n\ \n\ []<> (font)\ Other font ...\\hfil Doc*text_size_menu:\ <6> (size 6)\ 6 point\\hfil\\quad\\font{Times-Roman}\\size{6} Gnu\n\ <8> (size 8)\ 8 point\\hfil\\quad\\font{Times-Roman}\\size{8} Gnu\n\ <10> (size 10)\ 10 point\\hfil\\quad\\font{Times-Roman}\\size{10} Gnu\n\ <12> (size 12)\ 12 point\\hfil\\quad\\font{Times-Roman}\\size{12} Gnu\n\ <14> (size 14)\ 14 point\\hfil\\quad\\font{Times-Roman}\\size{14} Gnu\n\ <18> (size 18)\ 18 point\\hfil\\quad\\font{Times-Roman}\\size{18} Gnu\n\ <24> (size 24)\ 24 point\\hfil\\quad\\font{Times-Roman}\\size{24} Gnu\n\ <30> (size 30)\ 30 point\\hfil\\quad\\font{Times-Roman}\\size{30} Gnu\n\ \n\ []<> (size)\ Other size ...\\hfil Doc*text_color_menu:\ (color black)\ black\\hfil\\quad\\font{Times-Roman}\\size{14}\\color{black} Gnu\n\ (color red)\ red\\hfil\\quad\\font{Times-Roman}\\size{14}\\color{red} Gnu\n\ (color green)\ green\\hfil\\quad\\font{Times-Roman}\\size{14}\\color{green} Gnu\n\ (color blue)\ blue\\hfil\\quad\\font{Times-Roman}\\size{14}\\color{blue} Gnu\n\ \n\ []<> (color)\ Other color ...\\hfil Doc*text_align_menu:\ (align left) Align left\\hfil\n\
(align center) Center\\hfil\n\ (align right) Align right\\hfil\n\ (align justify) Justify\\hfil Doc*text_macro_menu:\ [] (macro chapter) Chapter\\hfil\n\ []
(macro section) Section\\hfil\n\ [] (macro subsection) Subsection\\hfil\n\ [] (macro itemized) Itemized\\hfil\n\ [] (macro enumerated) Enumerated\\hfil\n\ [] (macro referenced) Referenced\\hfil\n\ []
(macro figure) Figure\\hfil\n\ [] (macro table) Table\\hfil\n\ \n\ []<> (macro) Other macro ...\\hfil Doc*text_item_menu:\ [] (item psfig) Import graphic ...\\hfil\n\ [] (item import) Import text file ...\\hfil\n\ [] (item parbox) Parbox ...\\hfil\n\ [] (item float) Float ...\\hfil\n\ [] (item tabular) Tabular ...\\hfil\n\ []