Skip to content

Commit

Permalink
change export not to perform full lookup
Browse files Browse the repository at this point in the history
this is better behavior and also tends to reduce annoying error messages
about explicit importing.
fix imports/exports in cairo
  • Loading branch information
JeffBezanson committed Nov 6, 2012
1 parent 1dcd432 commit 39bf2fd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
7 changes: 2 additions & 5 deletions examples/winston_tk.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
load("plot.jl")
load("tk.jl")

import Tk.*
import Cairo.*
import Winston.*
import Plot.*
using Tk, Cairo, Winston, Plot

function TkRenderer(name, w, h)
win = Window(name, w, h)
Expand All @@ -27,6 +24,6 @@ end

function imagesc(I)
h, w = size(I)
pl = imagesc((0,w),(0,h),I)
pl = Plot.imagesc((0,w),(0,h),I)
tk(pl, w, h)
end
6 changes: 5 additions & 1 deletion extras/cairo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export CairoSurface, finish, destroy, status,
open, close, curve, polygon, layout_text, text, textwidth, textheight,
TeXLexer, tex2pango, SVGRenderer

import Base.get

global fill, open, close, symbol

try
global _jl_libcairo = openlib("libcairo")
global _jl_libpangocairo = openlib("libpangocairo-1.0")
Expand Down Expand Up @@ -72,7 +76,7 @@ end

for name in ("destroy","finish","flush","mark_dirty")
@eval begin
$(symbol(name))(surface::CairoSurface) =
$(Base.symbol(name))(surface::CairoSurface) =
ccall(dlsym(_jl_libcairo,$(strcat("cairo_surface_",name))),
Void, (Ptr{Void},), surface.ptr)
end
Expand Down
12 changes: 4 additions & 8 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,10 @@ void jl_module_export(jl_module_t *from, jl_sym_t *s)
{
jl_binding_t **bp = (jl_binding_t**)ptrhash_bp(&from->bindings, s);
if (*bp == HT_NOTFOUND) {
jl_binding_t *b = jl_get_binding(from, s);
bp = (jl_binding_t**)ptrhash_bp(&from->bindings, s);
if (b == NULL) {
b = new_binding(s);
// don't yet know who the owner is
b->owner = NULL;
*bp = b;
}
jl_binding_t *b = new_binding(s);
// don't yet know who the owner is
b->owner = NULL;
*bp = b;
}
assert(*bp != HT_NOTFOUND);
(*bp)->exportp = 1;
Expand Down

0 comments on commit 39bf2fd

Please sign in to comment.