Hi,
I just convert a jhp script to a gui app and ran into a strange problem:it
seems like I can not use mmap var in gui event handlers but other global
vars are OK.If I use a alias of mmap var then it will crash(j601 under both
linux and win).The code is as follows.Is it a bug or something i am doing
wrong?
Thanks.
Xu Zuoqian([EMAIL PROTECTED])
NB.In the following code,CELLDATA=: stkinfo 2600692 raise "id not found"
error.
NB.CELLDATA=:stksummary is OK.
NB.If alias iid=.id and change stkinfo to use iid then it will crash!
NB.========================================TESTING
CODE===============================
require 'jmf stats jzgrid'

NB.=========================================INIT======================================

homedir=:'/home/xuzq/j601/user/projects/finj/'
datadir=:homedir,'data/'

df_id=:datadir,'id.dat'
df_hislen=:datadir,'hislen.dat'
df_date=:datadir,'date.dat'
df_close=:datadir,'close.dat'
JINT map_jmf_ 'id';df_id;df_id;1
JINT map_jmf_ 'hislen';df_hislen;df_hislen;1
JINT map_jmf_ 'date';df_date;df_date;1
JFL map_jmf_ 'close';df_close;df_close;1
NB.=========================================LIB======================================

start=:}:@(+/\) 0,hislen
stop=:<:start+hislen

diff=:(}:@(1&|.)) - }:

summary=:('var';'len';'max';'min';'avg'),('id';'hislen';'date';'close') ,.
<"0 ((#`min`max`mean `:0)@>)"_1 id;hislen;date;close

stkinfo=:3 : 0
idx=.(#id)|(id i. y)
idx=.0:^:(1>#idx) idx
tid=.idx{id

begindate=.(idx{start){date
enddate=.(idx{stop){date
s=.((idx{start)+i.idx{hislen){close
yi=.diff ^. s

smin=.min s
smax=.max s
ymin=.min yi
ymax=.max yi

('id';tid),('begin';begindate),('end';enddate),('len';idx{hislen),('minP';smin),('minPdate';((idx{start)+s
i. smin){date),('maxP';smax),('maxPdate';((idx{start)+s i.
smax){date),('avgP';mean s),('minY';ymin),('minYdate';(>:(idx{start)+yi i.
ymin){date),('maxY';ymax),('maxYdate';(>:(idx{start)+yi i.
ymax){date),:('avgY';mean yi)
)
stksummary=:stkinfo 2600692
NB.===========================
==============GUI======================================
CELLDATA=:''
UI=: 0 : 0
pc ui;
pn "FinJ";
xywh 9 11 34 11;cc btnSummary button;cn "Summary";
xywh 50 11 50 11;cc txtTid edit;
xywh 105 11 34 13;cc btnStock button;cn "Stock";
xywh 148 12 34 11;cc btnMarket button;cn "Market";
xywh 469 9 34 11;cc btnQuit button;cn "Quit";
xywh 61 28 398 326;cc grid isigraph rightmove bottommove;
pas 0 0;pcenter;
rem form end;
)

ui_run=: 3 : 0
wd UI
wd 'set txtTid *',":{.id
grid=: '' conew 'jzgrid'
wd 'pshow;'
)

ui_close=: 3 : 0
destroy__grid ''
wd'pclose'
)

ui_btnQuit_button=: 3 : 0
ui_close ''
)

ui_btnSummary_button=: 3 : 0
CELLDATA=:summary
show__grid 'celldata'
)

ui_btnStock_button=: 3 : 0
NB.*****************************************ERROR
HERE****************************
CELLDATA=: stkinfo 2600692 NB.stksummary
NB.*******************************************************************************
show__grid 'celldata'
)

ui_btnMarket_button=: 3 : 0
)
ui_run 0
NB.=========================================CLEAN======================================
unmapall_jmf_''


回复转发
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to