

18!:4 <'jcfg'

FKEYQ=: 197 { a.           
MAXSMSTYLE=: IFJAVA { 3 2  
SMCOLORORG=: ''            
val=: 3;''

0!:0 < jpath '~system\extras\config\colordef.ijs'

cfv=: 3 : 0
USERNAME=: deb USERFNAME,' ',USERLNAME
val=: 3;''
0!:0 :: ] <jpath '~system\extras\util\jul.ijl'
0 pick val
)

cutfolders=: 3 : 0
j=. <;._2 y.
ndx=. j i.&> ' '
nms=. ndx {.each j
pth=. jpath each deb each (ndx+1) }.each j
nms,.pth
)

deb=: #~ (+. (1: |. (> </\)))@(' '&~:)

wdc=: 3 : 0
try. wd y.
catch.
  err=. wd 'qer'
  ndx=. >: err i. ':'
  msg=. ndx {. err
  pos=. {. ". ndx }. err
  cmd=. (>:j i.';') {. j=. pos}.y.
  if. 50 < #cmd do.
    cmd=. (47{.cmd),'...' end.
  wdinfo 'Window Driver';'wd error ',msg,LF,cmd
end.
)

cfread=: 3 : 0
0!:0 <jpath '~system\extras\config\stdcfg.ijs'
if. UNAME -: 'Darwin' do. JAVALAF=: 'Mac' end.
0!:0 :: ] <jpath '~config\config.ijs'
OUTPUT=: 0, }. OUTPUT
NEWUSER=: 1 <. NEWUSER + cfv''
USERFOLDERS=: cutfolders USERFOLDERS
)

configure=: 3 : 0
if. y.=0 do.
  cfread''
end.
configrun y.
configdel ''
)

configrun=: 3 : 0

9!:3 DISPLAYFORM
9!:7 BOXFORM { BOXES
9!:11 PRINTPREC
9!:17 BOXPOS
9!:21 (2&^ ^: (<&_)) MEMORYLIM
9!:37 OUTPUT

if. IFJAVA do.
  FIXFONT_z_=: FIXFONTJ
  PROFONT_z_=: PROFONTJ
else.
  FIXFONT_z_=: FIXFONTW
  PROFONT_z_=: PROFONTW
end.

if. IFJAVA do.
  a=. _2 [\ <;._2 wd 'javalaf'
  nms=. 0 {"1 a
  ndx=. (#nms) | nms i. <JAVALAF
  val=. > (<ndx;1) { a
  wd 'javasetlaf *',val
end.

BROWSER_j_=: BROWSER
DIRTREEX_j_=: DIRTREEX
EPSREADER_j_=: EPSREADER
PDFREADER_j_=: PDFREADER
FORMSIZES_j_=: FORMSIZES
P2UPFONT_j_=: P2UPFONT
SMPRINT_j_=: SMPRINT
PRINTERFONT_j_=: PRINTERFONT
PRINTOPT_j_=: PRINTOPT
XDIFF_j_=: XDIFF
USERFOLDERS_j_=: USERFOLDERS

clr=. getcolors SMCOLOR
if. -. clr -: SMCOLORORG do.
  setcolors clr
end.

set_fkeys_jijs_ FKEYS
set_skeys_jijs_ SKEYS

SMINIT_jijs_=: SMINIT
SMSIZE_jijs_=: SMSIZE
SMSTYLE_jijs_=: MAXSMSTYLE <. SMSTYLE
NEWUSER_jijs_=: NEWUSER
wdc 'fontdef ',PROFONT

if. y. do.
  setfontall_jijs_ FIXFONT
  setpnall_jijs_ ''
  wd 'psel ',JCFH
end.

if. y.=0 do.
  if. 1!:4 :: 0: <STARTUP do.
    startup=. STARTUP
    18!:4 <'base'
    try.
      load startup
    catch.
      wdinfo 'J Profile';'An error occurred when loading startup script: ',startup
    end.
    18!:4 <'jcfg'
  end.
end.
)

configdel=: coerase bind (<'jcfg')


BOXES=: ];._2 (0 : 0)
ÚÂ¿ÃÅ´ÀÁÙ³Ä
+++++++++|-
)

toblank=: ' '&(I. @(e.&'_')@]})
tounder=: '_'&(I. @(e.&' ')@]})

getsyskey=: 3 : '". @ tounder each y.'

SYSCOLORS=: 0 1 2 3 4 5 6 7  
CLSCOLORS=: 20 21 22 23 24 25 26 27 28 29  
USRCOLORS=: 40+i.20

SYSCOLORNAMES=: <;._2 (0 : 0)
background
text
selection background
selection text
margin
mark
lab text background
lab text foreground
)

CLSCOLORNAMES=: <;._2 (0 : 0)
primitive
name
number
string
comment
open quote
unmatched parenthesis
global assignment
local assignment
close definition
)

KEYCOLORNAMES=: <;._2 (0 : 0)
adverbs
arguments
box drawing
conjunctions
control words
nouns
verbs
)

UKEYCOLORNAMES=: tounder each KEYCOLORNAMES

USRCOLORNAMES=: ''

FIXCOLORS=: SYSCOLORS,CLSCOLORS
FIXCOLORNAMES=: SYSCOLORNAMES,CLSCOLORNAMES

JStandard=: 0 : 0
 0 255 255 255 0 0
 1   0   0   0 0 0
 6 228 228 228 0 0
23   0   0 255 0 0
24   0 128   0 0 0
25 255   0 255 0 0
26 255   0 255 0 0
40 255   0   0 0 0 control_words
)

on=: @:
deb=: #~ (+. 1: |. (> </\))@(' '&~:)

getcolors=: 3 : 0
if. 0 e. $ y. do. i.0 6 return. end.
getcolor4 ;._2 y.
)

getcolor4=: 3 : 0
dat=. deb y.
ndx=. (dat e. '0123456789 ') i. 0
num=. 6 {. ". ndx {. dat
num=. ({.num);(1 2 3{num);(4{num);5{num
dat=. ndx }. dat
ndx=. dat i. ' '
key=. tounder ndx {. dat
if. (<key) e. UKEYCOLORNAMES do.
  val=. ". key
else.
  val=. (ndx+1) }. dat
end.
num,key;val
)

setcolors=: 3 : 0

wd ,';smkeywords ' ,"1 ": ,. USRCOLORS

wd 'smcolor'

if. 0 e. $y. do. return. end.

nums=. > 0 {"1 y.
vals=. > 1 {"1 y.
ital=. > (> 2 {"1 y.) { '';' italic '
unds=. > (> 3 {"1 y.) { '';' underline '
keys=. 4 {"1 y.
sets=. 5 {"1 y.

if. 0 e. 2 3 e. nums do.
  ndx=. nums i. 0 1
  nums=. nums, 3 2
  msk=. ~: nums
  nums=. msk # nums
  vals=. msk # vals, ndx{vals
  ital=. msk # ital, ndx{ital
  unds=. msk # unds, ndx{unds
  keys=. msk # keys, ndx{keys
  sets=. msk # sets, ndx{sets
end.

b=. keys e. KEYCOLORNAMES
if. 1 e. b do.
  ndx=. I. b
  keys=. (getsyskey ndx{keys) ndx} keys
end.

b=. nums e. USRCOLORS
if. 1 e. b do.
  j=. <"1 ';smkeywords ' ,"1 (": ,. b#nums) ,"1 ' ',EAV
  wd ; j ,each (b#sets) ,each EAV
end.

wd ,';smcolor ' ,"1 (": nums ,. vals) ,. ital ,. unds

)

